iron-cms 0.3.0 → 0.4.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 (53) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/builds/iron.css +1468 -1447
  3. data/app/assets/tailwind/iron/application.css +12 -1
  4. data/app/assets/tailwind/iron/components/button.css +110 -60
  5. data/app/assets/tailwind/iron/components/input.css +11 -9
  6. data/app/assets/tailwind/iron/components/sidebar.css +13 -17
  7. data/app/helpers/iron/application_helper.rb +1 -1
  8. data/app/helpers/iron/form_builder.rb +46 -0
  9. data/app/javascript/iron/application.js +2 -0
  10. data/app/models/iron/entry/web_publishable.rb +12 -12
  11. data/app/views/iron/block_definitions/_form.html.erb +1 -1
  12. data/app/views/iron/block_definitions/index.html.erb +1 -1
  13. data/app/views/iron/block_definitions/show.html.erb +3 -3
  14. data/app/views/iron/content_types/_form.html.erb +1 -1
  15. data/app/views/iron/content_types/index.html.erb +4 -7
  16. data/app/views/iron/content_types/show.html.erb +3 -9
  17. data/app/views/iron/contents/new.html.erb +2 -2
  18. data/app/views/iron/entries/_form.html.erb +45 -37
  19. data/app/views/iron/entries/edit.html.erb +2 -12
  20. data/app/views/iron/entries/fields/_block.html.erb +3 -4
  21. data/app/views/iron/entries/fields/_block_list.html.erb +26 -17
  22. data/app/views/iron/entries/fields/_reference_item.html.erb +2 -3
  23. data/app/views/iron/entries/fields/_text_field.html.erb +1 -1
  24. data/app/views/iron/entries/index.html.erb +1 -1
  25. data/app/views/iron/field_definitions/_field_definition.html.erb +1 -2
  26. data/app/views/iron/field_definitions/edit.html.erb +1 -7
  27. data/app/views/iron/field_definitions/layouts/_form.html.erb +1 -1
  28. data/app/views/iron/first_runs/show.html.erb +1 -1
  29. data/app/views/iron/locales/_form.html.erb +1 -1
  30. data/app/views/iron/locales/_locale.html.erb +1 -1
  31. data/app/views/iron/locales/index.html.erb +1 -1
  32. data/app/views/iron/passwords/edit.html.erb +31 -6
  33. data/app/views/iron/passwords/new.html.erb +19 -18
  34. data/app/views/iron/schemas/new.html.erb +2 -2
  35. data/app/views/iron/sessions/new.html.erb +27 -26
  36. data/app/views/iron/settings/show.html.erb +3 -4
  37. data/app/views/iron/shared/_collection_select.html.erb +31 -0
  38. data/app/views/iron/users/_form.html.erb +1 -1
  39. data/app/views/iron/users/new.html.erb +1 -1
  40. data/app/views/iron/users/show.html.erb +1 -4
  41. data/app/views/layouts/iron/_mobile_header.html.erb +10 -0
  42. data/app/views/layouts/iron/_sidebar.html.erb +26 -81
  43. data/app/views/layouts/iron/_sidebar_content.html.erb +36 -0
  44. data/app/views/layouts/iron/_sidebar_item.html.erb +1 -5
  45. data/app/views/layouts/iron/_user_menu.html.erb +26 -0
  46. data/app/views/layouts/iron/application.html.erb +11 -27
  47. data/app/views/layouts/iron/authentication.html.erb +4 -21
  48. data/config/importmap.rb +1 -0
  49. data/lib/iron/version.rb +1 -1
  50. data/vendor/javascript/@tailwindplus--elements.js +4 -0
  51. data/vendor/javascript/trix.js +5 -0
  52. metadata +8 -3
  53. data/app/helpers/iron/components/dropdown_helper.rb +0 -161
@@ -1,161 +0,0 @@
1
- # module Iron
2
- # module Components::DropdownHelper
3
- # def dropdown_divider
4
- # tag.div role: "separator", class: "col-span-full mx-3.5 my-1 h-px border-0 bg-stone-950/5 sm:mx-3 dark:bg-white/10 forced-colors:bg-[CanvasText]"
5
- # end
6
- # end
7
- # end
8
-
9
- module Iron
10
- module Components::DropdownHelper
11
- # Main dropdown container
12
- def dropdown_menu(options = {}, &block)
13
- # Initialize storage for different parts of the dropdown
14
- @dropdown_id = options[:id] || "dropdown-#{SecureRandom.hex(4)}"
15
- @dropdown_trigger = nil
16
- @dropdown_content = nil
17
-
18
- # Capture the nested content
19
- capture(&block)
20
-
21
- # Build the complete dropdown
22
- content_tag(:div, class: options[:class]) do
23
- safe_join([
24
- @dropdown_trigger,
25
- @dropdown_content
26
- ].compact)
27
- end
28
- end
29
-
30
- # Button that toggles the dropdown
31
- def dropdown_menu_trigger(options = {}, &block)
32
- css_class = options.delete(:class)
33
- trigger_content = capture(&block)
34
-
35
- @dropdown_trigger = content_tag(:button,
36
- trigger_content,
37
- id: "#{@dropdown_id}-trigger",
38
- popovertarget: @dropdown_id,
39
- class: tw("inline-flex items-center justify-center gap-2", css_class),
40
- style: "anchor-name: --#{@dropdown_id}-trigger;",
41
- **options
42
- )
43
-
44
- nil # Return nil to avoid content being rendered twice
45
- end
46
-
47
- def dropdown_menu_content(options = {}, &block)
48
- css_class = options.delete(:class)
49
- width = options[:width] || "16rem"
50
- align = options[:align] || "end" # Default to end alignment
51
- side = options[:side]
52
-
53
- positioning = "position-anchor: --#{@dropdown_id}-trigger;"
54
-
55
- # Add alignment to positioning
56
- positioning += " position-align: #{align};" if align.present?
57
-
58
- # Add side to positioning if provided
59
- positioning += " position-side: #{side};" if side.present?
60
-
61
- content = capture(&block)
62
-
63
- @dropdown_content = content_tag(:div,
64
- content,
65
- id: @dropdown_id,
66
- popover: "",
67
- class: tw("dropdown", css_class),
68
- style: "#{positioning} --popover-width: #{width};",
69
- **options
70
- )
71
-
72
- nil # Return nil to avoid content being rendered twice
73
- end
74
-
75
- # Individual dropdown menu item
76
- def dropdown_menu_item(*args, &block)
77
- options = args.extract_options!
78
-
79
- # Determine what the remaining args are
80
- text = args[0]
81
- url = args[1]
82
-
83
- # Extract common options
84
- css_class = options.delete(:class)
85
- icon_name = options.delete(:icon)
86
- method = options.delete(:method)
87
-
88
- item_content = if block_given?
89
- capture(&block)
90
- elsif icon_name.present?
91
- safe_join([
92
- icon(icon_name, variant: :micro, data: { slot: "icon" }),
93
- content_tag(:div, text, data: { slot: "label" })
94
- ])
95
- else
96
- text
97
- end
98
-
99
- if url.nil? && method.present?
100
- # Button form
101
- button_tag(item_content,
102
- type: "button",
103
- class: tw("dropdown-item w-full text-left", css_class),
104
- **options
105
- )
106
- elsif method.present?
107
- # Button_to form
108
- button_to(url.to_s,
109
- method: method,
110
- class: tw("dropdown-item w-full", css_class),
111
- **options
112
- ) { item_content }
113
- elsif url.present?
114
- # Link form
115
- link_to(url.to_s,
116
- class: tw("dropdown-item", css_class),
117
- **options
118
- ) { item_content }
119
- else
120
- # Plain item
121
- content_tag(:div, item_content,
122
- class: tw("dropdown-item", css_class),
123
- **options
124
- )
125
- end
126
- end
127
-
128
- # Label for dropdown sections
129
- def dropdown_menu_label(text = nil, options = {}, &block)
130
- css_class = options.delete(:class)
131
-
132
- content = block_given? ? capture(&block) : text
133
-
134
- content_tag(:div, content,
135
- class: tw("px-3.5 py-2 text-sm font-semibold text-stone-950 dark:text-white sm:px-3", css_class),
136
- **options
137
- )
138
- end
139
-
140
- # Divider between dropdown items
141
- def dropdown_menu_separator(options = {})
142
- css_class = options.delete(:class)
143
-
144
- content_tag(:div, nil,
145
- role: "separator",
146
- class: tw("dropdown-divider", css_class),
147
- **options
148
- )
149
- end
150
-
151
- # Group of related dropdown items
152
- def dropdown_menu_group(options = {}, &block)
153
- css_class = options.delete(:class)
154
-
155
- content_tag(:div, capture(&block),
156
- class: tw("p-1", css_class),
157
- **options
158
- )
159
- end
160
- end
161
- end