Skip to content

Commit

Permalink
allow customization of application name in the generated title (#13)
Browse files Browse the repository at this point in the history
* chore: Remove arguments as the signature is identical

This update fixes the `Style/SuperArgument` error from `standardrb`

* feat: Add `app_name` parameter to allow custom names for titles

This update allows users to now pass a custom name instead of using the
default value, i.e., the application from `Rails.application.name`.

* refactor: Extra `app_name` into a separate method #13

* chore: Remove `app_name` docs and format with standard
  • Loading branch information
nanafox authored Feb 2, 2025
1 parent a32a03f commit 488e6c8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions lib/plutonium/core/controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ module Controller
end

helper Plutonium::Helpers
helper_method :make_page_title, :resource_url_for, :resource_url_args_for, :root_path
helper_method :make_page_title, :resource_url_for,
:resource_url_args_for, :root_path, :app_name

append_view_path File.expand_path("app/views", Plutonium.root)
layout -> { turbo_frame_request? ? false : "resource" }
Expand All @@ -30,7 +31,11 @@ def set_page_title(page_title)
end

def make_page_title(title)
[title.presence, helpers.application_name].compact.join(" | ")
[title.presence, app_name].compact.join(" | ")
end

def app_name
helpers.application_name
end

#
Expand Down
2 changes: 1 addition & 1 deletion lib/plutonium/ui/form/interaction.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def initialize_attributes
end

def submit_button(*, **)
super(*, **) do
super do
object.label
end
end
Expand Down

0 comments on commit 488e6c8

Please sign in to comment.