diff --git a/app/controllers/admin/page_parts_controller.rb b/app/controllers/admin/page_parts_controller.rb
index 2315c511..fd4b85f3 100644
--- a/app/controllers/admin/page_parts_controller.rb
+++ b/app/controllers/admin/page_parts_controller.rb
@@ -22,17 +22,20 @@ class Admin::PagePartsController < ApplicationController
def edit
@part = PagePart.find(params[:id])
- @module_apps = ModuleApp.all(:conditions => {:enable_frontend => true})
+ @module_apps = ModuleApp.excludes(widgets: nil).where(enable_frontend: true).order_by(:title, :asc)
@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
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
end
end
@@ -71,10 +74,13 @@ class Admin::PagePartsController < ApplicationController
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
end
respond_to do |format|
diff --git a/app/views/admin/page_parts/_module_widget.html.erb b/app/views/admin/page_parts/_module_widget.html.erb
index 374242df..3f81a5ae 100644
--- a/app/views/admin/page_parts/_module_widget.html.erb
+++ b/app/views/admin/page_parts/_module_widget.html.erb
@@ -6,7 +6,12 @@
<%= f.select :widget_path, @module_app.widgets.collect{|widget| [widget.humanize, widget]}, :selected => @part.widget_path %>
+:
<%= render 'widget_categories' %>
+
+<%= t :or_lower %>
+
+ <%= render 'widget_tags' %>
\ No newline at end of file
diff --git a/app/views/admin/page_parts/_widget_tags.html.erb b/app/views/admin/page_parts/_widget_tags.html.erb
new file mode 100644
index 00000000..bb78f118
--- /dev/null
+++ b/app/views/admin/page_parts/_widget_tags.html.erb
@@ -0,0 +1 @@
+ <%= select 'page_part', 'tag', @tags.collect{|category| [category[I18n.locale], category.id]}, :selected => (@part ? @part[:tag] : nil), :include_blank => true if @tags && @tags.size > 0 %>
\ No newline at end of file
diff --git a/app/views/admin/page_parts/reload_widgets.js.erb b/app/views/admin/page_parts/reload_widgets.js.erb
index 67e7589d..2b851ce0 100644
--- a/app/views/admin/page_parts/reload_widgets.js.erb
+++ b/app/views/admin/page_parts/reload_widgets.js.erb
@@ -1,2 +1,3 @@
$('#widget_list select').html("<%= j options_for_select(@module_app.widgets.collect{|widget| [widget.humanize, widget]}) %>")
-$('#widget_category').html("<%= j render 'widget_categories' %>")
\ No newline at end of file
+$('#widget_category').html("<%= j render 'widget_categories' %>")
+$('#widget_tag').html("<%= j render 'widget_tags' %>")
\ No newline at end of file
diff --git a/app/views/layouts/_side_bar.html.erb b/app/views/layouts/_side_bar.html.erb
index 691b330a..e9417091 100644
--- a/app/views/layouts/_side_bar.html.erb
+++ b/app/views/layouts/_side_bar.html.erb
@@ -5,12 +5,12 @@
<%= javascript_include_tag "/static/kernel.js" %>
<% end %>
-<%= content_tag :li, :class => active_for_controllers('bulletins', '/panel/announcement/back_end/tags', 'bulletin_categorys', 'approvals') || active_sys_call_for_app('module_apps','edit','Announcement') do -%>
+<%= content_tag :li, :class => active_for_controllers('bulletins', '/panel/announcement/back_end/tags', 'bulletin_categorys', 'approvals','bulletin_category_setting') || active_sys_call_for_app('module_apps','edit','Announcement') do -%>
<%= link_to content_tag(:i, nil, :class => 'icons-announcement') + t('admin.announcement'), panel_announcement_back_end_bulletins_path %>
<%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('bulletins', '/panel/announcement/back_end/tags', 'bulletin_categorys', 'approvals')) do -%>
<%= content_tag :li, link_to(t('announcement.all_articles'), panel_announcement_back_end_bulletins_path), :class => active_for_action('bulletins', 'index') %>
<%= content_tag :li, link_to(t('announcement.add_new'), new_panel_announcement_back_end_bulletin_path), :class => active_for_action('bulletins', 'new') %>
- <%= content_tag :li, link_to(t('announcement.categories'), panel_announcement_back_end_bulletin_categorys_path), :class => active_for_action('bulletin_categorys', 'index') %>
+ <%= content_tag :li, link_to(t('announcement.categories'), panel_announcement_back_end_bulletin_categorys_path), :class => (active_for_action('bulletin_categorys', 'index') || active_for_action('bulletin_category_setting', 'setting')) %>
<%= content_tag :li, link_to(t('announcement.tags'), panel_announcement_back_end_tags_path), :class => active_for_action('/panel/announcement/back_end/tags', 'index') %>
<%= content_tag :li, link_to(t('announcement.bulletin.approval_setting'), panel_announcement_back_end_approval_setting_path), :class => active_for_action('approvals', 'setting') if (is_manager? rescue nil) %>
<%= content_tag :li, link_to(t('admin.module.authorization'),edit_admin_module_app_path(ModuleApp.first(conditions: {title: "Announcement"}))), :class => active_sys_call_for_app('module_apps','edit','Announcement') if (is_admin? rescue nil) %>
@@ -19,12 +19,12 @@
<% end -%>
-<%= content_tag :li, :class => active_for_controllers('news_bulletins', '/panel/news/back_end/tags', 'news_bulletin_categorys', 'news_approvals') do -%>
+<%= content_tag :li, :class => active_for_controllers('news_bulletins', '/panel/news/back_end/tags', 'news_bulletin_categorys', 'news_approvals','news_bulletin_category_setting') do -%>
<%= link_to content_tag(:i, nil, :class => 'icons-announcement') + t('admin.news'), panel_news_back_end_news_bulletins_path %>
<%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('news_bulletins', '/panel/news/back_end/tags', 'news_bulletin_categorys', 'news_approvals')) do -%>
<%= content_tag :li, link_to(t('announcement.all_articles'), panel_news_back_end_news_bulletins_path), :class => active_for_action('news_bulletins', 'index') %>
<%= content_tag :li, link_to(t('announcement.add_new'), new_panel_news_back_end_news_bulletin_path), :class => active_for_action('news_bulletins', 'new') %>
- <%= content_tag :li, link_to(t('announcement.categories'), panel_news_back_end_news_bulletin_categorys_path), :class => active_for_action('news_bulletin_categorys', 'index') %>
+ <%= content_tag :li, link_to(t('announcement.categories'), panel_news_back_end_news_bulletin_categorys_path), :class => (active_for_action('news_bulletin_categorys', 'index') || active_for_action('news_bulletin_category_setting', 'setting'))%>
<%= content_tag :li, link_to(t('announcement.tags'), panel_news_back_end_tags_path), :class => active_for_action('/panel/news/back_end/tags', 'index') %>
<%= content_tag :li, link_to(t('announcement.bulletin.approval_setting'), panel_news_back_end_news_approval_setting_path), :class => active_for_action('news_approvals', 'setting') if (is_manager? rescue nil) %>
<%= content_tag :li, link_to(t('admin.module.authorization'),edit_admin_module_app_path(ModuleApp.first(conditions: {key: "news"}))), :class => active_sys_call_for_app('module_apps','edit','news') if (is_admin? rescue nil) %>
diff --git a/lib/parsers/parser_back_end.rb b/lib/parsers/parser_back_end.rb
index f32e8084..33b19510 100644
--- a/lib/parsers/parser_back_end.rb
+++ b/lib/parsers/parser_back_end.rb
@@ -46,6 +46,7 @@ module ParserBackEnd
if (content["main"] == "true" && !page.module_app.nil?)
ret << "
"
else
part = page.page_parts.detect{ |p| p.name.to_s == content['name'].to_s } rescue nil
@@ -57,8 +58,10 @@ module ParserBackEnd
when 'text'
ret << part.i18n_variable[I18n.locale] rescue ''
when 'module_widget'
- if part[:category]
- ret << ""
+ if !part[:category].blank?
+ ret << ""
+ elsif !part[:tag].blank?
+ ret << ""
else
ret << ""
end
diff --git a/lib/parsers/parser_front_end.rb b/lib/parsers/parser_front_end.rb
index 2a0f38cf..a0004f15 100644
--- a/lib/parsers/parser_front_end.rb
+++ b/lib/parsers/parser_front_end.rb
@@ -61,10 +61,10 @@ module ParserFrontEnd
# else
# ret << ""
# end
- if !params[:category_id].blank?
- ret << ""
- elsif !params[:tag_id].blank?
- ret << ""
+ if !part[:category].blank?
+ ret << ""
+ elsif !part[:tag].blank?
+ ret << ""
else
ret << ""
end
diff --git a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/approvals_controller.rb b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/approvals_controller.rb
index 566b0742..9f63a8ab 100644
--- a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/approvals_controller.rb
+++ b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/approvals_controller.rb
@@ -7,9 +7,9 @@ class Panel::Announcement::BackEnd::ApprovalsController < OrbitBackendControlle
@bulletin = Bulletin.find params[:bulletin_id]
end
- def approve
-
- end
+ # def approve
+ #
+ # end
def setting
@bulletin_categorys = BulletinCategory.all
@@ -39,41 +39,7 @@ class Panel::Announcement::BackEnd::ApprovalsController < OrbitBackendControlle
def user_list
@bulletin_category = BulletinCategory.find params[:category][:id]
end
- # def index
- # get_categorys(params[:bulletin_category_id])
- #
- # @bulletins = params[:sort] ? get_sorted_bulletins : Bulletin.all
- # @bulletin_categories = BulletinCategory.all
- #
- # module_app = ModuleApp.first(:conditions => {:key => 'announcement'})
- # @tags = Tag.all(:conditions => {:module_app_id => module_app.id}).order_by(I18n.locale, :asc)
- #
- # respond_to do |format|
- # format.html # index.html.erb
- # format.js
- # format.xml { render :xml => @bulletins }
- # end
- # end
- #
- # def new
- #
- # end
- #
- # def create
- #
- # end
- #
- # def update
- #
- # end
- #
- # def edit
- #
- # end
- #
- # def destroy
- #
- # end
+
protected
def update_setting_by_params
category = BulletinCategory.find params[:category][:id]
diff --git a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletin_category_setting_controller.rb b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletin_category_setting_controller.rb
new file mode 100644
index 00000000..4be5f6bc
--- /dev/null
+++ b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletin_category_setting_controller.rb
@@ -0,0 +1,63 @@
+class Panel::Announcement::BackEnd::BulletinCategorySettingController < OrbitBackendController
+ before_filter :authenticate_user!
+ before_filter :for_app_manager
+ include AdminHelper
+ # layout 'admin'
+ def preview_and_approve
+ @bulletin = Bulletin.find params[:bulletin_id]
+ end
+
+ # def approve
+ #
+ # end
+
+ def setting
+ @bulletin_categorys = []
+ @bulletin_categorys << BulletinCategory.find(params[:bulletin_category_id])
+ @options_from_collection_for_select_bulletin_categorys = @bulletin_categorys.collect{|bc| [bc.i18n_variable[I18n.locale],bc.id] }
+ if params.has_key? :category
+ @bulletin_category = BulletinCategory.find params[:category][:id]
+ else
+ @bulletin_category = @bulletin_categorys.first
+ end
+ preload_object_auth = @bulletin_category.object_auths.where(title: 'submit').empty?? (@bulletin_category.object_auths.create! :title=> 'submit') : @bulletin_category.object_auths.where(title: 'submit')
+ @users_array = preload_object_auth.first.privilege_users rescue []
+ respond_to do |format|
+ format.html
+ format.js
+ end
+ end
+
+ def update_setting
+ object_auth = update_setting_by_params
+ if object_auth.save!
+ flash[:notice] = "Update Done"
+ else
+ flash[:notice] = "Update Failed"
+ end
+ end
+
+ def user_list
+ @bulletin_category = BulletinCategory.find params[:category][:id]
+ end
+
+ protected
+ def update_setting_by_params
+ category = BulletinCategory.find params[:category][:id]
+ privilege_users = params[:users].collect{|key,value| User.find key } rescue []
+ object_auth_ary = category.object_auths.where(title: 'submit') || (category.object_auths.create :title=> 'submit')
+ object_auth = object_auth_ary.first
+ object_auth.privilege_users = privilege_users
+ object_auth
+ end
+
+ def get_categorys(id = nil)
+ @bulletin_categorys = []
+ if(is_manager? || is_admin?)
+ @bulletin_categorys = (id ? BulletinCategory.find(id).to_a : BulletinCategory.excludes('disabled' => true))
+ elsif is_sub_manager?
+ @bulletin_categorys = BulletinCategory.authed_for_user(current_user,'submit_new')
+ end
+ end
+
+end
diff --git a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/front_end/bulletins_controller.rb b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/front_end/bulletins_controller.rb
index 6c1b2cc3..725ffac9 100644
--- a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/front_end/bulletins_controller.rb
+++ b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/front_end/bulletins_controller.rb
@@ -13,17 +13,15 @@ class Panel::Announcement::FrontEnd::BulletinsController < OrbitWidgetController
date_now = Time.now
if !params[:category_id].blank?
@bulletins = Bulletin.can_display.where(:bulletin_category_id => params[:category_id]).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(10)
+ @current_category = BulletinCategory.from_id(params[:category_id]) rescue nil
elsif !params[:tag_id].blank?
- tmp = AnnouncementTag.find(params[:tag_id]) rescue nil
- tmp = AnnouncementTag.where(key: params[:tag_id])[0] unless tmp
- @bulletins = tmp.bulletins.can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(10)
+ @tag = AnnouncementTag.find(params[:tag_id]) rescue nil
+ @tag = AnnouncementTag.where(key: params[:tag_id])[0] unless @tag
+ @bulletins = @tag.bulletins.can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(10)
else
@bulletins = Bulletin.can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(10)
end
-
- get_categorys
- @current_category = BulletinCategory.from_id(params[:category_id]) rescue nil
end
def show
diff --git a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/widget/bulletins_controller.rb b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/widget/bulletins_controller.rb
index 6ac2ae05..57295cc7 100644
--- a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/widget/bulletins_controller.rb
+++ b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/widget/bulletins_controller.rb
@@ -9,20 +9,21 @@ class Panel::Announcement::Widget::BulletinsController < OrbitWidgetController
# GET /bulletins.xml
def index
-
- # deadline
- # @bulletin_categorys = BulletinCategory.first;
- # @bulletins = Bulletin.widget_datas(@bulletin_categorys.id).limit(9)
+
+ date_now = Time.now
if !params[:category_id].blank?
- @bulletins = Bulletin.can_display.where(:bulletin_category_id => params[:category_id]).widget_datas.limit(9)
+ @bulletins = Bulletin.can_display.where(:bulletin_category_id => params[:category_id]).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(10)
+ @current_category = BulletinCategory.from_id(params[:category_id]) rescue nil
elsif !params[:tag_id].blank?
- @bulletins = AnnouncementTag.find(params[:tag_id]).bulletins.can_display.widget_datas.limit(9) rescue nil
+ @tag = AnnouncementTag.find(params[:tag_id]) rescue nil
+ @tag = AnnouncementTag.where(key: params[:tag_id])[0] unless @tag
+ @bulletins = @tag.bulletins.can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(10)
else
- @bulletins = Bulletin.can_display.widget_datas.limit(9)
+ @bulletins = Bulletin.can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(10)
end
-
- get_categorys
-
+
+ get_categorys
+
end
def bulletins_and_web_links
diff --git a/vendor/built_in_modules/announcement/app/helpers/panel/announcement/back_end/bulletin_categorys_helper.rb b/vendor/built_in_modules/announcement/app/helpers/panel/announcement/back_end/bulletin_categorys_helper.rb
index 27dbe8f0..1fccbbe1 100644
--- a/vendor/built_in_modules/announcement/app/helpers/panel/announcement/back_end/bulletin_categorys_helper.rb
+++ b/vendor/built_in_modules/announcement/app/helpers/panel/announcement/back_end/bulletin_categorys_helper.rb
@@ -2,13 +2,15 @@ module Panel::Announcement::BackEnd::BulletinCategorysHelper
include ActionView::Helpers::UrlHelper
- def show_submit_permission_link(bulletin_category)
- oa = bulletin_category.get_object_auth_by_title('submit')
+ def show_anc_cate_permission_link(bulletin_category)
+ type = 'submit'
+ oa = bulletin_category.get_object_auth_by_title(type)
if oa.nil?
- bulletin_category.object_auths.new(title: 'submit' ).save
- oa = bulletin_category.get_object_auth_by_title('submit')
+ bulletin_category.object_auths.new(title: type ).save
+ oa = bulletin_category.get_object_auth_by_title(type)
end
- link_to t('announcement.bulletin.cate_auth'), edit_admin_object_auth_path(oa)
+# link_to t('announcement.bulletin.cate_auth'), edit_admin_object_auth_path(oa)
+ link_to t('announcement.bulletin.cate_auth'),panel_announcement_back_end_bulletin_category_setting_path(bulletin_category)
end
end
\ No newline at end of file
diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_category_setting/_modal_list.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_category_setting/_modal_list.html.erb
new file mode 100644
index 00000000..c7e842bd
--- /dev/null
+++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_category_setting/_modal_list.html.erb
@@ -0,0 +1,44 @@
+<% if bulletin_category -%>
+
+
+
+
+
+ <% bulletin_category.get_object_auth_by_title('submit').auth_users.each do |user| %>
+
+
+ <% if user.avatar? %>
+ <%= image_tag(user.avatar.thumb.url,:class => "member-img") %>
+ <% else %>
+ <%= image_tag "person.png",:class => "member-img" %>
+ <% end %>
+
+ <%= label_tag "lab-user-#{user.id}", (user.name rescue ''),:class=>"member-name",:id=>nil -%>
+
+ <% end -%>
+
+
+
+
+
+
+
+
+
+
+
+<% end -%>
diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_category_setting/_privilege_user.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_category_setting/_privilege_user.html.erb
new file mode 100644
index 00000000..c36941de
--- /dev/null
+++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_category_setting/_privilege_user.html.erb
@@ -0,0 +1,26 @@
+<%= content_tag :div ,:id => "users_checkbox_ary",:class => 'clear' do -%>
+<% sys_users = User.all -%>
+ <% sys_users.each do |sys_user| -%>
+
+
+
+ <% sys_user.sub_roles.each do |sr| %>
+
<%= sr.key %>
+ <% end %>
+ <%= content_tag :div,:data=>{'original-title'=>t('announcement.bulletin.approval_setting_window_title'),:content => "#{sys_user.sub_roles.collect{|sr| sr.i18n_variable[I18n.locale]}.join(',')}"},:class=>"checkbox clear" do %>
+
+
+
+ <% if sys_user.avatar? %>
+ <%= image_tag(sys_user.avatar.thumb.url,:class => "member-img") %>
+ <% else %>
+ <%= image_tag "person.png",:class => "member-img" %>
+ <% end %>
+
+ <%= label_tag "lab-user-#{sys_user.id}", (sys_user.name rescue ''),:class=>"member-name",:id=>nil -%>
+ <%= check_box_tag "[users][#{sys_user.id}]", 'true',users.include?(sys_user),:class => "check" -%>
+ <%end -%>
+
+
+ <% end -%>
+<% end -%>
\ No newline at end of file
diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_category_setting/setting.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_category_setting/setting.html.erb
new file mode 100644
index 00000000..3a21ede8
--- /dev/null
+++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_category_setting/setting.html.erb
@@ -0,0 +1,56 @@
+<% content_for :page_specific_css do %>
+ <%= stylesheet_link_tag "inc/permission-checkbox" %>
+<% end %>
+<% content_for :page_specific_javascript do %>
+ <%= javascript_include_tag "inc/permission-checkbox" %>
+ <%= javascript_include_tag "inc/search" %>
+ <%= javascript_include_tag "inc/modal-preview" %>
+<% end %>
+<%#= label_tag :fact_check_setting, t("announcement.bulletin.fact_check_setting") %>
+<%= form_tag('', :remote => true,:class => "prevent_enter_submit_form") %>
+
+
+ -
+
+ <%= label_tag :category, t("announcement.bulletin.category") %>
+ <%= select "category",'id',@options_from_collection_for_select_bulletin_categorys %>
+ <%= search_field_tag 'user_filter' %>
+
+
+
+
+ <%= link_to t("announcement.bulletin.submit_user_list"), panel_announcement_back_end_bulletin_category_user_list_path , :class=>'preview_trigger btn btn-success pull-right'%>
+
+
+<%#= label_tag :role, t("admin.roles") %>
+
+<%= content_tag :div do -%>
+ <% form_tag panel_announcement_back_end_approval_setting_path do %>
+ <%= render :partial => "privilege_user", :locals => {:users => @users_array} %>
+
+ <% end -%>
+<% end -%>
+
+
+
diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_category_setting/setting.js.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_category_setting/setting.js.erb
new file mode 100644
index 00000000..0ca148da
--- /dev/null
+++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_category_setting/setting.js.erb
@@ -0,0 +1,2 @@
+$("#users_checkbox_ary").replaceWith('<%= escape_javascript(render :partial => "privilege_user", :locals => {:users => @users_array})%>');
+permissionCheckbox();
\ No newline at end of file
diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_category_setting/update_setting.js.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_category_setting/update_setting.js.erb
new file mode 100644
index 00000000..7486000a
--- /dev/null
+++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_category_setting/update_setting.js.erb
@@ -0,0 +1 @@
+alert( "<% flash.each do |key, msg| %><%= msg %><% end%>");
\ No newline at end of file
diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_category_setting/user_list.js.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_category_setting/user_list.js.erb
new file mode 100644
index 00000000..4c8bf25d
--- /dev/null
+++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_category_setting/user_list.js.erb
@@ -0,0 +1,2 @@
+$('#show_preview').html("<%= escape_javascript(render(:partial => 'modal_list',:locals => {:bulletin_category => @bulletin_category})) %>");
+var start_modal_with_id = "bulletin_category-<%=@bulletin_category.id%>"
\ No newline at end of file
diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/_bulletin_category.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/_bulletin_category.html.erb
index 8ad4578e..b5013698 100644
--- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/_bulletin_category.html.erb
+++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/_bulletin_category.html.erb
@@ -5,7 +5,7 @@
<%if is_manager? || is_admin? %>
- - <%= show_submit_permission_link(bulletin_category) %>
+ - <%= show_anc_cate_permission_link(bulletin_category) %>
<% end %>
<% if is_admin?%>
- <%= link_to t('bulletin_category.edit'), edit_panel_announcement_back_end_bulletin_category_path(bulletin_category), :remote => true %>
diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/index.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/index.html.erb
index 3cf5731d..c885488f 100644
--- a/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/index.html.erb
+++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/index.html.erb
@@ -1,20 +1,29 @@
-<% # encoding: utf-8 %>
-
-<% if @bulletins and !@bulletins.nil? %>
- <%= t('announcement.campus_news')%>
- <%= link_to t('announcement.more'),panel_announcement_front_end_bulletins_path(), :class => "topic_note" %>
- previous page
- next page
-
- <% @bulletins.each do |post| %>
- -
-
<%= image_tag(post.image.url, :size => "290x130") if post.image.file %>
- <%= link_to post.title[I18n.locale], panel_announcement_front_end_bulletin_path(post, :category_id => post.bulletin_category_id) %>
- <%= post.subtitle[I18n.locale].html_safe %>
-
- <% end %>
-
-
+<% if @current_category %>
+ <%= @current_category.i18n_variable[I18n.locale] + t('announcement.bulletin.list_lower') %>
+<% elsif @tag %>
+ <%= @tag[I18n.locale] + t('announcement.bulletin.list_lower') %>
+<% else %>
+ <%= t('announcement.list_announcement') %>
<% end %>
+
+
+ <%= t('announcement.bulletin.category') %> |
+ <%= t('announcement.bulletin.title') %> |
+ <%= t('announcement.bulletin.postdate') %> |
+
+
+<% @bulletins.each do |post| %>
+
+ <%= post.bulletin_category.i18n_variable[I18n.locale] %> |
+ <%= link_to post.title[I18n.locale], panel_announcement_front_end_bulletin_path(post, :category_id => post.bulletin_category_id) %>
+ |
+ <%= post.postdate %> |
+
+
+<% end %>
+
+
+
+<%= paginate @bulletins, :params => {:inner => 'false'} %>
\ No newline at end of file
diff --git a/vendor/built_in_modules/announcement/config/locales/en.yml b/vendor/built_in_modules/announcement/config/locales/en.yml
index 1c4f51b0..5a1d2f13 100644
--- a/vendor/built_in_modules/announcement/config/locales/en.yml
+++ b/vendor/built_in_modules/announcement/config/locales/en.yml
@@ -68,6 +68,7 @@ en:
related_links: Related Links
list_announcement: List Announcement
bulletin:
+ submit_user_list: Submit User
category: Category
list_lower: " list"
title: Title
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 5cadd843..5e559b6a 100644
--- a/vendor/built_in_modules/announcement/config/locales/zh_tw.yml
+++ b/vendor/built_in_modules/announcement/config/locales/zh_tw.yml
@@ -50,6 +50,7 @@ zh_tw:
list_announcement: 公告列表
bulletin:
category: 分類
+ submit_user_list: 張貼人
list_lower: 列表
title: 標題
postdate: 張貼日期
@@ -173,7 +174,9 @@ zh_tw:
panel:
-
+ bulletin_category:
+ edit: 修改
+ delete: 刪除
# Chinese (Taiwan) translations for Ruby on Rails
# by tsechingho (http://github.com/tsechingho)
diff --git a/vendor/built_in_modules/announcement/config/routes.rb b/vendor/built_in_modules/announcement/config/routes.rb
index 396ea8e4..c6a406b0 100644
--- a/vendor/built_in_modules/announcement/config/routes.rb
+++ b/vendor/built_in_modules/announcement/config/routes.rb
@@ -21,7 +21,11 @@ Rails.application.routes.draw do
match "file_quick_edit/:bulletin_id" => "bulletins#file_quick_edit" ,:as => :file_quick_edit
end
- resources :bulletin_categorys
+ resources :bulletin_categorys do
+ match 'submit_setting' => "bulletin_category_setting#setting" ,:as => :setting,:via => :get
+ match 'submit_setting' => "bulletin_category_setting#update_setting" ,:as => :setting,:via => :post
+ match 'submit_setting' => "bulletin_category_setting#user_list" ,:as => :user_list,:via => :put
+ end
resources :bulletin_links, :controller => 'bulletin_links' do
match "link_quick_edit/:bulletin_link_id" => "bulletin_links#link_quick_edit" ,:as => :link_quick_edit
diff --git a/vendor/built_in_modules/news/app/controllers/panel/news/back_end/news_bulletin_category_setting_controller.rb b/vendor/built_in_modules/news/app/controllers/panel/news/back_end/news_bulletin_category_setting_controller.rb
new file mode 100644
index 00000000..6b92195f
--- /dev/null
+++ b/vendor/built_in_modules/news/app/controllers/panel/news/back_end/news_bulletin_category_setting_controller.rb
@@ -0,0 +1,63 @@
+class Panel::News::BackEnd::NewsBulletinCategorySettingController < OrbitBackendController
+ before_filter :authenticate_user!
+ before_filter :for_app_manager
+ include AdminHelper
+ # layout 'admin'
+ # def preview_and_approve
+ # @bulletin = Bulletin.find params[:bulletin_id]
+ # end
+
+ # def approve
+ #
+ # end
+
+ def setting
+ @bulletin_categorys = []
+ @bulletin_categorys << NewsBulletinCategory.find(params[:news_bulletin_category_id])
+ @options_from_collection_for_select_bulletin_categorys = @bulletin_categorys.collect{|bc| [bc.i18n_variable[I18n.locale],bc.id] }
+ if params.has_key? :category
+ @bulletin_category = NewsBulletinCategory.find params[:category][:id]
+ else
+ @bulletin_category = @bulletin_categorys.first
+ end
+ preload_object_auth = @bulletin_category.object_auths.where(title: 'submit').empty?? (@bulletin_category.object_auths.create! :title=> 'submit') : @bulletin_category.object_auths.where(title: 'submit')
+ @users_array = preload_object_auth.first.privilege_users rescue []
+ respond_to do |format|
+ format.html
+ format.js
+ end
+ end
+
+ def update_setting
+ object_auth = update_setting_by_params
+ if object_auth.save!
+ flash[:notice] = "Update Done"
+ else
+ flash[:notice] = "Update Failed"
+ end
+ end
+
+ def user_list
+ @bulletin_category = NewsBulletinCategory.find params[:category][:id]
+ end
+
+ protected
+ def update_setting_by_params
+ category = NewsBulletinCategory.find params[:category][:id]
+ privilege_users = params[:users].collect{|key,value| User.find key } rescue []
+ object_auth_ary = category.object_auths.where(title: 'submit') || (category.object_auths.create :title=> 'submit')
+ object_auth = object_auth_ary.first
+ object_auth.privilege_users = privilege_users
+ object_auth
+ end
+
+ def get_categorys(id = nil)
+ @bulletin_categorys = []
+ if(is_manager? || is_admin?)
+ @bulletin_categorys = (id ? NewsBulletinCategory.find(id).to_a : NewsBulletinCategory.excludes('disabled' => true))
+ elsif is_sub_manager?
+ @bulletin_categorys = NewsBulletinCategory.authed_for_user(current_user,'submit_new')
+ end
+ end
+
+end
diff --git a/vendor/built_in_modules/news/app/controllers/panel/news/widget/news_bulletins_controller.rb b/vendor/built_in_modules/news/app/controllers/panel/news/widget/news_bulletins_controller.rb
index 7d678cad..a6d20ca7 100644
--- a/vendor/built_in_modules/news/app/controllers/panel/news/widget/news_bulletins_controller.rb
+++ b/vendor/built_in_modules/news/app/controllers/panel/news/widget/news_bulletins_controller.rb
@@ -9,20 +9,18 @@ class Panel::News::Widget::NewsBulletinsController < OrbitWidgetController
# GET /news_bulletins.xml
def index
-
- # deadline
- # @news_bulletin_categorys = NewsBulletinCategory.first;
- # @news_bulletins = NewsBulletin.widget_datas(@news_bulletin_categorys.id).limit(9)
+ date_now = Time.now
if !params[:category_id].blank?
- @news_bulletins = NewsBulletin.can_display.where(:news_bulletin_category_id => params[:category_id]).widget_datas.limit(9)
+ @news_bulletins = NewsBulletin.can_display.where(:news_bulletin_category_id => params[:category_id]).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(10)
+ @current_category = NewsBulletinCategory.from_id(params[:category_id]) rescue nil
elsif !params[:tag_id].blank?
- @news_bulletins = NewsTag.find(params[:tag_id]).news_bulletins.can_display.widget_datas.limit(9) rescue nil
+ @tag = NewsTag.find(params[:tag_id]) rescue nil
+ @tag = NewsTag.where(key: params[:tag_id])[0] unless @tag
+ @news_bulletins = @tag.news_bulletins.can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(10) rescue nil
else
- @news_bulletins = NewsBulletin.can_display.widget_datas.limit(9)
+ @news_bulletins = NewsBulletin.can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(10)
end
-
- get_categorys
-
+
end
def news_bulletins_and_web_links
@@ -47,6 +45,18 @@ class Panel::News::Widget::NewsBulletinsController < OrbitWidgetController
@tags = NewsTag.all
get_categorys
end
+
+ def home_banner
+ if !params[:category_id].blank?
+ @news_bulletins = NewsBulletin.can_display.where(:news_bulletin_category_id => params[:category_id]).widget_datas.limit(9)
+ elsif !params[:tag_id].blank?
+ @news_bulletins = NewsTag.find(params[:tag_id]).news_bulletins.can_display.widget_datas.limit(9) rescue nil
+ else
+ @news_bulletins = NewsBulletin.can_display.widget_datas.limit(9)
+ end
+ get_categorys
+
+ end
protected
diff --git a/vendor/built_in_modules/news/app/helpers/panel/news/back_end/news_bulletin_categorys_helper.rb b/vendor/built_in_modules/news/app/helpers/panel/news/back_end/news_bulletin_categorys_helper.rb
index 8ad75108..74905640 100644
--- a/vendor/built_in_modules/news/app/helpers/panel/news/back_end/news_bulletin_categorys_helper.rb
+++ b/vendor/built_in_modules/news/app/helpers/panel/news/back_end/news_bulletin_categorys_helper.rb
@@ -2,13 +2,16 @@ module Panel::News::BackEnd::NewsBulletinCategorysHelper
include ActionView::Helpers::UrlHelper
- def show_submit_permission_link(news_bulletin_category)
- oa = news_bulletin_category.get_object_auth_by_title('submit')
+ def show_news_cate_permission_link(news_bulletin_category)
+ type = 'submit'
+ oa = news_bulletin_category.get_object_auth_by_title(type)
if oa.nil?
- news_bulletin_category.object_auths.new(title: 'submit' ).save
- oa = news_bulletin_category.get_object_auth_by_title('submit')
+ news_bulletin_category.object_auths.new(title: type ).save
+ oa = news_bulletin_category.get_object_auth_by_title(type)
end
- link_to t('announcement.bulletin.cate_auth'), edit_admin_object_auth_path(oa)
+# link_to t('announcement.bulletin.cate_auth'), edit_admin_object_auth_path(oa)
+link_to t('announcement.bulletin.cate_auth'),panel_news_back_end_news_bulletin_category_setting_path(news_bulletin_category)
+
end
end
\ No newline at end of file
diff --git a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletin_category_setting/_modal_list.html.erb b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletin_category_setting/_modal_list.html.erb
new file mode 100644
index 00000000..c7e842bd
--- /dev/null
+++ b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletin_category_setting/_modal_list.html.erb
@@ -0,0 +1,44 @@
+<% if bulletin_category -%>
+
+
+
+
+
+ <% bulletin_category.get_object_auth_by_title('submit').auth_users.each do |user| %>
+
+
+ <% if user.avatar? %>
+ <%= image_tag(user.avatar.thumb.url,:class => "member-img") %>
+ <% else %>
+ <%= image_tag "person.png",:class => "member-img" %>
+ <% end %>
+
+ <%= label_tag "lab-user-#{user.id}", (user.name rescue ''),:class=>"member-name",:id=>nil -%>
+
+ <% end -%>
+
+
+
+
+
+
+
+
+
+
+
+<% end -%>
diff --git a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletin_category_setting/_privilege_user.html.erb b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletin_category_setting/_privilege_user.html.erb
new file mode 100644
index 00000000..c36941de
--- /dev/null
+++ b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletin_category_setting/_privilege_user.html.erb
@@ -0,0 +1,26 @@
+<%= content_tag :div ,:id => "users_checkbox_ary",:class => 'clear' do -%>
+<% sys_users = User.all -%>
+ <% sys_users.each do |sys_user| -%>
+
+
+
+ <% sys_user.sub_roles.each do |sr| %>
+
<%= sr.key %>
+ <% end %>
+ <%= content_tag :div,:data=>{'original-title'=>t('announcement.bulletin.approval_setting_window_title'),:content => "#{sys_user.sub_roles.collect{|sr| sr.i18n_variable[I18n.locale]}.join(',')}"},:class=>"checkbox clear" do %>
+
+
+
+ <% if sys_user.avatar? %>
+ <%= image_tag(sys_user.avatar.thumb.url,:class => "member-img") %>
+ <% else %>
+ <%= image_tag "person.png",:class => "member-img" %>
+ <% end %>
+
+ <%= label_tag "lab-user-#{sys_user.id}", (sys_user.name rescue ''),:class=>"member-name",:id=>nil -%>
+ <%= check_box_tag "[users][#{sys_user.id}]", 'true',users.include?(sys_user),:class => "check" -%>
+ <%end -%>
+
+
+ <% end -%>
+<% end -%>
\ No newline at end of file
diff --git a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletin_category_setting/setting.html.erb b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletin_category_setting/setting.html.erb
new file mode 100644
index 00000000..99eadaf5
--- /dev/null
+++ b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletin_category_setting/setting.html.erb
@@ -0,0 +1,56 @@
+<% content_for :page_specific_css do %>
+ <%= stylesheet_link_tag "inc/permission-checkbox" %>
+<% end %>
+<% content_for :page_specific_javascript do %>
+ <%= javascript_include_tag "inc/permission-checkbox" %>
+ <%= javascript_include_tag "inc/search" %>
+ <%= javascript_include_tag "inc/modal-preview" %>
+<% end %>
+<%#= label_tag :fact_check_setting, t("announcement.bulletin.fact_check_setting") %>
+<%= form_tag('', :remote => true,:class => "prevent_enter_submit_form") %>
+
+
+ -
+
+ <%= label_tag :category, t("announcement.bulletin.category") %>
+ <%= select "category",'id',@options_from_collection_for_select_bulletin_categorys %>
+ <%= search_field_tag 'user_filter' %>
+
+
+
+
+ <%= link_to t("announcement.bulletin.submit_user_list"), panel_news_back_end_news_bulletin_category_user_list_path , :class=>'preview_trigger btn btn-success pull-right'%>
+
+
+<%#= label_tag :role, t("admin.roles") %>
+
+<%= content_tag :div do -%>
+ <% form_tag panel_news_back_end_news_bulletin_category_setting_path do %>
+ <%= render :partial => "privilege_user", :locals => {:users => @users_array} %>
+
+ <% end -%>
+<% end -%>
+
+
+
diff --git a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletin_category_setting/setting.js.erb b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletin_category_setting/setting.js.erb
new file mode 100644
index 00000000..0ca148da
--- /dev/null
+++ b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletin_category_setting/setting.js.erb
@@ -0,0 +1,2 @@
+$("#users_checkbox_ary").replaceWith('<%= escape_javascript(render :partial => "privilege_user", :locals => {:users => @users_array})%>');
+permissionCheckbox();
\ No newline at end of file
diff --git a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletin_category_setting/update_setting.js.erb b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletin_category_setting/update_setting.js.erb
new file mode 100644
index 00000000..7486000a
--- /dev/null
+++ b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletin_category_setting/update_setting.js.erb
@@ -0,0 +1 @@
+alert( "<% flash.each do |key, msg| %><%= msg %><% end%>");
\ No newline at end of file
diff --git a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletin_category_setting/user_list.js.erb b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletin_category_setting/user_list.js.erb
new file mode 100644
index 00000000..4c8bf25d
--- /dev/null
+++ b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletin_category_setting/user_list.js.erb
@@ -0,0 +1,2 @@
+$('#show_preview').html("<%= escape_javascript(render(:partial => 'modal_list',:locals => {:bulletin_category => @bulletin_category})) %>");
+var start_modal_with_id = "bulletin_category-<%=@bulletin_category.id%>"
\ No newline at end of file
diff --git a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletin_categorys/_news_bulletin_category.html.erb b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletin_categorys/_news_bulletin_category.html.erb
index 377091bd..94a4e851 100644
--- a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletin_categorys/_news_bulletin_category.html.erb
+++ b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletin_categorys/_news_bulletin_category.html.erb
@@ -5,7 +5,7 @@
<%if is_manager? || is_admin? %>
- - <%= show_submit_permission_link(news_bulletin_category) %>
+ - <%= show_news_cate_permission_link(news_bulletin_category) %>
<% end %>
<% if is_admin?%>
- <%= link_to t('bulletin_category.edit'), edit_panel_news_back_end_news_bulletin_category_path(news_bulletin_category), :remote => true %>
diff --git a/vendor/built_in_modules/news/app/views/panel/news/widget/news_bulletins/home_banner.html.erb b/vendor/built_in_modules/news/app/views/panel/news/widget/news_bulletins/home_banner.html.erb
new file mode 100644
index 00000000..fb6c0452
--- /dev/null
+++ b/vendor/built_in_modules/news/app/views/panel/news/widget/news_bulletins/home_banner.html.erb
@@ -0,0 +1,28 @@
+<% if @news_bulletins and !@news_bulletins.nil? %>
+ <%= t('news.campus_news')%>
+ <%#= link_to t('news.more'),panel_news_front_end_news_bulletins_path(), :class => "topic_note" %>
+
+ previous page
+ next page
+
+ <% @news_bulletins.each do |post| %>
+ -
+
<%= image_tag(post.image.url, :size => "290x130") if post.image.file %>
+ <%= link_to post.title[I18n.locale], panel_news_front_end_news_bulletin_path(post, :category_id => post.news_bulletin_category_id) %>
+ <%= post.subtitle[I18n.locale].html_safe %>
+
+ <% end %>
+
+<% end %>
\ No newline at end of file
diff --git a/vendor/built_in_modules/news/app/views/panel/news/widget/news_bulletins/index.html.erb b/vendor/built_in_modules/news/app/views/panel/news/widget/news_bulletins/index.html.erb
index 2103f997..bb2ff639 100644
--- a/vendor/built_in_modules/news/app/views/panel/news/widget/news_bulletins/index.html.erb
+++ b/vendor/built_in_modules/news/app/views/panel/news/widget/news_bulletins/index.html.erb
@@ -1,33 +1,33 @@
<% # encoding: utf-8 %>
-<% if @news_bulletins and !@news_bulletins.nil? %>
- <%= t('news.campus_news')%>
- <%#= link_to t('news.more'),panel_news_front_end_news_bulletins_path(), :class => "topic_note" %>
-
- previous page
- next page
-
- <% @news_bulletins.each do |post| %>
- -
-
<%= image_tag(post.image.url, :size => "290x130") if post.image.file %>
- <%= link_to post.title[I18n.locale], panel_news_front_end_news_bulletin_path(post, :category_id => post.news_bulletin_category_id) %>
- <%= post.subtitle[I18n.locale].html_safe %>
-
- <% end %>
-
+<%= flash_messages %>
+<% if @current_category %>
+ <%= @current_category.i18n_variable[I18n.locale] + t('news.news_bulletin.list_lower') %>
+<% elsif @tag %>
+ <%= @tag[I18n.locale] + t('news.news_bulletin.list_lower') %>
+<% else %>
+ <%= t('news.list_news') %>
<% end %>
+
+
+
+ <%= t('news.news_bulletin.image') %> |
+ <%= t('news.news_bulletin.title') %> |
+
+
+ <% @news_bulletins.each do |post| %>
+
+ <%= image_tag post.image %> |
+
+ <%= link_to post.title[I18n.locale], panel_news_front_end_news_bulletin_path(post), :class => 'news_title' %>
+ <%= post.subtitle[I18n.locale].html_safe %>
+ |
+ <%= post.postdate %> |
+
+ <% end %>
+
+
+<%= paginate @news_bulletins, :params => {:inner => 'false'} %>
diff --git a/vendor/built_in_modules/news/config/routes.rb b/vendor/built_in_modules/news/config/routes.rb
index b7882d2d..d718e7d6 100644
--- a/vendor/built_in_modules/news/config/routes.rb
+++ b/vendor/built_in_modules/news/config/routes.rb
@@ -20,7 +20,11 @@ Rails.application.routes.draw do
match "file_quick_edit/:news_bulletin_id" => "news_bulletins#file_quick_edit" ,:as => :file_quick_edit
end
- resources :news_bulletin_categorys
+ resources :news_bulletin_categorys do
+ match 'submit_setting' => "news_bulletin_category_setting#setting" ,:as => :setting,:via => :get
+ match 'submit_setting' => "news_bulletin_category_setting#update_setting" ,:as => :setting,:via => :post
+ match 'submit_setting' => "news_bulletin_category_setting#user_list" ,:as => :user_list,:via => :put
+ end
resources :news_bulletin_links, :controller => 'news_bulletin_links' do
match "link_quick_edit/:news_bulletin_link_id" => "news_bulletin_links#link_quick_edit" ,:as => :link_quick_edit
@@ -39,6 +43,7 @@ Rails.application.routes.draw do
end
namespace :widget do
match "news_bulletins" => "news_bulletins#index"
+ match "home_banner" => "news_bulletins#home_banner"
match "news_bulletins_and_web_links" => "news_bulletins#news_bulletins_and_web_links"
match "reload_news_bulletins" => "news_bulletins#reload_news_bulletins"
match "reload_web_links" => "news_bulletins#reload_web_links"
diff --git a/vendor/built_in_modules/news/news.json b/vendor/built_in_modules/news/news.json
index 1e7a7bae..74b2bfcc 100644
--- a/vendor/built_in_modules/news/news.json
+++ b/vendor/built_in_modules/news/news.json
@@ -7,6 +7,6 @@
"update_info": "Some info",
"create_date": "11-11-2011",
"app_pages": ["news_bulletins"],
- "widgets": ["news_bulletins", "news_bulletins_and_web_links"],
+ "widgets": ["news_bulletins", "news_bulletins_and_web_links", "home_banner"],
"enable_frontend": true
}
diff --git a/vendor/built_in_modules/web_resource/app/controllers/panel/web_resource/widget/web_links_controller.rb b/vendor/built_in_modules/web_resource/app/controllers/panel/web_resource/widget/web_links_controller.rb
index 8a2936a3..de36e3d6 100644
--- a/vendor/built_in_modules/web_resource/app/controllers/panel/web_resource/widget/web_links_controller.rb
+++ b/vendor/built_in_modules/web_resource/app/controllers/panel/web_resource/widget/web_links_controller.rb
@@ -7,7 +7,23 @@ class Panel::WebResource::Widget::WebLinksController < OrbitWidgetController
# GET /web_links
# GET /web_links.xml
+
def index
+ if !params[:category_id].blank?
+ @web_links = WebLink.where(:web_link_category => params[:category_id]).desc( :is_top, :postdate).page( params[:page]).per(10)
+ @current_category = WebLinkCategory.from_id(params[:category_id]) rescue nil
+ elsif !params[:tag_id].blank?
+ @tag = WebResourceTag.find(params[:tag_id]) rescue nil
+ @tag = WebResourceTag.where(key: params[:tag_id])[0] unless @tag
+ @web_links = @tag.web_links.desc( :is_top, :postdate).page( params[:page]).per(10)
+ else
+ @web_links = WebLink.all.desc( :is_top, :postdate).page( params[:page]).per(10)
+ end
+ end
+
+
+
+ def home_list
# deadline
diff --git a/vendor/built_in_modules/web_resource/app/views/panel/web_resource/widget/web_links/home_list.html.erb b/vendor/built_in_modules/web_resource/app/views/panel/web_resource/widget/web_links/home_list.html.erb
new file mode 100644
index 00000000..e5f2abd2
--- /dev/null
+++ b/vendor/built_in_modules/web_resource/app/views/panel/web_resource/widget/web_links/home_list.html.erb
@@ -0,0 +1,5 @@
+<%= t("announcement.related_links") %>
+
+
+ <%= render 'web_links' %>
+
diff --git a/vendor/built_in_modules/web_resource/app/views/panel/web_resource/widget/web_links/index.html.erb b/vendor/built_in_modules/web_resource/app/views/panel/web_resource/widget/web_links/index.html.erb
index e5f2abd2..8eebc6ac 100644
--- a/vendor/built_in_modules/web_resource/app/views/panel/web_resource/widget/web_links/index.html.erb
+++ b/vendor/built_in_modules/web_resource/app/views/panel/web_resource/widget/web_links/index.html.erb
@@ -1,5 +1,26 @@
-<%= t("announcement.related_links") %>
+<% if @current_category %>
+ <%= @current_category.i18n_variable[I18n.locale] + " " + t('web_resource.list_lower') %>
+<% elsif @tag %>
+ <%= @tag[I18n.locale] + " " + t('web_resource.list_lower') %>
+<% else %>
+ <%= t('web_resource.list_link') %>
+<% end %>
-
- <%= render 'web_links' %>
-
+
+
+
+ <%= t('web_resource.category') %> |
+ <%= t('web_resource.name') %> |
+
+ <% @web_links.each do |post| %>
+
+ <%= post.web_link_category.i18n_variable[I18n.locale] %> |
+
+ <%= link_to post.name[I18n.locale], post.url, {:target => '_blank', :title => post.name[I18n.locale]} %>
+ |
+
+ <% end %>
+
+
+
+<%= paginate @web_links, :params => {:inner => 'false'} %>
diff --git a/vendor/built_in_modules/web_resource/config/locales/en.yml b/vendor/built_in_modules/web_resource/config/locales/en.yml
index 4fcaafe7..83dbd328 100644
--- a/vendor/built_in_modules/web_resource/config/locales/en.yml
+++ b/vendor/built_in_modules/web_resource/config/locales/en.yml
@@ -25,6 +25,12 @@ en:
announcement:
sure?: Sure?
+
+
+ web_resource:
+ list_lower: list
+ list_link: Links list
+
# admin:
# action: Action
diff --git a/vendor/built_in_modules/web_resource/config/locales/zh_tw.yml b/vendor/built_in_modules/web_resource/config/locales/zh_tw.yml
index 4ef309e6..ace65d53 100644
--- a/vendor/built_in_modules/web_resource/config/locales/zh_tw.yml
+++ b/vendor/built_in_modules/web_resource/config/locales/zh_tw.yml
@@ -18,102 +18,9 @@ zh_tw:
update: 更新
yes_: "Yes"
- admin:
- action: 行動
- add_language: 新增語言
- admin: 管理
- action: 行動
- announcement: 公告
- asset: 資產
- attributes: 屬性
- cant_delete_self: 您不可以刪除自己。
- cant_revoke_self_admin: 您不可以撤銷自己的管理作用。
- class: 階級
- content: 內容
- create_error_link: 創建連接時出錯。
- create_error_page: 創建頁面時出錯。
- create_success_home: 首頁已成功創建。
- create_success_layout: 樣板已成功創建。
- create_success_link: 連結已成功創建。
- create_success_page: 頁面已成功創建。
- create_success_snippet: 片段已成功創建
- create_success_user: 用戶已成功創建。。
- data: 數據
- delete_language: 刪除語言
- description: 描述
- disable_language: 禁用語言
- editing_home: 編輯首頁
- editing_layout: 編輯樣板
- editing_link: 編輯連結
- editing_page: 編輯頁面
- editing_snippet: 編輯片段
- editing_user_info: 編輯用戶資料
- editing_user_role: 編輯用戶角色
- email: Email
- enable_language: 啟用語言
- file_name: 檔名
- file_size: 檔案大小
- format: 格式
- home: 首頁
- id: ID
- info: 資料
- is_published: 被出版
- item: 項目
- key: 關鍵
- language: 語言
- layout: 佈局
- layout_name: 佈局名字
- list_assets: 資產清單
- list_items: 項目清單
- list_layouts: 佈局清單
- list_snippets: 斷片清單
- list_users: 使用清單
- list_user_infos: 用戶資料清單
- list_user_roles: 用戶角色清單
- member: 會員
- move_down: 往下移
- move_up: 往上移
- multilingual: 多種語言
- my_avatar: 我的頭像
- no_home_page: 您沒有首頁
- no_layout: 您沒有佈局
- name: 名稱
- new_asset: 新增資產
- new_component: 新增元件
- new_home: 新增首頁
- new_layout: 新增樣板
- new_link: 新增連結
- new_page: 新增頁面
- new_snippet: 新增片段
- new_user: 新增使用
- new_user_info: 新增用戶資料
- new_user_role: 新增用戶角色
- non_multilingual: 非多種語言
- options: 選項
- orig_upload_file: 原上傳檔名
- position: 位置
- published?: 發布?
- role: 角色
- roles: 角色。
- title: 標題
- translation: 翻譯
- type: 類型
- update_error_link: 更新鏈接時出現錯誤。
- update_error_page: 更新頁面時出現錯誤。
- update_success_content: 內容已成功更新。
- update_success_home: 首頁已成功更新。
- update_success_layout: 樣板已成功更新。
- update_success_link: 連結已成功更新。
- update_success_page: 頁面已成功更新。
- update_success_snippet: 片段已成功更新。
- update_success_user: 用戶已成功更新
- url: URL
- user: 用戶
- user_info: 用戶資料
- user_panel: 用戶面板
- user_role: 用戶角色
-
- panel:
+ web_resource:
+ list_lower: 列表
+ list_link: 鏈接列表
diff --git a/vendor/built_in_modules/web_resource/config/routes.rb b/vendor/built_in_modules/web_resource/config/routes.rb
index ac98d4da..fed85983 100644
--- a/vendor/built_in_modules/web_resource/config/routes.rb
+++ b/vendor/built_in_modules/web_resource/config/routes.rb
@@ -18,6 +18,7 @@ Rails.application.routes.draw do
end
namespace :widget do
match "web_links" => "web_links#index"
+ match "home_list" => "web_links#home_list"
match "reload_web_links" => "web_links#reload_web_links"
end
end
diff --git a/vendor/built_in_modules/web_resource/web_resource.json b/vendor/built_in_modules/web_resource/web_resource.json
index 5d5a7974..22721e14 100644
--- a/vendor/built_in_modules/web_resource/web_resource.json
+++ b/vendor/built_in_modules/web_resource/web_resource.json
@@ -7,7 +7,8 @@
"update_info": "Some info",
"create_date": "11-11-2011",
"app_pages": ["web_links"],
- "widgets": ["web_links"],
+ "widgets": ["web_links", "home_list"]
"category": ["WebLinkCategory"],
+ "widgets": ["web_links", "home_list"],
"enable_frontend": true
}