2014-05-14 11:52:06 +00:00
|
|
|
<% # encoding: utf-8 %>
|
|
|
|
<% content_for :page_specific_css do %>
|
|
|
|
<%= stylesheet_link_tag "lib/main-forms" %>
|
|
|
|
<%= stylesheet_link_tag "lib/fileupload" %>
|
|
|
|
<%= stylesheet_link_tag "lib/main-list" %>
|
2016-02-16 10:10:52 +00:00
|
|
|
<style type="text/css">
|
|
|
|
.sort-order-icon{
|
|
|
|
font-size: 25px;
|
|
|
|
cursor: move;
|
|
|
|
}
|
|
|
|
</style>
|
2014-05-14 11:52:06 +00:00
|
|
|
<% end %>
|
|
|
|
<% content_for :page_specific_javascript do %>
|
|
|
|
<%= javascript_include_tag "lib/bootstrap-fileupload" %>
|
|
|
|
<%= javascript_include_tag "lib/file-type" %>
|
|
|
|
<%= javascript_include_tag "lib/module-area" %>
|
2016-02-16 10:10:52 +00:00
|
|
|
<%= javascript_include_tag "lib/jquery-ui-sortable.min" %>
|
2014-05-14 11:52:06 +00:00
|
|
|
<% end %>
|
|
|
|
|
|
|
|
<%#= f.error_messages %>
|
|
|
|
|
|
|
|
<!-- 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></li>
|
|
|
|
<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">
|
|
|
|
<label class="control-label muted"><%= t(:category) %></label>
|
|
|
|
<div class="controls">
|
2014-05-16 08:26:43 +00:00
|
|
|
<%= select_category(f, @module_app) %>
|
2014-05-14 11:52:06 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<!-- Sort -->
|
|
|
|
<div class="control-group">
|
|
|
|
<label class="control-label muted"><%= t(:sort_number) %></label>
|
|
|
|
<div class="controls">
|
|
|
|
<%= f.text_field :sort_number %>
|
|
|
|
</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">
|
|
|
|
<label class="checkbox inline btn <%= 'active' if @archive_file.is_top? %>">
|
|
|
|
<%= f.check_box :is_top %> <%= t(:top) %>
|
|
|
|
</label>
|
|
|
|
<label class="checkbox inline btn <%= 'active' if @archive_file.is_hot? %>">
|
|
|
|
<%= f.check_box :is_hot %> <%= t(:hot) %>
|
|
|
|
</label>
|
|
|
|
<label class="checkbox inline btn <%= 'active' if @archive_file.is_hidden? %>">
|
|
|
|
<%= f.check_box :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"><%= t(:tags) %></label>
|
2014-05-16 11:25:19 +00:00
|
|
|
<%= select_tags(f, @module_app) %>
|
2014-05-14 11:52:06 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<!-- Language Tabs -->
|
|
|
|
<div class="nav-name"><strong><%= t(:language) %></strong></div>
|
|
|
|
<ul class="nav nav-pills language-nav">
|
2014-05-16 09:24:44 +00:00
|
|
|
<% @site_in_use_locales.each_with_index do |locale, i| %>
|
2014-05-14 11:52:06 +00:00
|
|
|
<li class="<%= 'active' if i == 0 %>">
|
|
|
|
<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:24:44 +00:00
|
|
|
<% @site_in_use_locales.each_with_index do |locale, i| %>
|
2014-05-14 11:52:06 +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: (@archive_file.title_translations[locale] rescue nil) %>
|
|
|
|
<% end %>
|
|
|
|
</div>
|
|
|
|
</div>
|
2018-01-25 09:24:39 +00:00
|
|
|
<!-- url -->
|
|
|
|
<div class="control-group input-title">
|
|
|
|
<label class="control-label muted"><%= t(:url) %></label>
|
|
|
|
<div class="controls">
|
|
|
|
<%= f.fields_for :url_translations do |f| %>
|
|
|
|
<%= f.text_field locale, class: "input-block-level", placeholder: t(:url), value: (@archive_file.url_translations[locale] rescue nil) %>
|
|
|
|
<% end %>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2014-05-14 11:52:06 +00:00
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<% end %>
|
|
|
|
|
|
|
|
<!-- File -->
|
|
|
|
<div class="control-group">
|
|
|
|
<label class="control-label muted"><%= t(:file_) %></label>
|
|
|
|
<div class="controls">
|
2016-02-16 10:10:52 +00:00
|
|
|
<p class="add-btn">
|
|
|
|
<%= hidden_field_tag 'archive_file_multiple_field_count', @archive_file.archive_file_multiples.count %>
|
|
|
|
<a id="add_file" class="trigger btn btn-small btn-primary"><i class="icons-plus"></i> <%= t(:add) %></a>
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="control-group">
|
|
|
|
<div class="controls">
|
|
|
|
<!-- Add -->
|
|
|
|
<div class="add-target" id="add-target"></div>
|
2014-05-14 11:52:06 +00:00
|
|
|
<!-- Exist -->
|
|
|
|
<% if @archive_file && !@archive_file.archive_file_multiples.blank? %>
|
2016-02-16 10:10:52 +00:00
|
|
|
<div class="exist plugin-sortable">
|
|
|
|
<% @archive_file.archive_file_multiples.desc(:sort_number).each_with_index do |archive_file_multiple, i| %>
|
2014-05-14 11:52:06 +00:00
|
|
|
<%= f.fields_for :archive_file_multiples, archive_file_multiple do |f| %>
|
|
|
|
<%= render :partial => 'form_file', :object => archive_file_multiple, :locals => {:f => f, :i => i} %>
|
|
|
|
<% end %>
|
|
|
|
<% end %>
|
|
|
|
<hr>
|
|
|
|
</div>
|
|
|
|
<% end %>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<!-- Form Actions -->
|
|
|
|
<div class="form-actions">
|
|
|
|
<%= hidden_field_tag 'page', params[:page] if !params[:page].blank? %>
|
|
|
|
<%= f.submit t('submit'), class: 'btn btn-primary' %>
|
2018-01-19 09:06:23 +00:00
|
|
|
<a href="<%= admin_archive_files_path %>" class="btn"><%= t("archive.back_to_archives") %></a>
|
2014-05-14 11:52:06 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<% content_for :page_specific_javascript do %>
|
|
|
|
<script>
|
|
|
|
$(document).ready(function() {
|
2016-02-16 10:10:52 +00:00
|
|
|
$(".plugin-sortable").sortable({
|
|
|
|
update : function(event, ui){
|
|
|
|
var existingfiles = $(".exist.plugin-sortable div.fileupload")
|
|
|
|
existingfiles.each(function(i, file){
|
|
|
|
$(file).find("input.file-sort-number-field").val(existingfiles.length - i);
|
|
|
|
})
|
|
|
|
}
|
|
|
|
});
|
2014-05-14 11:52:06 +00:00
|
|
|
$('.main-forms .add-on').tooltip();
|
|
|
|
$(document).on('click', '#add_file', function(){
|
|
|
|
var new_id = $(this).prev().attr('value');
|
|
|
|
var old_id = new RegExp("new_archive_file_multiples", "g");
|
|
|
|
var on = $('.language-nav li.active').index();
|
2016-02-16 10:10:52 +00:00
|
|
|
var le = $('#add-target').children('.start-line').length;
|
2014-05-14 11:52:06 +00:00
|
|
|
$(this).prev().attr('value', parseInt(new_id) + 1);
|
2016-02-16 10:10:52 +00:00
|
|
|
$('#add-target').prepend(("<%= escape_javascript(add_attribute 'form_file', f, :archive_file_multiples) %>").replace(old_id, new_id).replace("new_archive_file_sort_order_XXX", parseInt(new_id) + 1));
|
|
|
|
$('#add-target').children('.start-line').eq(le).children('.input-append').find('.tab-content').each(function() {
|
2014-05-14 11:52:06 +00:00
|
|
|
$(this).children('.tab-pane').eq(on).addClass('in active').siblings().removeClass('in active');
|
|
|
|
});
|
|
|
|
formTip();
|
|
|
|
});
|
|
|
|
$(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();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
<% end %>
|