socialforge/app/views/issues/update.js.erb

24 lines
1.2 KiB
Plaintext
Raw Normal View History

<% if @saved %>
2015-12-16 09:31:11 +08:00
$("#issue_detail").replaceWith('<%= escape_javascript(render :partial => 'issues/detail') %>')
$("#issue_edit").replaceWith('<%= escape_javascript(render :partial => 'issues/edit') %>')
2015-12-17 15:19:29 +08:00
2015-12-15 18:43:58 +08:00
$("#issue_detail").show();
$("#issue_edit").hide();
$("#reply_div_<%= @issue.id %>").html("<%= escape_javascript(render :partial => 'issues/issue_replies', :locals => {:issue => @issue,:replies_all_i=>0}) %>");
2015-12-17 15:19:29 +08:00
sd_create_editor_from_data(<%= @issue.id%>, null, "100%");
2015-12-16 09:31:11 +08:00
$(".homepagePostReplyBannerCount").html('回复(<%= @issue.journals.count %>)')
//edit里的编辑器貌似显示不出来所以手动js生成。
issue_desc_editor = KindEditor.create('#issue_description',
2015-12-16 10:19:48 +08:00
{"width":"85%",
2015-12-16 09:31:11 +08:00
"resizeType":0,
"no_label":true,
"autoHeightMode":true,
2015-12-17 15:41:36 +08:00
"afterCreate":"eval(function(){ if(typeof enablePasteImg ==='function'){enablePasteImg(self);} if(typeof enableAt ==='function'){enableAt(self);} this.loadPlugin(\"autoheight\")})",
2015-12-16 09:31:11 +08:00
"emotionsBasePath":"http://localhost:3000","height":300,
"allowFileManager":true,
"uploadJson":"/kindeditor/upload",
"fileManagerJson":"/kindeditor/filemanager"});
<%else%>
alert('<%= @issue.errors.full_messages[0].to_s%>')
<%end %>