<% 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" %> <%= javascript_include_tag "form" %> <% end %>
<%= select_category(f, @module_app) %>
<%= f.datetime_picker :postdate, :no_label => true, :new_record => @custom_bulletin.new_record?, :data=>{"picker-type" => "range", "range" => "start"} %>
<%= f.datetime_picker :deadline, :no_label => true, :new_record => @custom_bulletin.new_record?, :data=>{"picker-type" => "range", "range" => "end"} %>
<%= f.label :is_external_link, t("custom_announcement.is_external_link"), :class => "control-label muted" %>
<%= f.check_box :is_external_link %>
<%= f.label :display_subtitle, t("custom_announcement.display_subtitle"), :class => "control-label muted" %>
<%= f.check_box :display_subtitle %>
<%= f.label :display_img, t("custom_announcement.display_img"), :class => "control-label muted" %>
<%= f.check_box :display_img %>
<% image_display_class_relation = {"full_width"=>"full-size-img","up_left_corner"=>"pull-left","up_right_corner"=>"pull-right"} %>
<%= f.label :image_display_class, t("custom_announcement.cover_image_display_setting"), :class => "control-label muted" %>
<% image_display_class_relation.each.with_index do |(key,value),i| %> <% end %>
<% if defined? Calendar %>
<%= f.check_box :add_to_calendar,onchange: 'trigger_on_add_calendar(this)' %>
>
<%= f.select :calendar_type_id, @calendar_categories.collect{|t| [ t.title, t.id ]} %>
<%= f.datetime_picker :calendar_start_date, :new_record => @custom_bulletin.new_record?, :no_label => true, :data=>{"picker-type" => "range", "range" => "start"} %>
<%= f.datetime_picker :calendar_end_date, :new_record => @custom_bulletin.new_record?, :no_label => true, :data=>{"picker-type" => "range", "range" => "end"} %>
<%= f.check_box :calendar_all_day %>
<%= f.select :page_id,[["----- Select a page -----",nil]]+@module_pages %>
<%= f.hidden_field :event_id %>
<% end %> <% if((!CustomAnnouncementSetting.first.only_manager_can_edit_status) || (CustomAnnouncementSetting.first.only_manager_can_edit_status && (@current_user.is_admin? || @current_user.is_manager?(@module_app))) ) %>
<% if !(@reach_limit.include?('is_top') && @custom_bulletin.is_top != true) || current_user.is_admin? %> <% else %> <% end %> <% if !(@reach_limit.include?('is_hot') && @custom_bulletin.is_hot != true) || current_user.is_admin? %> <% else %> <% end %>
<% if !@custom_bulletin.is_top? && !CustomAnnouncementSetting.check_limit_for_user((@custom_bulletin.new_record? ? current_user.id : @custom_bulletin.create_user_id)) %> Top limit has been reached. The custom_bulletin wont be marked as top even if you click on it. <% end %>
" data-for="is_top">
<%= f.datetime_picker :top_end_date, :no_label => true, :new_record => @custom_bulletin.new_record? %>
<%= f.check_box :open_comment %><%= t('custom_announcement.open') %>
" data-for="open_comment">
<%= f.datetime_picker :comment_end_time, :no_label => true, :new_record => @custom_bulletin.new_record? %>
" data-for="open_comment">
<%= check_box_tag 'custom_bulletin[comment_role][]','visitor',@custom_bulletin.comment_role.include?('visitor') %> <%= t('custom_announcement.visitor') %>
<%= check_box_tag 'custom_bulletin[comment_role][]','all_member',@custom_bulletin.comment_role.include?('all_member'),class: 'role_all_member' %> <%= t('custom_announcement.all_member') %>
<% Role.all.each do |role| %> <%= check_box_tag 'custom_bulletin[comment_role][]',role.id.to_s,@custom_bulletin.comment_role.include?(role.id.to_s),class: 'role' %> <%= role.title %> <% end %>
<% end %>
<%= select_tags(f, @module_app) %>
<% if @custom_bulletin.image.file %> <%= image_tag @custom_bulletin.image %> <% else %> <% end %>
<%= t(:select_image) %> <%= t(:change) %> <%= f.file_field :image %> <%= t(:cancel) %>
<% @site_in_use_locales.each do |locale| %> <%= f.fields_for :image_description_translations do |f| %>
<%= f.text_field locale, value: (@custom_bulletin.image_description_translations[locale.to_s] rescue nil) %>
<% end %> <% end %>
<%= render partial: 'admin/member_selects/email_selection_box', locals: {field: 'custom_bulletin[email_member_ids][]', email_members: @custom_bulletin.email_members} %>
<%= "#{t("custom_announcement.other_mailaddress")}(#{t("custom_announcement.other_mailaddress_note")})"%> <%= f.text_area :other_mailaddress, :class=>"span12", :cols=>"25", :rows=>"10" %>
<%= f.datetime_picker :email_sentdate, :no_label => true %>
<% if (@custom_bulletin.email.is_sent rescue false) %>
<% end %>
<% @site_in_use_locales.each_with_index do |locale, i| %>
">
<%= f.fields_for :title_translations do |f| %> <%= f.text_area locale, class: "ckeditor_reduce input-block-level", placeholder: t(:title), value: (@custom_bulletin.title_translations[locale] rescue nil) %> <% end %>
<%= f.fields_for :subtitle_translations do |f| %> <%= f.text_area locale, rows: 2, class: "ckeditor input-block-level", value: (@custom_bulletin.subtitle_translations[locale] rescue nil) %> <% end %>
<%= f.fields_for :text_translations do |f| %> <%= f.cktext_area locale, rows: 5, class: "input-block-level", :value => (@custom_bulletin.text_translations[locale] rescue nil) %> <% end %>
<% end %>
<% if @custom_bulletin && !@custom_bulletin.custom_bulletin_links.blank? %>
<% @custom_bulletin.custom_bulletin_links.each_with_index do |custom_bulletin_link, i| %> <%= f.fields_for :custom_bulletin_links, custom_bulletin_link do |f| %> <%= render :partial => 'form_link', :object => custom_bulletin_link, :locals => {:f => f, :i => i} %> <% end %> <% end %>
<% end %>

<%= hidden_field_tag 'custom_bulletin_link_field_count', @custom_bulletin.custom_bulletin_links.count %> <%= t(:add) %>

<%= t("custom_announcement.file_description_hint") %>
<% if @custom_bulletin && !@custom_bulletin.custom_bulletin_files.blank? %>
<% @custom_bulletin.custom_bulletin_files.each_with_index do |custom_bulletin_file, i| %> <%= f.fields_for :custom_bulletin_files, custom_bulletin_file do |f| %> <%= render :partial => 'form_file', :object => custom_bulletin_file, :locals => {:f => f, :i => i} %> <% end %> <% end %>
<% end %>

<%= hidden_field_tag 'custom_bulletin_file_field_count', @custom_bulletin.custom_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_custom_announcements_path + (params[:custom_module].blank? ? '' : "/#{params[:custom_module]}#{(params[:bind_uid].blank? ? '' : ('-'+params[:bind_uid]))}"), :class=>"btn" %> <% if params[:custom_module].present? %> <%= f.hidden_field :custom_module, :value=> params[:custom_module] %> <% if params[:bind_uid].present? %> <%= f.hidden_field :bind_uid, :value=> params[:bind_uid] %> <% end %> <% end %>
<% if !@module_app.tags.empty? %> <% end %>