Merge branch 'sidebar_config' into ntu

Conflicts:
	app/controllers/admin/object_auths_new_interface_controller.rb
	app/controllers/orbit_backend_controller.rb
	app/controllers/orbit_widget_controller.rb
	app/models/module_app.rb
	app/views/admin/page_parts/_module_widget.html.erb
	config/locales/zh_tw.yml
	lib/parsers/parser_common.rb
	lib/parsers/parser_front_end.rb
This commit is contained in:
Fu Matthew committed 2013-01-08 14:17:21 +08:00
commit 76296ab29b
160 files changed
+8659 -1037

No files matched your search

+3 -3
View File
@@ -48,16 +48,16 @@ class Item
new_parent = Item.find(new_parent)
current_position_sibling = find_by_parent_and_position(new_parent, position.to_i)
if current_position_sibling
current_position_sibling.at_bottom? ? move_below(current_position_sibling) : move_above(current_position_sibling)
move_above(current_position_sibling)
elsif self.parent != new_parent
self.parent = new_parent
save!
save
end
end
end
def show_in_sitemap_for(locale)
if !sitemap_enabled[locale].blank?
if sitemap_enabled && !sitemap_enabled[locale].blank?
sitemap_enabled[locale].eql?('true') ? true : false
else
true
+27
View File
@@ -6,6 +6,24 @@ class ModuleApp
field :key
field :title
field :version
field :organization
field :author
field :intro
field :update_info
field :create_date
field :enable_frontend, type: Boolean, :default => true
field :app_pages ,type: Array
# field :widgets ,type: Array
field :widgets ,type: Hash
field :widget_fields ,type: Array
field :widget_options,type:Hash
field :widget_options_fields_i18n,type:Hash
field :widget_fields_link_method,type:Hash
field :get_default_widget,type:Hash
has_many :managers,as: :managing_app ,:class_name => "AppManager" ,:dependent => :destroy#,:foreign_key => "managing_app_id",:inverse_of => :managing_app
has_many :sub_managers,as: :sub_managing_app ,:class_name => "AppManager", :dependent => :destroy#,:foreign_key => "sub_managing_app_id",:inverse_of => :sub_managing_app
@@ -132,10 +150,19 @@ class ModuleApp
end
end
def label
I18n.t(label_i18n)
end
def needs_to_widget_option?
if self.widget_options
self.widget_options.has_key? widgets.first
else
false
end
end
protected
def set_key
+8 -7
View File
@@ -24,9 +24,8 @@ class Page < Item
has_many :page_metas, :autosave => true, :dependent => :destroy
accepts_nested_attributes_for :page_parts, :allow_destroy => true
before_save :delete_empty_frontend_field
before_save :create_parts, if: Proc.new { |page| page.new_record? || page.design_id_changed? }
after_save :generate_html
before_save :delete_empty_frontend_field, :generate_html
protected
@@ -37,7 +36,8 @@ class Page < Item
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
if menu_part && current_part.name.eql?(menu_part.name)
if menu_part && current_part.name.eql?(menu_part.name)
if current_part.new_record?
current_part.kind = menu_part.kind
current_part.public_r_tag = menu_part.public_r_tag
@@ -50,6 +50,10 @@ class Page < Item
current_part.update_attributes(:kind => menu_part.kind, :public_r_tag => menu_part.public_r_tag, :public_r_tag_object_id => menu_part.public_r_tag_object_id)
end
end
elsif current_part.new_record?
PagePart.without_callback(:save, :after, :update_parent) do
current_part.save
end
end
end
end
@@ -67,10 +71,7 @@ class Page < Item
end
def generate_html
Page.without_callback(:save, :after, :generate_html) do
self.content_translations = parse_page_noko(self, Site.first)
self.save
end
self.content_translations = parse_page_noko(self, Site.first)
end
end
+3
View File
@@ -14,6 +14,7 @@ class PagePart
field :widget_style
field :widget_field , :type => Array
field :widget_options ,:type=>Hash
field :widget_data_count
belongs_to :page
@@ -22,6 +23,7 @@ class PagePart
before_save :delete_empty_widget_field
after_save :update_parent
protected
def delete_empty_widget_field
@@ -35,4 +37,5 @@ class PagePart
self.page.save
end
end
+2
View File
@@ -25,6 +25,8 @@ class Site
field :title, localize: true
field :footer, localize: true
field :sub_menu, localize: true
field :mobile_on, :type => Boolean, :default => false
belongs_to :design
has_many :site_metas, :autosave => true, :dependent => :destroy
+43 -2
View File
@@ -1,4 +1,45 @@
class Tag < ProtoTag
belongs_to :module_app
# class Tag < ProtoTag
# belongs_to :module_app
# end
class Tag
include Mongoid::Document
include Mongoid::Timestamps
include Impressionist::Impressionable
is_impressionable :counter_cache => { :column_name => :view_count }
field :key
field :view_count, :type => Integer, :default => 0
#field :cloud_amper,:type: Integer,:default=> 0
def self.sorted_for_cloud
tags = {}
self.all.each{ |tag|
tags.merge!({tag => self.get_impressionist(tag)})
}
if !tags.blank?
sorted_tags = tags.sort{|a,b| a[1]<=>b[1]}.reverse
sorted_tags[0][1] = :hot1
offset = (sorted_tags.size - 1) / 3
i = 1
class_i = 2
sorted_tags[1..-1].collect!{ |x|
x[1] = "hot#{class_i}"
i == offset ? i = 1 : i += 1 if class_i < 4
class_i += 1 if i == offset && class_i < 4
}
sorted_tags
else
[]
end
end
protected
def self.get_impressionist(item_tag = self)
item_tag.impressions.where(:created_at.gte=> 14.days.ago,:created_at.lte => Time.now).count
end
end
+1 -1
View File
@@ -3,7 +3,7 @@ class User
include Mongoid::Document
include Mongoid::Timestamps
devise :database_authenticatable, :recoverable, :rememberable, :trackable, :registerable, :validatable, :timeoutable
devise :database_authenticatable, :recoverable, :rememberable, :trackable, :registerable, :validatable #, :timeoutable
mount_uploader :avatar, AvatarUploader