first version of app config and modified inits.
This commit is contained in:
parent
bfaa22052f
commit
71d5abae2e
|
@ -29,37 +29,24 @@ class Admin::PagePartsController < ApplicationController
|
||||||
@user_choose = @part.widget_path
|
@user_choose = @part.widget_path
|
||||||
@r_tag = @part.public_r_tag.blank? ? LIST[:public_r_tags][0] : @part.public_r_tag
|
@r_tag = @part.public_r_tag.blank? ? LIST[:public_r_tags][0] : @part.public_r_tag
|
||||||
@tag_objects = @r_tag.classify.constantize.all rescue nil
|
@tag_objects = @r_tag.classify.constantize.all rescue nil
|
||||||
@widget_path = @part.widget_path ? @part.widget_path : @module_app.widgets.keys[0]
|
|
||||||
@widget_style = @module_app.get_widget_style[@widget_path][:style] unless @widget_path.nil?
|
|
||||||
|
|
||||||
@categories = @module_app.get_registration.get_categories
|
if @module_app
|
||||||
@tags = @module_app.get_registration.get_tags
|
@widget_path = @part.widget_path ? @part.widget_path : @module_app.widgets.keys[0]
|
||||||
# if @module_app.widgets.any?{|b| b.class == Array}
|
@widget_style = @module_app.get_widget_style[@widget_path][:style] unless @widget_path.nil? or @module_app.nil?
|
||||||
# @widget_style = @module_app.widgets[@widget_path] if !@widget_path.blank? && !@module_app.widgets.blank?
|
end
|
||||||
# end
|
|
||||||
|
|
||||||
|
unless @module_app.nil?
|
||||||
|
@categories = @module_app.get_categories
|
||||||
|
@tags = @module_app.get_tags
|
||||||
|
end
|
||||||
|
|
||||||
@widget_path = @part.widget_path ? @part.widget_path : (@module_app.widgets.keys[0] rescue nil)
|
@widget_path = @part.widget_path ? @part.widget_path : (@module_app.widgets.keys[0] rescue nil)
|
||||||
|
|
||||||
if @module_app && @module_app.widgets.any?{|b| b.class == Array}
|
if @module_app && @module_app.widgets.any?{|b| b.class == Array}
|
||||||
@widget_style = @module_app.widgets[@widget_path] if !@widget_path.blank? && !@module_app.widgets.blank?
|
@widget_style = @module_app.widgets[@widget_path] if !@widget_path.blank? && !@module_app.widgets.blank?
|
||||||
end
|
end
|
||||||
|
|
||||||
# TODO 應該要有一些東西來決定 @categories @tags
|
|
||||||
# case @module_app.key
|
|
||||||
# when 'announcement'
|
|
||||||
# @categories = BulletinCategory.all
|
|
||||||
# @tags = AnnouncementTag.all
|
|
||||||
# when 'gallery'
|
|
||||||
# @albums = GalleryAlbum.all
|
|
||||||
# when 'web_resource'
|
|
||||||
# @categories = WebLinkCategory.all
|
|
||||||
# @tags = WebResourceTag.all
|
|
||||||
# when 'archive'
|
|
||||||
# @categories = ArchiveFileCategory.all
|
|
||||||
# @tags = ArchiveTag.all
|
|
||||||
# end if @module_app
|
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
|
@ -107,29 +94,13 @@ class Admin::PagePartsController < ApplicationController
|
||||||
|
|
||||||
def reload_widgets
|
def reload_widgets
|
||||||
@part = PagePart.find params[:id]
|
@part = PagePart.find params[:id]
|
||||||
@categories =[]
|
|
||||||
@module_app = ModuleApp.find(params[:module_app_id]) rescue nil
|
@module_app = ModuleApp.find(params[:module_app_id]) rescue nil
|
||||||
|
@categories =@module_app ? @module_app.get_categories : []
|
||||||
@widget_path = @module_app.widgets.keys[0] if (@module_app && @module_app.widgets[0].blank? )
|
@tags =@module_app ? @module_app.get_tags : []
|
||||||
|
@widget_path = @module_app.widgets.keys[0] if (@module_app && @module_app.widgets[0].blank? )
|
||||||
@widget_style = @module_app.widgets[@widget_path] if ( !@widget_path.blank? )
|
@widget_style = @module_app.widgets[@widget_path] if ( !@widget_path.blank? )
|
||||||
|
|
||||||
case @module_app.key
|
@part.widget_path = @module_app.widgets.first if( @module_app)
|
||||||
when 'announcement'
|
|
||||||
@categories = BulletinCategory.all
|
|
||||||
@tags = AnnouncementTag.all
|
|
||||||
when 'gallery'
|
|
||||||
@albums = GalleryAlbum.all
|
|
||||||
@tags = []
|
|
||||||
when 'web_resource'
|
|
||||||
@categories = WebLinkCategory.all
|
|
||||||
@tags = WebResourceTag.all
|
|
||||||
when 'archive'
|
|
||||||
@categories = ArchiveFileCategory.all
|
|
||||||
@tags = ArchiveTag.all
|
|
||||||
end if @module_app
|
|
||||||
|
|
||||||
@part.widget_path = @module_app.widgets.first if( @module_app && @module_app.needs_to_widget_option?)
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.js {}
|
format.js {}
|
||||||
end
|
end
|
||||||
|
|
|
@ -29,8 +29,8 @@ helper Admin::PagePartsHelper
|
||||||
@design = @item.design ? @item.design : @designs.first
|
@design = @item.design ? @item.design : @designs.first
|
||||||
|
|
||||||
if @item.module_app
|
if @item.module_app
|
||||||
@app_frontend_urls = @item.module_app.app_pages
|
@app_frontend_urls = @item.module_app.app_pages.map{|t| [I18n.t(t[0]),t[1]]}
|
||||||
@app_frontend_urls << 'default_widget' if @item.module_app.has_default_widget?
|
@app_frontend_urls << [I18n.t('default_widget.name'),'default_widget'] if @item.module_app.has_default_widget?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
@ -140,11 +140,9 @@ helper Admin::PagePartsHelper
|
||||||
@page = Page.find params[:id] rescue nil
|
@page = Page.find params[:id] rescue nil
|
||||||
# @categories =[]
|
# @categories =[]
|
||||||
@module_app = ModuleApp.find(params[:module_app_id]) rescue nil
|
@module_app = ModuleApp.find(params[:module_app_id]) rescue nil
|
||||||
|
@app_frontend_urls = @module_app.nil? ? nil : @module_app.app_pages.map{|t| [I18n.t(t[0]),t[1]]}
|
||||||
@app_frontend_urls = @module_app.nil? ? nil : @module_app.app_pages
|
@app_frontend_urls << [I18n.t('default_widget.name'),'default_widget'] if(@module_app && @module_app.has_default_widget?)
|
||||||
@app_frontend_urls << 'default_widget' if(@module_app && @module_app.has_default_widget?)
|
|
||||||
|
|
||||||
|
|
||||||
case (@module_app.nil? ? nil : @module_app.key )
|
case (@module_app.nil? ? nil : @module_app.key )
|
||||||
when 'announcement'
|
when 'announcement'
|
||||||
@categories = BulletinCategory.all
|
@categories = BulletinCategory.all
|
||||||
|
|
|
@ -12,7 +12,11 @@ module Admin::PagePartsHelper
|
||||||
def widget_field_options(i,local_item=nil)
|
def widget_field_options(i,local_item=nil)
|
||||||
local_item = @part if local_item.nil? && @part
|
local_item = @part if local_item.nil? && @part
|
||||||
local_item = @page if local_item.nil? && @page
|
local_item = @page if local_item.nil? && @page
|
||||||
options = @module_app.widget_fields.collect{|widget_field| [I18n.t(widget_field[1]), widget_field[0]]}
|
|
||||||
|
options = @module_app.widget_fields.collect do |widget_field|
|
||||||
|
label = I18n.t("#{@module_app.key}.default_widget.#{widget_field[0]}")
|
||||||
|
[label, widget_field[0]]
|
||||||
|
end
|
||||||
|
|
||||||
case local_item
|
case local_item
|
||||||
when Page
|
when Page
|
||||||
|
|
|
@ -2,74 +2,40 @@ class ModuleApp
|
||||||
include Mongoid::Document
|
include Mongoid::Document
|
||||||
include Mongoid::Timestamps
|
include Mongoid::Timestamps
|
||||||
include OrbitCoreLib::ObjectTokenUtility
|
include OrbitCoreLib::ObjectTokenUtility
|
||||||
|
include OrbitApp::ModuleAppMembershipTools
|
||||||
|
|
||||||
field :key
|
field :key
|
||||||
field :title
|
field :title
|
||||||
|
field :sidebar_order#,type: Integer
|
||||||
|
|
||||||
field :version
|
def refetch_setting!(reg)
|
||||||
field :organization
|
# %w{module_label category base_url version organization author intro update_info create_date}.each do |field|
|
||||||
field :author
|
# self[field.to_sym] = reg.send field
|
||||||
field :intro
|
# end
|
||||||
field :update_info
|
self[:app_pages] = reg.get_app_pages
|
||||||
field :create_date
|
self[:enable_frontend] = reg.get_enable_frontend
|
||||||
field :enable_frontend, type: Boolean, :default => true
|
self[:get_widget_style] = reg.get_widgets
|
||||||
|
self[:using_default_widget] = !reg.get_default_widget.blank?
|
||||||
field :app_pages ,type: Array
|
self[:widgets] = reg.get_widgets
|
||||||
# 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
|
|
||||||
|
|
||||||
# has_many :tags
|
|
||||||
has_many :page_parts
|
|
||||||
has_many :pages
|
|
||||||
|
|
||||||
has_one :app_auth,dependent: :delete
|
|
||||||
|
|
||||||
before_save :set_key
|
|
||||||
|
|
||||||
def get_registration
|
|
||||||
OrbitApp::Module::Registration.find_by_key(key)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
%w{widget_styles }.each do |field|
|
|
||||||
define_method(field){|var| get_registration.send("get_#{field}") }
|
# def app_pages
|
||||||
|
# get_registration.get_app_pages
|
||||||
|
# end
|
||||||
|
|
||||||
|
|
||||||
|
def enable_frontend?
|
||||||
|
self[:enable_frontend]
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_default_widget
|
def get_default_widget
|
||||||
get_registration.get_default_widget
|
raise 'Need to link with OrbitApp [type: Array]'
|
||||||
end
|
end
|
||||||
|
|
||||||
def enable_frontend?
|
|
||||||
get_registration.get_enable_frontend
|
|
||||||
end
|
|
||||||
|
|
||||||
def label_i18n
|
|
||||||
reg = get_registration
|
|
||||||
reg.nil? ? 'Init is not defined completely' : get_registration.get_label_i18n
|
|
||||||
end
|
|
||||||
|
|
||||||
# def method_missing(m, *args, &block)
|
|
||||||
# # get_registration.send("get_#{m}")
|
|
||||||
# end
|
|
||||||
|
|
||||||
def using_default_widget?
|
|
||||||
!get_registration.get_default_widget.blank?
|
|
||||||
end
|
|
||||||
|
|
||||||
def get_widget_style
|
|
||||||
widgets = get_registration.get_widgets
|
|
||||||
end
|
|
||||||
|
|
||||||
def get_widget_for_select
|
def get_widget_for_select
|
||||||
widgets = get_registration.get_widgets
|
widgets = get_widget_style
|
||||||
ary = widgets.collect do |k,v|
|
ary = widgets.collect do |k,v|
|
||||||
if k == 'default_widget'
|
if k == 'default_widget'
|
||||||
[I18n.t('widget.default_widget'),'default_widget']
|
[I18n.t('widget.default_widget'),'default_widget']
|
||||||
|
@ -80,104 +46,85 @@ class ModuleApp
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def is_manager?(user)
|
# def get_widget_style
|
||||||
if user.nil?
|
# get_registration.get_widgets
|
||||||
return false
|
# end
|
||||||
else
|
|
||||||
m_users = managing_users
|
def has_default_widget?
|
||||||
if m_users.blank?
|
self[:widgets].has_key? 'default_widget'
|
||||||
false
|
|
||||||
else
|
|
||||||
m_users.include?(user)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def is_sub_manager?(user)
|
|
||||||
if user.nil?
|
|
||||||
return false
|
|
||||||
else # when user is guest
|
|
||||||
s_m_users = sub_managing_users
|
|
||||||
result = false
|
|
||||||
if s_m_users.blank?
|
|
||||||
result = false
|
|
||||||
else
|
|
||||||
result = s_m_users.include?(user)
|
|
||||||
end
|
|
||||||
result || is_manager?(user)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def managing_users
|
|
||||||
self.managers.collect{ |t| t.user }
|
|
||||||
end
|
|
||||||
|
|
||||||
def sub_managing_users
|
|
||||||
self.sub_managers.collect{ |t| t.user }
|
|
||||||
end
|
|
||||||
|
|
||||||
def assign_manager(user,assigner)
|
|
||||||
manager = AppManager.first(conditions: {managing_app_id: self.id,user_id: user.id}) rescue nil
|
|
||||||
if manager.nil?
|
|
||||||
manager = self.managers.create(:user_id => user.id,:rule_creator_id => (assigner.id rescue nil))
|
|
||||||
end
|
|
||||||
manager
|
|
||||||
end
|
|
||||||
|
|
||||||
def assign_sub_manager(user,assigner)
|
|
||||||
submanager = AppManager.first(conditions: {sub_managing_app_id: self.id,user_id: user.id}) rescue nil
|
|
||||||
if submanager.nil? && !self.managing_users.include?(user)
|
|
||||||
submanager = self.sub_managers.create(:user_id => user.id,:rule_creator_id => (assigner.id rescue nil) )
|
|
||||||
end
|
|
||||||
submanager
|
|
||||||
end
|
|
||||||
|
|
||||||
def remove_manager(user)
|
|
||||||
manager = AppManager.first(conditions: {managing_app_id: self.id,user_id: user.id}) rescue nil
|
|
||||||
if manager
|
|
||||||
manager.destroy
|
|
||||||
else
|
|
||||||
false
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def remove_sub_manager(user)
|
|
||||||
submanager = AppManager.first(conditions: {sub_managing_app_id: self.id,user_id: user.id}) rescue nil
|
|
||||||
if submanager
|
|
||||||
submanager.destroy
|
|
||||||
else
|
|
||||||
false
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
def label
|
def label
|
||||||
I18n.t(label_i18n)
|
I18n.t(label_i18n)
|
||||||
end
|
end
|
||||||
|
|
||||||
def needs_to_widget_option?
|
def label_i18n
|
||||||
if self.widget_options
|
reg = get_registration
|
||||||
self.widget_options.has_key? widgets.first
|
reg.nil? ? 'Init is not defined completely' : get_registration.get_label_i18n
|
||||||
else
|
|
||||||
false
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def has_default_widget?
|
|
||||||
case self[:widgets]
|
# def needs_to_widget_option?
|
||||||
when Array
|
# if self.widget_options
|
||||||
false
|
# self.widget_options.has_key? widgets.first
|
||||||
when Hash
|
# else
|
||||||
self[:widgets].has_key? 'default_widget'
|
# false
|
||||||
end
|
# end
|
||||||
|
# end
|
||||||
|
|
||||||
|
def using_default_widget?
|
||||||
|
# !get_registration.get_default_widget.blank?
|
||||||
|
self[:get_default_widget]
|
||||||
end
|
end
|
||||||
|
|
||||||
protected
|
def widget_fields
|
||||||
|
# binding.pry
|
||||||
|
# raise 'Need to link with OrbitApp [type: Array]'
|
||||||
|
get_registration.get_default_widget_fields
|
||||||
|
end
|
||||||
|
|
||||||
|
# def widgets
|
||||||
|
# # get_registration.get_widgets
|
||||||
|
# # get_registration.get_default_widget
|
||||||
|
# end
|
||||||
|
|
||||||
|
def widget_options(widget_path=nil)
|
||||||
|
get_registration.get_widget_by_path(widget_path)
|
||||||
|
# raise 'Need to link with OrbitApp [type: Hash]'
|
||||||
|
end
|
||||||
|
|
||||||
|
def widget_options_fields_i18n
|
||||||
|
raise 'Need to link with OrbitApp [type: Hash]'
|
||||||
|
end
|
||||||
|
|
||||||
|
def widget_fields_link_method
|
||||||
|
raise 'Need to link with OrbitApp [type: Hash]'
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
def set_key
|
# # has_many :tags
|
||||||
self.key = self.title.underscore.singularize if self.title
|
has_many :page_parts
|
||||||
|
has_many :pages
|
||||||
|
|
||||||
|
has_one :app_auth,dependent: :delete
|
||||||
|
|
||||||
|
def get_tags
|
||||||
|
get_registration.get_tags
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def get_categories
|
||||||
|
get_registration.get_categories
|
||||||
|
end
|
||||||
|
|
||||||
|
def module_name
|
||||||
|
I18n.t(get_registration.get_label_i18n)
|
||||||
|
end
|
||||||
|
|
||||||
|
def get_registration
|
||||||
|
OrbitApp::Module::Registration.find_by_key(key)
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
<%= f.select :module_app_id, @apps.collect { |t| [t.title.capitalize, t.id] }, {:include_blank => true} ,{:rel => admin_module_apps_path } %>
|
<%= f.select :module_app_id, @apps.collect { |t| [t.module_name, t.id] }, {:include_blank => true} ,{:rel => admin_module_apps_path } %>
|
||||||
|
|
|
@ -6,11 +6,11 @@
|
||||||
<% if @module_app.nil? || @module_app.widgets.nil? || (@module_app.widgets[@widget_path].blank? rescue true) %>
|
<% if @module_app.nil? || @module_app.widgets.nil? || (@module_app.widgets[@widget_path].blank? rescue true) %>
|
||||||
<%= t("default_widget.no_support_setting")%>
|
<%= t("default_widget.no_support_setting")%>
|
||||||
<%else%>
|
<%else%>
|
||||||
<%= select('page_part', 'widget_style', @module_app.widgets[@widget_path]) %>
|
<%= select('page_part', 'widget_style', @module_app.widgets[@widget_path]["style"]) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<% if(@module_app && @module_app.widget_options && @module_app.widget_options.has_key?(@widget_path)) %>
|
<% if(@module_app && @module_app.widget_options(@widget_path)) %>
|
||||||
<div class="style_switch control-group">
|
<div class="style_switch control-group">
|
||||||
<label class="control-label"><%= t("default_widget.select_widget_ext_option") %></label>
|
<label class="control-label"><%= t("default_widget.select_widget_ext_option") %></label>
|
||||||
<div class="controls well" >
|
<div class="controls well" >
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
<%= t "default_widget.select_module_app" %>
|
<%= t "default_widget.select_module_app" %>
|
||||||
</label>
|
</label>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<%= f.select :module_app, options_from_collection_for_select(@module_apps, :id, :title, :selected => (@module_app.id rescue nil)), {:include_blank => true }, {:rel => admin_page_parts_path,:id=>"page_module_app_id"} %>
|
<%= f.select :module_app, options_from_collection_for_select(@module_apps, :id, :module_name, :selected => (@module_app.id rescue nil)), {:include_blank => true }, {:rel => admin_page_parts_path,:id=>"page_module_app_id"} %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@
|
||||||
<%= t "default_widget.select_widget_path" %>
|
<%= t "default_widget.select_widget_path" %>
|
||||||
</label>
|
</label>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<%= f.select :widget_path, @module_app ? @module_app.widgets.collect{|k,v| [k.humanize, k]} : [], {}, { :selected => @part.widget_path, :rel => admin_page_parts_path } %>
|
<%= f.select :widget_path, @module_app ? @module_app.widgets.collect{|k,v| [I18n.t(v["i18n"]),k]} : [], {}, { :selected => @part.widget_path, :rel => admin_page_parts_path } %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
<%= content_tag_for(:label, @tags,:class=>"radio inline") do |tag|%>
|
<%= content_tag_for(:label, @tags,:class=>"radio inline") do |tag|%>
|
||||||
<%= radio_button_tag("#{field_name}[tag]", tag.id, tag_checked_value(object,tag.id) ) %>
|
<%= radio_button_tag("#{field_name}[tag]", tag.id, tag_checked_value(object,tag.id) ) %>
|
||||||
<%= tag[I18n.locale]%>
|
<%= tag[I18n.locale]%>
|
||||||
<% end %>
|
<% end if @tags%>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<% else %>
|
<% else %>
|
||||||
<%= t("default_widget.no_support_setting")%>
|
<%= t("default_widget.no_support_setting")%>
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<% @module_app.widget_options[@widget_path].each do |key,options| %>
|
<% @module_app.widget_options(@widget_path).get_options.each do |key,settings| %>
|
||||||
<%= label_tag(t(@module_app.widget_options_fields_i18n[@widget_path][key]))%>
|
<% options = settings[:opts] %>
|
||||||
|
<%= label_tag(t(settings[:label_i18n]))%>
|
||||||
<% case options%>
|
<% case options%>
|
||||||
<% when Hash%>
|
<% when Hash%>
|
||||||
<%= select_tag "page_part[widget_options][#{key}]", options_from_collection_for_select(eval(options["query"]), options["value"], options["label"].to_s, :selected => (@part.widget_options[key] rescue nil)) %>
|
<%= select_tag "page_part[widget_options][#{key}]", options_from_collection_for_select(eval(options["query"]), options["value"], options["label"].to_s, :selected => (@part.widget_options[key] rescue nil)) %>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<% if @module_app%>
|
<% if @module_app%>
|
||||||
$('#widget_list select').html("<%= j options_for_select(@module_app.widgets.collect{|k,v| k},@part.widget_path) %>");
|
$('#widget_list select').html("<%= j options_for_select(@module_app.widgets.collect{|k,v| [I18n.t(v['i18n']),k]},@part.widget_path) %>");
|
||||||
$("#widget_data_source_category").html("<%= j render :partial => 'widget_data_source_category',:locals=>{:object=>@part} %>");
|
$("#widget_data_source_category").html("<%= j render :partial => 'widget_data_source_category',:locals=>{:object=>@part} %>");
|
||||||
$("#widget_data_source_tag").html("<%= j render :partial => 'widget_data_source_tag',:locals=>{:object=>@part} %>");
|
$("#widget_data_source_tag").html("<%= j render :partial => 'widget_data_source_tag',:locals=>{:object=>@part} %>");
|
||||||
|
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
<%= f.select :module_app_id, @apps.collect { |t| [t.title.capitalize, t.id] }, {:include_blank => true} ,{:rel => admin_pages_path } %>
|
<%= f.select :module_app_id, @apps.collect { |t| [t.module_name, t.id] }, {:include_blank => true} ,{:rel => admin_pages_path } %>
|
||||||
|
|
|
@ -1,7 +1,11 @@
|
||||||
zh_tw:
|
zh_tw:
|
||||||
|
|
||||||
_locale: 中文
|
_locale: 中文
|
||||||
|
rulingcom:
|
||||||
|
errors:
|
||||||
|
init:
|
||||||
|
app_page_noname: 未命名前台頁面
|
||||||
|
module_app_noname: 未命名模組
|
||||||
front_page:
|
front_page:
|
||||||
select_app_url: 模組前台樣式
|
select_app_url: 模組前台樣式
|
||||||
is_published: 是否公開
|
is_published: 是否公開
|
||||||
|
@ -112,6 +116,7 @@ zh_tw:
|
||||||
delete: 刪除
|
delete: 刪除
|
||||||
delete_file: 刪除檔案
|
delete_file: 刪除檔案
|
||||||
default_widget:
|
default_widget:
|
||||||
|
name: 預設樣式
|
||||||
no_support_setting: 沒有可以使用的設定
|
no_support_setting: 沒有可以使用的設定
|
||||||
no_value: 不設定(全部)
|
no_value: 不設定(全部)
|
||||||
fields_: 前台輸出欄位
|
fields_: 前台輸出欄位
|
||||||
|
@ -361,7 +366,7 @@ zh_tw:
|
||||||
link: 連結已更新成功
|
link: 連結已更新成功
|
||||||
page: 頁面已更新成功
|
page: 頁面已更新成功
|
||||||
user: 使用者已更新成功
|
user: 使用者已更新成功
|
||||||
success_: 更新成功
|
# success_: 更新成功
|
||||||
paper: Paper was successfully updated.
|
paper: Paper was successfully updated.
|
||||||
user: User was successfully updated.
|
user: User was successfully updated.
|
||||||
success_: S使用者已更新成功
|
success_: S使用者已更新成功
|
||||||
|
|
|
@ -4,13 +4,14 @@ module OrbitApp
|
||||||
Version = "0.1"
|
Version = "0.1"
|
||||||
|
|
||||||
module ClassMethods
|
module ClassMethods
|
||||||
@@frontend_pages = []
|
@@frontend_pages = []
|
||||||
|
#Record all frontend pages of orbit
|
||||||
|
|
||||||
def add(var)
|
def add(var) #build @@frontend_pages
|
||||||
@@frontend_pages << var
|
@@frontend_pages << var
|
||||||
end
|
end
|
||||||
|
|
||||||
def all
|
def all #return all frontend_pages of orbit
|
||||||
return @@frontend_pages
|
return @@frontend_pages
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -21,18 +22,18 @@ module OrbitApp
|
||||||
other.extend( ClassMethods )
|
other.extend( ClassMethods )
|
||||||
end
|
end
|
||||||
|
|
||||||
class AppPageSet
|
class AppPageSet # From Registration
|
||||||
def initialize(&block)
|
def initialize(&block)
|
||||||
@frontend_pages = []
|
@frontend_pages = []
|
||||||
block.arity < 1 ? instance_eval(&block) : block.call(self) if block_given?
|
block.arity < 1 ? instance_eval(&block) : block.call(self) if block_given?
|
||||||
end
|
end
|
||||||
|
|
||||||
def app_page(name,options ={})
|
def app_page(name,&block)
|
||||||
@frontend_pages << AppPage.new(name,options)
|
@frontend_pages << AppPage.new(name,&block)
|
||||||
end
|
end
|
||||||
|
|
||||||
def to_module_app_format
|
def to_module_app_format #For ModuleApp to fetch data
|
||||||
@frontend_pages.collect{|t| t.name}
|
@frontend_pages.collect{|t| [t.get_i18n,t.name]}
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -40,10 +41,20 @@ module OrbitApp
|
||||||
class AppPage
|
class AppPage
|
||||||
attr_reader :name
|
attr_reader :name
|
||||||
|
|
||||||
def initialize(name,options ={})
|
def initialize(name,&block)
|
||||||
@name = name
|
@name = name
|
||||||
|
@frontend_i18n = 'rulingcom.errors.init.app_page_noname'
|
||||||
|
block.arity < 1 ? instance_eval(&block) : block.call(self) if block_given?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def frontend_i18n(i18n)
|
||||||
|
@frontend_i18n = i18n
|
||||||
|
end
|
||||||
|
|
||||||
|
def get_i18n
|
||||||
|
@frontend_i18n
|
||||||
|
end
|
||||||
|
|
||||||
def finalize!
|
def finalize!
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -35,6 +35,7 @@ module OrbitApp
|
||||||
@key = name.underscore.singularize
|
@key = name.underscore.singularize
|
||||||
@side_bar = nil
|
@side_bar = nil
|
||||||
@front_end_app_pages = nil
|
@front_end_app_pages = nil
|
||||||
|
@module_label = 'rulingcom.errors.init.module_app_noname'
|
||||||
block.arity < 1 ? instance_eval(&block) : block.call(self) if block_given?
|
block.arity < 1 ? instance_eval(&block) : block.call(self) if block_given?
|
||||||
setup_module_app
|
setup_module_app
|
||||||
end
|
end
|
||||||
|
@ -46,7 +47,7 @@ module OrbitApp
|
||||||
def setup_module_app
|
def setup_module_app
|
||||||
module_app = get_module_app
|
module_app = get_module_app
|
||||||
module_app = ModuleApp.new(:key=>@key,:title=>name) if module_app.nil?
|
module_app = ModuleApp.new(:key=>@key,:title=>name) if module_app.nil?
|
||||||
|
module_app.refetch_setting!(self)
|
||||||
begin
|
begin
|
||||||
module_app.save(:validate=>false)
|
module_app.save(:validate=>false)
|
||||||
rescue
|
rescue
|
||||||
|
@ -59,6 +60,10 @@ module OrbitApp
|
||||||
@module_label
|
@module_label
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def get_default_widget_fields
|
||||||
|
return @widget_set.get_fields
|
||||||
|
end
|
||||||
|
|
||||||
def get_default_widget
|
def get_default_widget
|
||||||
if @widget_set.nil? # Init not defining widget
|
if @widget_set.nil? # Init not defining widget
|
||||||
return {}
|
return {}
|
||||||
|
@ -77,32 +82,40 @@ module OrbitApp
|
||||||
@front_end_app_pages.nil? ? [] : @front_end_app_pages.to_module_app_format
|
@front_end_app_pages.nil? ? [] : @front_end_app_pages.to_module_app_format
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def get_widget_by_path(path)
|
||||||
|
if @widget_set
|
||||||
|
@widget_set.find_by_path(path)
|
||||||
|
else
|
||||||
|
nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def get_widgets
|
def get_widgets
|
||||||
@widget_set.nil? ? {} : @widget_set.to_module_app_format
|
@widget_set.nil? ? {} : @widget_set.to_module_app_format
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_categories
|
def get_categories
|
||||||
@widget_set.get_categories
|
@widget_set.get_categories rescue []
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_tags
|
def get_tags
|
||||||
@widget_set.get_tags
|
@widget_set.get_tags rescue []
|
||||||
end
|
end
|
||||||
|
|
||||||
def front_end(&block)
|
def front_end(&block) #setter for front_end from init
|
||||||
@front_end_app_pages = FrontendUtility::AppPageSet.new(&block)
|
@front_end_app_pages = FrontendUtility::AppPageSet.new(&block)
|
||||||
end
|
end
|
||||||
|
|
||||||
def side_bar(&block)
|
def side_bar(&block) #setter for side_bar from init
|
||||||
@side_bar = SideBarRegisition::SideBar.new(@name,@key,method(:get_module_app),&block)
|
@side_bar = SideBarRegisition::SideBar.new(@name,@key,method(:get_module_app),&block)
|
||||||
end
|
end
|
||||||
|
|
||||||
def personal_plugin(params)
|
def personal_plugin(params) #setter for personal_plugin from init
|
||||||
# TODO 這裡要看是一些檔案是不是都有
|
# TODO 這裡要看是一些檔案是不是都有
|
||||||
Plugin::Registration.new_from_module_app(@name,@base_path,params)
|
Plugin::Registration.new_from_module_app(@name,@base_path,params)
|
||||||
end
|
end
|
||||||
|
|
||||||
def widgets(&block)
|
def widgets(&block) #setter for widget from init
|
||||||
# @widgets = WidgetRegisition::WidgetSet.new(&block)
|
# @widgets = WidgetRegisition::WidgetSet.new(&block)
|
||||||
@widget_set = WidgetUtility::WidgetSet.new(&block)
|
@widget_set = WidgetUtility::WidgetSet.new(&block)
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,12 @@ module OrbitApp
|
||||||
define_method(field){|var| instance_variable_set( "@" + field, var)}
|
define_method(field){|var| instance_variable_set( "@" + field, var)}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def find_by_path(path)
|
||||||
|
@widgets.each do |widget|
|
||||||
|
return widget if widget.name == path
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def get_categories
|
def get_categories
|
||||||
eval(@categories_query) rescue nil
|
eval(@categories_query) rescue nil
|
||||||
end
|
end
|
||||||
|
@ -46,9 +52,17 @@ module OrbitApp
|
||||||
@default_widget = DefaultWidget.new(&block)
|
@default_widget = DefaultWidget.new(&block)
|
||||||
end
|
end
|
||||||
|
|
||||||
def customize_widget(name,label,options ={})
|
def customize_widget(name,&block)
|
||||||
@widgets << Widget.new(name,label,options)
|
@widgets << Widget.new(name,&block)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# def customize_widget(name,label,options ={})
|
||||||
|
# @widgets << Widget.new(name,label,options)
|
||||||
|
# end
|
||||||
|
|
||||||
|
# def customize_widget_options_fields_i18n(settings)
|
||||||
|
# @customize_widget_options_fields_i18n = settings
|
||||||
|
# end
|
||||||
|
|
||||||
def to_module_app_format
|
def to_module_app_format
|
||||||
hash = {}
|
hash = {}
|
||||||
|
@ -57,10 +71,13 @@ module OrbitApp
|
||||||
hash
|
hash
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def get_fields
|
||||||
|
get_default_widget.get_fields
|
||||||
|
end
|
||||||
|
|
||||||
def get_default_widget
|
def get_default_widget
|
||||||
return @default_widget
|
return @default_widget
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
class DefaultWidget
|
class DefaultWidget
|
||||||
|
@ -69,9 +86,16 @@ module OrbitApp
|
||||||
def initialize(&block)
|
def initialize(&block)
|
||||||
@query = nil
|
@query = nil
|
||||||
@image = nil
|
@image = nil
|
||||||
|
@more_link = {}
|
||||||
|
@fields = []
|
||||||
block.arity < 1 ? instance_eval(&block) : block.call(self) if block_given?
|
block.arity < 1 ? instance_eval(&block) : block.call(self) if block_given?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def more_link_to(label_i18n,path_method)
|
||||||
|
@more_link[:label_i18n] = label_i18n
|
||||||
|
@more_link[:path_method] = path_method
|
||||||
|
end
|
||||||
|
|
||||||
def self.get_interface_args
|
def self.get_interface_args
|
||||||
#will need to work with design
|
#will need to work with design
|
||||||
{:name=>"default_widget",:field=>nil,:label=>'label',:style=>STYLE}
|
{:name=>"default_widget",:field=>nil,:label=>'label',:style=>STYLE}
|
||||||
|
@ -81,6 +105,18 @@ module OrbitApp
|
||||||
{:query=>@query,:image=>@image} rescue nil
|
{:query=>@query,:image=>@image} rescue nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def link_field(field_name,setting)
|
||||||
|
@fields << [field_name,setting,:link]
|
||||||
|
end
|
||||||
|
|
||||||
|
def field(field_name)
|
||||||
|
@fields << [field_name,nil,:field]
|
||||||
|
end
|
||||||
|
|
||||||
|
def get_fields
|
||||||
|
@fields
|
||||||
|
end
|
||||||
|
|
||||||
def query(var)
|
def query(var)
|
||||||
@query = var
|
@query = var
|
||||||
end
|
end
|
||||||
|
@ -94,19 +130,38 @@ module OrbitApp
|
||||||
class Widget
|
class Widget
|
||||||
attr_reader :name,:default_template,:fields
|
attr_reader :name,:default_template,:fields
|
||||||
|
|
||||||
def initialize(name,label,options ={})
|
def initialize(name,&block)
|
||||||
@name = name
|
@name = name
|
||||||
@fields = options[:fields]
|
@options = {}
|
||||||
@label = label
|
block.arity < 1 ? instance_eval(&block) : block.call(self) if block_given?
|
||||||
@style= options[:style]
|
|
||||||
|
# @fields = options[:fields]
|
||||||
|
# @label = label
|
||||||
|
# @style= options[:style]
|
||||||
end
|
end
|
||||||
|
|
||||||
def to_hash
|
def widget_i18n(str) # "gallery.widget.widget1"
|
||||||
{:name => @name,:fields=>@fields,:label=>@label,:style=>@style}
|
@widget_i18n = str
|
||||||
|
end
|
||||||
|
|
||||||
|
def style(ary)# []
|
||||||
|
@style = ary
|
||||||
|
end
|
||||||
|
|
||||||
|
def get_options
|
||||||
|
@options
|
||||||
end
|
end
|
||||||
|
|
||||||
def finalize!
|
def options(opt_name,*options) # "vertical",
|
||||||
|
option = options[0]
|
||||||
|
@options[opt_name] = {:label_i18n=>option[:i18n] , :opts=>option[:options_item]}
|
||||||
|
# options => :i18n => "gallery.widget_option.vertical",:options_item=>[1, 2]
|
||||||
|
# :i18n =>"gallery.widget_option.album",:options_item => {"query"=>"GalleryAlbum.all", "value"=>:id, "label"=>:name}
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
def to_hash
|
||||||
|
{:name => @name,:fields=>@fields,:label=>@label,:style=>@style,:i18n=>@widget_i18n}
|
||||||
end
|
end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
|
@ -0,0 +1,73 @@
|
||||||
|
module OrbitApp
|
||||||
|
module ModuleAppMembershipTools
|
||||||
|
def is_manager?(user)
|
||||||
|
if user.nil?
|
||||||
|
return false
|
||||||
|
else
|
||||||
|
m_users = managing_users
|
||||||
|
if m_users.blank?
|
||||||
|
false
|
||||||
|
else
|
||||||
|
m_users.include?(user)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def is_sub_manager?(user)
|
||||||
|
if user.nil?
|
||||||
|
return false
|
||||||
|
else # when user is guest
|
||||||
|
s_m_users = sub_managing_users
|
||||||
|
result = false
|
||||||
|
if s_m_users.blank?
|
||||||
|
result = false
|
||||||
|
else
|
||||||
|
result = s_m_users.include?(user)
|
||||||
|
end
|
||||||
|
result || is_manager?(user)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def managing_users
|
||||||
|
self.managers.collect{ |t| t.user }
|
||||||
|
end
|
||||||
|
|
||||||
|
def sub_managing_users
|
||||||
|
self.sub_managers.collect{ |t| t.user }
|
||||||
|
end
|
||||||
|
|
||||||
|
def assign_manager(user,assigner)
|
||||||
|
manager = AppManager.first(conditions: {managing_app_id: self.id,user_id: user.id}) rescue nil
|
||||||
|
if manager.nil?
|
||||||
|
manager = self.managers.create(:user_id => user.id,:rule_creator_id => (assigner.id rescue nil))
|
||||||
|
end
|
||||||
|
manager
|
||||||
|
end
|
||||||
|
|
||||||
|
def assign_sub_manager(user,assigner)
|
||||||
|
submanager = AppManager.first(conditions: {sub_managing_app_id: self.id,user_id: user.id}) rescue nil
|
||||||
|
if submanager.nil? && !self.managing_users.include?(user)
|
||||||
|
submanager = self.sub_managers.create(:user_id => user.id,:rule_creator_id => (assigner.id rescue nil) )
|
||||||
|
end
|
||||||
|
submanager
|
||||||
|
end
|
||||||
|
|
||||||
|
def remove_manager(user)
|
||||||
|
manager = AppManager.first(conditions: {managing_app_id: self.id,user_id: user.id}) rescue nil
|
||||||
|
if manager
|
||||||
|
manager.destroy
|
||||||
|
else
|
||||||
|
false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def remove_sub_manager(user)
|
||||||
|
submanager = AppManager.first(conditions: {sub_managing_app_id: self.id,user_id: user.id}) rescue nil
|
||||||
|
if submanager
|
||||||
|
submanager.destroy
|
||||||
|
else
|
||||||
|
false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -1,6 +1,6 @@
|
||||||
module AdBanner
|
module AdBanner
|
||||||
OrbitApp.registration "AdBanner",:type=> 'ModuleApp' do
|
OrbitApp.registration "AdBanner",:type=> 'ModuleApp' do
|
||||||
module_label 'ad_banner.ad_banner'
|
module_label 'miss_module_i18n.ad_banner'
|
||||||
base_url File.expand_path File.dirname(__FILE__)
|
base_url File.expand_path File.dirname(__FILE__)
|
||||||
# personal_plugin :enable => true,:path=>"panel/ad_banner/plugin/profile",:i18n=>'admin.ad_banner'
|
# personal_plugin :enable => true,:path=>"panel/ad_banner/plugin/profile",:i18n=>'admin.ad_banner'
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,8 @@ zh_tw:
|
||||||
editing_announcement_category: 編輯公告類別
|
editing_announcement_category: 編輯公告類別
|
||||||
error:
|
error:
|
||||||
no_avilb_cate_for_posting: 公告必需有一個類別才能發送,請與管理員聯絡
|
no_avilb_cate_for_posting: 公告必需有一個類別才能發送,請與管理員聯絡
|
||||||
|
front_end:
|
||||||
|
bulletins: 請LIN給名字前台頁
|
||||||
new_bulletin_category: 新增公告類別
|
new_bulletin_category: 新增公告類別
|
||||||
search: 搜尋公告
|
search: 搜尋公告
|
||||||
update_bulletin_success: 公告已成功更新
|
update_bulletin_success: 公告已成功更新
|
||||||
|
|
|
@ -12,7 +12,9 @@ module Announcement
|
||||||
update_info 'some update_info'
|
update_info 'some update_info'
|
||||||
|
|
||||||
front_end do
|
front_end do
|
||||||
app_page 'bulletins'
|
app_page 'bulletins' do
|
||||||
|
frontend_i18n "announcement.front_end.bulletins"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
category ["BulletinCategory"]
|
category ["BulletinCategory"]
|
||||||
|
@ -21,13 +23,18 @@ module Announcement
|
||||||
default_widget do
|
default_widget do
|
||||||
query 'Bulletin.all'
|
query 'Bulletin.all'
|
||||||
image :image
|
image :image
|
||||||
|
field :postdate
|
||||||
|
link_field :title,{:method => 'panel_announcement_front_end_bulletin_path',:args=>:self}
|
||||||
|
link_field :bulletin_category_with_title,{:method => 'panel_announcement_front_end_bulletins_path',:args=>{:category_id => [:bulletin_category,:id]}}
|
||||||
end
|
end
|
||||||
|
|
||||||
categories_query 'BulletinCategory.all'
|
categories_query 'BulletinCategory.all'
|
||||||
tags_query 'AnnouncementTag.all'
|
tags_query 'AnnouncementTag.all'
|
||||||
|
|
||||||
customize_widget "index","announcement.widget.index",:fields=>["title","category","postdate"],:style=>["cu_style_1","cu_style_2","cu_style_3","cu_style_4","cu_style_5"]
|
customize_widget "index" do
|
||||||
customize_widget "bulletins_and_web_links","announcement.widget.bulletins_and_web_links"
|
widget_i18n "announcement.widget.index"
|
||||||
|
style ["1","2"]
|
||||||
|
end
|
||||||
# item "index","announcement.widget.index",:default_template=>true,:fields=>["title","category","postdate"]
|
# item "index","announcement.widget.index",:default_template=>true,:fields=>["title","category","postdate"]
|
||||||
# item "bulletins_and_web_links","announcement.widget.bulletins_and_web_links"
|
# item "bulletins_and_web_links","announcement.widget.bulletins_and_web_links"
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
zh_tw:
|
zh_tw:
|
||||||
|
|
||||||
_locale: 中文
|
_locale: 中文
|
||||||
|
archive:
|
||||||
|
widget:
|
||||||
|
archive_files: 檔案室Wiget
|
||||||
add: 新增
|
add: 新增
|
||||||
back: 回去
|
back: 回去
|
||||||
create: 創造
|
create: 創造
|
||||||
|
|
|
@ -26,7 +26,10 @@ module Archive
|
||||||
|
|
||||||
# categories_query 'BulletinCategory.all'
|
# categories_query 'BulletinCategory.all'
|
||||||
# tags_query 'ArchiveTag.all'
|
# tags_query 'ArchiveTag.all'
|
||||||
customize_widget "archive_files","archive.widget.archive_files",:style=>[]
|
customize_widget "archive_files" do
|
||||||
|
widget_i18n "archive.widget.archive_files"
|
||||||
|
style []
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
side_bar do
|
side_bar do
|
||||||
|
|
|
@ -1,17 +1,21 @@
|
||||||
class GalleryCategory
|
class GalleryCategory
|
||||||
include Mongoid::Document
|
include Mongoid::Document
|
||||||
include Mongoid::Timestamps
|
include Mongoid::Timestamps
|
||||||
|
|
||||||
include OrbitCoreLib::ObjectAuthable
|
include OrbitCoreLib::ObjectAuthable
|
||||||
|
|
||||||
ObjectAuthTitlesOptions = %W{new_album}
|
ObjectAuthTitlesOptions = %W{new_album}
|
||||||
APP_NAME = "album"
|
APP_NAME = "album"
|
||||||
|
|
||||||
field :name, localize: true
|
field :name, localize: true
|
||||||
|
|
||||||
has_many :gallery_albums, :autosave => true, :dependent => :destroy
|
has_many :gallery_albums, :autosave => true, :dependent => :destroy
|
||||||
|
|
||||||
def pp_object
|
def title
|
||||||
name
|
name
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def pp_object
|
||||||
|
name
|
||||||
|
end
|
||||||
end
|
end
|
|
@ -23,6 +23,8 @@ zh_tw:
|
||||||
edit: 編輯
|
edit: 編輯
|
||||||
delete_selected: 刪除選擇項目
|
delete_selected: 刪除選擇項目
|
||||||
del_album?: "要刪除這本相簿嗎?"
|
del_album?: "要刪除這本相簿嗎?"
|
||||||
|
front_end:
|
||||||
|
albums: 相簿前台
|
||||||
album_not_found: 找不到此相簿
|
album_not_found: 找不到此相簿
|
||||||
pic_not_found: 找不到該照片
|
pic_not_found: 找不到該照片
|
||||||
save: 儲存
|
save: 儲存
|
||||||
|
@ -33,6 +35,8 @@ zh_tw:
|
||||||
set_cover: 設為封面
|
set_cover: 設為封面
|
||||||
sure?: "你確定嗎?"
|
sure?: "你確定嗎?"
|
||||||
no_description: 沒有描述
|
no_description: 沒有描述
|
||||||
|
widget:
|
||||||
|
widget1: Widget1
|
||||||
widget_option:
|
widget_option:
|
||||||
horizontal: 水平圖片數量
|
horizontal: 水平圖片數量
|
||||||
vertical: 垂直圖片數量
|
vertical: 垂直圖片數量
|
||||||
|
|
|
@ -11,7 +11,9 @@ module Gallery
|
||||||
update_info 'some update_info'
|
update_info 'some update_info'
|
||||||
|
|
||||||
front_end do
|
front_end do
|
||||||
app_page 'albums'
|
app_page 'albums' do
|
||||||
|
frontend_i18n "gallery.front_end.albums"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
category ["gallery_categories"]
|
category ["gallery_categories"]
|
||||||
|
@ -25,8 +27,17 @@ module Gallery
|
||||||
categories_query 'GalleryCategory.all'
|
categories_query 'GalleryCategory.all'
|
||||||
# tags_query 'GalleryTag.all'
|
# tags_query 'GalleryTag.all'
|
||||||
|
|
||||||
customize_widget "albums","gallery.widget.albums",:fields=>[],:style=>[]
|
#* customize_widget "albums","gallery.widget.albums",:fields=>[],:style=>[],:options=>{"widget1"=>{"vertical"=>[1, 2], "horizontal"=>[1, 2, 3, 4, 5, 6], "album_id"=>{"query"=>"GalleryAlbum.all", "value"=>:id, "label"=>:name}}}
|
||||||
|
#* customize_widget_options_fields_i18n({"widget1"=>{"vertical"=>"gallery.widget_option.vertical", "horizontal"=>"gallery.widget_option.horizontal", "album_id"=>"gallery.widget_option.album"}} )
|
||||||
|
|
||||||
|
customize_widget "widget1" do
|
||||||
|
widget_i18n "gallery.widget.widget1"
|
||||||
|
style []
|
||||||
|
options "vertical",:i18n => "gallery.widget_option.vertical",:options_item=>[1, 2]
|
||||||
|
options "horizontal",:i18n => "gallery.widget_option.horizontal",:options_item=>[1, 2,3,4,5,6]
|
||||||
|
options "album_id",:i18n =>"gallery.widget_option.album",:options_item => {"query"=>"GalleryAlbum.all", "value"=>:id, "label"=>:name}
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
side_bar do
|
side_bar do
|
||||||
|
|
|
@ -7,8 +7,8 @@ zh_tw:
|
||||||
calendar: 日曆模組
|
calendar: 日曆模組
|
||||||
calendars: 日曆
|
calendars: 日曆
|
||||||
gallery: 相簿
|
gallery: 相簿
|
||||||
location: Location
|
location: (未命名)Location
|
||||||
|
ad_banner: 廣告輪播
|
||||||
|
|
||||||
miss_plugin_i18n:
|
miss_plugin_i18n:
|
||||||
personal_book: Personal Book
|
personal_book: Personal Book
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
module PersonalBook
|
module PersonalBook
|
||||||
OrbitApp.registration "Book",:type=> 'ModuleApp' do
|
OrbitApp.registration "Book",:type=> 'ModuleApp' do
|
||||||
|
module_label 'miss_plugin_i18n.personal_book'
|
||||||
base_url File.expand_path File.dirname(__FILE__)
|
base_url File.expand_path File.dirname(__FILE__)
|
||||||
personal_plugin :enable => true,:path=>"panel/personal_book/plugin/profile",:i18n=>'miss_module_i18n.personal_book'
|
personal_plugin :enable => true,:path=>"panel/personal_book/plugin/profile",:i18n=>'miss_module_i18n.personal_book'
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
module PersonalDiploma
|
module PersonalDiploma
|
||||||
OrbitApp.registration "Diploma",:type=> 'ModuleApp' do
|
OrbitApp.registration "Diploma",:type=> 'ModuleApp' do
|
||||||
|
module_label 'miss_plugin_i18n.personal_diploma'
|
||||||
base_url File.expand_path File.dirname(__FILE__)
|
base_url File.expand_path File.dirname(__FILE__)
|
||||||
personal_plugin :enable => true,:path=>"panel/personal_diploma/plugin/profile",:i18n=>'miss_plugin_i18n.personal_diploma'
|
personal_plugin :enable => true,:path=>"panel/personal_diploma/plugin/profile",:i18n=>'miss_plugin_i18n.personal_diploma'
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
module PersonalExperience
|
module PersonalExperience
|
||||||
OrbitApp.registration "Experience",:type=> 'ModuleApp' do
|
OrbitApp.registration "Experience",:type=> 'ModuleApp' do
|
||||||
|
module_label 'miss_plugin_i18n.personal_experience'
|
||||||
|
|
||||||
base_url File.expand_path File.dirname(__FILE__)
|
base_url File.expand_path File.dirname(__FILE__)
|
||||||
personal_plugin :enable => true,:path=>"panel/personal_experience/plugin/profile",:i18n=>'miss_plugin_i18n.personal_experience'
|
personal_plugin :enable => true,:path=>"panel/personal_experience/plugin/profile",:i18n=>'miss_plugin_i18n.personal_experience'
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
module PersonalHonor
|
module PersonalHonor
|
||||||
OrbitApp.registration "Honor",:type=> 'ModuleApp' do
|
OrbitApp.registration "Honor",:type=> 'ModuleApp' do
|
||||||
|
module_label 'miss_plugin_i18n.personal_honor'
|
||||||
base_url File.expand_path File.dirname(__FILE__)
|
base_url File.expand_path File.dirname(__FILE__)
|
||||||
personal_plugin :enable => true,:path=>"panel/personal_honor/plugin/profile",:i18n=>'miss_plugin_i18n.personal_honor'
|
personal_plugin :enable => true,:path=>"panel/personal_honor/plugin/profile",:i18n=>'miss_plugin_i18n.personal_honor'
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
module PersonalJournal
|
module PersonalJournal
|
||||||
OrbitApp.registration "Journal",:type=> 'ModuleApp' do
|
OrbitApp.registration "Journal",:type=> 'ModuleApp' do
|
||||||
|
module_label 'miss_plugin_i18n.personal_journal'
|
||||||
base_url File.expand_path File.dirname(__FILE__)
|
base_url File.expand_path File.dirname(__FILE__)
|
||||||
personal_plugin :enable => true,:path=>"panel/personal_journal/plugin/profile",:i18n=>'miss_plugin_i18n.personal_journal'
|
personal_plugin :enable => true,:path=>"panel/personal_journal/plugin/profile",:i18n=>'miss_plugin_i18n.personal_journal'
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
module PersonalLab
|
module PersonalLab
|
||||||
OrbitApp.registration "Lab",:type=> 'ModuleApp' do
|
OrbitApp.registration "Lab",:type=> 'ModuleApp' do
|
||||||
|
module_label 'miss_plugin_i18n.personal_lab'
|
||||||
base_url File.expand_path File.dirname(__FILE__)
|
base_url File.expand_path File.dirname(__FILE__)
|
||||||
personal_plugin :enable => true,:path=>"panel/personal_lab/plugin/profile",:i18n=>'miss_plugin_i18n.personal_lab'
|
personal_plugin :enable => true,:path=>"panel/personal_lab/plugin/profile",:i18n=>'miss_plugin_i18n.personal_lab'
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
module PersonalPatent
|
module PersonalPatent
|
||||||
OrbitApp.registration "Patent",:type=> 'ModuleApp' do
|
OrbitApp.registration "Patent",:type=> 'ModuleApp' do
|
||||||
|
module_label 'miss_plugin_i18n.personal_patent'
|
||||||
base_url File.expand_path File.dirname(__FILE__)
|
base_url File.expand_path File.dirname(__FILE__)
|
||||||
personal_plugin :enable => true,:path=>"panel/personal_patent/plugin/profile",:i18n=>'miss_plugin_i18n.personal_patent'
|
personal_plugin :enable => true,:path=>"panel/personal_patent/plugin/profile",:i18n=>'miss_plugin_i18n.personal_patent'
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
module PersonalProject
|
module PersonalProject
|
||||||
OrbitApp.registration "Research Project",:type=> 'ModuleApp' do
|
OrbitApp.registration "Research Project",:type=> 'ModuleApp' do
|
||||||
|
module_label 'miss_plugin_i18n.personal_project'
|
||||||
base_url File.expand_path File.dirname(__FILE__)
|
base_url File.expand_path File.dirname(__FILE__)
|
||||||
personal_plugin :enable => true,:path=>"panel/personal_project/plugin/profile",:i18n=>'miss_plugin_i18n.personal_project'
|
personal_plugin :enable => true,:path=>"panel/personal_project/plugin/profile",:i18n=>'miss_plugin_i18n.personal_project'
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
module PersonalResearch
|
module PersonalResearch
|
||||||
OrbitApp.registration "Research",:type=> 'ModuleApp' do
|
OrbitApp.registration "Research",:type=> 'ModuleApp' do
|
||||||
|
module_label 'miss_plugin_i18n.personal_research'
|
||||||
base_url File.expand_path File.dirname(__FILE__)
|
base_url File.expand_path File.dirname(__FILE__)
|
||||||
personal_plugin :enable => true,:path=>"panel/personal_research/plugin/profile",:i18n=>'miss_plugin_i18n.personal_research'
|
personal_plugin :enable => true,:path=>"panel/personal_research/plugin/profile",:i18n=>'miss_plugin_i18n.personal_research'
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
module PersonalSeminar
|
module PersonalSeminar
|
||||||
OrbitApp.registration "Seminar",:type=> 'ModuleApp' do
|
OrbitApp.registration "Seminar",:type=> 'ModuleApp' do
|
||||||
|
module_label 'miss_plugin_i18n.personal_seminar'
|
||||||
base_url File.expand_path File.dirname(__FILE__)
|
base_url File.expand_path File.dirname(__FILE__)
|
||||||
personal_plugin :enable => true,:path=>"panel/personal_seminar/plugin/profile",:i18n=>'miss_plugin_i18n.personal_seminar'
|
personal_plugin :enable => true,:path=>"panel/personal_seminar/plugin/profile",:i18n=>'miss_plugin_i18n.personal_seminar'
|
||||||
|
|
||||||
|
|
|
@ -21,8 +21,9 @@ module WebResource
|
||||||
categories_query 'BulletinCategory.all'
|
categories_query 'BulletinCategory.all'
|
||||||
tags_query 'WebResourceTag.all'
|
tags_query 'WebResourceTag.all'
|
||||||
|
|
||||||
customize_widget "home_list","web_resource.widget.home_list"
|
customize_widget "home_list" do
|
||||||
|
widget_i18n "web_resource.widget.home_list"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
side_bar do
|
side_bar do
|
||||||
|
|
Loading…
Reference in New Issue