view for preview
This commit is contained in:
parent
fc4e2ceba5
commit
ae1595a008
|
@ -3,6 +3,26 @@
|
||||||
// <%= link_to "NewPreview", realtime_preview_admin_ad_banner_path(ad_banner_tab) , :class=>'preview_trigger'%>
|
// <%= link_to "NewPreview", realtime_preview_admin_ad_banner_path(ad_banner_tab) , :class=>'preview_trigger'%>
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
$("a.post_preview").click(function(e){
|
||||||
|
$("#main-wrap").after("<span id='show_preview'></span>");
|
||||||
|
e.preventDefault();
|
||||||
|
var form = $(this).parents("form").first()
|
||||||
|
//var cont = form["content"].value;
|
||||||
|
$.ajax({
|
||||||
|
type: 'POST',
|
||||||
|
url: $(this).attr("href")+'?preview=true',
|
||||||
|
data: form.serialize(),
|
||||||
|
dataType: "script",
|
||||||
|
success: function (msg) {
|
||||||
|
$("#"+start_modal_with_id).modal('show'); },
|
||||||
|
error: function(){
|
||||||
|
alert("ERROR");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return false
|
||||||
|
});
|
||||||
|
|
||||||
$("a.preview_trigger").click(function(){
|
$("a.preview_trigger").click(function(){
|
||||||
$("#main-wrap").after("<span id='show_preview'></span>");
|
$("#main-wrap").after("<span id='show_preview'></span>");
|
||||||
$.ajax({
|
$.ajax({
|
||||||
|
|
|
@ -238,6 +238,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-actions">
|
<div class="form-actions">
|
||||||
|
<%= link_to t('preview'),panel_announcement_back_end_bulletin_preview_path, :class=>"btn" %>
|
||||||
<%= f.submit t('submit'), :class=>'btn btn-primary' %>
|
<%= f.submit t('submit'), :class=>'btn btn-primary' %>
|
||||||
<%= link_to t('cancel'), get_go_back, :class=>"btn" %>
|
<%= link_to t('cancel'), get_go_back, :class=>"btn" %>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -15,6 +15,7 @@ Rails.application.routes.draw do
|
||||||
get 'load_quick_edit'
|
get 'load_quick_edit'
|
||||||
end
|
end
|
||||||
collection do
|
collection do
|
||||||
|
post "preview"
|
||||||
get 'delete'
|
get 'delete'
|
||||||
end
|
end
|
||||||
match "file_quick_add/:bulletin_id" => "bulletins#file_quick_add" ,:as => :file_quick_add
|
match "file_quick_add/:bulletin_id" => "bulletins#file_quick_add" ,:as => :file_quick_add
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
<% # encoding: utf-8 %>
|
<% # encoding: utf-8 %>
|
||||||
|
<% content_for :page_specific_javascript do -%>
|
||||||
|
<%= javascript_include_tag "inc/modal-preview" %>
|
||||||
|
<% end -%>
|
||||||
<!--Widget start-->
|
<!--Widget start-->
|
||||||
<%= f.error_messages %>
|
<%= f.error_messages %>
|
||||||
|
|
||||||
|
@ -279,6 +281,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-actions">
|
<div class="form-actions">
|
||||||
|
<%= link_to t('preview'),preview_panel_news_back_end_news_bulletins_path, :class=>"btn post_preview",:method=>:post , :remote => true%>
|
||||||
<%= f.submit t('submit'), :class=>'btn btn-primary' %>
|
<%= f.submit t('submit'), :class=>'btn btn-primary' %>
|
||||||
<%= link_to t('cancel'), get_go_back, :class=>"btn" %>
|
<%= link_to t('cancel'), get_go_back, :class=>"btn" %>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -0,0 +1,47 @@
|
||||||
|
<div class="modal hide fade in banner-preview" id="<%= news_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="news_bulletin_slideshow">
|
||||||
|
<iframe src=<%= panel_news_front_end_news_bulletin_path(news_bulletin, :category_id => (news_bulletin.news_bulletin_category.id rescue ""),:preview=>true) %> style="width:1024px;height:300px" >
|
||||||
|
|
||||||
|
</iframe>
|
||||||
|
|
||||||
|
<%# preview_block_ad_images_helper(news_bulletin).each do |ad_image| -%>
|
||||||
|
<%#= image_tag ad_image.file,:alt => (ad_image.title[locale] || " "),:time_to_next => news_bulletin.transition_msec,:link_open=> ad_image.link_open, :link_url =>((ad_image.out_link || news_bulletin.context || " ")) %>
|
||||||
|
<%# end -%>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
|
||||||
|
<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() {
|
||||||
|
|
||||||
|
// $("#news_bulletin-<%#=news_bulletin.title.dehumanize%>").on("show", function () {
|
||||||
|
// $("#news_bulletin-<%#=news_bulletin.title.dehumanize%>").find(".news_bulletin_slideshow").cycle({delay: -1000, fx: "<%#= news_bulletin.ad_fx.nil?? "fade": news_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();
|
||||||
|
});
|
||||||
|
$('input', frameBody).attr("disabled", true);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</div>
|
||||||
|
</div>
|
5
vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/preview.js.erb
vendored
Normal file
5
vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/preview.js.erb
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
$('#show_preview').html('<%=escape_javascript(render :partial=>"modal_preview",:locals=>{:news_bulletin => @preview_news_bulletin}) %>');
|
||||||
|
var start_modal_with_id = "<%= @preview_news_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");
|
|
@ -11,10 +11,12 @@ Rails.application.routes.draw do
|
||||||
match "approve/:news_bulletin_id" => "news_approvals#approve",:as => :approve,:via => :post
|
match "approve/:news_bulletin_id" => "news_approvals#approve",:as => :approve,:via => :post
|
||||||
match "link_quick_add/:news_bulletin_id" => "news_bulletins#link_quick_add" ,:as => :link_quick_add
|
match "link_quick_add/:news_bulletin_id" => "news_bulletins#link_quick_add" ,:as => :link_quick_add
|
||||||
match "link_quick_edit/:news_bulletin_id" => "news_bulletins#link_quick_edit" ,:as => :link_quick_edit
|
match "link_quick_edit/:news_bulletin_id" => "news_bulletins#link_quick_edit" ,:as => :link_quick_edit
|
||||||
|
|
||||||
member do
|
member do
|
||||||
get 'load_quick_edit'
|
get 'load_quick_edit'
|
||||||
end
|
end
|
||||||
collection do
|
collection do
|
||||||
|
post "preview"
|
||||||
get 'delete'
|
get 'delete'
|
||||||
end
|
end
|
||||||
match "file_quick_add/:news_bulletin_id" => "news_bulletins#file_quick_add" ,:as => :file_quick_add
|
match "file_quick_add/:news_bulletin_id" => "news_bulletins#file_quick_add" ,:as => :file_quick_add
|
||||||
|
|
Loading…
Reference in New Issue