From a080ff323d6e1584a8479ec78bd23b6084336b2f Mon Sep 17 00:00:00 2001 From: Saurabh Bhatia Date: Fri, 11 Jul 2014 10:43:28 +0800 Subject: [PATCH] Fixed navigation and breadcrumb --- .../admin/journal_papers_controller.rb | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/app/controllers/admin/journal_papers_controller.rb b/app/controllers/admin/journal_papers_controller.rb index 28d6e46..4576601 100644 --- a/app/controllers/admin/journal_papers_controller.rb +++ b/app/controllers/admin/journal_papers_controller.rb @@ -6,6 +6,8 @@ class Admin::JournalPapersController < OrbitMemberController before_action :get_plugins, only: [:index, :writing_journal_setting, :new, :create, :edit, :update] before_action :set_types, only: [:writing_journal_setting, :new, :edit, :create, :update] before_action :find_journal_paper, only: [:destroy] + before_action :set_plugin + def index @writing_journals = JournalPaper.all @@ -27,11 +29,6 @@ class Admin::JournalPapersController < OrbitMemberController def new @journal_paper = JournalPaper.new @members_data = JournalPaper.member_data rescue nil - - respond_to do |format| - format.html # new.html.erb - format.xml { render :xml => @journal_paper } - end end def edit @@ -43,7 +40,7 @@ class Admin::JournalPapersController < OrbitMemberController respond_to do |format| if @journal_paper.save format.html { redirect_to admin_journal_papers_path } - format.xml { render :xml => @journal_paper, :status => :created, :location => @journal_paper } + format.json { render action: 'show', status: :created, location: @journal_paper } else format.html { render action: 'new' } format.json { render json: @journal_paper.errors, status: :unprocessable_entity } @@ -58,7 +55,7 @@ class Admin::JournalPapersController < OrbitMemberController if @journal_paper.update_attributes(journal_paper_attributes) format.html { redirect_to admin_journal_papers_path } # format.js { render 'toggle_enable' } - format.xml { head :ok } + format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @journal_paper.errors, status: :unprocessable_entity } @@ -192,6 +189,10 @@ class Admin::JournalPapersController < OrbitMemberController @plugins = OrbitApp::Plugin::Registration.all rescue nil end + def set_plugin + @plugin = OrbitApp::Plugin::Registration.all.select{|plugin| plugin.app_name.eql? 'JournalPaper'}.first + end + def set_types @journal_levels = JournalLevel.all @author_types = JournalPaperAuthorType.all