diff --git a/app/controllers/admin/journal_levels_controller.rb b/app/controllers/admin/journal_levels_controller.rb index af60876..6ddd63c 100644 --- a/app/controllers/admin/journal_levels_controller.rb +++ b/app/controllers/admin/journal_levels_controller.rb @@ -1,4 +1,5 @@ -class Admin::JournalLevelsController < ApplicationController +class Admin::JournalLevelsController < OrbitMemberController + before_action :allow_admin_only before_action :set_journal_level, only: [:edit, :update, :destroy] def initialize diff --git a/app/controllers/admin/journal_paper_author_types_controller.rb b/app/controllers/admin/journal_paper_author_types_controller.rb index b6bd815..6aa7110 100644 --- a/app/controllers/admin/journal_paper_author_types_controller.rb +++ b/app/controllers/admin/journal_paper_author_types_controller.rb @@ -1,4 +1,5 @@ -class Admin::JournalPaperAuthorTypesController < ApplicationController +class Admin::JournalPaperAuthorTypesController < OrbitMemberController + before_action :allow_admin_only before_action :set_journal_paper_author_type, only: [:edit, :update, :destroy] def initialize diff --git a/app/controllers/admin/journal_paper_types_controller.rb b/app/controllers/admin/journal_paper_types_controller.rb index a9471d9..b7144a6 100644 --- a/app/controllers/admin/journal_paper_types_controller.rb +++ b/app/controllers/admin/journal_paper_types_controller.rb @@ -1,5 +1,5 @@ -class Admin::JournalPaperTypesController < ApplicationController - +class Admin::JournalPaperTypesController < OrbitMemberController + before_action :allow_admin_only before_action :set_journal_paper_type, only: [:edit, :update, :destroy] def initialize diff --git a/app/controllers/admin/journal_papers_controller.rb b/app/controllers/admin/journal_papers_controller.rb index 2b47643..9f21bfb 100644 --- a/app/controllers/admin/journal_papers_controller.rb +++ b/app/controllers/admin/journal_papers_controller.rb @@ -8,6 +8,8 @@ class Admin::JournalPapersController < OrbitMemberController before_action :find_journal_paper, only: [:destroy] before_action :set_plugin + before_action :need_access_right + before_action :allow_admin_only, :only => [:index, :writing_journal_setting] def index @writing_journals = JournalPaper.order_by(:year=>'desc').page(params[:page]).per(10) @@ -39,7 +41,7 @@ class Admin::JournalPapersController < OrbitMemberController @journal_paper = JournalPaper.new(journal_paper_attributes) respond_to do |format| if @journal_paper.save - format.html { redirect_to admin_journal_papers_path } + format.html { redirect_to params['referer_url'] } format.json { render action: 'show', status: :created, location: @journal_paper } else format.html { render action: 'new' } @@ -53,7 +55,7 @@ class Admin::JournalPapersController < OrbitMemberController respond_to do |format| if @journal_paper.update_attributes(journal_paper_attributes) - format.html { redirect_to admin_journal_papers_path } + format.html { redirect_to params['referer_url'] } # format.js { render 'toggle_enable' } format.json { head :no_content } else diff --git a/app/controllers/journal_papers_controller.rb b/app/controllers/journal_papers_controller.rb index c7aa0ab..c12d904 100644 --- a/app/controllers/journal_papers_controller.rb +++ b/app/controllers/journal_papers_controller.rb @@ -22,8 +22,10 @@ class JournalPapersController < ApplicationController end def show - params = OrbitHelper.params - journal_paper = JournalPaper.find_by(uid: params[:uid]) + params = OrbitHelper.params + journal_paper = JournalPaper.find_by(uid: params[:uid]) + field_to_show = ["year", "language", "vol_no", "issue_no", "form_to_start", "form_to_end", "total_pages", "isbn", "publication_date", "url", "note", "journal_title", "paper_title", "updated_at", "created_at", "uid", "journal_level_ids", "journal_paper_author_type_ids", "member_profile_id"] + publication_date = journal_paper.publication_date.to_date.strftime("%Y/%m/%d") rescue nil files = journal_paper.journal_paper_files.map{|file| { "file_url" => file.journal_file.url, "file_title" => (file.title.blank? ? File.basename(file.file.path) : file.title) } } rescue [] { diff --git a/app/views/admin/journal_papers/_form.html.erb b/app/views/admin/journal_papers/_form.html.erb index 7f4f119..793efd0 100644 --- a/app/views/admin/journal_papers/_form.html.erb +++ b/app/views/admin/journal_papers/_form.html.erb @@ -309,6 +309,7 @@
<% end -%> | <%= t('personal_journal.year') %> | @@ -59,7 +58,7 @@ <% @writing_journals.each do |writing_journal| %>
---|---|
<%= check_box_tag 'to_change[]', writing_journal.id.to_s, false, :class => "list-check" %> | @@ -69,8 +68,10 @@ <%= link_to writing_journal.create_link, page_for_journal_paper(writing_journal), target: "blank"%>