iron-cms 0.4.5 → 0.5.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 (41) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +3 -0
  3. data/app/assets/builds/iron.css +1154 -1395
  4. data/app/assets/tailwind/iron/application.css +3 -1
  5. data/app/assets/tailwind/iron/components/badge.css +97 -0
  6. data/app/assets/tailwind/iron/components/form.css +1 -1
  7. data/app/assets/tailwind/iron/components/input.css +2 -2
  8. data/app/assets/tailwind/iron/lexxy.css +366 -0
  9. data/app/controllers/iron/home_controller.rb +1 -0
  10. data/app/helpers/iron/application_helper.rb +4 -13
  11. data/app/helpers/iron/entries_helper.rb +0 -4
  12. data/app/helpers/iron/icons_helper.rb +7 -5
  13. data/app/helpers/iron/ui_helper.rb +22 -0
  14. data/app/javascript/iron/application.js +5 -3
  15. data/app/views/iron/block_definitions/_block_definition.html.erb +2 -2
  16. data/app/views/iron/content_types/_content_type.html.erb +2 -2
  17. data/app/views/iron/content_types/show.html.erb +1 -1
  18. data/app/views/iron/entries/fields/_rich_text_area.html.erb +1 -3
  19. data/app/views/iron/field_definitions/_field_definition.html.erb +2 -4
  20. data/app/views/iron/home/show.html.erb +48 -2
  21. data/app/views/iron/locales/_locale.html.erb +1 -1
  22. data/app/views/iron/users/_user.html.erb +1 -1
  23. data/app/views/layouts/action_text/contents/_content.html.erb +1 -1
  24. data/app/views/layouts/iron/_sidebar_content.html.erb +30 -6
  25. data/app/views/layouts/iron/_user_menu.html.erb +1 -1
  26. data/app/views/layouts/iron/authentication.html.erb +1 -1
  27. data/config/importmap.rb +2 -2
  28. data/lib/iron/engine.rb +2 -0
  29. data/lib/iron/version.rb +1 -1
  30. data/lib/iron.rb +0 -1
  31. data/lib/puma/plugin/iron_tailwindcss.rb +8 -8
  32. data/lib/tasks/iron_tailwindcss.rake +33 -0
  33. data/vendor/javascript/lexxy.js +10814 -0
  34. metadata +20 -8
  35. data/app/assets/tailwind/iron/actiontext.css +0 -550
  36. data/app/helpers/iron/block_helper.rb +0 -4
  37. data/app/helpers/iron/buttons_helper.rb +0 -14
  38. data/app/helpers/iron/components/badge_helper.rb +0 -70
  39. data/app/javascript/iron/controllers/trix_controller.js +0 -19
  40. data/lib/iron/cva.rb +0 -69
  41. data/vendor/javascript/trix.js +0 -5
@@ -20,14 +20,12 @@
20
20
  <div class="flex flex-col sm:flex-row sm:items-center sm:gap-8 min-w-0 flex-1">
21
21
  <div class="flex items-center gap-3 shrink-0">
22
22
  <h3 class="text-base font-semibold text-stone-900 dark:text-white truncate"><%= field_definition.name %></h3>
23
- <%= badge field_definition.humanized_type,
24
- color: :blue,
25
- class: "hidden sm:inline-flex" %>
23
+ <%= badge field_definition.humanized_type, class: "badge-blue hidden sm:inline-flex" %>
26
24
  </div>
27
25
  </div>
28
26
 
29
27
  <div class="flex items-center gap-4">
30
- <%= badge field_definition.humanized_type, color: :blue, class: "sm:hidden" %>
28
+ <%= badge field_definition.humanized_type, class: "badge-blue sm:hidden" %>
31
29
  <%= icon "chevron-right", class: "text-stone-400 dark:text-stone-500" %>
32
30
  </div>
33
31
  </div>
@@ -1,2 +1,48 @@
1
- <h1>Home#show</h1>
2
- <p>Find me in app/views/iron/home/show.html.erb</p>
1
+ <% content_for :title, "Dashboard" %>
2
+
3
+ <div class="space-y-8">
4
+ <div>
5
+ <h1 class="page-title">Dashboard</h1>
6
+ <p class="text-stone-600 dark:text-stone-400 mt-1">Welcome back to Iron CMS</p>
7
+ </div>
8
+
9
+ <div class="space-y-4">
10
+ <h2 class="text-lg font-semibold text-stone-900 dark:text-white">Recent Activity</h2>
11
+
12
+ <% if @recent_entries.any? %>
13
+ <div class="bg-white dark:bg-stone-800/50 rounded-lg shadow-sm divide-y divide-stone-200 dark:divide-stone-700/20 overflow-hidden">
14
+ <% @recent_entries.each do |entry| %>
15
+ <% entry_title = entry.content_type.single? ? entry.content_type.name : entry.title %>
16
+ <% entry_path = entry.content_type.single? ? entry_content_type_path(entry.content_type) : edit_entry_path(entry) %>
17
+ <div class="relative">
18
+ <%= link_to entry_path, class: "block px-6 py-4 hover:bg-stone-50 dark:hover:bg-stone-800/50 transition-colors" do %>
19
+ <div class="flex items-start justify-between gap-4 pr-6">
20
+ <div class="flex flex-col gap-1 min-w-0 flex-1">
21
+ <h3 class="text-base font-semibold text-stone-900 dark:text-white truncate"><%= entry_title %></h3>
22
+ <div class="flex items-center gap-2 text-sm text-stone-500 dark:text-stone-400">
23
+ <%= badge entry.content_type.name, class: "badge-blue" %>
24
+ <span>&middot;</span>
25
+ <span>Updated <%= time_ago_in_words(entry.updated_at) %> ago</span>
26
+ <% if entry.creator %>
27
+ <span>&middot;</span>
28
+ <span>by <%= entry.creator.email_address %></span>
29
+ <% end %>
30
+ </div>
31
+ </div>
32
+ </div>
33
+
34
+ <div class="absolute right-6 top-1/2 -translate-y-1/2 flex items-center gap-4">
35
+ <%= icon "chevron-right", class: "text-stone-400 dark:text-stone-500" %>
36
+ </div>
37
+ <% end %>
38
+ </div>
39
+ <% end %>
40
+ </div>
41
+ <% else %>
42
+ <div class="bg-white dark:bg-stone-800/50 rounded-lg shadow-sm p-8 text-center">
43
+ <p class="text-stone-500 dark:text-stone-400">No entries yet. Create your first content type to get started.</p>
44
+ <%= link_to "Create Content Type", new_content_type_path, class: "button-primary mt-4 inline-block" %>
45
+ </div>
46
+ <% end %>
47
+ </div>
48
+ </div>
@@ -5,7 +5,7 @@
5
5
  <span class="font-medium"><%= locale.name %></span>
6
6
  <%= badge "default" if locale.default? %>
7
7
  </div>
8
- <%= badge locale.code, color: :blue %>
8
+ <%= badge locale.code, class: "badge-blue" %>
9
9
  </div>
10
10
  <% end %>
11
11
  <%= button_to locale_path(locale), method: :delete, class: "absolute right-2 top-1/2 -translate-y-1/2 button-secondary button-sm" do %>
@@ -9,7 +9,7 @@
9
9
  </div>
10
10
  <div>
11
11
  <% if user.current? %>
12
- <%= badge user.role, color: user.administrator? ? "blue" : "stone" %>
12
+ <%= badge user.role, class: ("badge-blue" if user.administrator?) %>
13
13
  <% else %>
14
14
  <%= form_with(model: user, class: "", data: { controller: "form", action: "change->form#submit" }) do |form| %>
15
15
  <div class="field">
@@ -1,3 +1,3 @@
1
- <div class="trix-content">
1
+ <div class="lexxy-content">
2
2
  <%= yield -%>
3
3
  </div>
@@ -8,11 +8,31 @@
8
8
  <li>
9
9
  <div class="text-xs/6 font-semibold text-stone-400">Admin</div>
10
10
  <ul role="list" class="-mx-2 mt-2 space-y-1">
11
- <%= render "layouts/iron/sidebar_item", text: "Content Types", url: content_types_path, icon: "boxes", current: controller_name == "content_types" %>
12
- <%= render "layouts/iron/sidebar_item", text: "Block definitions", url: block_definitions_path, icon: "blocks", current: controller_name == "block_definitions" %>
13
- <%= render "layouts/iron/sidebar_item", text: "Locales", url: locales_path, icon: "languages", current: controller_name == "locales" %>
14
- <%= render "layouts/iron/sidebar_item", text: "Users", url: users_path, icon: "users", current: controller_name == "users" %>
15
- <%= render "layouts/iron/sidebar_item", text: "Settings", url: settings_path, icon: "settings", current: controller_name == "settings" %>
11
+ <%= render "layouts/iron/sidebar_item",
12
+ text: "Content Types",
13
+ url: content_types_path,
14
+ icon: "boxes",
15
+ current: controller_name == "content_types" %>
16
+ <%= render "layouts/iron/sidebar_item",
17
+ text: "Block definitions",
18
+ url: block_definitions_path,
19
+ icon: "blocks",
20
+ current: controller_name == "block_definitions" %>
21
+ <%= render "layouts/iron/sidebar_item",
22
+ text: "Locales",
23
+ url: locales_path,
24
+ icon: "languages",
25
+ current: controller_name == "locales" %>
26
+ <%= render "layouts/iron/sidebar_item",
27
+ text: "Users",
28
+ url: users_path,
29
+ icon: "users",
30
+ current: controller_name == "users" %>
31
+ <%= render "layouts/iron/sidebar_item",
32
+ text: "Settings",
33
+ url: settings_path,
34
+ icon: "settings",
35
+ current: controller_name == "settings" %>
16
36
  </ul>
17
37
  </li>
18
38
  <% end %>
@@ -21,7 +41,11 @@
21
41
  <div class="text-xs/6 font-semibold text-stone-400">Content</div>
22
42
  <ul role="list" class="-mx-2 mt-2 space-y-1">
23
43
  <% Iron::ContentType.all.each do |content_type| %>
24
- <%= render "layouts/iron/sidebar_item", text: content_type.name, url: content_type_sidebar_url(content_type), icon: content_type.icon.present? ? content_type.icon : "folder-closed", current: current_content_page?(content_type) %>
44
+ <%= render "layouts/iron/sidebar_item",
45
+ text: content_type.name,
46
+ url: content_type_sidebar_url(content_type),
47
+ icon: content_type.icon.present? ? content_type.icon : "folder-closed",
48
+ current: current_content_page?(content_type) %>
25
49
  <% end %>
26
50
  </ul>
27
51
  </li>
@@ -17,7 +17,7 @@
17
17
  </a>
18
18
  </div>
19
19
  <div class="py-1">
20
- <%= link_to session_path, method: :delete, class: "group/item flex items-center px-4 py-2 text-sm text-stone-700 focus:bg-stone-100 focus:text-stone-900 focus:outline-hidden dark:text-stone-300 dark:focus:bg-white/5 dark:focus:text-white" do %>
20
+ <%= button_to session_path, method: :delete, class: "group/item w-full flex items-center px-4 py-2 text-sm text-stone-700 focus:bg-stone-100 focus:text-stone-900 focus:outline-hidden dark:text-stone-300 dark:focus:bg-white/5 dark:focus:text-white" do %>
21
21
  <%= icon "log-out", class: "mr-3 size-5 text-stone-400 group-focus/item:text-stone-500 dark:text-stone-500 dark:group-focus/item:text-white" %>
22
22
  Sign out
23
23
  <% end %>
@@ -1,5 +1,5 @@
1
1
  <!DOCTYPE html>
2
- <html class="h-full bg-white dark:bg-stone-900">
2
+ <html class="h-full bg-white text-stone-950 antialiased dark:bg-stone-900 dark:text-white">
3
3
  <head>
4
4
  <title><%= content_for(:title).present? ? "#{content_for(:title)} | Iron CMS" : "Iron CMS" %></title>
5
5
  <%= csrf_meta_tags %>
data/config/importmap.rb CHANGED
@@ -2,8 +2,8 @@ pin "application-iron", to: "iron/application.js", preload: true
2
2
  pin "@hotwired/turbo-rails", to: "turbo.min.js", preload: true
3
3
  pin "@hotwired/stimulus", to: "stimulus.min.js", preload: true
4
4
  pin "@hotwired/stimulus-loading", to: "stimulus-loading.js", preload: true
5
- pin "trix" # @2.1.15
6
- pin "@rails/actiontext", to: "actiontext.esm.js"
5
+ pin "@rails/activestorage", to: "activestorage.esm.js"
6
+ pin "lexxy", to: "lexxy.js"
7
7
 
8
8
  pin_all_from Iron::Engine.root.join("app/javascript/iron/lib"), under: "lib", to: "iron/lib"
9
9
  pin_all_from Iron::Engine.root.join("app/javascript/iron/controllers"), under: "controllers", to: "iron/controllers"
data/lib/iron/engine.rb CHANGED
@@ -3,6 +3,7 @@ require "turbo-rails"
3
3
  require "stimulus-rails"
4
4
  require "active_storage/engine"
5
5
  require "action_text/engine"
6
+ require "lexxy"
6
7
  require "bcrypt"
7
8
  require "ostruct"
8
9
  require "iron/lexorank"
@@ -17,6 +18,7 @@ module Iron
17
18
  initializer "iron.setup", before: "importmap" do |app|
18
19
  app.config.assets.paths.unshift(root.join("vendor/javascript"))
19
20
  app.config.assets.paths << root.join("app/javascript")
21
+ app.config.assets.paths << root.join("app/assets/builds")
20
22
  app.config.importmap.paths << root.join("config/importmap.rb")
21
23
  app.config.importmap.cache_sweepers << root.join("app/javascript")
22
24
 
data/lib/iron/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Iron
2
- VERSION = "0.4.5"
2
+ VERSION = "0.5.1"
3
3
  end
data/lib/iron.rb CHANGED
@@ -1,6 +1,5 @@
1
1
  require "iron/version"
2
2
  require "iron/engine"
3
- require "iron/cva"
4
3
  require "iron/sdk"
5
4
  require "iron/global_id/instance_scoped_locator"
6
5
  require "iron/test_fixtures"
@@ -7,20 +7,22 @@ Puma::Plugin.create do
7
7
  @log_writer = launcher.log_writer
8
8
  @puma_pid = $$
9
9
 
10
- # Build the Iron engine Tailwind CSS command
11
10
  engine_root = File.expand_path("../../..", __dir__)
11
+ input_path = File.join(engine_root, "app/assets/tailwind/iron/application.css")
12
+ output_path = File.join(engine_root, "app/assets/builds/iron.css")
13
+
12
14
  command = [
13
15
  "bundle", "exec", "tailwindcss",
14
- "-i", "#{engine_root}/app/assets/tailwind/iron/application.css",
15
- "-o", "#{engine_root}/app/assets/builds/iron.css",
16
+ "-i", input_path,
17
+ "-o", output_path,
16
18
  "-w"
17
19
  ]
18
20
 
19
21
  @iron_tailwind_pid = fork do
20
22
  Thread.new { monitor_puma }
21
23
  begin
22
- IO.popen(command, "r+") do |io|
23
- IO.copy_stream(io, $stdout)
24
+ Dir.chdir(engine_root) do
25
+ IO.popen(command, "r+") { |io| IO.copy_stream(io, $stdout) }
24
26
  end
25
27
  rescue Interrupt
26
28
  end
@@ -28,9 +30,7 @@ Puma::Plugin.create do
28
30
 
29
31
  launcher.events.on_stopped { stop_iron_tailwind }
30
32
 
31
- in_background do
32
- monitor_iron_tailwind
33
- end
33
+ in_background { monitor_iron_tailwind }
34
34
  end
35
35
 
36
36
  private
@@ -0,0 +1,33 @@
1
+ namespace :iron do
2
+ namespace :tailwindcss do
3
+ desc "Build Tailwind CSS for the Iron engine"
4
+ task :build do
5
+ require "tailwindcss/ruby"
6
+ require "fileutils"
7
+
8
+ engine_root = Iron::Engine.root
9
+ input_path = "app/assets/tailwind/iron/application.css"
10
+ output_path = "app/assets/builds/iron.css"
11
+
12
+ Dir.chdir(engine_root) do
13
+ FileUtils.mkdir_p(File.dirname(output_path))
14
+
15
+ cmd = [
16
+ Tailwindcss::Ruby.executable,
17
+ "-i", input_path,
18
+ "-o", output_path
19
+ ]
20
+
21
+ system(*cmd) || raise("Tailwind build failed for Iron engine")
22
+ end
23
+ end
24
+ end
25
+ end
26
+
27
+ if Rake::Task.task_defined?("build")
28
+ Rake::Task["build"].enhance([ "iron:tailwindcss:build" ])
29
+ end
30
+
31
+ if Rake::Task.task_defined?("release")
32
+ Rake::Task["release"].enhance([ "iron:tailwindcss:build" ])
33
+ end