|
|
|
@ -43,7 +43,7 @@
|
|
|
|
|
|
|
|
|
|
<div class="operate mt20 mb20 clearfix">
|
|
|
|
|
<%= link_to '确认提交', 'javascript:void(0)', class: 'white-btn edu-blueback-btn changebtn mr20 fl apply-publish-btn' %>
|
|
|
|
|
<%= f.submit('保存', class: 'white-btn edu-blueline-btn changebtn mr20 fl') %>
|
|
|
|
|
<%= link_to '保存', 'javascript:void(0)', class: 'white-btn edu-blueline-btn changebtn mr20 fl submit-btn' %>
|
|
|
|
|
</div>
|
|
|
|
|
<% end %>
|
|
|
|
|
</div>
|
|
|
|
@ -80,10 +80,32 @@
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$(function(){
|
|
|
|
|
var submitForm = function(){
|
|
|
|
|
var title = $("input[name='library[title]']").val();
|
|
|
|
|
var content = $("textarea[name='library[content]']").val();
|
|
|
|
|
|
|
|
|
|
if (!title || title.length == 0) {
|
|
|
|
|
alert('请输入标题');
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if (!content || content.length == 0) {
|
|
|
|
|
alert('请输入描述');
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if($('.attachments_fields .attachment').length == 0){
|
|
|
|
|
alert('请上传附件');
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$('.library-form-container form').submit();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
$('.apply-publish-btn').on('click', function(){
|
|
|
|
|
$('input[name="apply_publish"]').val(true);
|
|
|
|
|
$('.library-form-container form').submit();
|
|
|
|
|
submitForm();
|
|
|
|
|
});
|
|
|
|
|
$('.submit-btn').on('click', submitForm);
|
|
|
|
|
|
|
|
|
|
var message = '<%= flash[:message] %>';
|
|
|
|
|
if (message.length > 0) {
|
|
|
|
|