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.
Files changed (172) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +294 -0
  4. data/Rakefile +30 -0
  5. data/app/assets/config/madmin_manifest.js +3 -0
  6. data/app/assets/stylesheets/madmin/actiontext.css +31 -0
  7. data/app/assets/stylesheets/madmin/application-sprockets.css +11 -0
  8. data/app/assets/stylesheets/madmin/application.css +9 -0
  9. data/app/assets/stylesheets/madmin/base.css +144 -0
  10. data/app/assets/stylesheets/madmin/buttons.css +53 -0
  11. data/app/assets/stylesheets/madmin/forms.css +90 -0
  12. data/app/assets/stylesheets/madmin/pagination.css +59 -0
  13. data/app/assets/stylesheets/madmin/reset.css +242 -0
  14. data/app/assets/stylesheets/madmin/sidebar.css +179 -0
  15. data/app/assets/stylesheets/madmin/tables.css +71 -0
  16. data/app/controllers/madmin/application_controller.rb +17 -0
  17. data/app/controllers/madmin/base_controller.rb +15 -0
  18. data/app/controllers/madmin/dashboard_controller.rb +6 -0
  19. data/app/controllers/madmin/resource_controller.rb +119 -0
  20. data/app/helpers/madmin/application_helper.rb +10 -0
  21. data/app/helpers/madmin/nav_helper.rb +34 -0
  22. data/app/helpers/madmin/sort_helper.rb +48 -0
  23. data/app/javascript/madmin/application.js +3 -0
  24. data/app/javascript/madmin/controllers/application.js +12 -0
  25. data/app/javascript/madmin/controllers/index.js +5 -0
  26. data/app/javascript/madmin/controllers/mobile_nav_controller.js +50 -0
  27. data/app/javascript/madmin/controllers/nested_form_controller.js +34 -0
  28. data/app/javascript/madmin/controllers/select_controller.js +37 -0
  29. data/app/views/layouts/madmin/application.html.erb +41 -0
  30. data/app/views/madmin/application/_flash.html.erb +13 -0
  31. data/app/views/madmin/application/_form.html.erb +24 -0
  32. data/app/views/madmin/application/_javascript.html.erb +8 -0
  33. data/app/views/madmin/application/_missing_resource.html.erb +8 -0
  34. data/app/views/madmin/application/_navigation.html.erb +22 -0
  35. data/app/views/madmin/application/edit.html.erb +11 -0
  36. data/app/views/madmin/application/index.html.erb +85 -0
  37. data/app/views/madmin/application/new.html.erb +11 -0
  38. data/app/views/madmin/application/show.html.erb +40 -0
  39. data/app/views/madmin/dashboard/show.html.erb +2 -0
  40. data/app/views/madmin/fields/attachment/_form.html.erb +11 -0
  41. data/app/views/madmin/fields/attachment/_index.html.erb +7 -0
  42. data/app/views/madmin/fields/attachment/_show.html.erb +9 -0
  43. data/app/views/madmin/fields/attachments/_form.html.erb +1 -0
  44. data/app/views/madmin/fields/attachments/_index.html.erb +1 -0
  45. data/app/views/madmin/fields/attachments/_show.html.erb +11 -0
  46. data/app/views/madmin/fields/belongs_to/_form.html.erb +1 -0
  47. data/app/views/madmin/fields/belongs_to/_index.html.erb +4 -0
  48. data/app/views/madmin/fields/belongs_to/_show.html.erb +7 -0
  49. data/app/views/madmin/fields/boolean/_form.html.erb +3 -0
  50. data/app/views/madmin/fields/boolean/_index.html.erb +1 -0
  51. data/app/views/madmin/fields/boolean/_show.html.erb +1 -0
  52. data/app/views/madmin/fields/currency/_form.html.erb +1 -0
  53. data/app/views/madmin/fields/currency/_index.html.erb +1 -0
  54. data/app/views/madmin/fields/currency/_show.html.erb +1 -0
  55. data/app/views/madmin/fields/date/_form.html.erb +1 -0
  56. data/app/views/madmin/fields/date/_index.html.erb +1 -0
  57. data/app/views/madmin/fields/date/_show.html.erb +1 -0
  58. data/app/views/madmin/fields/date_time/_form.html.erb +1 -0
  59. data/app/views/madmin/fields/date_time/_index.html.erb +1 -0
  60. data/app/views/madmin/fields/date_time/_show.html.erb +1 -0
  61. data/app/views/madmin/fields/decimal/_form.html.erb +1 -0
  62. data/app/views/madmin/fields/decimal/_index.html.erb +1 -0
  63. data/app/views/madmin/fields/decimal/_show.html.erb +1 -0
  64. data/app/views/madmin/fields/enum/_form.html.erb +1 -0
  65. data/app/views/madmin/fields/enum/_index.html.erb +1 -0
  66. data/app/views/madmin/fields/enum/_show.html.erb +1 -0
  67. data/app/views/madmin/fields/file/_form.html.erb +1 -0
  68. data/app/views/madmin/fields/file/_index.html.erb +1 -0
  69. data/app/views/madmin/fields/file/_show.html.erb +6 -0
  70. data/app/views/madmin/fields/float/_form.html.erb +1 -0
  71. data/app/views/madmin/fields/float/_index.html.erb +1 -0
  72. data/app/views/madmin/fields/float/_show.html.erb +1 -0
  73. data/app/views/madmin/fields/has_many/_form.html.erb +1 -0
  74. data/app/views/madmin/fields/has_many/_index.html.erb +1 -0
  75. data/app/views/madmin/fields/has_many/_show.html.erb +18 -0
  76. data/app/views/madmin/fields/has_one/_form.html.erb +1 -0
  77. data/app/views/madmin/fields/has_one/_index.html.erb +3 -0
  78. data/app/views/madmin/fields/has_one/_show.html.erb +7 -0
  79. data/app/views/madmin/fields/integer/_form.html.erb +1 -0
  80. data/app/views/madmin/fields/integer/_index.html.erb +1 -0
  81. data/app/views/madmin/fields/integer/_show.html.erb +1 -0
  82. data/app/views/madmin/fields/json/_form.html.erb +1 -0
  83. data/app/views/madmin/fields/json/_index.html.erb +1 -0
  84. data/app/views/madmin/fields/json/_show.html.erb +1 -0
  85. data/app/views/madmin/fields/nested_has_many/_fields.html.erb +17 -0
  86. data/app/views/madmin/fields/nested_has_many/_form.html.erb +28 -0
  87. data/app/views/madmin/fields/nested_has_many/_index.html.erb +1 -0
  88. data/app/views/madmin/fields/nested_has_many/_show.html.erb +18 -0
  89. data/app/views/madmin/fields/password/_form.html.erb +1 -0
  90. data/app/views/madmin/fields/password/_index.html.erb +1 -0
  91. data/app/views/madmin/fields/password/_show.html.erb +1 -0
  92. data/app/views/madmin/fields/polymorphic/_form.html.erb +4 -0
  93. data/app/views/madmin/fields/polymorphic/_index.html.erb +3 -0
  94. data/app/views/madmin/fields/polymorphic/_show.html.erb +7 -0
  95. data/app/views/madmin/fields/rich_text/_form.html.erb +1 -0
  96. data/app/views/madmin/fields/rich_text/_index.html.erb +1 -0
  97. data/app/views/madmin/fields/rich_text/_show.html.erb +3 -0
  98. data/app/views/madmin/fields/select/_form.html.erb +1 -0
  99. data/app/views/madmin/fields/select/_index.html.erb +1 -0
  100. data/app/views/madmin/fields/select/_show.html.erb +1 -0
  101. data/app/views/madmin/fields/string/_form.html.erb +1 -0
  102. data/app/views/madmin/fields/string/_index.html.erb +1 -0
  103. data/app/views/madmin/fields/string/_show.html.erb +1 -0
  104. data/app/views/madmin/fields/text/_form.html.erb +1 -0
  105. data/app/views/madmin/fields/text/_index.html.erb +1 -0
  106. data/app/views/madmin/fields/text/_show.html.erb +1 -0
  107. data/app/views/madmin/fields/time/_form.html.erb +5 -0
  108. data/app/views/madmin/fields/time/_index.html.erb +1 -0
  109. data/app/views/madmin/fields/time/_show.html.erb +1 -0
  110. data/app/views/madmin/shared/_label.html.erb +4 -0
  111. data/config/importmap.rb +15 -0
  112. data/config/locales/el.yml +42 -0
  113. data/config/locales/en.yml +42 -0
  114. data/config/locales/fr.yml +42 -0
  115. data/config/locales/ko.yml +40 -0
  116. data/lib/generators/madmin/field/field_generator.rb +31 -0
  117. data/lib/generators/madmin/field/templates/_form.html.erb +1 -0
  118. data/lib/generators/madmin/field/templates/_index.html.erb +1 -0
  119. data/lib/generators/madmin/field/templates/_show.html.erb +1 -0
  120. data/lib/generators/madmin/field/templates/field.rb.tt +26 -0
  121. data/lib/generators/madmin/install/install_generator.rb +55 -0
  122. data/lib/generators/madmin/install/templates/controller.rb.tt +15 -0
  123. data/lib/generators/madmin/install/templates/routes.rb.tt +3 -0
  124. data/lib/generators/madmin/resource/resource_generator.rb +73 -0
  125. data/lib/generators/madmin/resource/templates/controller.rb.tt +10 -0
  126. data/lib/generators/madmin/resource/templates/resource.rb.tt +33 -0
  127. data/lib/generators/madmin/views/edit_generator.rb +16 -0
  128. data/lib/generators/madmin/views/form_generator.rb +15 -0
  129. data/lib/generators/madmin/views/index_generator.rb +15 -0
  130. data/lib/generators/madmin/views/javascript_generator.rb +15 -0
  131. data/lib/generators/madmin/views/layout_generator.rb +21 -0
  132. data/lib/generators/madmin/views/navigation_generator.rb +15 -0
  133. data/lib/generators/madmin/views/new_generator.rb +16 -0
  134. data/lib/generators/madmin/views/show_generator.rb +15 -0
  135. data/lib/generators/madmin/views/views_generator.rb +16 -0
  136. data/lib/madmin/engine.rb +47 -0
  137. data/lib/madmin/field.rb +67 -0
  138. data/lib/madmin/fields/attachment.rb +6 -0
  139. data/lib/madmin/fields/attachments.rb +9 -0
  140. data/lib/madmin/fields/belongs_to.rb +29 -0
  141. data/lib/madmin/fields/boolean.rb +6 -0
  142. data/lib/madmin/fields/currency.rb +15 -0
  143. data/lib/madmin/fields/date.rb +6 -0
  144. data/lib/madmin/fields/date_time.rb +6 -0
  145. data/lib/madmin/fields/decimal.rb +6 -0
  146. data/lib/madmin/fields/enum.rb +9 -0
  147. data/lib/madmin/fields/file.rb +9 -0
  148. data/lib/madmin/fields/float.rb +6 -0
  149. data/lib/madmin/fields/has_many.rb +62 -0
  150. data/lib/madmin/fields/has_one.rb +10 -0
  151. data/lib/madmin/fields/integer.rb +6 -0
  152. data/lib/madmin/fields/json.rb +6 -0
  153. data/lib/madmin/fields/nested_has_many.rb +44 -0
  154. data/lib/madmin/fields/password.rb +6 -0
  155. data/lib/madmin/fields/polymorphic.rb +22 -0
  156. data/lib/madmin/fields/rich_text.rb +6 -0
  157. data/lib/madmin/fields/select.rb +9 -0
  158. data/lib/madmin/fields/string.rb +9 -0
  159. data/lib/madmin/fields/text.rb +9 -0
  160. data/lib/madmin/fields/time.rb +6 -0
  161. data/lib/madmin/generator_helpers.rb +59 -0
  162. data/lib/madmin/member_action.rb +19 -0
  163. data/lib/madmin/menu.rb +70 -0
  164. data/lib/madmin/namespace.rb +35 -0
  165. data/lib/madmin/resource.rb +295 -0
  166. data/lib/madmin/resource_builder.rb +88 -0
  167. data/lib/madmin/search.rb +62 -0
  168. data/lib/madmin/version.rb +3 -0
  169. data/lib/madmin/view_generator.rb +43 -0
  170. data/lib/madmin.rb +114 -0
  171. data/lib/tasks/madmin_tasks.rake +11 -0
  172. 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,6 @@
1
+ <% value = field.value(record) %>
2
+ <% if value.respond_to?(:url) %>
3
+ <%= link_to value.url, value.url, target: :_blank, class: "text-blue-500 underline" %>
4
+ <% else %>
5
+ <%= value %>
6
+ <% end %>
@@ -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,3 @@
1
+ <% if (object = field.value(record)) %>
2
+ <%= link_to Madmin.resource_for(object).display_name(object), Madmin.resource_for(object).show_path(object) %>
3
+ <% 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) %>
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,3 @@
1
+ <% if (object = field.value(record)) %>
2
+ <%= link_to Madmin.resource_for(object).display_name(object), Madmin.resource_for(object).show_path(object) %>
3
+ <% 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,3 @@
1
+ <div class="prose">
2
+ <%= field.value(record) %>
3
+ </div>
@@ -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,5 @@
1
+ <div>
2
+ <%= form.time_select field.attribute_name,
3
+ {},
4
+ class: "form-select inline-block" %>
5
+ </div>
@@ -0,0 +1 @@
1
+ <%= field.value(record) %>
@@ -0,0 +1 @@
1
+ <%= field.value(record) %>
@@ -0,0 +1,4 @@
1
+ <%= form.label field.attribute_name, field.options.label %>
2
+ <% if field.required? %>
3
+ <span class="required">*</span>
4
+ <% end %>
@@ -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
@@ -0,0 +1,3 @@
1
+ # Below are the routes for madmin
2
+ namespace :madmin do
3
+ end