Skip to content

Commit

Permalink
set titles in controllers
Browse files Browse the repository at this point in the history
git status
  • Loading branch information
timcowlishaw committed Oct 29, 2024
1 parent 740fe9f commit acc462a
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 7 deletions.
2 changes: 2 additions & 0 deletions app/controllers/ui/sessions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ class SessionsController < ApplicationController
require 'net/https'

def new
@title = "Welcome!"
redirect_to ui_users_url if current_user
end

Expand Down Expand Up @@ -49,6 +50,7 @@ def reset_password_email
end

def password_reset_landing
@title = "Change password"
@token = params[:token]
end

Expand Down
1 change: 1 addition & 0 deletions app/controllers/ui/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ module Ui
class UsersController < ApplicationController
include SharedControllerMethods
def index
@title = "User information"
end
end
end
5 changes: 4 additions & 1 deletion app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<title>SmartCitizen Platform</title>
<title><%= ["SmartCitizen Platform", @title].compact.join(" – ") %></title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
Expand All @@ -11,6 +11,9 @@
<body>
<%= render partial: "layouts/flashes" %>
<div class="container bg-white mt-5 px-4 pb-4 pt-3">
<% if @title %>
<h1 class="mb-4"><%= @title %></h1>
<% end %>
<%= yield %>
</div>
</body>
Expand Down
2 changes: 0 additions & 2 deletions app/views/ui/sessions/new.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
<h2>Welcome!</h2>

<%= bootstrap_form_tag url: ui_sessions_path do |f| %>
<%= f.text_field :username_or_email, value: params[:username_or_email], autofocus: params[:username_or_email].blank? %>
<%= f.password_field :password %>
Expand Down
2 changes: 0 additions & 2 deletions app/views/ui/sessions/password_reset_landing.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
<h2>Change password</h2>

<%= bootstrap_form_tag url: ui_change_password_path do |f| %>
<%= f.hidden_field :token, value: @token %>
<%= f.password_field :password %>
Expand Down
2 changes: 0 additions & 2 deletions app/views/ui/users/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
<h2>User information</h2>

<% if current_user %>
<p>Logged in as <%= current_user.email %>. </p>
<p>Your access token:
Expand Down

0 comments on commit acc462a

Please sign in to comment.