madmin 0.1.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/MIT-LICENSE +1 -1
- data/README.md +50 -63
- data/Rakefile +5 -6
- data/app/assets/config/manifest.js +2 -0
- data/app/assets/stylesheets/actiontext.scss +36 -0
- data/app/assets/stylesheets/{madmin/application.css → application.css} +2 -9
- data/app/controllers/madmin/base_controller.rb +5 -9
- data/app/controllers/madmin/dashboard_controller.rb +1 -3
- data/app/controllers/madmin/resource_controller.rb +81 -0
- data/app/helpers/madmin/application_helper.rb +10 -8
- data/app/views/layouts/madmin/application.html.erb +23 -25
- data/app/views/madmin/application/_form.html.erb +25 -0
- data/app/views/madmin/application/_javascript.html.erb +24 -0
- data/app/views/madmin/application/_navigation.html.erb +6 -0
- data/app/views/madmin/application/edit.html.erb +3 -0
- data/app/views/madmin/application/index.html.erb +47 -0
- data/app/views/madmin/application/new.html.erb +3 -0
- data/app/views/madmin/application/show.html.erb +24 -0
- data/app/views/madmin/dashboard/show.html.erb +1 -0
- data/app/views/madmin/fields/attachment/_form.html.erb +2 -0
- data/app/views/madmin/fields/attachment/_index.html.erb +3 -0
- data/app/views/madmin/fields/attachment/_show.html.erb +3 -0
- data/app/views/madmin/fields/attachments/_form.html.erb +2 -0
- data/app/views/madmin/fields/attachments/_index.html.erb +1 -0
- data/app/views/madmin/fields/attachments/_show.html.erb +7 -0
- data/app/views/madmin/fields/belongs_to/_form.html.erb +2 -14
- data/app/views/madmin/fields/belongs_to/_index.html.erb +3 -7
- data/app/views/madmin/fields/belongs_to/_show.html.erb +3 -8
- data/app/views/madmin/fields/boolean/_form.html.erb +2 -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/date/_form.html.erb +2 -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 +2 -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 +2 -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 +2 -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/float/_form.html.erb +2 -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 +2 -0
- data/app/views/madmin/fields/has_many/_index.html.erb +1 -0
- data/app/views/madmin/fields/has_many/_show.html.erb +4 -14
- data/app/views/madmin/fields/has_one/_form.html.erb +3 -0
- data/app/views/madmin/fields/has_one/_index.html.erb +3 -0
- data/app/views/madmin/fields/has_one/_show.html.erb +3 -12
- data/app/views/madmin/fields/integer/_form.html.erb +2 -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 +2 -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/polymorphic/_form.html.erb +5 -32
- data/app/views/madmin/fields/polymorphic/_index.html.erb +3 -1
- data/app/views/madmin/fields/polymorphic/_show.html.erb +3 -14
- data/app/views/madmin/fields/rich_text/_form.html.erb +4 -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/string/_form.html.erb +2 -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 +2 -4
- data/app/views/madmin/fields/text/_index.html.erb +1 -1
- data/app/views/madmin/fields/text/_show.html.erb +1 -8
- data/app/views/madmin/fields/time/_form.html.erb +2 -0
- data/app/views/madmin/fields/time/_index.html.erb +1 -0
- data/app/views/madmin/fields/time/_show.html.erb +1 -0
- data/lib/generators/madmin/install/install_generator.rb +31 -12
- data/lib/generators/madmin/install/templates/controller.rb.tt +22 -0
- data/lib/generators/madmin/resource/resource_generator.rb +83 -47
- data/lib/generators/madmin/resource/templates/controller.rb.tt +4 -0
- data/lib/generators/madmin/resource/templates/resource.rb.tt +11 -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/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 +8 -8
- data/lib/madmin.rb +34 -23
- data/lib/madmin/engine.rb +5 -2
- data/lib/madmin/field.rb +22 -46
- data/lib/madmin/fields/attachment.rb +6 -0
- data/lib/madmin/fields/attachments.rb +9 -0
- data/lib/madmin/fields/belongs_to.rb +18 -0
- data/lib/madmin/fields/boolean.rb +6 -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/float.rb +6 -0
- data/lib/madmin/fields/has_many.rb +18 -0
- data/lib/madmin/fields/has_one.rb +6 -0
- data/lib/madmin/fields/integer.rb +6 -0
- data/lib/madmin/fields/json.rb +6 -0
- data/lib/madmin/fields/polymorphic.rb +17 -0
- data/lib/madmin/fields/rich_text.rb +6 -0
- data/lib/madmin/fields/string.rb +6 -0
- data/lib/madmin/fields/text.rb +6 -0
- data/lib/madmin/fields/time.rb +6 -0
- data/lib/madmin/generator_helpers.rb +24 -0
- data/lib/madmin/namespace.rb +35 -0
- data/lib/madmin/resource.rb +176 -0
- data/lib/madmin/version.rb +1 -1
- data/lib/madmin/view_generator.rb +42 -0
- data/lib/tasks/madmin_tasks.rake +7 -0
- metadata +106 -111
- data/app/assets/config/madmin_manifest.js +0 -2
- data/app/assets/javascripts/madmin/application.js +0 -15
- data/app/assets/javascripts/madmin/dashboard.js +0 -2
- data/app/assets/javascripts/madmin/resources.js +0 -36
- data/app/assets/stylesheets/madmin/dashboard.css +0 -4
- data/app/assets/stylesheets/madmin/resources.css +0 -4
- data/app/controllers/madmin/application_controller.rb +0 -16
- data/app/controllers/madmin/resources_controller.rb +0 -97
- data/app/decorators/madmin/resource_decorator.rb +0 -16
- data/app/helpers/madmin/fields/polymorphic_helper.rb +0 -25
- data/app/jobs/madmin/application_job.rb +0 -4
- data/app/mailers/madmin/application_mailer.rb +0 -6
- data/app/models/madmin/application_record.rb +0 -5
- data/app/views/application/_navigation.html.erb +0 -17
- data/app/views/madmin/dashboard/index.html.erb +0 -6
- data/app/views/madmin/fields/check_box/_form.html.erb +0 -4
- data/app/views/madmin/fields/check_box/_index.html.erb +0 -1
- data/app/views/madmin/fields/check_box/_show.html.erb +0 -8
- data/app/views/madmin/fields/email/_form.html.erb +0 -4
- data/app/views/madmin/fields/email/_index.html.erb +0 -1
- data/app/views/madmin/fields/email/_show.html.erb +0 -8
- data/app/views/madmin/fields/number/_form.html.erb +0 -4
- data/app/views/madmin/fields/number/_index.html.erb +0 -1
- data/app/views/madmin/fields/number/_show.html.erb +0 -8
- data/app/views/madmin/fields/password/_form.html.erb +0 -4
- data/app/views/madmin/fields/password/_index.html.erb +0 -1
- data/app/views/madmin/fields/password/_show.html.erb +0 -8
- data/app/views/madmin/fields/select/_form.html.erb +0 -4
- data/app/views/madmin/fields/select/_index.html.erb +0 -1
- data/app/views/madmin/fields/select/_show.html.erb +0 -8
- data/app/views/madmin/fields/text_area/_form.html.erb +0 -4
- data/app/views/madmin/fields/text_area/_index.html.erb +0 -1
- data/app/views/madmin/fields/text_area/_show.html.erb +0 -8
- data/app/views/madmin/resources/_form.html.erb +0 -15
- data/app/views/madmin/resources/_scopes.html.erb +0 -10
- data/app/views/madmin/resources/edit.html.erb +0 -2
- data/app/views/madmin/resources/index.html.erb +0 -13
- data/app/views/madmin/resources/index/_content.html.erb +0 -33
- data/app/views/madmin/resources/new.html.erb +0 -2
- data/app/views/madmin/resources/show.html.erb +0 -10
- data/config/routes.rb +0 -11
- data/lib/generators/madmin/controller/USAGE +0 -8
- data/lib/generators/madmin/controller/controller_generator.rb +0 -10
- data/lib/generators/madmin/page/USAGE +0 -8
- data/lib/generators/madmin/page/page_generator.rb +0 -20
- data/lib/generators/madmin/page/templates/template.html.erb +0 -2
- data/lib/generators/madmin/page/templates/template.rb.erb +0 -10
- data/lib/generators/madmin/resource/templates/resource.rb.erb +0 -11
- data/lib/madmin/field/associatable.rb +0 -58
- data/lib/madmin/field/belongs_to.rb +0 -9
- data/lib/madmin/field/check_box.rb +0 -8
- data/lib/madmin/field/date_time.rb +0 -8
- data/lib/madmin/field/email.rb +0 -8
- data/lib/madmin/field/has_many.rb +0 -9
- data/lib/madmin/field/has_one.rb +0 -9
- data/lib/madmin/field/number.rb +0 -8
- data/lib/madmin/field/password.rb +0 -8
- data/lib/madmin/field/polymorphic.rb +0 -57
- data/lib/madmin/field/select.rb +0 -13
- data/lib/madmin/field/text.rb +0 -8
- data/lib/madmin/field/text_area.rb +0 -8
- data/lib/madmin/resourceable.rb +0 -72
- data/lib/madmin/resourceable/class_methods.rb +0 -152
- data/lib/madmin/resources.rb +0 -13
@@ -0,0 +1,25 @@
|
|
1
|
+
<%= form_with model: [:madmin, record], url: (record.persisted? ? resource.show_path(record) : resource.index_path), local: true do |form| %>
|
2
|
+
<% if form.object.errors.any? %>
|
3
|
+
<div class="mb-4 rounded-md text-sm text-red-700 bg-red-100 p-4">
|
4
|
+
<div class="mb-2 font-medium leading-5 text-red-800">There was <%= pluralize form.object.errors.full_messages.count, "error" %> with your submission</div>
|
5
|
+
|
6
|
+
<% form.object.errors.full_messages.each do |message| %>
|
7
|
+
<div class="ml-4"><%= message %></div>
|
8
|
+
<% end %>
|
9
|
+
</div>
|
10
|
+
<% end %>
|
11
|
+
|
12
|
+
<% resource.attributes.each do |attribute| %>
|
13
|
+
<% next if attribute[:field].nil? %>
|
14
|
+
<% next unless attribute[:field].visible?(action_name) %>
|
15
|
+
<% next unless attribute[:field].visible?(:form) %>
|
16
|
+
|
17
|
+
<% field = attribute[:field] %>
|
18
|
+
|
19
|
+
<div class="mb-4 flex">
|
20
|
+
<%= render partial: field.to_partial_path("form"), locals: { field: field, record: record, form: form, resource: resource } %>
|
21
|
+
</div>
|
22
|
+
<% end %>
|
23
|
+
|
24
|
+
<%= form.submit class: "bg-white hover:bg-gray-100 text-gray-800 font-semibold py-2 px-4 border border-gray-400 rounded shadow" %>
|
25
|
+
<% end %>
|
@@ -0,0 +1,24 @@
|
|
1
|
+
<%= stylesheet_link_tag "https://cdn.skypack.dev/flatpickr/dist/flatpickr.min.css", "data-turbo-track": "reload" %>
|
2
|
+
<%= stylesheet_link_tag "https://cdn.skypack.dev/slim-select/dist/slimselect.min.css", "data-turbo-track": "reload" %>
|
3
|
+
<%= stylesheet_link_tag "https://cdn.skypack.dev/trix/dist/trix.css", "data-turbo-track": "reload" %>
|
4
|
+
|
5
|
+
<script type="module">
|
6
|
+
import { Application } from 'https://cdn.skypack.dev/stimulus'
|
7
|
+
const application = Application.start()
|
8
|
+
|
9
|
+
import stimulusFlatpickr from 'https://cdn.skypack.dev/stimulus-flatpickr'
|
10
|
+
application.register("flatpickr", stimulusFlatpickr)
|
11
|
+
|
12
|
+
import stimulusSlimselect from 'https://cdn.skypack.dev/stimulus-slimselect'
|
13
|
+
application.register("slimselect", stimulusSlimselect)
|
14
|
+
|
15
|
+
import Rails from 'https://cdn.skypack.dev/@rails/ujs@<%= npm_rails_version %>'
|
16
|
+
import * as ActiveStorage from 'https://cdn.skypack.dev/@rails/activestorage@<%= npm_rails_version %>'
|
17
|
+
import 'https://cdn.skypack.dev/trix'
|
18
|
+
import 'https://cdn.skypack.dev/@rails/actiontext@<%= npm_rails_version %>'
|
19
|
+
|
20
|
+
Rails.start()
|
21
|
+
ActiveStorage.start()
|
22
|
+
|
23
|
+
import * as Turbo from "https://cdn.skypack.dev/@hotwired/turbo"
|
24
|
+
</script>
|
@@ -0,0 +1,6 @@
|
|
1
|
+
<div class="text-sm">
|
2
|
+
<%= link_to "← Back to App", main_app.root_url, class: "block p-1", data: { turbo: false } if main_app.respond_to?(:root_url) %>
|
3
|
+
<% Madmin.resources.each do |resource| %>
|
4
|
+
<%= link_to resource.friendly_name.pluralize, resource.index_path, class: "block p-1" %>
|
5
|
+
<% end %>
|
6
|
+
</div>
|
@@ -0,0 +1,47 @@
|
|
1
|
+
<div class="flex justify-between">
|
2
|
+
<h1><%= resource.friendly_name.pluralize %></h1>
|
3
|
+
<%= link_to "New #{resource.friendly_name}", resource.new_path %>
|
4
|
+
</div>
|
5
|
+
|
6
|
+
<div>
|
7
|
+
<% if resource.scopes.any? %>
|
8
|
+
<%= link_to "All", resource.index_path %>
|
9
|
+
<% end %>
|
10
|
+
|
11
|
+
<% resource.scopes.each do |scope| %>
|
12
|
+
<%= link_to scope.to_s.humanize, resource.index_path(scope: scope) %>
|
13
|
+
<% end %>
|
14
|
+
</div>
|
15
|
+
|
16
|
+
<table class="table-auto">
|
17
|
+
<thead>
|
18
|
+
<tr>
|
19
|
+
<% resource.attributes.each do |attribute| %>
|
20
|
+
<% next if attribute[:field].nil? %>
|
21
|
+
<% next unless attribute[:field].visible?(action_name) %>
|
22
|
+
|
23
|
+
<th><%= attribute[:name].to_s.titleize %></th>
|
24
|
+
<% end %>
|
25
|
+
<th>Actions</th>
|
26
|
+
</tr>
|
27
|
+
</thead>
|
28
|
+
|
29
|
+
<tbody>
|
30
|
+
<% @records.each do |record| %>
|
31
|
+
<tr>
|
32
|
+
<% resource.attributes.each do |attribute| %>
|
33
|
+
<% next if attribute[:field].nil? %>
|
34
|
+
<% next unless attribute[:field].visible?(action_name) %>
|
35
|
+
|
36
|
+
<% field = attribute[:field] %>
|
37
|
+
|
38
|
+
<td><%= render partial: field.to_partial_path("index"), locals: { field: field, record: record } %></td>
|
39
|
+
<% end %>
|
40
|
+
|
41
|
+
<td><%= link_to "View", resource.show_path(record) %></td>
|
42
|
+
</tr>
|
43
|
+
<% end %>
|
44
|
+
</tbody>
|
45
|
+
</table>
|
46
|
+
|
47
|
+
<%== pagy_nav(@pagy) if @pagy.pages > 1 %>
|
@@ -0,0 +1,24 @@
|
|
1
|
+
<div class="flex justify-between">
|
2
|
+
<h1><%= link_to resource.friendly_name.pluralize, resource.index_path %> / <%= resource.model.name.singularize %> #<%= @record.id %></h1>
|
3
|
+
|
4
|
+
<div class="flex px-4">
|
5
|
+
<%= link_to "Edit", resource.edit_path(@record), class: "mr-2" %>
|
6
|
+
<%= button_to "Delete", resource.show_path(@record), method: :delete, data: { confirm: "Are you sure?" }, class: "inline-block" %>
|
7
|
+
</div>
|
8
|
+
</div>
|
9
|
+
|
10
|
+
<% resource.attributes.each do |attribute| %>
|
11
|
+
<% next if attribute[:field].nil? %>
|
12
|
+
<% next unless attribute[:field].visible?(action_name) %>
|
13
|
+
<% field = attribute[:field] %>
|
14
|
+
|
15
|
+
<div class="flex py-2">
|
16
|
+
<div class="w-32 flex-shrink-0 text-gray-700 uppercase tracking-wide text-sm">
|
17
|
+
<%= field.attribute_name.to_s.titleize %>
|
18
|
+
</div>
|
19
|
+
|
20
|
+
<div>
|
21
|
+
<%= render partial: field.to_partial_path("show"), locals: { field: field, record: @record } %>
|
22
|
+
</div>
|
23
|
+
</div>
|
24
|
+
<% end %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<h1>Madmin</h1>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= pluralize field.value(record).count, "attachment" %>
|
@@ -1,14 +1,2 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
<%=
|
4
|
-
form.select field.association_foreign_key,
|
5
|
-
options_from_collection_for_select(
|
6
|
-
field.association_collection,
|
7
|
-
:id,
|
8
|
-
field.association_display_value,
|
9
|
-
field.association_id_or_blank_for(resource)
|
10
|
-
),
|
11
|
-
{ include_blank: true },
|
12
|
-
class: 'form-control'
|
13
|
-
%>
|
14
|
-
</div>
|
1
|
+
<%= form.label field.attribute_name, class: "inline-block w-32 flex-shrink-0" %>
|
2
|
+
<%= form.select field.to_param, field.options_for_select(record), { prompt: true }, { class: "form-select", data: { controller: "slimselect", data: { controller: "slimselect" } } } %>
|
@@ -1,7 +1,3 @@
|
|
1
|
-
|
2
|
-
link_to
|
3
|
-
|
4
|
-
field.association_slug,
|
5
|
-
field.association_id_for(resource)
|
6
|
-
)
|
7
|
-
%>
|
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 %>
|
@@ -1,8 +1,3 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
</div>
|
5
|
-
<div class="col-9">
|
6
|
-
<%= field.association_value_for(resource) %>
|
7
|
-
</div>
|
8
|
-
</div>
|
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 @@
|
|
1
|
+
<%= field.value(record) %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= field.value(record) %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= field.value(record) %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= field.value(record) %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= field.value(record) %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= field.value(record) %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= field.value(record) %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= field.value(record) %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= field.value(record) %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= field.value(record) %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= field.value(record) %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= field.value(record) %>
|
@@ -0,0 +1,2 @@
|
|
1
|
+
<%= form.label field.attribute_name, class: "inline-block w-32 flex-shrink-0" %>
|
2
|
+
<%= form.select "#{field.attribute_name.to_s.singularize}_ids", field.options_for_select(record), { prompt: true }, { multiple: true, class: "form-select", data: { controller: "slimselect" } } %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= pluralize field.value(record).count, field.attribute_name.to_s %>
|
@@ -1,15 +1,5 @@
|
|
1
|
-
|
2
|
-
<div
|
3
|
-
|
4
|
-
<h3><%= field.label %></h3>
|
5
|
-
<%= link_to "Add", new_resource_path(field.association_slug, field.association_param => { field.association_foreign_key => resource.id }) %>
|
6
|
-
<%=
|
7
|
-
render "madmin/resources/index/content",
|
8
|
-
headers: [],
|
9
|
-
collection: field.value_for(resource),
|
10
|
-
madmin_resource: madmin_resource_for(model: field.association_class),
|
11
|
-
show_new_button: false
|
12
|
-
%>
|
13
|
-
</div>
|
1
|
+
<% field.value(record).each do |object| %>
|
2
|
+
<div>
|
3
|
+
<%= link_to Madmin.resource_for(object).display_name(object), Madmin.resource_for(object).show_path(object) %>
|
14
4
|
</div>
|
15
|
-
|
5
|
+
<% end %>
|
@@ -1,12 +1,3 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
<h3><%= field.name %></h3>
|
5
|
-
<% if !field.value %>
|
6
|
-
<%= link_to "Add", new_resource_path(madmin_resource_for(model: field.foreign_class).slug, ActiveModel::Naming.param_key(field.foreign_class) => { field.foreign_key => field.resource.id }) %>
|
7
|
-
<% else %>
|
8
|
-
<%= render "madmin/resources/index/content", headers: [], collection: [Madmin::ResourceDecorator.new(field.value)], show_new_button: false %>
|
9
|
-
<% end %>
|
10
|
-
</div>
|
11
|
-
</div>
|
12
|
-
</div>
|
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 @@
|
|
1
|
+
<%= field.value(record) %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= field.value(record) %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= field.value(record) %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= field.value(record) %>
|
@@ -1,32 +1,5 @@
|
|
1
|
-
|
2
|
-
<%=
|
3
|
-
<%=
|
4
|
-
|
5
|
-
|
6
|
-
{ include_blank: true },
|
7
|
-
id: field.polymorphic_type_param,
|
8
|
-
class: "form-control"
|
9
|
-
%>
|
10
|
-
<% if field.polymorphic_relationship_exists?(form.object) %>
|
11
|
-
<%=
|
12
|
-
form.select field.polymorphic_id_param,
|
13
|
-
polymorphic_options_for_selected_type(form: form, field: field),
|
14
|
-
{},
|
15
|
-
id: field.polymorphic_id_param,
|
16
|
-
class: "form-control"
|
17
|
-
%>
|
18
|
-
<% else %>
|
19
|
-
<%=
|
20
|
-
form.select field.polymorphic_id_param,
|
21
|
-
[],
|
22
|
-
{},
|
23
|
-
id: field.polymorphic_id_param,
|
24
|
-
class: "d-none form-control"
|
25
|
-
%>
|
26
|
-
<% end %>
|
27
|
-
</div>
|
28
|
-
|
29
|
-
<script>
|
30
|
-
window.polymorphicFields = window.polymorphicFields || [];
|
31
|
-
window.polymorphicFields.push('<%= field.key %>')
|
32
|
-
</script>
|
1
|
+
<%= form.fields_for field.attribute_name do |pf| %>
|
2
|
+
<%= pf.label field.attribute_name, class: "inline-block w-32 flex-shrink-0" %>
|
3
|
+
<%= pf.select :value, field.options_for_select(record).map(&:to_global_id), { selected: field.value(record)&.to_global_id, prompt: true }, { class: "form-select", data: { controller: "slimselect" } } %>
|
4
|
+
<%= pf.hidden_field :type, value: "polymorphic" %>
|
5
|
+
<% end %>
|
@@ -1 +1,3 @@
|
|
1
|
-
|
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 %>
|
@@ -1,14 +1,3 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
</div>
|
5
|
-
<div class="col-9">
|
6
|
-
<%=
|
7
|
-
link_to field.polymorphic_value_for(resource),
|
8
|
-
resource_path(
|
9
|
-
field.polymorphic_slug_for(resource),
|
10
|
-
field.polymorphic_id_for(resource)
|
11
|
-
)
|
12
|
-
%>
|
13
|
-
</div>
|
14
|
-
</div>
|
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 @@
|
|
1
|
+
<%= field.value(record) %>
|