administrate_tailwind_theme 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
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
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 52604e8e7aa5d828923b336c583959f5e83347ee14333627bbe3decc894e03d5
4
+ data.tar.gz: f80598a8f02c25492ad46c8cfb92b10ce019f017abfed2ffd78f7c4c230b6aac
5
+ SHA512:
6
+ metadata.gz: 19956cc2022698622a79c88c53bf6952bd7b4b18f05ac4596995850d7188a6789a89cb55ca7e11d7fa6a0eac364df524a6fb9fd745027ad5001aaffe2abe0bfc
7
+ data.tar.gz: f6568c5639907ba658e8fa3f9dc027a78ccf3885d08d838927661949da3fc00355a5091ba87501dc25c1d7018674b853d5c617368242bde18a7857cb9e52a944
data/.rubocop.yml ADDED
@@ -0,0 +1,33 @@
1
+ AllCops:
2
+ Exclude:
3
+ - 'administrate_tailwind_theme.gemspec'
4
+ - 'test/dummy/**/*.rb'
5
+ - 'vendor/**/*'
6
+ NewCops: enable
7
+ TargetRubyVersion: 3.0
8
+
9
+ Style/StringLiterals:
10
+ Enabled: true
11
+ EnforcedStyle: single_quotes
12
+
13
+ Style/Documentation:
14
+ Enabled: false
15
+
16
+ Style/StringLiteralsInInterpolation:
17
+ Enabled: true
18
+ EnforcedStyle: double_quotes
19
+
20
+ Layout/LineLength:
21
+ Max: 120
22
+
23
+ Metrics/AbcSize:
24
+ Max: 30
25
+
26
+ Metrics/MethodLength:
27
+ Max: 30
28
+
29
+ Metrics/BlockLength:
30
+ Max: 100
31
+
32
+ Metrics/ParameterLists:
33
+ Max: 6
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 3.2.2
data/.rubycritic.yml ADDED
@@ -0,0 +1,5 @@
1
+ minimum_score: 90
2
+ paths:
3
+ - 'lib/'
4
+ - 'app/'
5
+ no_browser: true
@@ -0,0 +1,84 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
+
7
+ We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8
+
9
+ ## Our Standards
10
+
11
+ Examples of behavior that contributes to a positive environment for our community include:
12
+
13
+ * Demonstrating empathy and kindness toward other people
14
+ * Being respectful of differing opinions, viewpoints, and experiences
15
+ * Giving and gracefully accepting constructive feedback
16
+ * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17
+ * Focusing on what is best not just for us as individuals, but for the overall community
18
+
19
+ Examples of unacceptable behavior include:
20
+
21
+ * The use of sexualized language or imagery, and sexual attention or
22
+ advances of any kind
23
+ * Trolling, insulting or derogatory comments, and personal or political attacks
24
+ * Public or private harassment
25
+ * Publishing others' private information, such as a physical or email
26
+ address, without their explicit permission
27
+ * Other conduct which could reasonably be considered inappropriate in a
28
+ professional setting
29
+
30
+ ## Enforcement Responsibilities
31
+
32
+ Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
33
+
34
+ Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
35
+
36
+ ## Scope
37
+
38
+ This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
39
+
40
+ ## Enforcement
41
+
42
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at eth3rnit3@gmail.com. All complaints will be reviewed and investigated promptly and fairly.
43
+
44
+ All community leaders are obligated to respect the privacy and security of the reporter of any incident.
45
+
46
+ ## Enforcement Guidelines
47
+
48
+ Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
49
+
50
+ ### 1. Correction
51
+
52
+ **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
53
+
54
+ **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
55
+
56
+ ### 2. Warning
57
+
58
+ **Community Impact**: A violation through a single incident or series of actions.
59
+
60
+ **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
61
+
62
+ ### 3. Temporary Ban
63
+
64
+ **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
65
+
66
+ **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
67
+
68
+ ### 4. Permanent Ban
69
+
70
+ **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
71
+
72
+ **Consequence**: A permanent ban from any sort of public interaction within the community.
73
+
74
+ ## Attribution
75
+
76
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
77
+ available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
78
+
79
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
80
+
81
+ [homepage]: https://www.contributor-covenant.org
82
+
83
+ For answers to common questions about this code of conduct, see the FAQ at
84
+ https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2024 Eth3rnit3
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,104 @@
1
+ # administrate_tailwind_theme Gem
2
+
3
+ ## Introduction
4
+ `administrate_tailwind_theme` is a custom theme gem for the [Administrate](https://github.com/thoughtbot/administrate) gem, utilizing the [Tailwind CSS](https://tailwindcss.com/) framework. This gem revamps all views to use Tailwind CSS classes, enhancing the visual aesthetics and responsiveness of your Administrate dashboard. It also introduces additional fields like BooleanEmoji and CountryEmoji for a richer admin interface.
5
+
6
+ ### Features
7
+ - **Tailwind CSS Integration:** Complete rewrite of Administrate component classes to use Tailwind CSS.
8
+ - **Additional Fields:** Adds BooleanEmoji and CountryEmoji fields to your Administrate dashboard.
9
+ - **Easy Setup:** Automatic initializer creation and configuration.
10
+ - **Rails 7, Rails-Tailwind, and Administrate Compatibility:** Seamlessly works with the latest versions of these key gems.
11
+
12
+ ## Installation
13
+ ### Prerequisites
14
+ - Ruby version 2.6.0 or higher.
15
+ - Rails 7.1 or higher.
16
+ - Administrate 0.15 or higher.
17
+ - Tailwind CSS Rails 2.0 or higher.
18
+
19
+ ### Setup
20
+ 1. Add this line to your application's Gemfile:
21
+
22
+ ```ruby
23
+ gem 'administrate_tailwind_theme'
24
+ ```
25
+
26
+ 2. Execute:
27
+
28
+ ```
29
+ bundle install
30
+ ```
31
+
32
+ 3. After installing the gem, run the installer:
33
+
34
+ ```
35
+ rails generate administrate_tailwind_theme:install
36
+ ```
37
+
38
+ This will create an initializer and modify your `tailwind.config.js` to ensure proper compilation of the gem's view styles.
39
+
40
+ ## Usage
41
+
42
+ Once installed, `administrate_tailwind_theme` automatically overrides the default Administrate views. Your dashboard will now use Tailwind CSS styles. You can further customize the styles as per your application's needs.
43
+
44
+ ### Custom Fields
45
+ #### BooleanEmoji Field
46
+ The `BooleanEmoji` field can be used to display boolean values with emojis for a more intuitive representation.
47
+
48
+ Example usage in a dashboard resource file:
49
+ ```ruby
50
+ ATTRIBUTE_TYPES = {
51
+ some_boolean_field: Field::BooleanEmoji,
52
+ # ...
53
+ }.freeze
54
+ ```
55
+
56
+ #### CountryEmoji Field
57
+ The `CountryEmoji` field is designed to display country codes with their corresponding emoji flags for a visual representation. It utilizes the iso_country_codes gem.
58
+
59
+ Example usage in a dashboard resource file:
60
+ ```ruby
61
+ ATTRIBUTE_TYPES = {
62
+ country_code: Field::CountryEmoji, # iso2
63
+ # ...
64
+ }.freeze
65
+ ```
66
+
67
+ ### Themed views
68
+ Like [Administrate](https://github.com/thoughtbot/administrate) you can generate views to customize
69
+ ```shell
70
+ ./bin/rails g --help
71
+ ...
72
+ AdministrateTailwindTheme:
73
+ administrate_tailwind_theme:install
74
+ administrate_tailwind_theme:view
75
+ administrate_tailwind_theme:views
76
+ administrate_tailwind_theme:views:edit
77
+ administrate_tailwind_theme:views:field
78
+ administrate_tailwind_theme:views:form
79
+ administrate_tailwind_theme:views:index
80
+ administrate_tailwind_theme:views:layout
81
+ administrate_tailwind_theme:views:navigation
82
+ administrate_tailwind_theme:views:new
83
+ administrate_tailwind_theme:views:show
84
+ ```
85
+
86
+ ## Configuration
87
+
88
+ After installation, you can modify the initializer created by the `administrate_tailwind_theme:install` generator to fine-tune the theme settings.
89
+
90
+ For modifying `tailwind.config.js`, we've followed the approach suggested in this [Stack Overflow comment](https://stackoverflow.com/a/74737193/8213274). Even though it might not be the most elegant solution, it's straightforward and works effectively.
91
+
92
+ Also, ensure your `tailwind.config.js` includes the styles from this gem for proper compilation.
93
+
94
+ ## Contributing
95
+
96
+ Contributions are welcome! Please feel free to submit pull requests or open issues on our [GitHub repository](https://github.com/eth3rnit3/administrate_tailwind_theme).
97
+
98
+ ## License
99
+
100
+ This gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
101
+
102
+ ## About
103
+
104
+ This gem is maintained by Eth3rnit3. Feel free to contact at [eth3rnit3@gmail.com](mailto:eth3rnit3@gmail.com) for any queries or feedback.
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/setup'
4
+
5
+ APP_RAKEFILE = File.expand_path('test/dummy/Rakefile', __dir__)
6
+ load 'rails/tasks/engine.rake'
7
+
8
+ load 'rails/tasks/statistics.rake'
9
+
10
+ require 'bundler/gem_tasks'
@@ -0,0 +1,33 @@
1
+ require_relative 'lib/administrate_tailwind_theme/version'
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = 'administrate_tailwind_theme'
5
+ spec.version = AdministrateTailwindTheme::VERSION
6
+ spec.authors = ['Eth3rnit3']
7
+ spec.email = ['eth3rnit3@gmail.com']
8
+
9
+ spec.summary = 'A Tailwind CSS theme for the Administrate gem.'
10
+ spec.description = 'This gem provides a custom Tailwind CSS theme for the Administrate gem used in Rails applications. It allows for easy integration and styling of the Administrate dashboard with Tailwind CSS.'
11
+ spec.homepage = 'https://github.com/eth3rnit3/administrate-tailwind-theme'
12
+ spec.license = 'MIT'
13
+ spec.required_ruby_version = '>= 2.6.0'
14
+
15
+ spec.metadata['allowed_push_host'] = 'https://rubygems.org'
16
+
17
+ spec.metadata['homepage_uri'] = spec.homepage
18
+ spec.metadata['source_code_uri'] = 'https://github.com/eth3rnit3/administrate-tailwind-theme'
19
+ spec.metadata['changelog_uri'] = 'https://github.com/eth3rnit3/administrate-tailwind-theme/blob/main/CHANGELOG.md'
20
+
21
+ spec.files = Dir.chdir(__dir__) do
22
+ `git ls-files -z`.split("\x0").reject do |f|
23
+ (File.expand_path(f) == __FILE__) ||
24
+ f.start_with?(*%w[bin/ test/ spec/ features/ .git .circleci appveyor Gemfile])
25
+ end
26
+ end
27
+ spec.files += Dir.glob('vendor/assets/**/*')
28
+
29
+ spec.add_dependency 'administrate', '~> 0.15'
30
+ spec.add_dependency 'iso_country_codes', '~> 0.7.8'
31
+ spec.add_runtime_dependency 'rails', '~> 7.1', '>= 7.1.3'
32
+ spec.add_dependency 'tailwindcss-rails', '~> 2.0'
33
+ end
@@ -0,0 +1,2 @@
1
+ //= link administrate-tailwind-theme.css
2
+ //= link administrate-tailwind-theme.js
@@ -0,0 +1 @@
1
+ console.log('Hello from theme')
File without changes
File without changes
data/app/helpers/.keep ADDED
File without changes
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ApplicationHelper
4
+ end
data/app/jobs/.keep ADDED
File without changes
data/app/mailers/.keep ADDED
File without changes
data/app/models/.keep ADDED
File without changes
File without changes
data/app/views/.keep ADDED
File without changes
@@ -0,0 +1,29 @@
1
+ <%#
2
+ # Flash Partial
3
+
4
+ This partial renders flash messages on every page.
5
+
6
+ ## Relevant Helpers:
7
+
8
+ - `flash`:
9
+ Returns a hash,
10
+ where the keys are the type of flash (alert, error, notice, etc)
11
+ and the values are the message to be displayed.
12
+ %>
13
+ <% if flash.any? %>
14
+ <div class="flashes">
15
+ <% flash.each do |key, value| -%>
16
+ <% next unless value.respond_to?(:html_safe) %>
17
+ <div class="flash flash-<%= key %> bg-blue-100 border-t-4 border-blue-500 rounded-b text-blue-900 px-4 py-3 shadow-md" role="alert">
18
+ <div class="flex">
19
+ <div class="py-1"><svg class="fill-current h-6 w-6 text-blue-500 mr-4" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M10 0C4.477 0 0 4.477 0 10s4.477 10 10 10 10-4.477 10-10S15.523 0 10 0zM9 15V9h2v6H9zm0-8V5h2v2H9z"/></svg></div>
20
+ <div>
21
+ <p class="font-bold"><%= flash_types(key) %></p>
22
+ <p class="text-sm"><%= value.html_safe %></p>
23
+ </div>
24
+ </div>
25
+ </div>
26
+ <% end -%>
27
+ </div>
28
+ <% end %>
29
+
@@ -0,0 +1,13 @@
1
+ <svg hidden xmlns="http://www.w3.org/2000/svg">
2
+ <symbol id="icon-cancel" viewBox="0 0 48 48">
3
+ <path fill-rule="evenodd" d="M24 19.757l-8.485-8.485c-.784-.783-2.047-.782-2.827 0l-1.417 1.416c-.777.777-.78 2.046.002 2.827L19.757 24l-8.485 8.485c-.783.784-.782 2.047 0 2.827l1.416 1.417c.777.777 2.046.78 2.827-.002L24 28.243l8.485 8.485c.784.783 2.047.782 2.827 0l1.417-1.416c.777-.777.78-2.046-.002-2.827L28.243 24l8.485-8.485c.783-.784.782-2.047 0-2.827l-1.416-1.417c-.777-.777-2.046-.78-2.827.002L24 19.757zM24 47c12.703 0 23-10.297 23-23S36.703 1 24 1 1 11.297 1 24s10.297 23 23 23z" />
4
+ </symbol>
5
+
6
+ <symbol id="icon-eyeglass" viewBox="0 0 48 48">
7
+ <path d="M27.885 32.515c-2.864 1.966-6.333 3.116-10.07 3.116C7.976 35.63 0 27.656 0 17.817 0 7.976 7.976 0 17.816 0S35.63 7.976 35.63 17.816c0 3.736-1.15 7.205-3.115 10.07l14.53 14.53c1.278 1.277 1.275 3.352 0 4.628-1.28 1.278-3.353 1.278-4.63 0l-14.53-14.53zm-10.07-3.736c6.056 0 10.964-4.91 10.964-10.964 0-6.055-4.91-10.964-10.964-10.964-6.055 0-10.964 4.91-10.964 10.964 0 6.055 4.91 10.963 10.964 10.963z" />
8
+ </symbol>
9
+
10
+ <symbol id="icon-up-caret" viewBox="0 0 48 48">
11
+ <path d="M2.988 33.02c-1.66 0-1.943-.81-.618-1.824l20-15.28c.878-.672 2.31-.67 3.188 0l20.075 15.288c1.316 1.003 1.048 1.816-.62 1.816H2.987z" />
12
+ </symbol>
13
+ </svg>
@@ -0,0 +1,21 @@
1
+ <%#
2
+ # Javascript Partial
3
+
4
+ This partial imports the necessary javascript on each page.
5
+ By default, it includes the application JS,
6
+ but each page can define additional JS sources
7
+ by providing a `content_for(:javascript)` block.
8
+ %>
9
+
10
+ <% Administrate::Engine.javascripts.each do |js_path| %>
11
+ <%= javascript_include_tag js_path %>
12
+ <% end %>
13
+
14
+ <%= yield :javascript %>
15
+
16
+ <% if Rails.env.test? %>
17
+ <%= javascript_tag do %>
18
+ $.fx.off = true;
19
+ $.ajaxSetup({ async: false });
20
+ <% end %>
21
+ <% end %>
@@ -0,0 +1,39 @@
1
+ <%#
2
+ # Navigation
3
+
4
+ This partial is used to display the navigation in Administrate.
5
+ By default, the navigation contains navigation links
6
+ for all resources in the admin dashboard,
7
+ as defined by the routes in the `admin/` namespace
8
+ %>
9
+ <!-- Navigation Sidebar -->
10
+ <aside id="default-sidebar" class="fixed top-0 left-0 z-40 w-64 h-screen transition-transform -translate-x-full sm:translate-x-0" aria-label="Sidebar">
11
+ <div class="h-full px-3 py-4 overflow-y-auto bg-gray-50 dark:bg-gray-800">
12
+ <ul class="space-y-2 font-medium">
13
+ <% if defined?(root_path) %>
14
+ <li>
15
+ <%= link_to(root_path, class: "flex items-center p-2 text-gray-900 rounded-lg dark:text-white hover:bg-gray-100 dark:hover:bg-gray-700 group") do %>
16
+ <svg class="w-5 h-5 text-gray-500 transition duration-75 dark:text-gray-400 group-hover:text-gray-900 dark:group-hover:text-white" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 22 21">
17
+ <path d="M4 10L3.29289 10.7071L2.58579 10L3.29289 9.29289L4 10ZM21 18C21 18.5523 20.5523 19 20 19C19.4477 19 19 18.5523 19 18L21 18ZM8.29289 15.7071L3.29289 10.7071L4.70711 9.29289L9.70711 14.2929L8.29289 15.7071ZM3.29289 9.29289L8.29289 4.29289L9.70711 5.70711L4.70711 10.7071L3.29289 9.29289ZM4 9L14 9L14 11L4 11L4 9ZM21 16L21 18L19 18L19 16L21 16ZM14 9C17.866 9 21 12.134 21 16L19 16C19 13.2386 16.7614 11 14 11L14 9Z" fill="#33363F"/>
18
+ </svg>
19
+ <span class="ms-3">
20
+ <%= t("administrate.navigation.back_to_app") %>
21
+ </span>
22
+ <% end %>
23
+ </li>
24
+ <% end %>
25
+ <% Administrate::Namespace.new(namespace).resources_with_index_route.each do |resource| %>
26
+ <% if accessible_action?(model_from_resource(resource), :index) %>
27
+ <%= link_to(resource_index_route(resource), class: "flex items-center p-2 text-gray-900 rounded-lg dark:text-white hover:bg-gray-100 dark:hover:bg-gray-700 group #{'bg-gray-100' if nav_link_state(resource)&.to_sym == :active }") do %>
28
+ <% if icon?(resource) %>
29
+ <%= render partial: "administrate/navigation/icons/#{resource}" %>
30
+ <% end %>
31
+ <span class="ms-3">
32
+ <%= display_resource_name(resource) %>
33
+ </span>
34
+ <% end %>
35
+ <% end %>
36
+ <% end %>
37
+ </ul>
38
+ </div>
39
+ </aside>
@@ -0,0 +1,14 @@
1
+ <%#
2
+ # Stylesheet Partial
3
+
4
+ This partial imports the necessary stylesheets on each page.
5
+ By default, it includes the application CSS,
6
+ but each page can define additional CSS sources
7
+ by providing a `content_for(:stylesheet)` block.
8
+ %>
9
+
10
+ <% Administrate::Engine.stylesheets.each do |css_path| %>
11
+ <%= stylesheet_link_tag css_path %>
12
+ <% end %>
13
+
14
+ <%= yield :stylesheet %>
@@ -0,0 +1,78 @@
1
+ <%#
2
+ # Collection
3
+
4
+ This partial is used on the `index` and `show` pages
5
+ to display a collection of resources in an HTML table.
6
+
7
+ ## Local variables:
8
+
9
+ - `collection_presenter`:
10
+ An instance of [Administrate::Page::Collection][1].
11
+ The table presenter uses `ResourceDashboard::COLLECTION_ATTRIBUTES` to determine
12
+ the columns displayed in the table
13
+ - `resources`:
14
+ An ActiveModel::Relation collection of resources to be displayed in the table.
15
+ By default, the number of resources is limited by pagination
16
+ or by a hard limit to prevent excessive page load times
17
+
18
+ [1]: http://www.rubydoc.info/gems/administrate/Administrate/Page/Collection
19
+ %>
20
+
21
+ <table aria-labelledby="<%= table_title %>" class="min-w-full divide-y divide-gray-200">
22
+ <thead class="bg-gray-50">
23
+ <tr>
24
+ <% collection_presenter.attribute_types.each do |attr_name, attr_type| %>
25
+ <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
26
+ <%= link_to(sanitized_order_params(page, collection_field_name).merge(collection_presenter.order_params_for(attr_name, key: collection_field_name))) do %>
27
+ <%= t(
28
+ "helpers.label.#{collection_presenter.resource_name}.#{attr_name}",
29
+ default: resource_class.human_attribute_name(attr_name).titleize
30
+ ) %>
31
+ <% if collection_presenter.ordered_by?(attr_name) %>
32
+ <span class="cell-label__sort-indicator cell-label__sort-indicator--<%= collection_presenter.ordered_html_class(attr_name) %>">
33
+ <svg class="w-4 h-4 inline" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
34
+ <path fill-rule="evenodd" d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z" clip-rule="evenodd" />
35
+ </svg>
36
+ </span>
37
+ <% end %>
38
+ <% end %>
39
+ </th>
40
+ <% end %>
41
+ <%= render(
42
+ "collection_header_actions",
43
+ collection_presenter: collection_presenter,
44
+ page: page,
45
+ resources: resources,
46
+ table_title: "page-title"
47
+ ) %>
48
+ </tr>
49
+ </thead>
50
+
51
+ <tbody class="bg-white divide-y divide-gray-200">
52
+ <% resources.each do |resource| %>
53
+ <tr class="hover:bg-gray-50">
54
+ <% collection_presenter.attributes_for(resource).each do |attribute| %>
55
+ <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">
56
+ <% if accessible_action?(resource, :show) %>
57
+ <%= link_to polymorphic_path([namespace, resource]), class: "text-indigo-600 hover:text-indigo-900" do %>
58
+ <%= render_field attribute %>
59
+ <% end %>
60
+ <% else %>
61
+ <%= render_field attribute %>
62
+ <% end %>
63
+ </td>
64
+ <% end %>
65
+ <%= render(
66
+ "collection_item_actions",
67
+ collection_presenter: collection_presenter,
68
+ collection_field_name: collection_field_name,
69
+ page: page,
70
+ namespace: namespace,
71
+ resource: resource,
72
+ table_title: "page-title"
73
+ ) %>
74
+ </tr>
75
+ <% end %>
76
+ </tbody>
77
+ </table>
78
+
@@ -0,0 +1,5 @@
1
+ <% action_count = [existing_action?(collection_presenter.resource_name, :edit),
2
+ existing_action?(collection_presenter.resource_name, :destroy)].count(true) %>
3
+ <% action_count.times do %>
4
+ <th scope="col" class="px-6 py-3 text-right text-xs font-medium text-gray-500 uppercase tracking-wider"></th>
5
+ <% end %>
@@ -0,0 +1,22 @@
1
+ <% if existing_action?(collection_presenter.resource_name, :edit) %>
2
+ <td class="px-6 py-4 whitespace-nowrap text-right text-sm font-medium">
3
+ <%= link_to(
4
+ t("administrate.actions.edit"),
5
+ [:edit, namespace, resource],
6
+ class: "text-indigo-600 hover:text-indigo-900",
7
+ ) if accessible_action?(resource, :edit) %>
8
+ </td>
9
+ <% end %>
10
+
11
+ <% if existing_action?(collection_presenter.resource_name, :destroy) %>
12
+ <td class="px-6 py-4 whitespace-nowrap text-right text-sm font-medium">
13
+ <%= link_to(
14
+ t("administrate.actions.destroy"),
15
+ [namespace, resource],
16
+ method: :delete,
17
+ data: { confirm: t("administrate.actions.confirm") },
18
+ class: "text-red-600 hover:text-red-900",
19
+ ) if accessible_action?(resource, :destroy) %>
20
+ </td>
21
+ <% end %>
22
+
@@ -0,0 +1,35 @@
1
+ <%#
2
+ # Flash Partial
3
+
4
+ This partial renders flash messages on every page.
5
+
6
+ ## Relevant Helpers:
7
+
8
+ - `flash`:
9
+ Returns a hash,
10
+ where the keys are the type of flash (alert, error, notice, etc)
11
+ and the values are the message to be displayed.
12
+ %>
13
+
14
+ <% if flash.any? %>
15
+ <div class="container mx-auto px-4 sm:px-6 lg:px-8">
16
+ <% flash.each do |key, value| -%>
17
+ <% next unless value.respond_to?(:html_safe) %>
18
+ <div class="flash bg-blue-100 border-t-4 border-blue-500 rounded-b text-blue-900 px-4 py-3 shadow-md mb-4" role="alert">
19
+ <div class="flex">
20
+ <div class="py-1">
21
+ <svg class="fill-current h-6 w-6 text-blue-500 mr-4" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20">
22
+ <path d="M0 0h20v20H0z" fill="none"/>
23
+ <path d="M9 12h2v2H9v-2zm1-8c-1.104 0-2 .896-2 2v5h4V6c0-1.104-.896-2-2-2zm0-3C4.486 1 1 4.486 1 9h2c0-3.314 2.686-6 6-6s6 2.686 6 6h2c0-4.514-3.486-8-8-8z"/>
24
+ </svg>
25
+ </div>
26
+ <div>
27
+ <p class="font-bold"><%= key.to_s.humanize %></p>
28
+ <p class="text-sm"><%= value.html_safe %></p>
29
+ </div>
30
+ </div>
31
+ </div>
32
+ <% end -%>
33
+ </div>
34
+ <% end %>
35
+