-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #684 from bitzesty/main
Staging release
- Loading branch information
Showing
8 changed files
with
362 additions
and
247 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -9,6 +9,7 @@ rspec.watchr | |
.pgpass | ||
certs/* | ||
.env | ||
.env.development.local | ||
.history/ | ||
|
||
*.swp | ||
|
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 |
---|---|---|
@@ -1 +1,2 @@ | ||
ruby 3.2.3 | ||
nodejs 16.14.0 |
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 |
---|---|---|
@@ -1,11 +1,43 @@ | ||
class LieutenantSearch < Search | ||
DEFAULT_SEARCH = { | ||
sort: "full_name" | ||
sort: "full_name", | ||
search_filter: {} | ||
} | ||
|
||
include FullNameSort | ||
|
||
def filter_by_assigned_ceremonial_county(scoped_results, value) | ||
value = value.map do |v| | ||
v == "not_assigned" ? nil : v | ||
end | ||
scoped_results.where(ceremonial_county_id: value) | ||
end | ||
|
||
def sort_by_ceremonial_county_name(scoped_results, desc = false) | ||
scoped_results.joins(:ceremonial_county).order("ceremonial_counties.name #{sort_order(desc)}") | ||
end | ||
|
||
class << self | ||
def ceremonial_county_options | ||
collection_mapping(county_options) | ||
end | ||
|
||
private | ||
|
||
def collection_mapping(options) | ||
options.map do |k, v| | ||
[v[:label], k] | ||
end | ||
end | ||
|
||
def county_options | ||
options = Hash[not_assigned: { label: "Not assigned" }] | ||
|
||
CeremonialCounty.ordered.collect do |county| | ||
options[county.id] = { label: county.name } | ||
end | ||
|
||
options | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
.dashboard | ||
h1.govuk-heading-xl | ||
| Users | ||
= simple_form_for @search, url: "#", method: :get, as: :search, html: { class: "search-form" } do |f| | ||
= render 'admin/users/navigation' do | ||
.govuk-tabs__panel | ||
.govuk-grid-row | ||
p.govuk-body-l.govuk-grid-column-two-thirds class="govuk-!-font-weight-bold" | ||
| Search Lieutenancy office users | ||
.govuk-grid-row | ||
.govuk-grid-column-one-third | ||
.form-group.search-input | ||
= f.input :query, label: "Name", input_html: { type: "search" } | ||
.govuk-grid-column-two-third | ||
.form-group.search-input | ||
= f.simple_fields_for [:filters, @search.filters] do |g| | ||
= render "shared/form_answers/filters/assigned_lieutenancy_filter", g: g, options: LieutenantSearch.ceremonial_county_options | ||
.govuk-button-group | ||
= f.submit "Search", class: 'govuk-button' | ||
= link_to "Clear search", | ||
[:admin, controller_name.to_sym], | ||
class: "govuk-button govuk-button--secondary", | ||
role: "button", | ||
aria: { label: "Clear search" } | ||
.govuk-grid-row | ||
= render "shared/users/search_count" | ||
.govuk-button-group | ||
- if action_name == "deleted" | ||
= link_to "Show active users", | ||
admin_lieutenants_path, | ||
class: "new-user govuk-button pull-right", | ||
role: "button", | ||
aria: { label: "Show active users" } | ||
|
||
- else | ||
= link_to "Show deleted users", | ||
deleted_admin_lieutenants_path, | ||
class: "new-user govuk-button pull-right", | ||
role: "button", | ||
aria: { label: "Show deleted users" } | ||
|
||
= link_to public_send("new_admin_#{controller_name.singularize}_path", search: params[:search], page: params[:page]), class: 'new-user govuk-button pull-right', role: 'button' do | ||
= t("admin.users.new_button.#{controller_name}") | ||
.clear | ||
|
||
= render 'list', resources: @resources, f: f | ||
|
||
.govuk-grid-row | ||
.col-xs-12.text-right | ||
= paginate @resources | ||
.clear |
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 |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
unless Admin.exists? | ||
admin_args = { | ||
email: "[email protected]", | ||
password: SecureRandom.alphanumeric(12), | ||
password: SecureRandom.alphanumeric(14), | ||
first_name: "First name", | ||
last_name: "Last name", | ||
confirmed_at: DateTime.now | ||
|
@@ -17,7 +17,7 @@ | |
assessor_args = { | ||
email: "[email protected]", | ||
sub_group: "sub_group_1", | ||
password: SecureRandom.alphanumeric(12), | ||
password: SecureRandom.alphanumeric(14), | ||
first_name: "First name", | ||
last_name: "Last name", | ||
confirmed_at: DateTime.now | ||
|
Oops, something went wrong.