iron-cms 0.19.1 → 0.20.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/README.md +7 -8
- data/app/assets/builds/iron.css +2125 -2101
- data/app/assets/tailwind/iron/application.css +2 -0
- data/app/assets/tailwind/iron/components/field-list.css +35 -0
- data/app/assets/tailwind/iron/components/translation-notice.css +39 -0
- data/app/assets/tailwind/iron/lexxy.css +154 -47
- data/app/controllers/iron/blocks_controller.rb +8 -1
- data/app/controllers/iron/entries/content_copies_controller.rb +36 -0
- data/app/controllers/iron/entries_controller.rb +2 -1
- data/app/controllers/iron/references_controller.rb +7 -0
- data/app/helpers/iron/entries_helper.rb +24 -0
- data/app/helpers/iron/fields_helper.rb +21 -0
- data/app/mcp/iron/mcp/tool_context.rb +27 -12
- data/app/mcp/iron/mcp/tools/create_entry.rb +4 -3
- data/app/mcp/iron/mcp/tools/get_entry.rb +4 -3
- data/app/mcp/iron/mcp/tools/list_content_types.rb +1 -1
- data/app/mcp/iron/mcp/tools/list_entries.rb +4 -3
- data/app/mcp/iron/mcp/tools/search.rb +4 -3
- data/app/mcp/iron/mcp/tools/update_entry.rb +4 -3
- data/app/models/iron/entry/titlable.rb +29 -11
- data/app/models/iron/entry/translatable.rb +53 -0
- data/app/models/iron/entry.rb +1 -1
- data/app/models/iron/field.rb +14 -0
- data/app/models/iron/fields/block.rb +8 -0
- data/app/models/iron/fields/block_list.rb +14 -0
- data/app/models/iron/fields/boolean.rb +4 -0
- data/app/models/iron/fields/file.rb +4 -0
- data/app/models/iron/fields/reference_list.rb +8 -0
- data/app/models/iron/fields/rich_text_area.rb +10 -0
- data/app/views/iron/entries/_entry.html.erb +1 -1
- data/app/views/iron/entries/_entry_option.html.erb +4 -3
- data/app/views/iron/entries/_translation_notice.html.erb +32 -0
- data/app/views/iron/entries/edit.html.erb +14 -4
- data/app/views/iron/entries/entry.html.erb +8 -4
- data/app/views/iron/entries/fields/_block_list.html.erb +6 -22
- data/app/views/iron/entries/fields/_reference.html.erb +1 -1
- data/app/views/iron/entries/fields/_reference_item.html.erb +2 -2
- data/app/views/iron/entries/fields/_reference_list.html.erb +12 -3
- data/app/views/iron/entries/fields/block_list/_empty_state.html.erb +49 -0
- data/app/views/iron/entries/fields/block_list/_menu.html.erb +14 -0
- data/app/views/iron/entries/search.html.erb +3 -1
- data/app/views/iron/home/_recent_activity.html.erb +1 -1
- data/config/locales/en.yml +32 -0
- data/config/locales/it.yml +32 -0
- data/config/routes.rb +10 -0
- data/lib/iron/version.rb +1 -1
- metadata +18 -5
|
@@ -13,13 +13,14 @@ module Iron
|
|
|
13
13
|
handle: { type: "string", description: "Content type handle, e.g. \"post\"" },
|
|
14
14
|
route: { type: "string", description: "Fetch one entry by route instead of listing" },
|
|
15
15
|
after: { type: "string", description: "Pagination cursor from a previous response" },
|
|
16
|
-
per_page: { type: "integer", description: "Entries per page (1-100, default 25)" }
|
|
16
|
+
per_page: { type: "integer", description: "Entries per page (1-100, default 25)" },
|
|
17
|
+
locale: { type: "string", description: "Locale code to read, e.g. \"en\". Defaults to the connector's locale." }
|
|
17
18
|
},
|
|
18
19
|
required: [ "handle" ]
|
|
19
20
|
)
|
|
20
21
|
|
|
21
|
-
def self.perform(context, handle:, route: nil, after: nil, per_page: nil)
|
|
22
|
-
context.list_entries(handle:, route:, after:, per_page:)
|
|
22
|
+
def self.perform(context, handle:, route: nil, after: nil, per_page: nil, locale: nil)
|
|
23
|
+
context.list_entries(handle:, route:, after:, per_page:, locale:)
|
|
23
24
|
end
|
|
24
25
|
end
|
|
25
26
|
end
|
|
@@ -11,13 +11,14 @@ module Iron
|
|
|
11
11
|
properties: {
|
|
12
12
|
query: { type: "string", description: "Text to search for" },
|
|
13
13
|
after: { type: "string", description: "Pagination cursor from a previous response" },
|
|
14
|
-
per_page: { type: "integer", description: "Results per page (1-100, default 25)" }
|
|
14
|
+
per_page: { type: "integer", description: "Results per page (1-100, default 25)" },
|
|
15
|
+
locale: { type: "string", description: "Locale code to read, e.g. \"en\". Defaults to the connector's locale." }
|
|
15
16
|
},
|
|
16
17
|
required: [ "query" ]
|
|
17
18
|
)
|
|
18
19
|
|
|
19
|
-
def self.perform(context, query:, after: nil, per_page: nil)
|
|
20
|
-
context.search(query:, after:, per_page:)
|
|
20
|
+
def self.perform(context, query:, after: nil, per_page: nil, locale: nil)
|
|
21
|
+
context.search(query:, after:, per_page:, locale:)
|
|
21
22
|
end
|
|
22
23
|
end
|
|
23
24
|
end
|
|
@@ -14,13 +14,14 @@ module Iron
|
|
|
14
14
|
handle: { type: "string", description: "Content type handle" },
|
|
15
15
|
content: { type: "object", description: "Field handles to new values" },
|
|
16
16
|
id: { type: "integer", description: "Entry id (collection types)" },
|
|
17
|
-
route: { type: "string", description: "Entry route (web-published types)" }
|
|
17
|
+
route: { type: "string", description: "Entry route (web-published types)" },
|
|
18
|
+
locale: { type: "string", description: "Locale code to write, e.g. \"en\". Defaults to the connector's locale." }
|
|
18
19
|
},
|
|
19
20
|
required: [ "handle", "content" ]
|
|
20
21
|
)
|
|
21
22
|
|
|
22
|
-
def self.perform(context, handle:, content:, id: nil, route: nil)
|
|
23
|
-
context.update_entry(handle:, content:, id:, route:)
|
|
23
|
+
def self.perform(context, handle:, content:, id: nil, route: nil, locale: nil)
|
|
24
|
+
context.update_entry(handle:, content:, id:, route:, locale:)
|
|
24
25
|
end
|
|
25
26
|
end
|
|
26
27
|
end
|
|
@@ -4,31 +4,49 @@ module Iron
|
|
|
4
4
|
|
|
5
5
|
included do
|
|
6
6
|
scope :search_by_title, ->(query, locale = nil) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
joins(:fields)
|
|
7
|
+
matches = joins(:fields)
|
|
10
8
|
.joins(:content_type)
|
|
11
9
|
.where("iron_content_types.title_field_definition_id = iron_fields.definition_id")
|
|
12
|
-
.where(
|
|
10
|
+
.where(iron_fields: { parent_id: nil })
|
|
13
11
|
.where("iron_fields.value_string LIKE ?", "%#{query}%")
|
|
12
|
+
|
|
13
|
+
(locale ? matches.where(iron_fields: { locale_id: locale.id }) : matches).distinct
|
|
14
14
|
}
|
|
15
15
|
end
|
|
16
16
|
|
|
17
17
|
def title
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
title_field_for(displayed_locale)&.value.presence || default_title
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def display_title
|
|
22
|
+
displayed_title_field&.value || default_title
|
|
23
|
+
end
|
|
20
24
|
|
|
21
|
-
|
|
25
|
+
def title_borrowed_from
|
|
26
|
+
field = displayed_title_field
|
|
27
|
+
field.locale if field && field.locale_id != displayed_locale.id
|
|
22
28
|
end
|
|
23
29
|
|
|
24
30
|
private
|
|
31
|
+
def displayed_title_field
|
|
32
|
+
filled = title_fields.select { |field| field.value.present? }
|
|
33
|
+
filled.find { |field| field.locale_id == displayed_locale.id } || filled.first
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def displayed_locale
|
|
37
|
+
Current.locale || Locale.default
|
|
38
|
+
end
|
|
25
39
|
|
|
26
40
|
def title_field_for(locale)
|
|
27
|
-
|
|
41
|
+
title_fields.find { |field| field.locale_id == locale.id }
|
|
42
|
+
end
|
|
28
43
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
44
|
+
def title_fields
|
|
45
|
+
if content_type.title_field_definition.present?
|
|
46
|
+
fields.select { |field| field.definition_id == content_type.title_field_definition_id && field.parent_id.nil? }
|
|
47
|
+
else
|
|
48
|
+
[]
|
|
49
|
+
end
|
|
32
50
|
end
|
|
33
51
|
|
|
34
52
|
def default_title
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
module Iron
|
|
2
|
+
module Entry::Translatable
|
|
3
|
+
extend ActiveSupport::Concern
|
|
4
|
+
|
|
5
|
+
included do
|
|
6
|
+
after_save :forget_written_locales
|
|
7
|
+
after_touch :forget_written_locales
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def written_in?(locale)
|
|
11
|
+
written_locale_ids.include?(locale.id)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def written_locales
|
|
15
|
+
Locale.where(id: written_locale_ids).order(:id)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def needs_translation_into?(locale)
|
|
19
|
+
written_locale_ids.any? && !written_in?(locale)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def copy_content(from:, to:)
|
|
23
|
+
with_lock do
|
|
24
|
+
if written_in?(from) && !written_in?(to)
|
|
25
|
+
root_fields_in(to).destroy_all
|
|
26
|
+
root_fields_in(from).each { |field| field.copy_to(to).save! }
|
|
27
|
+
fields.reset
|
|
28
|
+
forget_written_locales
|
|
29
|
+
touch
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def reload(...)
|
|
35
|
+
forget_written_locales
|
|
36
|
+
super
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
private
|
|
40
|
+
def written_locale_ids
|
|
41
|
+
@written_locale_ids ||= fields.select { |field| field.parent_id.nil? }.group_by(&:locale_id)
|
|
42
|
+
.select { |_locale_id, root_fields| root_fields.any?(&:content?) }.keys
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def forget_written_locales
|
|
46
|
+
@written_locale_ids = nil
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def root_fields_in(locale)
|
|
50
|
+
fields.where(locale: locale, parent_id: nil)
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
data/app/models/iron/entry.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
module Iron
|
|
2
2
|
class Entry < ApplicationRecord
|
|
3
|
-
include Titlable, Schemable, Searchable, WebPublishable, Presentable, DeepValidation, InstanceScoped, Exportable, Importable, ContentAssignable
|
|
3
|
+
include Titlable, Translatable, Schemable, Searchable, WebPublishable, Presentable, DeepValidation, InstanceScoped, Exportable, Importable, ContentAssignable
|
|
4
4
|
|
|
5
5
|
belongs_to :creator, class_name: "Iron::User", default: -> { Current.user }
|
|
6
6
|
has_many :fields, inverse_of: :entry, dependent: :destroy
|
data/app/models/iron/field.rb
CHANGED
|
@@ -29,6 +29,17 @@ module Iron
|
|
|
29
29
|
type.demodulize.underscore
|
|
30
30
|
end
|
|
31
31
|
|
|
32
|
+
def content?
|
|
33
|
+
filled?
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def copy_to(locale)
|
|
37
|
+
dup.tap do |copy|
|
|
38
|
+
copy.locale = locale
|
|
39
|
+
copy_content_into(copy)
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
32
43
|
def searchable_text
|
|
33
44
|
nil
|
|
34
45
|
end
|
|
@@ -47,6 +58,9 @@ module Iron
|
|
|
47
58
|
|
|
48
59
|
private
|
|
49
60
|
|
|
61
|
+
def copy_content_into(copy)
|
|
62
|
+
end
|
|
63
|
+
|
|
50
64
|
def add_content_error(message)
|
|
51
65
|
(@content_errors ||= []) << message
|
|
52
66
|
end
|
|
@@ -45,6 +45,10 @@ module Iron
|
|
|
45
45
|
end
|
|
46
46
|
end
|
|
47
47
|
|
|
48
|
+
def content?
|
|
49
|
+
fields.any?(&:content?)
|
|
50
|
+
end
|
|
51
|
+
|
|
48
52
|
def find_or_build_field(definition)
|
|
49
53
|
fields.find { |f| f.definition == definition } || fields.build(type: definition.field_type, entry:, definition: definition, locale:)
|
|
50
54
|
end
|
|
@@ -96,6 +100,10 @@ module Iron
|
|
|
96
100
|
|
|
97
101
|
private
|
|
98
102
|
|
|
103
|
+
def copy_content_into(copy)
|
|
104
|
+
fields.each { |field| copy.fields << field.copy_to(copy.locale) }
|
|
105
|
+
end
|
|
106
|
+
|
|
99
107
|
def export_nested_fields
|
|
100
108
|
fields.to_h { |f| [ f.definition.handle, f.export_value ] }
|
|
101
109
|
end
|
|
@@ -44,6 +44,16 @@ module Iron
|
|
|
44
44
|
end
|
|
45
45
|
end
|
|
46
46
|
|
|
47
|
+
def content?
|
|
48
|
+
blocks.any?
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def counterpart_with_blocks
|
|
52
|
+
if parent.nil?
|
|
53
|
+
entry.fields.find { |field| field.definition_id == definition_id && field.definition_type == definition_type && field.locale_id != locale_id && field.parent_id.nil? && field.content? }
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
|
|
47
57
|
def value
|
|
48
58
|
blocks.map(&:value)
|
|
49
59
|
end
|
|
@@ -58,6 +68,10 @@ module Iron
|
|
|
58
68
|
|
|
59
69
|
private
|
|
60
70
|
|
|
71
|
+
def copy_content_into(copy)
|
|
72
|
+
blocks.each { |block| copy.blocks << block.copy_to(copy.locale) }
|
|
73
|
+
end
|
|
74
|
+
|
|
61
75
|
def resolve_block_definition(block_data)
|
|
62
76
|
unless block_data.is_a?(Hash)
|
|
63
77
|
add_content_error("must contain block objects")
|
|
@@ -22,6 +22,10 @@ module Iron
|
|
|
22
22
|
end
|
|
23
23
|
end
|
|
24
24
|
|
|
25
|
+
def content?
|
|
26
|
+
references.any?
|
|
27
|
+
end
|
|
28
|
+
|
|
25
29
|
def value
|
|
26
30
|
references.map do |reference|
|
|
27
31
|
OpenStruct.new(
|
|
@@ -37,6 +41,10 @@ module Iron
|
|
|
37
41
|
|
|
38
42
|
private
|
|
39
43
|
|
|
44
|
+
def copy_content_into(copy)
|
|
45
|
+
references.each { |reference| copy.references.build(entry: reference.entry, rank: reference.rank) }
|
|
46
|
+
end
|
|
47
|
+
|
|
40
48
|
def supported_content_type?(referenced)
|
|
41
49
|
return true if definition.supported_content_types.empty?
|
|
42
50
|
|
|
@@ -2,6 +2,8 @@ module Iron
|
|
|
2
2
|
class Fields::RichTextArea < Field
|
|
3
3
|
include ActionView::Helpers::TagHelper
|
|
4
4
|
|
|
5
|
+
NON_TEXT_CONTENT = "action-text-attachment, img, picture, video, audio, iframe, embed, object, hr"
|
|
6
|
+
|
|
5
7
|
has_rich_text :rich_text
|
|
6
8
|
|
|
7
9
|
def content_value=(value)
|
|
@@ -10,6 +12,10 @@ module Iron
|
|
|
10
12
|
|
|
11
13
|
def filled? = rich_text&.body.present?
|
|
12
14
|
|
|
15
|
+
def content?
|
|
16
|
+
filled? && (rich_text.body.fragment.source.text.present? || rich_text.body.fragment.find_all(NON_TEXT_CONTENT).any?)
|
|
17
|
+
end
|
|
18
|
+
|
|
13
19
|
def searchable_text
|
|
14
20
|
rich_text&.to_plain_text
|
|
15
21
|
end
|
|
@@ -38,6 +44,10 @@ module Iron
|
|
|
38
44
|
|
|
39
45
|
private
|
|
40
46
|
|
|
47
|
+
def copy_content_into(copy)
|
|
48
|
+
copy.rich_text = rich_text.body if filled?
|
|
49
|
+
end
|
|
50
|
+
|
|
41
51
|
def export_attachment_tag(attachment)
|
|
42
52
|
case attachable = attachment.attachable
|
|
43
53
|
when ActiveStorage::Blob
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
<div id="<%= dom_id entry %>" class="card-item flex items-center justify-between gap-4">
|
|
4
4
|
<div class="min-w-0">
|
|
5
|
-
<%= link_to entry.
|
|
5
|
+
<%= link_to entry.display_title, edit_entry_path(entry, locale: Iron::Current.locale.code), class: "card-link block text-sm font-medium text-stone-900 dark:text-white truncate" %>
|
|
6
6
|
<span class="text-xs text-stone-400 dark:text-stone-500">
|
|
7
7
|
<%= t("iron.shared.time_ago", time: time_ago_in_words(entry.updated_at)) %>
|
|
8
8
|
</span>
|
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
<%# locals: (entry:, reference_list_dom_id:, form_field_name:) -%>
|
|
1
|
+
<%# locals: (entry:, reference_list_dom_id:, form_field_name:, locale:) -%>
|
|
2
2
|
|
|
3
3
|
<div id="<%= dom_id entry %>" class="relative">
|
|
4
4
|
<%= link_to new_reference_path(
|
|
5
5
|
reference_list_dom_id:,
|
|
6
6
|
form_field_name:,
|
|
7
|
-
entry_id: entry
|
|
7
|
+
entry_id: entry,
|
|
8
|
+
locale: locale.code
|
|
8
9
|
),
|
|
9
10
|
data: { turbo_stream: true },
|
|
10
11
|
class: "block px-2 py-2 hover:bg-stone-50 dark:hover:bg-stone-700/50 transition-colors rounded-lg" do %>
|
|
11
12
|
<div class="flex items-start justify-between gap-4 pr-6">
|
|
12
13
|
<div class="flex flex-col sm:flex-row sm:items-center sm:gap-8 min-w-0 flex-1">
|
|
13
14
|
<div class="flex items-center gap-3 shrink-0">
|
|
14
|
-
<h3 class="text-base font-semibold text-stone-900 dark:text-white truncate"><%= entry.
|
|
15
|
+
<h3 class="text-base font-semibold text-stone-900 dark:text-white truncate"><%= entry.display_title %></h3>
|
|
15
16
|
</div>
|
|
16
17
|
</div>
|
|
17
18
|
</div>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<%# locals: (entry:, locale:) -%>
|
|
2
|
+
|
|
3
|
+
<% source = entry.written_locales.first %>
|
|
4
|
+
|
|
5
|
+
<section class="translation-notice" aria-labelledby="translation_notice_title">
|
|
6
|
+
<div class="translation-notice-icon">
|
|
7
|
+
<%= icon "languages", class: "size-5" %>
|
|
8
|
+
</div>
|
|
9
|
+
|
|
10
|
+
<div class="min-w-0 flex-1 basis-80">
|
|
11
|
+
<h2 id="translation_notice_title" class="translation-notice-title"><%= t(".title", target: locale.name) %></h2>
|
|
12
|
+
<p class="translation-notice-description"><%= t(".description", source: source.name, target: locale.name) %></p>
|
|
13
|
+
|
|
14
|
+
<div class="translation-notice-actions">
|
|
15
|
+
<% if Iron::Current.user.can_write? %>
|
|
16
|
+
<%= button_to entry_content_copy_path(entry), params: { from: source.code, to: locale.code }, class: "button-primary", form_class: "translation-notice-copy" do %>
|
|
17
|
+
<%= icon "copy", class: "size-4" %>
|
|
18
|
+
<%= t(".copy", source: source.name) %>
|
|
19
|
+
<% end %>
|
|
20
|
+
<% end %>
|
|
21
|
+
|
|
22
|
+
<%= link_to entry_editor_path(entry, locale: source), class: "button-secondary" do %>
|
|
23
|
+
<%= t(".switch", source: source.name) %>
|
|
24
|
+
<%= icon "arrow-right", class: "size-4" %>
|
|
25
|
+
<% end %>
|
|
26
|
+
</div>
|
|
27
|
+
|
|
28
|
+
<% if Iron::Current.user.can_write? %>
|
|
29
|
+
<p class="translation-notice-unsaved"><%= t(".unsaved_changes", source: source.name) %></p>
|
|
30
|
+
<% end %>
|
|
31
|
+
</div>
|
|
32
|
+
</section>
|
|
@@ -9,18 +9,20 @@
|
|
|
9
9
|
<button type="button" class="inline-flex items-center gap-x-1.5 rounded-md bg-white px-3 py-2 text-sm font-medium text-stone-700 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">
|
|
10
10
|
<%= icon "globe", class: "size-4 text-stone-500 dark:text-stone-400" %>
|
|
11
11
|
<%= @locale.name %>
|
|
12
|
+
<%= untranslated_dot if @entry.needs_translation_into?(@locale) %>
|
|
12
13
|
<%= icon "chevron-down", class: "size-4 text-stone-400 dark:text-stone-500" %>
|
|
13
14
|
</button>
|
|
14
15
|
|
|
15
|
-
<el-menu anchor="bottom end" popover class="w-
|
|
16
|
+
<el-menu anchor="bottom end" popover class="w-64 origin-top-right 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">
|
|
16
17
|
<div class="py-1">
|
|
17
18
|
<% Iron::Locale.all.each do |locale| %>
|
|
18
19
|
<%= link_to edit_entry_path(@entry, locale: locale.code),
|
|
19
|
-
class: "group/item flex items-center px-4 py-2 text-sm #{locale.code == @locale.code ? 'text-sky-600 dark:text-sky-400 font-medium' : 'text-stone-700 dark:text-stone-300'} focus:bg-sky-100 focus:text-stone-900 focus:outline-hidden dark:focus:bg-sky-500/20 dark:focus:text-white" do %>
|
|
20
|
+
class: "group/item flex items-center gap-x-3 px-4 py-2 text-sm #{locale.code == @locale.code ? 'text-sky-600 dark:text-sky-400 font-medium' : 'text-stone-700 dark:text-stone-300'} focus:bg-sky-100 focus:text-stone-900 focus:outline-hidden dark:focus:bg-sky-500/20 dark:focus:text-white" do %>
|
|
20
21
|
<% if locale.code == @locale.code %>
|
|
21
|
-
<%= icon "check", class: "mr-
|
|
22
|
+
<%= icon "check", class: "-mr-1 size-4" %>
|
|
22
23
|
<% end %>
|
|
23
24
|
<%= locale.name %>
|
|
25
|
+
<%= locale_content_status(@entry, locale) %>
|
|
24
26
|
<% end %>
|
|
25
27
|
<% end %>
|
|
26
28
|
</div>
|
|
@@ -49,7 +51,7 @@
|
|
|
49
51
|
</div>
|
|
50
52
|
</div>
|
|
51
53
|
|
|
52
|
-
<h1 class="page-title-lg"><%= @entry.
|
|
54
|
+
<h1 class="page-title-lg"><%= @entry.display_title %></h1>
|
|
53
55
|
|
|
54
56
|
<div class="mt-4 flex flex-wrap items-center gap-2">
|
|
55
57
|
<% if @entry.creator %>
|
|
@@ -62,6 +64,12 @@
|
|
|
62
64
|
<%= icon "clock", class: "size-3.5" %>
|
|
63
65
|
<%= t("iron.shared.time_ago", time: time_ago_in_words(@entry.updated_at)) %>
|
|
64
66
|
<% end %>
|
|
67
|
+
<% if title_source = @entry.title_borrowed_from %>
|
|
68
|
+
<%= badge do %>
|
|
69
|
+
<%= icon "languages", class: "size-3.5" %>
|
|
70
|
+
<%= t(".title_from", source: title_source.name) %>
|
|
71
|
+
<% end %>
|
|
72
|
+
<% end %>
|
|
65
73
|
<% if @entry.content_type.web_publishing_enabled? && !@entry.route.nil? %>
|
|
66
74
|
<%= link_to @entry.path, target: "_blank", rel: "noopener",
|
|
67
75
|
class: "badge badge-sky" do %>
|
|
@@ -74,5 +82,7 @@
|
|
|
74
82
|
<div class="absolute bottom-0 left-0 right-0 h-px bg-gradient-to-r from-transparent via-stone-200 to-transparent dark:via-stone-700"></div>
|
|
75
83
|
</header>
|
|
76
84
|
|
|
85
|
+
<%= render "translation_notice", entry: @entry, locale: @locale if @entry.needs_translation_into?(@locale) %>
|
|
86
|
+
|
|
77
87
|
<%= render "form", entry: @entry, locale: @locale %>
|
|
78
88
|
</div>
|
|
@@ -10,18 +10,20 @@
|
|
|
10
10
|
<button type="button" class="inline-flex items-center gap-x-1.5 rounded-md bg-white px-3 py-2 text-sm font-medium text-stone-700 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">
|
|
11
11
|
<%= icon "globe", class: "size-4 text-stone-500 dark:text-stone-400" %>
|
|
12
12
|
<%= @locale.name %>
|
|
13
|
+
<%= untranslated_dot if @entry.needs_translation_into?(@locale) %>
|
|
13
14
|
<%= icon "chevron-down", class: "size-4 text-stone-400 dark:text-stone-500" %>
|
|
14
15
|
</button>
|
|
15
16
|
|
|
16
|
-
<el-menu anchor="bottom end" popover class="w-
|
|
17
|
+
<el-menu anchor="bottom end" popover class="w-64 origin-top-right 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">
|
|
17
18
|
<div class="py-1">
|
|
18
19
|
<% Iron::Locale.all.each do |locale| %>
|
|
19
|
-
<%= link_to
|
|
20
|
-
class: "group/item flex items-center px-4 py-2 text-sm #{locale.code == @locale.code ? 'text-sky-600 dark:text-sky-400 font-medium' : 'text-stone-700 dark:text-stone-300'} focus:bg-sky-100 focus:text-stone-900 focus:outline-hidden dark:focus:bg-sky-500/20 dark:focus:text-white" do %>
|
|
20
|
+
<%= link_to entry_content_type_path(@content_type, locale: locale.code),
|
|
21
|
+
class: "group/item flex items-center gap-x-3 px-4 py-2 text-sm #{locale.code == @locale.code ? 'text-sky-600 dark:text-sky-400 font-medium' : 'text-stone-700 dark:text-stone-300'} focus:bg-sky-100 focus:text-stone-900 focus:outline-hidden dark:focus:bg-sky-500/20 dark:focus:text-white" do %>
|
|
21
22
|
<% if locale.code == @locale.code %>
|
|
22
|
-
<%= icon "check", class: "mr-
|
|
23
|
+
<%= icon "check", class: "-mr-1 size-4" %>
|
|
23
24
|
<% end %>
|
|
24
25
|
<%= locale.name %>
|
|
26
|
+
<%= locale_content_status(@entry, locale) %>
|
|
25
27
|
<% end %>
|
|
26
28
|
<% end %>
|
|
27
29
|
</div>
|
|
@@ -48,5 +50,7 @@
|
|
|
48
50
|
<div class="absolute bottom-0 left-0 right-0 h-px bg-gradient-to-r from-transparent via-stone-200 to-transparent dark:via-stone-700"></div>
|
|
49
51
|
</header>
|
|
50
52
|
|
|
53
|
+
<%= render "translation_notice", entry: @entry, locale: @locale if @entry.needs_translation_into?(@locale) %>
|
|
54
|
+
|
|
51
55
|
<%= render "form", entry: @entry, locale: @locale %>
|
|
52
56
|
</div>
|
|
@@ -2,36 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
<% block_list = field %>
|
|
4
4
|
|
|
5
|
-
<section class="space-y-4">
|
|
5
|
+
<section class="field-list space-y-4">
|
|
6
6
|
<div class="flex items-center justify-between">
|
|
7
7
|
<h3 class="text-sm font-semibold text-stone-900 dark:text-white"><%= block_list.definition.name %></h3>
|
|
8
8
|
|
|
9
9
|
<el-dropdown class="inline-block">
|
|
10
10
|
<button type="button" class="inline-flex items-center gap-x-1.5 rounded-md bg-white px-3 py-2 text-sm font-medium text-stone-700 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">
|
|
11
11
|
<%= icon "plus", class: "size-4" %>
|
|
12
|
-
|
|
12
|
+
<%= t(".add_block") %>
|
|
13
13
|
<%= icon "chevron-down", class: "size-4 text-stone-400 dark:text-stone-500" %>
|
|
14
14
|
</button>
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
<div class="py-1">
|
|
18
|
-
<% block_list.definition.supported_block_definitions.each do |block_definition| %>
|
|
19
|
-
<%= link_to new_block_path(
|
|
20
|
-
block_list_field_definition_id: block_list.definition.id,
|
|
21
|
-
block_definition_id: block_definition.id,
|
|
22
|
-
locale_id: block_list.locale.id,
|
|
23
|
-
form_field_name: builder.field_name(:blocks_attributes),
|
|
24
|
-
),
|
|
25
|
-
data: {
|
|
26
|
-
turbo_stream: true,
|
|
27
|
-
},
|
|
28
|
-
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 %>
|
|
29
|
-
<%= 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" %>
|
|
30
|
-
<%= block_definition.name %>
|
|
31
|
-
<% end %>
|
|
32
|
-
<% end %>
|
|
33
|
-
</div>
|
|
34
|
-
</el-menu>
|
|
16
|
+
<%= render "iron/entries/fields/block_list/menu", block_list:, builder:, block_definitions: block_list.definition.supported_block_definitions %>
|
|
35
17
|
</el-dropdown>
|
|
36
18
|
</div>
|
|
37
19
|
|
|
@@ -44,7 +26,7 @@
|
|
|
44
26
|
|
|
45
27
|
<div
|
|
46
28
|
id="<%= dom_id(block_list.definition) %>"
|
|
47
|
-
class="space-y-3"
|
|
29
|
+
class="field-list-items space-y-3"
|
|
48
30
|
data-controller="sortable-list"
|
|
49
31
|
>
|
|
50
32
|
<% block_list.blocks.each do |block| %>
|
|
@@ -53,4 +35,6 @@
|
|
|
53
35
|
<% end %>
|
|
54
36
|
<% end %>
|
|
55
37
|
</div>
|
|
38
|
+
|
|
39
|
+
<%= render "iron/entries/fields/block_list/empty_state", block_list:, builder: %>
|
|
56
40
|
</section>
|
|
@@ -8,6 +8,6 @@
|
|
|
8
8
|
|
|
9
9
|
<%= render "iron/entries/fields/field_label", builder: builder, field: field, attribute: :referenced_entry_id %>
|
|
10
10
|
<% entries = Iron::Entry.with_content_type(field.definition.supported_content_types.pluck(:id)) %>
|
|
11
|
-
<%= builder.collection_select :referenced_entry_id, entries, :id, :
|
|
11
|
+
<%= builder.collection_select :referenced_entry_id, entries, :id, :display_title, { include_blank: "Select an entry" } %>
|
|
12
12
|
<%= render "iron/entries/fields/field_errors", field: field %>
|
|
13
13
|
</div>
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
class="group reference-item"
|
|
5
5
|
data-sortable-list-target="item"
|
|
6
6
|
>
|
|
7
|
-
<%= builder.check_box :_destroy, class: "destroy hidden", data: { destroy: "" } %>
|
|
7
|
+
<%= builder.check_box :_destroy, class: "destroy hidden", unstyled: true, data: { destroy: "" } %>
|
|
8
8
|
<%= builder.hidden_field :rank, data: { sortable_list_target: "rank" } %>
|
|
9
9
|
<%= builder.hidden_field :entry_id %>
|
|
10
10
|
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
|
|
24
24
|
<div class="flex-1 min-w-0">
|
|
25
25
|
<span class="reference-title">
|
|
26
|
-
<%= reference.entry.
|
|
26
|
+
<%= reference.entry.display_title %>
|
|
27
27
|
</span>
|
|
28
28
|
</div>
|
|
29
29
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<% reference_list = field %>
|
|
4
4
|
<% reference_list_dom_id = dom_id(reference_list, unique_id) %>
|
|
5
5
|
|
|
6
|
-
<section class="space-y-4">
|
|
6
|
+
<section class="field-list space-y-4">
|
|
7
7
|
<div class="flex items-center justify-between">
|
|
8
8
|
<h3 class="text-sm font-semibold text-stone-900 dark:text-white">
|
|
9
9
|
<%= reference_list.definition.name %>
|
|
@@ -12,13 +12,14 @@
|
|
|
12
12
|
<% picker_id = "picker_#{reference_list_dom_id}" %>
|
|
13
13
|
<button type="button" class="button-secondary button-sm" popovertarget="<%= picker_id %>">
|
|
14
14
|
<%= icon "plus", class: "size-4" %>
|
|
15
|
-
|
|
15
|
+
<%= t(".add") %>
|
|
16
16
|
</button>
|
|
17
17
|
<div id="<%= picker_id %>" popover class="rounded-lg overflow-hidden mt-2 bg-stone-800/90 backdrop-blur-xs shadow-sm w-sm [position-area:bottom_span-right]">
|
|
18
18
|
<%= turbo_frame_tag "entries_picker", src: entries_search_path(
|
|
19
19
|
reference_list_field_definition_id: reference_list.definition.id,
|
|
20
20
|
reference_list_dom_id: reference_list_dom_id,
|
|
21
21
|
form_field_name: builder.field_name(:references_attributes),
|
|
22
|
+
locale: reference_list.locale.code,
|
|
22
23
|
) do %>
|
|
23
24
|
<% end %>
|
|
24
25
|
</div>
|
|
@@ -33,7 +34,7 @@
|
|
|
33
34
|
|
|
34
35
|
<div
|
|
35
36
|
id="<%= reference_list_dom_id %>"
|
|
36
|
-
class="space-y-2"
|
|
37
|
+
class="field-list-items space-y-2"
|
|
37
38
|
data-controller="sortable-list"
|
|
38
39
|
>
|
|
39
40
|
<% reference_list.references.each do |reference| %>
|
|
@@ -42,4 +43,12 @@
|
|
|
42
43
|
<% end %>
|
|
43
44
|
<% end %>
|
|
44
45
|
</div>
|
|
46
|
+
|
|
47
|
+
<div class="field-list-empty">
|
|
48
|
+
<div class="field-list-empty-icon">
|
|
49
|
+
<%= icon "link", class: "size-5" %>
|
|
50
|
+
</div>
|
|
51
|
+
<p class="field-list-empty-title"><%= t(".empty_title") %></p>
|
|
52
|
+
<p class="field-list-empty-description"><%= t(".empty_description") %></p>
|
|
53
|
+
</div>
|
|
45
54
|
</section>
|