administrate_tailwind_theme 0.0.1

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 (126) hide show
  1. checksums.yaml +7 -0
  2. data/.rubocop.yml +33 -0
  3. data/.ruby-version +1 -0
  4. data/.rubycritic.yml +5 -0
  5. data/CODE_OF_CONDUCT.md +84 -0
  6. data/LICENSE.txt +21 -0
  7. data/README.md +104 -0
  8. data/Rakefile +10 -0
  9. data/administrate_tailwind_theme.gemspec +33 -0
  10. data/app/assets/config/administrate_tailwind_theme_manifest.js +2 -0
  11. data/app/assets/images/administrate/tailwind/theme/.keep +0 -0
  12. data/app/assets/javascripts/administrate-tailwind-theme.js +1 -0
  13. data/app/assets/stylesheets/administrate-tailwind-theme.css +0 -0
  14. data/app/controllers/.keep +0 -0
  15. data/app/controllers/concerns/.keep +0 -0
  16. data/app/helpers/.keep +0 -0
  17. data/app/helpers/application_helper.rb +4 -0
  18. data/app/jobs/.keep +0 -0
  19. data/app/mailers/.keep +0 -0
  20. data/app/models/.keep +0 -0
  21. data/app/models/concerns/.keep +0 -0
  22. data/app/views/.keep +0 -0
  23. data/app/views/admin/application/_flashes.html.erb +29 -0
  24. data/app/views/admin/application/_icons.html.erb +13 -0
  25. data/app/views/admin/application/_javascript.html.erb +21 -0
  26. data/app/views/admin/application/_navigation.html.erb +39 -0
  27. data/app/views/admin/application/_stylesheet.html.erb +14 -0
  28. data/app/views/administrate/application/_collection.html.erb +78 -0
  29. data/app/views/administrate/application/_collection_header_actions.html.erb +5 -0
  30. data/app/views/administrate/application/_collection_item_actions.html.erb +22 -0
  31. data/app/views/administrate/application/_flashes.html.erb +35 -0
  32. data/app/views/administrate/application/_form.html.erb +58 -0
  33. data/app/views/administrate/application/_icons.html.erb +13 -0
  34. data/app/views/administrate/application/_index_header.html.erb +28 -0
  35. data/app/views/administrate/application/_javascript.html.erb +21 -0
  36. data/app/views/administrate/application/_navigation.html.erb +27 -0
  37. data/app/views/administrate/application/_pagination.html.erb +1 -0
  38. data/app/views/administrate/application/_search.html.erb +21 -0
  39. data/app/views/administrate/application/_stylesheet.html.erb +14 -0
  40. data/app/views/administrate/application/edit.html.erb +42 -0
  41. data/app/views/administrate/application/index.html.erb +49 -0
  42. data/app/views/administrate/application/new.html.erb +43 -0
  43. data/app/views/administrate/application/show.html.erb +71 -0
  44. data/app/views/administrate/navigation/icons/_comments.html.erb +4 -0
  45. data/app/views/administrate/navigation/icons/_messages.html.erb +4 -0
  46. data/app/views/administrate/navigation/icons/_users.erb +6 -0
  47. data/app/views/fields/belongs_to/_form.html.erb +29 -0
  48. data/app/views/fields/belongs_to/_index.html.erb +27 -0
  49. data/app/views/fields/belongs_to/_show.html.erb +28 -0
  50. data/app/views/fields/boolean/_form.html.erb +24 -0
  51. data/app/views/fields/boolean/_index.html.erb +19 -0
  52. data/app/views/fields/boolean/_show.html.erb +24 -0
  53. data/app/views/fields/boolean_emoji/_form.html.erb +7 -0
  54. data/app/views/fields/boolean_emoji/_index.html.erb +1 -0
  55. data/app/views/fields/boolean_emoji/_show.html.erb +3 -0
  56. data/app/views/fields/country_emoji/_form.html.erb +6 -0
  57. data/app/views/fields/country_emoji/_index.html.erb +1 -0
  58. data/app/views/fields/country_emoji/_show.html.erb +3 -0
  59. data/app/views/fields/date/_form.html.erb +23 -0
  60. data/app/views/fields/date/_index.html.erb +21 -0
  61. data/app/views/fields/date/_show.html.erb +23 -0
  62. data/app/views/fields/date_time/_form.html.erb +23 -0
  63. data/app/views/fields/date_time/_index.html.erb +21 -0
  64. data/app/views/fields/date_time/_show.html.erb +23 -0
  65. data/app/views/fields/email/_form.html.erb +23 -0
  66. data/app/views/fields/email/_index.html.erb +18 -0
  67. data/app/views/fields/email/_show.html.erb +20 -0
  68. data/app/views/fields/has_many/_form.html.erb +29 -0
  69. data/app/views/fields/has_many/_index.html.erb +19 -0
  70. data/app/views/fields/has_many/_show.html.erb +39 -0
  71. data/app/views/fields/has_one/_form.html.erb +39 -0
  72. data/app/views/fields/has_one/_index.html.erb +24 -0
  73. data/app/views/fields/has_one/_show.html.erb +48 -0
  74. data/app/views/fields/number/_form.html.erb +23 -0
  75. data/app/views/fields/number/_index.html.erb +19 -0
  76. data/app/views/fields/number/_show.html.erb +21 -0
  77. data/app/views/fields/password/_form.html.erb +23 -0
  78. data/app/views/fields/password/_index.html.erb +18 -0
  79. data/app/views/fields/password/_show.html.erb +20 -0
  80. data/app/views/fields/polymorphic/_form.html.erb +29 -0
  81. data/app/views/fields/polymorphic/_index.html.erb +27 -0
  82. data/app/views/fields/polymorphic/_show.html.erb +32 -0
  83. data/app/views/fields/select/_form.html.erb +31 -0
  84. data/app/views/fields/select/_index.html.erb +16 -0
  85. data/app/views/fields/select/_show.html.erb +18 -0
  86. data/app/views/fields/string/_form.html.erb +24 -0
  87. data/app/views/fields/string/_index.html.erb +18 -0
  88. data/app/views/fields/string/_show.html.erb +21 -0
  89. data/app/views/fields/text/_form.html.erb +22 -0
  90. data/app/views/fields/text/_index.html.erb +18 -0
  91. data/app/views/fields/text/_show.html.erb +20 -0
  92. data/app/views/fields/time/_form.html.erb +22 -0
  93. data/app/views/fields/time/_index.html.erb +19 -0
  94. data/app/views/fields/time/_show.html.erb +21 -0
  95. data/app/views/fields/url/_form.html.erb +23 -0
  96. data/app/views/fields/url/_index.html.erb +20 -0
  97. data/app/views/fields/url/_show.html.erb +22 -0
  98. data/app/views/kaminari/_first_page.html.erb +11 -0
  99. data/app/views/kaminari/_gap.html.erb +8 -0
  100. data/app/views/kaminari/_last_page.html.erb +11 -0
  101. data/app/views/kaminari/_next_page.html.erb +11 -0
  102. data/app/views/kaminari/_page.html.erb +12 -0
  103. data/app/views/kaminari/_paginator.html.erb +25 -0
  104. data/app/views/kaminari/_prev_page.html.erb +11 -0
  105. data/app/views/layouts/admin/application.html.erb +40 -0
  106. data/config/routes.rb +4 -0
  107. data/lib/administrate/field/boolean_emoji.rb +13 -0
  108. data/lib/administrate/field/country_emoji.rb +30 -0
  109. data/lib/administrate_tailwind_theme/engine.rb +15 -0
  110. data/lib/administrate_tailwind_theme/version.rb +5 -0
  111. data/lib/administrate_tailwind_theme/view_generator.rb +49 -0
  112. data/lib/administrate_tailwind_theme/view_helper.rb +22 -0
  113. data/lib/administrate_tailwind_theme.rb +9 -0
  114. data/lib/generators/administrate_tailwind_theme/install/USAGE +10 -0
  115. data/lib/generators/administrate_tailwind_theme/install/install_generator.rb +35 -0
  116. data/lib/generators/administrate_tailwind_theme/views/edit_generator.rb +18 -0
  117. data/lib/generators/administrate_tailwind_theme/views/field_generator.rb +52 -0
  118. data/lib/generators/administrate_tailwind_theme/views/form_generator.rb +17 -0
  119. data/lib/generators/administrate_tailwind_theme/views/index_generator.rb +18 -0
  120. data/lib/generators/administrate_tailwind_theme/views/layout_generator.rb +26 -0
  121. data/lib/generators/administrate_tailwind_theme/views/navigation_generator.rb +17 -0
  122. data/lib/generators/administrate_tailwind_theme/views/new_generator.rb +18 -0
  123. data/lib/generators/administrate_tailwind_theme/views/show_generator.rb +17 -0
  124. data/lib/generators/administrate_tailwind_theme/views/views_generator.rb +17 -0
  125. data/lib/tasks/administrate_tailwind/theme_tasks.rake +5 -0
  126. metadata +235 -0
@@ -0,0 +1,21 @@
1
+ <%#
2
+ # Date Index Partial
3
+
4
+ This partial renders a date attribute,
5
+ to be displayed on a resource's index page.
6
+
7
+ By default, the attribute is rendered
8
+ as a localized date string.
9
+
10
+ ## Local variables:
11
+
12
+ - `field`:
13
+ An instance of [Administrate::Field::Date][1].
14
+ A wrapper around the Date value pulled from the database.
15
+
16
+ [1]: http://www.rubydoc.info/gems/administrate/Administrate/Field/Date
17
+ %>
18
+
19
+ <% if field.data %>
20
+ <%= field.date %>
21
+ <% end %>
@@ -0,0 +1,23 @@
1
+ <%#
2
+ # Date Show Partial
3
+
4
+ This partial renders a date attribute,
5
+ to be displayed on a resource's show page.
6
+
7
+ By default, the attribute is rendered
8
+ as a localized date string.
9
+
10
+ ## Local variables:
11
+
12
+ - `field`:
13
+ An instance of [Administrate::Field::Date][1].
14
+ A wrapper around the Date value pulled from the database.
15
+
16
+ [1]: http://www.rubydoc.info/gems/administrate/Administrate/Field/Date
17
+ %>
18
+
19
+ <% if field.data %>
20
+ <div class="bg-gray-50 p-3 rounded-md shadow-sm">
21
+ <%= field.date %>
22
+ </div>
23
+ <% end %>
@@ -0,0 +1,23 @@
1
+ <%#
2
+ # DateTime Form Partial
3
+
4
+ This partial renders an input element for a datetime attribute.
5
+
6
+ ## Local variables:
7
+
8
+ - `f`:
9
+ A Rails form generator, used to help create the appropriate input fields.
10
+ - `field`:
11
+ An instance of [Administrate::Field::DateTime][1].
12
+ A wrapper around the DateTime value pulled from the database.
13
+
14
+ [1]: http://www.rubydoc.info/gems/administrate/Administrate/Field/DateTime
15
+ %>
16
+
17
+ <div class="mb-4">
18
+ <%= f.label field.attribute, class: "block text-sm font-medium text-gray-700" %>
19
+ <div class="mt-1">
20
+ <%= f.datetime_local_field field.attribute, step: 1, class: "shadow-sm focus:ring-indigo-500 focus:border-indigo-500 block w-full sm:text-sm border-gray-300 rounded-md" %>
21
+ </div>
22
+ </div>
23
+
@@ -0,0 +1,21 @@
1
+ <%#
2
+ # DateTime Index Partial
3
+
4
+ This partial renders a datetime attribute,
5
+ to be displayed on a resource's index page.
6
+
7
+ By default, the attribute is rendered
8
+ as a localized date & time string.
9
+
10
+ ## Local variables:
11
+
12
+ - `field`:
13
+ An instance of [Administrate::Field::DateTime][1].
14
+ A wrapper around the DateTime value pulled from the database.
15
+
16
+ [1]: http://www.rubydoc.info/gems/administrate/Administrate/Field/DateTime
17
+ %>
18
+
19
+ <% if field.data %>
20
+ <%= field.datetime %>
21
+ <% end %>
@@ -0,0 +1,23 @@
1
+ <%#
2
+ # DateTime Show Partial
3
+
4
+ This partial renders a datetime attribute,
5
+ to be displayed on a resource's show page.
6
+
7
+ By default, the attribute is rendered
8
+ as a localized date & time string.
9
+
10
+ ## Local variables:
11
+
12
+ - `field`:
13
+ An instance of [Administrate::Field::DateTime][1].
14
+ A wrapper around the DateTime value pulled from the database.
15
+
16
+ [1]: http://www.rubydoc.info/gems/administrate/Administrate/Field/DateTime
17
+ %>
18
+
19
+ <% if field.data %>
20
+ <div class="bg-gray-50 p-3 rounded-md shadow-sm">
21
+ <%= field.datetime %>
22
+ </div>
23
+ <% end %>
@@ -0,0 +1,23 @@
1
+ <%#
2
+ # Email Form Partial
3
+
4
+ This partial renders an input element for email addresses.
5
+ By default, the input is a text box.
6
+
7
+ ## Local variables:
8
+
9
+ - `f`:
10
+ A Rails form generator, used to help create the appropriate input fields.
11
+ - `field`:
12
+ An instance of [Administrate::Field::Email][1].
13
+ A wrapper around the email pulled from the database.
14
+
15
+ [1]: http://www.rubydoc.info/gems/administrate/Administrate/Field/Email
16
+ %>
17
+
18
+ <div class="mb-4">
19
+ <%= f.label field.attribute, class: "block text-sm font-medium text-gray-700" %>
20
+ <div class="mt-1">
21
+ <%= f.text_field field.attribute, type: :email, class: "shadow-sm focus:ring-indigo-500 focus:border-indigo-500 block w-full sm:text-sm border-gray-300 rounded-md" %>
22
+ </div>
23
+ </div>
@@ -0,0 +1,18 @@
1
+ <%#
2
+ # Email Index Partial
3
+
4
+ This partial renders an email address,
5
+ to be displayed on a resource's index page.
6
+
7
+ By default, the relationship is rendered as a `mailto` link.
8
+
9
+ ## Local variables:
10
+
11
+ - `field`:
12
+ An instance of [Administrate::Field::Email][1].
13
+ A wrapper around the email pulled from the database.
14
+
15
+ [1]: http://www.rubydoc.info/gems/administrate/Administrate/Field/Email
16
+ %>
17
+
18
+ <%= mail_to field.data %>
@@ -0,0 +1,20 @@
1
+ <%#
2
+ # Email Show Partial
3
+
4
+ This partial renders an email address,
5
+ to be displayed on a resource's show page.
6
+
7
+ By default, the relationship is rendered as a `mailto` link.
8
+
9
+ ## Local variables:
10
+
11
+ - `field`:
12
+ An instance of [Administrate::Field::Email][1].
13
+ A wrapper around the email pulled from the database.
14
+
15
+ [1]: http://www.rubydoc.info/gems/administrate/Administrate/Field/Email
16
+ %>
17
+
18
+ <div class="bg-gray-50 p-3 rounded-md shadow-sm">
19
+ <%= mail_to field.data %>
20
+ </div>
@@ -0,0 +1,29 @@
1
+ <%#
2
+ # HasMany Form Partial
3
+
4
+ This partial renders an input element for has_many relationships.
5
+ By default, the input is a collection select box
6
+ that displays all possible records to associate with.
7
+ The collection select box supports multiple inputs,
8
+ and is augmented with [Selectize].
9
+
10
+ ## Local variables:
11
+
12
+ - `f`:
13
+ A Rails form generator, used to help create the appropriate input fields.
14
+ - `field`:
15
+ An instance of [Administrate::Field::HasMany][1].
16
+ Contains helper methods for displaying a collection select box.
17
+
18
+ [1]: http://www.rubydoc.info/gems/administrate/Administrate/Field/HasMany
19
+ [Selectize]: http://brianreavis.github.io/selectize.js
20
+ %>
21
+
22
+ <div class="bg-gray-50 p-3 rounded-md shadow-sm">
23
+ <%= f.label field.attribute, for: "#{f.object_name}_#{field.attribute_key}" %>
24
+ </div>
25
+ <div class="bg-gray-50 p-3 rounded-md shadow-sm">
26
+ <%= f.select(field.attribute_key, nil, {}, multiple: true, class: "form-select block w-full py-2 px-3 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm") do %>
27
+ <%= options_for_select(field.associated_resource_options, field.selected_options) %>
28
+ <% end %>
29
+ </div>
@@ -0,0 +1,19 @@
1
+ <%#
2
+ # HasMany Index Partial
3
+
4
+ This partial renders a has_many relationship,
5
+ to be displayed on a resource's index page.
6
+
7
+ By default, the relationship is rendered
8
+ as a count of how many objects are associated through the relationship.
9
+
10
+ ## Local variables:
11
+
12
+ - `field`:
13
+ An instance of [Administrate::Field::HasMany][1].
14
+ A wrapper around the has_many relationship pulled from the database.
15
+
16
+ [1]: http://www.rubydoc.info/gems/administrate/Administrate/Field/HasMany
17
+ %>
18
+
19
+ <%= pluralize(field.data.size, t("activerecord.models.#{field.attribute.to_s.singularize}", default: field.attribute.to_s.humanize.downcase.singularize, count: field.data.size)) %>
@@ -0,0 +1,39 @@
1
+ <%#
2
+ # HasMany Show Partial
3
+
4
+ This partial renders a has_many relationship,
5
+ to be displayed on a resource's show page.
6
+
7
+ By default, the relationship is rendered
8
+ as a table of the first few associated resources.
9
+ The columns of the table are taken
10
+ from the associated resource class's dashboard.
11
+
12
+ ## Local variables:
13
+
14
+ - `field`:
15
+ An instance of [Administrate::Field::HasMany][1].
16
+ Contains methods to help display a table of associated resources.
17
+
18
+ [1]: http://www.rubydoc.info/gems/administrate/Administrate/Field/HasMany
19
+ %>
20
+
21
+ <% if field.resources.any? %>
22
+ <% order = field.order_from_params(params.fetch(field.name, {})) %>
23
+ <% page_number = params.fetch(field.name, {}).fetch(:page, nil) %>
24
+ <%= render(
25
+ "collection",
26
+ collection_presenter: field.associated_collection(order),
27
+ collection_field_name: field.name,
28
+ page: page,
29
+ resources: field.resources(page_number, order),
30
+ table_title: field.name,
31
+ resource_class: field.associated_class,
32
+ ) %>
33
+ <% if field.more_than_limit? %>
34
+ <%= render("pagination", resources: field.resources(page_number), param_name: "#{field.name}[page]") %>
35
+ <% end %>
36
+
37
+ <% else %>
38
+ <%= t("administrate.fields.has_many.none", default: "–") %>
39
+ <% end %>
@@ -0,0 +1,39 @@
1
+ <%#
2
+ # HasOne Form Partial
3
+
4
+ This partial renders an input element for has_one relationships.
5
+
6
+ The form will be rendered as nested_from to parent relationship.
7
+
8
+ ## Local variables:
9
+
10
+ - `f`:
11
+ A Rails form generator, used to help create the appropriate input fields.
12
+ - `field`:
13
+ An instance of [Administrate::Field::HasOne][1].
14
+ A wrapper around the has_one relationship pulled from the database.
15
+
16
+ [1]: http://www.rubydoc.info/gems/administrate/Administrate/Field/HasOne
17
+ %>
18
+
19
+ <%= f.fields_for field.attribute, field.data || field.nested_form.resource.class.new do |has_one_f| %>
20
+ <fieldset class="bg-gray-50 p-3 rounded-md shadow-sm">
21
+ <legend class="text-gray-800 font-semibold"><%= t "helpers.label.#{f.object_name}.#{field.name}", default: field.name.titleize %></legend>
22
+ <% field.nested_form.attributes.each do |title, attributes| -%>
23
+
24
+ <fieldset class="<%= "bg-white p-3 rounded-md shadow-sm" if title.present? %>">
25
+ <% if title.present? %>
26
+ <legend class="text-gray-800 font-semibold"><%= t "helpers.label.#{f.object_name}.#{title}", default: title %></legend>
27
+ <% end %>
28
+
29
+ <% attributes.each do |attribute| %>
30
+ <div class="bg-white p-3 rounded-md shadow-sm">
31
+ <%= render_field attribute, f: has_one_f %>
32
+ </div>
33
+ <% end %>
34
+ </fieldset>
35
+
36
+ <% end -%>
37
+ </fieldset>
38
+ <% end %>
39
+
@@ -0,0 +1,24 @@
1
+ <%#
2
+ # HasOne Index Partial
3
+
4
+ This partial renders a has_one relationship,
5
+ to be displayed on a resource's index page.
6
+
7
+ By default, the relationship is rendered as a link to the associated object.
8
+
9
+ ## Local variables:
10
+
11
+ - `field`:
12
+ An instance of [Administrate::Field::HasOne][1].
13
+ A wrapper around the has_one relationship pulled from the database.
14
+
15
+ [1]: http://www.rubydoc.info/gems/administrate/Administrate/Field/HasOne
16
+ %>
17
+
18
+ <% if field.linkable? %>
19
+ <%= link_to_if(
20
+ accessible_action?(field.data, :show),
21
+ field.display_associated_resource,
22
+ [namespace, field.data],
23
+ ) %>
24
+ <% end %>
@@ -0,0 +1,48 @@
1
+ <%#
2
+ # HasOne Show Partial
3
+
4
+ This partial renders a has_one relationship,
5
+ to be displayed on a resource's show page.
6
+
7
+ All show page attributes of has_one relationship would be rendered
8
+
9
+ ## Local variables:
10
+
11
+ - `field`:
12
+ An instance of [Administrate::Field::HasOne][1].
13
+ A wrapper around the has_one relationship pulled from the database.
14
+
15
+ [1]: http://www.rubydoc.info/gems/administrate/Administrate/Field/HasOne
16
+ %>
17
+
18
+ <% if field.linkable? %>
19
+ <fieldset class="bg-gray-50 p-3 rounded-md shadow-sm">
20
+ <legend>
21
+ <%= link_to_if(
22
+ accessible_action?(field.data, :show),
23
+ field.display_associated_resource,
24
+ [namespace, field.data],
25
+ ) %>
26
+ </legend>
27
+ <% field.nested_show.attributes.each do |title, attributes| -%>
28
+ <fieldset class="<%= "bg-white p-3 rounded-md shadow-sm" if title.present? %>">
29
+ <% if title.present? %>
30
+ <legend class="text-gray-800 font-semibold"><%= t "helpers.label.#{namespace}.#{title}", default: title %></legend>
31
+ <% end %>
32
+
33
+ <% attributes.each do |attribute| %>
34
+ <dt class="text-sm font-medium text-gray-500">
35
+ <%= t(
36
+ "helpers.label.#{field.associated_class_name.underscore}.#{attribute.name}",
37
+ default: attribute.name.titleize,
38
+ ) %>
39
+ </dt>
40
+ <dd class="mt-1 text-sm text-gray-900">
41
+ <%= render_field attribute, { page: page } %>
42
+ </dd>
43
+ <% end %>
44
+ </fieldset>
45
+ <% end -%>
46
+ </fieldset>
47
+ <% end %>
48
+
@@ -0,0 +1,23 @@
1
+ <%#
2
+ # Number Form Partial
3
+
4
+ This partial renders an input element for number attributes.
5
+ By default, the input is a text field.
6
+
7
+ ## Local variables:
8
+
9
+ - `f`:
10
+ A Rails form generator, used to help create the appropriate input fields.
11
+ - `field`:
12
+ An instance of [Administrate::Field::Number][1].
13
+ A wrapper around the number pulled from the database.
14
+
15
+ [1]: http://www.rubydoc.info/gems/administrate/Administrate/Field/Number
16
+ %>
17
+
18
+ <div class="mb-4">
19
+ <%= f.label field.attribute, class: "block text-sm font-medium text-gray-700" %>
20
+ <div class="mt-1">
21
+ <%= f.text_field field.attribute, type: :number, class: "shadow-sm focus:ring-indigo-500 focus:border-indigo-500 block w-full sm:text-sm border-gray-300 rounded-md" %>
22
+ </div>
23
+ </div>
@@ -0,0 +1,19 @@
1
+ <%#
2
+ # Number Index Partial
3
+
4
+ This partial renders a number attribute,
5
+ to be displayed on a resource's index page.
6
+
7
+ By default, the attribute is rendered
8
+ using the formatting options given in the resource's dashboard.
9
+
10
+ ## Local variables:
11
+
12
+ - `field`:
13
+ An instance of [Administrate::Field::Number][1].
14
+ A wrapper around the number pulled from the database.
15
+
16
+ [1]: http://www.rubydoc.info/gems/administrate/Administrate/Field/Number
17
+ %>
18
+
19
+ <%= field.to_s %>
@@ -0,0 +1,21 @@
1
+ <%#
2
+ # Number Show Partial
3
+
4
+ This partial renders a number attribute,
5
+ to be displayed on a resource's show page.
6
+
7
+ By default, the attribute is rendered
8
+ using the formatting options given in the resource's dashboard.
9
+
10
+ ## Local variables:
11
+
12
+ - `field`:
13
+ An instance of [Administrate::Field::Number][1].
14
+ A wrapper around the number pulled from the database.
15
+
16
+ [1]: http://www.rubydoc.info/gems/administrate/Administrate/Field/Number
17
+ %>
18
+
19
+ <div class="bg-gray-50 p-3 rounded-md shadow-sm">
20
+ <%= field.to_s %>
21
+ </div>
@@ -0,0 +1,23 @@
1
+ <%#
2
+ # Password Form Partial
3
+
4
+ This partial renders an input element for a password attribute.
5
+ By default, the input is a password field.
6
+
7
+ ## Local variables:
8
+
9
+ - `f`:
10
+ A Rails form generator, used to help create the appropriate input fields.
11
+ - `field`:
12
+ An instance of [Administrate::Field::Password][1].
13
+ A wrapper around the Password.
14
+
15
+ [1]: http://www.rubydoc.info/gems/administrate/Administrate/Field/Password
16
+ %>
17
+
18
+ <div class="mb-4">
19
+ <%= f.label field.attribute, class: "block text-sm font-medium text-gray-700" %>
20
+ <div class="mt-1">
21
+ <%= f.password_field field.attribute, value: field.data, class: "shadow-sm focus:ring-indigo-500 focus:border-indigo-500 block w-full sm:text-sm border-gray-300 rounded-md" %>
22
+ </div>
23
+ </div>
@@ -0,0 +1,18 @@
1
+ <%#
2
+ # Password Index Partial
3
+
4
+ This partial renders a password attribute
5
+ to be displayed on a resource's index page.
6
+
7
+ By default, the attribute is rendered as a truncated string.
8
+
9
+ ## Local variables:
10
+
11
+ - `field`:
12
+ An instance of [Administrate::Field::Password][1].
13
+ A wrapper around the Password.
14
+
15
+ [1]: http://www.rubydoc.info/gems/administrate/Administrate/Field/Password
16
+ %>
17
+
18
+ <%= field.truncate %>
@@ -0,0 +1,20 @@
1
+ <%#
2
+ # Password Show Partial
3
+
4
+ This partial renders a password attribute,
5
+ to be displayed on a resource's show page.
6
+
7
+ By default, the attribute is rendered as an truncate string.
8
+
9
+ ## Local variables:
10
+
11
+ - `field`:
12
+ An instance of [Administrate::Field::Password][1].
13
+ A wrapper around the Password.
14
+
15
+ [1]: http://www.rubydoc.info/gems/administrate/Administrate/Field/Password
16
+ %>
17
+
18
+ <div class="bg-gray-50 p-3 rounded-md shadow-sm">
19
+ <%= field.truncate %>
20
+ </div>
@@ -0,0 +1,29 @@
1
+ <%#
2
+ # Polymorphic Form Partial
3
+
4
+ This partial renders an input element for polymorphic relationships.
5
+
6
+ ## Local variables:
7
+
8
+ - `f`:
9
+ A Rails form generator, used to help create the appropriate input fields.
10
+ - `field`:
11
+ An instance of [Administrate::Field::Polymorphic][1].
12
+ A wrapper around the polymorphic belongs_to relationship
13
+ pulled from the database.
14
+
15
+ [1]: http://www.rubydoc.info/gems/administrate/Administrate/Field/Polymorphic
16
+ %>
17
+
18
+ <%= f.fields_for field.attribute do |pf| %>
19
+ <div class="mb-4">
20
+ <%= pf.label :value, field.name.humanize, class: "block text-sm font-medium text-gray-700" %>
21
+ <div class="mt-1">
22
+ <%= pf.hidden_field(:type, value: field.class.name, class: "shadow-sm focus:ring-indigo-500 focus:border-indigo-500 block w-full sm:text-sm border-gray-300 rounded-md") %>
23
+ <%= pf.select(:value, {}, {}, class: "mt-1 block w-full py-2 px-3 border border-gray-300 bg-white rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm") do %>
24
+ <%= grouped_options_for_select(field.associated_resource_grouped_options, field.selected_global_id, prompt: true) %>
25
+ <% end %>
26
+ </div>
27
+ </div>
28
+ <% end %>
29
+
@@ -0,0 +1,27 @@
1
+ <%#
2
+ # Polymorphic Index Partial
3
+
4
+ This partial renders a polymorphic relationship,
5
+ to be displayed on a resource's index page.
6
+
7
+ By default, the relationship is rendered as a link to the associated object.
8
+
9
+ ## Local variables:
10
+
11
+ - `field`:
12
+ An instance of [Administrate::Field::Polymorphic][1].
13
+ A wrapper around the polymorphic belongs_to relationship
14
+ pulled from the database.
15
+
16
+ [1]: http://www.rubydoc.info/gems/administrate/Administrate/Field/Polymorphic
17
+ %>
18
+
19
+ <% if field.data %>
20
+ <%= link_to_if(
21
+ accessible_action?(field.data, :show),
22
+ field.display_associated_resource,
23
+ [namespace, field.data],
24
+ class: "text-blue-600 hover:text-blue-800 visited:text-purple-600"
25
+ ) %>
26
+ <% end %>
27
+
@@ -0,0 +1,32 @@
1
+ <%#
2
+ # Polymorphic Show Partial
3
+
4
+ This partial renders a polymorphic relationship,
5
+ to be displayed on a resource's show page.
6
+
7
+ By default, the relationship is rendered as a link to the associated object.
8
+
9
+ ## Local variables:
10
+
11
+ - `field`:
12
+ An instance of [Administrate::Field::Polymorphic][1].
13
+ A wrapper around the polymorphic belongs_to relationship
14
+ pulled from the database.
15
+
16
+ [1]: http://www.rubydoc.info/gems/administrate/Administrate/Field/Polymorphic
17
+ %>
18
+
19
+ <% if field.data %>
20
+ <% if accessible_action?(field.data, :show) %>
21
+ <%= link_to(
22
+ field.display_associated_resource,
23
+ [namespace, field.data],
24
+ class: "text-blue-600 hover:text-blue-800 visited:text-purple-600"
25
+ ) %>
26
+ <% else %>
27
+ <span class="text-gray-900">
28
+ <%= field.display_associated_resource %>
29
+ </span>
30
+ <% end %>
31
+ <% end %>
32
+
@@ -0,0 +1,31 @@
1
+ <%#
2
+ # Select Form Partial
3
+
4
+ This partial renders a selectable text attribute,
5
+ to be displayed on a resource's edit form page.
6
+
7
+ ## Local variables:
8
+
9
+ - `f`:
10
+ A Rails form generator, used to help create the appropriate input fields.
11
+ - `field`:
12
+ An instance of [Administrate::Field::Select][1].
13
+ A wrapper around the attribute pulled from the database.
14
+
15
+ [1]: http://www.rubydoc.info/gems/administrate/Administrate/Field/Select
16
+ %>
17
+
18
+ <div class="mb-4">
19
+ <%= f.label field.attribute, class: "block text-sm font-medium text-gray-700" %>
20
+ <div class="mt-1">
21
+ <%= f.select(
22
+ field.attribute,
23
+ options_for_select(
24
+ field.selectable_options,
25
+ field.data,
26
+ ),
27
+ { include_blank: field.include_blank_option },
28
+ { class: "form-select block w-full py-2 px-3 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm" }
29
+ ) %>
30
+ </div>
31
+ </div>
@@ -0,0 +1,16 @@
1
+ <%#
2
+ # Select Index Partial
3
+
4
+ This partial renders a selectable text attribute,
5
+ to be displayed on a resource's index page.
6
+
7
+ ## Local variables:
8
+
9
+ - `field`:
10
+ An instance of [Administrate::Field::Select][1].
11
+ A wrapper around the attribute pulled from the database.
12
+
13
+ [1]: http://www.rubydoc.info/gems/administrate/Administrate/Field/Select
14
+ %>
15
+
16
+ <%= field.data %>