Merge commit 'e429aa9425e9648a94a1dd7bb5cea15af7ba854a' into sidebar_config

Conflicts:
	app/views/layouts/_side_bar_content.html.erb
	config/locales/zh_tw.yml
	config/mongoid.yml
	vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletin_categorys_controller.rb
	vendor/built_in_modules/announcement/init.rb
This commit is contained in:
Matthew K. Fu JuYuan committed 2012-12-05 11:36:32 +08:00
commit ca290f3519
262 files changed
+7692 -2403

No files matched your search

Binary file not shown.
+5
View File
@@ -10,6 +10,7 @@ class Layout < DesignFile
embeds_many :layout_parts
before_save :parse_layout
after_save :save_pages
def content
self.file.read.force_encoding("UTF-8") rescue ''
@@ -24,5 +25,9 @@ class Layout < DesignFile
self.body = html.at_css("body").inner_html
parse_body(self)
end
def save_pages
self.design.pages.each(&:generate_parts)
end
end
+9
View File
@@ -26,6 +26,15 @@ class Page < Item
# embeds_many :custom_images, :class_name => 'Image', as: :design_image
def generate_parts
page_design = self.design
page_design.layout.layout_parts.each do |layout_part|
current_part = self.page_parts.detect{|page_part| page_part.name.eql?(layout_part.name)}
current_part = self.page_parts.build(:name => layout_part.name) unless current_part
current_part.save if current_part.new_record?
end
end
protected
def create_parts
+1 -1
View File
@@ -12,7 +12,7 @@ class AttributeField
field :to_delete,:type=> Boolean,:default => false
field :typeA,:type=> Hash,:default=>{:cross_lang=>false}
field :typeB,:type=> Hash,:default=>{}
field :typeC,:type=> Hash,:default=>{:claendar=>"west_claendar",:format=>"format3"}
field :typeC,:type=> Hash,:default=>{:calendar=>"west_calendar",:format=>"format3"}
field :typeD,:type=> Hash,:default=>{:cross_lang=>false}
field :typeE,:type=> Hash,:default=>{}
field :title, localize: true
+5 -4
View File
@@ -6,14 +6,15 @@ class CoAuthor
field :name_id, type: BSON::ObjectId
field :co_author, localize: true
field :email
field :type
belongs_to :co_author_relations
VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i
VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/
validates :email, format: { with: VALID_EMAIL_REGEX },
uniqueness: { case_sensitive: false }
allow_blank: true,
uniqueness: { case_sensitive: false }
validates :co_author, presence: true
before_save { |coauthor| coauthor.email = email.downcase }
before_save { |coauthor| coauthor.email = email.downcase if not coauthor.email.nil?}
end
+11
View File
@@ -0,0 +1,11 @@
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
+2 -2
View File
@@ -3,7 +3,7 @@ class User
include Mongoid::Document
include Mongoid::Timestamps
devise :database_authenticatable, :recoverable, :rememberable, :trackable, :registerable
devise :database_authenticatable, :recoverable, :rememberable, :trackable, :registerable, :validatable, :timeoutable
mount_uploader :avatar, AvatarUploader
@@ -194,4 +194,4 @@ class User
end
end
end
end