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;
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user