iron-cms 0.3.0 → 0.4.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.
Files changed (51) 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. metadata +6 -3
  51. data/app/helpers/iron/components/dropdown_helper.rb +0 -161
@@ -11,8 +11,7 @@
11
11
  <%= builder.check_box :_destroy, class: "destroy hidden", data: { destroy: "" } %>
12
12
  <button
13
13
  type="button"
14
- class="handle btn rounded-sm"
15
- data-variant="plain"
14
+ class="handle button-ghost button-sm"
16
15
  data-sortable-list-target="handle"
17
16
  >
18
17
  <%= icon "grip-vertical" %>
@@ -28,7 +27,7 @@
28
27
  <%= block.definition.name %>
29
28
  </span>
30
29
  <div class="flex items-center gap-2">
31
- <%= builder.label :_destroy, class: "btn", data: { variant: "plain", color: "destructive" } do %>
30
+ <%= builder.label :_destroy, class: "button-secondary button-sm" do %>
32
31
  <%= icon "trash" %>
33
32
  <% end %>
34
33
  <%= icon "chevron-down", class: "transition-transform group-open:rotate-180" %>
@@ -84,7 +83,7 @@
84
83
  <p class="text-red-400">Missing block definition!</p>
85
84
  <%= link_to "Edit field definition",
86
85
  edit_field_definition_path(block.definition),
87
- class: "btn" %>
86
+ class: "button-primary" %>
88
87
  </div>
89
88
  <% end %>
90
89
  </fieldset>
@@ -24,22 +24,31 @@
24
24
  <% end %>
25
25
  </div>
26
26
 
27
- <ul class="flex gap-2 mt-4">
28
- <% block_list.definition.supported_block_definitions.each do |block_definition| %>
29
- <li>
30
- <%= link_to "+ #{block_definition.name}",
31
- new_block_path(
32
- block_list_field_definition_id: block_list.definition.id,
33
- block_definition_id: block_definition.id,
34
- locale_id: block_list.locale.id,
35
- form_field_name: builder.field_name(:blocks_attributes),
36
- ),
37
- data: {
38
- turbo_stream: true,
39
- },
40
- class: "btn" %>
41
- </li>
42
- <% end %>
43
- </ul>
27
+ <el-dropdown class="inline-block mt-4">
28
+ <button class="inline-flex w-full justify-center gap-x-1.5 rounded-md bg-white px-3 py-2 text-sm font-semibold text-stone-900 shadow-xs inset-ring-1 inset-ring-stone-300 hover:bg-stone-50 dark:bg-white/10 dark:text-white dark:shadow-none dark:inset-ring-white/5 dark:hover:bg-white/20">
29
+ Add Block
30
+ <%= icon "chevron-down", class: "-mr-1 size-5 text-stone-400 dark:text-stone-500" %>
31
+ </button>
32
+
33
+ <el-menu anchor="bottom start" popover class="w-56 origin-top-left rounded-md bg-white shadow-lg outline-1 outline-black/5 transition transition-discrete [--anchor-gap:--spacing(2)] data-closed:scale-95 data-closed:transform data-closed:opacity-0 data-enter:duration-100 data-enter:ease-out data-leave:duration-75 data-leave:ease-in dark:bg-stone-800 dark:shadow-none dark:-outline-offset-1 dark:outline-white/10">
34
+ <div class="py-1">
35
+ <% block_list.definition.supported_block_definitions.each do |block_definition| %>
36
+ <%= link_to new_block_path(
37
+ block_list_field_definition_id: block_list.definition.id,
38
+ block_definition_id: block_definition.id,
39
+ locale_id: block_list.locale.id,
40
+ form_field_name: builder.field_name(:blocks_attributes),
41
+ ),
42
+ data: {
43
+ turbo_stream: true,
44
+ },
45
+ class: "group/item flex items-center px-4 py-2 text-sm text-stone-700 focus:bg-sky-100 focus:text-stone-900 focus:outline-hidden dark:text-stone-300 dark:focus:bg-sky-500/20 dark:focus:text-white" do %>
46
+ <%= icon "plus", class: "mr-3 size-5 text-stone-400 group-focus/item:text-sky-600 dark:text-stone-500 dark:group-focus/item:text-sky-400" %>
47
+ <%= block_definition.name %>
48
+ <% end %>
49
+ <% end %>
50
+ </div>
51
+ </el-menu>
52
+ </el-dropdown>
44
53
 
45
54
  </fieldset>
@@ -7,8 +7,7 @@
7
7
  <%= builder.check_box :_destroy, class: "destroy hidden", data: { destroy: "" } %>
8
8
  <button
9
9
  type="button"
10
- class="handle btn"
11
- data-variant="plain"
10
+ class="handle button-ghost button-sm"
12
11
  data-sortable-list-target="handle"
13
12
  >
14
13
  <%= icon "grip-vertical" %>
@@ -20,7 +19,7 @@
20
19
  <p><%= reference.entry.title %></p>
21
20
 
22
21
  <div class="">
23
- <%= builder.label :_destroy, class: "btn", data: { variant: "plain", color: "destructive" } do %>
22
+ <%= builder.label :_destroy, class: "button-secondary button-sm" do %>
24
23
  <%= icon "trash" %>
25
24
  <% end %>
26
25
  </div>
@@ -15,7 +15,7 @@
15
15
  <% if field.definition.allowed_values.present? %>
16
16
  <%= builder.select :value_string,
17
17
  field.definition.allowed_values,
18
- { include_blank: true },
18
+ { include_blank: "Select #{field.definition.name}" },
19
19
  { class: "select" } %>
20
20
  <% else %>
21
21
  <%= builder.text_field :value_string %>
@@ -6,7 +6,7 @@
6
6
  entries</h1>
7
7
  <%= link_to "New #{@content_type.name}",
8
8
  new_content_type_entry_path,
9
- class: "btn" %>
9
+ class: "button-primary" %>
10
10
  </div>
11
11
 
12
12
  <div
@@ -9,8 +9,7 @@
9
9
  <%= form.hidden_field :rank, data: { sortable_list_target: "rank" } %>
10
10
 
11
11
  <button
12
- class="absolute left-2 top-1/2 -translate-y-1/2"
13
- data-variant="plain"
12
+ class="absolute left-2 top-1/2 -translate-y-1/2 button-ghost"
14
13
  data-sortable-list-target="handle"
15
14
  >
16
15
  <%= icon "grip-vertical", class: "text-stone-400" %>
@@ -6,11 +6,5 @@
6
6
 
7
7
  <%= render "iron/field_definitions/#{@field_definition.type_handle}/form",
8
8
  field_definition: @field_definition %>
9
- <%= button_to "Destroy",
10
- field_definition_path(@field_definition),
11
- method: :delete,
12
- class: "btn mt-2",
13
- data: {
14
- color: "destructive",
15
- } %>
9
+ <%= button_to "Destroy", field_definition_path(@field_definition), method: :delete, class: "button-destructive mt-2" %>
16
10
  </div>
@@ -41,7 +41,7 @@
41
41
  <%= yield form %>
42
42
 
43
43
  <div class="pt-2">
44
- <%= form.submit form.object.persisted? ? "Update" : "Create" %>
44
+ <%= form.submit form.object.persisted? ? "Update" : "Create", class: "button-primary" %>
45
45
  </div>
46
46
  </div>
47
47
  <% end %>
@@ -39,6 +39,6 @@
39
39
  <%= form.password_field :password_confirmation, required: true, autocomplete: "new-password" %>
40
40
  </div>
41
41
 
42
- <%= form.submit "Create account" %>
42
+ <%= form.submit "Create account", class: "button-primary" %>
43
43
  <% end %>
44
44
  </div>
@@ -18,7 +18,7 @@
18
18
  </div>
19
19
 
20
20
  <div class="mt-4">
21
- <%= form.submit %>
21
+ <%= form.submit class: "button-primary" %>
22
22
  </div>
23
23
  <% end %>
24
24
 
@@ -8,7 +8,7 @@
8
8
  <%= badge locale.code, color: :blue %>
9
9
  </div>
10
10
  <% end %>
11
- <%= button_to locale_path(locale), method: :delete, class: "absolute right-2 top-1/2 -translate-y-1/2", data: { variant: "plain" } do %>
11
+ <%= button_to locale_path(locale), method: :delete, class: "absolute right-2 top-1/2 -translate-y-1/2 button-secondary button-sm" do %>
12
12
  <%= icon "trash", class: "text-stone-400 size-4" %>
13
13
  <span class="sr-only">Delete</span>
14
14
  <% end %>
@@ -3,7 +3,7 @@
3
3
  <div class="space-y-8">
4
4
  <div class="flex justify-between items-center">
5
5
  <h1 class="page-title">Locales</h1>
6
- <%= link_to "New locale", new_locale_path, class: "btn" %>
6
+ <%= link_to "New locale", new_locale_path, class: "button-primary" %>
7
7
  </div>
8
8
 
9
9
  <div id="locales" class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4">
@@ -1,7 +1,32 @@
1
- <h1>Update your password</h1>
1
+ <div class="sm:mx-auto sm:w-full sm:max-w-sm">
2
+ <h2 class="mt-10 text-center text-2xl/9 font-bold tracking-tight text-stone-900 dark:text-white">Update your password</h2>
3
+ </div>
2
4
 
3
- <%= form_with url: password_path(params[:token]), method: :put do |form| %>
4
- <%= form.password_field :password, required: true, autocomplete: "new-password", placeholder: "Enter new password", maxlength: 72 %><br>
5
- <%= form.password_field :password_confirmation, required: true, autocomplete: "new-password", placeholder: "Repeat new password", maxlength: 72 %><br>
6
- <%= form.submit "Save" %>
7
- <% end %>
5
+ <div class="mt-10 sm:mx-auto sm:w-full sm:max-w-sm">
6
+ <%= form_with url: password_path(params[:token]), method: :put, class: "space-y-6" do |form| %>
7
+ <div>
8
+ <%= form.label :password, "New password", class: "block text-sm/6 font-medium text-stone-900 dark:text-stone-100" %>
9
+ <div class="mt-2">
10
+ <%= form.password_field :password,
11
+ required: true,
12
+ autofocus: true,
13
+ autocomplete: "new-password",
14
+ maxlength: 72 %>
15
+ </div>
16
+ </div>
17
+
18
+ <div>
19
+ <%= form.label :password_confirmation, "Confirm password", class: "block text-sm/6 font-medium text-stone-900 dark:text-stone-100" %>
20
+ <div class="mt-2">
21
+ <%= form.password_field :password_confirmation,
22
+ required: true,
23
+ autocomplete: "new-password",
24
+ maxlength: 72 %>
25
+ </div>
26
+ </div>
27
+
28
+ <div>
29
+ <%= form.submit "Save password", class: "button-primary w-full" %>
30
+ </div>
31
+ <% end %>
32
+ </div>
@@ -1,26 +1,27 @@
1
- <div>
2
- <div class="mb-8 text-center">
3
- <h1 class="text-2xl font-semibold tracking-tight">Reset your password</h1>
4
- <p class="mt-2 text-sm text-stone-600 dark:text-stone-400">Enter your email address and we'll send you instructions</p>
5
- </div>
1
+ <div class="sm:mx-auto sm:w-full sm:max-w-sm">
2
+ <h2 class="mt-10 text-center text-2xl/9 font-bold tracking-tight text-stone-900 dark:text-white">Reset your password</h2>
3
+ <p class="mt-2 text-center text-sm/6 text-stone-500 dark:text-stone-400">Enter your email address and we'll send you instructions</p>
4
+ </div>
6
5
 
6
+ <div class="mt-10 sm:mx-auto sm:w-full sm:max-w-sm">
7
7
  <%= form_with url: passwords_path, class: "space-y-6" do |form| %>
8
8
  <div>
9
- <%= form.label :email_address, "Email address", class: "sr-only" %>
10
- <%= form.email_field :email_address,
11
- class: "block w-full rounded-md border-0 py-2 px-3 text-stone-900 shadow-xs ring-1 ring-inset ring-stone-300 placeholder:text-stone-400 focus:ring-2 focus:ring-inset focus:ring-stone-600 dark:bg-stone-800 dark:text-white dark:ring-stone-700 dark:placeholder:text-stone-500 dark:focus:ring-stone-500 sm:text-sm sm:leading-6",
12
- required: true,
13
- autofocus: true,
14
- autocomplete: "username",
15
- placeholder: "Enter your email address",
16
- value: params[:email_address] %>
9
+ <%= form.label :email_address, "Email address", class: "block text-sm/6 font-medium text-stone-900 dark:text-stone-100" %>
10
+ <div class="mt-2">
11
+ <%= form.email_field :email_address,
12
+ required: true,
13
+ autofocus: true,
14
+ autocomplete: "email",
15
+ value: params[:email_address] %>
16
+ </div>
17
17
  </div>
18
18
 
19
- <%= form.submit "Send reset instructions" %>
19
+ <div>
20
+ <%= form.submit "Send reset instructions", class: "button-primary w-full" %>
21
+ </div>
20
22
  <% end %>
21
23
 
22
- <div class="mt-8 text-center text-sm">
23
- <%= link_to "Back to sign in", sign_in_path,
24
- class: "text-stone-600 hover:text-stone-900 dark:text-stone-400 dark:hover:text-stone-300" %>
25
- </div>
24
+ <p class="mt-10 text-center text-sm/6 text-stone-500 dark:text-stone-400">
25
+ <%= link_to "Back to sign in", sign_in_path, class: "font-semibold text-stone-600 hover:text-stone-500 dark:text-stone-400 dark:hover:text-stone-300" %>
26
+ </p>
26
27
  </div>
@@ -50,8 +50,8 @@
50
50
  </div>
51
51
 
52
52
  <div class="mt-6 flex items-center gap-x-3">
53
- <%= form.submit "Import Schema", class: "btn" %>
54
- <%= link_to "Cancel", content_types_path, class: "btn", data: { variant: "plain" } %>
53
+ <%= form.submit "Import Schema", class: "button-primary" %>
54
+ <%= link_to "Cancel", content_types_path, class: "button-secondary" %>
55
55
  </div>
56
56
  <% end %>
57
57
  </div>
@@ -1,36 +1,37 @@
1
- <div>
2
- <div class="mb-8 text-center">
3
- <h1 class="text-2xl font-semibold tracking-tight">Welcome back</h1>
4
- <p class="mt-2 text-sm text-stone-600 dark:text-stone-400">Sign in to your account to continue</p>
5
- </div>
1
+ <div class="sm:mx-auto sm:w-full sm:max-w-sm">
2
+ <h2 class="mt-10 text-center text-2xl/9 font-bold tracking-tight text-stone-900 dark:text-white">Sign in to your account</h2>
3
+ </div>
6
4
 
5
+ <div class="mt-10 sm:mx-auto sm:w-full sm:max-w-sm">
7
6
  <%= form_with url: sign_in_path, class: "space-y-6" do |form| %>
8
7
  <div>
9
- <%= form.label :email_address, "Email address", class: "sr-only" %>
10
- <%= form.email_field :email_address,
11
- required: true,
12
- autofocus: true,
13
- autocomplete: "username",
14
- placeholder: "Enter your email address",
15
- value: params[:email_address] %>
8
+ <%= form.label :email_address, "Email address", class: "block text-sm/6 font-medium text-stone-900 dark:text-stone-100" %>
9
+ <div class="mt-2">
10
+ <%= form.email_field :email_address,
11
+ required: true,
12
+ autofocus: true,
13
+ autocomplete: "email",
14
+ value: params[:email_address] %>
15
+ </div>
16
16
  </div>
17
17
 
18
18
  <div>
19
- <%= form.label :password, "Password", class: "sr-only" %>
20
- <%= form.password_field :password,
21
- required: true,
22
- autocomplete: "current-password",
23
- placeholder: "Enter your password",
24
- maxlength: 72 %>
19
+ <div class="flex items-center justify-between">
20
+ <%= form.label :password, "Password", class: "block text-sm/6 font-medium text-stone-900 dark:text-stone-100" %>
21
+ <div class="text-sm">
22
+ <%= link_to "Forgot password?", new_password_path, class: "font-semibold text-stone-600 hover:text-stone-500 dark:text-stone-400 dark:hover:text-stone-300" %>
23
+ </div>
24
+ </div>
25
+ <div class="mt-2">
26
+ <%= form.password_field :password,
27
+ required: true,
28
+ autocomplete: "current-password",
29
+ maxlength: 72 %>
30
+ </div>
25
31
  </div>
26
32
 
27
- <%= form.submit "Sign in", class: "w-full" %>
33
+ <div>
34
+ <%= form.submit "Sign in", class: "button-primary w-full" %>
35
+ </div>
28
36
  <% end %>
29
-
30
- <div class="mt-8 space-y-4 text-center text-sm">
31
- <%= link_to "Forgot your password?",
32
- new_password_path,
33
- class:
34
- "block text-stone-600 hover:text-stone-900 dark:text-stone-400 dark:hover:text-stone-300" %>
35
- </div>
36
37
  </div>
@@ -31,7 +31,7 @@
31
31
  </div>
32
32
 
33
33
  <div class="mt-4">
34
- <%= form.submit "Save Settings" %>
34
+ <%= form.submit "Save Settings", class: "button-primary" %>
35
35
  </div>
36
36
  <% end %>
37
37
  </div>
@@ -44,14 +44,13 @@
44
44
  <div class="flex flex-col gap-2">
45
45
  <%= link_to "Export Content",
46
46
  export_content_path,
47
- class: "btn",
47
+ class: "button-primary",
48
48
  data: {
49
49
  turbo: false,
50
50
  } %>
51
51
  <%= link_to "Import Content",
52
52
  new_content_path,
53
- class: "btn",
54
- data: { variant: "secondary" } %>
53
+ class: "button-secondary" %>
55
54
  </div>
56
55
  </div>
57
56
  </div>
@@ -0,0 +1,31 @@
1
+ <%# locals: (field_name:, select_id:, selected_value:, collection:, value_method:, text_method:, options:, html_options:) -%>
2
+
3
+ <el-select id="<%= select_id %>" name="<%= field_name %>" value="<%= selected_value %>" class="mt-2 block">
4
+ <button type="button" class="grid w-full cursor-default grid-cols-1 rounded-md bg-white py-1.5 pr-2 pl-3 text-left text-stone-900 outline-1 -outline-offset-1 outline-stone-400 focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-sky-600 sm:text-sm/6 dark:bg-white/5 dark:text-white dark:outline-white/10 dark:focus-visible:outline-sky-500">
5
+ <el-selectedcontent class="col-start-1 row-start-1 truncate pr-6"></el-selectedcontent>
6
+ <%= icon "chevrons-up-down", class: "col-start-1 row-start-1 size-5 self-center justify-self-end text-stone-500 sm:size-4 dark:text-stone-400" %>
7
+ </button>
8
+
9
+ <el-options anchor="bottom start" popover class="max-h-60 w-(--button-width) overflow-auto rounded-md bg-white py-1 text-base shadow-lg outline-1 outline-black/5 [--anchor-gap:--spacing(1)] data-leave:transition data-leave:transition-discrete data-leave:duration-100 data-leave:ease-in data-closed:data-leave:opacity-0 sm:text-sm dark:bg-stone-800 dark:shadow-none dark:-outline-offset-1 dark:outline-white/10">
10
+ <% if options[:include_blank] %>
11
+ <% blank_text = options[:include_blank].is_a?(String) ? options[:include_blank] : "" %>
12
+ <el-option value="" class="group/option relative block cursor-default py-2 pr-9 pl-3 text-stone-900 select-none focus:bg-sky-600 focus:text-white focus:outline-hidden dark:text-white dark:focus:bg-sky-500">
13
+ <span class="block truncate font-normal group-aria-selected/option:font-semibold"><%= blank_text %></span>
14
+ <span class="absolute inset-y-0 right-0 flex items-center pr-4 text-sky-600 group-not-aria-selected/option:hidden group-focus/option:text-white in-[el-selectedcontent]:hidden dark:text-sky-400">
15
+ <%= icon "check", class: "size-5" %>
16
+ </span>
17
+ </el-option>
18
+ <% end %>
19
+
20
+ <% collection.each do |item| %>
21
+ <% value = item.send(value_method) %>
22
+ <% text = item.send(text_method) %>
23
+ <el-option value="<%= value %>" class="group/option relative block cursor-default py-2 pr-9 pl-3 text-stone-900 select-none focus:bg-sky-600 focus:text-white focus:outline-hidden dark:text-white dark:focus:bg-sky-500">
24
+ <span class="block truncate font-normal group-aria-selected/option:font-semibold"><%= text %></span>
25
+ <span class="absolute inset-y-0 right-0 flex items-center pr-4 text-sky-600 group-not-aria-selected/option:hidden group-focus/option:text-white in-[el-selectedcontent]:hidden dark:text-sky-400">
26
+ <%= icon "check", class: "size-5" %>
27
+ </span>
28
+ </el-option>
29
+ <% end %>
30
+ </el-options>
31
+ </el-select>
@@ -17,5 +17,5 @@
17
17
  </div>
18
18
  </div>
19
19
 
20
- <%= form.submit class: "mt-4" %>
20
+ <%= form.submit class: "button-primary mt-4" %>
21
21
  <% end %>
@@ -24,6 +24,6 @@
24
24
  <%= form.error_for :password_confirmation %>
25
25
  </div>
26
26
 
27
- <%= form.submit "Join", class: "mt-4 w-full" %>
27
+ <%= form.submit "Join", class: "button-primary mt-4 w-full" %>
28
28
  <% end %>
29
29
  </div>
@@ -9,10 +9,7 @@
9
9
  button_to "Destroy",
10
10
  @user,
11
11
  method: :delete,
12
- class: "btn",
13
- data: {
14
- color: "destructive",
15
- }
12
+ class: "button-destructive"
16
13
  end %>
17
14
  </div>
18
15
  </div>
@@ -0,0 +1,10 @@
1
+ <div class="sticky top-0 z-40 flex items-center gap-x-6 bg-white px-4 py-4 shadow-xs sm:px-6 lg:hidden dark:bg-stone-900 dark:shadow-none dark:after:pointer-events-none dark:after:absolute dark:after:inset-0 dark:after:border-b dark:after:border-white/10 dark:after:bg-black/10">
2
+ <button type="button" command="show-modal" commandfor="sidebar" class="-m-2.5 p-2.5 text-stone-700 hover:text-stone-900 lg:hidden dark:text-stone-400 dark:hover:text-white">
3
+ <span class="sr-only">Open sidebar</span>
4
+ <%= icon "menu", class: "size-6" %>
5
+ </button>
6
+ <div class="flex-1 text-sm/6 font-semibold text-stone-900 dark:text-white">
7
+ <%= content_for(:title).present? ? content_for(:title) : "Iron CMS" %>
8
+ </div>
9
+ <%= render "layouts/iron/user_menu", class: "-m-2.5 p-2.5", anchor: "bottom end", show_name: false %>
10
+ </div>
@@ -1,83 +1,28 @@
1
- <div class="fixed inset-y-0 left-0 w-64 max-lg:hidden">
2
- <nav class="flex h-full min-h-0 flex-col">
3
- <div class="border-b border-stone-950/5 p-4 dark:border-white/5">
4
- <span class="font-semibold bg-stone-700/50 px-2 py-1 rounded-lg"><%= Iron::Current.account.name %></span>
1
+ <%# Mobile sidebar dialog %>
2
+ <el-dialog>
3
+ <dialog id="sidebar" class="backdrop:bg-transparent lg:hidden">
4
+ <el-dialog-backdrop class="fixed inset-0 bg-stone-900/80 transition-opacity duration-300 ease-linear data-closed:opacity-0"></el-dialog-backdrop>
5
+
6
+ <div tabindex="0" class="fixed inset-0 flex focus:outline-none">
7
+ <el-dialog-panel class="group/dialog-panel relative mr-16 flex w-full max-w-xs flex-1 transform transition duration-300 ease-in-out data-closed:-translate-x-full">
8
+ <div class="absolute top-0 left-full flex w-16 justify-center pt-5 duration-300 ease-in-out group-data-closed/dialog-panel:opacity-0">
9
+ <button type="button" command="close" commandfor="sidebar" class="-m-2.5 p-2.5">
10
+ <span class="sr-only">Close sidebar</span>
11
+ <%= icon "x", class: "size-6 text-white" %>
12
+ </button>
13
+ </div>
14
+
15
+ <div class="relative flex grow flex-col gap-y-5 overflow-y-auto bg-white px-6 pb-2 dark:bg-stone-900 dark:ring dark:ring-white/10 dark:before:pointer-events-none dark:before:absolute dark:before:inset-0 dark:before:bg-black/10">
16
+ <%= render "layouts/iron/sidebar_content" %>
17
+ </div>
18
+ </el-dialog-panel>
5
19
  </div>
6
-
7
- <div class="flex flex-1 flex-col overflow-y-auto p-4 [&>section+section]:mt-8">
8
- <% if Iron::Current.user.can_administer? %>
9
- <section class="flex flex-col gap-0.5">
10
- <h3 class="mb-1 px-2 text-xs/6 font-medium text-stone-500 dark:text-stone-400">Admin</h3>
11
-
12
- <ul>
13
- <%= render "layouts/iron/sidebar_item", text: "Content Types", url: content_types_path, icon: "boxes", current: controller_name == "content_types" %>
14
- <ul class="ml-4">
15
- <% Iron::ContentType.all.each do |content_type| %>
16
- <%= render "layouts/iron/sidebar_item", text: content_type.name, url: content_type_path(content_type), icon: content_type.icon.present? ? content_type.icon : "box" %>
17
- <% end %>
18
- </ul>
19
- <%= render "layouts/iron/sidebar_item", text: "Block definitions", url: block_definitions_path, icon: "blocks", current: controller_name == "block_definitions" %>
20
- <ul class="ml-4">
21
- <% Iron::BlockDefinition.all.each do |block_definition| %>
22
- <%= render "layouts/iron/sidebar_item", text: block_definition.name, url: block_definition_path(block_definition), icon: "diamond" %>
23
- <% end %>
24
- </ul>
25
- <%= render "layouts/iron/sidebar_item", text: "Locales", url: locales_path, icon: "languages", current: controller_name == "locales" %>
26
- <%= render "layouts/iron/sidebar_item", text: "Users", url: users_path, icon: "users", current: controller_name == "users" %>
27
- <%= render "layouts/iron/sidebar_item", text: "Settings", url: settings_path, icon: "settings", current: controller_name == "settings" %>
28
- </ul>
29
- </section>
30
- <% end %>
31
-
32
- <section class="flex flex-col gap-0.5">
33
- <h3 class="mb-1 px-2 text-xs/6 font-medium text-stone-500 dark:text-stone-400">Content</h3>
34
-
35
- <ul class="">
36
- <% Iron::ContentType.all.each do |content_type| %>
37
- <%= 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) %>
38
- <% end %>
39
- </ul>
40
- </section>
41
- </div>
42
-
43
- <div
44
- class="
45
- flex flex-col border-t border-stone-950/5 p-4 dark:border-white/5
46
- [&>section+section]:mt-2.5
47
- "
48
- >
49
- <%= dropdown_menu do %>
50
- <%= dropdown_menu_trigger class: "sidebar-item" do %>
51
- <span class="flex items-center gap-3 min-w-0">
52
- <%= avatar Iron::Current.user, class: "size-10", variant: "square" %>
53
- <span class="min-w-0">
54
- <span
55
- class="
56
- block truncate text-sm/5 font-medium text-stone-950 dark:text-white
57
- "
58
- >
59
- <%= Iron::Current.user.name %>
60
- </span>
61
- <span
62
- class="
63
- block truncate text-xs/5 font-normal text-stone-500 dark:text-stone-400
64
- "
65
- >
66
- <%= Iron::Current.user.email_address %>
67
- </span>
68
- </span>
69
- </span>
70
- <%= icon "chevron-up", class: "size-4" %>
71
- <% end %>
72
-
73
- <%= dropdown_menu_content width: "16rem", align: "end" do %>
74
- <%= dropdown_menu_item "My account", "#", icon: "circle-user" %>
75
-
76
- <%= dropdown_menu_separator %>
77
-
78
- <%= dropdown_menu_item "Sign out", session_path, method: :delete, icon: "log-out" %>
79
- <% end %>
80
- <% end %>
81
- </div>
82
- </nav>
20
+ </dialog>
21
+ </el-dialog>
22
+
23
+ <%# Desktop sidebar %>
24
+ <div class="hidden lg:fixed lg:inset-y-0 lg:z-50 lg:flex lg:w-72 lg:flex-col dark:bg-stone-900">
25
+ <div class="flex grow flex-col gap-y-5 overflow-y-auto border-r border-stone-200 bg-white px-6 dark:border-white/10 dark:bg-black/10">
26
+ <%= render "layouts/iron/sidebar_content" %>
27
+ </div>
83
28
  </div>
@@ -0,0 +1,36 @@
1
+ <div class="relative flex h-16 shrink-0 items-center">
2
+ <span class="font-semibold bg-stone-700/50 px-2 py-1 rounded-lg"><%= Iron::Current.account.name %></span>
3
+ </div>
4
+
5
+ <nav class="relative flex flex-1 flex-col">
6
+ <ul role="list" class="flex flex-1 flex-col gap-y-7">
7
+ <% if Iron::Current.user.can_administer? %>
8
+ <li>
9
+ <div class="text-xs/6 font-semibold text-stone-400">Admin</div>
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" %>
16
+ </ul>
17
+ </li>
18
+ <% end %>
19
+
20
+ <li>
21
+ <div class="text-xs/6 font-semibold text-stone-400">Content</div>
22
+ <ul role="list" class="-mx-2 mt-2 space-y-1">
23
+ <% 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) %>
25
+ <% end %>
26
+ </ul>
27
+ </li>
28
+
29
+ <li class="-mx-6 mt-auto">
30
+ <%= render "layouts/iron/user_menu",
31
+ class: "flex w-full items-center gap-x-4 px-6 py-3 text-sm/6 font-semibold text-stone-900 hover:bg-stone-50 dark:text-white dark:hover:bg-white/5",
32
+ anchor: "top start",
33
+ show_name: true %>
34
+ </li>
35
+ </ul>
36
+ </nav>
@@ -1,10 +1,6 @@
1
1
  <%# locals: (text:, url:, icon: nil, class: nil, current: false) -%>
2
2
 
3
- <li class="<%= tw(local_assigns[:class], "relative") %>">
4
- <% if current %>
5
- <span class="absolute inset-y-2 -left-4 w-0.5 rounded-full bg-stone-950 dark:bg-white"></span>
6
- <% end %>
7
-
3
+ <li class="<%= local_assigns[:class] %>">
8
4
  <%= link_to url, class: "sidebar-item", data: { current: current ? "true" : nil } do %>
9
5
  <% if icon.present? %>
10
6
  <%= icon(icon, data: { slot: "icon" }) %>