rails-markup 1.2.2 → 1.2.3
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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: bfb46593a03e4c5562c8dbec13d69ffa7e0492abc266f7d1bcf1cde6efdc624b
|
|
4
|
+
data.tar.gz: 60cb28088ec81da177e3bbfcaa52b040c8341e3d9d55e874ad71f65852498b82
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2e9408961851e8c76cb51a920434e59a7c8bc70304ebcf703a6095ecb2aa2f1458147030965c42ad42968ddf748c63c0dc1cce9d12027cc52b01b04682a7dac1
|
|
7
|
+
data.tar.gz: fbaff2d124dbf48aeea3800e5df2ade96be4527830d4264caa13f3f387a43c3b9b1ca4f3d66281ababb0547e38cd2a3aa4a50c96dc82dc55808ac31b5a10594d
|
data/README.md
CHANGED
|
@@ -64,7 +64,7 @@ The generator creates:
|
|
|
64
64
|
| `app/controllers/rails_markup_auth_controller.rb` | Auth controller |
|
|
65
65
|
| `bin/markup` | CLI wrapper |
|
|
66
66
|
| Route mount | Engine at `/admin/annotations` |
|
|
67
|
-
| Toolbar injection |
|
|
67
|
+
| Toolbar injection | Admin-gated `render "rails_markup/shared/toolbar"` in your layout |
|
|
68
68
|
|
|
69
69
|
### Generator options
|
|
70
70
|
|
|
@@ -83,6 +83,12 @@ customize `authorize_rails_markup!` if your host uses another authorization
|
|
|
83
83
|
policy. The configured base controller must actually enforce authorization.
|
|
84
84
|
Choosing a public controller makes both interfaces public.
|
|
85
85
|
|
|
86
|
+
The install generator injects the toolbar behind an admin gate
|
|
87
|
+
(`current_user.admin?`) rather than rendering it unconditionally, so the FAB and
|
|
88
|
+
toolbar chrome only appear for the same users the dashboard/API authorize. If
|
|
89
|
+
your app authorizes annotators differently, adjust that gate in your layout to
|
|
90
|
+
match `authorize_rails_markup!`.
|
|
91
|
+
|
|
86
92
|
The toolbar uses the same host authentication boundary as the dashboard and
|
|
87
93
|
sends normal Rails CSRF tokens on every mutation. Keep `csrf_meta_tags` in the
|
|
88
94
|
host layout. Rails is authoritative; localStorage is an offline cache and a
|
|
@@ -159,8 +159,9 @@
|
|
|
159
159
|
.rm-popup { display:none; position:fixed; z-index:9982; width:360px; max-width:calc(100vw - 24px); background:rgba(255,255,255,0.95); backdrop-filter:blur(12px); border-radius:16px; box-shadow:0 25px 50px rgba(0,0,0,0.1); border:1px solid rgba(229,231,235,0.8); padding:16px; }
|
|
160
160
|
.rm-popup textarea { width:100%; font-size:13px; border:1px solid #e5e7eb; border-radius:12px; padding:12px; resize:none; outline:none; font-family:inherit; transition:border-color 0.15s,box-shadow 0.15s; }
|
|
161
161
|
.rm-popup textarea:focus { border-color:#818cf8; box-shadow:0 0 0 3px rgba(99,102,241,0.1); }
|
|
162
|
-
.rm-popup select { font-size:11px; font-weight:500; border:1px solid #e5e7eb; border-radius:8px; padding:6px 24px 6px 8px; background:#fff; appearance:none; cursor:pointer; }
|
|
163
|
-
.rm-popup select:focus { outline:none; border
|
|
162
|
+
#rm-toolbar-root .rm-popup select { font-size:11px; font-weight:500; line-height:1.4; color:#374151; height:auto; margin:0; border:1px solid #e5e7eb; border-top:1px solid #e5e7eb; border-right:1px solid #e5e7eb; border-bottom:1px solid #e5e7eb; border-left:1px solid #e5e7eb; border-radius:8px; padding:6px 24px 6px 8px; background:#fff; background-image:none; box-shadow:none; outline:none; text-transform:none; appearance:none; -webkit-appearance:none; -moz-appearance:none; cursor:pointer; }
|
|
163
|
+
#rm-toolbar-root .rm-popup select:focus { outline:none; border:1px solid #818cf8; box-shadow:0 0 0 3px rgba(99,102,241,0.1); }
|
|
164
|
+
#rm-toolbar-root .rm-popup select:hover { border:1px solid #d1d5db; background:#fff; }
|
|
164
165
|
.rm-popup-el { font-size:11px; color:#9ca3af; font-family:monospace; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; line-height:1.4; }
|
|
165
166
|
.rm-popup-text { font-size:12px; color:#6b7280; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; margin-top:2px; line-height:1.4; }
|
|
166
167
|
.rm-popup-actions { display:flex; align-items:center; gap:8px; margin-top:8px; }
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
2
|
# frozen_string_literal: true
|
|
3
3
|
|
|
4
|
+
# Set up Bundler so the gem's lib path is on $LOAD_PATH. This matters when
|
|
5
|
+
# rails-markup is installed from a git source, where its files live outside
|
|
6
|
+
# Ruby's default load path until bundler/setup runs.
|
|
7
|
+
require "bundler/setup"
|
|
4
8
|
require "rails_markup/cli"
|
|
5
9
|
RailsMarkup::Cli.start(ARGV)
|
|
@@ -58,9 +58,14 @@ module RailsMarkup
|
|
|
58
58
|
return
|
|
59
59
|
end
|
|
60
60
|
|
|
61
|
+
# Gate the toolbar on the same authorization contract as the engine's
|
|
62
|
+
# auth controller (current_user.admin?), not merely on the partial
|
|
63
|
+
# existing — otherwise the FAB/toolbar chrome ships to every visitor,
|
|
64
|
+
# including logged-out and non-admin users. Adjust this condition if
|
|
65
|
+
# your app authorizes annotators differently.
|
|
61
66
|
toolbar_block = <<~ERB.indent(4)
|
|
62
|
-
<%# Rails Markup annotation toolbar %>
|
|
63
|
-
<% if
|
|
67
|
+
<%# Rails Markup annotation toolbar (admins only) %>
|
|
68
|
+
<% if respond_to?(:current_user) && current_user.respond_to?(:admin?) && current_user.admin? %>
|
|
64
69
|
<%= render "rails_markup/shared/toolbar" %>
|
|
65
70
|
<% end %>
|
|
66
71
|
ERB
|
|
@@ -87,7 +92,11 @@ module RailsMarkup
|
|
|
87
92
|
say_status :skip, "Procfile.dev already uses bin/markup server", :yellow
|
|
88
93
|
end
|
|
89
94
|
else
|
|
90
|
-
|
|
95
|
+
# Ensure the existing content ends with a newline so the markup
|
|
96
|
+
# process starts on its own line even when Procfile.dev has no
|
|
97
|
+
# trailing newline (otherwise it glues onto the last process).
|
|
98
|
+
leading = content.empty? || content.end_with?("\n") ? "" : "\n"
|
|
99
|
+
append_to_file "Procfile.dev", "#{leading}markup: bin/markup server\n"
|
|
91
100
|
say_status :append, "Procfile.dev (added markup server)", :green
|
|
92
101
|
end
|
|
93
102
|
end
|
data/lib/rails_markup/version.rb
CHANGED