testimonials 0.8.2 → 0.9.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f6e6a966ec88019419566c0524b32c1e2cfbc01126ad9d7ee807063343fbadec
4
- data.tar.gz: 1a3982c027490e0e31f342058e390c4aec208f9a90b4242998629aa6718a3504
3
+ metadata.gz: b79e1e2893951f81ee3c7144fd2c2eaba89d6b6753e75b243b7ec961aa5ec39b
4
+ data.tar.gz: c55a34d075dfa5604b302a21a3c75d317fcef8253420799a343b64878b8fb65f
5
5
  SHA512:
6
- metadata.gz: 4c92786e0beccb39fe665405ce100d997e0db155a7bc2c56e881747f417f705414b57cfac650afa37d4473beec64a2d61c916a49e3ad489f92aaed889bd5e267
7
- data.tar.gz: 2e3ee818dcbb6c619e3efdc1740ddec85421c0194b0778d72767d7935f0547a88fdf19a247bc8479a06d9fcd7e74199448b350b5368d41bcc9f3ec250b48742a
6
+ metadata.gz: 6fb8c825f96b096352a4f181de4b6da669bead079925461b0cff538ee79cbd31d77917a834c07abf621e4f7a49835c66740b84b175ebb0575f522692f1e8e91c
7
+ data.tar.gz: 8f28f17a353aa422e90fed7949f9cd991bf5d47f60e8d396cd4f4086e21daa0da4dd2c11d4ba521a5cbf6429c139303db99e52c32dcc969ea49d037576e5f69c
data/AGENTS.md CHANGED
@@ -190,6 +190,10 @@ Turbo Drive and nonce-based CSP work out of the box; the widget config rides in
190
190
 
191
191
  ---
192
192
 
193
+ ## One family
194
+
195
+ `ideasbugs`, `livechat`, `product_tours`, `i18n_proofreading` are the sibling engines. Same install shape, same host hooks (`base_controller_class`, `admin_layout`), same scoped dashboard CSS, same `primary_key_type`-aware migrations — so what you learn here transfers.
196
+
193
197
  ## Working on the gem itself
194
198
 
195
199
  ```bash
@@ -206,5 +210,6 @@ Conventions this codebase holds to — follow them rather than the first thing t
206
210
  - **Every install shape gets a test that drops the table for real** (`test/integration/skip_nps_test.rb`, `skip_prompt_events_test.rb`), so a slipped guard raises `no such table` instead of passing quietly. Generator tests pin each migration and initializer shape and check the ERB still compiles as Ruby.
207
211
  - **The widget is plain ES5-style JS in `lib/testimonials/widget.js`**, served by the engine, no build step, no framework. It reads its config from a JSON block on every `turbo:load`.
208
212
  - **Display stays headless.** New display UI belongs in `examples/`, not in `app/views`.
213
+ - **`lib/testimonials/dashboard.css` is half shared.** Everything above the `GEM-SPECIFIC` banner is the design system all five gems in the family ship — the same tokens, the same `.page-head`/`.tabs`/`.filters`/`.card`/`.badge`/`button`, the same `.dashboard-shell` + `.record-row` + `.detail-panel` two-pane dashboard — identical in every repo apart from the `tml` prefix. Diff it against a sibling before changing it, and carry the change to the other four. Anything only this gem has goes below the banner. New dashboard markup reuses the shared class names rather than inventing a domain-specific one.
209
214
  - Every user-facing change bumps `lib/testimonials/version.rb` and adds a `CHANGELOG.md` entry that says what it costs, not only what it adds.
210
215
  - Commit messages are prose that explains the tradeoff — read `git log` before writing one.
data/CHANGELOG.md CHANGED
@@ -1,5 +1,32 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.9.0
4
+
5
+ - **One design system across the family.** The stylesheet now opens with a
6
+ shared core — the colour tokens, `.page-head`, `.tabs`, `.filters`, `.card`,
7
+ `.badge`, buttons and form controls, and the `.dashboard-shell` +
8
+ `.record-row` + `.detail-panel` two-pane dashboard — identical in all five
9
+ gems of the family, apart from the `--tml-` prefix. The five had drifted:
10
+ sidebars between 380px and 430px, reading columns between 860px and 1020px,
11
+ two different tab styles and three different button styles. The sidebar is
12
+ now 330–430px everywhere, a reading page 1020px, a dashboard 1280px.
13
+ Everything below the `GEM-SPECIFIC` banner is what only this gem has.
14
+ - **The dashboard markup uses the shared class names.** `.testimonial-panel`
15
+ and `.nps-panel` are both `.detail-panel` now, and the body classes are
16
+ `tml-index`, `tml-show` and `tml-index tml-nps-index` where they were
17
+ `tm-index`, `tm-show` and `tm-nps-index`. The row classes were already
18
+ shared. If you styled or scripted any of those names in a host app, that is
19
+ the breaking change — no configuration, route or database change is
20
+ involved.
21
+ - **The narrow-screen rules work again.** The `max-width: 760px` block sat above
22
+ the component rules it means to override, and CSS nesting adds no specificity,
23
+ so the desktop grid won every tie: showing one pane at a time on a phone had
24
+ quietly stopped working. The media query moved to the end of the file.
25
+ - Smaller fixes that came with the shared core: a submit input is styled as a
26
+ button rather than a full-width field, the filter row keeps its search box and
27
+ button on one line, and a `code.key` truncates inside a list row instead of
28
+ wrapping over three lines.
29
+
3
30
  ## 0.8.1
4
31
 
5
32
  - Dropped the redundant `(tenant, status)` index from the install and tenant
data/README.md CHANGED
@@ -376,11 +376,24 @@ Bug reports and pull requests welcome. The fastest way to help is to install it
376
376
  in a real app and
377
377
  [tell me where it hurt](https://github.com/yshmarov/testimonials/issues).
378
378
 
379
- ## Also by the same author
379
+ ## One family
380
380
 
381
- - [ideasbugs](https://github.com/yshmarov/ideasbugs) in-app bug reports and
382
- feature requests. Pairs with this gem's NPS detractor hook.
383
- - [SupeRails](https://superails.com) — Rails screencasts.
381
+ Five Rails engines built on the same backbone, so adopting a second one is
382
+ mostly muscle memory:
383
+
384
+ | Gem | What it does |
385
+ | --- | --- |
386
+ | **testimonials** *(this gem)* | Testimonials, reviews and NPS — text and video, collected in your own app |
387
+ | [ideasbugs](https://github.com/yshmarov/ideasbugs) | In-app bug reports and feature requests, with a triage queue |
388
+ | [livechat](https://github.com/yshmarov/livechat) | Live chat between your visitors and your agents, self-hosted |
389
+ | [product_tours](https://github.com/yshmarov/product_tours) | Product tours and video tutorials, shown in-app at the right moment |
390
+ | [i18n_proofreading](https://github.com/yshmarov/i18n_proofreading) | In-context translation fixes suggested by your own users |
391
+
392
+ They share the install shape (`generate <gem>:install`, mount, one initializer),
393
+ the same host hooks (`base_controller_class` to inherit your admin's controller,
394
+ `admin_layout` for just the shell), one dashboard design system — the same
395
+ two-pane layout, colour tokens and components in all five, scoped so it cannot
396
+ touch your own CSS — and migrations that follow your app's `primary_key_type`.
384
397
 
385
398
  ## License
386
399
 
@@ -1,6 +1,6 @@
1
- <section class="nps-panel">
1
+ <section class="detail-panel">
2
2
  <div class="panel-head">
3
- <h1 class="title-row">
3
+ <h1>
4
4
  <span class="badge nps-<%= response.promoter? ? 'promoter' : (response.detractor? ? 'detractor' : 'passive') %>">
5
5
  <%= response.score %>
6
6
  </span>
@@ -1,4 +1,4 @@
1
- <% content_for :body_class, 'tm-nps-index' %>
1
+ <% content_for :body_class, 'tml-index tml-nps-index' %>
2
2
 
3
3
  <%= render layout: 'testimonials/shared/dashboard' do %>
4
4
  <div class="page-head">
@@ -114,7 +114,7 @@
114
114
  <% if @responses.any? %>
115
115
  <% @responses.each do |response| %>
116
116
  <%= link_to nps_responses_path(page: @page, response_id: response.id),
117
- class: ['record-row nps-row', ('active' if @selected_response&.id == response.id)].compact do %>
117
+ class: ['record-row', ('active' if @selected_response&.id == response.id)].compact do %>
118
118
  <span class="record-main">
119
119
  <span class="record-topline">
120
120
  <span class="badge nps-<%= response.promoter? ? 'promoter' : (response.detractor? ? 'detractor' : 'passive') %>">
@@ -1,4 +1,4 @@
1
- <% content_for :body_class, 'tm-show' %>
1
+ <% content_for :body_class, 'tml-show' %>
2
2
 
3
3
  <%= render layout: 'testimonials/shared/dashboard' do %>
4
4
  <div class="breadcrumb">
@@ -1,4 +1,4 @@
1
- <section class="testimonial-panel">
1
+ <section class="detail-panel">
2
2
  <div class="detail-scroll">
3
3
  <div class="card pad">
4
4
  <dl>
@@ -1,4 +1,4 @@
1
- <% content_for :body_class, 'tm-index' %>
1
+ <% content_for :body_class, 'tml-index' %>
2
2
 
3
3
  <%= render layout: 'testimonials/shared/dashboard' do %>
4
4
  <div class="page-head">
@@ -46,7 +46,7 @@
46
46
  <% @testimonials.each do |testimonial| %>
47
47
  <%= link_to testimonials_path(status: @status, kind: @kind, q: @query, page: @page,
48
48
  testimonial_id: testimonial.id),
49
- class: ['record-row testimonial-row',
49
+ class: ['record-row',
50
50
  ('active' if @selected_testimonial&.id == testimonial.id)].compact do %>
51
51
  <span class="record-main">
52
52
  <span class="record-topline">
@@ -1,4 +1,4 @@
1
- <% content_for :body_class, 'tm-show' %>
1
+ <% content_for :body_class, 'tml-show' %>
2
2
 
3
3
  <%= render layout: 'testimonials/shared/dashboard' do %>
4
4
  <div class="breadcrumb">
@@ -4,102 +4,59 @@
4
4
  *
5
5
  * :root custom properties, all `--tml-` prefixed so they can
6
6
  * neither overwrite a host's nor be overwritten by them.
7
- * .tml-page the page frame (was bare html/body). Only the gem's own
7
+ * .tml-page the page frame (was bare html/body). Only the gem's own
8
8
  * layout puts this class on <body>, so inside a host admin
9
9
  * these rules simply do not apply.
10
- * .tml-dashboard everything else, nested. Names like .container, .card
10
+ * .tml-dashboard everything else, nested. Names like .container, .card
11
11
  * and .tabs are confined to the dashboard's own markup, so
12
12
  * loading this file inside a host cannot restyle its chrome.
13
13
  *
14
14
  * Nothing here styles a bare `body`, `a`, `table` or `*` at the top level.
15
+ *
16
+ * Two sections follow: the design system shared by the whole gem family,
17
+ * then what only this gem has. A rule that belongs in the shared section
18
+ * belongs in all five copies of it.
19
+ *
20
+ * Order inside a section matters — components, then the page frame, then the
21
+ * narrow-screen overrides. Nesting adds no specificity, so the last rule
22
+ * wins the ties, and an override placed before the rule it means to beat
23
+ * silently does nothing.
15
24
  */
16
25
 
26
+ /* ---------------------------------------------------------------------------
27
+ * SHARED CORE — identical in testimonials, ideasbugs, livechat, product_tours
28
+ * and i18n_proofreading apart from the prefix. Diff it against a sibling gem
29
+ * before you change it, and carry the change to all five.
30
+ * ------------------------------------------------------------------------- */
17
31
 
18
32
  :root {
19
33
  color-scheme: light dark;
20
- --tml-bg: #f6f7f9; --tml-surface: #fff; --tml-text: #1c2024; --tml-muted: #6b7280;
21
- --tml-border: #e5e7eb; --tml-accent: #2563eb; --tml-accent-text: #fff;
22
- --tml-pending: #d97706; --tml-approved: #16a34a; --tml-archived: #6b7280;
23
- --tml-star: #f59e0b; --tml-danger: #dc2626;
24
- --tml-promoter: #16a34a; --tml-passive: #d97706; --tml-detractor: #dc2626;
25
- /* The four bands an NPS number falls into: bad, ordinary, strong, rare. */
26
- --tml-nps-needs-work: #dc2626; --tml-nps-good: #d97706; --tml-nps-great: #16a34a; --tml-nps-excellent: #0f766e;
34
+ --tml-bg: #f6f7f9;
35
+ --tml-surface: #fff;
36
+ --tml-text: #1c2024;
37
+ --tml-muted: #6b7280;
38
+ --tml-border: #e5e7eb;
39
+ --tml-accent: #2563eb;
40
+ --tml-accent-text: #fff;
41
+ --tml-code: #f0f1f3;
42
+ /* The four semantic states every gem in the family badges something with. */
43
+ --tml-success: #16a34a;
44
+ --tml-warning: #d97706;
45
+ --tml-danger: #dc2626;
46
+ --tml-neutral: #6b7280;
27
47
  }
28
48
  @media (prefers-color-scheme: dark) {
29
49
  :root {
30
- --tml-bg: #111418; --tml-surface: #1a1f26; --tml-text: #e6e8ea; --tml-muted: #9aa2ab;
31
- --tml-border: #2a313a; --tml-accent: #3b82f6;
32
- }
33
- }
34
- @media (max-width: 760px) {
35
- .tml-page { font-size: 14px; }
36
- .tm-index, .tm-nps-index, .tm-show { overflow-x: hidden; }
37
- .tm-index, .tm-nps-index { overflow-y: auto; overflow-x: hidden; }
38
- .tm-index, .tm-index .container,
39
- .tm-nps-index, .tm-nps-index .container { min-height: 100vh; height: auto; }
40
- .tm-index .container, .tm-nps-index .container { padding-bottom: 10px; }
41
- .tml-dashboard {
42
- & .container { padding: 14px 10px 24px; }
43
- & .dashboard-detail,
44
- & .testimonial-panel,
45
- & .nps-panel,
46
- & .detail-scroll,
47
- & .card,
48
- & dl,
49
- & dd,
50
- & .best-line-form,
51
- & .best-line-form textarea { min-width: 0; max-width: 100%; }
52
- & .testimonial-panel .card,
53
- & .nps-panel .card { width: calc(100vw - 20px); }
54
- & .best-line-form textarea { width: 100%; }
55
- & .message,
56
- & .best-line-hint,
57
- & dd,
58
- & .muted { overflow-wrap: anywhere; }
59
- & .message,
60
- & .best-line-hint,
61
- & dd,
62
- & .muted { max-width: calc(100vw - 54px); }
63
- & .dashboard-shell { display: block; min-height: calc(100vh - 76px); }
64
- & .dashboard-sidebar,
65
- & .dashboard-detail { min-height: calc(100vh - 76px); }
66
- & .dashboard-shell.has-selected .dashboard-sidebar { display: none; }
67
- & .dashboard-shell:not(.has-selected) .dashboard-detail { display: none; }
68
- & .record-list { overflow: visible; }
69
- & .record-row { padding: 12px; }
70
- & .record-meta { display: none; }
71
- & .dashboard-detail .testimonial-panel,
72
- & .dashboard-detail .nps-panel { min-height: calc(100vh - 64px); }
73
- & .mobile-back { display: block; flex: 0 0 auto; margin: 10px 10px 0; font-size: 13px; }
74
- & .panel-head h1 { font-size: 18px; }
75
- & dl { grid-template-columns: 1fr; gap: 3px; }
76
- & .stat-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
77
- & .stat { min-width: 0; padding: 10px 12px; }
78
- & .stat b { font-size: 22px; }
79
- & .stat-nps { grid-column: 1 / -1; }
80
- & .nps-bands { grid-template-columns: max-content 1fr; }
81
- & .nps-bands b { grid-column: 2; }
82
- & .nps-bands li > .muted { grid-column: 1 / -1; }
83
- & .share-link { flex: 1 0 100%; margin-left: 0; text-align: center; }
50
+ --tml-bg: #111418;
51
+ --tml-surface: #1a1f26;
52
+ --tml-text: #e6e8ea;
53
+ --tml-muted: #9aa2ab;
54
+ --tml-border: #2a313a;
55
+ --tml-accent: #3b82f6;
56
+ --tml-code: #232a33;
84
57
  }
85
58
  }
86
59
 
87
- /* Page frame — the gem's own layout only. */
88
- .tml-page { margin: 0; background: var(--tml-bg); color: var(--tml-text); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; }
89
- /* Desktop dashboard: queue on the left, selected record on the right. */
90
- .tm-index, .tm-index .container,
91
- .tm-nps-index, .tm-nps-index .container { height: 100vh; height: 100dvh; }
92
- .tm-index, .tm-nps-index { overflow: hidden; }
93
- .tm-index .container, .tm-nps-index .container { max-width: 1280px; display: flex; flex-direction: column; padding-bottom: 16px; }
94
- .tm-index .nav, .tm-nps-index .nav,
95
- .tm-index .container .page-head, .tm-nps-index .container .page-head,
96
- .tm-nps-index .stat-row { flex: 0 0 auto; }
97
- .tm-index .container .page-head, .tm-nps-index .container .page-head { margin-bottom: 14px; }
98
- .tm-nps-index .stat-row { margin-bottom: 14px; }
99
- /* Standalone show pages keep normal page scrolling. */
100
- .tm-show { min-height: 100vh; overflow: auto; }
101
- .tm-show .detail-scroll { overflow: visible; }
102
-
103
60
  /* Dashboard components — any layout. */
104
61
  .tml-dashboard {
105
62
  /* A scoping device, not a layout one: without this the wrapper would
@@ -109,70 +66,259 @@
109
66
  & * { box-sizing: border-box; }
110
67
  & a { color: var(--tml-accent); text-decoration: none; }
111
68
  & a:hover { text-decoration: underline; }
69
+ & :focus-visible { outline: 2px solid var(--tml-accent); outline-offset: 2px; }
70
+
71
+ /* Page furniture. `.container` is the reading width; an index page widens it
72
+ to 1280px in the page frame below. */
112
73
  & .container { max-width: 1020px; margin: 0 auto; padding: 24px 16px 64px; }
113
- & h1 { font-size: 22px; margin: 0 0 16px; }
114
- & h1.title-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
115
- /* Index heading row: title on the left, the shareable public link on the right. */
116
- & .page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
74
+ & h1 { margin: 0 0 16px; font-size: 22px; }
75
+ & h2 { margin: 0 0 12px; font-size: 16px; }
76
+ & .page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
117
77
  & .page-head h1 { margin: 0; }
118
- & .nav { display: flex; gap: 8px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
78
+ & .lede { margin: 4px 0 0; color: var(--tml-muted); }
79
+ & .breadcrumb { margin: 0 0 12px; font-size: 13px; }
80
+ & .muted { color: var(--tml-muted); font-size: 13px; }
81
+ & .case-id { color: var(--tml-muted); font-weight: 400; font-size: 15px; }
82
+ & .spacer { flex: 1; }
83
+ & .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
84
+
85
+ /* Section switcher: the pills above the dashboard when a gem has more than
86
+ one section. Lives on the page, so a host `admin_layout` can drop it. */
87
+ & .nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
119
88
  & .nav a { padding: 6px 16px; border: 1px solid var(--tml-border); border-radius: 999px; background: var(--tml-surface); color: var(--tml-muted); font-weight: 600; }
120
89
  & .nav a:hover { text-decoration: none; color: var(--tml-text); }
121
- & .nav a.active { background: var(--tml-accent); border-color: var(--tml-accent); color: var(--tml-accent-text); }
90
+ & .nav a.active { border-color: var(--tml-accent); background: var(--tml-accent); color: var(--tml-accent-text); }
122
91
  & .nav a.active:hover { color: var(--tml-accent-text); }
123
- & .share-link { margin-left: auto; font-size: 13px; font-weight: 400; }
124
- & .tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--tml-border); margin-bottom: 16px; flex-wrap: wrap; }
125
- & .tabs a { padding: 8px 14px; border-radius: 8px 8px 0 0; color: var(--tml-muted); }
126
- & .tabs a.active { color: var(--tml-text); font-weight: 600; border: 1px solid var(--tml-border); border-bottom: 2px solid var(--tml-surface); background: var(--tml-surface); margin-bottom: -1px; }
127
- & .tabs a:hover { text-decoration: none; color: var(--tml-text); }
128
- & .count { display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 4px; border-radius: 999px; background: var(--tml-border); font-size: 12px; text-align: center; }
129
- & .filters { margin-bottom: 16px; display: flex; gap: 8px; align-items: center; }
130
- & .filters select,
131
- & .filters input[type=search] { padding: 6px 8px; border: 1px solid var(--tml-border); border-radius: 8px; background: var(--tml-surface); color: var(--tml-text); font: inherit; }
132
- & .filters input[type=search] { flex: 1; max-width: 320px; }
133
- & .card { background: var(--tml-surface); border: 1px solid var(--tml-border); border-radius: 12px; overflow: hidden; }
92
+
93
+ /* Tabs: one system for the whole family an underlined row of equal-width
94
+ tabs, sized to sit at the top of the sidebar. */
95
+ & .tabs { display: flex; gap: 6px; }
96
+ & .tabs a { position: relative; display: flex; flex: 1 1 0; align-items: center; justify-content: center; gap: 6px; min-height: 34px; padding: 5px 10px 8px; border-radius: 8px; color: var(--tml-muted); font-weight: 600; }
97
+ & .tabs a:hover { background: var(--tml-bg); color: var(--tml-text); text-decoration: none; }
98
+ & .tabs a.active { color: var(--tml-text); }
99
+ & .tabs a.active::after { content: ""; position: absolute; right: 20px; bottom: 0; left: 20px; height: 2px; border-radius: 999px; background: var(--tml-accent); }
100
+ & .count { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 999px; background: color-mix(in srgb, var(--tml-muted) 14%, transparent); font-size: 12px; text-align: center; font-variant-numeric: tabular-nums; }
101
+ & .tabs a.active .count { background: var(--tml-border); }
102
+
103
+ /* Filter row under the tabs: a full-width select over a search + submit row,
104
+ however many of the three a gem actually has. */
105
+ & .filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 12px; border-bottom: 1px solid var(--tml-border); }
106
+ & .filters label { flex: 1 1 100%; color: var(--tml-muted); font-size: 13px; }
107
+ & .filters select { flex: 1 1 100%; }
108
+ /* Basis 0, not auto: the controls below are `width: 100%`, which would
109
+ otherwise push the submit button onto its own row. */
110
+ & .filters input[type="search"] { flex: 1 1 0; min-width: 0; }
111
+ & .filters button,
112
+ & .filters input[type="submit"] { flex: 0 0 auto; }
113
+
114
+ /* Form controls. 16px so iOS does not zoom the page on focus. */
115
+ & input,
116
+ & select,
117
+ & textarea { width: 100%; min-height: 38px; padding: 7px 9px; border: 1px solid var(--tml-border); border-radius: 8px; background: var(--tml-surface); color: var(--tml-text); font: inherit; font-size: 16px; letter-spacing: 0; }
118
+ & textarea { resize: vertical; }
119
+ & input[type="checkbox"],
120
+ & input[type="radio"] { width: auto; min-width: 0; min-height: 0; }
121
+ & input:focus,
122
+ & select:focus,
123
+ & textarea:focus { border-color: var(--tml-accent); outline: 2px solid color-mix(in srgb, var(--tml-accent) 22%, transparent); outline-offset: 0; }
124
+ & .field { margin-bottom: 16px; }
125
+ & .field label { display: block; margin-bottom: 5px; font-weight: 600; }
126
+ & .field small { display: block; margin-top: 5px; color: var(--tml-muted); }
127
+
128
+ /* A submit input is a button, whatever the markup says. */
129
+ & button,
130
+ & .button,
131
+ & input[type="submit"] { display: inline-flex; width: auto; align-items: center; justify-content: center; min-height: 38px; padding: 8px 14px; border: 1px solid var(--tml-border); border-radius: 8px; background: var(--tml-surface); color: var(--tml-text); font: inherit; cursor: pointer; }
132
+ & button:hover,
133
+ & .button:hover,
134
+ & input[type="submit"]:hover { border-color: var(--tml-muted); text-decoration: none; }
135
+ & button.primary,
136
+ & .button.primary,
137
+ & input[type="submit"].primary { border-color: var(--tml-accent); background: var(--tml-accent); color: var(--tml-accent-text); }
138
+ & button.danger,
139
+ & .button.danger { color: var(--tml-danger); }
140
+ & button.small,
141
+ & .button.small { min-height: 32px; padding: 4px 10px; font-size: 13px; }
142
+ & .actions,
143
+ & .form-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
144
+ & .actions form { display: inline; }
145
+ & .form-actions { padding-top: 12px; }
146
+
147
+ & .card { overflow: hidden; border: 1px solid var(--tml-border); border-radius: 12px; background: var(--tml-surface); }
134
148
  & .card.pad { padding: 16px; overflow: visible; }
135
149
  & table { width: 100%; border-collapse: collapse; }
136
150
  & th,
137
151
  & td { padding: 10px 14px; text-align: left; vertical-align: top; }
138
152
  & th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--tml-muted); border-bottom: 1px solid var(--tml-border); }
139
153
  & tr + tr td { border-top: 1px solid var(--tml-border); }
140
- & .badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; color: #fff; white-space: nowrap; }
154
+ & td.row-actions { white-space: nowrap; text-align: right; }
155
+ & td.row-actions form { display: inline-block; }
156
+ & td.row-actions form + form { margin-left: 6px; }
157
+
158
+ & .badge { display: inline-flex; padding: 2px 10px; border-radius: 999px; color: #fff; font-size: 12px; font-weight: 600; white-space: nowrap; }
159
+ & .badge.locale { border: 1px solid var(--tml-border); background: transparent; color: var(--tml-muted); }
160
+ & code.key { max-width: 100%; padding: 2px 7px; border-radius: 6px; background: var(--tml-code); font: 12.5px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; overflow-wrap: anywhere; }
161
+
162
+ & .flash,
163
+ & .errors { margin-bottom: 16px; padding: 10px 12px; border: 1px solid var(--tml-border); border-radius: 8px; background: var(--tml-surface); }
164
+ & .flash.notice { border-color: var(--tml-success); }
165
+ & .flash.alert,
166
+ & .errors { border-color: var(--tml-danger); }
167
+ & .errors ul { margin-bottom: 0; }
168
+
169
+ & dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 16px; margin: 0; }
170
+ & dt { color: var(--tml-muted); }
171
+ & dd { margin: 0; overflow-wrap: anywhere; }
172
+ & .message { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
173
+
174
+ & .empty { padding: 48px 16px; color: var(--tml-muted); text-align: center; }
175
+ & .empty-state { max-width: 320px; margin: auto; padding: 24px; text-align: center; }
176
+ & .empty-state h2 { margin: 0 0 6px; font-size: 18px; }
177
+ & .empty-state p { margin: 0; }
178
+
179
+ /* The two-pane dashboard: the queue on the left, the selected record on the
180
+ right, each pane owning its own scroll. */
181
+ & .dashboard-shell { display: grid; flex: 1 1 auto; grid-template-columns: minmax(330px, 430px) 1fr; gap: 16px; min-height: 0; }
182
+ & .dashboard-sidebar { display: flex; min-width: 0; min-height: 0; flex-direction: column; overflow: hidden; border: 1px solid var(--tml-border); border-radius: 8px; background: var(--tml-surface); }
183
+ & .dashboard-sidebar .tabs { flex: 0 0 auto; margin: 12px 12px 0; }
184
+ & .dashboard-sidebar .filters { flex: 0 0 auto; }
185
+
186
+ /* One row shape for every gem: a topline of badges and a timestamp, the copy
187
+ that identifies the record, then a muted line of ids and authors. */
188
+ & .record-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
189
+ & .record-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; padding: 13px 14px; border-bottom: 1px solid var(--tml-border); color: var(--tml-text); }
190
+ & .record-row:hover { background: var(--tml-bg); text-decoration: none; }
191
+ & .record-row.active { background: color-mix(in srgb, var(--tml-accent) 9%, var(--tml-surface)); box-shadow: inset 3px 0 0 var(--tml-accent); }
192
+ & .record-main { display: flex; min-width: 0; flex-direction: column; gap: 5px; }
193
+ & .record-topline,
194
+ & .record-meta { display: flex; align-items: center; gap: 8px; min-width: 0; }
195
+ & .record-name,
196
+ & .record-copy,
197
+ & .record-meta span,
198
+ /* A key is `overflow-wrap: anywhere` in prose; in a row it truncates. */
199
+ & .record-topline code.key,
200
+ & .record-meta code.key { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
201
+ & .record-name { font-weight: 600; }
202
+ & .record-copy { display: block; font-weight: 600; }
203
+ & .record-time { margin-left: auto; white-space: nowrap; }
204
+ & .record-side { display: flex; flex-direction: column; align-items: flex-end; justify-content: space-between; gap: 8px; padding-top: 1px; }
205
+ & .pager { display: flex; flex: 0 0 auto; justify-content: space-between; gap: 16px; min-height: 42px; margin: 0; padding: 10px 12px; border-top: 1px solid var(--tml-border); }
206
+
207
+ /* The selected record. `.detail-scroll` is the only part that scrolls, so the
208
+ panel heading and its actions stay put. */
209
+ & .dashboard-detail { display: flex; min-width: 0; min-height: 0; flex-direction: column; overflow: hidden; }
210
+ & .dashboard-detail .detail-panel { flex: 1 1 auto; min-height: 0; }
211
+ & .dashboard-detail .detail-scroll { flex: 1 1 auto; overflow-y: auto; padding-right: 2px; }
212
+ & .dashboard-detail .actions { margin-bottom: 0; }
213
+ & .detail-panel { display: flex; min-width: 0; flex-direction: column; }
214
+ /* The panel's own heading row: the title on the left, whatever acts on the
215
+ whole record on the right. */
216
+ & .panel-head { display: flex; flex: 0 0 auto; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
217
+ & .panel-head h1 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0; }
218
+ & .detail-scroll { display: flex; min-height: 0; flex-direction: column; gap: 12px; }
219
+ & .mobile-back { display: none; }
220
+ }
221
+
222
+ /* Page frame — the gem's own layout only. After the components, so it wins the
223
+ specificity ties against them. */
224
+ .tml-page { margin: 0; min-height: 100vh; background: var(--tml-bg); color: var(--tml-text); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; letter-spacing: 0; }
225
+ /* An index page is the dashboard: it fills the viewport and never scrolls
226
+ itself, because the queue and the detail pane each scroll on their own. */
227
+ .tml-index, .tml-index .container { height: 100vh; height: 100dvh; }
228
+ .tml-index { overflow: hidden; }
229
+ .tml-index .container { display: flex; max-width: 1280px; flex-direction: column; padding-bottom: 16px; }
230
+ .tml-index .nav,
231
+ .tml-index .page-head { flex: 0 0 auto; }
232
+ /* Standalone show pages keep normal page scrolling. */
233
+ .tml-show { min-height: 100vh; overflow: auto; }
234
+ .tml-show .detail-panel { width: 100%; }
235
+ .tml-show .detail-scroll { overflow: visible; }
236
+
237
+ /* Narrow screens: one pane at a time, the queue until a record is picked.
238
+ Last in the file, so these overrides actually reach the rules above. */
239
+ @media (max-width: 760px) {
240
+ .tml-page { font-size: 14px; }
241
+ .tml-index, .tml-show { overflow-x: hidden; }
242
+ .tml-index { overflow-y: auto; }
243
+ .tml-index, .tml-index .container { min-height: 100vh; height: auto; }
244
+ .tml-index .container { padding-bottom: 10px; }
245
+ .tml-dashboard {
246
+ & .container { padding: 14px 10px 24px; }
247
+ & .page-head { margin-bottom: 12px; }
248
+ & .detail-panel,
249
+ & .detail-scroll,
250
+ & .card,
251
+ & dl,
252
+ & dd { min-width: 0; max-width: 100%; }
253
+ & .dashboard-detail .card { width: 100%; }
254
+ & .message,
255
+ & .lede,
256
+ & dd,
257
+ & .muted { overflow-wrap: anywhere; }
258
+ & .dashboard-shell { display: block; min-height: calc(100vh - 62px); }
259
+ & .dashboard-sidebar,
260
+ & .dashboard-detail { min-height: calc(100vh - 62px); }
261
+ & .dashboard-shell.has-selected .dashboard-sidebar { display: none; }
262
+ & .dashboard-shell:not(.has-selected) .dashboard-detail { display: none; }
263
+ & .record-list { overflow: visible; }
264
+ & .record-row { padding: 12px; }
265
+ & .record-meta { display: none; }
266
+ & .dashboard-detail .detail-panel { min-height: calc(100vh - 64px); }
267
+ & .mobile-back { display: block; flex: 0 0 auto; margin: 4px 0 10px; font-size: 13px; }
268
+ & .panel-head h1 { font-size: 18px; }
269
+ & dl { grid-template-columns: 1fr; gap: 3px; }
270
+ & dd { margin-bottom: 8px; }
271
+ }
272
+ }
273
+
274
+ /* ---------------------------------------------------------------------------
275
+ * GEM-SPECIFIC — testimonials only: star ratings, the video player, the best
276
+ * line editor, and the NPS score card with its meter and benchmarks.
277
+ * ------------------------------------------------------------------------- */
278
+
279
+ :root {
280
+ --tml-pending: var(--tml-warning);
281
+ --tml-approved: var(--tml-success);
282
+ --tml-archived: var(--tml-neutral);
283
+ --tml-star: #f59e0b;
284
+ --tml-promoter: var(--tml-success);
285
+ --tml-passive: var(--tml-warning);
286
+ --tml-detractor: var(--tml-danger);
287
+ /* The four bands an NPS number falls into: bad, ordinary, strong, rare. */
288
+ --tml-nps-needs-work: var(--tml-danger);
289
+ --tml-nps-good: var(--tml-warning);
290
+ --tml-nps-great: var(--tml-success);
291
+ --tml-nps-excellent: #0f766e;
292
+ }
293
+
294
+ .tml-dashboard {
295
+ /* The shareable public form, sitting in the index heading row. */
296
+ & .share-link { font-size: 13px; font-weight: 400; }
297
+
141
298
  & .badge.status-pending { background: var(--tml-pending); }
142
299
  & .badge.status-approved { background: var(--tml-approved); }
143
300
  & .badge.status-archived { background: var(--tml-archived); }
144
301
  & .badge.nps-promoter { background: var(--tml-promoter); }
145
302
  & .badge.nps-passive { background: var(--tml-passive); }
146
303
  & .badge.nps-detractor { background: var(--tml-detractor); }
147
- & .badge.locale { background: transparent; color: var(--tml-muted); border: 1px solid var(--tml-border); }
148
304
  & .stars { color: var(--tml-star); letter-spacing: 1px; white-space: nowrap; }
149
305
  & .stars .off { color: var(--tml-border); }
150
- & .muted { color: var(--tml-muted); font-size: 13px; }
151
- & .pager { margin-top: 16px; display: flex; gap: 16px; }
152
- & .actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 0; }
153
- & .actions form { display: inline; }
154
- & td.row-actions { white-space: nowrap; text-align: right; }
155
- & td.row-actions form { display: inline-block; }
156
- & td.row-actions form + form { margin-left: 6px; }
157
- & button,
158
- & .button { padding: 8px 14px; border: 1px solid var(--tml-border); border-radius: 8px; cursor: pointer; background: var(--tml-surface); color: var(--tml-text); font: inherit; }
159
- & button.primary { background: var(--tml-accent); border-color: var(--tml-accent); color: var(--tml-accent-text); }
160
- & button.danger { color: var(--tml-danger); }
161
- & button.small { padding: 3px 10px; font-size: 13px; }
162
- & .message { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
163
- & dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
164
- & dt { color: var(--tml-muted); }
165
- & dd { margin: 0; overflow-wrap: anywhere; }
306
+
166
307
  & video.playback { width: 100%; max-width: 480px; border-radius: 10px; background: #000; }
167
308
  & img.avatar { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; }
168
- & .empty { padding: 48px 16px; text-align: center; color: var(--tml-muted); }
169
- & .breadcrumb { margin-bottom: 12px; font-size: 13px; }
170
- & .case-id { color: var(--tml-muted); font-weight: 400; font-size: 15px; }
309
+
310
+ & .best-line-form { margin-top: 14px; }
311
+ & .best-line-form label { font-weight: 600; }
312
+ & .best-line-hint { margin: 2px 0 6px; }
313
+ & .best-line-save { margin-top: 8px; }
314
+
315
+ /* NPS summary row. */
171
316
  & .stat-row { display: flex; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
172
- & .stat { flex: 1; min-width: 140px; background: var(--tml-surface); border: 1px solid var(--tml-border); border-radius: 12px; padding: 14px 16px; }
317
+ & .stat { flex: 1; min-width: 140px; padding: 14px 16px; border: 1px solid var(--tml-border); border-radius: 12px; background: var(--tml-surface); }
173
318
  & .stat b { display: block; font-size: 26px; }
174
319
  & .stat span { color: var(--tml-muted); font-size: 13px; }
175
- /* NPS score card: the number, the band it falls in, and where it sits on the −100..100 scale — so nobody has to google whether 50 is any good. */
320
+ /* The score card: the number, the band it falls in, and where it sits on the
321
+ −100..100 scale — so nobody has to google whether 50 is any good. */
176
322
  & .stat-nps { flex: 2.4; min-width: 240px; }
177
323
  & .stat-headline { display: flex; align-items: center; gap: 10px; }
178
324
  & .stat-headline b { display: inline-block; }
@@ -189,7 +335,8 @@
189
335
  & .nps-seg.nps-band-good { flex: 30; background: var(--tml-nps-good); }
190
336
  & .nps-seg.nps-band-great { flex: 40; background: var(--tml-nps-great); }
191
337
  & .nps-seg.nps-band-excellent { flex: 30; background: var(--tml-nps-excellent); }
192
- /* Hidden until dashboard.js reads data-nps-marker and positions it, so a score of 50 never renders as if it were −100. */
338
+ /* Hidden until dashboard.js reads data-nps-marker and positions it, so a score
339
+ of 50 never renders as if it were −100. */
193
340
  & .nps-marker { display: none; position: absolute; top: -3px; width: 4px; height: 12px; margin-left: -2px; border-radius: 2px; background: var(--tml-text); box-shadow: 0 0 0 2px var(--tml-surface); }
194
341
  & .nps-marker.placed { display: block; }
195
342
  & .nps-meter-ticks { position: relative; height: 14px; margin-top: 3px; color: var(--tml-muted); font-size: 11px; }
@@ -201,7 +348,7 @@
201
348
  & .nps-meter-ticks .tick-max { left: 100%; transform: translateX(-100%); }
202
349
  & .nps-sample { margin: 8px 0 0; font-size: 12px; }
203
350
  /* The formula and the benchmarks, tucked behind a disclosure. */
204
- & .nps-guide { flex: 0 0 auto; margin-bottom: 14px; background: var(--tml-surface); border: 1px solid var(--tml-border); border-radius: 12px; }
351
+ & .nps-guide { flex: 0 0 auto; margin-bottom: 14px; border: 1px solid var(--tml-border); border-radius: 12px; background: var(--tml-surface); }
205
352
  & .nps-guide summary { padding: 10px 16px; color: var(--tml-muted); font-size: 13px; cursor: pointer; }
206
353
  & .nps-guide summary:hover { color: var(--tml-text); }
207
354
  & .nps-guide[open] summary { border-bottom: 1px solid var(--tml-border); }
@@ -210,48 +357,24 @@
210
357
  & .nps-bands { display: grid; grid-template-columns: max-content max-content 1fr; gap: 8px 14px; margin: 12px 0; padding: 0; list-style: none; align-items: baseline; }
211
358
  & .nps-bands li { display: contents; }
212
359
  & .nps-bands b { font-variant-numeric: tabular-nums; white-space: nowrap; }
213
- & .best-line-form textarea { width: 100%; padding: 8px; border: 1px solid var(--tml-border); border-radius: 8px; background: var(--tml-surface); color: var(--tml-text); font: inherit; resize: vertical; }
214
- & .best-line-hint { margin: 2px 0 6px; }
215
- & .best-line-save { margin-top: 8px; }
216
- & .panel-head { flex: 0 0 auto; }
217
- & .panel-head h1 { margin-bottom: 12px; }
218
- & .detail-scroll { min-height: 0; display: flex; flex-direction: column; gap: 12px; }
219
- & .testimonial-panel,
220
- & .nps-panel { min-width: 0; display: flex; flex-direction: column; }
221
- & .testimonial-panel .actions { flex: 0 0 auto; }
222
- & .testimonial-panel .detail-scroll > .actions { margin: 0; }
223
- & .dashboard-shell { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: minmax(330px, 430px) 1fr; gap: 16px; }
224
- & .dashboard-sidebar { min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--tml-surface); border: 1px solid var(--tml-border); border-radius: 8px; overflow: hidden; }
225
- & .dashboard-sidebar .tabs { flex: 0 0 auto; margin: 12px 12px 0; padding: 0; background: transparent; border: 0; border-radius: 0; gap: 6px; flex-wrap: nowrap; }
226
- & .dashboard-sidebar .tabs a { flex: 1 1 0; position: relative; display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 34px; padding: 5px 10px 8px; border-radius: 8px; color: var(--tml-muted); font-weight: 600; }
227
- & .dashboard-sidebar .tabs a.active { color: var(--tml-text); border: 0; background: transparent; box-shadow: none; margin: 0; }
228
- & .dashboard-sidebar .tabs a.active::after { content: ""; position: absolute; left: 20px; right: 20px; bottom: 0; height: 2px; border-radius: 999px; background: var(--tml-accent); }
229
- & .dashboard-sidebar .tabs a:not(.active):hover { text-decoration: none; color: var(--tml-text); background: var(--tml-bg); }
230
- & .dashboard-sidebar .tabs .count { margin-left: 0; background: color-mix(in srgb, var(--tml-muted) 14%, transparent); }
231
- & .dashboard-sidebar .tabs a.active .count { background: var(--tml-border); }
232
- & .dashboard-sidebar .filters { flex: 0 0 auto; display: grid; grid-template-columns: minmax(0, 1fr) auto; margin: 0; padding: 12px; border-bottom: 1px solid var(--tml-border); }
233
- & .dashboard-sidebar .filters select { grid-column: 1 / -1; width: 100%; }
234
- & .dashboard-sidebar .filters input[type=search] { min-width: 0; max-width: none; }
235
- & .record-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
236
- & .record-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; padding: 13px 14px; color: var(--tml-text); border-bottom: 1px solid var(--tml-border); }
237
- & .record-row:hover { text-decoration: none; background: var(--tml-bg); }
238
- & .record-row.active { background: color-mix(in srgb, var(--tml-accent) 9%, var(--tml-surface)); box-shadow: inset 3px 0 0 var(--tml-accent); }
239
- & .record-main { min-width: 0; display: flex; flex-direction: column; gap: 5px; }
240
- & .record-topline,
241
- & .record-meta { display: flex; align-items: center; gap: 8px; min-width: 0; }
242
- & .record-copy,
243
- & .record-meta span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
244
- & .record-copy { display: block; font-weight: 600; }
245
- & .record-time { margin-left: auto; white-space: nowrap; }
246
- & .record-side { display: flex; flex-direction: column; align-items: flex-end; justify-content: space-between; gap: 8px; padding-top: 1px; }
247
- & .dashboard-sidebar .pager { flex: 0 0 auto; margin: 0; padding: 10px 12px; border-top: 1px solid var(--tml-border); }
248
- & .dashboard-detail { min-width: 0; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
249
- & .dashboard-detail .testimonial-panel,
250
- & .dashboard-detail .nps-panel { flex: 1 1 auto; min-height: 0; }
251
- & .dashboard-detail .detail-scroll { flex: 1 1 auto; overflow-y: auto; padding-right: 2px; }
252
- & .dashboard-detail .actions { margin-bottom: 0; }
253
- & .empty-state { margin: auto; max-width: 320px; padding: 24px; text-align: center; }
254
- & .empty-state h2 { margin: 0 0 6px; font-size: 18px; }
255
- & .empty-state p { margin: 0; }
256
- & .mobile-back { display: none; }
360
+ }
361
+
362
+ /* The NPS page carries `tml-index tml-nps-index`: the shared index frame plus
363
+ the summary row and the guide, which sit above the two panes. */
364
+ .tml-nps-index .stat-row { flex: 0 0 auto; margin-bottom: 14px; }
365
+
366
+ @media (max-width: 760px) {
367
+ .tml-dashboard {
368
+ & .best-line-form,
369
+ & .best-line-form textarea { min-width: 0; max-width: 100%; }
370
+ & .best-line-hint { overflow-wrap: anywhere; }
371
+ & .stat-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
372
+ & .stat { min-width: 0; padding: 10px 12px; }
373
+ & .stat b { font-size: 22px; }
374
+ & .stat-nps { grid-column: 1 / -1; }
375
+ & .nps-bands { grid-template-columns: max-content 1fr; }
376
+ & .nps-bands b { grid-column: 2; }
377
+ & .nps-bands li > .muted { grid-column: 1 / -1; }
378
+ & .share-link { flex: 1 0 100%; text-align: center; }
379
+ }
257
380
  }
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Testimonials
4
- VERSION = '0.8.2'
4
+ VERSION = '0.9.0'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: testimonials
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.2
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yaroslav Shmarov