Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow customization of application name in the generated title #13

Conversation

nanafox
Copy link
Contributor

@nanafox nanafox commented Jan 27, 2025

This pull request includes changes to improve the flexibility and functionality of methods in the lib/plutonium directory. The most important changes include modifying the make_page_title method to accept an optional app_name parameter and simplifying the submit_button method by removing redundant parameters.

Improvements to method parameters:

  • lib/plutonium/core/controller.rb: Modified the make_page_title method to accept an optional app_name parameter, allowing more flexibility in setting the page title.

Code simplification:

This update fixes the `Style/SuperArgument` error from `standardrb`
This update allows users to now pass a custom name instead of using the
default value, i.e., the application from `Rails.application.name`.
@nanafox
Copy link
Contributor Author

nanafox commented Jan 27, 2025

Here's an example of usage.

image

Copy link
Contributor

@thedumbtechguy thedumbtechguy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this!
Great addition. I have some feedback.

@@ -29,8 +29,8 @@ def set_page_title(page_title)
@page_title = page_title
end

def make_page_title(title)
[title.presence, helpers.application_name].compact.join(" | ")
def make_page_title(title, app_name: helpers.application_name)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would add an app_name method that defaults to helpers.application_name and remove the app_name param from make_page_title altogether.

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

      def app_name
        helpers.application_name
      end

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is much cleaner. We should have this instead.

Copy link
Contributor

@thedumbtechguy thedumbtechguy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fantastic! Thanks.

@thedumbtechguy thedumbtechguy changed the title Allow make_page_title to Accept An Optional app_name Parameter allow customization of application name in the generated title Feb 2, 2025
@thedumbtechguy thedumbtechguy merged commit 488e6c8 into radioactive-labs:master Feb 2, 2025
1 check failed
@nanafox nanafox deleted the feature/custom_app_name_for_title branch February 2, 2025 12:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants