2014-05-08 07:33:39 +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/modal-preview" %>
|
|
|
|
<%= javascript_include_tag "lib/file-type" %>
|
|
|
|
<% end %>
|
|
|
|
<%#= f.error_messages %>
|
|
|
|
<fieldset>
|
|
|
|
<!-- 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>
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
<!-- Module -->
|
|
|
|
<div class="tab-content module-area">
|
|
|
|
|
|
|
|
<!-- Basic Module -->
|
|
|
|
<div class="tab-pane fade in active" id="basic">
|
|
|
|
|
|
|
|
<!-- Category -->
|
|
|
|
<div class="control-group">
|
|
|
|
<%= f.label :category ,t(:category), :class=>"control-label muted" %>
|
|
|
|
<div class="controls">
|
2014-05-13 07:30:44 +00:00
|
|
|
<%= select_category(f, @module_app) %>
|
2014-05-08 07:33:39 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<!-- Status Module -->
|
|
|
|
<div class="tab-pane fade" id="status">
|
|
|
|
|
|
|
|
<!-- Status -->
|
|
|
|
<div class="control-group">
|
|
|
|
<label class="control-label muted">Status</label>
|
|
|
|
<div class="controls" data-toggle="buttons-checkbox">
|
|
|
|
<label class="checkbox inline btn <%= 'active' if @qa.is_top? %>">
|
|
|
|
<%= f.check_box :is_top, :value => @qa.is_top %> <%= t(:top) %>
|
|
|
|
</label>
|
|
|
|
<label class="checkbox inline btn <%= 'active' if @qa.is_hot? %>">
|
|
|
|
<%= f.check_box :is_hot, :value => @qa.is_hot %> <%= t(:hot) %>
|
|
|
|
</label>
|
|
|
|
<label class="checkbox inline btn <%= 'active' if @qa.is_hidden? %>">
|
|
|
|
<%= f.check_box :is_hidden, :value => @qa.is_hidden %> <%= t(:hide) %>
|
|
|
|
</label>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<!-- Tag Module -->
|
|
|
|
<div class="tab-pane fade" id="tag">
|
|
|
|
|
|
|
|
<!-- Tag -->
|
|
|
|
<div class="control-group">
|
|
|
|
<label class="control-label muted">Tag</label>
|
2014-05-13 07:30:44 +00:00
|
|
|
<%= select_tag(f, @module_app) %>
|
2014-05-08 07:33:39 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<!-- Language Tabs -->
|
|
|
|
<div class="nav-name"><strong>Language</strong></div>
|
|
|
|
<ul class="nav nav-pills language-nav">
|
2014-05-16 09:22:13 +00:00
|
|
|
<% @site_in_use_locales.each_with_index do |locale, i| %>
|
2014-05-08 07:33:39 +00:00
|
|
|
<li <%= ( i == 0 ) ? "class=active" : '' %>><a data-toggle="tab" href=".<%= locale %>"><%= t(locale.to_s) %></a></li>
|
|
|
|
<% end %>
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
<!-- Language -->
|
|
|
|
<div class="tab-content language-area">
|
2014-05-16 09:22:13 +00:00
|
|
|
<% @site_in_use_locales.each_with_index do |locale, i| %>
|
2014-05-08 07:33:39 +00:00
|
|
|
<div class="<%= locale %> fade tab-pane <%= ( i == 0 ) ? "in active" : '' %>">
|
|
|
|
<div class="control-group input-title">
|
|
|
|
<%= f.label :title , t('faq.question'), :class=>"control-label muted" %>
|
|
|
|
<div class="controls">
|
|
|
|
<%= f.fields_for :title_translations do |f| %>
|
|
|
|
<%= f.text_field locale, :class=>'post-title', :value => (@qa.title_translations[locale] rescue nil) %>
|
|
|
|
<% end %>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="control-group input-content">
|
|
|
|
<%= f.label :answer ,t('faq.answer'), :class => "control-label muted" %>
|
|
|
|
<%= f.fields_for :answer_translations do |f| %>
|
|
|
|
<div class="controls">
|
|
|
|
<div class="textarea">
|
|
|
|
<%= f.text_area locale, :style=>"width:100%", :class => 'ckeditor input-block-level', :value => (@qa.answer_translations[locale] rescue nil) %>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<% end %>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<% end %>
|
|
|
|
<!-- Link -->
|
|
|
|
<div class="control-group">
|
2014-05-13 07:30:44 +00:00
|
|
|
<label class="control-label muted"><%= t(:link) %></label>
|
2014-05-08 07:33:39 +00:00
|
|
|
<div class="controls add-input">
|
|
|
|
|
|
|
|
<!-- Exist -->
|
|
|
|
<% if @qa && !@qa.qa_links.blank? %>
|
|
|
|
<div class="exist">
|
|
|
|
<% @qa.qa_links.each_with_index do |qa_link, i| %>
|
|
|
|
<%= f.fields_for :qa_links, qa_link do |f| %>
|
|
|
|
<%= render :partial => 'form_qa_link', :object => qa_link, :locals => {:f => f, :i => i} %>
|
|
|
|
<% end %>
|
|
|
|
<% end %>
|
|
|
|
<hr>
|
|
|
|
</div>
|
|
|
|
<% end %>
|
|
|
|
|
|
|
|
<!-- Add -->
|
|
|
|
<div class="add-target"></div>
|
|
|
|
<p class="add-btn">
|
|
|
|
<%= hidden_field_tag 'qa_link_field_count', @qa.qa_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">
|
2014-05-13 07:30:44 +00:00
|
|
|
<label class="control-label muted"><%= t(:file_) %></label>
|
2014-05-08 07:33:39 +00:00
|
|
|
<div class="controls">
|
|
|
|
|
|
|
|
<!-- Exist -->
|
|
|
|
<% if @qa && !@qa.qa_files.blank? %>
|
|
|
|
<div class="exist">
|
|
|
|
<% @qa.qa_files.each_with_index do |qa_file, i| %>
|
|
|
|
<%= f.fields_for :qa_files, qa_file do |f| %>
|
|
|
|
<%= render :partial => 'form_qa_file', :object => qa_file, :locals => {:f => f, :i => i} %>
|
|
|
|
<% end %>
|
|
|
|
<% end %>
|
|
|
|
<hr>
|
|
|
|
</div>
|
|
|
|
<% end %>
|
|
|
|
|
|
|
|
<!-- Add -->
|
|
|
|
<div class="add-target">
|
|
|
|
</div>
|
|
|
|
<p class="add-btn">
|
|
|
|
<%= hidden_field_tag 'qa_file_field_count', @qa.qa_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">
|
|
|
|
<%= f.submit t('submit'), class: 'btn btn-primary' %>
|
|
|
|
<%#= button_tag t("preview"), id: "button_for_preview", name: "commit", class: 'btn post_preview', type: :button, url: preview_panel_announcement_back_end_bulletins_path %>
|
|
|
|
<%#= link_to t('cancel'), get_go_back, :class=>"btn" %>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</fieldset>
|
|
|
|
<% content_for :page_specific_javascript do %>
|
|
|
|
<script>
|
|
|
|
$(function() {
|
|
|
|
$(document).on('click', '#add_link', function(){
|
|
|
|
var new_id = $(this).prev().attr('value');
|
|
|
|
var old_id = new RegExp("new_qa_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_qa_link', f, :qa_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_qa_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_qa_file', f, :qa_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();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
$("#status").on('click',"*[data-toggle=buttons-checkbox] input",function(){
|
|
|
|
var d = $(this).parent().find("input[type=hidden]");
|
|
|
|
if($(this).is(":checked")){
|
|
|
|
d.val("1");
|
|
|
|
}else{
|
|
|
|
d.val("0");
|
|
|
|
}
|
|
|
|
|
|
|
|
})
|
|
|
|
$("#status *[data-toggle=buttons-checkbox] .checkbox").each(function(){
|
|
|
|
if($(this).hasClass("active")){
|
|
|
|
$(this).find("input[type=hidden]").val("1");
|
|
|
|
}
|
|
|
|
})
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
<% end %>
|
|
|
|
|