fixes for links in plugin

This commit is contained in:
Saurabh Bhatia 2014-06-25 14:20:22 +08:00
parent 78b32248cf
commit 32cc9ed6a3
4 changed files with 10 additions and 4 deletions

View File

@ -1,5 +1,5 @@
class Admin::JournalPapersController < OrbitMemberController class Admin::JournalPapersController < OrbitMemberController
include Admin::JournalPapersHelper
before_action :set_journal_paper, only: [:show, :edit , :update, :destroy] before_action :set_journal_paper, only: [:show, :edit , :update, :destroy]
before_action :get_plugins, only: [:index, :writing_journal_setting, :new, :create, :edit, :update] 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 :set_types, only: [:writing_journal_setting, :new, :edit, :create, :update]

View File

@ -1,2 +1,9 @@
module Admin::JournalPapersHelper module Admin::JournalPapersHelper
def page_for_journal_paper(journal_paper)
journal_paper_page = nil
pages = Page.where(:module=>"member")
journal_paper_page = pages.first if journal_paper_page.nil?
request.protocol+(request.host_with_port+journal_paper_page.url+'/'+journal_paper.to_param+"?method=personal_plugin&plugin_name=JournalPaper").gsub('//','/') rescue "/"
end
end end

View File

@ -2,8 +2,7 @@
<td class="span1"><%= writing_journal.year %></td> <td class="span1"><%= writing_journal.year %></td>
<td class="span1"> <td class="span1">
<%= link_to writing_journal.create_link %> <%= link_to writing_journal.create_link, page_for_journal_paper(writing_journal), target: "blank"%>
<div class="quick-edit"> <div class="quick-edit">
<ul class="nav nav-pills hide"> <ul class="nav nav-pills hide">
<li><%= link_to t('edit'), edit_admin_journal_paper_path(writing_journal) %></li> <li><%= link_to t('edit'), edit_admin_journal_paper_path(writing_journal) %></li>

View File

@ -65,7 +65,7 @@
<% end -%> <% end -%>
<td><%= writing_journal.year %></td> <td><%= writing_journal.year %></td>
<td> <td>
<%= link_to writing_journal.create_link %> <%= link_to writing_journal.create_link, page_for_journal_paper(writing_journal), target: "blank"%>
<div class="quick-edit"> <div class="quick-edit">
<ul class="nav nav-pills hide"> <ul class="nav nav-pills hide">