diff --git a/app/controllers/admin/object_auths_controller.rb b/app/controllers/admin/object_auths_controller.rb index dab659b4..d407d3db 100644 --- a/app/controllers/admin/object_auths_controller.rb +++ b/app/controllers/admin/object_auths_controller.rb @@ -1,5 +1,5 @@ class Admin::ObjectAuthsController < ApplicationController - include OrbitCoreLib::PermissionUnility + include OrbitCoreLib::PermissionUtility layout "new_admin" before_filter :force_order # before_filter :is_admin? ,:only => :index diff --git a/app/controllers/admin/object_auths_new_interface_controller.rb b/app/controllers/admin/object_auths_new_interface_controller.rb index 7e0763ff..33c0dfe8 100644 --- a/app/controllers/admin/object_auths_new_interface_controller.rb +++ b/app/controllers/admin/object_auths_new_interface_controller.rb @@ -1,5 +1,5 @@ class Admin::ObjectAuthsNewInterfaceController < OrbitBackendController - include OrbitCoreLib::PermissionUnility + include OrbitCoreLib::PermissionUtility before_filter :force_order def set_module_app diff --git a/app/controllers/admin/page_parts_controller.rb b/app/controllers/admin/page_parts_controller.rb index f4672800..a188ce1b 100644 --- a/app/controllers/admin/page_parts_controller.rb +++ b/app/controllers/admin/page_parts_controller.rb @@ -28,27 +28,29 @@ class Admin::PagePartsController < ApplicationController @module_app = @part.module_app ? @part.module_app : @module_apps[0] @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_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 - case @module_app.key - when 'announcement' - @categories = BulletinCategory.all - @tags = AnnouncementTag.all - when 'news' - @categories = NewsBulletinCategory.all - @tags = NewsTag.all - when 'web_resource' - @categories = WebLinkCategory.all - @tags = WebResourceTag.all - when 'archive' - @categories = ArchiveFileCategory.all - @tags = ArchiveTag.all - end + # case @module_app.key + # when 'announcement' + # @categories = BulletinCategory.all + # @tags = AnnouncementTag.all + # when 'news' + # @categories = NewsBulletinCategory.all + # @tags = NewsTag.all + # when 'web_resource' + # @categories = WebLinkCategory.all + # @tags = WebResourceTag.all + # when 'archive' + # @categories = ArchiveFileCategory.all + # @tags = ArchiveTag.all + # end end def create @@ -60,7 +62,7 @@ class Admin::PagePartsController < ApplicationController params[:page_part][:widget_field] = params[:page_part][:widget_field].zip( params[:page_part][:widget_field_type] ) if params[:page_part][:widget_field] params[:page_part][:widget_field_type] = nil - + if @part.update_attributes(params[:page_part]) set_children_sub_menu(@part) if @part.public_r_tag && @part.public_r_tag.eql?('sub_menu') flash.now[:notice] = t('update.success.content') @@ -95,7 +97,7 @@ class Admin::PagePartsController < ApplicationController @widget_path = @module_app.widgets.keys[0] if ( @module_app.widgets[0].blank? ) - @widget_style = @module_app.widgets[@widget_path] if ( !@widget_path.blank? ) + @widget_style = @module_app.get_widget_style[@widget_path][:style] unless @widget_path.nil? case @module_app.key when 'announcement' @@ -119,8 +121,9 @@ class Admin::PagePartsController < ApplicationController def reload_widget_styles @module_app = ModuleApp.find(params[:module_app_id]) - @widget_style = @module_app.widgets[params[:id]] - + style_ary = @module_app.get_widget_style[params[:id]] + @widget_style = style_ary[:style] unless style_ary.nil? + respond_to do |format| format.js {} end diff --git a/app/controllers/default_widget_controller.rb b/app/controllers/default_widget_controller.rb new file mode 100644 index 00000000..6997840b --- /dev/null +++ b/app/controllers/default_widget_controller.rb @@ -0,0 +1,43 @@ +class DefaultWidgetController< OrbitWidgetController + + def front_end_available(var) + @page_part = PagePart.find params[:part_id] + @page_part.module_app.enable_frontend? + end + + def default_widget + @tag_class = nil + + @default_widget = @page_part.module_app.get_default_widget + @widget_image_field = @default_widget[:image] + data_limit = @page_part.widget_data_count.is_a?(Fixnum) ? @page_part.widget_data_count : (@page_part.widget_data_count.to_i rescue 3) + @data = eval(@default_widget[:query]).limit(data_limit).includes(@widget_image_field) + @fields = @page_part.widget_field + + case params[:type] + when "typeA" + @tag_class = 'defulat_widget_typeA' + render "typeA" + when /typeB_/ + @tag_class = "defulat_widget_#{params[:type]}" + render "typeB" + when "typeC" + @tag_class = 'defulat_widget_typeC' + render "typeC" + end + + + + # {"inner"=>"true", + # "category_id"=>"false", + # "tag_id"=>"", + # "page"=>"", + # "search_query"=>"", + # "part_title"=>"", + # "part_id"=>"50ac426f83e75219d20000a7", + # "controller"=>"default_widget", + # "action"=>"default_widget", + # "type"=>"typeA"} + end + +end diff --git a/app/controllers/orbit_backend_controller.rb b/app/controllers/orbit_backend_controller.rb index 530415ba..ce6640a8 100644 --- a/app/controllers/orbit_backend_controller.rb +++ b/app/controllers/orbit_backend_controller.rb @@ -1,41 +1,11 @@ class OrbitBackendController < ApplicationController - #before_filter :setup_vars - #before_filter :set_current_user - - # before_filter {|c| c.front_end_available(@app_title)} - # before_filter :check_user_can_use - include OrbitCoreLib::PermissionUnility + include OrbitCoreLib::AppBackendUtility + include OrbitCoreLib::PermissionUtility include AdminHelper include ApplicationHelper layout 'new_admin' - def setup_vars - @app_title ||= controller_path.split('/')[1].singularize - @module_app ||= ModuleApp.first(conditions: {:key => @app_title} ) - end - - private - - def force_order_for_visitor - setup_vars - set_current_user - end - - - def force_order_for_user - setup_vars - set_current_user - authenticate_user! - check_user_can_use - end - - def check_user_can_use - unless check_permission - #redirect_to polymorphic_path(['panel',@app_title,'back_end','public']) - redirect_to root_url - end - end def get_sorted_and_filtered(object_class, query=nil) objects = get_objects(object_class, query) diff --git a/app/controllers/orbit_frontend_controller.rb b/app/controllers/orbit_frontend_controller.rb index e1be8167..386b8cda 100644 --- a/app/controllers/orbit_frontend_controller.rb +++ b/app/controllers/orbit_frontend_controller.rb @@ -1,3 +1,4 @@ class OrbitFrontendController< OrbitFrontendComponentController + end \ No newline at end of file diff --git a/app/controllers/orbit_widget_controller.rb b/app/controllers/orbit_widget_controller.rb index 47e24fe0..f006cd43 100644 --- a/app/controllers/orbit_widget_controller.rb +++ b/app/controllers/orbit_widget_controller.rb @@ -1,3 +1,4 @@ class OrbitWidgetController< OrbitFrontendComponentController + end \ No newline at end of file diff --git a/app/helpers/admin_helper.rb b/app/helpers/admin_helper.rb index 120e1245..7cb28b96 100644 --- a/app/helpers/admin_helper.rb +++ b/app/helpers/admin_helper.rb @@ -16,7 +16,7 @@ module AdminHelper end def is_admin? - current_or_guest_user.admin? + current_or_guest_user.admin? rescue false end def is_member? diff --git a/app/models/module_app.rb b/app/models/module_app.rb index 22fb4814..b64ac908 100644 --- a/app/models/module_app.rb +++ b/app/models/module_app.rb @@ -1,7 +1,7 @@ class ModuleApp include Mongoid::Document include Mongoid::Timestamps - include OrbitCoreLib::ObjectTokenUnility + include OrbitCoreLib::ObjectTokenUtility field :key field :title @@ -21,9 +21,17 @@ class ModuleApp OrbitApp::Module::Registration.find_by_key(key) end - # %w{label_i18n }.each do |field| - # define_method(field){|var| get_registration.send("get_#{m}") } - # end + %w{widget_styles }.each do |field| + define_method(field){|var| get_registration.send("get_#{field}") } + end + + def get_default_widget + get_registration.get_default_widget + end + + def enable_frontend? + get_registration.get_enable_frontend + end def label_i18n reg = get_registration @@ -38,10 +46,20 @@ class ModuleApp !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 - ary = widgets.collect{|k,v| [I18n.t(v["label"]),k]} - ary << [I18n.t('widget.default_widget'),'default_widget']if using_default_widget? + ary = widgets.collect do |k,v| + if k == 'default_widget' + [I18n.t('widget.default_widget'),'default_widget'] + else + [I18n.t(v[:label]),k] + end + + end end def is_manager?(user) diff --git a/app/models/object_auth.rb b/app/models/object_auth.rb index 6c7405ca..f2ef5c04 100644 --- a/app/models/object_auth.rb +++ b/app/models/object_auth.rb @@ -1,5 +1,5 @@ class ObjectAuth < PrototypeAuth - include OrbitCoreLib::ObjectTokenUnility + include OrbitCoreLib::ObjectTokenUtility validates_uniqueness_of :title ,:scope => [:obj_authable_type,:obj_authable_id] #{ |c| } belongs_to :obj_authable, polymorphic: true after_save :check_user_has_can_access_app diff --git a/app/views/admin/page_parts/reload_widget_styles.js.erb b/app/views/admin/page_parts/reload_widget_styles.js.erb index 41b2ad9c..051108d6 100644 --- a/app/views/admin/page_parts/reload_widget_styles.js.erb +++ b/app/views/admin/page_parts/reload_widget_styles.js.erb @@ -1 +1,5 @@ -$('#widget_style_list select').html("<%= j options_for_select(@module_app.widgets[params[:id]]) %>") +<% if @widget_style.nil? %> + $('#widget_style_list select').html("") +<% else %> + $('#widget_style_list select').html("<%= j options_for_select(@widget_style) %>") +<% end %> diff --git a/app/views/default_widget/typeA.html.erb b/app/views/default_widget/typeA.html.erb new file mode 100644 index 00000000..22422516 --- /dev/null +++ b/app/views/default_widget/typeA.html.erb @@ -0,0 +1,19 @@ +<%= content_tag :div,:class=>@tag_class do%> +
+ + + + <% @fields.each do |field|%> + + <% end %> + + + <% @data.each do |row_data| %> + + <% @fields.each do |field|%> + + <% end %> + + <% end %> +
<%= content_tag(:span,field[0],:class=>field[1])%>
<%= content_tag(:span,row_data.send(field[0]),:class=>field[1])%>
+ <% end %> diff --git a/app/views/default_widget/typeB.html.erb b/app/views/default_widget/typeB.html.erb new file mode 100644 index 00000000..8c3cc34e --- /dev/null +++ b/app/views/default_widget/typeB.html.erb @@ -0,0 +1,22 @@ +<%= content_tag :div,:class=>@tag_class do%> + +
more
+ <% end %> diff --git a/app/views/default_widget/typeC.html.erb b/app/views/default_widget/typeC.html.erb new file mode 100644 index 00000000..4fceefc3 --- /dev/null +++ b/app/views/default_widget/typeC.html.erb @@ -0,0 +1,15 @@ +<%= content_tag :div,:class=>@tag_class do%> +
+ <%= image_tag @data.first.send(@widget_image_field)%> +
+ +
more
+ <% end %> diff --git a/app/views/layouts/_side_bar_content.html.erb b/app/views/layouts/_side_bar_content.html.erb index 479d6216..532390fb 100644 --- a/app/views/layouts/_side_bar_content.html.erb +++ b/app/views/layouts/_side_bar_content.html.erb @@ -4,8 +4,7 @@ <% content_for :page_specific_javascript do %> <%= javascript_include_tag "/static/kernel.js" %> <% end %> - -<%=OrbitApp::Module::SideBarRegisition.all.first.render(request,params,current_user) %> +<%=OrbitApp::Module::SideBarRegisition.all.first.render(request,params,current_user,@module_app) %>
<% flash.each do |key, msg| %> diff --git a/config/locales/zh_tw.yml b/config/locales/zh_tw.yml index 1971ab2a..8979f7bf 100644 --- a/config/locales/zh_tw.yml +++ b/config/locales/zh_tw.yml @@ -867,11 +867,11 @@ zh_tw: widget: default_widget: 系統預設Widget _default_widget: - style1: 表格列表 - style2: 單行列佐圖(同邊) - style3: 多行列佐圖(同邊) - style4: 多行列佐圖(異邊) - style5: 單行列佐單圖(同邊) + typeA: 表格列表 + typeB_style2: 單行列佐圖(同邊) + typeB_style3: 多行列佐圖(同邊) + typeB_style4: 多行列佐圖(異邊) + typeC: 單行列佐單圖(同邊) # : <<<<<<< HEAD mongoid: models: diff --git a/config/routes.rb b/config/routes.rb index 9b584ebe..01129e1f 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -220,7 +220,7 @@ Orbit::Application.routes.draw do # match '/desktop_orbit/eventajaxload' => 'desktop_publications#update_journal' - + match '/panel/orbit_app/widget/:type' => 'default_widget#default_widget' match '/panel/:app_name/front_end/:app_action/:id(/:controller_action)' => 'pages#show_from_link', :constraints => lambda { |request| !request.query_string.include?("inner=true") diff --git a/lib/orbit_app/helper/context_link_renderer.rb b/lib/orbit_app/helper/context_link_renderer.rb index 9e1af318..a34f6cb4 100644 --- a/lib/orbit_app/helper/context_link_renderer.rb +++ b/lib/orbit_app/helper/context_link_renderer.rb @@ -1,12 +1,32 @@ module ContextLinkRenderer include Renderer - def render(request,params) + def render(request,params,module_app,user) + @module_app = module_app @request = request @params = params + @current_user = user if display? content_tag :li, link_to((I18n.t(@label_i18n) + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe, eval(@path)), :class => (active? ? 'active' : nil) end end +protected + def display? + @available_for.each do |available_for_in_sym| + result = case available_for_in_sym + when :all + true + when :manager + @module_app.is_manager? @current_user + when :sub_manager + @module_app.is_sub_manager? @current_user + else + (eval(available_for_in_sym).include? @current_user rescue false) + end # of case + return true if result || @current_user.admin? + end # of collect + false + end + end \ No newline at end of file diff --git a/lib/orbit_app/helper/renderer.rb b/lib/orbit_app/helper/renderer.rb index 3eb09b86..ee2ffb23 100644 --- a/lib/orbit_app/helper/renderer.rb +++ b/lib/orbit_app/helper/renderer.rb @@ -8,10 +8,15 @@ module Renderer protected def active_for_app_auth? - @module_app.id.to_s == @params[:module_app_id] ? true : false + if @module_app.nil? + false + else + @module_app.id.to_s == @params[:module_app_id] ? true : false + end end def active_for_ob_auths? + if @params.has_key? :object_auth_id oa = ObjectAuth.find @params[:object_auth_id] check_controller = @params[:controller] == 'admin/object_auths_new_interface' diff --git a/lib/orbit_app/helper/side_bar_renderer.rb b/lib/orbit_app/helper/side_bar_renderer.rb index 5e04f69e..3fd680ef 100644 --- a/lib/orbit_app/helper/side_bar_renderer.rb +++ b/lib/orbit_app/helper/side_bar_renderer.rb @@ -2,7 +2,8 @@ module SideBarRenderer include Renderer include AdminHelper - def render(request,params,user) + def render(request,params,user,module_app) + @module_app = module_app @request = request @params = params @current_user = user @@ -11,7 +12,7 @@ module SideBarRenderer buf = link_to( content_tag(:i, nil, :class => @icon_class ) + content_tag(:span, I18n.t( @head_label )), eval(@head_link)) buf << content_tag( :ul, :class => ("nav nav-list active") )do # visible_for_controllers('bulletins', '/panel/announcement/back_end/tags', 'bulletin_categorys', 'approvals')||active_for_ob_auths_object("BulletinCategory")) @context_links.sort_by! {| obj | obj.priority}.collect do |link| - link.render(request,params) + link.render(request,params,@module_app,@current_user) end.join.html_safe end end diff --git a/lib/orbit_app/module/registration.rb b/lib/orbit_app/module/registration.rb index c7967663..d94de028 100644 --- a/lib/orbit_app/module/registration.rb +++ b/lib/orbit_app/module/registration.rb @@ -78,11 +78,11 @@ module OrbitApp end def get_categories - eval(@widget_set.categories_query) rescue nil + @widget_set.get_categories end def get_tags - eval(@widget_set.tags_query) rescue nil + @widget_set.get_tags end def front_end(&block) diff --git a/lib/orbit_app/module/side_bar.rb b/lib/orbit_app/module/side_bar.rb index d82cac84..7d733bfa 100644 --- a/lib/orbit_app/module/side_bar.rb +++ b/lib/orbit_app/module/side_bar.rb @@ -46,9 +46,9 @@ module OrbitApp @active_for_app_auth = [] @head_link = "" @app_base_path = '' + @module_app_key = key block.arity < 1 ? instance_eval(&block) : block.call(self) if block_given? # setup_module_app(module_app_key) - @module_app_key = key finalize! SideBarRegisition.add(self) end @@ -76,6 +76,7 @@ module OrbitApp end def context_link(*var) + var[1].merge!(:module_app_key=>@module_app_key) unless @module_app_key.nil? new_context_link = ContextLink.new(*var) @context_links << new_context_link end @@ -124,10 +125,14 @@ module OrbitApp @active_for_action = options[:active_for_action] || [] @active_for_object_auth = options[:active_for_object_auth] || [] @active_for_app_auth = options[:active_for_app_auth] || [] + @module_app_key = options[:module_app_key] end def active? - active_for_action? || active_for_app_auth? || active_for_ob_auths? + for_action = @active_for_action.blank? ? false : active_for_action? + for_app_auth = @active_for_app_auth.blank? ? false : active_for_app_auth? + for_ob_auth = @active_for_object_auth.blank? ? false : active_for_ob_auths? + for_action || for_app_auth || for_ob_auth end def active_for_action? diff --git a/lib/orbit_app/module/widget.rb b/lib/orbit_app/module/widget.rb index 708dc28d..5c6932bd 100644 --- a/lib/orbit_app/module/widget.rb +++ b/lib/orbit_app/module/widget.rb @@ -35,11 +35,11 @@ module OrbitApp end def get_categories - @categories_query + eval(@categories_query) rescue nil end def get_tags - @tags_query + eval(@tags_query) rescue nil end def default_widget(&block) @@ -53,6 +53,7 @@ module OrbitApp def to_module_app_format hash = {} @widgets.collect{|t| hash[t.name] = t.to_hash} + hash["default_widget"]= DefaultWidget.get_interface_args unless @default_widget.blank? hash end @@ -63,12 +64,19 @@ module OrbitApp end class DefaultWidget + STYLE = ["typeA","typeB_style2","typeB_style3","typeB_style4","typeC"] + def initialize(&block) @query = nil @image = nil block.arity < 1 ? instance_eval(&block) : block.call(self) if block_given? end + def self.get_interface_args + #will need to work with design + {:name=>"default_widget",:field=>nil,:label=>'label',:style=>STYLE} + end + def to_module_app_format {:query=>@query,:image=>@image} rescue nil end @@ -90,10 +98,11 @@ module OrbitApp @name = name @fields = options[:fields] @label = label + @style= options[:style] end def to_hash - {:name => @name,:fields=>@fields,:label=>@label} + {:name => @name,:fields=>@fields,:label=>@label,:style=>@style} end def finalize! diff --git a/lib/orbit_core_lib.rb b/lib/orbit_core_lib.rb index 3abeeddd..5be4de3b 100644 --- a/lib/orbit_core_lib.rb +++ b/lib/orbit_core_lib.rb @@ -81,7 +81,7 @@ module OrbitCoreLib end query1 = auth_object_space.any_in({sub_role_ids: sub_role_ids_ary}).excludes(blocked_user_ids: user.id) - query2 = auth_object_space.any_of({all: true},{privilege_user_ids: user.id},{role_ids: user.role.id}).excludes(blocked_user_ids: user.id) + query2 = auth_object_space.any_of({all: true},{privilege_user_ids: user.id},{role_ids: user.role_ids}).excludes(blocked_user_ids: user.id) result = (query1 + query2).uniq result.collect{|t| t.obj_authable}.delete_if{|val| val==nil} end @@ -128,7 +128,7 @@ module OrbitCoreLib end end - module ObjectTokenUnility + module ObjectTokenUtility def self.included(base) base.instance_eval("field :s_token") base.instance_eval("after_create :generate_token") @@ -145,7 +145,7 @@ module OrbitCoreLib end end - module PermissionUnility + module PermissionUtility private def check_permission(type = :use) permission_grant = current_or_guest_user.admin?? true : false @@ -168,4 +168,34 @@ module OrbitCoreLib ModuleApp.first(conditions: {s_token: token}) end end + + module AppBackendUtility + def setup_vars + @app_title ||= controller_path.split('/')[1].singularize + @module_app ||= ModuleApp.first(conditions: {:key => @app_title} ) + end + + private + + def force_order_for_visitor + setup_vars + set_current_user + end + + + def force_order_for_user + setup_vars + set_current_user + authenticate_user! + check_user_can_use + end + + def check_user_can_use + unless check_permission + #redirect_to polymorphic_path(['panel',@app_title,'back_end','public']) + redirect_to root_url + end + end + end + end diff --git a/lib/parsers/parser_common.rb b/lib/parsers/parser_common.rb index 047f72e6..0c18bf0b 100644 --- a/lib/parsers/parser_common.rb +++ b/lib/parsers/parser_common.rb @@ -215,7 +215,13 @@ module ParserCommon when 'text' ret << part.content rescue '' when 'module_widget' - url = "/panel/#{part.module_app.key}/widget/#{part.widget_path}?inner=true" + url = case part.widget_path + when 'default_widget' + "/panel/orbit_app/widget/#{part.widget_style}?inner=true" + else + "/panel/#{part.module_app.key}/widget/#{part.widget_path}?inner=true" + end + options = "&category_id=#{!part[:category].blank? ? part[:category].blank? : category}&tag_id=#{!part[:tag].blank? ? part[:tag] : tag}&page=#{params[:page]}&search_query=#{params[:search_query]}&part_title=#{Rack::Utils.escape(part_title).gsub("+", "%20") rescue nil}&part_id=#{part.id}" ret << "
" when 'public_r_tag' diff --git a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletin_categorys_controller.rb b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletin_categorys_controller.rb index 7b5abb1f..f1fd138c 100644 --- a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletin_categorys_controller.rb +++ b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletin_categorys_controller.rb @@ -3,6 +3,10 @@ class Panel::Announcement::BackEnd::BulletinCategorysController < OrbitBackendCo before_filter :for_app_manager,:except => [:index,:get_categorys_json,:get_bulletins_json] + before_filter :force_order_for_visitor,:only=>[:index,:get_categorys_json,:get_bulletins_json] + before_filter :force_order_for_user,:except => [:index,:get_categorys_json,:get_bulletins_json] + before_filter :for_app_sub_manager,:except => [:index,:get_categorys_json,:get_bulletins_json] + def index @bulletin_categorys = get_categories_for_index("BulletinCategory") #TODO 需要做 manager ,admin 才可以 all. 其他 available就好 diff --git a/vendor/built_in_modules/announcement/config/locales/zh_tw.yml b/vendor/built_in_modules/announcement/config/locales/zh_tw.yml index 5fd57d49..ada03b99 100644 --- a/vendor/built_in_modules/announcement/config/locales/zh_tw.yml +++ b/vendor/built_in_modules/announcement/config/locales/zh_tw.yml @@ -17,4 +17,10 @@ zh_tw: update_bulletin_category_success: 公告類別已成功更新 widget: index: 目錄Widget - bulletins_and_web_links: 公告與連結並排Widget \ No newline at end of file + bulletins_and_web_links: 公告與連結並排Widget + #init don't merge + all_articles: 全部公告 + add_new: 新增 + categories: 分類 + approval_setting: 審核權限 + tags: 標籤 \ No newline at end of file diff --git a/vendor/built_in_modules/announcement/init.rb b/vendor/built_in_modules/announcement/init.rb index 2d8b9ae4..69da05ce 100644 --- a/vendor/built_in_modules/announcement/init.rb +++ b/vendor/built_in_modules/announcement/init.rb @@ -25,7 +25,7 @@ module Announcement categories_query 'BulletinCategory.all' tags_query 'AnnouncementTag.all' - customize_widget "index","announcement.widget.index",:fields=>["title","category","postdate"] + 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" # item "index","announcement.widget.index",:default_template=>true,:fields=>["title","category","postdate"] # item "bulletins_and_web_links","announcement.widget.bulletins_and_web_links" @@ -42,13 +42,14 @@ module Announcement context_link 'announcement.all_articles', :link_path=>"panel_announcement_back_end_bulletins_path" , :priority=>1, - :active_for_action=>{:bulletins=>:index} + :active_for_action=>{:bulletins=>:index}, + :available_for => [:all] context_link 'announcement.add_new', :link_path=>"new_panel_announcement_back_end_bulletin_path" , :priority=>2, :active_for_action=>{:bulletins=>:new}, - :available_for => [:manager] + :available_for => [:sub_manager] context_link 'announcement.categories', :link_path=>"panel_announcement_back_end_bulletin_categorys_path" , @@ -59,12 +60,13 @@ module Announcement context_link 'announcement.tags', :link_path=>"panel_announcement_back_end_tags_path" , :priority=>4, - :active_for_action=>{:bulletin_categorys=>:index}, + # :active_for_action=>{:bulletin_categorys=>:index}, :available_for => [:manager] context_link 'announcement.approval_setting', :link_path=>"panel_announcement_back_end_approval_setting_path" , :priority=>5, + :active_for_action=>{:approvals=>:setting}, :active_for_object_auth => 'BulletinCategory', :available_for => [:manager]