Skip to content

Commit

Permalink
Librarian-22 - Add button_to execute :read task
Browse files Browse the repository at this point in the history
  • Loading branch information
hmdros committed Oct 3, 2023
1 parent d8f2021 commit 9d91c8c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
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')
redirect_to root_path
flash[:notice] = "Read task executed!"
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 "Execute 'Read' task", 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 9d91c8c

Please sign in to comment.