generated from DFE-Digital/govuk-rails-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
POC allow registration when service is closed
- Loading branch information
Showing
9 changed files
with
97 additions
and
6 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
app/controllers/admin/closed_registration_users_controller.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
class Admin::ClosedRegistrationUsersController < SuperAdminController | ||
def index | ||
@users = ClosedRegistrationUser.all | ||
@user = ClosedRegistrationUser.new | ||
end | ||
|
||
def new | ||
@user = ClosedRegistrationUser.new | ||
end | ||
|
||
def create | ||
@user = ClosedRegistrationUser.new(params[:closed_registration_user].permit(:email)) | ||
if @user.save | ||
flash[:success] = "New closed registration user created" | ||
redirect_to admin_closed_registration_users_path | ||
else | ||
flash[:error] = "Can not create a user" | ||
render :index | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
class ClosedRegistrationUser < ApplicationRecord | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<div class="govuk-grid-row"> | ||
<div class="govuk-grid-column-full"> | ||
<%= render "admin/layout", title: "Closed registration users" %> | ||
|
||
<h2 class="govuk-heading-l">Add new email</h2> | ||
<%= form_for [:admin, @user] do |f| %> | ||
<%= f.govuk_error_summary %> | ||
<%= f.govuk_text_field :email, legend: { text: 'Provide course start date' } %> | ||
<%= f.govuk_submit "Save" %> | ||
<% end %> | ||
|
||
<h2 class="govuk-heading-l">Currently allowed emails</h2> | ||
|
||
<table class="govuk-table"> | ||
<thead class="govuk-table__head"> | ||
<tr class="govuk-table__row"> | ||
<th scope="col" class="govuk-table__header">User</th> | ||
<th scope="col" class="govuk-table__header">Has account</th> | ||
<th scope="col" class="govuk-table__header">Last application date</th> | ||
</tr> | ||
</thead> | ||
|
||
<tbody class="govuk-table__body"> | ||
<% @users.each do |user| %> | ||
<tr class="govuk-table__row"> | ||
<td class="govuk-table__cell"><%= user.email %></td> | ||
<td class="govuk-table__cell"><%= %></td> | ||
<td class="govuk-table__cell"></td> | ||
</tr> | ||
<% end %> | ||
</tbody> | ||
</table> | ||
|
||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<h1>Admin::LateRegistrants#new</h1> | ||
<p>Find me in app/views/admin/late_registrants/new.html.erb</p> | ||
|
||
<div class="govuk-grid-row"> | ||
<div class="govuk-grid-column-full"> | ||
<%= render "admin/layout", title: "Settings" %> | ||
<%= form_for [:admin, @user] do |f| %> | ||
<%= f.govuk_error_summary %> | ||
<%= f.govuk_text_field :email, legend: { text: 'Provide course start date' } %> | ||
<%= f.govuk_submit "Save" %> | ||
<% end %> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters