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

specify devise authentication per controller #57

Merged
merged 1 commit into from
Oct 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions app/assets/stylesheets/application.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
$primary: #215d91;
$half: lighten( $primary, 60% );
@import "bootstrap";

kbd {
Expand All @@ -24,3 +26,12 @@ kbd {
width: 100%;
word-wrap: break-word;
}

main {
margin-bottom: 5em;
}

footer {
background: $half;
}

1 change: 1 addition & 0 deletions app/controllers/aces/inbound_transfers_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
module Aces
# Transfers from an outside source coming into Enroll
class InboundTransfersController < ActionController::Base
before_action :authenticate_user!
def show
@transfer = Aces::InboundTransfer.find(params[:id])
@failure_status = @transfer.failure.nil?
Expand Down
1 change: 1 addition & 0 deletions app/controllers/aces/transfers_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
module Aces
# Transfers from Enroll to outside agency
class TransfersController < ActionController::Base
before_action :authenticate_user!
def show
@transfer = Aces::Transfer.find(params[:id])
@failure_status = @transfer.failure.nil?
Expand Down
1 change: 0 additions & 1 deletion app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# frozen_string_literal: true

class ApplicationController < ActionController::Base
before_action :authenticate_user!
end
1 change: 1 addition & 0 deletions app/controllers/reports_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

# ReportsController provides API access to reports
class ReportsController < ApplicationController
before_action :authenticate_user!

def events
@start_on = start_on || session[:start] || Date.today
Expand Down
4 changes: 2 additions & 2 deletions app/views/devise/sessions/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
</div>
<% end %>

<div class="actions">
<%= f.submit "Log in" %>
<div class="actions mb-3">
<%= f.submit "Log in", class: 'btn btn-primary mt-3' %>
</div>
<% end %>

Expand Down
16 changes: 7 additions & 9 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</head>

<body>
<header class="navbar navbar-expand-lg navbar-dark bg-dark mb-3">
<header class="navbar navbar-expand-lg navbar-dark bg-primary mb-3">
<nav class="container">
<div class="" id="navbarSupportedContent">
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
Expand Down Expand Up @@ -42,7 +42,7 @@
<a class="nav-link" href="/reports/mec_checks">MEC Checks</a>
</li>
<% end %>
<% end %>
<% end %>
</ul>
</div>
</nav>
Expand All @@ -60,12 +60,10 @@
<% end %>
<%= yield %>
</main>

<% if user_signed_in? %>
<footer class="container border-top mt-3 p-1 d-flex justify-content-center">
<%= button_to "logout", destroy_user_session_path, method: :delete, class: 'btn btn-dark' %>
</footer>
<% end %>

<footer class="footer border-top border-primary mt-3 p-2 fixed-bottom">
<div class="container">
<%= button_to "logout", destroy_user_session_path, method: :delete, class: 'btn btn-secondary' if user_signed_in? %>
</div>
</footer>
</body>
</html>
4 changes: 3 additions & 1 deletion app/views/reports/_date_range.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<div class="mt-2 mb-3">
<label for="start_on">Start On:</label>
<input type="date" id="start_on" name="start_on" value="<%= @start_on %>" data-session="<%= session_name %>start" data-controller="report" data-action="report#change_date">
<label for="end_on" class="ms-2">End On:</label>
<input type="date" id="end_on" name="end_on" value="<%= @end_on %>" data-session="<%= session_name %>end" data-controller="report" data-action="report#change_date"></input>
<p class="d-inline ms-1"><%= "as of #{Time.current.to_formatted_s(:time)} UTC" if @end_on.today? %></p>
<p class="d-inline ms-1"><%= "as of #{Time.current.to_formatted_s(:time)} UTC" if @end_on.today? %></p>
</div>