railsui 3.2.7 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +8 -1
- data/README.md +196 -42
- data/app/assets/javascripts/railsui-controllers.js +12 -0
- data/app/controllers/railsui/configurations_controller.rb +11 -2
- data/app/helpers/railsui/application_helper.rb +12 -0
- data/app/javascript/controllers/index.js +3 -31
- data/app/javascript/controllers/railsui_anchor_controller.js +4 -3
- data/app/javascript/controllers/railsui_auto_expand_text_area_controller.js +1 -1
- data/app/javascript/controllers/railsui_canvas_controller.js +1 -1
- data/app/javascript/controllers/railsui_code_controller.js +3 -28
- data/app/javascript/controllers/railsui_color_controller.js +1 -1
- data/app/javascript/controllers/railsui_configuration_controller.js +1 -1
- data/app/javascript/controllers/railsui_dialog_controller.js +1 -1
- data/app/javascript/controllers/railsui_flash_controller.js +1 -1
- data/app/javascript/controllers/railsui_helper_controller.js +1 -1
- data/app/javascript/controllers/railsui_loading_controller.js +1 -1
- data/app/javascript/controllers/railsui_modal_controller.js +4 -3
- data/app/javascript/controllers/railsui_nav_controller.js +4 -3
- data/app/javascript/controllers/railsui_pages_controller.js +1 -1
- data/app/javascript/controllers/railsui_prevent_controller.js +1 -1
- data/app/javascript/controllers/railsui_scroll_controller.js +1 -1
- data/app/javascript/controllers/railsui_scroll_spy_controller.js +1 -1
- data/app/javascript/controllers/railsui_search_controller.js +1 -1
- data/app/javascript/controllers/railsui_smooth_controller.js +1 -1
- data/app/javascript/controllers/railsui_snippet_controller.js +1 -1
- data/app/views/layouts/railsui/application.html.erb +7 -5
- data/app/views/layouts/railsui/fullwidth.html.erb +4 -4
- data/app/views/layouts/railsui/landing.html.erb +3 -4
- data/app/views/layouts/railsui/routes.html.erb +4 -3
- data/app/views/railsui/admin/_form.html.erb +18 -1
- data/app/views/railsui/admin/fields/_theme.html.erb +0 -1
- data/app/views/railsui/shared/_cdn_dependencies.html.erb +121 -0
- data/app/views/railsui/shared/_inline_controllers.html.erb +498 -0
- data/app/views/railsui/shared/_snippet.html.erb +23 -1
- data/app/views/railsui/themes/hound/forms/_input_group.html.erb +3 -1
- data/app/views/railsui/themes/shepherd/authentication/devise/_overview.html.erb +30 -28
- data/app/views/railsui/themes/shepherd/authentication/static/_overview.html.erb +8 -8
- data/app/views/railsui/themes/shepherd/content/typography/_headings.html.erb +23 -21
- data/app/views/railsui/themes/shepherd/forms/_input.html.erb +1 -1
- data/guides/CONFIGURATION.md +199 -0
- data/guides/MIGRATION_GUIDE.md +220 -0
- data/lib/generators/railsui/install/install_generator.rb +124 -38
- data/lib/generators/railsui/install/templates/Procfile.dev.build +1 -0
- data/lib/generators/railsui/install/templates/Procfile.dev.nobuild +2 -0
- data/lib/generators/railsui/install/templates/bin/dev +21 -0
- data/lib/generators/railsui/install/templates/themes/corgie/stylesheets/railsui/actiontext.css +0 -1
- data/lib/generators/railsui/install/templates/themes/corgie/views/layouts/rui/railsui.html.erb +7 -2
- data/lib/generators/railsui/install/templates/themes/corgie/views/layouts/rui/railsui_admin.html.erb +7 -2
- data/lib/generators/railsui/install/templates/themes/corgie/views/layouts/rui/railsui_auth.html.erb +6 -2
- data/lib/generators/railsui/install/templates/themes/corgie/views/rui/pages/{privacy.html.erb → privacy_policy.html.erb} +1 -1
- data/lib/generators/railsui/install/templates/themes/corgie/views/rui/pages/terms.html.erb +2 -2
- data/lib/generators/railsui/install/templates/themes/corgie/views/rui/shared/sidebar/_link.html.erb +4 -4
- data/lib/generators/railsui/install/templates/themes/hound/stylesheets/railsui/actiontext.css +0 -1
- data/lib/generators/railsui/install/templates/themes/hound/views/layouts/rui/railsui.html.erb +6 -2
- data/lib/generators/railsui/install/templates/themes/hound/views/layouts/rui/railsui_admin.html.erb +6 -2
- data/lib/generators/railsui/install/templates/themes/shepherd/stylesheets/railsui/actiontext.css +0 -1
- data/lib/generators/railsui/install/templates/themes/shepherd/views/layouts/rui/railsui.html.erb +6 -2
- data/lib/generators/railsui/install/templates/themes/shepherd/views/layouts/rui/railsui_admin.html.erb +6 -2
- data/lib/generators/railsui/update/update_generator.rb +40 -4
- data/lib/railsui/configuration.rb +116 -15
- data/lib/railsui/engine.rb +15 -0
- data/lib/railsui/theme_setup.rb +598 -38
- data/lib/railsui/version.rb +1 -1
- data/lib/railsui.rb +10 -7
- data/lib/tasks/install.rake +9 -3
- data/lib/tasks/migrate.rake +219 -0
- metadata +26 -4
- data/.claude/settings.local.json +0 -10
|
@@ -7,65 +7,149 @@ module Railsui
|
|
|
7
7
|
|
|
8
8
|
source_root File.expand_path("templates", __dir__)
|
|
9
9
|
|
|
10
|
+
class_option :build, type: :boolean, default: false, desc: "Install with JS bundler (esbuild, bun, webpack, rollup)"
|
|
11
|
+
|
|
12
|
+
def check_build_mode_requirements
|
|
13
|
+
# If --build flag is used, verify jsbundling-rails is installed BEFORE doing anything
|
|
14
|
+
if options[:build]
|
|
15
|
+
unless gem_installed?('jsbundling-rails')
|
|
16
|
+
say ""
|
|
17
|
+
say "=" * 70, :red
|
|
18
|
+
say "❌ Build mode requires jsbundling-rails", :red
|
|
19
|
+
say "=" * 70, :red
|
|
20
|
+
say ""
|
|
21
|
+
say "You've used the --build flag, but jsbundling-rails is not installed.", :yellow
|
|
22
|
+
say ""
|
|
23
|
+
say "Please install a JS bundler first:", :cyan
|
|
24
|
+
say ""
|
|
25
|
+
say " bundle add jsbundling-rails", :cyan
|
|
26
|
+
say " rails javascript:install:[bun|esbuild|rollup|webpack]", :cyan
|
|
27
|
+
say " rails railsui:install --build", :cyan
|
|
28
|
+
say ""
|
|
29
|
+
say "Or use importmap mode (no --build flag needed):", :cyan
|
|
30
|
+
say ""
|
|
31
|
+
say " rails railsui:install", :cyan
|
|
32
|
+
say ""
|
|
33
|
+
say "📚 See README for more details on installation modes", :cyan
|
|
34
|
+
say ""
|
|
35
|
+
exit(1)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# Also verify a JS bundler is configured
|
|
39
|
+
bundler = detect_js_bundler
|
|
40
|
+
if bundler == "unknown" || bundler == "importmap"
|
|
41
|
+
say ""
|
|
42
|
+
say "=" * 70, :red
|
|
43
|
+
say "❌ Build mode requires a configured JS bundler", :red
|
|
44
|
+
say "=" * 70, :red
|
|
45
|
+
say ""
|
|
46
|
+
say "jsbundling-rails is installed, but no bundler is configured.", :yellow
|
|
47
|
+
say ""
|
|
48
|
+
say "Install one with:", :cyan
|
|
49
|
+
say ""
|
|
50
|
+
say " rails javascript:install:[bun|esbuild|rollup|webpack]", :cyan
|
|
51
|
+
say " rails railsui:install --build", :cyan
|
|
52
|
+
say ""
|
|
53
|
+
say "Or use importmap mode (no --build flag needed):", :cyan
|
|
54
|
+
say ""
|
|
55
|
+
say " rails railsui:install", :cyan
|
|
56
|
+
say ""
|
|
57
|
+
say "📚 See README for more details on installation modes", :cyan
|
|
58
|
+
say ""
|
|
59
|
+
exit(1)
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
|
|
10
64
|
def create_config
|
|
65
|
+
build_mode = options[:build] ? "build" : "nobuild"
|
|
66
|
+
|
|
11
67
|
configuration_params = {
|
|
12
68
|
application_name: "Rails UI",
|
|
13
69
|
support_email: "support@example.com",
|
|
14
70
|
theme: "hound",
|
|
15
|
-
pages: Railsui::Pages.get_pages('hound')
|
|
71
|
+
pages: Railsui::Pages.get_pages('hound'),
|
|
72
|
+
build_mode: build_mode
|
|
16
73
|
}
|
|
17
74
|
|
|
18
75
|
config = Railsui::Configuration.new(configuration_params)
|
|
19
|
-
config.save
|
|
76
|
+
config.save(skip_build: true) # Skip CSS build - file doesn't exist yet
|
|
20
77
|
end
|
|
21
78
|
|
|
22
79
|
def install_dependencies
|
|
80
|
+
# Detect and warn about existing setup
|
|
81
|
+
detect_and_warn_about_setup
|
|
82
|
+
|
|
23
83
|
config = Railsui::Configuration.load!
|
|
24
84
|
|
|
25
85
|
@theme = Railsui.config.theme
|
|
86
|
+
@build_mode = config.build_mode
|
|
87
|
+
|
|
88
|
+
mode_label = @build_mode == "nobuild" ? "no-build (importmap)" : "build"
|
|
89
|
+
say "🔥 Installing default theme: #{@theme.humanize} 🐶 in #{mode_label} mode. Don't worry, you can change this."
|
|
90
|
+
|
|
91
|
+
# Add engine routes
|
|
92
|
+
# Add a GUI for easier theme configuration
|
|
93
|
+
copy_railsui_routes
|
|
26
94
|
|
|
27
|
-
|
|
28
|
-
|
|
95
|
+
# gems railsui_icon and action_text
|
|
96
|
+
install_gems
|
|
97
|
+
|
|
98
|
+
# Install CSS dependencies (unified for both modes)
|
|
99
|
+
install_css_dependencies
|
|
100
|
+
|
|
101
|
+
# mailers
|
|
102
|
+
update_application_helper
|
|
103
|
+
update_railsui_mailer_layout(@theme)
|
|
104
|
+
generate_sample_mailers(@theme)
|
|
105
|
+
|
|
106
|
+
# Install JS dependencies based on build mode
|
|
107
|
+
if @build_mode == "nobuild"
|
|
108
|
+
install_js_dependencies_nobuild(@theme)
|
|
29
109
|
else
|
|
30
|
-
|
|
110
|
+
install_js_dependencies_build(@theme)
|
|
111
|
+
end
|
|
31
112
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
113
|
+
# assets
|
|
114
|
+
copy_theme_javascript(@theme)
|
|
115
|
+
copy_theme_stylesheets(@theme)
|
|
35
116
|
|
|
36
|
-
|
|
37
|
-
|
|
117
|
+
# view related
|
|
118
|
+
copy_railsui_head(@theme)
|
|
119
|
+
copy_railsui_launcher(@theme)
|
|
38
120
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
update_railsui_mailer_layout(@theme)
|
|
42
|
-
generate_sample_mailers(@theme)
|
|
121
|
+
# cleanup
|
|
122
|
+
remove_action_text_defaults
|
|
43
123
|
|
|
44
|
-
|
|
45
|
-
|
|
124
|
+
# Copy the pages related files.
|
|
125
|
+
copy_railsui_pages_routes
|
|
126
|
+
copy_railsui_page_controller(@theme)
|
|
127
|
+
copy_railsui_images(@theme)
|
|
128
|
+
copy_railsui_pages(@theme)
|
|
46
129
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
copy_theme_stylesheets(@theme)
|
|
130
|
+
# Copy Procfile for the correct mode
|
|
131
|
+
copy_procfile
|
|
50
132
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
copy_railsui_launcher(@theme)
|
|
133
|
+
# Copy bin/dev script
|
|
134
|
+
copy_bin_dev
|
|
54
135
|
|
|
55
|
-
|
|
56
|
-
|
|
136
|
+
# Run bundle install to ensure all gems are available
|
|
137
|
+
say "Running bundle install...", :yellow
|
|
138
|
+
run "bundle install"
|
|
57
139
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
copy_railsui_page_controller(@theme)
|
|
61
|
-
copy_railsui_images(@theme)
|
|
62
|
-
copy_railsui_pages(@theme)
|
|
140
|
+
# migrate
|
|
141
|
+
rails_command "db:migrate"
|
|
63
142
|
|
|
64
|
-
|
|
65
|
-
|
|
143
|
+
# Build JavaScript if in build mode (after all packages are installed)
|
|
144
|
+
if @build_mode == "build"
|
|
145
|
+
say "Building JavaScript...", :yellow
|
|
146
|
+
run "yarn build"
|
|
147
|
+
say "✓ JavaScript built successfully", :green
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
config.save
|
|
66
151
|
|
|
67
|
-
|
|
68
|
-
say "
|
|
152
|
+
say "
|
|
69
153
|
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
|
|
70
154
|
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
|
|
71
155
|
MMMMMMMMMMMMMWXOxooodOXMMMMMMMMMMWXxxXMMMMMMMMMMMMMMMMMMMMMM
|
|
@@ -90,11 +174,13 @@ MMMMMMMMMNxldk0XNWMMMMMWNKkl,. .lKWMMMMMXo. ,xNMMMMMMMMMMMM
|
|
|
90
174
|
MMMMMMMMMWWMMMMMMMMMMMMMMMMMW0kkKWMMMMMMMMWKONMMMMMMMMMMMMMM
|
|
91
175
|
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
|
|
92
176
|
"
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
177
|
+
say "✅ Install complete", :green
|
|
178
|
+
say ""
|
|
179
|
+
say "Next steps:", :cyan
|
|
180
|
+
say " 1. Run: bin/dev", :cyan
|
|
181
|
+
say " 2. Visit: http://localhost:3000/railsui", :cyan
|
|
182
|
+
say ""
|
|
183
|
+
say "📚 Documentation: https://railsui.com/docs"
|
|
98
184
|
end
|
|
99
185
|
end
|
|
100
186
|
end
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
css: bin/rails tailwindcss:watch
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
# Exit if any command fails
|
|
4
|
+
set -e
|
|
5
|
+
|
|
6
|
+
# Check if Procfile.dev exists
|
|
7
|
+
if [ ! -f Procfile.dev ]; then
|
|
8
|
+
echo "Procfile.dev not found!"
|
|
9
|
+
exit 1
|
|
10
|
+
fi
|
|
11
|
+
|
|
12
|
+
# Check for foreman/overmind, otherwise try to install foreman
|
|
13
|
+
if command -v overmind &> /dev/null; then
|
|
14
|
+
exec overmind start -f Procfile.dev "$@"
|
|
15
|
+
elif command -v foreman &> /dev/null; then
|
|
16
|
+
exec foreman start -f Procfile.dev "$@"
|
|
17
|
+
else
|
|
18
|
+
echo "Installing foreman..."
|
|
19
|
+
gem install foreman
|
|
20
|
+
exec foreman start -f Procfile.dev "$@"
|
|
21
|
+
fi
|
data/lib/generators/railsui/install/templates/themes/corgie/views/layouts/rui/railsui.html.erb
CHANGED
|
@@ -17,8 +17,12 @@
|
|
|
17
17
|
<%# Enable PWA manifest for installable apps (make sure to enable in config/routes.rb too!) %>
|
|
18
18
|
<%#= tag.link rel: "manifest", href: pwa_manifest_path(format: :json) %>
|
|
19
19
|
|
|
20
|
-
<%= stylesheet_link_tag "
|
|
21
|
-
|
|
20
|
+
<%= stylesheet_link_tag "tailwind", "data-turbo-track": "reload" %>
|
|
21
|
+
<% if Railsui.config.build_mode == "build" %>
|
|
22
|
+
<%= javascript_include_tag "application", "data-turbo-track": "reload", type: "module" %>
|
|
23
|
+
<% else %>
|
|
24
|
+
<%= javascript_importmap_tags %>
|
|
25
|
+
<% end %>
|
|
22
26
|
|
|
23
27
|
<%= railsui_head %>
|
|
24
28
|
</head>
|
|
@@ -29,6 +33,7 @@
|
|
|
29
33
|
<%= yield %>
|
|
30
34
|
|
|
31
35
|
<%= render "rui/shared/footer" %>
|
|
36
|
+
<%= render "rui/shared/search" %>
|
|
32
37
|
<%= render "rui/shared/settings/modal" %>
|
|
33
38
|
<%= railsui_launcher if Rails.env.development? %>
|
|
34
39
|
</body>
|
data/lib/generators/railsui/install/templates/themes/corgie/views/layouts/rui/railsui_admin.html.erb
CHANGED
|
@@ -17,8 +17,12 @@
|
|
|
17
17
|
<%# Enable PWA manifest for installable apps (make sure to enable in config/routes.rb too!) %>
|
|
18
18
|
<%#= tag.link rel: "manifest", href: pwa_manifest_path(format: :json) %>
|
|
19
19
|
|
|
20
|
-
<%= stylesheet_link_tag "
|
|
21
|
-
|
|
20
|
+
<%= stylesheet_link_tag "tailwind", "data-turbo-track": "reload" %>
|
|
21
|
+
<% if Railsui.config.build_mode == "build" %>
|
|
22
|
+
<%= javascript_include_tag "application", "data-turbo-track": "reload", type: "module" %>
|
|
23
|
+
<% else %>
|
|
24
|
+
<%= javascript_importmap_tags %>
|
|
25
|
+
<% end %>
|
|
22
26
|
|
|
23
27
|
<%= railsui_head %>
|
|
24
28
|
</head>
|
|
@@ -28,6 +32,7 @@
|
|
|
28
32
|
|
|
29
33
|
<%= yield %>
|
|
30
34
|
|
|
35
|
+
<%= render "rui/shared/search" %>
|
|
31
36
|
<%= render "rui/shared/settings/modal" %>
|
|
32
37
|
<%= railsui_launcher if Rails.env.development? %>
|
|
33
38
|
</body>
|
data/lib/generators/railsui/install/templates/themes/corgie/views/layouts/rui/railsui_auth.html.erb
CHANGED
|
@@ -17,8 +17,12 @@
|
|
|
17
17
|
<%# Enable PWA manifest for installable apps (make sure to enable in config/routes.rb too!) %>
|
|
18
18
|
<%#= tag.link rel: "manifest", href: pwa_manifest_path(format: :json) %>
|
|
19
19
|
|
|
20
|
-
<%= stylesheet_link_tag "
|
|
21
|
-
|
|
20
|
+
<%= stylesheet_link_tag "tailwind", "data-turbo-track": "reload" %>
|
|
21
|
+
<% if Railsui.config.build_mode == "build" %>
|
|
22
|
+
<%= javascript_include_tag "application", "data-turbo-track": "reload", type: "module" %>
|
|
23
|
+
<% else %>
|
|
24
|
+
<%= javascript_importmap_tags %>
|
|
25
|
+
<% end %>
|
|
22
26
|
|
|
23
27
|
<%= railsui_head %>
|
|
24
28
|
</head>
|
|
@@ -131,7 +131,7 @@
|
|
|
131
131
|
If you have any questions about this Privacy Policy or our data practices, please contact us at:
|
|
132
132
|
</p>
|
|
133
133
|
<ul>
|
|
134
|
-
<li>Email: <a href="#">privacy@
|
|
134
|
+
<li>Email: <a href="#">privacy@corgie.com</a></li>
|
|
135
135
|
<li>Address: <a href="#">123 AI Street, Tech City, TC 12345</a></li>
|
|
136
136
|
<li>Phone: <a href="#">+1 (555) 123-4567</a></li>
|
|
137
137
|
</ul>
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
|
|
20
20
|
<p>
|
|
21
21
|
By creating an account or using our service, you acknowledge that you have read, understood, and agree to be
|
|
22
|
-
bound by these Terms and our <%= link_to "Privacy Policy",
|
|
22
|
+
bound by these Terms and our <%= link_to "Privacy Policy", rui_privacy_policy_path %>. If you do not agree to these Terms, please do not
|
|
23
23
|
use our service.
|
|
24
24
|
</p>
|
|
25
25
|
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
<h2>6. Privacy and Data Protection</h2>
|
|
90
90
|
|
|
91
91
|
<p>
|
|
92
|
-
Your privacy is important to us. Our collection and use of personal information is governed by our <%= link_to "Privacy Policy",
|
|
92
|
+
Your privacy is important to us. Our collection and use of personal information is governed by our <%= link_to "Privacy Policy", rui_privacy_policy_path %>. By using our service, you consent to the collection and use of your information
|
|
93
93
|
as described in our Privacy Policy.
|
|
94
94
|
</p>
|
|
95
95
|
|
data/lib/generators/railsui/install/templates/themes/corgie/views/rui/shared/sidebar/_link.html.erb
CHANGED
|
@@ -10,14 +10,14 @@
|
|
|
10
10
|
<span class="flex-1 truncate transition-opacity duration-200" data-sidebar-target="chatTitle"><%= title %></span>
|
|
11
11
|
|
|
12
12
|
<div class="opacity-0 group-hover:opacity-100 transition-opacity shrink-0 flex gap-1" data-sidebar-target="chatActions">
|
|
13
|
-
|
|
13
|
+
<div class="p-1 hover:bg-neutral-300 dark:hover:bg-neutral-600 rounded text-neutral-600 dark:text-neutral-400">
|
|
14
14
|
<%= icon "pencil-square", class: "size-3.5" %>
|
|
15
15
|
<span class="sr-only">Edit</span>
|
|
16
|
-
|
|
16
|
+
</div>
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
<div class="p-1 hover:bg-neutral-300 dark:hover:bg-neutral-600 rounded text-neutral-600 dark:text-neutral-400">
|
|
19
19
|
<%= icon "trash", class: "size-3.5" %>
|
|
20
20
|
<span class="sr-only">Delete</span>
|
|
21
|
-
|
|
21
|
+
</div>
|
|
22
22
|
</div>
|
|
23
23
|
<% end %>
|
data/lib/generators/railsui/install/templates/themes/hound/views/layouts/rui/railsui.html.erb
CHANGED
|
@@ -16,8 +16,12 @@
|
|
|
16
16
|
<%# Enable PWA manifest for installable apps (make sure to enable in config/routes.rb too!) %>
|
|
17
17
|
<%#= tag.link rel: "manifest", href: pwa_manifest_path(format: :json) %>
|
|
18
18
|
|
|
19
|
-
<%= stylesheet_link_tag "
|
|
20
|
-
|
|
19
|
+
<%= stylesheet_link_tag "tailwind", "data-turbo-track": "reload" %>
|
|
20
|
+
<% if Railsui.config.build_mode == "build" %>
|
|
21
|
+
<%= javascript_include_tag "application", "data-turbo-track": "reload", type: "module" %>
|
|
22
|
+
<% else %>
|
|
23
|
+
<%= javascript_importmap_tags %>
|
|
24
|
+
<% end %>
|
|
21
25
|
|
|
22
26
|
<%= railsui_head %>
|
|
23
27
|
</head>
|
data/lib/generators/railsui/install/templates/themes/hound/views/layouts/rui/railsui_admin.html.erb
CHANGED
|
@@ -16,8 +16,12 @@
|
|
|
16
16
|
<%# Enable PWA manifest for installable apps (make sure to enable in config/routes.rb too!) %>
|
|
17
17
|
<%#= tag.link rel: "manifest", href: pwa_manifest_path(format: :json) %>
|
|
18
18
|
|
|
19
|
-
<%= stylesheet_link_tag "
|
|
20
|
-
|
|
19
|
+
<%= stylesheet_link_tag "tailwind", "data-turbo-track": "reload" %>
|
|
20
|
+
<% if Railsui.config.build_mode == "build" %>
|
|
21
|
+
<%= javascript_include_tag "application", "data-turbo-track": "reload", type: "module" %>
|
|
22
|
+
<% else %>
|
|
23
|
+
<%= javascript_importmap_tags %>
|
|
24
|
+
<% end %>
|
|
21
25
|
|
|
22
26
|
<%= railsui_head %>
|
|
23
27
|
</head>
|
data/lib/generators/railsui/install/templates/themes/shepherd/views/layouts/rui/railsui.html.erb
CHANGED
|
@@ -16,8 +16,12 @@
|
|
|
16
16
|
<%# Enable PWA manifest for installable apps (make sure to enable in config/routes.r b too!) %>
|
|
17
17
|
<%#= tag.link rel: "manifest", href: pwa_manifest_path(format: :json) %>
|
|
18
18
|
|
|
19
|
-
<%= stylesheet_link_tag "
|
|
20
|
-
|
|
19
|
+
<%= stylesheet_link_tag "tailwind", "data-turbo-track": "reload" %>
|
|
20
|
+
<% if Railsui.config.build_mode == "build" %>
|
|
21
|
+
<%= javascript_include_tag "application", "data-turbo-track": "reload", type: "module" %>
|
|
22
|
+
<% else %>
|
|
23
|
+
<%= javascript_importmap_tags %>
|
|
24
|
+
<% end %>
|
|
21
25
|
|
|
22
26
|
<%= railsui_head %>
|
|
23
27
|
</head>
|
|
@@ -16,8 +16,12 @@
|
|
|
16
16
|
<%# Enable PWA manifest for installable apps (make sure to enable in config/routes.r b too!) %>
|
|
17
17
|
<%#= tag.link rel: "manifest", href: pwa_manifest_path(format: :json) %>
|
|
18
18
|
|
|
19
|
-
<%= stylesheet_link_tag "
|
|
20
|
-
|
|
19
|
+
<%= stylesheet_link_tag "tailwind", "data-turbo-track": "reload" %>
|
|
20
|
+
<% if Railsui.config.build_mode == "build" %>
|
|
21
|
+
<%= javascript_include_tag "application", "data-turbo-track": "reload", type: "module" %>
|
|
22
|
+
<% else %>
|
|
23
|
+
<%= javascript_importmap_tags %>
|
|
24
|
+
<% end %>
|
|
21
25
|
|
|
22
26
|
<%= railsui_head %>
|
|
23
27
|
</head>
|
|
@@ -9,22 +9,35 @@ module Railsui
|
|
|
9
9
|
|
|
10
10
|
def setup_theme
|
|
11
11
|
@config = Railsui::Configuration.load!
|
|
12
|
+
@build_mode = @config.build_mode
|
|
12
13
|
|
|
14
|
+
say "Updating theme: #{@config.theme} (#{@build_mode} mode)", :yellow
|
|
13
15
|
|
|
14
|
-
|
|
16
|
+
# Migrate old CSS path to new tailwindcss-rails v4 location if needed
|
|
17
|
+
migrate_css_path_if_needed
|
|
15
18
|
|
|
16
19
|
say "Updating Rails UI config", :yellow
|
|
17
20
|
# mailers
|
|
18
21
|
update_railsui_mailer_layout(@config.theme)
|
|
19
22
|
copy_sample_mailers(@config.theme)
|
|
20
23
|
|
|
21
|
-
#
|
|
22
|
-
|
|
24
|
+
# Install dependencies based on build mode
|
|
25
|
+
if @build_mode == "nobuild"
|
|
26
|
+
install_js_dependencies_nobuild(@config.theme)
|
|
27
|
+
else
|
|
28
|
+
install_js_dependencies_build(@config.theme)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# CSS dependencies (unified for both modes)
|
|
32
|
+
install_css_dependencies
|
|
23
33
|
|
|
24
34
|
# themed assets
|
|
25
35
|
copy_theme_javascript(@config.theme)
|
|
26
36
|
copy_theme_stylesheets(@config.theme)
|
|
27
37
|
|
|
38
|
+
# Update Procfile for current mode
|
|
39
|
+
copy_procfile
|
|
40
|
+
|
|
28
41
|
# update body classes
|
|
29
42
|
update_railsui_theme_classes
|
|
30
43
|
|
|
@@ -33,12 +46,35 @@ module Railsui
|
|
|
33
46
|
|
|
34
47
|
Railsui::Configuration.synchronize_pages
|
|
35
48
|
|
|
49
|
+
# Run bundle install to ensure all gems are available
|
|
50
|
+
say "Running bundle install...", :yellow
|
|
51
|
+
run "bundle install"
|
|
52
|
+
|
|
36
53
|
@config.save
|
|
37
|
-
say "✅ Configuration updated successfully", :green
|
|
54
|
+
say "✅ Configuration updated successfully for #{@build_mode} mode", :green
|
|
38
55
|
end
|
|
39
56
|
|
|
40
57
|
private
|
|
41
58
|
|
|
59
|
+
def migrate_css_path_if_needed
|
|
60
|
+
old_path = Rails.root.join("app/assets/stylesheets/application.tailwind.css")
|
|
61
|
+
new_path = Rails.root.join("app/assets/tailwind/application.css")
|
|
62
|
+
|
|
63
|
+
# If using old path and new path doesn't exist, migrate
|
|
64
|
+
if File.exist?(old_path) && !File.exist?(new_path)
|
|
65
|
+
say "📦 Migrating CSS to tailwindcss-rails v4 location...", :yellow
|
|
66
|
+
|
|
67
|
+
# Create new directory
|
|
68
|
+
FileUtils.mkdir_p(Rails.root.join("app/assets/tailwind"))
|
|
69
|
+
|
|
70
|
+
# Move the file
|
|
71
|
+
FileUtils.mv(old_path, new_path)
|
|
72
|
+
|
|
73
|
+
say "✓ Moved #{old_path.relative_path_from(Rails.root)} → #{new_path.relative_path_from(Rails.root)}", :green
|
|
74
|
+
say " Layouts will now use stylesheet_link_tag 'tailwind' instead of 'application'", :cyan
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
|
|
42
78
|
def sync_pages
|
|
43
79
|
# Remove old theme's pages. Forcefully for now.
|
|
44
80
|
pages_directory = Rails.root.join("app/views/rui")
|