first version of app config and modified inits.

This commit is contained in:
Fu Matthew 2013-01-29 20:33:40 +08:00
parent bfaa22052f
commit 71d5abae2e
36 changed files with 377 additions and 264 deletions

View File

@ -29,14 +29,17 @@ class Admin::PagePartsController < ApplicationController
@user_choose = @part.widget_path
@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
@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
@tags = @module_app.get_registration.get_tags
# if @module_app.widgets.any?{|b| b.class == Array}
# @widget_style = @module_app.widgets[@widget_path] if !@widget_path.blank? && !@module_app.widgets.blank?
# end
if @module_app
@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? or @module_app.nil?
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)
@ -44,22 +47,6 @@ class Admin::PagePartsController < ApplicationController
@widget_style = @module_app.widgets[@widget_path] if !@widget_path.blank? && !@module_app.widgets.blank?
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
def create
@ -107,29 +94,13 @@ class Admin::PagePartsController < ApplicationController
def reload_widgets
@part = PagePart.find params[:id]
@categories =[]
@module_app = ModuleApp.find(params[:module_app_id]) rescue nil
@categories =@module_app ? @module_app.get_categories : []
@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? )
case @module_app.key
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?)
@part.widget_path = @module_app.widgets.first if( @module_app)
respond_to do |format|
format.js {}
end

View File

@ -29,8 +29,8 @@ helper Admin::PagePartsHelper
@design = @item.design ? @item.design : @designs.first
if @item.module_app
@app_frontend_urls = @item.module_app.app_pages
@app_frontend_urls << 'default_widget' if @item.module_app.has_default_widget?
@app_frontend_urls = @item.module_app.app_pages.map{|t| [I18n.t(t[0]),t[1]]}
@app_frontend_urls << [I18n.t('default_widget.name'),'default_widget'] if @item.module_app.has_default_widget?
end
@ -140,10 +140,8 @@ helper Admin::PagePartsHelper
@page = Page.find params[:id] rescue nil
# @categories =[]
@module_app = ModuleApp.find(params[:module_app_id]) rescue nil
@app_frontend_urls = @module_app.nil? ? nil : @module_app.app_pages
@app_frontend_urls << 'default_widget' if(@module_app && @module_app.has_default_widget?)
@app_frontend_urls = @module_app.nil? ? nil : @module_app.app_pages.map{|t| [I18n.t(t[0]),t[1]]}
@app_frontend_urls << [I18n.t('default_widget.name'),'default_widget'] if(@module_app && @module_app.has_default_widget?)
case (@module_app.nil? ? nil : @module_app.key )
when 'announcement'

View File

@ -12,7 +12,11 @@ module Admin::PagePartsHelper
def widget_field_options(i,local_item=nil)
local_item = @part if local_item.nil? && @part
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
when Page

View File

@ -2,74 +2,40 @@ class ModuleApp
include Mongoid::Document
include Mongoid::Timestamps
include OrbitCoreLib::ObjectTokenUtility
include OrbitApp::ModuleAppMembershipTools
field :key
field :title
field :sidebar_order#,type: Integer
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
# 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)
def refetch_setting!(reg)
# %w{module_label category base_url version organization author intro update_info create_date}.each do |field|
# self[field.to_sym] = reg.send field
# end
self[:app_pages] = reg.get_app_pages
self[:enable_frontend] = reg.get_enable_frontend
self[:get_widget_style] = reg.get_widgets
self[:using_default_widget] = !reg.get_default_widget.blank?
self[:widgets] = reg.get_widgets
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
def get_default_widget
get_registration.get_default_widget
raise 'Need to link with OrbitApp [type: Array]'
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
widgets = get_registration.get_widgets
widgets = get_widget_style
ary = widgets.collect do |k,v|
if k == 'default_widget'
[I18n.t('widget.default_widget'),'default_widget']
@ -80,104 +46,85 @@ class ModuleApp
end
end
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 get_widget_style
# get_registration.get_widgets
# 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)
def has_default_widget?
self[:widgets].has_key? 'default_widget'
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
I18n.t(label_i18n)
end
def needs_to_widget_option?
if self.widget_options
self.widget_options.has_key? widgets.first
else
false
end
def label_i18n
reg = get_registration
reg.nil? ? 'Init is not defined completely' : get_registration.get_label_i18n
end
def has_default_widget?
case self[:widgets]
when Array
false
when Hash
self[:widgets].has_key? 'default_widget'
# def needs_to_widget_option?
# if self.widget_options
# self.widget_options.has_key? widgets.first
# else
# false
# end
# end
def using_default_widget?
# !get_registration.get_default_widget.blank?
self[:get_default_widget]
end
def widget_fields
# binding.pry
# raise 'Need to link with OrbitApp [type: Array]'
get_registration.get_default_widget_fields
end
protected
# def widgets
# # get_registration.get_widgets
# # get_registration.get_default_widget
# end
def set_key
self.key = self.title.underscore.singularize if self.title
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
# # has_many :tags
has_many :page_parts
has_many :pages
has_one :app_auth,dependent: :delete
def get_tags
get_registration.get_tags
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

View File

@ -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 } %>

View File

@ -6,11 +6,11 @@
<% if @module_app.nil? || @module_app.widgets.nil? || (@module_app.widgets[@widget_path].blank? rescue true) %>
<%= t("default_widget.no_support_setting")%>
<%else%>
<%= select('page_part', 'widget_style', @module_app.widgets[@widget_path]) %>
<%= select('page_part', 'widget_style', @module_app.widgets[@widget_path]["style"]) %>
<% end %>
</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">
<label class="control-label"><%= t("default_widget.select_widget_ext_option") %></label>
<div class="controls well" >

View File

@ -17,7 +17,7 @@
<%= t "default_widget.select_module_app" %>
</label>
<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>
@ -26,7 +26,7 @@
<%= t "default_widget.select_widget_path" %>
</label>
<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>

View File

@ -14,7 +14,7 @@
<%= content_tag_for(:label, @tags,:class=>"radio inline") do |tag|%>
<%= radio_button_tag("#{field_name}[tag]", tag.id, tag_checked_value(object,tag.id) ) %>
<%= tag[I18n.locale]%>
<% end %>
<% end if @tags%>
</fieldset>
<% else %>
<%= t("default_widget.no_support_setting")%>

View File

@ -1,5 +1,6 @@
<% @module_app.widget_options[@widget_path].each do |key,options| %>
<%= label_tag(t(@module_app.widget_options_fields_i18n[@widget_path][key]))%>
<% @module_app.widget_options(@widget_path).get_options.each do |key,settings| %>
<% options = settings[:opts] %>
<%= label_tag(t(settings[:label_i18n]))%>
<% case options%>
<% 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)) %>

View File

@ -1,5 +1,5 @@
<% 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_tag").html("<%= j render :partial => 'widget_data_source_tag',:locals=>{:object=>@part} %>");

View File

@ -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 } %>

View File

@ -1,7 +1,11 @@
zh_tw:
_locale: 中文
rulingcom:
errors:
init:
app_page_noname: 未命名前台頁面
module_app_noname: 未命名模組
front_page:
select_app_url: 模組前台樣式
is_published: 是否公開
@ -112,6 +116,7 @@ zh_tw:
delete: 刪除
delete_file: 刪除檔案
default_widget:
name: 預設樣式
no_support_setting: 沒有可以使用的設定
no_value: 不設定(全部)
fields_: 前台輸出欄位
@ -361,7 +366,7 @@ zh_tw:
link: 連結已更新成功
page: 頁面已更新成功
user: 使用者已更新成功
success_: 更新成功
# success_: 更新成功
paper: Paper was successfully updated.
user: User was successfully updated.
success_: S使用者已更新成功

View File

@ -5,12 +5,13 @@ module OrbitApp
module ClassMethods
@@frontend_pages = []
#Record all frontend pages of orbit
def add(var)
def add(var) #build @@frontend_pages
@@frontend_pages << var
end
def all
def all #return all frontend_pages of orbit
return @@frontend_pages
end
@ -21,18 +22,18 @@ module OrbitApp
other.extend( ClassMethods )
end
class AppPageSet
class AppPageSet # From Registration
def initialize(&block)
@frontend_pages = []
block.arity < 1 ? instance_eval(&block) : block.call(self) if block_given?
end
def app_page(name,options ={})
@frontend_pages << AppPage.new(name,options)
def app_page(name,&block)
@frontend_pages << AppPage.new(name,&block)
end
def to_module_app_format
@frontend_pages.collect{|t| t.name}
def to_module_app_format #For ModuleApp to fetch data
@frontend_pages.collect{|t| [t.get_i18n,t.name]}
end
end
@ -40,8 +41,18 @@ module OrbitApp
class AppPage
attr_reader :name
def initialize(name,options ={})
def initialize(name,&block)
@name = name
@frontend_i18n = 'rulingcom.errors.init.app_page_noname'
block.arity < 1 ? instance_eval(&block) : block.call(self) if block_given?
end
def frontend_i18n(i18n)
@frontend_i18n = i18n
end
def get_i18n
@frontend_i18n
end
def finalize!

View File

@ -35,6 +35,7 @@ module OrbitApp
@key = name.underscore.singularize
@side_bar = 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?
setup_module_app
end
@ -46,7 +47,7 @@ module OrbitApp
def setup_module_app
module_app = get_module_app
module_app = ModuleApp.new(:key=>@key,:title=>name) if module_app.nil?
module_app.refetch_setting!(self)
begin
module_app.save(:validate=>false)
rescue
@ -59,6 +60,10 @@ module OrbitApp
@module_label
end
def get_default_widget_fields
return @widget_set.get_fields
end
def get_default_widget
if @widget_set.nil? # Init not defining widget
return {}
@ -77,32 +82,40 @@ module OrbitApp
@front_end_app_pages.nil? ? [] : @front_end_app_pages.to_module_app_format
end
def get_widget_by_path(path)
if @widget_set
@widget_set.find_by_path(path)
else
nil
end
end
def get_widgets
@widget_set.nil? ? {} : @widget_set.to_module_app_format
end
def get_categories
@widget_set.get_categories
@widget_set.get_categories rescue []
end
def get_tags
@widget_set.get_tags
@widget_set.get_tags rescue []
end
def front_end(&block)
def front_end(&block) #setter for front_end from init
@front_end_app_pages = FrontendUtility::AppPageSet.new(&block)
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)
end
def personal_plugin(params)
def personal_plugin(params) #setter for personal_plugin from init
# TODO 這裡要看是一些檔案是不是都有
Plugin::Registration.new_from_module_app(@name,@base_path,params)
end
def widgets(&block)
def widgets(&block) #setter for widget from init
# @widgets = WidgetRegisition::WidgetSet.new(&block)
@widget_set = WidgetUtility::WidgetSet.new(&block)

View File

@ -34,6 +34,12 @@ module OrbitApp
define_method(field){|var| instance_variable_set( "@" + field, var)}
end
def find_by_path(path)
@widgets.each do |widget|
return widget if widget.name == path
end
end
def get_categories
eval(@categories_query) rescue nil
end
@ -46,10 +52,18 @@ module OrbitApp
@default_widget = DefaultWidget.new(&block)
end
def customize_widget(name,label,options ={})
@widgets << Widget.new(name,label,options)
def customize_widget(name,&block)
@widgets << Widget.new(name,&block)
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
hash = {}
@widgets.collect{|t| hash[t.name] = t.to_hash}
@ -57,10 +71,13 @@ module OrbitApp
hash
end
def get_fields
get_default_widget.get_fields
end
def get_default_widget
return @default_widget
end
end
class DefaultWidget
@ -69,9 +86,16 @@ module OrbitApp
def initialize(&block)
@query = nil
@image = nil
@more_link = {}
@fields = []
block.arity < 1 ? instance_eval(&block) : block.call(self) if block_given?
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
#will need to work with design
{:name=>"default_widget",:field=>nil,:label=>'label',:style=>STYLE}
@ -81,6 +105,18 @@ module OrbitApp
{:query=>@query,:image=>@image} rescue nil
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)
@query = var
end
@ -94,19 +130,38 @@ module OrbitApp
class Widget
attr_reader :name,:default_template,:fields
def initialize(name,label,options ={})
def initialize(name,&block)
@name = name
@fields = options[:fields]
@label = label
@style= options[:style]
@options = {}
block.arity < 1 ? instance_eval(&block) : block.call(self) if block_given?
# @fields = options[:fields]
# @label = label
# @style= options[:style]
end
def widget_i18n(str) # "gallery.widget.widget1"
@widget_i18n = str
end
def style(ary)# []
@style = ary
end
def get_options
@options
end
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}
end
def finalize!
{:name => @name,:fields=>@fields,:label=>@label,:style=>@style,:i18n=>@widget_i18n}
end
protected

View File

@ -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

View File

@ -1,6 +1,6 @@
module AdBanner
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__)
# personal_plugin :enable => true,:path=>"panel/ad_banner/plugin/profile",:i18n=>'admin.ad_banner'

View File

@ -11,6 +11,8 @@ zh_tw:
editing_announcement_category: 編輯公告類別
error:
no_avilb_cate_for_posting: 公告必需有一個類別才能發送,請與管理員聯絡
front_end:
bulletins: 請LIN給名字前台頁
new_bulletin_category: 新增公告類別
search: 搜尋公告
update_bulletin_success: 公告已成功更新

View File

@ -12,7 +12,9 @@ module Announcement
update_info 'some update_info'
front_end do
app_page 'bulletins'
app_page 'bulletins' do
frontend_i18n "announcement.front_end.bulletins"
end
end
category ["BulletinCategory"]
@ -21,13 +23,18 @@ module Announcement
default_widget do
query 'Bulletin.all'
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
categories_query 'BulletinCategory.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 "bulletins_and_web_links","announcement.widget.bulletins_and_web_links"
customize_widget "index" do
widget_i18n "announcement.widget.index"
style ["1","2"]
end
# item "index","announcement.widget.index",:default_template=>true,:fields=>["title","category","postdate"]
# item "bulletins_and_web_links","announcement.widget.bulletins_and_web_links"
end

View File

@ -1,7 +1,9 @@
zh_tw:
_locale: 中文
archive:
widget:
archive_files: 檔案室Wiget
add: 新增
back: 回去
create: 創造

View File

@ -26,7 +26,10 @@ module Archive
# categories_query 'BulletinCategory.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
side_bar do

View File

@ -11,6 +11,10 @@ class GalleryCategory
has_many :gallery_albums, :autosave => true, :dependent => :destroy
def title
name
end
def pp_object
name
end

View File

@ -23,6 +23,8 @@ zh_tw:
edit: 編輯
delete_selected: 刪除選擇項目
del_album?: "要刪除這本相簿嗎?"
front_end:
albums: 相簿前台
album_not_found: 找不到此相簿
pic_not_found: 找不到該照片
save: 儲存
@ -33,6 +35,8 @@ zh_tw:
set_cover: 設為封面
sure?: "你確定嗎?"
no_description: 沒有描述
widget:
widget1: Widget1
widget_option:
horizontal: 水平圖片數量
vertical: 垂直圖片數量

View File

@ -11,7 +11,9 @@ module Gallery
update_info 'some update_info'
front_end do
app_page 'albums'
app_page 'albums' do
frontend_i18n "gallery.front_end.albums"
end
end
category ["gallery_categories"]
@ -25,7 +27,16 @@ module Gallery
categories_query 'GalleryCategory.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

View File

@ -7,8 +7,8 @@ zh_tw:
calendar: 日曆模組
calendars: 日曆
gallery: 相簿
location: Location
location: (未命名)Location
ad_banner: 廣告輪播
miss_plugin_i18n:
personal_book: Personal Book

View File

@ -1,6 +1,6 @@
module PersonalBook
OrbitApp.registration "Book",:type=> 'ModuleApp' do
module_label 'miss_plugin_i18n.personal_book'
base_url File.expand_path File.dirname(__FILE__)
personal_plugin :enable => true,:path=>"panel/personal_book/plugin/profile",:i18n=>'miss_module_i18n.personal_book'

View File

@ -1,6 +1,6 @@
module PersonalDiploma
OrbitApp.registration "Diploma",:type=> 'ModuleApp' do
module_label 'miss_plugin_i18n.personal_diploma'
base_url File.expand_path File.dirname(__FILE__)
personal_plugin :enable => true,:path=>"panel/personal_diploma/plugin/profile",:i18n=>'miss_plugin_i18n.personal_diploma'

View File

@ -1,5 +1,6 @@
module PersonalExperience
OrbitApp.registration "Experience",:type=> 'ModuleApp' do
module_label 'miss_plugin_i18n.personal_experience'
base_url File.expand_path File.dirname(__FILE__)
personal_plugin :enable => true,:path=>"panel/personal_experience/plugin/profile",:i18n=>'miss_plugin_i18n.personal_experience'

View File

@ -1,6 +1,6 @@
module PersonalHonor
OrbitApp.registration "Honor",:type=> 'ModuleApp' do
module_label 'miss_plugin_i18n.personal_honor'
base_url File.expand_path File.dirname(__FILE__)
personal_plugin :enable => true,:path=>"panel/personal_honor/plugin/profile",:i18n=>'miss_plugin_i18n.personal_honor'

View File

@ -1,6 +1,6 @@
module PersonalJournal
OrbitApp.registration "Journal",:type=> 'ModuleApp' do
module_label 'miss_plugin_i18n.personal_journal'
base_url File.expand_path File.dirname(__FILE__)
personal_plugin :enable => true,:path=>"panel/personal_journal/plugin/profile",:i18n=>'miss_plugin_i18n.personal_journal'

View File

@ -1,6 +1,6 @@
module PersonalLab
OrbitApp.registration "Lab",:type=> 'ModuleApp' do
module_label 'miss_plugin_i18n.personal_lab'
base_url File.expand_path File.dirname(__FILE__)
personal_plugin :enable => true,:path=>"panel/personal_lab/plugin/profile",:i18n=>'miss_plugin_i18n.personal_lab'

View File

@ -1,6 +1,6 @@
module PersonalPatent
OrbitApp.registration "Patent",:type=> 'ModuleApp' do
module_label 'miss_plugin_i18n.personal_patent'
base_url File.expand_path File.dirname(__FILE__)
personal_plugin :enable => true,:path=>"panel/personal_patent/plugin/profile",:i18n=>'miss_plugin_i18n.personal_patent'

View File

@ -1,6 +1,6 @@
module PersonalProject
OrbitApp.registration "Research Project",:type=> 'ModuleApp' do
module_label 'miss_plugin_i18n.personal_project'
base_url File.expand_path File.dirname(__FILE__)
personal_plugin :enable => true,:path=>"panel/personal_project/plugin/profile",:i18n=>'miss_plugin_i18n.personal_project'

View File

@ -1,6 +1,6 @@
module PersonalResearch
OrbitApp.registration "Research",:type=> 'ModuleApp' do
module_label 'miss_plugin_i18n.personal_research'
base_url File.expand_path File.dirname(__FILE__)
personal_plugin :enable => true,:path=>"panel/personal_research/plugin/profile",:i18n=>'miss_plugin_i18n.personal_research'

View File

@ -1,6 +1,6 @@
module PersonalSeminar
OrbitApp.registration "Seminar",:type=> 'ModuleApp' do
module_label 'miss_plugin_i18n.personal_seminar'
base_url File.expand_path File.dirname(__FILE__)
personal_plugin :enable => true,:path=>"panel/personal_seminar/plugin/profile",:i18n=>'miss_plugin_i18n.personal_seminar'

View File

@ -21,8 +21,9 @@ module WebResource
categories_query 'BulletinCategory.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
side_bar do