keystone_ui 0.69.0 → 0.71.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/app/components/keystone/ui/data_table_component.html.erb +14 -11
- data/app/components/keystone/ui/data_table_component.rb +45 -4
- data/app/components/keystone/ui/page_header_component.html.erb +24 -8
- data/app/components/keystone/ui/page_header_component.rb +33 -2
- data/lib/keystone_ui/version.rb +1 -1
- data/the_local/agents/keystone_ui-develop.md +26 -6
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5355c29793674a40bcd010200e66a7f6e99ec08de1b802aab127ad42e7e0d9b7
|
|
4
|
+
data.tar.gz: '09001801fe0132be8e69116ab38b2dbe7031978ee144a0f707d35ec711a4e952'
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 95ce9153bafe6c8cc3a5d7e84216713f20ef8c23f6d960a97728dd1f431a0fd2f7edf9efc031f47545c588a6ca379ce1b189dd7d72c99e0b3a8946d4ef96a28b
|
|
7
|
+
data.tar.gz: 11657cd55a53830686b48b3eaf4bf9240872e4a1754fe2f1e0edf2d827eeb3976424daae2ba499d3b259425aa6e16377c03dabc3e6d2320904ae3d09c0ad2618
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
</div>
|
|
5
5
|
<% end %>
|
|
6
6
|
<div class="<%= Keystone::Ui::DataTableComponent::WRAPPER_CLASSES %>">
|
|
7
|
-
<table class="
|
|
8
|
-
<thead class="<%=
|
|
7
|
+
<table class="<%= table_classes %> divide-y divide-gray-300 dark:divide-white/15">
|
|
8
|
+
<thead class="<%= head_classes %>">
|
|
9
9
|
<tr>
|
|
10
10
|
<% header_cells.each do |cell| %>
|
|
11
11
|
<th scope="<%= cell[:scope] %>" class="<%= cell[:classes] %>">
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
<% end %>
|
|
26
26
|
</tr>
|
|
27
27
|
</thead>
|
|
28
|
-
<tbody class="<%=
|
|
28
|
+
<tbody class="<%= body_classes %>"<% if row_detail? %> data-controller="row-detail" data-action="turbo:before-morph-attribute->row-detail#keep"<% end %>>
|
|
29
29
|
<% if empty? %>
|
|
30
30
|
<% if @empty_message %>
|
|
31
31
|
<tr>
|
|
@@ -37,9 +37,9 @@
|
|
|
37
37
|
<% else %>
|
|
38
38
|
<% @items.each_with_index do |item, idx| %>
|
|
39
39
|
<% if (group = group_starting_at(idx)) %>
|
|
40
|
-
<tr class="<%=
|
|
40
|
+
<tr class="<%= summary_row_classes %>" data-table-group>
|
|
41
41
|
<% group_cells(group).each do |cell| %>
|
|
42
|
-
<th scope="colgroup" class="<%= cell[:classes] %>"><%= cell[:value] %></th>
|
|
42
|
+
<th scope="colgroup" class="<%= cell[:classes] %>"><% if cell[:label] %><span class="<%= Keystone::Ui::DataTableComponent::CELL_LABEL_CLASSES %>"><%= cell[:label] %></span><% end %><%= cell[:value] %></th>
|
|
43
43
|
<% end %>
|
|
44
44
|
<% if actions? %><th></th><% end %>
|
|
45
45
|
</tr>
|
|
@@ -48,6 +48,9 @@
|
|
|
48
48
|
<tr<% if (classes = row_classes(idx)) %> class="<%= classes %>"<% end %><% if current_row?(idx) %> aria-current="true"<% end %><% if detail.present? %> data-action="click->row-detail#toggle"<% end %>>
|
|
49
49
|
<% row_cells[idx].each_with_index do |cell, cell_index| %>
|
|
50
50
|
<td class="<%= cell[:classes] %>">
|
|
51
|
+
<% if cell[:label] %>
|
|
52
|
+
<span class="<%= Keystone::Ui::DataTableComponent::CELL_LABEL_CLASSES %>"><%= cell[:label] %></span>
|
|
53
|
+
<% end %>
|
|
51
54
|
<% if detail.present? && cell_index.zero? %>
|
|
52
55
|
<button type="button" class="<%= Keystone::Ui::DataTableComponent::DETAIL_BUTTON_CLASSES %>" aria-label="Show detail" aria-expanded="false" aria-controls="<%= row_detail_id(idx) %>" data-row-detail-target="toggle"><%= Keystone::Ui::DisclosureComponent::CARET_ICON.html_safe %></button>
|
|
53
56
|
<% end %>
|
|
@@ -59,7 +62,7 @@
|
|
|
59
62
|
</td>
|
|
60
63
|
<% end %>
|
|
61
64
|
<% if actions? %>
|
|
62
|
-
<td class="<%=
|
|
65
|
+
<td class="<%= actions_cell_classes %>">
|
|
63
66
|
<% row_actions = capture(item, &@actions_block) %>
|
|
64
67
|
<% if row_actions.present? %>
|
|
65
68
|
<%= render Keystone::Ui::ActionMenuComponent.new do %>
|
|
@@ -70,18 +73,18 @@
|
|
|
70
73
|
<% end %>
|
|
71
74
|
</tr>
|
|
72
75
|
<% if detail.present? %>
|
|
73
|
-
<tr id="<%= row_detail_id(idx) %>" hidden data-row-detail-target="detail">
|
|
74
|
-
<td colspan="<%= column_count %>"><%= detail %></td>
|
|
76
|
+
<tr id="<%= row_detail_id(idx) %>"<% if phone_list_block_classes %> class="<%= phone_list_block_classes %>"<% end %> hidden data-row-detail-target="detail">
|
|
77
|
+
<td<% if phone_list_block_classes %> class="<%= phone_list_block_classes %>"<% end %> colspan="<%= column_count %>"><%= detail %></td>
|
|
75
78
|
</tr>
|
|
76
79
|
<% end %>
|
|
77
80
|
<% end %>
|
|
78
81
|
<% end %>
|
|
79
82
|
</tbody>
|
|
80
83
|
<% if total_cells.any? %>
|
|
81
|
-
<tfoot class="<%=
|
|
82
|
-
<tr
|
|
84
|
+
<tfoot class="<%= summary_row_classes %>">
|
|
85
|
+
<tr<% if phone_list_block_classes %> class="<%= phone_list_block_classes %>"<% end %>>
|
|
83
86
|
<% total_cells.each do |cell| %>
|
|
84
|
-
<th scope="row" class="<%= cell[:classes] %>"><%= cell[:value] %></th>
|
|
87
|
+
<th scope="row" class="<%= cell[:classes] %>"><% if cell[:label] %><span class="<%= Keystone::Ui::DataTableComponent::CELL_LABEL_CLASSES %>"><%= cell[:label] %></span><% end %><%= cell[:value] %></th>
|
|
85
88
|
<% end %>
|
|
86
89
|
<% if actions? %><th></th><% end %>
|
|
87
90
|
</tr>
|
|
@@ -14,6 +14,7 @@ module Keystone
|
|
|
14
14
|
}.freeze
|
|
15
15
|
DETAIL_BUTTON_CLASSES = "ks-disclosure-icon inline-flex align-middle transition-transform aria-expanded:rotate-180"
|
|
16
16
|
HEAD_CLASSES = "ks-table-head"
|
|
17
|
+
TABLE_CLASSES = "relative min-w-full"
|
|
17
18
|
WRAPPER_CLASSES = "ks-table overflow-x-auto"
|
|
18
19
|
TOOLBAR_CLASSES = "ks-table-toolbar flex justify-end"
|
|
19
20
|
HEADER_CLASSES_FIRST = "ks-table-header ks-table-header-first text-left text-sm"
|
|
@@ -29,6 +30,11 @@ module Keystone
|
|
|
29
30
|
HEADER_LOCKED_CLASSES = "ks-table-header-locked sticky left-0"
|
|
30
31
|
CELL_LOCKED_CLASSES = "ks-table-cell-locked sticky left-0"
|
|
31
32
|
|
|
33
|
+
PHONE_LIST_HEAD_CLASSES = "max-sm:hidden"
|
|
34
|
+
PHONE_LIST_BLOCK_CLASSES = "max-sm:block"
|
|
35
|
+
PHONE_LIST_CELL_CLASSES = "max-sm:block max-sm:text-left max-sm:whitespace-normal"
|
|
36
|
+
CELL_LABEL_CLASSES = "ks-caption block sm:hidden"
|
|
37
|
+
|
|
32
38
|
SORT_LINK_CLASSES = "ks-table-sort-link group inline-flex items-center"
|
|
33
39
|
SORT_ICON_CLASSES = "h-4 w-4 flex-shrink-0"
|
|
34
40
|
SORT_ICON_ACTIVE = "ks-table-sort-icon-active"
|
|
@@ -38,7 +44,7 @@ module Keystone
|
|
|
38
44
|
SORT_DESC_ICON = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor"><path fill-rule="evenodd" d="M10 3a.75.75 0 0 1 .75.75v10.638l3.96-4.158a.75.75 0 1 1 1.08 1.04l-5.25 5.5a.75.75 0 0 1-1.08 0l-5.25-5.5a.75.75 0 0 1 1.08-1.04l3.96 4.158V3.75A.75.75 0 0 1 10 3Z" clip-rule="evenodd" /></svg>'
|
|
39
45
|
SORT_NEUTRAL_ICON = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor"><path fill-rule="evenodd" d="M10 3a.75.75 0 0 1 .55.24l3.25 3.5a.75.75 0 1 1-1.1 1.02L10 4.852 7.3 7.76a.75.75 0 0 1-1.1-1.02l3.25-3.5A.75.75 0 0 1 10 3Zm-3.76 9.2a.75.75 0 0 1 1.06.04l2.7 2.908 2.7-2.908a.75.75 0 1 1 1.1 1.02l-3.25 3.5a.75.75 0 0 1-1.1 0l-3.25-3.5a.75.75 0 0 1 .04-1.06Z" clip-rule="evenodd" /></svg>'
|
|
40
46
|
|
|
41
|
-
def initialize(items:, columns:, empty_message: nil, sort: nil, sort_direction: nil, sort_url: nil, hidden_columns: [], key: nil, group_by: nil, group_totals: {}, total: nil, current_row: nil)
|
|
47
|
+
def initialize(items:, columns:, empty_message: nil, sort: nil, sort_direction: nil, sort_url: nil, hidden_columns: [], key: nil, group_by: nil, group_totals: {}, total: nil, current_row: nil, phone_list: false)
|
|
42
48
|
@items = items.to_a
|
|
43
49
|
@current_index = @items.index(current_row) unless current_row.nil?
|
|
44
50
|
@group_by = group_by
|
|
@@ -55,6 +61,7 @@ module Keystone
|
|
|
55
61
|
@sort_url = sort_url
|
|
56
62
|
@actions_block = nil
|
|
57
63
|
@link_blocks = {}
|
|
64
|
+
@phone_list = phone_list
|
|
58
65
|
end
|
|
59
66
|
|
|
60
67
|
def before_render
|
|
@@ -87,11 +94,35 @@ module Keystone
|
|
|
87
94
|
end
|
|
88
95
|
|
|
89
96
|
def row_classes(index)
|
|
90
|
-
classes = [ (CURRENT_ROW_CLASSES if current_row?(index)), row_colour_class(@items[index]) ].compact
|
|
97
|
+
classes = [ (CURRENT_ROW_CLASSES if current_row?(index)), row_colour_class(@items[index]), (PHONE_LIST_BLOCK_CLASSES if @phone_list) ].compact
|
|
91
98
|
|
|
92
99
|
classes.join(" ") unless classes.empty?
|
|
93
100
|
end
|
|
94
101
|
|
|
102
|
+
def table_classes
|
|
103
|
+
phone_list_classes(TABLE_CLASSES, PHONE_LIST_BLOCK_CLASSES)
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
def body_classes
|
|
107
|
+
phone_list_classes(BODY_CLASSES, PHONE_LIST_BLOCK_CLASSES)
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
def summary_row_classes
|
|
111
|
+
phone_list_classes(HEAD_CLASSES, PHONE_LIST_BLOCK_CLASSES)
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
def phone_list_block_classes
|
|
115
|
+
PHONE_LIST_BLOCK_CLASSES if @phone_list
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
def actions_cell_classes
|
|
119
|
+
phone_list_classes(ROW_CLASSES_LAST, PHONE_LIST_BLOCK_CLASSES)
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
def head_classes
|
|
123
|
+
phone_list_classes(HEAD_CLASSES, PHONE_LIST_HEAD_CLASSES)
|
|
124
|
+
end
|
|
125
|
+
|
|
95
126
|
def actions?
|
|
96
127
|
!!@actions_block
|
|
97
128
|
end
|
|
@@ -159,11 +190,13 @@ module Keystone
|
|
|
159
190
|
tokens = [ row_classes_for(index) ]
|
|
160
191
|
tokens << MOBILE_HIDDEN_CLASSES if column.mobile_hidden?
|
|
161
192
|
tokens << CELL_LOCKED_CLASSES if index.zero? && column.locked?
|
|
193
|
+
tokens << PHONE_LIST_CELL_CLASSES if @phone_list && !column.mobile_hidden?
|
|
162
194
|
|
|
163
195
|
cell = {
|
|
164
196
|
value: resolve_value(item, column.key),
|
|
165
197
|
classes: wrapped(aligned(tokens.join(" "), column), column)
|
|
166
198
|
}
|
|
199
|
+
cell[:label] = column.header_text if @phone_list
|
|
167
200
|
|
|
168
201
|
link_block = @link_blocks[column.key]
|
|
169
202
|
cell[:href] = link_block.call(item) if link_block
|
|
@@ -196,19 +229,27 @@ module Keystone
|
|
|
196
229
|
return [] unless @total
|
|
197
230
|
|
|
198
231
|
@columns.map.with_index do |column, index|
|
|
199
|
-
{ value: @total[column.key.to_s], classes: aligned(header_classes_for(index), column) }
|
|
232
|
+
{ value: @total[column.key.to_s], classes: phone_list_classes(aligned(header_classes_for(index), column), PHONE_LIST_CELL_CLASSES), label: summary_label(index, column) }
|
|
200
233
|
end
|
|
201
234
|
end
|
|
202
235
|
|
|
203
236
|
def group_cells(name)
|
|
204
237
|
subtotals = @group_totals.fetch(name.to_s, {}).to_h.transform_keys(&:to_s)
|
|
205
238
|
@columns.map.with_index do |column, index|
|
|
206
|
-
{ value: index.zero? ? name : subtotals[column.key.to_s], classes: aligned(header_classes_for(index), column) }
|
|
239
|
+
{ value: index.zero? ? name : subtotals[column.key.to_s], classes: phone_list_classes(aligned(header_classes_for(index), column), PHONE_LIST_CELL_CLASSES), label: summary_label(index, column) }
|
|
207
240
|
end
|
|
208
241
|
end
|
|
209
242
|
|
|
210
243
|
private
|
|
211
244
|
|
|
245
|
+
def summary_label(index, column)
|
|
246
|
+
column.header_text if @phone_list && !index.zero?
|
|
247
|
+
end
|
|
248
|
+
|
|
249
|
+
def phone_list_classes(classes, phone_list_classes)
|
|
250
|
+
@phone_list ? "#{classes} #{phone_list_classes}" : classes
|
|
251
|
+
end
|
|
252
|
+
|
|
212
253
|
def apply_saved_layout
|
|
213
254
|
saved = KeystoneUi.configuration.supplied_preference(helpers, @key)
|
|
214
255
|
return unless saved
|
|
@@ -6,18 +6,34 @@
|
|
|
6
6
|
<% end %>
|
|
7
7
|
<div class="<%= wrapper_classes %>">
|
|
8
8
|
<div>
|
|
9
|
-
|
|
9
|
+
<% if badges? %>
|
|
10
|
+
<div class="<%= TITLE_ROW_CLASSES %>">
|
|
11
|
+
<h1 class="<%= title_classes %>"><%= @title %></h1>
|
|
12
|
+
<% @badges.each do |badge| %>
|
|
13
|
+
<%= render Keystone::Ui::BadgeComponent.new(**badge) %>
|
|
14
|
+
<% end %>
|
|
15
|
+
</div>
|
|
16
|
+
<% else %>
|
|
17
|
+
<h1 class="<%= title_classes %>"><%= @title %></h1>
|
|
18
|
+
<% end %>
|
|
10
19
|
<% if subtitle? %>
|
|
11
20
|
<p class="<%= SUBTITLE_CLASSES %>"><%= subtitle_text %></p>
|
|
12
21
|
<% end %>
|
|
13
22
|
</div>
|
|
14
|
-
<% if
|
|
15
|
-
<div class="<%=
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
23
|
+
<% if actions? %>
|
|
24
|
+
<div class="<%= actions_classes %>">
|
|
25
|
+
<% if action? %>
|
|
26
|
+
<%= @action_block.call %>
|
|
27
|
+
<% elsif action_url %>
|
|
28
|
+
<%= render Keystone::Ui::ButtonComponent.new(label: action_label, href: action_url, method: action_method || :get) %>
|
|
29
|
+
<% end %>
|
|
30
|
+
<% if menu? %>
|
|
31
|
+
<%= render Keystone::Ui::ActionMenuComponent.new do %>
|
|
32
|
+
<% @menu.each do |item| %>
|
|
33
|
+
<%= render Keystone::Ui::ActionMenuItemComponent.new(**item) %>
|
|
34
|
+
<% end %>
|
|
35
|
+
<% end %>
|
|
36
|
+
<% end %>
|
|
21
37
|
</div>
|
|
22
38
|
<% end %>
|
|
23
39
|
</div>
|
|
@@ -7,21 +7,28 @@ module Keystone
|
|
|
7
7
|
TITLE_CLASSES = "ks-page-header-title"
|
|
8
8
|
SUBTITLE_CLASSES = "ks-page-header-subtitle"
|
|
9
9
|
ACTIONS_CLASSES = "page-header-actions ks-page-header-actions"
|
|
10
|
+
PHONE_TITLE_CLASSES = "ks-page-header-title max-sm:[body:has(.ks-mobile-header-title)_&]:hidden"
|
|
11
|
+
PHONE_WRAPPER_CLASSES = "max-sm:flex max-sm:flex-wrap max-sm:items-center max-sm:justify-between"
|
|
12
|
+
PHONE_ACTIONS_CLASSES = "max-sm:block"
|
|
13
|
+
MENU_ROW_CLASSES = "flex items-center ks-grid-gap-sm"
|
|
14
|
+
TITLE_ROW_CLASSES = "flex flex-wrap items-center ks-grid-gap-sm"
|
|
10
15
|
|
|
11
16
|
attr_reader :title, :action_url, :action_label, :action_method
|
|
12
17
|
|
|
13
|
-
def initialize(title:, subtitle: nil, action_url: nil, action_label: "Add new", action_method: nil, class: nil)
|
|
18
|
+
def initialize(title:, subtitle: nil, action_url: nil, action_label: "Add new", action_method: nil, badges: [], menu: [], class: nil)
|
|
14
19
|
@title = title
|
|
15
20
|
@subtitle = subtitle
|
|
16
21
|
@action_url = action_url
|
|
17
22
|
@action_label = action_label
|
|
18
23
|
@action_method = action_method
|
|
24
|
+
@badges = badges
|
|
25
|
+
@menu = menu
|
|
19
26
|
@action_block = nil
|
|
20
27
|
@extra_classes = binding.local_variable_get(:class)
|
|
21
28
|
end
|
|
22
29
|
|
|
23
30
|
def wrapper_classes
|
|
24
|
-
[ WRAPPER_CLASSES, @extra_classes ].compact.join(" ")
|
|
31
|
+
[ WRAPPER_CLASSES, (PHONE_WRAPPER_CLASSES if phone?), @extra_classes ].compact.join(" ")
|
|
25
32
|
end
|
|
26
33
|
|
|
27
34
|
def before_render
|
|
@@ -36,6 +43,30 @@ module Keystone
|
|
|
36
43
|
!!@action_block
|
|
37
44
|
end
|
|
38
45
|
|
|
46
|
+
def actions_classes
|
|
47
|
+
[ ACTIONS_CLASSES, (menu? ? MENU_ROW_CLASSES : PHONE_ACTIONS_CLASSES if phone?) ].compact.join(" ")
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def title_classes
|
|
51
|
+
phone? ? PHONE_TITLE_CLASSES : TITLE_CLASSES
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def phone?
|
|
55
|
+
badges? || menu?
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def actions?
|
|
59
|
+
action? || !action_url.nil? || menu?
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def menu?
|
|
63
|
+
@menu.any?
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def badges?
|
|
67
|
+
@badges.any?
|
|
68
|
+
end
|
|
69
|
+
|
|
39
70
|
def subtitle?
|
|
40
71
|
!@subtitle.nil?
|
|
41
72
|
end
|
data/lib/keystone_ui/version.rb
CHANGED
|
@@ -27,7 +27,7 @@ not available in the app yet, that is `keystone_ui-install`'s job.
|
|
|
27
27
|
- `ui_page` — the outer wrapper of a screen, holding the page's content.
|
|
28
28
|
- `ui_form_page` — marks a screen as a form screen and gives it its title, Back link and breadcrumbs.
|
|
29
29
|
- `ui_show_page` — marks a screen as a detail screen and gives it its Back link and breadcrumbs.
|
|
30
|
-
- `ui_page_header` — the
|
|
30
|
+
- `ui_page_header` — the title of a page, with optional badges beside it and a control and action menu on its right.
|
|
31
31
|
- `ui_breadcrumbs` — a line of links to the pages above the current one, shown from `lg:` up.
|
|
32
32
|
- `ui_section` — a titled block of content with an optional link and action menu in its header.
|
|
33
33
|
- `ui_grid` — a responsive grid with a column count per breakpoint.
|
|
@@ -168,8 +168,8 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
|
|
|
168
168
|
- Ask the developer whether a screen shows breadcrumbs and which parent
|
|
169
169
|
screens its trail names. Ask which screens a navigation tab opens
|
|
170
170
|
directly, since those pass `trail: []`.
|
|
171
|
-
- `ui_page_header(title:, subtitle: nil, action_url: nil, action_label: "Add new", action_method: nil, class: nil)`
|
|
172
|
-
takes a block yielding the header
|
|
171
|
+
- `ui_page_header(title:, subtitle: nil, action_url: nil, action_label: "Add new", action_method: nil, badges: [], menu: [], class: nil)`
|
|
172
|
+
takes a block yielding the header. Call
|
|
173
173
|
`header.action { ... }` in the block to place a control on its right.
|
|
174
174
|
`action_url:` declares the screen's main action. It publishes that URL and
|
|
175
175
|
label for `ui_mobile_action` to pick up, and with no `action` block the
|
|
@@ -177,6 +177,17 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
|
|
|
177
177
|
are given. `action_method:`, such as `:post`, makes the main action send
|
|
178
178
|
that method: the header's button and `ui_mobile_action`'s icon become
|
|
179
179
|
forms posting to `action_url:`.
|
|
180
|
+
- `badges:` is `[{ label:, variant: }, ...]`, each drawn as a `ui_badge`
|
|
181
|
+
beside the title, with `variant:` taking the badge's values. `menu:` is
|
|
182
|
+
`[{ label:, href:, method: }, ...]`, each hash taking the keywords of
|
|
183
|
+
`ui_action_menu_item`, drawn in an action menu beside the actions. Put a
|
|
184
|
+
record's Edit and Delete in `menu:` on its detail screen.
|
|
185
|
+
- Below `sm:` a header given no badges and no menu is hidden, even with an
|
|
186
|
+
action. A header given badges or a menu is shown there with its badges,
|
|
187
|
+
actions and menu, and hides its title when the page holds
|
|
188
|
+
`ui_mobile_header`'s title. Its action then shows below `sm:` beside
|
|
189
|
+
`ui_mobile_action`'s plus icon, so ask the developer whether a screen
|
|
190
|
+
with both keeps both.
|
|
180
191
|
- `ui_breadcrumbs(trail:, current: nil)` renders `trail:` as links separated
|
|
181
192
|
by `›`, then `current:` unlinked and marked as the current page, shown
|
|
182
193
|
only from `lg:` up. On a form or detail screen pass `trail:` to the shell
|
|
@@ -405,7 +416,7 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
|
|
|
405
416
|
become `data-*` attributes on the input and the label.
|
|
406
417
|
|
|
407
418
|
7. Put the actions on a record, such as Edit and Delete, in an action menu
|
|
408
|
-
rather than a row of buttons: `menu:` on the `ui_section` showing the record,
|
|
419
|
+
rather than a row of buttons: `menu:` on the `ui_page_header` or `ui_section` showing the record,
|
|
409
420
|
`table.actions` for a table row, or `ui_action_menu` anywhere else.
|
|
410
421
|
|
|
411
422
|
- `ui_action_menu` takes no keywords and a block of `ui_action_menu_item`
|
|
@@ -424,7 +435,7 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
|
|
|
424
435
|
|
|
425
436
|
8. Build tables.
|
|
426
437
|
|
|
427
|
-
- `ui_data_table(items:, columns:, empty_message: nil, sort: nil, sort_direction: nil, sort_url: nil, hidden_columns: [], key: nil, group_by: nil, group_totals: {}, total: nil, current_row: nil)`
|
|
438
|
+
- `ui_data_table(items:, columns:, empty_message: nil, sort: nil, sort_direction: nil, sort_url: nil, hidden_columns: [], key: nil, group_by: nil, group_totals: {}, total: nil, current_row: nil, phone_list: false)`
|
|
428
439
|
takes a block yielding the table. `items:` are records or hashes, and a
|
|
429
440
|
cell's value is the column key called on the item, or `item[key]`.
|
|
430
441
|
`group_by:` lists rows under heading rows named by that key's value,
|
|
@@ -432,6 +443,15 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
|
|
|
432
443
|
subtotals in each heading row, and `total:` (`{ column_key => value }`)
|
|
433
444
|
ends the table with a total row. Pass every subtotal and total already
|
|
434
445
|
calculated. `align: :start` or `:end` on a `Column` aligns it left or right.
|
|
446
|
+
- `phone_list: true` shows the table as a list below `sm:`. The heading
|
|
447
|
+
row is hidden there, each row is one item, and each cell sits on its own
|
|
448
|
+
line under its column's heading, starting at the left and wrapping. A
|
|
449
|
+
row's links, badges, detail button and action menu stay in its item, and
|
|
450
|
+
group subtotals and totals after the first carry their headings. Sorting
|
|
451
|
+
is not reachable below `sm:`, since the sort links are in the heading row.
|
|
452
|
+
From `sm:` up the table is unchanged, and a table without it is unchanged
|
|
453
|
+
at every width. It is chosen table by table, so ask the developer which
|
|
454
|
+
tables show as a list on a phone.
|
|
435
455
|
- `columns:` takes `{ key: "Label" }` hashes when every column is plain.
|
|
436
456
|
Switch the whole set to `Keystone::Ui::Column` objects once one column
|
|
437
457
|
needs an option.
|
|
@@ -709,7 +729,7 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
|
|
|
709
729
|
- **Containers take blocks, leaves take keywords.** The data table, page header
|
|
710
730
|
and swipe deck render only what is registered through the object they yield,
|
|
711
731
|
so anything else emitted in their block is dropped.
|
|
712
|
-
- **Check both screen sizes.** Page headers, mobile headers, mobile actions,
|
|
732
|
+
- **Check both screen sizes.** Page headers with no badges or menu, mobile headers, mobile actions,
|
|
713
733
|
bottom navigation, breadcrumbs and `ui_navigation`'s bars render on one side
|
|
714
734
|
of `lg:` or `sm:` only, so a screen needs both treatments.
|
|
715
735
|
- Out of scope: installing or upgrading the gem, its configuration, the theme
|