<%= stylesheet_link_tag "select2/select2" %> <%= javascript_include_tag 'validator' %> <%= javascript_include_tag "select2/select2.min" %> <% content_for :page_specific_css do %> <%= stylesheet_link_tag "lib/main-forms" %> <% end %> <% sub_managers = @module_app.sub_managers sub_managers.delete(nil) all_statuses = [[t('top'),'is_top'],[t('hot'),'is_hot']] tp1 = select_tag("announcement_setting[anns_status_settings][-1][status]",options_for_select(all_statuses)) tp2 = select_tag("announcement_setting[anns_status_settings][-1][role_id]",options_for_select(Role.all.map{|r| [r.title,r.id]})) tp3 = number_field_tag("announcement_setting[anns_status_settings][-1][top_limit]",nil, min: 0,required: true) tp4 = "" all_tp = "
#{tp1}
#{tp2}
#{tp3}
#{tp4}
" %>
<%= t("announcement.click_on_submit") %>
<%= form_for @setting, url: (@setting.new_record? ? admin_announcement_createsettings_path : admin_announcement_updatesettings_path), html: {class: "form-horizontal main-forms"} do |f| %>
<%= f.label :carousel_image_width, t("announcement.default_carousel_image_width"), :class => "control-label muted" %>
<%= f.text_field :carousel_image_width %>
<%= f.label :only_manager_can_edit_status, t("announcement.only_manager_can_edit_status"), :class => "control-label muted" %>
<%= f.check_box :only_manager_can_edit_status %>
<%= f.label :is_display_edit_only, t("announcement.is_display_edit_only"), :class => "control-label muted" %>
<%= f.check_box :is_display_edit_only %>
<%= f.label :top_limit, t("announcement.top_limit"), :class => "control-label muted" %>
<%= f.number_field :top_limit, :min => "0" %> <%= t("announcement.for_unlimited") %>
<%= t('status') %>
<%= t('role') %>
<%= t('announcement.top_limit') %>
<% (AnnouncementSetting.first.anns_status_settings rescue []).each_with_index do |v,i| %>
<%= hidden_field_tag("announcement_setting[anns_status_settings][#{i}][_id]",v.id) %>
<%= select_tag("announcement_setting[anns_status_settings][#{i}][status]",options_for_select(all_statuses,:selected => v['status'])) %>
<%= select_tag("announcement_setting[anns_status_settings][#{i}][role_id]",options_for_select(Role.all.map{|r| [r.title,r.id]},:selected => v['role_id'])) %>
<%= number_field_tag("announcement_setting[anns_status_settings][#{i}][top_limit]",v['top_limit'], min: 0,required: true) %>
<% end %>
<% if AnnouncementSetting.is_pro? %> <% if !sub_managers.blank? %>
<%= f.label "Approver Setting", :class => "control-label muted" %>
<%= t("announcement.approvers_list") %> <%= @setting.approvers.count %>
<% else %>
<%= t("announcement.click_set_sub_manager") %>
<% end %>
<%= f.label "Send emails to", :class => "control-label muted" %>
> <%= t("admin") %> > <%= t("manager") %> > <%= t("announcement.approver") %>
<% sub_managers.each do |sm| %> <% if @setting.approvers.include?(sm.id.to_s) %> <% end %> <% end %>
<% end %>
<%= f.submit t('submit'), class: 'btn btn-primary' %>
<% end %> <% if AnnouncementSetting.is_pro? %> <% end %> <%= fields_for :iframe do |f| %>
<%=t('announcement.announcement_setting_for_iframe')%>
<%= f.label :layout_type, t("announcement.layout_type"), :class => "control-label muted" %>
<% @layout_types = get_layouts(@module_app.key) %> <% if @layout_types.first.kind_of?(Hash) %> <% else %> <%= f.select(:layout, @layout_types) %> <% end %>
<%= f.label :tags, t(:tags), :class => "control-label muted" %>
<% @module_app.tags.each_with_index do |t,index| %> <% end %>
<% @module_app.categories.each_with_index do |c,index| %> <% end %>
<%= f.label :authors, t('announcement.table.author'), :class => "control-label muted" %>
<%= render partial: 'admin/members/generate_modal_select' , locals: { :@sorted_members => @sorted_members ,:member_form_id => "card-list-members",:member_field_name=>"iframe[member_ids][]" } %>
<%= f.label :show_page, t('announcement.show_page'), :class => "control-label muted" %>
<%=f.check_box :show_page ,{:checked=>'checked'},'true','false'%>
<%= f.label :data_count, t(:data_count), :class => "control-label muted" %>
<%=f.number_field :data_count, {min: 0,:value=> 10} %>
<% end %>