Merge commit 'fc702a6210d901cd3beea220e72f71a3b7f7d41e' into sidebar_config
Conflicts: app/controllers/admin/page_parts_controller.rb app/controllers/default_widget_controller.rb app/uploaders/gprs_uploader.rb app/uploaders/location_uploader.rb app/views/admin/page_parts/_module_widget.html.erb app/views/admin/page_parts/reload_widget_styles.js.erb app/views/admin/page_parts/reload_widgets.js.erb app/views/layouts/_side_bar_content.html.erb config/locales/zh_tw.yml lib/parsers/parser_front_end.rb vendor/built_in_modules/announcement/init.rb vendor/built_in_modules/gprs/app/assets/javascripts/panel/gprs/back_end/locations.js vendor/built_in_modules/gprs/app/assets/stylesheets/panel/gprs/back_end/locations.css vendor/built_in_modules/gprs/app/controllers/panel/gprs/back_end/locations_controller.rb vendor/built_in_modules/gprs/app/views/panel/gprs/back_end/locations/index.html.erb vendor/built_in_modules/gprs/test/functional/panel/gprs/back_end/locations_controller_test.rb vendor/built_in_modules/location/README.rdoc vendor/built_in_modules/location/app/assets/javascripts/panel/gprs/back_end/locations.js vendor/built_in_modules/location/app/assets/javascripts/panel/location/back_end/locations.js vendor/built_in_modules/location/app/assets/stylesheets/panel/gprs/back_end/locations.css vendor/built_in_modules/location/app/assets/stylesheets/panel/location/back_end/locations.css vendor/built_in_modules/location/app/controllers/panel/location/back_end/locations_controller.rb vendor/built_in_modules/location/app/controllers/panel/locations/back_end/locations_controller.rb vendor/built_in_modules/location/app/models/location.rb vendor/built_in_modules/location/app/uploaders/locations_uploader.rb vendor/built_in_modules/location/app/views/panel/location/back_end/locations/index.html.erb vendor/built_in_modules/location/app/views/panel/locations/back_end/locations/_form.html.erb vendor/built_in_modules/location/app/views/panel/locations/back_end/locations/edit.html.erb vendor/built_in_modules/location/app/views/panel/locations/back_end/locations/index.html.erb vendor/built_in_modules/location/app/views/panel/locations/back_end/locations/new.html.erb vendor/built_in_modules/location/config/routes.rb vendor/built_in_modules/location/lib/location.rb vendor/built_in_modules/location/location.gemspec vendor/built_in_modules/location/test/functional/panel/gprs/back_end/locations_controller_test.rb vendor/built_in_modules/location/test/functional/panel/location/back_end/locations_controller_test.rb
This commit is contained in:
commit
bfaa22052f
248 files changed
+6732
-2502
No files matched your search
+4
-17
@@ -5,7 +5,10 @@ class AdImage
|
||||
mount_uploader :file, ImageUploader
|
||||
|
||||
field :title, localize: true
|
||||
field :context, localize: true
|
||||
field :context, localize: true
|
||||
field :to_save, :type => Boolean
|
||||
field :to_destroy, :type => Boolean
|
||||
|
||||
|
||||
field :direct_to_after_click,type: Boolean
|
||||
|
||||
@@ -16,28 +19,12 @@ class AdImage
|
||||
|
||||
field :post_date,type: Date
|
||||
field :unpost_date,type: Date
|
||||
|
||||
field :to_save, :type => Boolean
|
||||
field :to_destroy, :type => Boolean
|
||||
|
||||
belongs_to :ad_banner
|
||||
|
||||
# validates_numericality_of :weight, greater_than_or_equal_to: 1,less_than_or_equal_to: 10
|
||||
# validates_format_of :out_link, with: /(http:\/\/.*|)/ ,:message => 'Need a valid URL'
|
||||
attr_reader :parse_post_date,:parse_unpost_date
|
||||
|
||||
before_validation :add_http
|
||||
validates :out_link, :format => /^(http|https):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(([0-9]{1,5})?\/.*)?$/ix, :allow_blank => true
|
||||
|
||||
def parse_post_date=(att)
|
||||
self.post_date = (Date.parse att.gsub(/\s+/, "") rescue nil)
|
||||
end
|
||||
|
||||
|
||||
def parse_unpost_date=(att)
|
||||
self.unpost_date = (Date.parse att.gsub(/\s+/, "") rescue nil)
|
||||
end
|
||||
|
||||
def display?
|
||||
if (self.post_date <= Date.today && (self.unpost_date.nil? || self.unpost_date>= Date.today) rescue false)
|
||||
return true
|
||||
|
||||
@@ -163,6 +163,16 @@ class ModuleApp
|
||||
end
|
||||
end
|
||||
|
||||
def has_default_widget?
|
||||
case self[:widgets]
|
||||
when Array
|
||||
false
|
||||
when Hash
|
||||
self[:widgets].has_key? 'default_widget'
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def set_key
|
||||
|
||||
@@ -23,6 +23,15 @@ class PagePart
|
||||
before_save :delete_empty_widget_field
|
||||
after_save :update_parent
|
||||
|
||||
# def module_app
|
||||
# if self[:module_app]
|
||||
# self[:module_app]
|
||||
# elsif self[:kind] == 'module_widget'
|
||||
# self.page.module_app
|
||||
# else
|
||||
# nil
|
||||
# end
|
||||
# end
|
||||
|
||||
protected
|
||||
|
||||
@@ -37,5 +46,4 @@ class PagePart
|
||||
self.page.save
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
@@ -6,7 +6,9 @@ class Attribute
|
||||
field :key
|
||||
field :built_in, :type => Boolean, :default => false
|
||||
field :disabled, :type => Boolean, :default => false
|
||||
field :title, localize: true
|
||||
field :title, localize: true
|
||||
|
||||
field :to_search, :type => Boolean, :default => false
|
||||
|
||||
has_many :attribute_fields, :autosave => true, :dependent => :destroy
|
||||
accepts_nested_attributes_for :attribute_fields, :allow_destroy => true
|
||||
|
||||
@@ -11,6 +11,9 @@ class AttributeField
|
||||
field :built_in, :type => Boolean, :default => false
|
||||
field :disabled, :type => Boolean, :default => false
|
||||
field :to_delete,:type=> Boolean,:default => false
|
||||
|
||||
field :to_search,:type=> Boolean,:default => false
|
||||
|
||||
field :typeA,:type=> Hash,:default=>{:cross_lang=>false}
|
||||
field :typeB,:type=> Hash,:default=>{}
|
||||
field :typeC,:type=> Hash,:default=>{:calendar=>"west_calendar",:format=>"format3"}
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
class CoAuthor
|
||||
include Mongoid::Document
|
||||
|
||||
LANGUAGE_TYPES = [ "English", "Chinese" ]
|
||||
|
||||
field :name_id, type: BSON::ObjectId
|
||||
field :co_author, localize: true
|
||||
field :email
|
||||
|
||||
belongs_to :co_author_relations
|
||||
|
||||
VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/
|
||||
validates :email, format: { with: VALID_EMAIL_REGEX },
|
||||
allow_blank: true,
|
||||
uniqueness: { case_sensitive: false }
|
||||
|
||||
validates :co_author, presence: true
|
||||
before_save { |coauthor| coauthor.email = email.downcase if not coauthor.email.nil?}
|
||||
end
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
class CoAuthorRelation
|
||||
include Mongoid::Document
|
||||
include Mongoid::Timestamps
|
||||
|
||||
field :relation, localize: true
|
||||
|
||||
has_and_belongs_to_many :co_authors
|
||||
|
||||
validates :relation, presence: true,
|
||||
uniqueness: { case_sensitive: false }
|
||||
end
|
||||
@@ -1,4 +1,4 @@
|
||||
class Role
|
||||
class Role < Attribute
|
||||
|
||||
include Mongoid::Document
|
||||
include Mongoid::Timestamps
|
||||
@@ -6,12 +6,13 @@ class Role
|
||||
field :key
|
||||
field :built_in, :type => Boolean, :default => false
|
||||
field :disabled, :type => Boolean, :default => false
|
||||
|
||||
field :title, localize: true
|
||||
|
||||
has_many :sub_roles, :autosave => true, :dependent => :destroy
|
||||
has_many :users
|
||||
has_many :statuses, :autosave => true, :dependent => :destroy
|
||||
has_many :attribute_fields, :autosave => true, :dependent => :destroy
|
||||
# has_many :attribute_fields, :autosave => true, :dependent => :destroy
|
||||
accepts_nested_attributes_for :sub_roles, :allow_destroy => true
|
||||
|
||||
def is_built_in?
|
||||
|
||||
+21
-2
@@ -72,14 +72,32 @@ class User
|
||||
sub_roles.where(role_id: role.id)
|
||||
end
|
||||
|
||||
def disable_sub_role=(var)
|
||||
def disable_role=(var)
|
||||
var[:id].each do |id,val|
|
||||
# binding.pry if id == '5052c5b22b5c49ab02000004'
|
||||
if (val=="true")
|
||||
self.roles = self.roles.reject{|t| t.id.to_s==id}
|
||||
elsif(val=="false")
|
||||
self.roles << Role.find(id)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def disable_sub_role=(var)
|
||||
var[:id].each do |id,val|
|
||||
|
||||
@sr = SubRole.find(id)
|
||||
|
||||
@roid = Role.find(@sr.role_id.to_s)
|
||||
|
||||
# binding.pry if id == '5052c5b22b5c49ab02000004'
|
||||
|
||||
if ( self.roles.include?(@roid) == false or val=="true")
|
||||
self.sub_roles = self.sub_roles.reject{|t| t.id.to_s==id}
|
||||
elsif(val=="false")
|
||||
self.sub_roles << SubRole.find(id)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -189,7 +207,8 @@ class User
|
||||
|
||||
protected
|
||||
def save_roles
|
||||
self.roles = self.sub_roles.collect{|t| t.role}.uniq
|
||||
# self.roles = self.sub_roles.collect{|t| t.role}.uniq
|
||||
self.roles = self.roles.uniq
|
||||
end
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user