<% content_for :page_specific_css do %> <%= stylesheet_link_tag "lib/main-forms" %> <%= stylesheet_link_tag "lib/fileupload" %> <%= stylesheet_link_tag "lib/main-list" %> <% end %> <% content_for :page_specific_javascript do %> <%= javascript_include_tag "lib/bootstrap-fileupload" %> <%= javascript_include_tag "lib/bootstrap-datetimepicker" %> <%= javascript_include_tag "lib/datetimepicker/datetimepicker.js" %> <%= javascript_include_tag "lib/file-type" %> <%= javascript_include_tag "lib/module-area" %> <% end %>
<% if request.params["action"] == "edit" %> <%= f.select :unit_id, @unit.collect{|t| [ t.name, t.id ]} %> <%= f.select :department_id, @department.collect{|t| [ t.name, t.id ]} %> <% elsif request.params["action"]== "new" %> <%= select_tag "news_bulletin[unit_id]", options_from_collection_for_select(@unit, "id", "name"), :'data-remote' => 'true', :'url' => "/admin/news/getdata", :'prompt' => t("news_bulletin.ut_prompt"), :'data-type' => 'json' %> <%= select_tag "news_bulletin[department_id]" %> <% end %>
<%= select_category(f, @module_app) %>
<%= f.datetime_picker :postdate, :no_label => true, :new_record => @news_bulletin.new_record? %>
<%= f.datetime_picker :deadline, :no_label => true, :new_record => @news_bulletin.new_record? %>
<%# end %>
<% if @news_bulletin.image.file %> <%= image_tag @news_bulletin.image %> <% else %> <% end %>
<%= t(:select_image) %> <%= t(:change) %> <%= f.file_field :image %> <%= t(:cancel) %>


※此區塊圖片尺寸使用比例為2:1(圖片寬:高),寬度最低400px,亦即最小尺寸為400px*200px。
※<%= t("news.image_size_limit")%>
※上傳圖片格式僅支援.gif、.jpg、.png
※<%= t("news.image_note")%>
※欲知「如何裁剪新聞封面圖片」,請點選 <此處>
<% @site_in_use_locales.each do |locale| %> <%= f.fields_for :image_description_translations do |f| %>
<%= f.text_field locale, value: (@news_bulletin.image_description_translations[locale.to_s] rescue nil) %>
<% end %> <% end %>
<% @site_in_use_locales.each_with_index do |locale, i| %>
">
<%= f.fields_for :title_translations do |f| %> <%= f.text_field locale, class: "input-block-level", placeholder: t(:title), value: (@news_bulletin.title_translations[locale] rescue nil) %> <% end %>
<%= f.fields_for :subtitle_translations do |f| %> <%= f.text_area locale, rows: 2, class: "input-block-level", value: (@news_bulletin.subtitle_translations[locale] rescue nil) %> <% end %>
※建議使用IE10、IE11、Chrome(最佳)、Firefox等瀏覽器。
※內文裡單一圖片大小為1MB以下
※內文裡單一圖片尺寸的最大寬度600px(滿版),如圖片要縮小,請依比例調整。
※欲知「如何裁剪新聞圖片」,請點選 <此處>
<%= f.fields_for :text_translations do |f| %> <%= f.cktext_area locale, rows: 5, class: "input-block-level", :value => (@news_bulletin.text_translations[locale] rescue nil) %> <% end %>
<% end %>
<% if @news_bulletin && !@news_bulletin.news_bulletin_links.blank? %>
<% @news_bulletin.news_bulletin_links.each_with_index do |news_bulletin_link, i| %> <%= f.fields_for :news_bulletin_links, news_bulletin_link do |f| %> <%= render :partial => 'form_link', :object => news_bulletin_link, :locals => {:f => f, :i => i} %> <% end %> <% end %>
<% end %>

<%= hidden_field_tag 'news_bulletin_link_field_count', @news_bulletin.news_bulletin_links.count %> <%= t(:add) %>

<% if @news_bulletin && !@news_bulletin.news_bulletin_files.blank? %>
<% @news_bulletin.news_bulletin_files.each_with_index do |news_bulletin_file, i| %> <%= f.fields_for :news_bulletin_files, news_bulletin_file do |f| %> <%= render :partial => 'form_file', :object => news_bulletin_file, :locals => {:f => f, :i => i} %> <% end %> <% end %>
<% end %>

<%= hidden_field_tag 'news_bulletin_file_field_count', @news_bulletin.news_bulletin_files.count %> <%= t(:add) %>

<%= get_referer_url[:action] rescue "" %> <%= f.submit t('submit'), class: 'btn btn-primary' %> <%= button_tag t("preview"), id: "button_for_preview", name: "commit", class: 'btn', type: :button %> <%= link_to t('cancel'), admin_news_index_path, :class=>"btn" %>
<% content_for :page_specific_javascript do %> <% end %>