<% 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 %>
<%= f.datetime_picker :deadline, :no_label => true %>
<%# end %>
<% if @news_bulletin.image.file %> <%= image_tag @news_bulletin.image %> <% else %> <% end %>
<%= t(:select_image) %> <%= t(:change) %> <%= f.file_field :image %> <%= t(:cancel) %>


※<%= t("ad.widget_info_for_ad_image_size", :best_size=> "290px x 150px") %>
※<%= t("news.image_size_limit")%>
※<%= t("news.image_note")%>
※如何裁剪新聞刊頭圖片
<% @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 %>
※內文裡單一圖片大小為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 %>