diff --git a/app/controllers/admin/honor_types_controller.rb b/app/controllers/admin/honor_types_controller.rb index 0ccb48c..0685185 100644 --- a/app/controllers/admin/honor_types_controller.rb +++ b/app/controllers/admin/honor_types_controller.rb @@ -1,4 +1,6 @@ -class Admin::HonorTypesController < OrbitAdminController +class Admin::HonorTypesController < OrbitMemberController + before_action :allow_admin_only + def new @honor_type = HonorType.new @url = admin_honor_types_path(@honor_type) diff --git a/app/controllers/admin/honors_controller.rb b/app/controllers/admin/honors_controller.rb index 0c500e8..798c90d 100644 --- a/app/controllers/admin/honors_controller.rb +++ b/app/controllers/admin/honors_controller.rb @@ -4,6 +4,9 @@ class Admin::HonorsController < OrbitMemberController before_action :set_plugin before_action :get_settings,:only => [:new, :edit, :setting] + before_action :need_access_right + before_action :allow_admin_only, :only => [:index, :setting] + def index @honors = Honor.order_by(:year=>'desc').page(params[:page]).per(10) end @@ -17,7 +20,7 @@ class Admin::HonorsController < OrbitMemberController @member = MemberProfile.find(honor_params['member_profile_id']) rescue nil @honor = Honor.new(honor_params) @honor.save - redirect_to URI.encode('/admin/members/'+@member.to_param+'/Honor') + redirect_to params['referer_url'] end def edit @@ -30,7 +33,7 @@ class Admin::HonorsController < OrbitMemberController @honor = Honor.find(params[:id]) @honor.update_attributes(honor_params) @honor.save - redirect_to URI.encode('/admin/members/'+@member.to_param+'/Honor') + redirect_to params['referer_url'] end def destroy diff --git a/app/views/admin/honors/_form.html.erb b/app/views/admin/honors/_form.html.erb index 1450ba0..c8265e0 100644 --- a/app/views/admin/honors/_form.html.erb +++ b/app/views/admin/honors/_form.html.erb @@ -153,6 +153,7 @@
<% end -%> | <%= t('personal_honor.year') %> | @@ -38,7 +37,7 @@
---|---|
<%= check_box_tag 'to_change[]', honor.id.to_s, false, :class => "list-check" %> | @@ -48,8 +47,10 @@ <%= link_to honor.award_name, OrbitHelper.url_to_plugin_show(honor.to_param,'personal_honor'), target: "blank"%>