Files

28 lines
1.5 KiB
ERB

<% if controller.action_name == "new" %>
<div class="control-group">
<%= f.label :content, t('category'), class: 'control-label' %>
<%= f.select :category_id, options_for_select(@categories) %>
</div>
<script type="text/javascript">
$(function(){
var $cat = $("select[name='<%= f.object_name %>[category_id]']");
$cat.closest("form").off("submit.category_check").on("submit.category_check", function(){
if(!$cat.val()){
alert("<%= j((I18n.locale.to_s == 'zh_tw') ? '沒有可選擇的類別。每個類別只能設定一筆,若尚未建立類別或所有類別都已設定,請先到「類別」頁面新增類別,或直接編輯既有的設定。' : 'No category available. Each category can only have one setting. If no category exists or all categories are already set, please add a new category on the Categories page first, or edit an existing setting.') %>");
return false;
}
});
});
</script>
<% end %>
<div class="control-group">
<%= f.label :content, t('ask.acknowledgements'), class: 'control-label' %>
<%= multiple_lang_tag_for_ask(nil,'text_area','content',@ask_acknowledgement.content,{:class=>'ckeditor',placeholder: t('ask.acknowledgements'),rows:10},nil,{'class' => 'controls','style'=>'display: flex;flex-direction: column-reverse;'})
%>
</div>
<div class="form-actions">
<%= f.submit t('submit'), class: 'btn btn-primary' %>
<%= f.button t('cancel'), type: 'button', class: 'btn', onclick: 'history.back();' %>
</div>