From b854e25b30f3e7361f43150dbc04c3f97d6df2d7 Mon Sep 17 00:00:00 2001 From: nccu Date: Wed, 7 Jan 2015 17:26:39 +0800 Subject: [PATCH] preview button fixed --- app/helpers/admin/announcements_helper.rb | 10 ++++++++-- app/views/admin/announcements/_index.html.erb | 13 ++++++++++++- app/views/admin/announcements/index.html.erb | 13 +------------ 3 files changed, 21 insertions(+), 15 deletions(-) diff --git a/app/helpers/admin/announcements_helper.rb b/app/helpers/admin/announcements_helper.rb index cf3ace5..47e32f2 100644 --- a/app/helpers/admin/announcements_helper.rb +++ b/app/helpers/admin/announcements_helper.rb @@ -21,8 +21,14 @@ module Admin::AnnouncementsHelper end end - ann_page = pages.first if ann_page.nil? - request.protocol+(request.host_with_port+ann_page.url+'/'+bulletin.to_param).gsub('//','/') rescue "/" + + if Page.where(:module=>'announcement',:url => "/announcement").count ==1 + ann_page = '/announcement' + else + ann_page = pages.first.url if ann_page.nil? + end + + request.protocol+(request.host_with_port+ann_page+'/'+bulletin.to_param).gsub('//','/') rescue "/" end def load_access_level diff --git a/app/views/admin/announcements/_index.html.erb b/app/views/admin/announcements/_index.html.erb index 0eaca59..b35a86b 100644 --- a/app/views/admin/announcements/_index.html.erb +++ b/app/views/admin/announcements/_index.html.erb @@ -79,4 +79,15 @@ content_tag :div, class: "bottomnav clearfix" do content_tag :div, paginate(@bulletins), class: "pagination pagination-centered" end -%> \ No newline at end of file +%> + + \ No newline at end of file diff --git a/app/views/admin/announcements/index.html.erb b/app/views/admin/announcements/index.html.erb index 7723682..92d764b 100644 --- a/app/views/admin/announcements/index.html.erb +++ b/app/views/admin/announcements/index.html.erb @@ -5,15 +5,4 @@ <%= render 'layouts/delete_modal', delete_options: @delete_options %> -<%= render :partial=> "approval_modal" %> - - \ No newline at end of file +<%= render :partial=> "approval_modal" %> \ No newline at end of file