katalyst-koi 4.18.1 → 5.0.0.alpha.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.
- checksums.yaml +4 -4
- data/app/assets/images/koi/icons/add.svg +3 -0
- data/app/assets/images/koi/icons/close.svg +1 -0
- data/app/assets/images/koi/koi.png +0 -0
- data/app/assets/javascripts/koi/controllers/file_field_controller.js +2 -2
- data/app/assets/javascripts/koi/controllers/index.js +0 -3
- data/app/assets/javascripts/koi/controllers/koi/modal_controller.js +40 -0
- data/app/assets/javascripts/koi/controllers/navigation_controller.js +14 -21
- data/app/assets/javascripts/koi/controllers/webauthn_registration_controller.js +4 -1
- data/app/assets/stylesheets/koi/blocks/actions.css +8 -0
- data/app/assets/stylesheets/koi/blocks/application-header.css +15 -0
- data/app/assets/stylesheets/koi/blocks/application-navigation.css +54 -0
- data/app/assets/stylesheets/koi/blocks/button.css +90 -0
- data/app/assets/stylesheets/koi/blocks/flash.css +19 -0
- data/app/assets/stylesheets/koi/blocks/icon.css +15 -0
- data/app/assets/stylesheets/koi/blocks/index.css +13 -0
- data/app/assets/stylesheets/koi/blocks/modal.css +26 -0
- data/app/assets/stylesheets/koi/blocks/navigation.css +23 -0
- data/app/assets/stylesheets/koi/blocks/page-header.css +31 -0
- data/app/assets/stylesheets/koi/blocks/pagy.css +82 -0
- data/app/assets/stylesheets/koi/blocks/prose.css +37 -0
- data/app/assets/stylesheets/koi/blocks/tables/index.css +4 -0
- data/app/assets/stylesheets/koi/{components/_query.scss → blocks/tables/query.css} +13 -13
- data/app/assets/stylesheets/koi/{base/_tables.scss → blocks/tables/table.css} +11 -59
- data/app/assets/stylesheets/koi/compositions/cover.css +17 -0
- data/app/assets/stylesheets/koi/{base/_flow.scss → compositions/flow.css} +1 -1
- data/app/assets/stylesheets/koi/compositions/index.css +4 -0
- data/app/assets/stylesheets/koi/compositions/wrapper.css +11 -0
- data/app/assets/stylesheets/koi/forms/caption.css +22 -0
- data/app/assets/stylesheets/koi/forms/checkboxes.css +153 -0
- data/app/assets/stylesheets/koi/forms/date-input.css +12 -0
- data/app/assets/stylesheets/koi/{components/_document-field.scss → forms/document-field.css} +20 -15
- data/app/assets/stylesheets/koi/forms/errors.css +38 -0
- data/app/assets/stylesheets/koi/forms/fieldset.css +73 -0
- data/app/assets/stylesheets/koi/forms/file-upload.css +20 -0
- data/app/assets/stylesheets/koi/forms/form-group.css +19 -0
- data/app/assets/stylesheets/koi/forms/hint.css +11 -0
- data/app/assets/stylesheets/koi/forms/image-field.css +96 -0
- data/app/assets/stylesheets/koi/forms/index.css +44 -0
- data/app/assets/stylesheets/koi/forms/input.css +194 -0
- data/app/assets/stylesheets/koi/forms/label.css +43 -0
- data/app/assets/stylesheets/koi/forms/password.css +18 -0
- data/app/assets/stylesheets/koi/forms/radios.css +162 -0
- data/app/assets/stylesheets/koi/forms/select.css +18 -0
- data/app/assets/stylesheets/koi/forms/textarea.css +3 -0
- data/app/assets/stylesheets/koi/forms/trix.css +33 -0
- data/app/assets/stylesheets/koi/global/fonts.css +22 -0
- data/app/assets/stylesheets/koi/global/global-styles.css +297 -0
- data/app/assets/stylesheets/koi/global/reset.css +98 -0
- data/app/assets/stylesheets/koi/global/variables.css +97 -0
- data/app/assets/stylesheets/koi/icons.css +14 -0
- data/app/assets/stylesheets/koi/{admin.scss → index.css} +16 -7
- data/app/assets/stylesheets/koi/login.css +26 -0
- data/app/assets/stylesheets/koi/themes/_index.scss +0 -1
- data/app/assets/stylesheets/koi/utilities/index.css +1 -0
- data/app/assets/stylesheets/koi/utilities/visually-hidden.css +18 -0
- data/app/components/concerns/koi/tables/cells.rb +3 -3
- data/app/components/koi/header_component.html.erb +12 -11
- data/app/components/koi/header_component.rb +2 -0
- data/app/components/koi/table_component.rb +8 -0
- data/app/controllers/admin/admin_users_controller.rb +24 -18
- data/app/controllers/admin/application_controller.rb +1 -3
- data/app/controllers/admin/credentials_controller.rb +18 -14
- data/app/controllers/admin/otps_controller.rb +15 -13
- data/app/controllers/admin/sessions_controller.rb +12 -1
- data/app/controllers/admin/url_rewrites_controller.rb +19 -17
- data/app/controllers/admin/well_knowns_controller.rb +20 -18
- data/app/controllers/concerns/koi/controller.rb +37 -0
- data/app/helpers/koi/form_helper.rb +18 -0
- data/app/helpers/koi/header_helper.rb +122 -0
- data/app/helpers/koi/index_actions_helper.rb +3 -2
- data/app/helpers/koi/modal_helper.rb +71 -0
- data/app/models/admin/user.rb +7 -1
- data/app/models/url_rewrite.rb +1 -9
- data/app/views/admin/admin_users/_form.html+self.erb +8 -0
- data/app/views/admin/admin_users/_form.html.erb +8 -0
- data/app/views/admin/admin_users/archived.html.erb +7 -4
- data/app/views/admin/admin_users/edit.html+self.erb +12 -0
- data/app/views/admin/admin_users/edit.html.erb +13 -8
- data/app/views/admin/admin_users/index.html.erb +10 -5
- data/app/views/admin/admin_users/new.html.erb +8 -8
- data/app/views/admin/admin_users/show.html+self.erb +26 -14
- data/app/views/admin/admin_users/show.html.erb +22 -20
- data/app/views/admin/credentials/_credentials.html+self.erb +8 -6
- data/app/views/admin/credentials/_credentials.html.erb +3 -1
- data/app/views/admin/credentials/create.turbo_stream.erb +4 -3
- data/app/views/admin/credentials/destroy.turbo_stream.erb +4 -2
- data/app/views/admin/credentials/new.html.erb +42 -36
- data/app/views/admin/dashboards/show.html.erb +13 -1
- data/app/views/admin/otps/_form.html.erb +7 -7
- data/app/views/admin/otps/create.turbo_stream.erb +3 -3
- data/app/views/admin/otps/new.html.erb +5 -3
- data/app/views/admin/sessions/new.html.erb +2 -3
- data/app/views/admin/sessions/otp.html.erb +1 -3
- data/app/views/admin/sessions/password.html.erb +1 -3
- data/app/views/admin/tokens/show.html.erb +4 -6
- data/app/views/admin/url_rewrites/_form.html.erb +9 -0
- data/app/views/admin/url_rewrites/edit.html.erb +13 -9
- data/app/views/admin/url_rewrites/index.html.erb +10 -7
- data/app/views/admin/url_rewrites/new.html.erb +8 -8
- data/app/views/admin/url_rewrites/show.html.erb +17 -12
- data/app/views/admin/well_knowns/_form.html.erb +9 -0
- data/app/views/admin/well_knowns/edit.html.erb +13 -9
- data/app/views/admin/well_knowns/index.html.erb +8 -5
- data/app/views/admin/well_knowns/new.html.erb +8 -8
- data/app/views/admin/well_knowns/show.html.erb +14 -13
- data/app/views/katalyst/content/asides/_aside.html+form.erb +6 -4
- data/app/views/katalyst/content/columns/_column.html+form.erb +5 -3
- data/app/views/katalyst/content/contents/_content.html+form.erb +8 -6
- data/app/views/katalyst/content/figures/_figure.html+form.erb +8 -5
- data/app/views/katalyst/content/groups/_group.html+form.erb +5 -3
- data/app/views/katalyst/content/items/_item.html+form.erb +5 -3
- data/app/views/katalyst/content/sections/_section.html+form.erb +5 -3
- data/app/views/katalyst/content/tables/_table.html+form.erb +16 -11
- data/app/views/katalyst/navigation/items/_button.html.erb +6 -12
- data/app/views/katalyst/navigation/items/_heading.html.erb +3 -10
- data/app/views/katalyst/navigation/items/_link.html.erb +6 -11
- data/app/views/katalyst/navigation/menus/edit.html.erb +10 -6
- data/app/views/katalyst/navigation/menus/index.html.erb +4 -2
- data/app/views/katalyst/navigation/menus/new.html.erb +5 -3
- data/app/views/katalyst/navigation/menus/show.html.erb +8 -7
- data/app/views/layouts/koi/_application_header.html.erb +20 -0
- data/app/views/layouts/koi/_application_navigation.html.erb +34 -0
- data/app/views/layouts/koi/_flash.html.erb +6 -3
- data/app/views/layouts/koi/_navigation_header.html.erb +0 -2
- data/app/views/layouts/koi/application.html.erb +22 -27
- data/app/views/layouts/koi/frame.html.erb +1 -3
- data/app/views/layouts/koi/login.html.erb +12 -5
- data/config/locales/koi.en.yml +9 -1
- data/config/routes.rb +1 -1
- data/lib/generators/koi/admin/admin_generator.rb +3 -12
- data/lib/generators/koi/admin_controller/admin_controller_generator.rb +6 -16
- data/lib/generators/koi/admin_controller/templates/controller.rb.tt +82 -18
- data/lib/generators/koi/admin_controller/templates/controller_spec.rb.tt +113 -47
- data/lib/generators/koi/admin_route/admin_route_generator.rb +60 -6
- data/lib/generators/koi/admin_views/USAGE +18 -7
- data/lib/generators/koi/admin_views/admin_views_generator.rb +19 -11
- data/lib/generators/koi/admin_views/templates/_form.html.erb.tt +8 -0
- data/lib/generators/koi/admin_views/templates/archived.html.erb.tt +33 -0
- data/lib/generators/koi/admin_views/templates/edit.html.erb.tt +17 -9
- data/lib/generators/koi/admin_views/templates/index.html.erb.tt +31 -3
- data/lib/generators/koi/admin_views/templates/new.html.erb.tt +8 -8
- data/lib/generators/koi/admin_views/templates/show.html.erb.tt +15 -18
- data/lib/generators/koi/helpers/attribute_helpers.rb +147 -0
- data/lib/generators/koi/helpers/attribute_types.rb +218 -0
- data/lib/generators/koi/helpers/resource_helpers.rb +121 -0
- data/lib/generators/koi/{active_record/active_record_generator.rb → model/model_generator.rb} +1 -1
- data/lib/koi/config.rb +3 -1
- data/lib/koi/engine.rb +0 -9
- data/lib/koi/form/builder.rb +4 -4
- data/lib/koi/form/content.rb +55 -0
- data/lib/koi/form/elements/document.rb +1 -1
- data/lib/koi/form/elements/image.rb +1 -1
- data/lib/koi/form_builder.rb +1 -0
- data/lib/koi/menu.rb +14 -1
- data/spec/factories/admins.rb +1 -1
- metadata +90 -99
- data/app/assets/builds/koi/admin.css +0 -1
- data/app/assets/stylesheets/koi/base/_button.scss +0 -122
- data/app/assets/stylesheets/koi/base/_icon.scss +0 -29
- data/app/assets/stylesheets/koi/base/_index.scss +0 -21
- data/app/assets/stylesheets/koi/base/_input.scss +0 -19
- data/app/assets/stylesheets/koi/base/_link.scss +0 -26
- data/app/assets/stylesheets/koi/base/_list.scss +0 -11
- data/app/assets/stylesheets/koi/base/_typography.scss +0 -160
- data/app/assets/stylesheets/koi/components/_actions-group.scss +0 -7
- data/app/assets/stylesheets/koi/components/_image-field.scss +0 -95
- data/app/assets/stylesheets/koi/components/_index.scss +0 -9
- data/app/assets/stylesheets/koi/components/_pagy.scss +0 -29
- data/app/assets/stylesheets/koi/components/_summary-list.scss +0 -40
- data/app/assets/stylesheets/koi/layouts/_banner.scss +0 -7
- data/app/assets/stylesheets/koi/layouts/_content.scss +0 -40
- data/app/assets/stylesheets/koi/layouts/_flash.scss +0 -41
- data/app/assets/stylesheets/koi/layouts/_header.scss +0 -61
- data/app/assets/stylesheets/koi/layouts/_index.scss +0 -48
- data/app/assets/stylesheets/koi/layouts/_main.scss +0 -23
- data/app/assets/stylesheets/koi/layouts/_navigation.scss +0 -180
- data/app/assets/stylesheets/koi/layouts/_stack.scss +0 -13
- data/app/assets/stylesheets/koi/pages/_index.scss +0 -1
- data/app/assets/stylesheets/koi/pages/_login.scss +0 -46
- data/app/assets/stylesheets/koi/themes/_govuk.scss +0 -56
- data/app/assets/stylesheets/koi/themes/_kpop.scss +0 -5
- data/app/assets/stylesheets/koi/utils/_breakpoints.scss +0 -13
- data/app/assets/stylesheets/koi/utils/_hide.scss +0 -11
- data/app/assets/stylesheets/koi/utils/_index.scss +0 -2
- data/app/assets/stylesheets/koi/utils/_typography.scss +0 -42
- data/app/components/koi/content/editor/item_form_component.html.erb +0 -11
- data/app/components/koi/content/editor/item_form_component.rb +0 -94
- data/app/components/koi/summary_list/attachment_component.rb +0 -47
- data/app/components/koi/summary_list/base.rb +0 -59
- data/app/components/koi/summary_list/boolean_component.rb +0 -15
- data/app/components/koi/summary_list/date_component.rb +0 -17
- data/app/components/koi/summary_list/datetime_component.rb +0 -17
- data/app/components/koi/summary_list/item_component.rb +0 -26
- data/app/components/koi/summary_list/number_component.rb +0 -21
- data/app/components/koi/summary_list/rich_text_component.rb +0 -8
- data/app/components/koi/summary_list/text_component.rb +0 -8
- data/app/components/koi/summary_list_component.html.erb +0 -5
- data/app/components/koi/summary_list_component.rb +0 -75
- data/app/controllers/concerns/koi/controller/is_admin_controller.rb +0 -66
- data/app/helpers/koi/application_helper.rb +0 -7
- data/app/helpers/koi/date_helper.rb +0 -26
- data/app/helpers/koi/definition_list_helper.rb +0 -10
- data/app/views/admin/admin_users/_fields.html+self.erb +0 -3
- data/app/views/admin/admin_users/_fields.html.erb +0 -3
- data/app/views/admin/url_rewrites/_fields.html.erb +0 -4
- data/app/views/admin/well_knowns/_fields.html.erb +0 -6
- data/app/views/layouts/koi/_environment.html.erb +0 -4
- data/app/views/layouts/koi/_header.html.erb +0 -11
- data/app/views/layouts/koi/_navigation.html.erb +0 -23
- data/app/views/layouts/koi/_navigation_collapse.html.erb +0 -3
- data/lib/generators/koi/admin_views/templates/_fields.html.erb.tt +0 -3
- data/lib/generators/koi/helpers/admin_generator_attributes.rb +0 -66
- data/lib/koi/extensions/dartsass.rb +0 -23
- /data/app/assets/stylesheets/koi/{components/_clipboard.scss → blocks/clipboard.css} +0 -0
- /data/app/assets/stylesheets/koi/{components/_index-actions.scss → blocks/index-actions.css} +0 -0
- /data/app/assets/stylesheets/koi/{components/_toolbar.scss → blocks/toolbar.css} +0 -0
- /data/app/assets/stylesheets/koi/{base/_repel.scss → compositions/repel.css} +0 -0
@@ -1,180 +0,0 @@
|
|
1
|
-
$heading: rgba(255, 255, 255, 0.6);
|
2
|
-
$separator: rgba(255, 255, 255, 0.2);
|
3
|
-
|
4
|
-
%subheading {
|
5
|
-
color: $heading;
|
6
|
-
font-size: 0.8rem;
|
7
|
-
font-weight: 400;
|
8
|
-
margin: 0;
|
9
|
-
}
|
10
|
-
|
11
|
-
@mixin header {
|
12
|
-
display: grid;
|
13
|
-
grid-template-areas: "icon primary" "icon secondary";
|
14
|
-
grid-template-rows: 1fr 1fr;
|
15
|
-
grid-template-columns: 3rem 1fr;
|
16
|
-
padding: 1rem;
|
17
|
-
|
18
|
-
.site-name {
|
19
|
-
grid-area: primary;
|
20
|
-
padding-left: 1rem;
|
21
|
-
font-size: 1.25rem;
|
22
|
-
font-weight: unset;
|
23
|
-
color: var(--site-primary);
|
24
|
-
margin: 0;
|
25
|
-
white-space: nowrap;
|
26
|
-
overflow-x: hidden;
|
27
|
-
text-overflow: ellipsis;
|
28
|
-
}
|
29
|
-
|
30
|
-
.admin-name {
|
31
|
-
grid-area: secondary;
|
32
|
-
color: white;
|
33
|
-
padding-left: 1rem;
|
34
|
-
@extend %subheading;
|
35
|
-
opacity: 0.75;
|
36
|
-
white-space: nowrap;
|
37
|
-
overflow-x: hidden;
|
38
|
-
text-overflow: ellipsis;
|
39
|
-
}
|
40
|
-
|
41
|
-
.site-icon {
|
42
|
-
grid-area: icon;
|
43
|
-
display: flex;
|
44
|
-
background-color: var(--site-primary);
|
45
|
-
color: var(--site-on-primary);
|
46
|
-
width: 3rem;
|
47
|
-
height: 3rem;
|
48
|
-
align-items: center;
|
49
|
-
justify-content: space-around;
|
50
|
-
text-transform: capitalize;
|
51
|
-
font-size: 2rem;
|
52
|
-
border-radius: 0.25rem;
|
53
|
-
}
|
54
|
-
}
|
55
|
-
|
56
|
-
%navigation {
|
57
|
-
background: black;
|
58
|
-
color: white;
|
59
|
-
padding-bottom: 2rem;
|
60
|
-
--site-link: white;
|
61
|
-
|
62
|
-
> * {
|
63
|
-
transition: opacity 0.25s;
|
64
|
-
}
|
65
|
-
|
66
|
-
&:not([aria-expanded]) {
|
67
|
-
> * {
|
68
|
-
opacity: 0;
|
69
|
-
}
|
70
|
-
}
|
71
|
-
|
72
|
-
header {
|
73
|
-
@include header;
|
74
|
-
border-bottom: 1px solid $separator;
|
75
|
-
}
|
76
|
-
|
77
|
-
ul,
|
78
|
-
li {
|
79
|
-
padding: 0;
|
80
|
-
list-style: none;
|
81
|
-
font-size: var(--heading--h6);
|
82
|
-
}
|
83
|
-
|
84
|
-
.filter {
|
85
|
-
margin: 1rem calc(1rem - 5px) 0;
|
86
|
-
position: relative;
|
87
|
-
|
88
|
-
input {
|
89
|
-
width: 100%;
|
90
|
-
border: none;
|
91
|
-
border-radius: 1px;
|
92
|
-
}
|
93
|
-
|
94
|
-
// keyboard shortcut
|
95
|
-
&::after {
|
96
|
-
content: "G";
|
97
|
-
position: absolute;
|
98
|
-
display: block;
|
99
|
-
top: 4px;
|
100
|
-
bottom: 4px;
|
101
|
-
right: 4px;
|
102
|
-
width: auto;
|
103
|
-
border-radius: 2px;
|
104
|
-
border: 1px solid #aaa;
|
105
|
-
color: #888;
|
106
|
-
padding: 6px 0.3rem 0 0.3rem;
|
107
|
-
font-size: 0.8rem;
|
108
|
-
pointer-events: none;
|
109
|
-
}
|
110
|
-
|
111
|
-
&:has(input:focus),
|
112
|
-
&:has(input:hover) {
|
113
|
-
&::after {
|
114
|
-
opacity: 0;
|
115
|
-
}
|
116
|
-
}
|
117
|
-
}
|
118
|
-
|
119
|
-
li > span {
|
120
|
-
display: block;
|
121
|
-
padding: 1.25rem 1rem 0.25rem;
|
122
|
-
color: $heading;
|
123
|
-
}
|
124
|
-
|
125
|
-
> ul > li > span {
|
126
|
-
border-top: 1px solid $separator;
|
127
|
-
margin-top: 1rem;
|
128
|
-
padding: 1.25rem 1rem 0.25rem;
|
129
|
-
@extend %subheading;
|
130
|
-
}
|
131
|
-
|
132
|
-
li li li > a[href] {
|
133
|
-
padding-left: 2.5rem;
|
134
|
-
}
|
135
|
-
|
136
|
-
li > a[href] {
|
137
|
-
display: block;
|
138
|
-
padding: 0.75rem 1rem;
|
139
|
-
white-space: nowrap;
|
140
|
-
overflow: hidden;
|
141
|
-
text-overflow: ellipsis;
|
142
|
-
}
|
143
|
-
|
144
|
-
li > a[href]:hover,
|
145
|
-
li > a[href]:focus {
|
146
|
-
background: rgba(255, 255, 255, 0.2);
|
147
|
-
text-decoration: none;
|
148
|
-
}
|
149
|
-
}
|
150
|
-
|
151
|
-
.navigation-collapse {
|
152
|
-
width: 2rem;
|
153
|
-
border-radius: 50%;
|
154
|
-
margin-top: 1rem;
|
155
|
-
justify-self: right;
|
156
|
-
align-self: start;
|
157
|
-
background-color: white;
|
158
|
-
box-shadow: 0px 1px 7px 2px rgba(0, 0, 0, 0.1);
|
159
|
-
visibility: hidden;
|
160
|
-
opacity: 0;
|
161
|
-
transform: translateX(50%);
|
162
|
-
transition:
|
163
|
-
opacity 0.25s,
|
164
|
-
background-color 0.25s;
|
165
|
-
cursor: pointer;
|
166
|
-
|
167
|
-
nav[aria-expanded] + & {
|
168
|
-
transform: translateX(50%) rotate(180deg);
|
169
|
-
}
|
170
|
-
|
171
|
-
nav:hover + &,
|
172
|
-
&:hover {
|
173
|
-
visibility: visible;
|
174
|
-
opacity: 1;
|
175
|
-
}
|
176
|
-
|
177
|
-
&:hover {
|
178
|
-
background-color: var(--site-primary);
|
179
|
-
}
|
180
|
-
}
|
@@ -1 +0,0 @@
|
|
1
|
-
@use "login";
|
@@ -1,46 +0,0 @@
|
|
1
|
-
@use "../layouts/navigation" as nav;
|
2
|
-
@use "../layouts/flash";
|
3
|
-
|
4
|
-
.admin-login {
|
5
|
-
display: flex;
|
6
|
-
flex-direction: row;
|
7
|
-
align-items: center;
|
8
|
-
justify-content: center;
|
9
|
-
background: var(--site-primary);
|
10
|
-
}
|
11
|
-
|
12
|
-
.admin-login > main {
|
13
|
-
flex: 1 1 auto;
|
14
|
-
max-width: 24rem;
|
15
|
-
background: white;
|
16
|
-
border-radius: 0.25rem;
|
17
|
-
height: unset;
|
18
|
-
}
|
19
|
-
|
20
|
-
.admin-login header {
|
21
|
-
@include nav.header;
|
22
|
-
width: 100%;
|
23
|
-
|
24
|
-
.admin-name {
|
25
|
-
color: #555;
|
26
|
-
}
|
27
|
-
}
|
28
|
-
|
29
|
-
.admin-login form {
|
30
|
-
padding: 0 1rem 1rem;
|
31
|
-
}
|
32
|
-
|
33
|
-
.admin-login .actions-group {
|
34
|
-
display: flex;
|
35
|
-
flex-direction: row;
|
36
|
-
justify-content: stretch;
|
37
|
-
}
|
38
|
-
|
39
|
-
.admin-login .button--primary {
|
40
|
-
flex: 1;
|
41
|
-
}
|
42
|
-
|
43
|
-
.admin-login .govuk-error-summary {
|
44
|
-
padding: 15px;
|
45
|
-
margin-bottom: 30px;
|
46
|
-
}
|
@@ -1,56 +0,0 @@
|
|
1
|
-
@use "../utils/typography" as *;
|
2
|
-
|
3
|
-
@use "katalyst/govuk/formbuilder" with (
|
4
|
-
$govuk-font-family: "Inter",
|
5
|
-
$govuk-text-colour: #{var(--site-text-color)},
|
6
|
-
$govuk-typography-scale: (
|
7
|
-
80: govuk-definition(h1),
|
8
|
-
48: govuk-definition(h2),
|
9
|
-
36: govuk-definition(h3),
|
10
|
-
27: govuk-definition(h4),
|
11
|
-
24: govuk-definition(h5),
|
12
|
-
19: govuk-definition(h6),
|
13
|
-
16: govuk-definition(paragraph),
|
14
|
-
14: govuk-definition(small),
|
15
|
-
),
|
16
|
-
$govuk-input-border-colour: #{var(--site-text-color)}
|
17
|
-
);
|
18
|
-
|
19
|
-
.govuk-input,
|
20
|
-
.govuk-textarea {
|
21
|
-
color: var(--site-text-color);
|
22
|
-
}
|
23
|
-
|
24
|
-
.govuk-hint {
|
25
|
-
max-width: var(--text-width);
|
26
|
-
}
|
27
|
-
|
28
|
-
// in the context of Koi admin forms, hang the error border in the gutter
|
29
|
-
// not a generally applicable style
|
30
|
-
.govuk-form-group--error:not(.govuk-form-group .govuk-form-group--error) {
|
31
|
-
position: relative;
|
32
|
-
margin-left: -18px;
|
33
|
-
padding-left: 13px;
|
34
|
-
}
|
35
|
-
|
36
|
-
// add some koi styling to the govuk show/hide password button
|
37
|
-
[data-govuk-password-input-init] {
|
38
|
-
max-width: var(--text-width);
|
39
|
-
|
40
|
-
.govuk-password-input__wrapper {
|
41
|
-
gap: 0.5rem;
|
42
|
-
}
|
43
|
-
|
44
|
-
.govuk-button {
|
45
|
-
min-width: 4em;
|
46
|
-
background: none;
|
47
|
-
cursor: pointer;
|
48
|
-
border: 2px solid var(--site-text-color);
|
49
|
-
}
|
50
|
-
|
51
|
-
.govuk-button:focus-visible,
|
52
|
-
.govuk-button:hover {
|
53
|
-
color: var(--site-primary);
|
54
|
-
border-color: var(--site-primary);
|
55
|
-
}
|
56
|
-
}
|
@@ -1,13 +0,0 @@
|
|
1
|
-
// At a 16px base font size this will be 640px (to match govuk)
|
2
|
-
@mixin tablet-breakpoint {
|
3
|
-
@media screen and (max-width: 40rem) {
|
4
|
-
@content;
|
5
|
-
}
|
6
|
-
}
|
7
|
-
|
8
|
-
// At a 16px base font size this will be 1120px
|
9
|
-
@mixin laptop-breakpoint {
|
10
|
-
@media screen and (max-width: 70rem) {
|
11
|
-
@content;
|
12
|
-
}
|
13
|
-
}
|
@@ -1,42 +0,0 @@
|
|
1
|
-
@use "sass:map";
|
2
|
-
@use "sass:math";
|
3
|
-
|
4
|
-
$-font-sizes: () !default;
|
5
|
-
$-line-heights: () !default;
|
6
|
-
|
7
|
-
@function font-size($size, $breakpoint: null, $unit: rem) {
|
8
|
-
$font-size: map.get($-font-sizes, $size);
|
9
|
-
|
10
|
-
@if $unit == rem {
|
11
|
-
@return $font-size;
|
12
|
-
} @else if $unit == px {
|
13
|
-
@return math.div($font-size, 1rem) * 16px;
|
14
|
-
}
|
15
|
-
}
|
16
|
-
|
17
|
-
@function line-height($size, $breakpoint: null, $unit: em) {
|
18
|
-
$line-height: map.get($-line-heights, $size);
|
19
|
-
|
20
|
-
@if $unit == em {
|
21
|
-
@return $line-height;
|
22
|
-
} @else if $unit == px {
|
23
|
-
@return math.div($line-height, 1em) * 16px;
|
24
|
-
}
|
25
|
-
}
|
26
|
-
|
27
|
-
@function govuk-definition($size) {
|
28
|
-
@return (
|
29
|
-
null: (
|
30
|
-
font-size: font-size($size, mobile, px),
|
31
|
-
line-height: line-height($size, mobile, px),
|
32
|
-
),
|
33
|
-
tablet: (
|
34
|
-
font-size: font-size($size, tablet, px),
|
35
|
-
line-height: line-height($size, tablet, px),
|
36
|
-
),
|
37
|
-
print: (
|
38
|
-
font-size: font-size($size, print, px),
|
39
|
-
line-height: line-height($size, print, px),
|
40
|
-
)
|
41
|
-
);
|
42
|
-
}
|
@@ -1,11 +0,0 @@
|
|
1
|
-
<%= form_with model:, scope: :item, url:, builder:, **html_attributes do |form| %>
|
2
|
-
<%= form.hidden_field :container_type %>
|
3
|
-
<%= form.hidden_field :container_id %>
|
4
|
-
<%= form.hidden_field :type %>
|
5
|
-
|
6
|
-
<%= content %>
|
7
|
-
|
8
|
-
<%= form.content_background_field %>
|
9
|
-
<%= form.content_visible_field %>
|
10
|
-
<%= form.content_buttons %>
|
11
|
-
<% end %>
|
@@ -1,94 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Koi
|
4
|
-
module Content
|
5
|
-
module Editor
|
6
|
-
class ItemFormComponent < ViewComponent::Base
|
7
|
-
include Katalyst::HtmlAttributes
|
8
|
-
|
9
|
-
attr_reader :model, :url, :builder, :form
|
10
|
-
|
11
|
-
def initialize(model:, url:, builder: Koi::FormBuilder, **)
|
12
|
-
super(**)
|
13
|
-
|
14
|
-
@model = model
|
15
|
-
@url = url
|
16
|
-
@builder = builder
|
17
|
-
end
|
18
|
-
|
19
|
-
def form_with(**options, &block)
|
20
|
-
view_context.form_with(**options) do |form|
|
21
|
-
@form = form
|
22
|
-
form.extend(ContentFormHelper)
|
23
|
-
capture(form, &block)
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
def content
|
28
|
-
@__vc_content_evaluated = true
|
29
|
-
return @__vc_content if defined?(@__vc_content)
|
30
|
-
|
31
|
-
@__vc_content = view_context.capture(@form, &@__vc_render_in_block)
|
32
|
-
end
|
33
|
-
|
34
|
-
def inspect
|
35
|
-
"#<#{self.class.name} model: #{model.inspect} url: #{url.inspect}>"
|
36
|
-
end
|
37
|
-
|
38
|
-
module ContentFormHelper
|
39
|
-
def content_heading_fieldset
|
40
|
-
govuk_fieldset(legend: { text: "Heading", size: "m" }) do
|
41
|
-
concat(content_heading_field(label: nil))
|
42
|
-
concat(content_heading_style_field)
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
def content_heading_field(args = {})
|
47
|
-
govuk_text_field :heading,
|
48
|
-
**{ label: { text: "Heading", size: "s" } }.deep_merge(args)
|
49
|
-
end
|
50
|
-
|
51
|
-
def content_heading_style_field(args = {})
|
52
|
-
govuk_collection_radio_buttons :heading_style,
|
53
|
-
Katalyst::Content.config.heading_styles,
|
54
|
-
:itself,
|
55
|
-
:itself,
|
56
|
-
**{ small: true, legend: { text: "Style", size: "s" } }.deep_merge(args)
|
57
|
-
end
|
58
|
-
|
59
|
-
def content_url_field(args = {})
|
60
|
-
govuk_text_field :url,
|
61
|
-
**{ label: { text: "URL", size: "s" } }.deep_merge(args)
|
62
|
-
end
|
63
|
-
|
64
|
-
def content_http_method_field(methods, args = {})
|
65
|
-
govuk_select :http_method, methods,
|
66
|
-
**{ label: { text: "HTTP method", size: "s" } }.deep_merge(args)
|
67
|
-
end
|
68
|
-
|
69
|
-
def content_target_field(targets, args = {})
|
70
|
-
govuk_select :target, targets,
|
71
|
-
**{ label: { text: "HTTP target", size: "s" } }.deep_merge(args)
|
72
|
-
end
|
73
|
-
|
74
|
-
def content_background_field(args = {})
|
75
|
-
govuk_select :background, Katalyst::Content.config.backgrounds,
|
76
|
-
**{ label: { size: "s" } }.deep_merge(args)
|
77
|
-
end
|
78
|
-
|
79
|
-
def content_visible_field(args = {})
|
80
|
-
govuk_check_box_field :visible,
|
81
|
-
**{ label: { text: "Visible? ", size: "s" }, small: true }.deep_merge(args)
|
82
|
-
end
|
83
|
-
|
84
|
-
def content_buttons
|
85
|
-
tag.div(class: "actions") do
|
86
|
-
concat(admin_save("Done"))
|
87
|
-
concat(admin_discard(data: { action: "click->kpop--frame#dismiss:prevent" }))
|
88
|
-
end
|
89
|
-
end
|
90
|
-
end
|
91
|
-
end
|
92
|
-
end
|
93
|
-
end
|
94
|
-
end
|
@@ -1,47 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Koi
|
4
|
-
module SummaryList
|
5
|
-
class AttachmentComponent < Base
|
6
|
-
def initialize(model, attribute, variant: :thumb, **attributes)
|
7
|
-
super(model, attribute, **attributes)
|
8
|
-
|
9
|
-
@variant = variant
|
10
|
-
end
|
11
|
-
|
12
|
-
def attribute_value
|
13
|
-
representation
|
14
|
-
end
|
15
|
-
|
16
|
-
def representation
|
17
|
-
if raw_value.try(:variable?) && named_variant.present?
|
18
|
-
image_tag(raw_value.variant(@variant))
|
19
|
-
elsif raw_value.try(:attached?)
|
20
|
-
filename.to_s
|
21
|
-
else
|
22
|
-
""
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
def filename
|
27
|
-
raw_value.blob.filename
|
28
|
-
end
|
29
|
-
|
30
|
-
# Utility for accessing the path Rails provides for retrieving the
|
31
|
-
# attachment for use in cells. Example:
|
32
|
-
# <% row.attachment :file do |cell| %>
|
33
|
-
# <%= link_to "Download", cell.internal_path %>
|
34
|
-
# <% end %>
|
35
|
-
def internal_path
|
36
|
-
rails_blob_path(raw_value, disposition: :attachment)
|
37
|
-
end
|
38
|
-
|
39
|
-
private
|
40
|
-
|
41
|
-
# Find the reflective variant by name (i.e. :thumb by default)
|
42
|
-
def named_variant
|
43
|
-
@model.attachment_reflections[@attribute.to_s].named_variants[@variant.to_sym]
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
@@ -1,59 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Koi
|
4
|
-
module SummaryList
|
5
|
-
class Base < ViewComponent::Base
|
6
|
-
include Katalyst::HtmlAttributes
|
7
|
-
|
8
|
-
define_html_attribute_methods :term_attributes, default: {}
|
9
|
-
define_html_attribute_methods :description_attributes, default: {}
|
10
|
-
|
11
|
-
def initialize(model, attribute, label: nil, skip_blank: true)
|
12
|
-
super()
|
13
|
-
|
14
|
-
@model = model
|
15
|
-
@attribute = attribute
|
16
|
-
@label = label
|
17
|
-
@skip_blank = skip_blank
|
18
|
-
end
|
19
|
-
|
20
|
-
def call
|
21
|
-
tag.dt(attribute_name, **term_attributes) +
|
22
|
-
tag.dd(content_or_value, **description_attributes)
|
23
|
-
end
|
24
|
-
|
25
|
-
def render?
|
26
|
-
raw_value.present? || !@skip_blank
|
27
|
-
end
|
28
|
-
|
29
|
-
def attribute_name
|
30
|
-
@label&.dig(:text) || @model.class.human_attribute_name(@attribute)
|
31
|
-
end
|
32
|
-
|
33
|
-
def attribute_value
|
34
|
-
raw_value.to_s
|
35
|
-
end
|
36
|
-
|
37
|
-
def raw_value
|
38
|
-
@model.public_send(@attribute)
|
39
|
-
end
|
40
|
-
|
41
|
-
def inspect
|
42
|
-
"#<#{self.class.name} #{@attribute.inspect}>"
|
43
|
-
end
|
44
|
-
|
45
|
-
# Convenience method for rendering the content of the cell
|
46
|
-
# <% dl.text(:name) { |cell| tag.em(cell) } %>
|
47
|
-
# => <dt>Name</dt><dd><em>Jamie Banks</em></dd>
|
48
|
-
def to_s
|
49
|
-
attribute_value
|
50
|
-
end
|
51
|
-
|
52
|
-
private
|
53
|
-
|
54
|
-
def content_or_value
|
55
|
-
content? ? content : attribute_value
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Koi
|
4
|
-
module SummaryList
|
5
|
-
class DateComponent < Base
|
6
|
-
def initialize(model, attribute, format: :admin, **)
|
7
|
-
super(model, attribute, **)
|
8
|
-
|
9
|
-
@format = format
|
10
|
-
end
|
11
|
-
|
12
|
-
def attribute_value
|
13
|
-
l(raw_value.to_date, format: @format) if raw_value.present?
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Koi
|
4
|
-
module SummaryList
|
5
|
-
class DatetimeComponent < Base
|
6
|
-
def initialize(model, attribute, format: :admin, **)
|
7
|
-
super(model, attribute, **)
|
8
|
-
|
9
|
-
@format = format
|
10
|
-
end
|
11
|
-
|
12
|
-
def attribute_value
|
13
|
-
l(raw_value.to_datetime, format: @format) if raw_value.present?
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Koi
|
4
|
-
module SummaryList
|
5
|
-
class ItemComponent < Base
|
6
|
-
def render?
|
7
|
-
!(@skip_blank && raw_value.blank? && raw_value != false)
|
8
|
-
end
|
9
|
-
|
10
|
-
def attribute_value
|
11
|
-
case raw_value
|
12
|
-
when Array
|
13
|
-
raw_value.join(", ")
|
14
|
-
when ActiveStorage::Attached::One
|
15
|
-
raw_value.attached? ? link_to(raw_value.filename, url_for(raw_value)) : ""
|
16
|
-
when Date, Time, DateTime, ActiveSupport::TimeWithZone
|
17
|
-
l(raw_value, format: :admin)
|
18
|
-
when TrueClass, FalseClass
|
19
|
-
raw_value ? "Yes" : "No"
|
20
|
-
else
|
21
|
-
raw_value.to_s
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Koi
|
4
|
-
module SummaryList
|
5
|
-
class NumberComponent < Base
|
6
|
-
def initialize(model, attribute, format: :admin, **)
|
7
|
-
super(model, attribute, **)
|
8
|
-
|
9
|
-
@format = format
|
10
|
-
end
|
11
|
-
|
12
|
-
def attribute_value
|
13
|
-
number_to_human(raw_value) if raw_value.present?
|
14
|
-
end
|
15
|
-
|
16
|
-
def default_description_attributes
|
17
|
-
{ class: "number" }
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|