Announcement preivew
This commit is contained in:
parent
f6307abfbf
commit
453cb21066
|
@ -96,9 +96,9 @@ class ApplicationController < ActionController::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
# Render the page
|
# Render the page
|
||||||
def render_page(id = nil)
|
def render_page(param)
|
||||||
if @item
|
if @item
|
||||||
render :text => process_page(@item, id), :layout => 'page_layout'
|
render :text => process_page(@item, param[:id],param), :layout => 'page_layout'
|
||||||
else
|
else
|
||||||
render :text => '404 Not Found'
|
render :text => '404 Not Found'
|
||||||
end
|
end
|
||||||
|
|
|
@ -19,7 +19,7 @@ class PagesController < ApplicationController
|
||||||
if @item && @item.is_published
|
if @item && @item.is_published
|
||||||
case @item._type
|
case @item._type
|
||||||
when 'Page'
|
when 'Page'
|
||||||
render_page(params[:id])
|
render_page(params)
|
||||||
when 'Link'
|
when 'Link'
|
||||||
redirect_to "http://#{@item[:url]}"
|
redirect_to "http://#{@item[:url]}"
|
||||||
end
|
end
|
||||||
|
@ -40,7 +40,9 @@ class PagesController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def show_from_link
|
def show_from_link
|
||||||
redirect_to "/#{@item.full_name}?id=#{params[:id]}"
|
# debugger
|
||||||
|
# a=1
|
||||||
|
redirect_to "/#{@item.full_name}?id=#{params[:id]}&preview=#{params[:preview]}"
|
||||||
end
|
end
|
||||||
|
|
||||||
def load_orbit_bar
|
def load_orbit_bar
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<% content_for :page_specific_css do -%>
|
<% content_for :page_specific_css do -%>
|
||||||
<%#= stylesheet_link_tag "admin/ad_banner_preview" %>
|
<%#= stylesheet_link_tag "admin/ad_banner_preview" %>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
<% content_for :page_specific_css do -%>
|
<% content_for :page_specific_javascript do -%>
|
||||||
<%= javascript_include_tag "/static/jquery.cycle.all.latest.js" %>
|
<%= javascript_include_tag "/static/jquery.cycle.all.latest.js" %>
|
||||||
<%= javascript_include_tag "inc/modal-preview" %>
|
<%= javascript_include_tag "inc/modal-preview" %>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
|
|
|
@ -17,17 +17,17 @@
|
||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
<dl id="sub_manager">
|
<dl id="sub_manager">
|
||||||
<dt><%= t("admin.user_role.auth.sub_manager") %></ht>
|
<dt><%#= t("admin.user_role.auth.sub_manager") %></ht>
|
||||||
<% @module_app.sub_managers.each do |manager| %>
|
<%# @module_app.sub_managers.each do |manager| %>
|
||||||
<dd><%= manager.user.name %> <%= get_auth_by(manager) %><%= link_to '[X]',remove_sub_manager_admin_module_app_path(@module_app,manager),:method => :delete if if_permit_to_delete(:sub_manager) && manager.user != current_user %> </dd>
|
<dd><%#= manager.user.name %> <%#= get_auth_by(manager) %><%#= link_to '[X]',remove_sub_manager_admin_module_app_path(@module_app,manager),:method => :delete if if_permit_to_delete(:sub_manager) && manager.user != current_user %> </dd>
|
||||||
<% end %>
|
<%# end %>
|
||||||
<dd>
|
<dd>
|
||||||
<%= form_tag(assign_sub_manager_admin_module_app_path) do %>
|
<%#= form_tag(assign_sub_manager_admin_module_app_path) do %>
|
||||||
<%= collection_select(:sub_manager,:id, User.all, :id, :name, :prompt => true,:disabled => !if_permit_to_assign(:sub_manager))%>
|
<%#= collection_select(:sub_manager,:id, User.all, :id, :name, :prompt => true,:disabled => !if_permit_to_assign(:sub_manager))%>
|
||||||
<%= submit_tag t("admin.user_role.auth.add_sub_manager") %>
|
<%#= submit_tag t("admin.user_role.auth.add_sub_manager") %>
|
||||||
<% end %>
|
<%# end %>
|
||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
<%= render :partial => "admin/components/user_role_management", :locals => { :object => @module_app ,:auth=> @module_app.app_auth ,:submit_url=> admin_module_app_app_auths_path(@module_app),:ploy_route_ary=>['remove',:admin,@module_app,@module_app.app_auth] } %>
|
<%#= render :partial => "admin/components/user_role_management", :locals => { :object => @module_app ,:auth=> @module_app.app_auth ,:submit_url=> admin_module_app_app_auths_path(@module_app),:ploy_route_ary=>['remove',:admin,@module_app,@module_app.app_auth] } %>
|
||||||
|
|
||||||
|
|
|
@ -21,10 +21,10 @@ module ParserFrontEnd
|
||||||
|
|
||||||
require 'nokogiri'
|
require 'nokogiri'
|
||||||
|
|
||||||
def parse_page_noko(page, id = nil)
|
def parse_page_noko(page, id = nil,params)
|
||||||
body = Nokogiri::HTML(page.design.layout.body)
|
body = Nokogiri::HTML(page.design.layout.body)
|
||||||
parse_menu(body, page)
|
parse_menu(body, page)
|
||||||
public_r_tags = parse_contents(body, page, id)
|
public_r_tags = parse_contents(body, page, id,params[:preview])
|
||||||
parse_images(body, page)
|
parse_images(body, page)
|
||||||
|
|
||||||
public_r_tags.each do |tag|
|
public_r_tags.each do |tag|
|
||||||
|
@ -35,7 +35,7 @@ module ParserFrontEnd
|
||||||
end
|
end
|
||||||
|
|
||||||
# page_contents
|
# page_contents
|
||||||
def parse_contents(body, page, id)
|
def parse_contents(body, page, id,preview = false)
|
||||||
public_r_tags = []
|
public_r_tags = []
|
||||||
body.css('.page_content').each do |content|
|
body.css('.page_content').each do |content|
|
||||||
ret = ''
|
ret = ''
|
||||||
|
|
|
@ -3,6 +3,13 @@ class Panel::Announcement::BackEnd::ApprovalsController < OrbitBackendControlle
|
||||||
before_filter :is_admin?
|
before_filter :is_admin?
|
||||||
include AdminHelper
|
include AdminHelper
|
||||||
# layout 'admin'
|
# layout 'admin'
|
||||||
|
def preview_and_approve
|
||||||
|
@bulletin = Bulletin.find params[:bulletin_id]
|
||||||
|
end
|
||||||
|
|
||||||
|
def approve
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
def setting
|
def setting
|
||||||
@bulletin_categorys = BulletinCategory.all
|
@bulletin_categorys = BulletinCategory.all
|
||||||
|
|
|
@ -25,10 +25,20 @@ class Panel::Announcement::FrontEnd::BulletinsController < OrbitWidgetController
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
|
if params[:preview] == "true"
|
||||||
|
preview_content
|
||||||
|
else
|
||||||
@bulletin = Bulletin.can_display.where(_id: params[:id]).first
|
@bulletin = Bulletin.can_display.where(_id: params[:id]).first
|
||||||
get_categorys
|
get_categorys
|
||||||
end
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
def preview_content
|
||||||
|
@bulletin = Bulletin.find params[:id]
|
||||||
|
get_categorys
|
||||||
|
render :show
|
||||||
|
end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,68 @@
|
||||||
|
<% if bulletin -%>
|
||||||
|
|
||||||
|
<div class="modal hide fade in banner-preview" id="bulletin-<%=bulletin.id%>">
|
||||||
|
<div class="modal-header">
|
||||||
|
<a class="close" data-dismiss="modal">×</a>
|
||||||
|
<h3><%= t("modal.preview") %></h3>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<p class="bulletin_slideshow">
|
||||||
|
<iframe src=<%= panel_announcement_front_end_bulletin_path(bulletin, :category_id => bulletin.bulletin_category.id ,:preview=>true) %> style="width:1024px;height:300px" >
|
||||||
|
|
||||||
|
</iframe>
|
||||||
|
|
||||||
|
<%# preview_block_ad_images_helper(bulletin).each do |ad_image| -%>
|
||||||
|
<%#= image_tag ad_image.file,:alt => (ad_image.title[locale] || " "),:time_to_next => bulletin.transition_msec,:link_open=> ad_image.link_open, :link_url =>((ad_image.out_link || bulletin.context || " ")) %>
|
||||||
|
<%# end -%>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
|
||||||
|
<%= form_for bulletin, :url => panel_announcement_back_end_bulletin_path(bulletin), :html => {:class => 'clear'} do |f| %>
|
||||||
|
<%= f.label :approval_stat, t('announcement.bulletin.approval_stat') %>
|
||||||
|
<%= content_tag :label,:class => "radio inline" do -%>
|
||||||
|
<%= f.radio_button :is_checked, true , {:class => 'privacy'} %>
|
||||||
|
<%= t('announcement.bulletin.approval_pass') %>
|
||||||
|
<% end -%>
|
||||||
|
<%= content_tag :label,:class => "radio inline" do -%>
|
||||||
|
<%= f.radio_button :is_checked, false, (!@bulletin.is_checked ? {:checked => true, :class => 'privacy'} : {})%>
|
||||||
|
<%= t('announcement.bulletin.approval_not_pass') %>
|
||||||
|
<% end -%>
|
||||||
|
|
||||||
|
<%= label :is_checked_false, t('announcement.bulletin.approval_not_pass_reason') %>
|
||||||
|
<%= f.text_field :not_checked_reason %>
|
||||||
|
<%= f.submit t('announcement.bulletin.submit_approval'),:class=>"btn"%>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<a href="#" class="btn" data-dismiss="modal"><%= t("modal.close") %></a>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<script type="text/javascript" src="/static/kernel.js"></script>
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(document).ready(function() {
|
||||||
|
|
||||||
|
// $("#bulletin-<%#=bulletin.title.dehumanize%>").on("show", function () {
|
||||||
|
// $("#bulletin-<%#=bulletin.title.dehumanize%>").find(".bulletin_slideshow").cycle({delay: -1000, fx: "<%#= bulletin.ad_fx.nil?? "fade": bulletin.ad_fx %>", timeoutFn: getTimeout });
|
||||||
|
// });
|
||||||
|
$(".modal").on("hidden", function () {
|
||||||
|
$("#show_preview").remove();
|
||||||
|
});
|
||||||
|
|
||||||
|
$("iframe").load(function(){
|
||||||
|
// Get the body element
|
||||||
|
var frameBody = $("iframe").contents().find("body");
|
||||||
|
|
||||||
|
// Get all links inside the BODY tag
|
||||||
|
$('a', frameBody).click(function(e){
|
||||||
|
//Disable all default actions
|
||||||
|
e.preventDefault();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<% end -%>
|
|
@ -0,0 +1,5 @@
|
||||||
|
$('#show_preview').html("<%= escape_javascript(render(:partial => 'modal_approve',:locals => {:bulletin => @bulletin})) %>");
|
||||||
|
var start_modal_with_id = "bulletin-<%=@bulletin.id%>";
|
||||||
|
$("#"+start_modal_with_id).css("width","1050px");
|
||||||
|
$("#"+start_modal_with_id).css("height","768px");
|
||||||
|
$("#"+start_modal_with_id).css("margin","-270px 0 0 -550px");
|
|
@ -54,7 +54,7 @@
|
||||||
<li class="dropdown"><%= link_to t('bulletin.delete'), panel_announcement_back_end_bulletin_path(bulletin), :confirm => t('announcement.sure?'), :method => :delete, :remote => true %></li>
|
<li class="dropdown"><%= link_to t('bulletin.delete'), panel_announcement_back_end_bulletin_path(bulletin), :confirm => t('announcement.sure?'), :method => :delete, :remote => true %></li>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
<% if show_approval_link(bulletin) %>
|
<% if show_approval_link(bulletin) %>
|
||||||
<li><%= link_to t('announcement.bulletin.approval'), edit_panel_announcement_back_end_bulletin_path(bulletin) %></li><%#= #TODO add ancher so user can quick access into that part %>
|
<li><%= link_to t('announcement.bulletin.approval'), panel_announcement_back_end_bulletin_approval_preview_path(bulletin),:class => 'preview_trigger' %></li><%#= #TODO add ancher so user can quick access into that part %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -105,28 +105,6 @@
|
||||||
<a class="action"><i title="A" class="icon-exclamation-sign icon-white tip"></i></a>
|
<a class="action"><i title="A" class="icon-exclamation-sign icon-white tip"></i></a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h3 class="widget-title"><i class="icons-link icons-white"></i>Audit</h3>
|
|
||||||
<div class="widget-content">
|
|
||||||
|
|
||||||
<% if is_manager? || @bulletin.bulletin_category.authed_users('fact_check').include?(current_user) || current_user.admin? %>
|
|
||||||
<div class="controls">
|
|
||||||
<%= f.label :approval_stat, t('announcement.bulletin.approval_stat') %>
|
|
||||||
<%= content_tag :label,:class => "radio inline" do -%>
|
|
||||||
<%= f.radio_button :is_checked, true , {:class => 'privacy'} %>
|
|
||||||
<%= t('announcement.bulletin.approval_pass') %>
|
|
||||||
<% end -%>
|
|
||||||
<%= content_tag :label,:class => "radio inline" do -%>
|
|
||||||
<%= f.radio_button :is_checked, false, (!@bulletin.is_checked ? {:checked => true, :class => 'privacy'} : {})%>
|
|
||||||
<%= t('announcement.bulletin.approval_not_pass') %>
|
|
||||||
<% end -%>
|
|
||||||
<div class="select-role">
|
|
||||||
<%= label :is_checked_false, t('announcement.bulletin.approval_not_pass_reason') %>
|
|
||||||
<%= f.text_field :not_checked_reason %>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<% elsif current_user.admin? %>
|
<% elsif current_user.admin? %>
|
||||||
<%= f.hidden_field :is_checked,:value => true%>
|
<%= f.hidden_field :is_checked,:value => true%>
|
||||||
|
|
|
@ -20,5 +20,7 @@
|
||||||
|
|
||||||
<% content_for :page_specific_javascript do %>
|
<% content_for :page_specific_javascript do %>
|
||||||
<%= javascript_include_tag "bulletin_form" %>
|
<%= javascript_include_tag "bulletin_form" %>
|
||||||
|
<%= javascript_include_tag "/static/jquery.cycle.all.latest.js" %>
|
||||||
|
<%= javascript_include_tag "inc/modal-preview" %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
|
|
@ -82,6 +82,7 @@ en:
|
||||||
approval_setting_window_title: 'Unit'
|
approval_setting_window_title: 'Unit'
|
||||||
approval_user_list: 'Approval Users'
|
approval_user_list: 'Approval Users'
|
||||||
cate_auth: Category Authorization
|
cate_auth: Category Authorization
|
||||||
|
submit_approval: Submit approval
|
||||||
tag_cloud: Tag cloud
|
tag_cloud: Tag cloud
|
||||||
|
|
||||||
# admin:
|
# admin:
|
||||||
|
|
|
@ -63,6 +63,7 @@ zh_tw:
|
||||||
approval_setting_window_title: '單位'
|
approval_setting_window_title: '單位'
|
||||||
approval_user_list: '審核者'
|
approval_user_list: '審核者'
|
||||||
cate_auth: '分類授權'
|
cate_auth: '分類授權'
|
||||||
|
submit_approval: '提交審核'
|
||||||
tag_cloud: 標籤雲
|
tag_cloud: 標籤雲
|
||||||
|
|
||||||
bulletin:
|
bulletin:
|
||||||
|
|
|
@ -7,6 +7,8 @@ Rails.application.routes.draw do
|
||||||
match 'approval_setting' => "approvals#update_setting" ,:as => :approval_setting,:via => :post
|
match 'approval_setting' => "approvals#update_setting" ,:as => :approval_setting,:via => :post
|
||||||
match 'approval_setting' => "approvals#user_list" ,:as => :approval_user_list,:via => :put
|
match 'approval_setting' => "approvals#user_list" ,:as => :approval_user_list,:via => :put
|
||||||
resources :bulletins do
|
resources :bulletins do
|
||||||
|
match "approve/:bulletin_id" => "approvals#preview_and_approve",:as => :approval_preview,:via => :put
|
||||||
|
match "approve/:bulletin_id" => "approvals#approve",:as => :approve,:via => :post
|
||||||
match "link_quick_add/:bulletin_id" => "bulletins#link_quick_add" ,:as => :link_quick_add
|
match "link_quick_add/:bulletin_id" => "bulletins#link_quick_add" ,:as => :link_quick_add
|
||||||
match "link_quick_edit/:bulletin_id" => "bulletins#link_quick_edit" ,:as => :link_quick_edit
|
match "link_quick_edit/:bulletin_id" => "bulletins#link_quick_edit" ,:as => :link_quick_edit
|
||||||
member do
|
member do
|
||||||
|
@ -32,7 +34,9 @@ Rails.application.routes.draw do
|
||||||
resources :tags
|
resources :tags
|
||||||
end
|
end
|
||||||
namespace :front_end do
|
namespace :front_end do
|
||||||
resources :bulletins
|
resources :bulletins # do
|
||||||
|
# match "preview" => "bulletins#preview_content",:as => :get_preview_content
|
||||||
|
# end
|
||||||
end
|
end
|
||||||
namespace :widget do
|
namespace :widget do
|
||||||
match "bulletins" => "bulletins#index"
|
match "bulletins" => "bulletins#index"
|
||||||
|
|
Reference in New Issue