Class: RailsMarkup::Configuration
- Inherits:
-
Object
- Object
- RailsMarkup::Configuration
- Defined in:
- lib/rails_markup/configuration.rb
Constant Summary collapse
- ALLOWED_ACCENTS =
%w[indigo amber blue emerald rose].freeze
- ALLOWED_POSITIONS =
%w[tl tr br bl].freeze
- ALLOWED_SIZES =
%w[slim compact default].freeze
Instance Attribute Summary collapse
-
#api_token ⇒ Object
Bearer token for the external API (MCP production tools).
-
#author_name_method ⇒ Object
Method name (Symbol) or Proc to resolve the author's display name from the current_user.
-
#base_controller_class ⇒ Object
Base controller class name for dashboard/API controllers.
-
#dashboard_layout ⇒ Object
Layout for the dashboard views.
-
#enable_screenshots ⇒ Object
Enable element screenshot capture in the toolbar.
-
#fab_visible ⇒ Object
Show the floating action button (FAB) specifically.
-
#health_interval ⇒ Object
Health check poll interval in seconds.
-
#on_create_callback ⇒ Object
Proc called after an annotation is created.
-
#per_page ⇒ Object
Number of annotations per page on the dashboard.
-
#return_url ⇒ Object
URL path for "Back to app" link in the dashboard header.
-
#table_name ⇒ Object
Database table name for annotations.
-
#toolbar_accent ⇒ Object
Accent color for the toolbar FAB and UI elements.
-
#toolbar_enabled ⇒ Object
Render the annotation toolbar system at all (FAB, panel, pins, sync).
-
#toolbar_position ⇒ Object
FAB button position: "bl" (bottom-left), "br" (bottom-right), "tl" (top-left), "tr" (top-right).
-
#toolbar_size ⇒ Object
FAB button size: "default" (48px), "compact" (40px), "slim" (32px).
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #resolve_author_name(user) ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/rails_markup/configuration.rb', line 77 def initialize @base_controller_class = "RailsMarkup::ApplicationController" @api_token = nil @table_name = "rails_markup_annotations" @per_page = 25 @toolbar_accent = "indigo" @toolbar_enabled = true @fab_visible = true @toolbar_position = "bl" @toolbar_size = "default" @return_url = nil @dashboard_layout = "rails_markup/application" @author_name_method = :email @on_create_callback = nil @enable_screenshots = true @health_interval = 60 end |
Instance Attribute Details
#api_token ⇒ Object
Bearer token for the external API (MCP production tools). Set to nil to disable external API.
16 17 18 |
# File 'lib/rails_markup/configuration.rb', line 16 def api_token @api_token end |
#author_name_method ⇒ Object
Method name (Symbol) or Proc to resolve the author's display name from the current_user. Symbol: calls user.public_send(method_name) — e.g. :name, :email, :display_name Proc: receives user, returns string — e.g. ->(u) { u.full_name } Default: :email
54 55 56 |
# File 'lib/rails_markup/configuration.rb', line 54 def @author_name_method end |
#base_controller_class ⇒ Object
Base controller class name for dashboard/API controllers. Set to a controller that provides authentication. Example: "AdminAuthController"
12 13 14 |
# File 'lib/rails_markup/configuration.rb', line 12 def base_controller_class @base_controller_class end |
#dashboard_layout ⇒ Object
Layout for the dashboard views. Set to a host app layout name to embed within that layout. Default: "rails_markup/application" (engine's own layout) Example: "admin"
45 46 47 |
# File 'lib/rails_markup/configuration.rb', line 45 def dashboard_layout @dashboard_layout end |
#enable_screenshots ⇒ Object
Enable element screenshot capture in the toolbar. Default: true
63 64 65 |
# File 'lib/rails_markup/configuration.rb', line 63 def enable_screenshots @enable_screenshots end |
#fab_visible ⇒ Object
Show the floating action button (FAB) specifically. When false, the FAB is hidden but the toolbar system stays active — pins still render and the panel is reachable via its toggle. Use when the host provides its own trigger or wants read-only pins. Requires toolbar_enabled. Default: true
34 35 36 |
# File 'lib/rails_markup/configuration.rb', line 34 def fab_visible @fab_visible end |
#health_interval ⇒ Object
Health check poll interval in seconds. Default: 60
75 76 77 |
# File 'lib/rails_markup/configuration.rb', line 75 def health_interval @health_interval end |
#on_create_callback ⇒ Object
Proc called after an annotation is created. Receives the annotation record. Use for email/Slack/webhook notifications. Default: nil (no callback)
59 60 61 |
# File 'lib/rails_markup/configuration.rb', line 59 def on_create_callback @on_create_callback end |
#per_page ⇒ Object
Number of annotations per page on the dashboard.
48 49 50 |
# File 'lib/rails_markup/configuration.rb', line 48 def per_page @per_page end |
#return_url ⇒ Object
URL path for "Back to app" link in the dashboard header. Set to nil to hide the link. Example: "/admin"
39 40 41 |
# File 'lib/rails_markup/configuration.rb', line 39 def return_url @return_url end |
#table_name ⇒ Object
Database table name for annotations.
19 20 21 |
# File 'lib/rails_markup/configuration.rb', line 19 def table_name @table_name end |
#toolbar_accent ⇒ Object
Accent color for the toolbar FAB and UI elements.
22 23 24 |
# File 'lib/rails_markup/configuration.rb', line 22 def @toolbar_accent end |
#toolbar_enabled ⇒ Object
Render the annotation toolbar system at all (FAB, panel, pins, sync). Set to false to disable rails-markup entirely for a request/environment. Default: true
27 28 29 |
# File 'lib/rails_markup/configuration.rb', line 27 def @toolbar_enabled end |
#toolbar_position ⇒ Object
FAB button position: "bl" (bottom-left), "br" (bottom-right), "tl" (top-left), "tr" (top-right). Default: "bl"
67 68 69 |
# File 'lib/rails_markup/configuration.rb', line 67 def @toolbar_position end |
#toolbar_size ⇒ Object
FAB button size: "default" (48px), "compact" (40px), "slim" (32px). Default: "default"
71 72 73 |
# File 'lib/rails_markup/configuration.rb', line 71 def @toolbar_size end |
Instance Method Details
#resolve_author_name(user) ⇒ Object
95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/rails_markup/configuration.rb', line 95 def (user) return nil unless user case when Symbol then user.respond_to?() ? user.public_send() : nil when Proc then .call(user) end rescue => e Rails.logger.warn("[rails-markup] author_name_method error: #{e.}") if defined?(Rails) nil end |