harry's fix, announcement still broken

This commit is contained in:
Matt 2012-10-01 17:21:23 +08:00
parent edcef5a8f7
commit b65d785834
3 changed files with 7 additions and 5 deletions

View File

@ -25,14 +25,16 @@ $(document).ready(function() {
// form.submit();
// //return false;
// });
var clicked_what = null;
$("button.post_preview").click(function(){
clicked_what = $(this);
var btn = document.getElementById("button_for_preview");
var attrs = btn.attributes;
var url = attrs['url'];
// url = url.replace("url=","");
$("form.nccu_ajax_form").ajaxSubmit({
beforeSubmit: function(a,f,o){
$("#main-wrap").after("<span id='show_preview'></span>");
o.dataType = 'script';
o.url = clicked_what.attr("url");
o.url = url.nodeValue;
o.type = 'post';
}
});

View File

@ -240,7 +240,7 @@
</div>
<div class="form-actions">
<%= button_tag t("preview"), :name=>"commit",:class=>'btn post_preview two_btn',:type=>:button,:url=>preview_panel_announcement_back_end_bulletins_path %>
<%= button_tag t("preview"), :id=>"button_for_preview", :name=>"commit",:class=>'btn post_preview two_btn',:type=>:button,:url=>preview_panel_announcement_back_end_bulletins_path %>
<%= f.submit t('submit'), :class=>'btn btn-primary two_btn' %>
<%= link_to t('cancel'), get_go_back, :class=>"btn" %>
</div>

View File

@ -279,7 +279,7 @@
</div>
<div class="form-actions">
<%= button_tag t("preview"), :name=>"commit", :class=>'btn post_preview two_btn',:type=>:button, :url=>preview_panel_news_back_end_news_bulletins_path %>
<%= button_tag t("preview"), :id=>"button_for_preview", :name=>"commit", :class=>'btn post_preview two_btn',:type=>:button, :url=>preview_panel_news_back_end_news_bulletins_path %>
<%= f.submit t('submit'), :class=>'btn btn-primary two_btn' %>
<%= link_to t('cancel'), get_go_back, :class=>"btn" %>
</div>