2014-05-01 08:41:00 +00:00
|
|
|
|
<% content_for :page_specific_css do %>
|
|
|
|
|
<%= stylesheet_link_tag "lib/main-forms" %>
|
|
|
|
|
<%= stylesheet_link_tag "lib/fileupload" %>
|
|
|
|
|
<%= stylesheet_link_tag "lib/main-list" %>
|
|
|
|
|
<% end %>
|
2021-09-25 11:26:13 +00:00
|
|
|
|
<style type="text/css">
|
|
|
|
|
.icons-list-2 {
|
|
|
|
|
cursor: all-scroll;
|
|
|
|
|
}
|
|
|
|
|
#show_anncs .modal-body {
|
|
|
|
|
background-color: #fff;
|
|
|
|
|
padding: 0;
|
|
|
|
|
max-height: none;
|
|
|
|
|
height: 100%;
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
}
|
|
|
|
|
#show_anncs iframe {
|
|
|
|
|
border: 0;
|
|
|
|
|
outline: none;
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: 100%;
|
|
|
|
|
}
|
|
|
|
|
#show_anncs .modal {
|
|
|
|
|
width: 90%;
|
|
|
|
|
margin-left: -45%;
|
|
|
|
|
}
|
|
|
|
|
</style>
|
2020-03-02 10:09:55 +00:00
|
|
|
|
<style type="text/css">
|
|
|
|
|
.reach_limit{
|
|
|
|
|
background: #a90c0c;
|
|
|
|
|
color: white;
|
|
|
|
|
padding: 4px 12px;
|
|
|
|
|
font-family: 'Varela Round';
|
|
|
|
|
letter-spacing: -.4px;
|
|
|
|
|
cursor: default;
|
|
|
|
|
display: inline-block;
|
|
|
|
|
}
|
2020-12-19 10:28:18 +00:00
|
|
|
|
.add-on.btn-group .dropdown-menu{
|
|
|
|
|
margin: 0;
|
|
|
|
|
}
|
|
|
|
|
.main-forms fieldset .input-area .controls .input-prepend a:hover{
|
|
|
|
|
color: #fff;
|
|
|
|
|
}
|
2021-09-25 11:26:13 +00:00
|
|
|
|
.image_group{
|
|
|
|
|
border: 0.2em solid #333;
|
|
|
|
|
padding-top: 0;
|
|
|
|
|
}
|
|
|
|
|
.image_group:last-child {
|
|
|
|
|
margin-bottom: 1em;
|
|
|
|
|
}
|
2020-03-02 10:09:55 +00:00
|
|
|
|
</style>
|
2014-05-01 08:41:00 +00:00
|
|
|
|
<% 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" %>
|
2020-02-11 13:12:54 +00:00
|
|
|
|
<%= javascript_include_tag "form" %>
|
2014-05-01 08:41:00 +00:00
|
|
|
|
<% end %>
|
2020-05-28 11:16:00 +00:00
|
|
|
|
<script type="text/javascript">
|
|
|
|
|
function trigger_on_add_calendar(ele){
|
|
|
|
|
if ($(ele).prop('checked')){
|
|
|
|
|
$('.trigger_on_add_calendar').show()
|
|
|
|
|
}else{
|
|
|
|
|
$('.trigger_on_add_calendar').hide()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
2014-05-01 08:41:00 +00:00
|
|
|
|
<!-- Input Area -->
|
|
|
|
|
<div class="input-area">
|
|
|
|
|
|
|
|
|
|
<!-- Module Tabs -->
|
|
|
|
|
<div class="nav-name"><strong><%= t(:module) %></strong></div>
|
|
|
|
|
<ul class="nav nav-pills module-nav">
|
|
|
|
|
<li class="active"><a href="#basic" data-toggle="tab"><%= t(:basic) %></a></li>
|
2020-05-28 11:16:00 +00:00
|
|
|
|
<% if defined? Calendar %>
|
|
|
|
|
<li><a href="#calendar" data-toggle="tab"><%= t('calendar.calendar') %></a></li>
|
|
|
|
|
<% end %>
|
2020-05-16 13:43:37 +00:00
|
|
|
|
<% if((!AnnouncementSetting.first.only_manager_can_edit_status) || (AnnouncementSetting.first.only_manager_can_edit_status && (@current_user.is_admin? || @current_user.is_manager?(@module_app))) ) %>
|
|
|
|
|
<li><a href="#status" data-toggle="tab"><%= t(:status) %></a></li>
|
|
|
|
|
<% end %>
|
2014-05-01 08:41:00 +00:00
|
|
|
|
<li><a href="#tag" data-toggle="tab"><%= t(:tags) %></a></li>
|
2020-02-11 13:12:54 +00:00
|
|
|
|
<li><a href="#imageupload" data-toggle="tab"><%= t('announcement.image') %></a></li>
|
2021-04-10 16:28:00 +00:00
|
|
|
|
<li><a href="#carousel_image_upload" data-toggle="tab" title="<%= t('announcement.carousel_image_title') %>"><%= t('announcement.carousel_image') %></a></li>
|
2021-09-25 11:26:13 +00:00
|
|
|
|
<li><a href="#relation_announcements_list" data-toggle="tab" title="<%= t('announcement.relation_announcements_list') %>"><%= t('announcement.relation_announcements_list') %></a></li>
|
2014-05-01 08:41:00 +00:00
|
|
|
|
<li><a href="#mail-group" data-toggle="tab"><%= t('announcement.email_reminder')%></a></li>
|
|
|
|
|
</ul>
|
|
|
|
|
<!-- Module -->
|
|
|
|
|
<div class="tab-content module-area">
|
|
|
|
|
|
|
|
|
|
<!-- Basic Module -->
|
|
|
|
|
<div class="tab-pane fade in active" id="basic">
|
2022-04-18 15:32:19 +00:00
|
|
|
|
<% if (AnnouncementSetting.first.enable_annc_dept rescue false) %>
|
|
|
|
|
<!-- Annc Dept -->
|
|
|
|
|
<div class="control-group">
|
|
|
|
|
<label class="control-label muted" for="annc_dept"><%= t("announcement.annc_dept") %></label>
|
|
|
|
|
<div class="controls">
|
|
|
|
|
<%= f.select("annc_dept", (options_for_select(AnnouncementSetting.first.annc_depts.to_a.map.with_index{|dept,i| [dept, i] },:selected => f.object.annc_dept) rescue []) , { include_blank: true, id: "annc_dept" }) %>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<% end %>
|
2014-05-01 08:41:00 +00:00
|
|
|
|
<!-- Category -->
|
|
|
|
|
<div class="control-group">
|
|
|
|
|
<label class="control-label muted"><%= t(:category) %></label>
|
|
|
|
|
<div class="controls">
|
2014-05-12 08:16:46 +00:00
|
|
|
|
<%= select_category(f, @module_app) %>
|
2014-05-01 08:41:00 +00:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<!-- Date Time Picker -->
|
|
|
|
|
<div class="control-group">
|
2014-05-13 07:06:23 +00:00
|
|
|
|
<label class="control-label muted"><%= t(:start_date) %></label>
|
2014-05-01 08:41:00 +00:00
|
|
|
|
<div class="controls">
|
2016-12-29 06:29:59 +00:00
|
|
|
|
<%= f.datetime_picker :postdate, :no_label => true, :new_record => @bulletin.new_record?, :data=>{"picker-type" => "range", "range" => "start"} %>
|
2014-05-01 08:41:00 +00:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="control-group">
|
2014-05-13 07:06:23 +00:00
|
|
|
|
<label class="control-label muted"><%= t(:end_date) %></label>
|
2014-05-01 08:41:00 +00:00
|
|
|
|
<div class="controls">
|
2016-12-29 06:29:59 +00:00
|
|
|
|
<%= f.datetime_picker :deadline, :no_label => true, :new_record => @bulletin.new_record?, :data=>{"picker-type" => "range", "range" => "end"} %>
|
2014-05-01 08:41:00 +00:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
2017-06-20 07:04:05 +00:00
|
|
|
|
<div class="control-group">
|
|
|
|
|
<%= f.label :is_external_link, t("announcement.is_external_link"), :class => "control-label muted" %>
|
|
|
|
|
<div class="controls">
|
|
|
|
|
<%= f.check_box :is_external_link %>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="control-group" style="display: none;" id="external_link_box">
|
|
|
|
|
<%= f.label :external_link, t("announcement.external_link"), :class => "control-label muted" %>
|
|
|
|
|
<div class="controls">
|
|
|
|
|
<%= f.text_field :external_link %>
|
|
|
|
|
<div class="hint"><%= t("announcement.external_link_hint") %></div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
2020-01-13 06:51:37 +00:00
|
|
|
|
<!-- display subtitle -->
|
|
|
|
|
<div class="control-group">
|
2020-01-13 09:14:53 +00:00
|
|
|
|
<%= f.label :display_subtitle, t("announcement.display_subtitle"), :class => "control-label muted" %>
|
2020-01-13 06:51:37 +00:00
|
|
|
|
<div class="controls">
|
|
|
|
|
<%= f.check_box :display_subtitle %>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<!-- display img src -->
|
|
|
|
|
<div class="control-group">
|
2020-01-13 09:14:53 +00:00
|
|
|
|
<%= f.label :display_img, t("announcement.display_img"), :class => "control-label muted" %>
|
2020-01-13 06:51:37 +00:00
|
|
|
|
<div class="controls">
|
|
|
|
|
<%= f.check_box :display_img %>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2021-05-21 07:48:40 +00:00
|
|
|
|
|
|
|
|
|
<!-- Image display setting -->
|
|
|
|
|
<% image_display_class_relation = {"full_width"=>"full-size-img","up_left_corner"=>"pull-left","up_right_corner"=>"pull-right"} %>
|
|
|
|
|
<div class="control-group <%='hide' if !f.object.display_img %>" id="image_display_setting">
|
|
|
|
|
<%= f.label :image_display_class, t("announcement.cover_image_display_setting"), :class => "control-label muted" %>
|
|
|
|
|
<div class="controls">
|
|
|
|
|
<% image_display_class_relation.each.with_index do |(key,value),i| %>
|
|
|
|
|
<label>
|
|
|
|
|
<%= radio_button_tag "#{f.object_name}[image_display_class]", value , (f.object.image_display_class == value) %>
|
|
|
|
|
<%= t("announcement.#{key}") %>
|
|
|
|
|
</label>
|
|
|
|
|
<% end %>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2014-05-01 08:41:00 +00:00
|
|
|
|
</div>
|
|
|
|
|
|
2020-05-28 11:16:00 +00:00
|
|
|
|
<!-- Calendar Module -->
|
|
|
|
|
<% if defined? Calendar %>
|
|
|
|
|
<div class="tab-pane fade" id="calendar">
|
|
|
|
|
<div class="control-group">
|
|
|
|
|
<label class="control-label muted"><%= t('announcement.add_to_calendar') %></label>
|
|
|
|
|
<div class="controls">
|
|
|
|
|
<%= f.check_box :add_to_calendar,onchange: 'trigger_on_add_calendar(this)' %>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="trigger_on_add_calendar" <%= "style=display:none;" if !@bulletin.add_to_calendar %>>
|
|
|
|
|
<div class="control-group">
|
|
|
|
|
<label class="control-label muted"><%= t('calendar.calendar') %></label>
|
|
|
|
|
<div class="controls">
|
|
|
|
|
<%= f.select :calendar_type_id, @calendar_categories.collect{|t| [ t.title, t.id ]} %>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="control-group" style="display: flex;flex-wrap: wrap;">
|
|
|
|
|
<div style="display: flex;flex-direction: column;">
|
|
|
|
|
<label class="control-label muted"><%= t(:start_date) %></label>
|
|
|
|
|
<label class="control-label muted"><%= t('announcement.blank_to_set') %></label>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="controls" style="margin-left: 1.5em;">
|
|
|
|
|
<%= f.datetime_picker :calendar_start_date, :new_record => @bulletin.new_record?, :no_label => true, :data=>{"picker-type" => "range", "range" => "start"} %>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="control-group" style="display: flex;flex-wrap: wrap;">
|
|
|
|
|
<div style="display: flex;flex-direction: column;">
|
|
|
|
|
<label class="control-label muted"><%= t(:end_date) %></label>
|
|
|
|
|
<label class="control-label muted"><%= t('announcement.blank_to_set') %></label>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="controls" style="margin-left: 1.5em;">
|
|
|
|
|
<%= f.datetime_picker :calendar_end_date, :new_record => @bulletin.new_record?, :no_label => true, :data=>{"picker-type" => "range", "range" => "end"} %>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="control-group">
|
|
|
|
|
<label class="control-label muted"><%= t('calendar.all_day') %></label>
|
|
|
|
|
<div class="controls">
|
|
|
|
|
<%= f.check_box :calendar_all_day %>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2020-08-12 13:28:57 +00:00
|
|
|
|
<div class="control-group">
|
|
|
|
|
<label class="control-label muted">Select Read More Page :</label>
|
|
|
|
|
<div class="controls">
|
|
|
|
|
<%= f.select :page_id,[["----- Select a page -----",nil]]+@module_pages %>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2020-05-28 11:16:00 +00:00
|
|
|
|
</div>
|
|
|
|
|
<%= f.hidden_field :event_id %>
|
|
|
|
|
</div>
|
|
|
|
|
<% end %>
|
2014-05-01 08:41:00 +00:00
|
|
|
|
<!-- Status Module -->
|
2020-05-16 13:43:37 +00:00
|
|
|
|
<% if((!AnnouncementSetting.first.only_manager_can_edit_status) || (AnnouncementSetting.first.only_manager_can_edit_status && (@current_user.is_admin? || @current_user.is_manager?(@module_app))) ) %>
|
2014-05-01 08:41:00 +00:00
|
|
|
|
<div class="tab-pane fade" id="status">
|
|
|
|
|
<!-- Status -->
|
|
|
|
|
<div class="control-group">
|
|
|
|
|
<label class="control-label muted"><%= t(:status) %></label>
|
|
|
|
|
<div class="controls" data-toggle="buttons-checkbox">
|
2020-03-02 10:09:55 +00:00
|
|
|
|
<% if !(@reach_limit.include?('is_top') && @bulletin.is_top != true) || current_user.is_admin? %>
|
|
|
|
|
<label class="checkbox inline btn <%= 'active' if @bulletin.is_top? || (!@bulletin.top_end_date.nil? && @bulletin.top_end_date > Time.now) %>">
|
|
|
|
|
<%= f.check_box :is_top %> <%= t(:top) %>
|
|
|
|
|
</label>
|
|
|
|
|
<% else %>
|
|
|
|
|
<label class="reach_limit">
|
|
|
|
|
<%= t(:top) %>
|
|
|
|
|
</label>
|
|
|
|
|
<% end %>
|
|
|
|
|
<% if !(@reach_limit.include?('is_hot') && @bulletin.is_hot != true) || current_user.is_admin? %>
|
|
|
|
|
<label class="checkbox inline btn <%= 'active' if @bulletin.is_hot? %>">
|
|
|
|
|
<%= f.check_box :is_hot %> <%= t(:hot) %>
|
|
|
|
|
</label>
|
|
|
|
|
<% else %>
|
|
|
|
|
<label class="reach_limit">
|
|
|
|
|
<%= t(:hot) %>
|
|
|
|
|
</label>
|
|
|
|
|
<% end %>
|
2014-05-01 08:41:00 +00:00
|
|
|
|
<label class="checkbox inline btn <%= 'active' if @bulletin.is_hidden? %>">
|
|
|
|
|
<%= f.check_box :is_hidden %> <%= t(:hide) %>
|
|
|
|
|
</label>
|
2015-12-22 11:04:13 +00:00
|
|
|
|
</div>
|
|
|
|
|
<div class="controls">
|
|
|
|
|
<% if !@bulletin.is_top? && !AnnouncementSetting.check_limit_for_user((@bulletin.new_record? ? current_user.id : @bulletin.create_user_id)) %>
|
|
|
|
|
<span>Top limit has been reached. The bulletin wont be marked as top even if you click on it.</span>
|
|
|
|
|
<% end %>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="control-group <%= @bulletin.is_top? || (!@bulletin.top_end_date.nil? && @bulletin.top_end_date > Time.now) ? "" : "hide" %>" data-for="is_top">
|
|
|
|
|
<label for="" class="control-label muted">Top end time</label>
|
|
|
|
|
<div class="controls">
|
|
|
|
|
<%= f.datetime_picker :top_end_date, :no_label => true, :new_record => @bulletin.new_record? %>
|
2014-05-01 08:41:00 +00:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2020-07-30 14:12:21 +00:00
|
|
|
|
<div class="control-group">
|
|
|
|
|
<label class="control-label muted"><%= t('announcement.open_comment')%></label>
|
|
|
|
|
<div class="controls">
|
|
|
|
|
<%= f.check_box :open_comment %><%= t('announcement.open') %>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="control-group <%= @bulletin.open_comment ? "" : "hide" %>" data-for="open_comment">
|
|
|
|
|
<label for="" class="control-label muted"><%= t('announcement.comment_end_time')%></label>
|
|
|
|
|
<div class="controls">
|
|
|
|
|
<%= f.datetime_picker :comment_end_time, :no_label => true, :new_record => @bulletin.new_record? %>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="control-group <%= @bulletin.open_comment ? "" : "hide" %>" data-for="open_comment">
|
|
|
|
|
<label for="" class="control-label muted"><%= t('announcement.comment_role')%></label>
|
|
|
|
|
<div class="controls">
|
|
|
|
|
<%= check_box_tag 'bulletin[comment_role][]','visitor',@bulletin.comment_role.include?('visitor') %>
|
|
|
|
|
<%= t('announcement.visitor') %>
|
|
|
|
|
<br>
|
|
|
|
|
<%= check_box_tag 'bulletin[comment_role][]','all_member',@bulletin.comment_role.include?('all_member'),class: 'role_all_member' %>
|
|
|
|
|
<%= t('announcement.all_member') %>
|
|
|
|
|
<br>
|
|
|
|
|
<% Role.all.each do |role| %>
|
|
|
|
|
<%= check_box_tag 'bulletin[comment_role][]',role.id.to_s,@bulletin.comment_role.include?(role.id.to_s),class: 'role' %>
|
|
|
|
|
<%= role.title %>
|
|
|
|
|
<% end %>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2014-05-01 08:41:00 +00:00
|
|
|
|
</div>
|
2020-05-16 13:43:37 +00:00
|
|
|
|
<% end %>
|
2014-05-01 08:41:00 +00:00
|
|
|
|
|
|
|
|
|
<!-- Tag Module -->
|
|
|
|
|
<div class="tab-pane fade" id="tag">
|
|
|
|
|
<div class="control-group">
|
|
|
|
|
<label class="control-label muted"><%= t(:tags) %></label>
|
2014-05-16 11:24:46 +00:00
|
|
|
|
<%= select_tags(f, @module_app) %>
|
2014-05-01 08:41:00 +00:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<!-- Images Module -->
|
|
|
|
|
<div class="tab-pane fade" id="imageupload">
|
|
|
|
|
|
|
|
|
|
<!-- Images Upload -->
|
|
|
|
|
<div class="control-group">
|
|
|
|
|
<label class="control-label muted"><%= t(:image) %></label>
|
|
|
|
|
<div class="controls">
|
|
|
|
|
<div class="fileupload fileupload-new clearfix <%= 'fileupload-edit' if @bulletin.image.file %>" data-provides="fileupload">
|
|
|
|
|
<div class="fileupload-new thumbnail pull-left">
|
|
|
|
|
<% if @bulletin.image.file %>
|
|
|
|
|
<%= image_tag @bulletin.image %>
|
|
|
|
|
<% else %>
|
2021-09-25 11:26:13 +00:00
|
|
|
|
<img src="/assets/bulletin/AAAAAA" />
|
2014-05-01 08:41:00 +00:00
|
|
|
|
<% end %>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="fileupload-preview fileupload-exists thumbnail pull-left"></div>
|
|
|
|
|
<span class="btn btn-file">
|
|
|
|
|
<span class="fileupload-new"><%= t(:select_image) %></span>
|
|
|
|
|
<span class="fileupload-exists"><%= t(:change) %></span>
|
|
|
|
|
<%= f.file_field :image %>
|
|
|
|
|
</span>
|
|
|
|
|
<a href="#" class="btn fileupload-exists" data-dismiss="fileupload"><%= t(:cancel) %></a>
|
|
|
|
|
<div class="controls" data-toggle="buttons-checkbox">
|
|
|
|
|
<label class="checkbox inline btn btn-danger fileupload-remove">
|
|
|
|
|
<%= f.check_box :remove_image %><%= t(:remove) %>
|
|
|
|
|
</label>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2014-10-14 06:28:51 +00:00
|
|
|
|
<% @site_in_use_locales.each do |locale| %>
|
|
|
|
|
<%= f.fields_for :image_description_translations do |f| %>
|
|
|
|
|
<div class="control-group">
|
|
|
|
|
<label class="control-label muted" for="image_description_<%= locale.to_s %>"><%= t(:description) + " (#{t(locale.to_s)})" %></label>
|
|
|
|
|
<div class="controls">
|
|
|
|
|
<%= f.text_field locale, value: (@bulletin.image_description_translations[locale.to_s] rescue nil) %>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<% end %>
|
|
|
|
|
<% end %>
|
2014-05-01 08:41:00 +00:00
|
|
|
|
|
|
|
|
|
</div>
|
2021-04-10 16:28:00 +00:00
|
|
|
|
<!-- Images Module -->
|
|
|
|
|
<div class="tab-pane fade" id="carousel_image_upload">
|
2021-09-25 11:26:13 +00:00
|
|
|
|
<div class="control-group">
|
|
|
|
|
<%= f.label :custom_carousel_image_type, t("announcement.default_carousel_image_type"), :class => "control-label muted" %>
|
|
|
|
|
<div class="controls">
|
|
|
|
|
<% carousel_image_types = ["default","carousel","album"] %>
|
|
|
|
|
<%= f.select :custom_carousel_image_type, options_for_select(carousel_image_types.map.with_index{|type,i| [t("announcement.carousel_image_types.#{type}"),i]}.to_h,:selected => f.object.custom_carousel_image_type) %>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2021-06-11 09:15:51 +00:00
|
|
|
|
<div class="control-group">
|
|
|
|
|
<label class="control-label muted" for="carousel_image_width"><%= t("announcement.carousel_image_width") %></label>
|
|
|
|
|
<div class="controls">
|
|
|
|
|
<%= f.text_field :custom_carousel_image_width, :placeholder => t("announcement.custom_carousel_image_width_hint") %>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2021-04-10 16:28:00 +00:00
|
|
|
|
<% if @bulletin && !@bulletin.bulletin_carousel_images.blank? %>
|
|
|
|
|
<div class="exist">
|
|
|
|
|
<% @bulletin.bulletin_carousel_images.each_with_index do |bulletin_carousel_image, i| %>
|
|
|
|
|
<%= f.fields_for :bulletin_carousel_images, bulletin_carousel_image do |f| %>
|
|
|
|
|
<%= render :partial => 'form_image', :object => bulletin_carousel_image, :locals => {:f => f, :i => i} %>
|
|
|
|
|
<% end %>
|
|
|
|
|
<% end %>
|
|
|
|
|
<hr>
|
|
|
|
|
</div>
|
|
|
|
|
<% end %>
|
|
|
|
|
<!-- Add -->
|
|
|
|
|
<div class="add-target">
|
|
|
|
|
</div>
|
|
|
|
|
<p class="add-btn controls">
|
|
|
|
|
<%= hidden_field_tag 'bulletin_carousel_image_count', @bulletin.bulletin_carousel_images.count %>
|
|
|
|
|
<a id="add_carousel_image" class="trigger btn btn-small btn-primary"><i class="icons-plus"></i> <%= t(:add) %></a>
|
|
|
|
|
</p>
|
2021-09-25 11:26:13 +00:00
|
|
|
|
</div>
|
|
|
|
|
<!-- relation_announcements_list -->
|
|
|
|
|
<div class="tab-pane fade" id="relation_announcements_list">
|
|
|
|
|
<!-- Enable relations-->
|
|
|
|
|
<div class="control-group">
|
|
|
|
|
<label class="control-label muted" for="enable_sub_annc"><%= t("announcement.enable") %></label>
|
|
|
|
|
<div class="controls">
|
|
|
|
|
<label class="checkbox inline">
|
|
|
|
|
<%= f.check_box :enable_sub_annc, {:id=>"enable_sub_annc"} %>
|
|
|
|
|
<%= t('announcement.enable')%>
|
|
|
|
|
</label>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div id="sub_annc_block" class="<%= 'hide' if !(f.object.enable_sub_annc) %>">
|
|
|
|
|
<div class="control-group">
|
|
|
|
|
<%= f.label :sub_annc_title_trans, t("announcement.sub_annc_title_trans"), :class => "control-label muted" %>
|
|
|
|
|
<div class="controls">
|
|
|
|
|
<div class="input-append">
|
|
|
|
|
<div class="tab-content">
|
|
|
|
|
<% @site_in_use_locales.each_with_index do |locale, i| %>
|
|
|
|
|
<div class="tab-pane fade <%= ( i == 0 ) ? "active in" : '' %>" id="sub_annc_title_trans_<%= locale %>">
|
|
|
|
|
<%= f.fields_for :custom_sub_annc_title_trans_translations,f.object do |f| %>
|
|
|
|
|
<%= f.text_field locale, :value => (f.object.custom_sub_annc_title_trans_translations[locale] rescue nil), :placeholder=>t("announcement.sub_annc_title_trans_hint"),:id=> ((i == 0) ? "sub_annc_title_trans_input" : "") %>
|
|
|
|
|
<% end %>
|
|
|
|
|
</div>
|
|
|
|
|
<% end %>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="btn-group" data-toggle="buttons-radio">
|
|
|
|
|
<% @site_in_use_locales.each_with_index do |locale, i| %>
|
|
|
|
|
<a class="btn <%= ( i == 0 ) ? "active" : '' %>" href="#sub_annc_title_trans_<%= locale %>" data-toggle="tab"><%= t(locale.to_s) %></a>
|
|
|
|
|
<% end %>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="control-group">
|
|
|
|
|
<label class="control-label muted"><%= t("announcement.display_sub_annc_date") %></label>
|
|
|
|
|
<div class="controls">
|
|
|
|
|
<%= f.check_box :display_sub_annc_date,:id=>"display_sub_annc_date" %>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="control-group">
|
|
|
|
|
<label class="control-label muted"><%= t("announcement.relation_announcements_list") %></label>
|
|
|
|
|
<div class="controls">
|
|
|
|
|
<table class="table table-bordered">
|
|
|
|
|
<thead>
|
|
|
|
|
<tr>
|
|
|
|
|
<th></th>
|
|
|
|
|
<th></th>
|
|
|
|
|
<th id="sub_annc_title_trans_text"><%=f.object.get_sub_annc_title_trans%></th>
|
|
|
|
|
<th id="annc_date_text" class="<%='hide' if !f.object.display_sub_annc_date %> annc_date"><%=t("announcement.table.date")%></th>
|
|
|
|
|
</tr>
|
|
|
|
|
</thead>
|
|
|
|
|
<tbody id="relation_announcements_list_target">
|
|
|
|
|
<% if f.object.sub_annc_list.count != 0 %>
|
|
|
|
|
<% f.object.get_sub_annc_list.each do |annc| %>
|
|
|
|
|
<tr>
|
|
|
|
|
<td><span class="brand"><i class="icons-list-2"></i></span></td>
|
|
|
|
|
<td><button class="remove_tr btn btn-danger" type="button">X</button><%= hidden_field_tag "#{f.object_name}[sub_annc_list][]", annc.id %></td>
|
|
|
|
|
<td><%=annc.title%></td>
|
|
|
|
|
<td class="<%='hide' if !f.object.display_sub_annc_date %> annc_date"><%=annc.display_postdate %></td>
|
|
|
|
|
</tr>
|
|
|
|
|
<% end %>
|
|
|
|
|
<% end %>
|
|
|
|
|
</tbody>
|
|
|
|
|
</table>
|
|
|
|
|
<div class="clearfix"></div>
|
|
|
|
|
<button id="add_sub_annc" class="btn btn-primary" type="button"><%= t(:add) %></button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2021-04-10 16:28:00 +00:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2014-05-01 08:41:00 +00:00
|
|
|
|
<!-- Mail Group Module -->
|
|
|
|
|
<div class="tab-pane fade" id="mail-group">
|
|
|
|
|
<!-- Mail Group -->
|
|
|
|
|
<div class="control-group">
|
2021-09-25 11:26:13 +00:00
|
|
|
|
<label class="control-label muted" for="remind-check"><%= t("announcement.email_to") %></label>
|
2014-05-01 08:41:00 +00:00
|
|
|
|
<div class="controls">
|
|
|
|
|
<label class="checkbox inline">
|
2021-09-25 11:26:13 +00:00
|
|
|
|
<%= f.check_box :email_sent, {:id=>'remind-check'} %>
|
|
|
|
|
<%= t('announcement.activate_email_reminder')%>
|
2014-05-01 08:41:00 +00:00
|
|
|
|
</label>
|
|
|
|
|
<div class="content-box">
|
2014-05-28 07:37:56 +00:00
|
|
|
|
<%= render partial: 'admin/member_selects/email_selection_box', locals: {field: 'bulletin[email_member_ids][]', email_members: @bulletin.email_members} %>
|
2014-05-01 08:41:00 +00:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="control-group">
|
|
|
|
|
<label class="control-label muted"></label>
|
|
|
|
|
<div class="controls">
|
|
|
|
|
<div class="content-box">
|
|
|
|
|
<span class="help-block"><%= "#{t("announcement.other_mailaddress")}(#{t("announcement.other_mailaddress_note")})"%> </span>
|
|
|
|
|
<%= f.text_area :other_mailaddress, :class=>"span12", :cols=>"25", :rows=>"10" %>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="content-box">
|
2021-09-25 11:26:13 +00:00
|
|
|
|
<div class="control-group">
|
|
|
|
|
<label class="control-label muted"><%= t("announcement.email_sentdate") %></label>
|
|
|
|
|
<div class="controls">
|
|
|
|
|
<%= f.datetime_picker :email_sentdate, :no_label => true %>
|
|
|
|
|
</div>
|
2014-05-01 08:41:00 +00:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2014-05-28 07:37:56 +00:00
|
|
|
|
<% if (@bulletin.email.is_sent rescue false) %>
|
|
|
|
|
<div class="content-box">
|
|
|
|
|
<div class="control-group">
|
|
|
|
|
<label class="control-label muted"><%= t("announcement.resend_mail") %></label>
|
|
|
|
|
<div class="controls">
|
|
|
|
|
<input type="checkbox" name="resend_mail" value="true">
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<% end %>
|
2014-05-01 08:41:00 +00:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<!-- Language Tabs -->
|
|
|
|
|
<div class="nav-name"><strong><%= t(:language) %></strong></div>
|
|
|
|
|
<ul class="nav nav-pills language-nav">
|
2014-05-16 09:02:54 +00:00
|
|
|
|
<% @site_in_use_locales.each_with_index do |locale, i| %>
|
2014-05-01 08:41:00 +00:00
|
|
|
|
<li class="<%= 'active' if i == 0 %>">
|
|
|
|
|
<a data-toggle="tab" href=".<%= locale %>"><%= t(locale) %></a>
|
|
|
|
|
</li>
|
|
|
|
|
<% end %>
|
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
<!-- Language -->
|
|
|
|
|
<div class="tab-content language-area">
|
|
|
|
|
|
2014-05-16 09:02:54 +00:00
|
|
|
|
<% @site_in_use_locales.each_with_index do |locale, i| %>
|
2014-05-01 08:41:00 +00:00
|
|
|
|
|
|
|
|
|
<div class="<%= locale %> tab-pane fade <%= ( i == 0 ) ? "in active" : '' %>">
|
|
|
|
|
|
|
|
|
|
<!-- Title-->
|
|
|
|
|
<div class="control-group input-title">
|
|
|
|
|
<label class="control-label muted"><%= t(:title) %></label>
|
|
|
|
|
<div class="controls">
|
|
|
|
|
<%= f.fields_for :title_translations do |f| %>
|
2020-02-11 13:12:54 +00:00
|
|
|
|
<%= f.text_area locale, class: "ckeditor_reduce input-block-level", placeholder: t(:title), value: (@bulletin.title_translations[locale] rescue nil) %>
|
2014-05-01 08:41:00 +00:00
|
|
|
|
<% end %>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<!-- Sub Title -->
|
|
|
|
|
<div class="control-group input-subtitle">
|
|
|
|
|
<label class="control-label muted"><%= t(:subtitle) %></label>
|
|
|
|
|
<div class="controls">
|
|
|
|
|
<div class="textarea">
|
|
|
|
|
<%= f.fields_for :subtitle_translations do |f| %>
|
2020-02-06 04:46:38 +00:00
|
|
|
|
<%= f.text_area locale, rows: 2, class: "ckeditor input-block-level", value: (@bulletin.subtitle_translations[locale] rescue nil) %>
|
2014-05-01 08:41:00 +00:00
|
|
|
|
<% end %>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<!-- Content -->
|
|
|
|
|
<div class="control-group input-content">
|
|
|
|
|
<label class="control-label muted"><%= t(:content) %></label>
|
|
|
|
|
<div class="controls">
|
|
|
|
|
<div class="textarea">
|
|
|
|
|
<%= f.fields_for :text_translations do |f| %>
|
|
|
|
|
<%= f.cktext_area locale, rows: 5, class: "input-block-level", :value => (@bulletin.text_translations[locale] rescue nil) %>
|
|
|
|
|
<% end %>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<% end %>
|
|
|
|
|
|
|
|
|
|
<!-- Link -->
|
|
|
|
|
<div class="control-group">
|
|
|
|
|
<label class="control-label muted"><%= t(:link) %></label>
|
|
|
|
|
<div class="controls add-input">
|
|
|
|
|
|
|
|
|
|
<!-- Exist -->
|
|
|
|
|
<% if @bulletin && !@bulletin.bulletin_links.blank? %>
|
|
|
|
|
<div class="exist">
|
|
|
|
|
<% @bulletin.bulletin_links.each_with_index do |bulletin_link, i| %>
|
|
|
|
|
<%= f.fields_for :bulletin_links, bulletin_link do |f| %>
|
|
|
|
|
<%= render :partial => 'form_link', :object => bulletin_link, :locals => {:f => f, :i => i} %>
|
|
|
|
|
<% end %>
|
|
|
|
|
<% end %>
|
|
|
|
|
<hr>
|
|
|
|
|
</div>
|
|
|
|
|
<% end %>
|
|
|
|
|
|
|
|
|
|
<!-- Add -->
|
|
|
|
|
<div class="add-target">
|
|
|
|
|
</div>
|
|
|
|
|
<p class="add-btn">
|
|
|
|
|
<%= hidden_field_tag 'bulletin_link_field_count', @bulletin.bulletin_links.count %>
|
|
|
|
|
<a id="add_link" class="trigger btn btn-small btn-primary"><i class="icons-plus"></i> <%= t(:add) %></a>
|
|
|
|
|
</p>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<!-- File -->
|
|
|
|
|
<div class="control-group">
|
|
|
|
|
<label class="control-label muted"><%= t(:file_) %></label>
|
|
|
|
|
<div class="controls">
|
2021-03-24 10:05:19 +00:00
|
|
|
|
<div id="file_description_hint"><%= t("announcement.file_description_hint") %></div>
|
2014-05-01 08:41:00 +00:00
|
|
|
|
<!-- Exist -->
|
|
|
|
|
<% if @bulletin && !@bulletin.bulletin_files.blank? %>
|
|
|
|
|
<div class="exist">
|
|
|
|
|
<% @bulletin.bulletin_files.each_with_index do |bulletin_file, i| %>
|
|
|
|
|
<%= f.fields_for :bulletin_files, bulletin_file do |f| %>
|
|
|
|
|
<%= render :partial => 'form_file', :object => bulletin_file, :locals => {:f => f, :i => i} %>
|
|
|
|
|
<% end %>
|
|
|
|
|
<% end %>
|
|
|
|
|
<hr>
|
|
|
|
|
</div>
|
|
|
|
|
<% end %>
|
|
|
|
|
|
|
|
|
|
<!-- Add -->
|
|
|
|
|
<div class="add-target">
|
|
|
|
|
</div>
|
|
|
|
|
<p class="add-btn">
|
|
|
|
|
<%= hidden_field_tag 'bulletin_file_field_count', @bulletin.bulletin_files.count %>
|
|
|
|
|
<a id="add_file" class="trigger btn btn-small btn-primary"><i class="icons-plus"></i> <%= t(:add) %></a>
|
|
|
|
|
</p>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<!-- Form Actions -->
|
|
|
|
|
<div class="form-actions">
|
2014-09-12 03:02:56 +00:00
|
|
|
|
<%= get_referer_url[:action] rescue "" %>
|
2014-05-01 08:41:00 +00:00
|
|
|
|
<%= f.submit t('submit'), class: 'btn btn-primary' %>
|
2014-09-12 03:02:56 +00:00
|
|
|
|
<input type="hidden" name="referer_url" value="<%= get_referer_url %>">
|
2014-06-17 10:46:52 +00:00
|
|
|
|
<%= button_tag t("preview"), id: "button_for_preview", name: "commit", class: 'btn', type: :button %>
|
2014-05-01 08:41:00 +00:00
|
|
|
|
<%= link_to t('cancel'), admin_announcements_path, :class=>"btn" %>
|
|
|
|
|
</div>
|
2021-09-25 11:26:13 +00:00
|
|
|
|
<span id='show_anncs'>
|
|
|
|
|
<div class="modal hide fade in banner-anncs" id="">
|
|
|
|
|
<div class="modal-header">
|
|
|
|
|
<a class="close" data-dismiss="modal">×</a>
|
|
|
|
|
<h3><%= t("announcement.select_relation_announcements") %></h3>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="modal-body">
|
|
|
|
|
<iframe id="anncs-iframe" src=""></iframe>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="modal-footer">
|
|
|
|
|
<a href="#" class="btn" data-dismiss="modal"><%= t("announcement.confirm") %></a>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</span>
|
2014-06-17 10:46:52 +00:00
|
|
|
|
<span id='show_preview'>
|
|
|
|
|
<div class="modal hide fade in banner-preview" id="">
|
|
|
|
|
<div class="modal-header">
|
|
|
|
|
<a class="close" data-dismiss="modal">×</a>
|
|
|
|
|
<h3><%= t(:preview) %></h3>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="modal-body">
|
2014-06-23 08:36:04 +00:00
|
|
|
|
<iframe id="preview-iframe" src=""></iframe>
|
2014-06-17 10:46:52 +00:00
|
|
|
|
</div>
|
|
|
|
|
<div class="modal-footer">
|
|
|
|
|
<a href="#" class="btn" data-dismiss="modal"><%= t(:close) %></a>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</span>
|
2016-09-06 09:47:52 +00:00
|
|
|
|
<% if !@module_app.tags.empty? %>
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
|
$("form.previewable").on("submit", function(){
|
|
|
|
|
if(!$("input[name='bulletin[tags][]']").is(":checked")){
|
|
|
|
|
if(!confirm("You have selected no tag, do you wish to continue?")){
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
</script>
|
|
|
|
|
<% end %>
|
2021-04-19 03:56:33 +00:00
|
|
|
|
<style type="text/css">
|
|
|
|
|
[aria-describedby] ul.dropdown-menu {
|
|
|
|
|
display: block;
|
|
|
|
|
}
|
|
|
|
|
[aria-describedby] .checkbox input{
|
|
|
|
|
margin-left: 0;
|
|
|
|
|
}
|
|
|
|
|
</style>
|
2020-12-19 10:28:18 +00:00
|
|
|
|
<script>
|
2021-09-25 11:26:13 +00:00
|
|
|
|
var display_sub_annc_date = <%=f.object.display_sub_annc_date%>;
|
|
|
|
|
function calc_relation_table_width(){
|
|
|
|
|
window.relation_announcements_list_width = [];
|
|
|
|
|
$( "#relation_announcements_list_target" ).siblings('thead').find("th").each(function(j,th){
|
|
|
|
|
window.relation_announcements_list_width.push($(th).outerWidth(true));
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
$(window).resize(function(){
|
|
|
|
|
calc_relation_table_width();
|
|
|
|
|
})
|
|
|
|
|
$("#display_sub_annc_date").click(function(){
|
|
|
|
|
display_sub_annc_date = !display_sub_annc_date;
|
|
|
|
|
if(display_sub_annc_date){
|
|
|
|
|
$(".annc_date").removeClass("hide");
|
|
|
|
|
}else{
|
|
|
|
|
$(".annc_date").addClass("hide");
|
|
|
|
|
}
|
|
|
|
|
calc_relation_table_width();
|
|
|
|
|
})
|
|
|
|
|
$('a[href="#relation_announcements_list"]').on('shown.bs.tab',calc_relation_table_width);
|
|
|
|
|
function sub_anncs_sort(){
|
|
|
|
|
calc_relation_table_width();
|
|
|
|
|
$( "#relation_announcements_list_target" ).sortable({
|
|
|
|
|
revert: true,
|
|
|
|
|
axis: "y",
|
|
|
|
|
handle: ".brand",
|
|
|
|
|
start: function(event, ui){
|
|
|
|
|
var item = ui.item;
|
|
|
|
|
var target = $(event.target);
|
|
|
|
|
item.css("width",target.width());
|
|
|
|
|
item.find("td").each(function(i,td){
|
|
|
|
|
$(td).width(window.relation_announcements_list_width[i]);
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
stop: function(event, ui) {
|
|
|
|
|
var item = ui.item;
|
|
|
|
|
item.css("width","");
|
|
|
|
|
item.find("td").css("width","");
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
2021-05-21 07:48:40 +00:00
|
|
|
|
$("#bulletin_display_img").click(function(){$("#image_display_setting").toggleClass("hide")})
|
2020-12-19 10:28:18 +00:00
|
|
|
|
function Appendzero(obj)
|
|
|
|
|
{
|
|
|
|
|
if(obj<10) return "0" +""+ obj;
|
|
|
|
|
else return obj;
|
|
|
|
|
}
|
2020-12-22 05:24:03 +00:00
|
|
|
|
function add_click_for_privacy()
|
|
|
|
|
{
|
2021-04-19 03:56:33 +00:00
|
|
|
|
$('.add-on.btn-group').off('show.bs.tooltip').on('show.bs.tooltip',function(){$(this).find('ul').toggleClass('show')});
|
2020-12-22 05:24:03 +00:00
|
|
|
|
$(".privacy-changer-btn").off('click')
|
|
|
|
|
$(".privacy-changer-btn").click(function(){
|
|
|
|
|
var val = $(this).attr('for')
|
|
|
|
|
var parent_node = $(this).parents('.add-on.btn-group').eq(0)
|
|
|
|
|
parent_node.find('.privacy_type').val(val)
|
|
|
|
|
parent_node.find('i').eq(0).attr('class',$(this).find('i').attr('class'))
|
|
|
|
|
parent_node.find('.dropdown-menu').hide()
|
|
|
|
|
window.setTimeout(function(){
|
|
|
|
|
parent_node.find('.dropdown-menu').css('display','')
|
|
|
|
|
},1000)
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
}
|
2020-12-19 10:28:18 +00:00
|
|
|
|
$(function() {
|
2021-09-25 11:26:13 +00:00
|
|
|
|
sub_anncs_sort();
|
|
|
|
|
$("#add_sub_annc").click(function(){
|
|
|
|
|
var all_sub_anncs = $("#relation_announcements_list_target input[name='<%=f.object_name%>[sub_annc_list][]']").map(function(){return $(this).val()}).toArray();
|
|
|
|
|
window.tmp_sub_anncs = {};
|
|
|
|
|
$("#anncs-iframe").attr("src","<%=admin_announcement_get_all_anncs_without_subannc_path%>?" + $.param({"subannc_ids": all_sub_anncs}));
|
|
|
|
|
$('#show_anncs .modal').modal();
|
|
|
|
|
$('#show_anncs .modal').height(function() {
|
|
|
|
|
return $(window).height() * 0.7;
|
|
|
|
|
});
|
|
|
|
|
$('#show_anncs .modal').on('hidden.bs.modal', function () {
|
|
|
|
|
Object.keys(window.tmp_sub_anncs).forEach(function(annc_id){
|
|
|
|
|
var annc_data = window.tmp_sub_anncs[annc_id];
|
|
|
|
|
var annc_row = "<tr><td><span class=\"brand\"><i class=\"icons-list-2\"></i></span></td><td><button class=\"remove_tr btn btn-danger\" type=\"button\">X</button><input type=\"hidden\" name=\"<%=f.object_name%>[sub_annc_list][]\" value=\""+annc_id+"\"></td><td>"+annc_data.title+"</td><td class=\""+(display_sub_annc_date ? '' : 'hide')+" annc_date\">"+annc_data.date+"</td></tr>"
|
|
|
|
|
$("#relation_announcements_list_target").append(annc_row);
|
|
|
|
|
})
|
|
|
|
|
window.tmp_sub_anncs = {};
|
|
|
|
|
sub_anncs_sort();
|
|
|
|
|
});
|
|
|
|
|
})
|
|
|
|
|
$(document).on("click",".remove_tr",function(){
|
|
|
|
|
if(window.confirm("<%=t('announcement.are_you_sure_you_want_to_delete_relation')%>"))
|
|
|
|
|
$(this).parents("tr").eq(0).remove();
|
|
|
|
|
})
|
2020-12-19 10:28:18 +00:00
|
|
|
|
$('#bulletin_open_comment').change(function(){
|
|
|
|
|
$(this).prop('checked') ? $('div[data-for="open_comment"]').removeClass('hide') : $('div[data-for="open_comment"]').addClass('hide')
|
|
|
|
|
})
|
|
|
|
|
$('.role_all_member').change(function(){
|
|
|
|
|
if ($(this).prop('checked')){
|
|
|
|
|
$('.role').each(function() {
|
|
|
|
|
$(this).prop("checked", true);
|
|
|
|
|
})
|
|
|
|
|
} else{
|
|
|
|
|
$('.role').each(function() {
|
|
|
|
|
$(this).prop("checked", false);
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
$('.role').change(function(){
|
|
|
|
|
if (!$(this).prop('checked') && $('.role_all_member').prop('checked')){
|
|
|
|
|
$('.role_all_member').prop('checked',false)
|
2015-03-16 08:56:53 +00:00
|
|
|
|
}
|
2020-12-19 10:28:18 +00:00
|
|
|
|
})
|
|
|
|
|
if (location.pathname.substr(-3)=='new'){
|
|
|
|
|
var getDate = new Date();
|
|
|
|
|
var toDay = getDate.getFullYear()+"/"+ (Appendzero(getDate.getMonth()+1))+"/"+Appendzero(getDate.getDate())+" "+Appendzero(getDate.getHours())+":"+Appendzero(getDate.getMinutes());
|
|
|
|
|
$('input[name="bulletin[postdate]"]').val(toDay);
|
|
|
|
|
}
|
2015-03-16 08:56:53 +00:00
|
|
|
|
|
2020-12-19 10:28:18 +00:00
|
|
|
|
$("#main-wrap").after("");
|
|
|
|
|
|
|
|
|
|
$(document).on('click', '#add_link', function(){
|
|
|
|
|
var new_id = $(this).prev().attr('value');
|
|
|
|
|
var old_id = new RegExp("new_bulletin_links", "g");
|
|
|
|
|
var on = $('.language-nav li.active').index();
|
|
|
|
|
var le = $(this).parent('.add-btn').prev('.add-target').children('.start-line').length;
|
|
|
|
|
$(this).prev().attr('value', parseInt(new_id) + 1);
|
|
|
|
|
$(this).parent().siblings('.add-target').append(("<%= escape_javascript(add_attribute 'form_link', f, :bulletin_links) %>").replace(old_id, new_id));
|
|
|
|
|
$(this).parent('.add-btn').prev('.add-target').children('.start-line').eq(le).children('.tab-content').children('.tab-pane').eq(on).addClass('in active').siblings().removeClass('in active');
|
|
|
|
|
formTip();
|
|
|
|
|
});
|
|
|
|
|
$(document).on('click', '#add_file', function(){
|
|
|
|
|
var new_id = $(this).prev().attr('value');
|
|
|
|
|
var old_id = new RegExp("new_bulletin_files", "g");
|
|
|
|
|
var on = $('.language-nav li.active').index();
|
|
|
|
|
var le = $(this).parent('.add-btn').prev('.add-target').children('.start-line').length;
|
|
|
|
|
$(this).prev().attr('value', parseInt(new_id) + 1);
|
|
|
|
|
$(this).parent().siblings('.add-target').append(("<%= escape_javascript(add_attribute 'form_file', f, :bulletin_files) %>").replace(old_id, new_id));
|
|
|
|
|
$(this).parent('.add-btn').prev('.add-target').children('.start-line').eq(le).children('.input-append').find('.tab-content').each(function() {
|
|
|
|
|
$(this).children('.tab-pane').eq(on).addClass('in active').siblings().removeClass('in active');
|
2014-05-01 08:41:00 +00:00
|
|
|
|
});
|
2020-12-19 10:28:18 +00:00
|
|
|
|
formTip();
|
2020-12-22 05:24:03 +00:00
|
|
|
|
add_click_for_privacy();
|
2020-12-19 10:28:18 +00:00
|
|
|
|
});
|
2021-04-10 16:28:00 +00:00
|
|
|
|
$(document).on('click', '#add_carousel_image', function(){
|
|
|
|
|
var new_id = $(this).prev().attr('value');
|
|
|
|
|
var old_id = new RegExp("new_bulletin_carousel_images", "g");
|
|
|
|
|
var on = $('.language-nav li.active').index();
|
|
|
|
|
var le = $(this).parent('.add-btn').prev('.add-target').children('.start-line').length;
|
|
|
|
|
$(this).prev().attr('value', parseInt(new_id) + 1);
|
|
|
|
|
$(this).parent().siblings('.add-target').append(("<%= escape_javascript(add_attribute 'form_image', f, :bulletin_carousel_images) %>").replace(old_id, new_id));
|
|
|
|
|
$(this).parent('.add-btn').prev('.add-target').children('.start-line').eq(le).children('.input-append').find('.tab-content').each(function() {
|
|
|
|
|
$(this).children('.tab-pane').eq(on).addClass('in active').siblings().removeClass('in active');
|
|
|
|
|
});
|
|
|
|
|
});
|
2021-09-25 11:26:13 +00:00
|
|
|
|
$(document).on('click', '.image-form-remove', function(){
|
|
|
|
|
if($(this).find(".remove_existing_record").length != 0){
|
|
|
|
|
if(confirm("<%= I18n.t(:sure?)%>")){
|
|
|
|
|
$(this).find('.should_destroy').attr('value', 1);
|
|
|
|
|
$(this).parents('.image_group').hide();
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
$(this).parents('.image_group').remove();
|
|
|
|
|
}
|
|
|
|
|
});
|
2021-04-10 16:28:00 +00:00
|
|
|
|
$(document).on('click', '.fileupload-remove', function(){
|
|
|
|
|
if($(this).find(".delete_image").length != 0){
|
|
|
|
|
$(this).parents('.image_group').remove();
|
|
|
|
|
}
|
|
|
|
|
});
|
2020-12-19 10:28:18 +00:00
|
|
|
|
$(document).on('click', '.delete_link', function(){
|
|
|
|
|
$(this).parents('.input-prepend').remove();
|
|
|
|
|
});
|
|
|
|
|
$(document).on('click', '.delete_file', function(){
|
|
|
|
|
$(this).parents('.input-prepend').remove();
|
|
|
|
|
});
|
|
|
|
|
$(document).on('click', '.remove_existing_record', function(){
|
|
|
|
|
if(confirm("<%= I18n.t(:sure?)%>")){
|
|
|
|
|
$(this).children('.should_destroy').attr('value', 1);
|
|
|
|
|
$(this).parents('.start-line').hide();
|
|
|
|
|
}
|
|
|
|
|
});
|
2021-09-25 11:26:13 +00:00
|
|
|
|
$("#enable_sub_annc").click(function(){
|
|
|
|
|
$("#sub_annc_block").toggleClass("hide");
|
|
|
|
|
calc_relation_table_width();
|
|
|
|
|
})
|
2020-12-19 10:28:18 +00:00
|
|
|
|
$('#remind-check').prop('checked') ? '':$('.content-box').addClass('hide')
|
|
|
|
|
$('#remind-check').on('change', function() {
|
|
|
|
|
$(this).prop('checked') ? $('.content-box').removeClass('hide'):$('.content-box').addClass('hide')
|
|
|
|
|
})
|
2021-09-13 09:43:41 +00:00
|
|
|
|
try{
|
|
|
|
|
if( self != top ){
|
|
|
|
|
$('#button_for_preview,#show_preview').remove();
|
|
|
|
|
}
|
|
|
|
|
}catch(e){}
|
2020-12-19 10:28:18 +00:00
|
|
|
|
$('#button_for_preview').click(function(){
|
|
|
|
|
var method = $('.main-forms input[name="_method"]').val();
|
|
|
|
|
$('.main-forms input[name="_method"]').val("post");
|
|
|
|
|
|
|
|
|
|
for ( instance in CKEDITOR.instances )
|
|
|
|
|
CKEDITOR.instances[instance].updateElement();
|
|
|
|
|
|
|
|
|
|
var formData = new FormData( $('.main-forms')[0] );
|
|
|
|
|
formData.append("preview_type", ( (method==undefined) ? "new" : "edit" ));
|
|
|
|
|
formData.append("bulletin_id", '<%= @bulletin.id.to_s %>');
|
|
|
|
|
|
|
|
|
|
$.ajax({
|
|
|
|
|
type: "post",
|
|
|
|
|
url: '<%= admin_announcement_preview_path %>',
|
|
|
|
|
data : formData,
|
|
|
|
|
processData: false,
|
|
|
|
|
contentType: false
|
|
|
|
|
}).done(function(data){
|
|
|
|
|
if(window.location.protocol === "https:"){
|
|
|
|
|
data = data.replace("http:","https:");
|
|
|
|
|
}
|
2021-09-13 09:43:41 +00:00
|
|
|
|
window.preview_annc_uid = data.split("-").slice(-1)[0].split("?")[0];
|
2020-12-19 10:28:18 +00:00
|
|
|
|
$('.modal-body iframe').attr('src',data);
|
|
|
|
|
$('#show_preview .modal').modal();
|
|
|
|
|
$('#show_preview .modal').height(function() {
|
|
|
|
|
return $(window).height() * 0.7;
|
2014-06-17 10:46:52 +00:00
|
|
|
|
});
|
2021-09-13 09:43:41 +00:00
|
|
|
|
$('#show_preview .modal').on('hidden.bs.modal', function () {
|
|
|
|
|
$.ajax({
|
|
|
|
|
type: "post",
|
|
|
|
|
url: '<%= admin_announcement_get_preview_action_path %>',
|
|
|
|
|
data: {uid: window.preview_annc_uid}
|
|
|
|
|
}).done(function(data){
|
|
|
|
|
if(data["action"] == "redirect"){
|
|
|
|
|
window.location.href = data["path"];
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
});
|
2020-12-19 10:28:18 +00:00
|
|
|
|
|
|
|
|
|
var slug = data.split('/')[(data.split('/').length-1)];
|
|
|
|
|
// $('#preview-iframe').on('load', function(){
|
|
|
|
|
// $.get('/admin/announcement/destroy_preview/'+slug,function(data){
|
|
|
|
|
// });
|
|
|
|
|
// });
|
2014-06-17 10:46:52 +00:00
|
|
|
|
});
|
2020-12-19 10:28:18 +00:00
|
|
|
|
$('.main-forms input[name="_method"]').val(method);
|
|
|
|
|
return false;
|
|
|
|
|
});
|
2014-06-17 10:46:52 +00:00
|
|
|
|
|
2020-12-19 10:28:18 +00:00
|
|
|
|
$("#bulletin_is_top").parent().on("click",function(){
|
|
|
|
|
setTimeout(function(){
|
|
|
|
|
if($("#bulletin_is_top").parent().hasClass("active")){
|
|
|
|
|
$("div[data-for=is_top]").removeClass("hide");
|
2017-06-20 07:04:05 +00:00
|
|
|
|
}else{
|
2020-12-19 10:28:18 +00:00
|
|
|
|
$("div[data-for=is_top]").addClass("hide");
|
|
|
|
|
$("div[data-for=is_top]").find("input[type=text]").val("");
|
2017-06-20 07:04:05 +00:00
|
|
|
|
}
|
2020-12-19 10:28:18 +00:00
|
|
|
|
},100)
|
|
|
|
|
})
|
2017-06-20 07:04:05 +00:00
|
|
|
|
|
2021-08-06 08:29:39 +00:00
|
|
|
|
$("#bulletin_is_external_link").on("change",function(){
|
2020-12-19 10:28:18 +00:00
|
|
|
|
if($(this).is(":checked")){
|
|
|
|
|
$("#external_link_box").show();
|
|
|
|
|
}else{
|
|
|
|
|
$("#external_link_box").hide();
|
|
|
|
|
}
|
2021-08-06 08:26:36 +00:00
|
|
|
|
});
|
2021-09-25 11:26:13 +00:00
|
|
|
|
$("#sub_annc_title_trans_input").on("input",function(){
|
|
|
|
|
$("#sub_annc_title_trans_text").html($(this).val());
|
|
|
|
|
})
|
2021-08-06 08:29:39 +00:00
|
|
|
|
$("#bulletin_is_external_link").trigger('change');
|
2022-11-18 12:44:47 +00:00
|
|
|
|
$('#<%=f.object_name.gsub(/[\[\]]/,'_')%>_external_link').on('paste', function(e){
|
|
|
|
|
var pastedData = e.originalEvent.clipboardData.getData('text');
|
|
|
|
|
var _this = $(this);
|
|
|
|
|
pastedData = pastedData.replace(new RegExp('^http(s|)://' + window.location.host), '');
|
|
|
|
|
window.setTimeout(function(){
|
|
|
|
|
_this.val(pastedData);
|
|
|
|
|
}, 0);
|
|
|
|
|
});
|
2020-12-22 05:24:03 +00:00
|
|
|
|
add_click_for_privacy()
|
2020-12-19 10:28:18 +00:00
|
|
|
|
});
|
|
|
|
|
</script>
|