Skip to content

Commit

Permalink
Merge pull request #26 from fastruby/22-add-a-button-to-run-the-sitem…
Browse files Browse the repository at this point in the history
…ap-reader-job

Add button_to execute :read task
  • Loading branch information
fbuys authored Oct 4, 2023
2 parents d8f2021 + 6743fbf commit 43d91e8
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,7 @@ PLATFORMS
aarch64-linux
x86_64-darwin-20
x86_64-darwin-21
x86_64-darwin-22
x86_64-linux

DEPENDENCIES
Expand Down
8 changes: 7 additions & 1 deletion app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
class ApplicationController < ActionController::Base
before_action :authenticate_user!
end

def execute_read_task
system('rake read')
flash[:notice] = "Read task executed!"
redirect_back_or_to root_path
end
end
4 changes: 4 additions & 0 deletions app/views/shared/_navigation_bar.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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 "Refresh List", execute_read_task_path, class: "inline-block border rounded py-1 px-3", method: :post %>
</li>

<li class="mr-3 ml-auto flex items-center">
<span><%= current_user.email %></span>
<%= button_to "Sign out", ombu_labs_auth.destroy_user_session_path, method: :delete, class: "inline-block border rounded py-1 px-3" %>
Expand Down
1 change: 1 addition & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
resources :shares
get '/shares/:id/clone', to: 'shares#clone', as: "clone"
end
post 'execute_read_task', to: 'application#execute_read_task'

mount OmbuLabs::Auth::Engine, at: '/', as: 'ombu_labs_auth'
end

0 comments on commit 43d91e8

Please sign in to comment.