diff --git a/app/controllers/panel/announcement/back_end/bulletins_controller.rb b/app/controllers/panel/announcement/back_end/bulletins_controller.rb index d18cb79..4de07e3 100644 --- a/app/controllers/panel/announcement/back_end/bulletins_controller.rb +++ b/app/controllers/panel/announcement/back_end/bulletins_controller.rb @@ -25,7 +25,12 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController @statuses = get_statuses category_ids = @categories.collect{|t| t.id} - @bulletins = get_sorted_and_filtered("bulletin", :category_id.in => category_ids) + if is_manager? or is_admin? + @bulletins = get_sorted_and_filtered("bulletin", :category_id.in => category_ids) + else + @bulletins = get_sorted_and_filtered("bulletin", {:category_id.in => category_ids, :create_user_id => current_user.id}) + end + respond_to do |format| format.html # index.html.erb format.js { } @@ -70,7 +75,8 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController @tags = get_tags is_authorized_sub_manager = @bulletin.category.auth_sub_manager.authorized_user_ids rescue nil - if !(is_manager? || is_admin? || is_authorized_sub_manager.include?(current_user.id)) + if !(is_manager? || is_admin? || (is_authorized_sub_manager.include?(current_user.id) and @bulletin.create_user_id == current_user.id)) + redirect_to :action => :index else # @summary_variable = @bulletin.summary_variable diff --git a/app/views/panel/announcement/back_end/bulletins/index.html.erb b/app/views/panel/announcement/back_end/bulletins/index.html.erb index 6a287dc..81233e8 100644 --- a/app/views/panel/announcement/back_end/bulletins/index.html.erb +++ b/app/views/panel/announcement/back_end/bulletins/index.html.erb @@ -1,4 +1,8 @@ -<% set_default_index do +<% + + @unit_field = User.get_member_list_attribute_field("staff","unit") + + set_default_index do objects @bulletins quick_edit_link type: 'edit', link: 'edit_panel_announcement_back_end_bulletin_path' @@ -49,6 +53,11 @@ translation: 'last_modified', hide: 'phone', sort: 'last_modified' + field db_field: 'update_user_id', + translation: 'announcement.default_widget.bulletin_create_dept', + display_option: 'User.get_member_list_attribute_value(object.create_user_id,@unit_field.id).get_value_by_locale(I18n.locale) rescue nil', + sort: 'last_modified' + filter_field type: 'array', values: @statuses, translation: 'status'