fix new ui announcement preview
This commit is contained in:
1 parent
3a3f913ae6
commit
27a238a2eb
10 files changed
+156
-111
No files matched your search
@@ -2,7 +2,7 @@
|
||||
//Ex preview trigger:
|
||||
// <%= link_to "NewPreview", realtime_preview_admin_ad_banner_path(ad_banner_tab) , :class=>'preview_trigger'%>
|
||||
|
||||
$(document).ready(function() {
|
||||
$(function() {
|
||||
// $(".post_preview").click(function(e){
|
||||
// $("#main-wrap").after("<span id='show_preview'></span>");
|
||||
// e.preventDefault();
|
||||
@@ -25,21 +25,57 @@ $(document).ready(function() {
|
||||
// form.submit();
|
||||
// //return false;
|
||||
// });
|
||||
$("button.post_preview").click(function(){
|
||||
var btn = document.getElementById("button_for_preview");
|
||||
var attrs = btn.attributes;
|
||||
var url = attrs['url'];
|
||||
// url = url.replace("url=","");
|
||||
$("form.previewable").ajaxSubmit({
|
||||
beforeSubmit: function(a,f,o){
|
||||
$("#main-wrap").after("<span id='show_preview'></span>");
|
||||
o.dataType = 'script';
|
||||
o.url = url.nodeValue;
|
||||
o.type = 'post';
|
||||
},success: function(msg) { }
|
||||
// /panel/announcement/back_end/bulletins/preview
|
||||
$('#main-wrap').on(clickEvent, '.post_preview, .preview_trigger', function(e) {
|
||||
$("#main-wrap").after("<span id='show_preview'></span>");
|
||||
if($(this).hasClass('post_preview')) {
|
||||
var attrs = e.target.attributes;
|
||||
var url = attrs['url'];
|
||||
$("form.previewable").ajaxSubmit({
|
||||
beforeSubmit: function(a,f,o){
|
||||
o.dataType = 'script';
|
||||
o.url = url.nodeValue;
|
||||
o.type = 'post';
|
||||
},success: function(msg) {
|
||||
$('#show_preview .modal').modal()
|
||||
$('#show_preview .modal').height(function() {
|
||||
return $(window).height() * 0.7;
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
})
|
||||
});
|
||||
} else if($(this).hasClass('preview_trigger')) {
|
||||
$.ajax({
|
||||
type: 'PUT',
|
||||
url: $(this).attr("href"),
|
||||
data: $(this).parents("form").serialize(),
|
||||
success: function (msg) {
|
||||
$('#show_preview .modal').modal();
|
||||
$('#show_preview .modal').height(function() {
|
||||
return $(window).height() * 0.7;
|
||||
});
|
||||
},
|
||||
error: function(){
|
||||
alert("ERROR");
|
||||
}
|
||||
});
|
||||
return false;
|
||||
}
|
||||
});
|
||||
// $("a.preview_trigger").on('click',function(){
|
||||
// $("#main-wrap").after("<span id='show_preview'></span>");
|
||||
// $.ajax({
|
||||
// type: 'PUT',
|
||||
// url:$(this).attr("href"),
|
||||
// data:$(this).parents("form").serialize(),
|
||||
// success: function (msg) {
|
||||
// $("#"+start_modal_with_id).modal('show'); },
|
||||
// error: function(){
|
||||
// alert("ERROR");
|
||||
// }
|
||||
// });
|
||||
// return false;
|
||||
// });
|
||||
// $("form.nccu_ajax_form").ajaxForm({
|
||||
// beforeSubmit: function(a,f,o) {
|
||||
// // if(clicked_what.hasClass("post_preview")){
|
||||
@@ -54,19 +90,4 @@ $(document).ready(function() {
|
||||
// // }
|
||||
// }
|
||||
// })
|
||||
|
||||
$("a.preview_trigger").on('click',function(){
|
||||
$("#main-wrap").after("<span id='show_preview'></span>");
|
||||
$.ajax({
|
||||
type: 'PUT',
|
||||
url:$(this).attr("href"),
|
||||
data:$(this).parents("form").serialize(),
|
||||
success: function (msg) {
|
||||
$("#"+start_modal_with_id).modal('show'); },
|
||||
error: function(){
|
||||
alert("ERROR");
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
});
|
||||
@@ -40,9 +40,13 @@ class DefaultWidgetController< OrbitWidgetController
|
||||
|
||||
def default_widget
|
||||
@search = params["search_query"].blank? ? false : true
|
||||
if !params[:id].blank?
|
||||
if !params[:id].blank? and !params["clicked_field_name"].blank?
|
||||
clicked_field_name = params["clicked_field_name"].to_sym
|
||||
redirect_to eval("#{@page_part.module_app.widget_fields_link_method[clicked_field_name][:method]}('#{params[:id]}', {inner: #{params[:inner] || true}})")
|
||||
elsif !params[:id].blank? and params["preview"]
|
||||
clicked_field_name = :title
|
||||
@preview_pages = @page_part.module_app.widget_fields_link_method.find_all{|t| t[1].has_key?(:preview)}.collect{|t| t[0]}
|
||||
redirect_to eval("#{@page_part.module_app.widget_fields_link_method[clicked_field_name][:method]}('#{params[:id]}', {preview: true,inner: #{params[:inner] || true},clicked_field_name: '#{@preview_pages.first.to_s}'})")
|
||||
else
|
||||
@tag_class = nil
|
||||
@default_widget = @page_part.module_app.get_default_widget
|
||||
|
||||
@@ -4,37 +4,32 @@
|
||||
<h3><%= t(:preview) %></h3>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p class="">
|
||||
<iframe src=<%= @preview_obj.get_preview_link %> style="width:1024px;height:300px" >
|
||||
|
||||
</iframe>
|
||||
</p>
|
||||
<iframe src=<%= @preview_obj.get_preview_link %>></iframe>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
|
||||
<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(){
|
||||
$(function() {
|
||||
$("iframe").load(function() {
|
||||
// Get the body element
|
||||
var frameBody = $("iframe").contents().find("body");
|
||||
|
||||
var frameBody = $("iframe").contents().find('body');
|
||||
// Get all links inside the BODY tag
|
||||
$('a', frameBody).click(function(e){
|
||||
//Disable all default actions
|
||||
e.preventDefault();
|
||||
$("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>
|
||||
</div>
|
||||
</div>
|
||||
@@ -2,11 +2,8 @@
|
||||
<textarea>
|
||||
<% end %>
|
||||
$('#show_preview').html('<%=escape_javascript(render :partial=>"/shared/preview/modal_preview") %>');
|
||||
var start_modal_with_id = "<%= @preview_obj.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");
|
||||
$("#"+start_modal_with_id).modal();
|
||||
<!-- var start_modal_with_id = "<%= @preview_obj.id %>"; -->
|
||||
<!-- $("#"+start_modal_with_id).modal(); -->
|
||||
<% if !request.xhr? %>
|
||||
</textarea>
|
||||
<% end %>
|
||||
Reference in new issue
Block a user