-
Notifications
You must be signed in to change notification settings - Fork 0
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
Add button_to execute :read task #26
Conversation
def execute_read_task | ||
system('rake read') | ||
redirect_to root_path |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about using the redirect back option: https://api.rubyonrails.org/classes/ActionController/Redirecting.html#method-i-redirect_back_or_to
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not quite sure which controller is best for this action, but we don't have much information at this stage - so this should be fine.
@@ -15,6 +15,10 @@ | |||
<a class="inline-block border rounded py-1 px-3" href="/?domain=UpgradeJS.com">UpgradeJS Links</a> | |||
</li> | |||
|
|||
<li class="mr-3"> | |||
<%= button_to "Execute 'Read' task", execute_read_task_path, class: "inline-block border rounded py-1 px-3", method: :post %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about we use the disable_with
data option to disable the button after it is clicked?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
disable_with won't work as expected, because the redirect will reload the page.
def execute_read_task | ||
system('rake read') | ||
redirect_back_or_to root_path |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be the last line of the method?
@@ -15,6 +15,10 @@ | |||
<a class="inline-block border rounded py-1 px-3" href="/?domain=UpgradeJS.com">UpgradeJS Links</a> | |||
</li> | |||
|
|||
<li class="mr-3"> | |||
<%= button_to "Run 'Sitemap' task", execute_read_task_path, class: "inline-block border rounded py-1 px-3", method: :post %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<%= button_to "Run 'Sitemap' task", execute_read_task_path, class: "inline-block border rounded py-1 px-3", method: :post %> | |
<%= button_to "Refresh List", execute_read_task_path, class: "inline-block border rounded py-1 px-3", method: :post %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hmdros looks good, QA passed, but let's change the button title if you agree(I left a suggestion). Other then that, great job!
Using redirect_back_or_to to redirect after read task completed successfully. See: #22
dead939
to
6743fbf
Compare
Attending to issue #22, this PR aims to add a button on navigation bar to trigger :read task and sync Sitemap links.