curation/app/views/admin/curations/_form_section_post.html.erb

118 lines
5.4 KiB
Plaintext
Executable File

<style type="text/css">
.main-forms fieldset .input-area .controls .input-prepend .tab-content > .active {
display: block!important;
}
.curation_section{
display: flex !important;
flex-wrap: wrap;
}
.main-forms .input-append .tab-content{
width:100%;
}
.tab-pane{
.input-large{
margin-bottom:1em!important;
}
}
.add-on{
margin-bottom:1em!important;
}
.select2-container-multi .select2-choices{
min-width: 200px;
display: table-caption;
}
.input-append, .input-prepend{
font-size: 1em!important;
}
</style>
<div class="input-prepend input-append start-line curation_section">
<span class="tab-content">
<span class="add-on"><%= t("curation.title") %></span>
<% @site_in_use_locales.each_with_index do |locale, i| %>
<span class="tab-pane fade <%= ( i == 0 ) ? "in active" : '' %> <%= locale %>">
<%= f.fields_for :title_translations do |f| %>
<%= f.text_field locale, :class => "input-large", placeholder: t("curation.title"), :value => (form_section_post.title_translations[locale] rescue nil) %>
<% end %>
</span>
<% end %>
</span>
<span class="tab-content section_type">
<span class="add-on"><%= t("curation.section_type") %></span>
<%= f.select :section_type, CurationPostSection::SECTION_TYPES.map { |type| [t("curation.#{type}"), type] },
{ include_blank: t("curation.please_select"), selected: form_section_post.section_type },
class: 'form-control' %>
</span>
<span class="tab-content section_type_text" style="<%= !form_section_post.new_record? && form_section_post.section_type == 'text' ? '' : 'display:none' %>">
<span class="add-on"><%= t("curation.text") %></span>
<% @site_in_use_locales.each_with_index do |locale, i| %>
<span class="tab-pane fade <%= ( i == 0 ) ? "in active" : '' %> <%= locale %>">
<%= f.fields_for :text_translations do |f| %>
<%= f.text_area locale, :rows => 2, :class => "ckeditor input-block-level", :placeholder => t("curation.text"), :value => (form_section_post.text_translations[locale] rescue nil) %>
<% end %>
</span>
<% end %>
</span>
<% if defined? UniversalTable %>
<span class="tab-content section_type_ut" style="<%= !form_section_post.new_record? && form_section_post.section_type == 'universal_table' ? '' : 'display:none' %>">
<span class="add-on"><%= t("curation.tables") %></span>
<%= f.select :universal_table, UTable.all.map { |table| [table.title, table.uid] },
{ include_blank: t("curation.please_select") },
class: 'form-control universal_table' %>
</span>
<% if !form_section_post.new_record? && form_section_post.section_type == "universal_table" %>
<span class="tab-content section_type_ut_entries">
<ul>
<% form_section_post.get_table_entries.each do |entry| %>
<li data-entry-id="<%= entry.id.to_s %>"><%= entry.column_entries.first.text %><a class="icon-remove cleanup" ></a></li>
<% end %>
</ul>
<span class="add-on"><%= t("curation.table_entries") %></span>
<%= f.text_field :table_entries, :class => "select2" %>
<%#= f.select :universal_table, [], {}, class: 'form-control select2', multiple: true, data: { value: tbData } %>
</span>
<% else %>
<span class="tab-content section_type_ut_entries" style="display:none">
<span class="add-on"><%= t("curation.table_entries") %></span>
<%= f.text_field :table_entries, :class => "select2" %>
</span>
<% end %>
<% end %>
<% if defined? UniversalTable %>
<span class="tab-content section_type_mm" style="<%= !form_section_post.new_record? && form_section_post.section_type == 'mind_map' ? '' : 'display:none' %>">
<span class="add-on"><%= t("curation.tables") %></span>
<%= f.select :universal_table, UTable.all.map { |table| [table.title, table.uid] },
{ include_blank: t("curation.please_select") },
class: 'form-control mind_map_select_ut' %>
</span>
<% if !form_section_post.new_record? && form_section_post.section_type == "mind_map" %>
<span class="tab-content section_type_mm_mindmaps">
<% maps = UTable.where(:uid => form_section_post.universal_table).first.mind_maps %>
<span class="add-on"><%= t("curation.mind_map") %></span>
<%= f.select :mind_map_id, maps.map { |m| [m.title, m.id.to_s] },
{ include_blank: t("curation.please_select"), selected: form_section_post.mind_map_id },
class: 'form-control mind_map_select' %>
</span>
<% else %>
<span class="tab-content section_type_mm_mindmaps" style="display:none">
<span class="add-on"><%= t("curation.mind_map") %></span>
<%= f.select :mind_map_id, [], {}, class: 'form-control mind_map_select' %>
</span>
<% end %>
<% end %>
<% if form_section_post.new_record? %>
<span class="delete_link add-on btn" title="<%= t(:delete_) %>">
<a class="icon-trash"></a>
</span>
<% else %>
<span class="remove_existing_record add-on btn" title="<%= t(:remove) %>">
<%= f.hidden_field :id %>
<a class="icon-remove"></a>
<%= f.hidden_field :_destroy, :value => nil, :class => 'should_destroy' %>
</span>
<% end %>
</div>