This commit is contained in:
User 2025-07-01 10:50:13 +08:00
parent 2a60bfe730
commit 4247599fd5
1 changed files with 114 additions and 111 deletions

225
app/views/admin/curations/_form_section_post.html.erb Normal file → Executable file
View File

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