fix new ui announcement preview

This commit is contained in:
Spen committed 2013-10-24 14:46:53 +08:00
1 parent 3a3f913ae6
commit 27a238a2eb
10 files changed
+156 -111

No files matched your search

@@ -56,20 +56,30 @@ class Panel::Announcement::FrontEnd::BulletinsController < OrbitWidgetController
delayed_impressionist(@tag) if @tag
end
end
end
def show
@item = Page.find(params[:page_id]) rescue nil
@bulletin = Bulletin.all.can_display.where(_id: params[:id]).first
if @bulletin and !@bulletin.disable? and !@bulletin.is_rejected
if @bulletin.enabled_for_lang(I18n.locale.to_s)
impressionist(@bulletin)
else
render :text => "<div class='alert alert-error'>#{t('sys.can_not_display_due_to_no_context')}</div>".html_safe
end
if params[:preview] == "true"
preview_content
else
render :nothing => true, :status => 403
@bulletin = Bulletin.all.can_display.where(_id: params[:id]).first
if @bulletin and !@bulletin.disable? and !@bulletin.is_rejected
if @bulletin.enabled_for_lang(I18n.locale.to_s)
delayed_impressionist(@bulletin)
else
render :text => "<div class='alert alert-error'>#{t('sys.can_not_display_due_to_no_context')}</div>".html_safe
end
else
render :nothing => true, :status => 403
end
end
end
def preview_content
@bulletin = Bulletin.find params[:id] rescue nil
@bulletin = Preview.find(params[:id]).get_virtual_object if @bulletin.nil?
end
end
@@ -6,57 +6,78 @@
<h3><%= t(:preview) %></h3>
</div>
<div class="modal-body">
<p class="bulletin_slideshow">
<iframe src=<%= panel_announcement_front_end_bulletin_path(bulletin, :category_id => bulletin.category.id ,:preview=>true) %> style="width:1024px;height:300px" >
</iframe>
</p>
<iframe src=<%= panel_announcement_front_end_bulletin_path(bulletin, :category_id => bulletin.category.id ,:preview=>true) %>></iframe>
</div>
<div class="modal-footer">
<%= form_for bulletin, :url => panel_announcement_back_end_bulletin_approve_path(bulletin),:method => :post, :html => {:class => 'clear'} do |f| %>
<%= f.label :approval_stat, t('approval.stat') %>
<%= content_tag :label,:class => "radio inline" do -%>
<%= f.radio_button :is_checked, true , {:class => 'privacy'} %>
<%= t('approval.pass') %>
<% end -%>
<%= content_tag :label,:class => "radio inline" do -%>
<%= f.radio_button :is_checked, false, (!@bulletin.is_checked ? {:checked => true, :class => 'privacy'} : {})%>
<%= t('approval.not_pass') %>
<%= form_for bulletin, :url => panel_announcement_back_end_bulletin_approve_path(bulletin),:method => :post, :html => {:class => 'form-horizontal'} do |f| %>
<%= content_tag :div,:class => "control-group pull-left" do -%>
<%= f.label :approval_stat, t('approval.stat'), :class=>"control-label" %>
<%= content_tag :div,:class => "controls" do -%>
<%= content_tag :label,:class => "radio inline" do -%>
<%= f.radio_button :is_checked, true , {:class => 'privacy'} %>
<%= t('approval.pass') %>
<% end -%>
<%= content_tag :label,:class => "radio inline" do -%>
<%= f.radio_button :is_checked, false, (!@bulletin.is_checked ? {:checked => true, :class => 'privacy'} : {})%>
<%= t('approval.not_pass') %>
<% end -%>
<% end -%>
<% end -%>
<%= label :is_checked_false, t('approval.not_pass_reason') %>
<%= f.text_field :not_checked_reason %>
<%= f.submit t(:submit_approval),:class=>"btn"%>
<%= content_tag :div,:class => "control-group pull-left reject" do -%>
<%= label :is_checked_false, t('approval.not_pass_reason'), :class=>"control-label" %>
<%= content_tag :div,:class => "controls" do -%>
<%= f.text_field :not_checked_reason, :class=>"input-xlarge" %>
<% end %>
<% end %>
<%= content_tag :div,:class => "control-group pull-right" do -%>
<%= f.submit t(:submit_approval),:class=>"btn"%>
<button class="btn" data-dismiss="modal" aria-hidden="true"><%= t(:close) %></button>
<% end %>
<% end %>
<a href="#" class="btn" data-dismiss="modal"><%= t(:close) %></a>
</div>
<div>
<script type="text/javascript" src="/static/kernel.js"></script>
<script type="text/javascript" src="/assets/kernel.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$(".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();
});
$('input', frameBody).attr("disabled", true);
});
});
$(function() {
$("iframe").load(function() {
// Get the body element
var frameBody = $("iframe").contents().find('body');
// Get all links inside the BODY tag
$("iframe").contents().find('#orbit-bar').hide();
frameBody.find('a').click(function(e){
//Disable all default actions
e.preventDefault();
});
$('input', frameBody).attr("disabled", true);
});
$(".modal").on("hidden", function () {
$("#show_preview").remove();
});
});
</script>
<script>
$('#show_preview').on(clickEvent, 'input[type="radio"]', function(event) {
if($(this).val() == "true") {
$('.reject').addClass('hide');
} else {
$('.reject').removeClass('hide');
}
});
</script>
</div>
</div>
<% end -%>
@@ -25,7 +25,7 @@
<a href="#" class="btn" data-dismiss="modal"><%= t(:close) %></a>
</div>
<div>
<script type="text/javascript" src="/static/kernel.js"></script>
<script type="text/javascript" src="/assets/kernel.js"></script>
<script type="text/javascript">
$(document).ready(function() {
@@ -1,5 +1,2 @@
$('#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");
@@ -25,7 +25,7 @@
<a href="#" class="btn" data-dismiss="modal"><%= t(:close) %></a>
</div>
<div>
<script type="text/javascript" src="/static/kernel.js"></script>
<script type="text/javascript" src="/assets/kernel.js"></script>
<script type="text/javascript">
$(document).ready(function() {
@@ -19,7 +19,7 @@
<a href="#" class="btn" data-dismiss="modal"><%= t(:close) %></a>
</div>
<div>
<script type="text/javascript" src="/static/kernel.js"></script>
<script type="text/javascript" src="/assets/kernel.js"></script>
<script type="text/javascript">
$(document).ready(function() {