jav_madmin 2.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +294 -0
- data/Rakefile +30 -0
- data/app/assets/config/madmin_manifest.js +3 -0
- data/app/assets/stylesheets/madmin/actiontext.css +31 -0
- data/app/assets/stylesheets/madmin/application-sprockets.css +11 -0
- data/app/assets/stylesheets/madmin/application.css +9 -0
- data/app/assets/stylesheets/madmin/base.css +144 -0
- data/app/assets/stylesheets/madmin/buttons.css +53 -0
- data/app/assets/stylesheets/madmin/forms.css +90 -0
- data/app/assets/stylesheets/madmin/pagination.css +59 -0
- data/app/assets/stylesheets/madmin/reset.css +242 -0
- data/app/assets/stylesheets/madmin/sidebar.css +179 -0
- data/app/assets/stylesheets/madmin/tables.css +71 -0
- data/app/controllers/madmin/application_controller.rb +17 -0
- data/app/controllers/madmin/base_controller.rb +15 -0
- data/app/controllers/madmin/dashboard_controller.rb +6 -0
- data/app/controllers/madmin/resource_controller.rb +119 -0
- data/app/helpers/madmin/application_helper.rb +10 -0
- data/app/helpers/madmin/nav_helper.rb +34 -0
- data/app/helpers/madmin/sort_helper.rb +48 -0
- data/app/javascript/madmin/application.js +3 -0
- data/app/javascript/madmin/controllers/application.js +12 -0
- data/app/javascript/madmin/controllers/index.js +5 -0
- data/app/javascript/madmin/controllers/mobile_nav_controller.js +50 -0
- data/app/javascript/madmin/controllers/nested_form_controller.js +34 -0
- data/app/javascript/madmin/controllers/select_controller.js +37 -0
- data/app/views/layouts/madmin/application.html.erb +41 -0
- data/app/views/madmin/application/_flash.html.erb +13 -0
- data/app/views/madmin/application/_form.html.erb +24 -0
- data/app/views/madmin/application/_javascript.html.erb +8 -0
- data/app/views/madmin/application/_missing_resource.html.erb +8 -0
- data/app/views/madmin/application/_navigation.html.erb +22 -0
- data/app/views/madmin/application/edit.html.erb +11 -0
- data/app/views/madmin/application/index.html.erb +85 -0
- data/app/views/madmin/application/new.html.erb +11 -0
- data/app/views/madmin/application/show.html.erb +40 -0
- data/app/views/madmin/dashboard/show.html.erb +2 -0
- data/app/views/madmin/fields/attachment/_form.html.erb +11 -0
- data/app/views/madmin/fields/attachment/_index.html.erb +7 -0
- data/app/views/madmin/fields/attachment/_show.html.erb +9 -0
- data/app/views/madmin/fields/attachments/_form.html.erb +1 -0
- data/app/views/madmin/fields/attachments/_index.html.erb +1 -0
- data/app/views/madmin/fields/attachments/_show.html.erb +11 -0
- data/app/views/madmin/fields/belongs_to/_form.html.erb +1 -0
- data/app/views/madmin/fields/belongs_to/_index.html.erb +4 -0
- data/app/views/madmin/fields/belongs_to/_show.html.erb +7 -0
- data/app/views/madmin/fields/boolean/_form.html.erb +3 -0
- data/app/views/madmin/fields/boolean/_index.html.erb +1 -0
- data/app/views/madmin/fields/boolean/_show.html.erb +1 -0
- data/app/views/madmin/fields/currency/_form.html.erb +1 -0
- data/app/views/madmin/fields/currency/_index.html.erb +1 -0
- data/app/views/madmin/fields/currency/_show.html.erb +1 -0
- data/app/views/madmin/fields/date/_form.html.erb +1 -0
- data/app/views/madmin/fields/date/_index.html.erb +1 -0
- data/app/views/madmin/fields/date/_show.html.erb +1 -0
- data/app/views/madmin/fields/date_time/_form.html.erb +1 -0
- data/app/views/madmin/fields/date_time/_index.html.erb +1 -0
- data/app/views/madmin/fields/date_time/_show.html.erb +1 -0
- data/app/views/madmin/fields/decimal/_form.html.erb +1 -0
- data/app/views/madmin/fields/decimal/_index.html.erb +1 -0
- data/app/views/madmin/fields/decimal/_show.html.erb +1 -0
- data/app/views/madmin/fields/enum/_form.html.erb +1 -0
- data/app/views/madmin/fields/enum/_index.html.erb +1 -0
- data/app/views/madmin/fields/enum/_show.html.erb +1 -0
- data/app/views/madmin/fields/file/_form.html.erb +1 -0
- data/app/views/madmin/fields/file/_index.html.erb +1 -0
- data/app/views/madmin/fields/file/_show.html.erb +6 -0
- data/app/views/madmin/fields/float/_form.html.erb +1 -0
- data/app/views/madmin/fields/float/_index.html.erb +1 -0
- data/app/views/madmin/fields/float/_show.html.erb +1 -0
- data/app/views/madmin/fields/has_many/_form.html.erb +1 -0
- data/app/views/madmin/fields/has_many/_index.html.erb +1 -0
- data/app/views/madmin/fields/has_many/_show.html.erb +18 -0
- data/app/views/madmin/fields/has_one/_form.html.erb +1 -0
- data/app/views/madmin/fields/has_one/_index.html.erb +3 -0
- data/app/views/madmin/fields/has_one/_show.html.erb +7 -0
- data/app/views/madmin/fields/integer/_form.html.erb +1 -0
- data/app/views/madmin/fields/integer/_index.html.erb +1 -0
- data/app/views/madmin/fields/integer/_show.html.erb +1 -0
- data/app/views/madmin/fields/json/_form.html.erb +1 -0
- data/app/views/madmin/fields/json/_index.html.erb +1 -0
- data/app/views/madmin/fields/json/_show.html.erb +1 -0
- data/app/views/madmin/fields/nested_has_many/_fields.html.erb +17 -0
- data/app/views/madmin/fields/nested_has_many/_form.html.erb +28 -0
- data/app/views/madmin/fields/nested_has_many/_index.html.erb +1 -0
- data/app/views/madmin/fields/nested_has_many/_show.html.erb +18 -0
- data/app/views/madmin/fields/password/_form.html.erb +1 -0
- data/app/views/madmin/fields/password/_index.html.erb +1 -0
- data/app/views/madmin/fields/password/_show.html.erb +1 -0
- data/app/views/madmin/fields/polymorphic/_form.html.erb +4 -0
- data/app/views/madmin/fields/polymorphic/_index.html.erb +3 -0
- data/app/views/madmin/fields/polymorphic/_show.html.erb +7 -0
- data/app/views/madmin/fields/rich_text/_form.html.erb +1 -0
- data/app/views/madmin/fields/rich_text/_index.html.erb +1 -0
- data/app/views/madmin/fields/rich_text/_show.html.erb +3 -0
- data/app/views/madmin/fields/select/_form.html.erb +1 -0
- data/app/views/madmin/fields/select/_index.html.erb +1 -0
- data/app/views/madmin/fields/select/_show.html.erb +1 -0
- data/app/views/madmin/fields/string/_form.html.erb +1 -0
- data/app/views/madmin/fields/string/_index.html.erb +1 -0
- data/app/views/madmin/fields/string/_show.html.erb +1 -0
- data/app/views/madmin/fields/text/_form.html.erb +1 -0
- data/app/views/madmin/fields/text/_index.html.erb +1 -0
- data/app/views/madmin/fields/text/_show.html.erb +1 -0
- data/app/views/madmin/fields/time/_form.html.erb +5 -0
- data/app/views/madmin/fields/time/_index.html.erb +1 -0
- data/app/views/madmin/fields/time/_show.html.erb +1 -0
- data/app/views/madmin/shared/_label.html.erb +4 -0
- data/config/importmap.rb +15 -0
- data/config/locales/el.yml +42 -0
- data/config/locales/en.yml +42 -0
- data/config/locales/fr.yml +42 -0
- data/config/locales/ko.yml +40 -0
- data/lib/generators/madmin/field/field_generator.rb +31 -0
- data/lib/generators/madmin/field/templates/_form.html.erb +1 -0
- data/lib/generators/madmin/field/templates/_index.html.erb +1 -0
- data/lib/generators/madmin/field/templates/_show.html.erb +1 -0
- data/lib/generators/madmin/field/templates/field.rb.tt +26 -0
- data/lib/generators/madmin/install/install_generator.rb +55 -0
- data/lib/generators/madmin/install/templates/controller.rb.tt +15 -0
- data/lib/generators/madmin/install/templates/routes.rb.tt +3 -0
- data/lib/generators/madmin/resource/resource_generator.rb +73 -0
- data/lib/generators/madmin/resource/templates/controller.rb.tt +10 -0
- data/lib/generators/madmin/resource/templates/resource.rb.tt +33 -0
- data/lib/generators/madmin/views/edit_generator.rb +16 -0
- data/lib/generators/madmin/views/form_generator.rb +15 -0
- data/lib/generators/madmin/views/index_generator.rb +15 -0
- data/lib/generators/madmin/views/javascript_generator.rb +15 -0
- data/lib/generators/madmin/views/layout_generator.rb +21 -0
- data/lib/generators/madmin/views/navigation_generator.rb +15 -0
- data/lib/generators/madmin/views/new_generator.rb +16 -0
- data/lib/generators/madmin/views/show_generator.rb +15 -0
- data/lib/generators/madmin/views/views_generator.rb +16 -0
- data/lib/madmin/engine.rb +47 -0
- data/lib/madmin/field.rb +67 -0
- data/lib/madmin/fields/attachment.rb +6 -0
- data/lib/madmin/fields/attachments.rb +9 -0
- data/lib/madmin/fields/belongs_to.rb +29 -0
- data/lib/madmin/fields/boolean.rb +6 -0
- data/lib/madmin/fields/currency.rb +15 -0
- data/lib/madmin/fields/date.rb +6 -0
- data/lib/madmin/fields/date_time.rb +6 -0
- data/lib/madmin/fields/decimal.rb +6 -0
- data/lib/madmin/fields/enum.rb +9 -0
- data/lib/madmin/fields/file.rb +9 -0
- data/lib/madmin/fields/float.rb +6 -0
- data/lib/madmin/fields/has_many.rb +62 -0
- data/lib/madmin/fields/has_one.rb +10 -0
- data/lib/madmin/fields/integer.rb +6 -0
- data/lib/madmin/fields/json.rb +6 -0
- data/lib/madmin/fields/nested_has_many.rb +44 -0
- data/lib/madmin/fields/password.rb +6 -0
- data/lib/madmin/fields/polymorphic.rb +22 -0
- data/lib/madmin/fields/rich_text.rb +6 -0
- data/lib/madmin/fields/select.rb +9 -0
- data/lib/madmin/fields/string.rb +9 -0
- data/lib/madmin/fields/text.rb +9 -0
- data/lib/madmin/fields/time.rb +6 -0
- data/lib/madmin/generator_helpers.rb +59 -0
- data/lib/madmin/member_action.rb +19 -0
- data/lib/madmin/menu.rb +70 -0
- data/lib/madmin/namespace.rb +35 -0
- data/lib/madmin/resource.rb +295 -0
- data/lib/madmin/resource_builder.rb +88 -0
- data/lib/madmin/search.rb +62 -0
- data/lib/madmin/version.rb +3 -0
- data/lib/madmin/view_generator.rb +43 -0
- data/lib/madmin.rb +114 -0
- data/lib/tasks/madmin_tasks.rake +11 -0
- metadata +284 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= field.value(record) %>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= form.file_field field.attribute_name, class: "form-input" %>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= field.value(record) %>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= form.number_field field.attribute_name, step: :any, class: "form-input" %>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= field.value(record) %>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= field.value(record) %>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= form.select "#{field.attribute_name.to_s.singularize}_ids", field.options_for_select(record), { prompt: true }, { multiple: true, data: { controller: "select", select_url_value: field.index_path } } %>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= pluralize field.value(record).size, field.attribute_name.to_s %>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<% pagy, records = field.paginated_value(record, params) %>
|
|
2
|
+
<% records.each do |object| %>
|
|
3
|
+
<% if (associated_resource = field.associated_resource_for(object)) %>
|
|
4
|
+
<div><%= link_to associated_resource.display_name(object), associated_resource.show_path(object) %></div>
|
|
5
|
+
<% else %>
|
|
6
|
+
<%= render partial: "missing_resource", locals: { resource_name: Madmin.resource_name_for(object) } %>
|
|
7
|
+
<% end %>
|
|
8
|
+
<% end %>
|
|
9
|
+
|
|
10
|
+
<div class="pagination">
|
|
11
|
+
<% if pagy.respond_to?(:series_nav) %>
|
|
12
|
+
<%== pagy.series_nav if pagy.last > 1 %>
|
|
13
|
+
<%== pagy.info_tag %>
|
|
14
|
+
<% else %>
|
|
15
|
+
<%== pagy_nav pagy if pagy.last > 1 %>
|
|
16
|
+
<%== pagy_info pagy %>
|
|
17
|
+
<% end %>
|
|
18
|
+
</div>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= field.value(record) %>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<% if (object = field.value(record)) %>
|
|
2
|
+
<% if (associated_resource = field.associated_resource_for(object)) %>
|
|
3
|
+
<%= link_to associated_resource.display_name(object), associated_resource.show_path(object) %>
|
|
4
|
+
<% else %>
|
|
5
|
+
<%= render partial: "missing_resource", locals: { resource_name: Madmin.resource_name_for(object) } %>
|
|
6
|
+
<% end %>
|
|
7
|
+
<% end %>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= form.number_field field.attribute_name, class: "form-input" %>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= link_to_if field.attribute_name.to_s == resource.model.primary_key, field.value(record), resource.show_path(record) %>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= field.value(record) %>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= form.text_area field.attribute_name, class: "form-input" %>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= field.value(record) %>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= field.value(record) %>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<%= content_tag :div, class: "nested-fields", data: { new_record: f.object.new_record? } do %>
|
|
2
|
+
<% field.nested_attributes.each do |name, nested_attribute| %>
|
|
3
|
+
<% nested_field = nested_attribute.field %>
|
|
4
|
+
<% next if nested_field.nil? %>
|
|
5
|
+
<% next unless nested_field.visible?(action_name) %>
|
|
6
|
+
<% next unless nested_field.visible?(:form) %>
|
|
7
|
+
|
|
8
|
+
<div class="form-group">
|
|
9
|
+
<%= render "madmin/shared/label", form: f, field: nested_field %>
|
|
10
|
+
<%= render partial: nested_field.to_partial_path("form"), locals: { field: nested_field, record: f.object, form: f, resource: field.resource } %>
|
|
11
|
+
</div>
|
|
12
|
+
<% end %>
|
|
13
|
+
|
|
14
|
+
<small><%= link_to t("madmin.actions.remove"), "#", data: { action: "click->nested-form#remove_association" } %></small>
|
|
15
|
+
|
|
16
|
+
<%= f.hidden_field :_destroy %>
|
|
17
|
+
<% end %>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<div class="container space-y-8" data-controller="nested-form">
|
|
2
|
+
<template data-target="nested-form.template">
|
|
3
|
+
|
|
4
|
+
<%= form.fields_for field.attribute_name, field.to_model.new, child_index: 'NEW_RECORD' do |nested_form| %>
|
|
5
|
+
<%= render(
|
|
6
|
+
partial: field.to_partial_path('fields'),
|
|
7
|
+
locals: {
|
|
8
|
+
f: nested_form,
|
|
9
|
+
field: field
|
|
10
|
+
}
|
|
11
|
+
) %>
|
|
12
|
+
<% end %>
|
|
13
|
+
</template>
|
|
14
|
+
|
|
15
|
+
<%= form.fields_for field.attribute_name do |nested_form| %>
|
|
16
|
+
<%= render(
|
|
17
|
+
partial: field.to_partial_path('fields'),
|
|
18
|
+
locals: {
|
|
19
|
+
f: nested_form,
|
|
20
|
+
field: field
|
|
21
|
+
}
|
|
22
|
+
) %>
|
|
23
|
+
<% end %>
|
|
24
|
+
|
|
25
|
+
<%= content_tag :div, class: '', data: { target:"nested-form.links" } do %>
|
|
26
|
+
<%= link_to t("madmin.nested_form.add_new"), "#", data: { action: "click->nested-form#add_association" } %>
|
|
27
|
+
<% end %>
|
|
28
|
+
</div>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= pluralize field.value(record).size, field.attribute_name.to_s %>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<% pagy, records = field.paginated_value(record, params) %>
|
|
2
|
+
<% records.each do |object| %>
|
|
3
|
+
<% if (associated_resource = field.associated_resource_for(object)) %>
|
|
4
|
+
<div><%= link_to associated_resource.display_name(object), associated_resource.show_path(object) %></div>
|
|
5
|
+
<% else %>
|
|
6
|
+
<%= render partial: "missing_resource", locals: { resource_name: Madmin.resource_name_for(object) } %>
|
|
7
|
+
<% end %>
|
|
8
|
+
<% end %>
|
|
9
|
+
|
|
10
|
+
<div class="pagination">
|
|
11
|
+
<% if pagy.respond_to?(:series_nav) %>
|
|
12
|
+
<%== pagy.series_nav if pagy.last > 1 %>
|
|
13
|
+
<%== pagy.info_tag %>
|
|
14
|
+
<% else %>
|
|
15
|
+
<%== pagy_nav pagy if pagy.last > 1 %>
|
|
16
|
+
<%== pagy_info pagy %>
|
|
17
|
+
<% end %>
|
|
18
|
+
</div>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= form.password_field field.attribute_name, class: "form-input" %>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= field.value(record) %>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= field.value(record) %>
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
<%= form.fields_for field.attribute_name do |pf| %>
|
|
2
|
+
<%= pf.select :value, field.options_for_select(record).map(&:to_global_id), { selected: field.value(record)&.to_global_id, prompt: true }, { data: { controller: "select" } } %>
|
|
3
|
+
<%= pf.hidden_field :type, value: "polymorphic" %>
|
|
4
|
+
<% end %>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<% if (object = field.value(record)) %>
|
|
2
|
+
<% if (associated_resource = field.associated_resource_for(object)) %>
|
|
3
|
+
<%= link_to associated_resource.display_name(object), associated_resource.show_path(object), class: "text-blue-500 underline" %>
|
|
4
|
+
<% else %>
|
|
5
|
+
<%= render partial: "missing_resource", locals: { resource_name: Madmin.resource_name_for(object) } %>
|
|
6
|
+
<% end %>
|
|
7
|
+
<% end %>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= form.rich_text_area field.attribute_name, class: "form-input" %>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= field.value(record) %>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= form.select field.attribute_name, field.options_for_select(record), { prompt: true }, { data: { controller: "select" } } %>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= field.value(record) %>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= field.value(record) %>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= form.text_field field.attribute_name, class: "form-input", placeholder: field.options.placeholder %>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= field.value(record) %>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= field.value(record) %>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= form.text_area field.attribute_name, class: "form-input" %>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= truncate field.value(record).to_s %>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= field.value(record) %>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= field.value(record) %>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= field.value(record) %>
|
data/config/importmap.rb
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
pin "application", to: "madmin/application.js", preload: true
|
|
2
|
+
pin "@hotwired/turbo-rails", to: "turbo.min.js", preload: true
|
|
3
|
+
pin "@hotwired/stimulus", to: "stimulus.min.js", preload: true
|
|
4
|
+
pin "@hotwired/stimulus-loading", to: "stimulus-loading.js", preload: true
|
|
5
|
+
pin "@rails/actiontext", to: "actiontext.esm.js"
|
|
6
|
+
pin "@rails/activestorage", to: "activestorage.esm.js"
|
|
7
|
+
|
|
8
|
+
pin "trix" if defined?(::Trix) || Rails.gem_version < Gem::Version.new("8.1.0.beta1")
|
|
9
|
+
pin "lexxy", to: "lexxy.js" if defined?(::Lexxy)
|
|
10
|
+
|
|
11
|
+
pin_all_from Madmin::Engine.root.join("app/javascript/madmin/controllers"), under: "controllers", to: "madmin/controllers"
|
|
12
|
+
pin_all_from Rails.root.join("app/javascript/madmin/controllers"), under: "controllers", to: "madmin/controllers"
|
|
13
|
+
|
|
14
|
+
pin "tom-select", to: "https://ga.jspm.io/npm:tom-select@2.4.1/dist/js/tom-select.complete.js"
|
|
15
|
+
pin "tailwindcss-stimulus-components", to: "https://ga.jspm.io/npm:tailwindcss-stimulus-components@6.1.2/dist/tailwindcss-stimulus-components.module.js"
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
el:
|
|
2
|
+
madmin:
|
|
3
|
+
layout:
|
|
4
|
+
open_menu: Άνοιγμα μενού
|
|
5
|
+
admin_suffix: Διαχείριση
|
|
6
|
+
navigation:
|
|
7
|
+
dashboard: Πίνακας ελέγχου
|
|
8
|
+
github: Το Madmin στο GitHub
|
|
9
|
+
dashboard:
|
|
10
|
+
title: Πίνακας ελέγχου Madmin
|
|
11
|
+
hint_html: Δημιουργήστε το <code>app/views/madmin/dashboard/show.html.erb</code> για να προσαρμόσετε τον πίνακα ελέγχου σας.
|
|
12
|
+
actions:
|
|
13
|
+
all: Όλα
|
|
14
|
+
view: Προβολή
|
|
15
|
+
edit: Επεξεργασία
|
|
16
|
+
delete: Διαγραφή
|
|
17
|
+
new: Νέο
|
|
18
|
+
remove: Αφαίρεση
|
|
19
|
+
cancel: Ακύρωση
|
|
20
|
+
search:
|
|
21
|
+
placeholder: Αναζήτηση
|
|
22
|
+
titles:
|
|
23
|
+
new: Νέο %{name}
|
|
24
|
+
edit: Επεξεργασία %{name}
|
|
25
|
+
form:
|
|
26
|
+
errors:
|
|
27
|
+
one: Υπήρξε 1 σφάλμα με την υποβολή σας
|
|
28
|
+
other: Υπήρξαν %{count} σφάλματα με την υποβολή σας
|
|
29
|
+
flash:
|
|
30
|
+
readonly: "%{name}: μόνο για ανάγνωση"
|
|
31
|
+
confirmations:
|
|
32
|
+
delete: Είστε σίγουροι;
|
|
33
|
+
remove_with_changes: Είστε σίγουροι; Θα χάσετε όλες τις άλλες αλλαγές.
|
|
34
|
+
nested_form:
|
|
35
|
+
add_new: "+ Προσθήκη νέου"
|
|
36
|
+
fields:
|
|
37
|
+
attachment:
|
|
38
|
+
one: "%{count} συνημμένο"
|
|
39
|
+
other: "%{count} συνημμένα"
|
|
40
|
+
missing_resource:
|
|
41
|
+
message: "Λείπει: %{resource}"
|
|
42
|
+
create_hint: "Δημιουργήστε το εκτελώντας:"
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
en:
|
|
2
|
+
madmin:
|
|
3
|
+
layout:
|
|
4
|
+
open_menu: Open menu
|
|
5
|
+
admin_suffix: Admin
|
|
6
|
+
navigation:
|
|
7
|
+
dashboard: Dashboard
|
|
8
|
+
github: Madmin on GitHub
|
|
9
|
+
dashboard:
|
|
10
|
+
title: Madmin Dashboard
|
|
11
|
+
hint_html: Create <code>app/views/madmin/dashboard/show.html.erb</code> to customize your dashboard.
|
|
12
|
+
actions:
|
|
13
|
+
all: All
|
|
14
|
+
view: View
|
|
15
|
+
edit: Edit
|
|
16
|
+
delete: Delete
|
|
17
|
+
new: New
|
|
18
|
+
remove: Remove
|
|
19
|
+
cancel: Cancel
|
|
20
|
+
search:
|
|
21
|
+
placeholder: Search
|
|
22
|
+
titles:
|
|
23
|
+
new: New %{name}
|
|
24
|
+
edit: Edit %{name}
|
|
25
|
+
form:
|
|
26
|
+
errors:
|
|
27
|
+
one: There was 1 error with your submission
|
|
28
|
+
other: There were %{count} errors with your submission
|
|
29
|
+
flash:
|
|
30
|
+
readonly: "%{name} is read-only"
|
|
31
|
+
confirmations:
|
|
32
|
+
delete: Are you sure?
|
|
33
|
+
remove_with_changes: Are you sure? You will lose any other changes.
|
|
34
|
+
nested_form:
|
|
35
|
+
add_new: "+ Add new"
|
|
36
|
+
fields:
|
|
37
|
+
attachment:
|
|
38
|
+
one: "%{count} attachment"
|
|
39
|
+
other: "%{count} attachments"
|
|
40
|
+
missing_resource:
|
|
41
|
+
message: "%{resource} is missing."
|
|
42
|
+
create_hint: "Create it by running:"
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
fr:
|
|
2
|
+
madmin:
|
|
3
|
+
layout:
|
|
4
|
+
open_menu: Ouvrir le menu
|
|
5
|
+
admin_suffix: Administration
|
|
6
|
+
navigation:
|
|
7
|
+
dashboard: Tableau de bord
|
|
8
|
+
github: Madmin sur GitHub
|
|
9
|
+
dashboard:
|
|
10
|
+
title: Tableau de bord Madmin
|
|
11
|
+
hint_html: Créez <code>app/views/madmin/dashboard/show.html.erb</code> pour personnaliser votre tableau de bord.
|
|
12
|
+
actions:
|
|
13
|
+
all: Tous
|
|
14
|
+
view: Voir
|
|
15
|
+
edit: Modifier
|
|
16
|
+
delete: Supprimer
|
|
17
|
+
new: Nouveau
|
|
18
|
+
remove: Retirer
|
|
19
|
+
cancel: Annuler
|
|
20
|
+
search:
|
|
21
|
+
placeholder: Rechercher
|
|
22
|
+
titles:
|
|
23
|
+
new: Nouveau %{name}
|
|
24
|
+
edit: Modifier %{name}
|
|
25
|
+
form:
|
|
26
|
+
errors:
|
|
27
|
+
one: Il y a eu 1 erreur dans votre soumission
|
|
28
|
+
other: Il y a eu %{count} erreurs dans votre soumission
|
|
29
|
+
flash:
|
|
30
|
+
readonly: "%{name} est en lecture seule"
|
|
31
|
+
confirmations:
|
|
32
|
+
delete: Êtes-vous sûr ?
|
|
33
|
+
remove_with_changes: Êtes-vous sûr ? Vous perdrez toutes les autres modifications.
|
|
34
|
+
nested_form:
|
|
35
|
+
add_new: "+ Ajouter"
|
|
36
|
+
fields:
|
|
37
|
+
attachment:
|
|
38
|
+
one: "%{count} pièce jointe"
|
|
39
|
+
other: "%{count} pièces jointes"
|
|
40
|
+
missing_resource:
|
|
41
|
+
message: "%{resource} est introuvable."
|
|
42
|
+
create_hint: "Pour le créer, exécutez :"
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
ko:
|
|
2
|
+
madmin:
|
|
3
|
+
layout:
|
|
4
|
+
open_menu: 메뉴 열기
|
|
5
|
+
admin_suffix: 관리자
|
|
6
|
+
navigation:
|
|
7
|
+
dashboard: 대시보드
|
|
8
|
+
github: GitHub에서 Madmin 보기
|
|
9
|
+
dashboard:
|
|
10
|
+
title: Madmin 대시보드
|
|
11
|
+
hint_html: 대시보드를 원하는 대로 꾸미려면 <code>app/views/madmin/dashboard/show.html.erb</code> 파일을 생성하세요.
|
|
12
|
+
actions:
|
|
13
|
+
all: 전체
|
|
14
|
+
view: 보기
|
|
15
|
+
edit: 수정
|
|
16
|
+
delete: 삭제
|
|
17
|
+
new: 새로 만들기
|
|
18
|
+
remove: 제거
|
|
19
|
+
cancel: 취소
|
|
20
|
+
search:
|
|
21
|
+
placeholder: 검색
|
|
22
|
+
titles:
|
|
23
|
+
new: 새 %{name}
|
|
24
|
+
edit: "%{name} 수정"
|
|
25
|
+
form:
|
|
26
|
+
errors:
|
|
27
|
+
one: 제출한 내용에 오류가 1개 있습니다
|
|
28
|
+
other: 제출한 내용에 오류가 %{count}개 있습니다
|
|
29
|
+
confirmations:
|
|
30
|
+
delete: 정말 삭제하시겠습니까?
|
|
31
|
+
remove_with_changes: 정말 제거하시겠습니까? 다른 변경 사항도 함께 사라집니다.
|
|
32
|
+
nested_form:
|
|
33
|
+
add_new: "+ 새로 추가"
|
|
34
|
+
fields:
|
|
35
|
+
attachment:
|
|
36
|
+
one: "첨부파일 %{count}개"
|
|
37
|
+
other: "첨부파일 %{count}개"
|
|
38
|
+
missing_resource:
|
|
39
|
+
message: "%{resource}이(가) 존재하지 않습니다."
|
|
40
|
+
create_hint: "다음 명령어를 실행하여 생성하세요:"
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
module Madmin
|
|
2
|
+
module Generators
|
|
3
|
+
class FieldGenerator < Rails::Generators::NamedBase
|
|
4
|
+
include Madmin::GeneratorHelpers
|
|
5
|
+
|
|
6
|
+
source_root File.expand_path("../templates", __FILE__)
|
|
7
|
+
|
|
8
|
+
def eager_load
|
|
9
|
+
Rails.application.eager_load!
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def generate_field
|
|
13
|
+
template "field.rb", "app/madmin/fields/#{file_path}_field.rb"
|
|
14
|
+
copy_resource_template "_form"
|
|
15
|
+
copy_resource_template "_index"
|
|
16
|
+
copy_resource_template "_show"
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
private
|
|
20
|
+
|
|
21
|
+
def copy_resource_template(template_name)
|
|
22
|
+
template_file = "#{template_name}.html.erb"
|
|
23
|
+
|
|
24
|
+
copy_file(
|
|
25
|
+
template_file,
|
|
26
|
+
"app/views/madmin/fields/#{file_path}_field/#{template_file}"
|
|
27
|
+
)
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= form.text_field field.attribute_name, class: "form-input" %>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= field.value(record) %>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= field.value(record) %>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
class <%= class_name %>Field < Madmin::Field
|
|
2
|
+
# def value(record)
|
|
3
|
+
# record.public_send(attribute_name)
|
|
4
|
+
# end
|
|
5
|
+
|
|
6
|
+
# def to_partial_path(name)
|
|
7
|
+
# unless %w[index show form].include? name
|
|
8
|
+
# raise ArgumentError, "`partial` must be 'index', 'show', or 'form'"
|
|
9
|
+
# end
|
|
10
|
+
#
|
|
11
|
+
# "/madmin/fields/#{self.class.field_type}/#{name}"
|
|
12
|
+
# end
|
|
13
|
+
|
|
14
|
+
# def to_param
|
|
15
|
+
# attribute_name
|
|
16
|
+
# end
|
|
17
|
+
|
|
18
|
+
# # Used for checking visibility of attribute on an view
|
|
19
|
+
# def visible?(action, default: true)
|
|
20
|
+
# options.fetch(action.to_sym, default)
|
|
21
|
+
# end
|
|
22
|
+
|
|
23
|
+
# def required?
|
|
24
|
+
# model.validators_on(attribute_name).any? { |v| v.is_a? ActiveModel::Validations::PresenceValidator }
|
|
25
|
+
# end
|
|
26
|
+
end
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
require "madmin/generator_helpers"
|
|
2
|
+
|
|
3
|
+
module Madmin
|
|
4
|
+
module Generators
|
|
5
|
+
class InstallGenerator < ::Rails::Generators::Base
|
|
6
|
+
include Madmin::GeneratorHelpers
|
|
7
|
+
|
|
8
|
+
source_root File.expand_path("../templates", __FILE__)
|
|
9
|
+
|
|
10
|
+
def eager_load
|
|
11
|
+
Rails.application.eager_load!
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def copy_controller
|
|
15
|
+
template("controller.rb.tt", "app/controllers/madmin/application_controller.rb")
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def generate_routes
|
|
19
|
+
if rails6_1_and_up?
|
|
20
|
+
route "draw :madmin", file: ROUTES_FILE[:default]
|
|
21
|
+
template("routes.rb.tt", "config/routes/madmin.rb")
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
if route_namespace_exists?
|
|
25
|
+
route "root to: \"dashboard#show\"", indentation: separated_routes_file? ? 2 : 4, sentinel: /namespace :madmin do\s*\n/m
|
|
26
|
+
else
|
|
27
|
+
route "root to: \"dashboard#show\"", namespace: [:madmin]
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def generate_resources
|
|
32
|
+
generateable_models.each do |model|
|
|
33
|
+
if model.table_exists?
|
|
34
|
+
call_generator "madmin:resource", model.to_s
|
|
35
|
+
else
|
|
36
|
+
puts "Skipping #{model} because database table does not exist"
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
private
|
|
42
|
+
|
|
43
|
+
# Skip Abstract classes, ActiveRecord::Base, and auto-generated HABTM models
|
|
44
|
+
def generateable_models
|
|
45
|
+
active_record_models.reject do |model|
|
|
46
|
+
model.abstract_class? || model == ::ActiveRecord::Base || model.name.start_with?("HABTM_")
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def active_record_models
|
|
51
|
+
ObjectSpace.each_object(::ActiveRecord::Base.singleton_class)
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module Madmin
|
|
2
|
+
class ApplicationController < Madmin::BaseController
|
|
3
|
+
before_action :authenticate_admin_user
|
|
4
|
+
|
|
5
|
+
def authenticate_admin_user
|
|
6
|
+
# TODO: Add your authentication logic here
|
|
7
|
+
|
|
8
|
+
# For example, with Rails 8 authentication
|
|
9
|
+
# redirect_to "/", alert: "Not authorized." unless authenticated? && Current.user.admin?
|
|
10
|
+
|
|
11
|
+
# Or with Devise
|
|
12
|
+
# redirect_to "/", alert: "Not authorized." unless current_user&.admin?
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|