diff --git a/app/controllers/admin/researchs_controller.rb b/app/controllers/admin/researchs_controller.rb index dec41b4..843d046 100644 --- a/app/controllers/admin/researchs_controller.rb +++ b/app/controllers/admin/researchs_controller.rb @@ -4,6 +4,9 @@ class Admin::ResearchsController < 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 @researchs = Research.order_by(:year=>'desc').page(params[:page]).per(10) end @@ -17,7 +20,7 @@ class Admin::ResearchsController < OrbitMemberController @member = MemberProfile.find(research_params['member_profile_id']) rescue nil @research = Research.new(research_params) @research.save - redirect_to URI.encode('/admin/members/'+@member.to_param+'/Research') + redirect_to params['referer_url'] end def edit @@ -30,7 +33,7 @@ class Admin::ResearchsController < OrbitMemberController @research = Research.find(params[:id]) @research.update_attributes(research_params) @research.save - redirect_to URI.encode('/admin/members/'+@member.to_param+'/Research') + redirect_to params['referer_url'] end def destroy diff --git a/app/views/admin/researchs/_form.html.erb b/app/views/admin/researchs/_form.html.erb index d80b3e2..c7ebb2c 100644 --- a/app/views/admin/researchs/_form.html.erb +++ b/app/views/admin/researchs/_form.html.erb @@ -194,6 +194,7 @@
<%= f.hidden_field :user_id, :value => params[:user_id] if !params[:user_id].blank? %> + <%= f.submit t('submit'), class: 'btn btn-primary' %> <%= link_to t('cancel'), get_go_back, :class=>"btn" %>
diff --git a/app/views/admin/researchs/index.html.erb b/app/views/admin/researchs/index.html.erb index db2ef16..e3bdce2 100644 --- a/app/views/admin/researchs/index.html.erb +++ b/app/views/admin/researchs/index.html.erb @@ -13,9 +13,6 @@
-
- <%= link_to content_tag(:i, nil, :class => 'icon-cog icon-white') + t('setting'), admin_writing_conference_setting_path, :class => 'btn btn-primary pull-right' %> -
diff --git a/app/views/plugin/personal_research/_profile.html.erb b/app/views/plugin/personal_research/_profile.html.erb index 0d66542..382c86d 100644 --- a/app/views/plugin/personal_research/_profile.html.erb +++ b/app/views/plugin/personal_research/_profile.html.erb @@ -6,15 +6,14 @@ <% end %> <% - is_autorized_user = (current_user==@member.user || current_user.is_admin?) - if is_autorized_user + if has_access? @researchs = Research.where(member_profile_id: @member.id).desc(:year).page(params[:page]).per(10) else @researchs = Research.where(is_hidden: false, member_profile_id: @member.id).desc(:year).page(params[:page]).per(10) end %> -<% if is_autorized_user %> +<% if has_access? %>
<%= link_to('Hide', '#', :class => "btn btn-mini list-active-btn disabled", "data-check-action" => "list-be-hide", :rel => toggle_hide_admin_researchs_path(member_profile_id: params[:id], disable: 'true') ) %> @@ -26,7 +25,7 @@ - <% if is_autorized_user %> + <% if has_access? %> <% end -%> @@ -37,7 +36,7 @@ <% @researchs.each do |research| %> "> - <% if is_autorized_user %> + <% if has_access? %> @@ -48,8 +47,10 @@ <%= link_to research.research_title, OrbitHelper.url_to_plugin_show(research.to_param,'personal_research'), target: "blank"%>
@@ -60,7 +61,7 @@
- <% if is_autorized_user %> + <% if has_access? %>
<%= link_to content_tag(:i, nil, :class => 'icon-edit') +' '+ t('setting'),'/admin/members/'+@member.to_param+'/researchs/frontend_setting', :class => 'btn btn-primary' %> <%= link_to content_tag(:i, nil, :class => 'icon-plus') +' '+ t('new_'),
<%= t('personal_research.year') %>
<%= check_box_tag 'to_change[]', research.id.to_s, false, :class => "list-check" %>