Merge branch 'master' into ldap
Conflicts: Gemfile Gemfile.lock app/views/admin/attributes/_app_selector.html.erb app/views/admin/module_apps/_app_selector.html.erb app/views/admin/pages/_app_selector.html.erb vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletin_categorys_controller.rb
This commit is contained in:
commit
198825a309
256 files changed
+4631
-4327
No files matched your search
+20
-29
@@ -4,41 +4,32 @@ class AdBanner
|
||||
include Mongoid::MultiParameterAttributes
|
||||
|
||||
field :title
|
||||
field :picture_position
|
||||
field :post_date,type: Date
|
||||
field :unpost_date,type: Date
|
||||
field :context
|
||||
field :direct_to_after_click,type: Boolean
|
||||
field :transition_sec,type: Integer
|
||||
field :ad_fx #TODO Design should explain
|
||||
|
||||
|
||||
|
||||
before_save :save_or_destroy
|
||||
|
||||
embeds_many :ad_images, :cascade_callbacks => true
|
||||
validates_uniqueness_of :title
|
||||
has_many :ad_images , dependent: :delete
|
||||
|
||||
FX_TYPES = ["blindX","blindY","blindZ","cover","curtainX","curtainY","fade","fadeZoom","growX","growY","scrollUp","scrollDown","scrollLeft","scrollRight","scrollHorz","scrollVert","shuffle","slideX","slideY","toss","turnUp","turnDown","turnLeft","turnRight","uncover","wipe","zoom"]
|
||||
|
||||
def display?
|
||||
if (self.post_date <= Date.today && (self.unpost_date.nil? || self.unpost_date>= Date.today))
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
# def new_ad_images(*attrs)
|
||||
# debugger
|
||||
# a=1
|
||||
# attrs[0].each do |attr| #Loop by JSs,Themes,Imgs
|
||||
# unless attr[:file].nil?
|
||||
# self.ad_images << AdImage.new(attr)
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
|
||||
def new_ad_images=(*attrs)
|
||||
attrs[0].each do |attr| #Loop by JSs,Themes,Imgs
|
||||
unless attr[:file].nil?
|
||||
self.ad_images << AdImage.new(attr)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def existing_ad_images=(*attrs)
|
||||
attrs[0].each do |attr| #Loop by JSs,Themes,Imgs
|
||||
ad_image = self.ad_images.find attr[0]
|
||||
ad_image.update_attributes(attr[1])
|
||||
end
|
||||
end
|
||||
# def existing_ad_images=(*attrs)
|
||||
# attrs[0].each do |attr| #Loop by JSs,Themes,Imgs
|
||||
# ad_image = self.ad_images.find attr[0]
|
||||
# ad_image.update_attributes(attr[1])
|
||||
# end
|
||||
# end
|
||||
|
||||
def save_or_destroy
|
||||
self.ad_images.each do |ad_image|
|
||||
|
||||
+34
-7
@@ -3,19 +3,46 @@ class AdImage
|
||||
include Mongoid::Timestamps
|
||||
|
||||
mount_uploader :file, ImageUploader
|
||||
|
||||
has_one :title, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
|
||||
has_one :context, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
|
||||
|
||||
field :time_to_next #Weight
|
||||
field :picture_intro
|
||||
field :out_link
|
||||
field :link_open
|
||||
field :direct_to_after_click,type: Boolean
|
||||
|
||||
field :weight ,type: Integer ,default: 1
|
||||
field :out_link #the link itself
|
||||
field :link_open #how will the link be opened
|
||||
LINK_OPEN_TYPES = ["new_window","local"]
|
||||
|
||||
field :post_date,type: Date
|
||||
field :unpost_date,type: Date
|
||||
|
||||
field :to_save, :type => Boolean
|
||||
field :to_destroy, :type => Boolean
|
||||
|
||||
LINK_OPEN_TYPES = ["new_window","local"]
|
||||
|
||||
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'
|
||||
# validates_presence_of :post_date,:message => 'Need a valid post date'
|
||||
attr_reader :parse_post_date,:parse_unpost_date
|
||||
|
||||
def parse_post_date=(att)
|
||||
self.post_date = (Date.parse att rescue nil)
|
||||
end
|
||||
|
||||
|
||||
embedded_in :ad_banner
|
||||
def parse_unpost_date=(att)
|
||||
self.unpost_date = (Date.parse att rescue nil)
|
||||
end
|
||||
|
||||
def display?
|
||||
if (self.post_date <= Date.today && (self.unpost_date.nil? || self.unpost_date>= Date.today) rescue false)
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
|
||||
def get_delay_time
|
||||
time = ''
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
class Design
|
||||
include Mongoid::Document
|
||||
include Mongoid::Timestamps
|
||||
include ParserLayout
|
||||
|
||||
field :title
|
||||
field :author
|
||||
@@ -14,7 +15,7 @@ class Design
|
||||
embeds_one :reset_css, :class_name => "Stylesheet", :cascade_callbacks => true
|
||||
embeds_many :themes, :cascade_callbacks => true
|
||||
embeds_many :javascripts, :cascade_callbacks => true
|
||||
embeds_many :images, :cascade_callbacks => true
|
||||
embeds_many :images, :as => :design_image, :cascade_callbacks => true
|
||||
# embeds_many :custom_images, :class_name => 'Image', :cascade_callbacks => true
|
||||
|
||||
validates_presence_of :title
|
||||
@@ -65,9 +66,6 @@ class Design
|
||||
protected
|
||||
|
||||
def parse_css_for_images
|
||||
self.images.each do |image|
|
||||
image.save
|
||||
end
|
||||
if (self.default_css && self.default_css.changed)
|
||||
self.default_css.parse_urls
|
||||
end
|
||||
@@ -76,6 +74,7 @@ class Design
|
||||
theme.parse_urls
|
||||
end
|
||||
end
|
||||
parse_body_for_images(self)
|
||||
end
|
||||
|
||||
end
|
||||
@@ -2,6 +2,8 @@ class Layout < DesignFile
|
||||
include ParserLayout
|
||||
|
||||
attr_reader :content
|
||||
|
||||
field :body
|
||||
|
||||
embeds_one :menu
|
||||
embedded_in :design
|
||||
@@ -17,8 +19,10 @@ class Layout < DesignFile
|
||||
Layout.count > 0
|
||||
end
|
||||
|
||||
def parse_layout
|
||||
parse_layout_contents(self)
|
||||
def parse_layout
|
||||
html = Nokogiri::HTML(self.file.read)
|
||||
self.body = html.at_css("body").inner_html
|
||||
parse_body(self)
|
||||
end
|
||||
|
||||
end
|
||||
@@ -27,6 +27,7 @@ class Stylesheet < DesignFile
|
||||
temp_file = File.new(dir + '/' + orig_file_name, 'w+')
|
||||
temp_file.write content.force_encoding("UTF-8")
|
||||
self.file = temp_file
|
||||
self.save
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
class Meta
|
||||
|
||||
include Mongoid::Document
|
||||
include Mongoid::Timestamps
|
||||
|
||||
field :key
|
||||
field :value, :default => nil
|
||||
|
||||
has_one :i18n_variable, :as => :language_value, :autosave => true, :dependent => :destroy
|
||||
|
||||
def get_name_content
|
||||
[self.key, self.value ? self.value : self.i18n_variable[I18n.locale]]
|
||||
end
|
||||
|
||||
end
|
||||
@@ -0,0 +1,11 @@
|
||||
class Meta
|
||||
|
||||
include Mongoid::Document
|
||||
include Mongoid::Timestamps
|
||||
|
||||
field :key
|
||||
field :value, :default => nil
|
||||
|
||||
has_one :i18n_variable, :as => :language_value, :autosave => true, :dependent => :destroy
|
||||
|
||||
end
|
||||
@@ -0,0 +1,5 @@
|
||||
class PageMeta < Meta
|
||||
|
||||
belongs_to :page
|
||||
|
||||
end
|
||||
@@ -0,0 +1,5 @@
|
||||
class SiteMeta < Meta
|
||||
|
||||
belongs_to :site
|
||||
|
||||
end
|
||||
@@ -1,6 +1,6 @@
|
||||
class ObjectAuth < PrototypeAuth
|
||||
include OrbitCoreLib::ObjectTokenUnility
|
||||
validates_uniqueness_of :obj_authable_type,:scope => :title #{ |c| }
|
||||
validates_uniqueness_of :title ,:scope => [:obj_authable_type,:obj_authable_id] #{ |c| }
|
||||
belongs_to :obj_authable, polymorphic: true
|
||||
# > - Something.find_with_auth(query)
|
||||
# > - or Something.find(query).auth
|
||||
|
||||
+13
-1
@@ -6,17 +6,23 @@ class Page < Item
|
||||
|
||||
belongs_to :design
|
||||
belongs_to :module_app
|
||||
has_one :title, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
|
||||
has_many :page_parts, :autosave => true, :dependent => :destroy
|
||||
has_many :page_contexts, :autosave => true, :dependent => :destroy
|
||||
has_many :page_metas, :autosave => true, :dependent => :destroy
|
||||
accepts_nested_attributes_for :page_parts, :allow_destroy => true
|
||||
|
||||
before_save :create_parts
|
||||
before_save :create_parts, :set_key
|
||||
|
||||
# embeds_many :custom_images, :class_name => 'Image', as: :design_image
|
||||
|
||||
def is_home?
|
||||
self.parent ? false : true
|
||||
end
|
||||
|
||||
def title
|
||||
@title ||= I18nVariable.first(:conditions => {:key => 'title', :language_value_id => self.id, :language_value_type => self.class}) rescue nil
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
@@ -27,4 +33,10 @@ class Page < Item
|
||||
end
|
||||
end
|
||||
|
||||
def set_key
|
||||
if title && title.new_record?
|
||||
title.key = 'title'
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -12,6 +12,8 @@ class Site
|
||||
|
||||
field :school
|
||||
field :department
|
||||
|
||||
has_many :site_metas, :autosave => true, :dependent => :destroy
|
||||
|
||||
def generate_keys
|
||||
private_key = OpenSSL::PKey::RSA.generate(2048)
|
||||
|
||||
Reference in new issue
Block a user