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 %>
|
|
|
|
|
<% 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 %>
|
|
|
|
|
|
|
|
|
|
<!-- 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>
|
|
|
|
|
<li><a href="#status" data-toggle="tab"><%= t(:status) %></a></li>
|
|
|
|
|
<li><a href="#tag" data-toggle="tab"><%= t(:tags) %></a></li>
|
|
|
|
|
<li><a href="#imageupload" data-toggle="tab"><%= t(:image) %></a></li>
|
|
|
|
|
<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">
|
|
|
|
|
|
|
|
|
|
<!-- 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">
|
2015-03-05 11:48:38 +00:00
|
|
|
|
<%= f.datetime_picker :postdate, :no_label => true, :new_record => @bulletin.new_record? %>
|
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">
|
2015-03-05 11:48:38 +00:00
|
|
|
|
<%= f.datetime_picker :deadline, :no_label => true, :new_record => @bulletin.new_record? %>
|
2014-05-01 08:41:00 +00:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<!-- Status Module -->
|
|
|
|
|
<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">
|
2015-12-22 11:04:13 +00:00
|
|
|
|
<label class="checkbox inline btn <%= 'active' if @bulletin.is_top? || (!@bulletin.top_end_date.nil? && @bulletin.top_end_date > Time.now) %>">
|
2014-05-01 08:41:00 +00:00
|
|
|
|
<%= f.check_box :is_top %> <%= t(:top) %>
|
|
|
|
|
</label>
|
|
|
|
|
<label class="checkbox inline btn <%= 'active' if @bulletin.is_hot? %>">
|
|
|
|
|
<%= f.check_box :is_hot %> <%= t(:hot) %>
|
|
|
|
|
</label>
|
|
|
|
|
<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>
|
2015-12-22 11:04:13 +00:00
|
|
|
|
|
2014-05-01 08:41:00 +00:00
|
|
|
|
</div>
|
|
|
|
|
<%# end %>
|
|
|
|
|
|
|
|
|
|
<!-- 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 %>
|
|
|
|
|
<img src="http://www.placehold.it/50x50/EFEFEF/AAAAAA" />
|
|
|
|
|
<% 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>
|
|
|
|
|
|
2014-10-14 06:28:51 +00:00
|
|
|
|
|
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">
|
|
|
|
|
<label class="control-label muted"><%= t("announcement.email_to") %></label>
|
|
|
|
|
<div class="controls">
|
|
|
|
|
|
|
|
|
|
<label class="checkbox inline">
|
|
|
|
|
<%= check_box_tag('bulletin[email_sent]', '1', (!@bulletin.email_sent.blank? ? true : false), :id=>'remind-check') %><%= t('announcement.activate_email_reminder')%>
|
|
|
|
|
</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">
|
|
|
|
|
<div class="control-group">
|
|
|
|
|
<label class="control-label muted"><%= t("announcement.email_sentdate") %></label>
|
|
|
|
|
<div class="controls">
|
2014-05-28 07:37:56 +00:00
|
|
|
|
<%= f.datetime_picker :email_sentdate, :no_label => true %>
|
2014-05-01 08:41:00 +00:00
|
|
|
|
</div>
|
|
|
|
|
</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| %>
|
|
|
|
|
<%= f.text_field locale, class: "input-block-level", placeholder: t(:title), value: (@bulletin.title_translations[locale] rescue nil) %>
|
|
|
|
|
<% 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| %>
|
|
|
|
|
<%= f.text_area locale, rows: 2, class: "input-block-level", value: (@bulletin.subtitle_translations[locale] rescue nil) %>
|
|
|
|
|
<% 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">
|
|
|
|
|
|
|
|
|
|
<!-- 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>
|
|
|
|
|
|
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>
|
|
|
|
|
|
2014-05-01 08:41:00 +00:00
|
|
|
|
<% content_for :page_specific_javascript do %>
|
|
|
|
|
<script>
|
2015-03-16 08:56:53 +00:00
|
|
|
|
function Appendzero(obj)
|
|
|
|
|
{
|
|
|
|
|
if(obj<10) return "0" +""+ obj;
|
|
|
|
|
else return obj;
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-01 08:41:00 +00:00
|
|
|
|
$(function() {
|
2015-03-16 08:56:53 +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);
|
|
|
|
|
}
|
|
|
|
|
|
2014-06-17 10:46:52 +00:00
|
|
|
|
$("#main-wrap").after("");
|
|
|
|
|
|
2014-05-01 08:41:00 +00:00
|
|
|
|
$(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');
|
|
|
|
|
});
|
|
|
|
|
formTip();
|
|
|
|
|
});
|
|
|
|
|
$(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();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$('#remind-check').prop('checked') ? '':$('.content-box').addClass('hide')
|
|
|
|
|
$('#remind-check').on('change', function() {
|
|
|
|
|
$(this).prop('checked') ? $('.content-box').removeClass('hide'):$('.content-box').addClass('hide')
|
|
|
|
|
})
|
|
|
|
|
|
2014-06-17 10:46:52 +00:00
|
|
|
|
$('#button_for_preview').click(function(){
|
|
|
|
|
var method = $('.main-forms input[name="_method"]').val();
|
|
|
|
|
$('.main-forms input[name="_method"]').val("post");
|
2014-06-23 08:36:04 +00:00
|
|
|
|
|
2014-06-17 10:46:52 +00:00
|
|
|
|
for ( instance in CKEDITOR.instances )
|
|
|
|
|
CKEDITOR.instances[instance].updateElement();
|
2014-06-23 08:36:04 +00:00
|
|
|
|
|
|
|
|
|
var formData = new FormData( $('.main-forms')[0] );
|
|
|
|
|
formData.append("preview_type", ( (method==undefined) ? "new" : "edit" ));
|
|
|
|
|
formData.append("bulletin_id", '<%= @bulletin.id.to_s %>');
|
|
|
|
|
|
2014-06-17 10:46:52 +00:00
|
|
|
|
$.ajax({
|
|
|
|
|
type: "post",
|
|
|
|
|
url: '<%= admin_announcement_preview_path %>',
|
2014-06-23 08:36:04 +00:00
|
|
|
|
data : formData,
|
|
|
|
|
processData: false,
|
|
|
|
|
contentType: false
|
2014-06-17 10:46:52 +00:00
|
|
|
|
}).done(function(data){
|
|
|
|
|
$('.modal-body iframe').attr('src',data);
|
|
|
|
|
$('#show_preview .modal').modal();
|
|
|
|
|
$('#show_preview .modal').height(function() {
|
|
|
|
|
return $(window).height() * 0.7;
|
|
|
|
|
});
|
2014-06-23 08:36:04 +00:00
|
|
|
|
|
|
|
|
|
var slug = data.split('/')[(data.split('/').length-1)];
|
2015-03-05 11:48:38 +00:00
|
|
|
|
// $('#preview-iframe').on('load', function(){
|
|
|
|
|
// $.get('/admin/announcement/destroy_preview/'+slug,function(data){
|
|
|
|
|
// });
|
|
|
|
|
// });
|
2014-06-17 10:46:52 +00:00
|
|
|
|
});
|
|
|
|
|
$('.main-forms input[name="_method"]').val(method);
|
|
|
|
|
return false;
|
|
|
|
|
});
|
|
|
|
|
|
2015-12-22 11:04:13 +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");
|
|
|
|
|
}else{
|
|
|
|
|
$("div[data-for=is_top]").addClass("hide");
|
|
|
|
|
$("div[data-for=is_top]").find("input[type=text]").val("");
|
|
|
|
|
}
|
|
|
|
|
},100)
|
|
|
|
|
})
|
|
|
|
|
|
2014-05-01 08:41:00 +00:00
|
|
|
|
});
|
|
|
|
|
</script>
|
|
|
|
|
<% end %>
|