Extract images and documents tab partial to a component
This commit is contained in:
committed by
Javi Martín
parent
f56dc654f3
commit
75180de8e6
@@ -0,0 +1,12 @@
|
|||||||
|
<h2><%= t("admin.settings.index.images_and_documents") %></h2>
|
||||||
|
|
||||||
|
<%= render Admin::Settings::TableComponent.new(setting_name: "setting") do %>
|
||||||
|
<% images_settings.each do |key| %>
|
||||||
|
<%= render Admin::Settings::RowComponent.new(key, tab: tab) %>
|
||||||
|
<% end %>
|
||||||
|
<%= render Admin::Settings::RowComponent.new("uploads.images.content_types", type: :content_type, tab: tab) %>
|
||||||
|
<% documents_settings.each do |key| %>
|
||||||
|
<%= render Admin::Settings::RowComponent.new(key, tab: tab) %>
|
||||||
|
<% end %>
|
||||||
|
<%= render Admin::Settings::RowComponent.new("uploads.documents.content_types", type: :content_type, tab: tab) %>
|
||||||
|
<% end %>
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
class Admin::Settings::ImagesAndDocumentsTabComponent < ApplicationComponent
|
||||||
|
def tab
|
||||||
|
"#tab-images-and-documents"
|
||||||
|
end
|
||||||
|
|
||||||
|
def images_settings
|
||||||
|
%w[
|
||||||
|
uploads.images.title.min_length
|
||||||
|
uploads.images.title.max_length
|
||||||
|
uploads.images.min_width
|
||||||
|
uploads.images.min_height
|
||||||
|
uploads.images.max_size
|
||||||
|
]
|
||||||
|
end
|
||||||
|
|
||||||
|
def documents_settings
|
||||||
|
%w[
|
||||||
|
uploads.documents.max_amount
|
||||||
|
uploads.documents.max_size
|
||||||
|
]
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
<h2><%= t("admin.settings.index.images_and_documents") %></h2>
|
|
||||||
|
|
||||||
<% tab = "#tab-images-and-documents" %>
|
|
||||||
<%= render Admin::Settings::TableComponent.new(setting_name: "setting") do %>
|
|
||||||
<%= render Admin::Settings::RowComponent.new("uploads.images.title.min_length", tab: tab) %>
|
|
||||||
<%= render Admin::Settings::RowComponent.new("uploads.images.title.max_length", tab: tab) %>
|
|
||||||
<%= render Admin::Settings::RowComponent.new("uploads.images.min_width", tab: tab) %>
|
|
||||||
<%= render Admin::Settings::RowComponent.new("uploads.images.min_height", tab: tab) %>
|
|
||||||
<%= render Admin::Settings::RowComponent.new("uploads.images.max_size", tab: tab) %>
|
|
||||||
<%= render Admin::Settings::RowComponent.new("uploads.images.content_types", type: :content_type, tab: tab) %>
|
|
||||||
<%= render Admin::Settings::RowComponent.new("uploads.documents.max_amount", tab: tab) %>
|
|
||||||
<%= render Admin::Settings::RowComponent.new("uploads.documents.max_size", tab: tab) %>
|
|
||||||
<%= render Admin::Settings::RowComponent.new("uploads.documents.content_types", type: :content_type, tab: tab) %>
|
|
||||||
<% end %>
|
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="tabs-panel" id="tab-images-and-documents">
|
<div class="tabs-panel" id="tab-images-and-documents">
|
||||||
<%= render "images_and_documents_tab" %>
|
<%= render Admin::Settings::ImagesAndDocumentsTabComponent.new %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="tabs-panel" id="tab-proposals">
|
<div class="tabs-panel" id="tab-proposals">
|
||||||
|
|||||||
Reference in New Issue
Block a user