<%= highlight(account.description, params.dig(:q, :name_or_description_cont)) %>
diff --git a/app/views/accounts/_form.html.erb b/app/views/accounts/_form.html.erb
index 54660a3f..7871acee 100644
--- a/app/views/accounts/_form.html.erb
+++ b/app/views/accounts/_form.html.erb
@@ -1,81 +1,92 @@
-<%= form_for(@account, role: 'form', html: { class: 'form-horizontal record-form space-y-6' }) do |f| %>
- <%#= form_header(@account) %>
+
+ <%= form_for(account, html: { role: 'form' }) do |form| %>
+ <%= render 'form_header', record: account %>
+ <%= render 'form_body' do %>
+ <%= render 'section' do %>
+ <%= render 'section_header', title: 'Overview', subtitle: 'General settings this account.' %>
+ <%= render 'section_body' do %>
+
+ <%= form.label :name %>
+
+ <%=
+ form.text_field(:name, placeholder: 'Account name', autofocus: true, required: true)
+ %>
+
+
-
- <%= f.label :name, class: 'w-1/3 text-right pr-4' %>
-
- <%= f.text_field :name %>
-
-
+
+ <%= form.label :description %>
+
+ <%= form.text_area :description %>
+
+
-
- <%= f.label :description, class: 'w-1/3 text-right pr-4' %>
-
- <%= f.text_area :description %>
-
-
+ <% end %>
+ <% end %>
-
- <%= f.label :welcome_message, class: 'w-1/3 text-right pr-4' %>
-
- <%= f.text_area :welcome_message %>
-
-
+ <%= render 'section' do %>
+ <%= render 'section_header', title: 'Status', subtitle: 'Activation and expiration settings for this account' %>
+ <%= render 'section_body' do %>
+ <% if policy(@account).update_protected_attributes? %>
+
+ <%= form.label :deactivated %>
+
+ <%= form.checkbox :deactivated %>
+
+
- <% if policy(@account).update_protected_attributes? %>
-
- <%= f.label :expires_on, class: 'w-1/3 text-right pr-4' %>
-
- <%= f.text_field :expires_on, class: 'form-input block w-full', data: { behaviour: "datepicker" } %>
-
-
+
+ <%= form.label :expires_on %>
+
+ <%= form.date_field :expires_on %>
+
+
-
- <%= f.label :expiry_warning_sent_on, class: 'w-1/3 text-right pr-4' %>
-
- <%= f.text_field :expiry_warning_sent_on, class: 'form-input block w-full', readonly: true %>
-
-
+
+ <%= form.label :expiry_warning_sent_on %>
+
+ <%= form.date_field :expiry_warning_sent_on, readonly: true, disabled: true %>
+
+
+ <% end %>
+ <% end %>
+ <% end %>
-
- <%= f.label :max_users, class: 'w-1/3 text-right pr-4' %>
-
- <%= f.text_field :max_users, class: 'form-input block w-full' %>
-
-
+ <%= render 'section' do %>
+ <%= render 'section_header', title: 'Restrictions', subtitle: 'Limits to number of team members and impact cards' %>
+ <%= render 'section_body' do %>
+ <% if policy(@account).update_protected_attributes? %>
+
+ <%= form.label :max_users, "Max team members" %>
+
+ <%= form.number_field :max_users, min: 0 %>
+
+
Set to zero (0) to indicate unlimited team members.
+
-
- <%= f.label :max_scorecards, "Max #{Scorecard.model_name.human.pluralize.downcase}", class: 'w-1/3 text-right pr-4' %>
-
- <%= f.text_field :max_scorecards, class: 'form-input block w-full' %>
-
-
+
+ <%= form.label :max_scorecards, 'Max impact ards' %>
+
+ <%= form.number_field :max_scorecards, min: 0 %>
+
+
Set to zero (0) to indicate unlimited impact cards.
+
+ <% end %>
+ <% end %>
+ <% end %>
-
-
- <%= label :solution_ecosystem_maps, 'Solution Ecosystem Map?' %>
-
-
- <%= f.check_box :solution_ecosystem_maps, class: 'form-checkbox' %>
-
-
-
-
-
- Allow Transition Cards?
-
-
- <%= f.check_box :allow_transition_cards, class: 'form-checkbox' %>
-
-
-
-
-
- Allow SDG Goal Alignment Cards?
-
-
- <%= f.check_box :allow_sustainable_development_goal_alignment_cards, class: 'form-checkbox' %>
-
-
+ <%= render 'section' do %>
+ <%= render 'section_header', title: 'Other Settings' %>
+ <%= render 'section_body' do %>
+
+ <%= form.label :classic_grid_mode %>
+
+ <%= form.checkbox :classic_grid_mode %>
+
+
+ <% end %>
+ <% end %>
+ <%= render 'form_buttons', form:, cancel_path: account.persisted? ? account_path(account) : accounts_path %>
+ <% end %>
<% end %>
-<% end %>
+
diff --git a/app/views/accounts/_form.html.erb.old b/app/views/accounts/_form.html.erb.old
new file mode 100644
index 00000000..74b2a268
--- /dev/null
+++ b/app/views/accounts/_form.html.erb.old
@@ -0,0 +1,74 @@
+<%= form_for(@account, role: 'form', html: { class: 'form-horizontal record-form space-y-6' }) do |f| %>
+ <%#= form_header(@account) %>
+
+
+ <%= f.label :name, class: 'w-1/3 text-right pr-4' %>
+
+ <%= f.text_field :name %>
+
+
+
+
+ <%= f.label :description, class: 'w-1/3 text-right pr-4' %>
+
+ <%= f.text_area :description %>
+
+
+
+ <% if policy(@account).update_protected_attributes? %>
+
+ <%= f.label :expires_on, class: 'w-1/3 text-right pr-4' %>
+
+ <%= f.text_field :expires_on, class: 'form-input block w-full', data: { behaviour: "datepicker" } %>
+
+
+
+
+ <%= f.label :expiry_warning_sent_on, class: 'w-1/3 text-right pr-4' %>
+
+ <%= f.text_field :expiry_warning_sent_on, class: 'form-input block w-full', readonly: true %>
+
+
+
+
+ <%= f.label :max_accounts, class: 'w-1/3 text-right pr-4' %>
+
+ <%= f.text_field :max_accounts, class: 'form-input block w-full' %>
+
+
+
+
+ <%= f.label :max_scorecards, "Max #{Scorecard.model_name.human.pluralize.downcase}", class: 'w-1/3 text-right pr-4' %>
+
+ <%= f.text_field :max_scorecards, class: 'form-input block w-full' %>
+
+
+
+
+
+ <%= label :solution_ecosystem_maps, 'Solution Ecosystem Map?' %>
+
+
+ <%= f.check_box :solution_ecosystem_maps, class: 'form-checkbox' %>
+
+
+
+
+
+ Allow Transition Cards?
+
+
+ <%= f.check_box :allow_transition_cards, class: 'form-checkbox' %>
+
+
+
+
+
+ Allow SDG Goal Alignment Cards?
+
+
+ <%= f.check_box :allow_sustainable_development_goal_alignment_cards, class: 'form-checkbox' %>
+
+
+ <% end %>
+<% end %>
diff --git a/app/views/accounts/show.html.erb b/app/views/accounts/show.html.erb
index 100d5fa4..68034694 100644
--- a/app/views/accounts/show.html.erb
+++ b/app/views/accounts/show.html.erb
@@ -1,70 +1,46 @@
-<%= form_for(@account, html: { class: 'space-y-6' }) do |f| %>
- <%= form_header(@account) %>
+
+
+
+ <%= page_header_tag 'Account Details' %>
+
+
+ <%= render partial: 'resource_summary', locals: { name: @account.name, background_color: 'bg-green-700' } %>
+
+
+ <%= @account.name %>
+
+
+ <%= @account.description %>
+
+
+
+
+
+ <%= link_to_primary 'Edit', edit_account_path(@account), class: 'inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500' %>
+
+
+
+
+
+
+ <%= render 'section' do %>
+ <%= render 'section_header', title: 'Account Status' %>
+ <%= render 'section_body' do %>
+
+
+
+
+ Expires On <%= @account.expires_on %>
+ Event Bear Hug: Live in Concert
+ Amount $150.00 USD
+ Amount after exchange rate US$150.00 → CA$199.79
+ Fee $4.79 USD
+ Net $1,955.00
+
+
+
+
+ <% end %>
+ <% end %>
+
-
- <%= f.label :name, class: 'w-1/3 text-right pr-4' %>
-
- <%= f.text_field :name, class: 'form-input block w-full', readonly: true %>
-
-
-
-
- <%= f.label :description, class: 'w-1/3 text-right pr-4' %>
-
- <%= f.text_area :description, class: 'form-textarea block w-full', readonly: true %>
-
-
-
-
- <%= f.label :welcome_message, class: 'w-1/3 text-right pr-4' %>
-
- <%= f.text_area :welcome_message, class: 'form-textarea block w-full', readonly: true %>
-
-
-
-
- <%= f.label :expires_on, class: 'w-1/3 text-right pr-4' %>
-
- <%= f.text_field :expires_on, class: 'form-input block w-full', readonly: true %>
-
-
-
-
- <%= f.label :expiry_warning_sent_on, class: 'w-1/3 text-right pr-4' %>
-
- <%= f.text_field :expiry_warning_sent_on, class: 'form-input block w-full', readonly: true %>
-
-
-
-
- <%= f.label :max_users, class: 'w-1/3 text-right pr-4' %>
-
- <%= f.text_field :max_users, class: 'form-input block w-full', readonly: true %>
-
-
-
-
- <%= f.label :max_scorecards, "Max #{Scorecard.model_name.human.pluralize.downcase}", class: 'w-1/3 text-right pr-4' %>
-
- <%= f.text_field :max_scorecards, class: 'form-input block w-full', readonly: true %>
-
-
-
-
-
- Solution Ecosystem Maps
-
-
- <%= f.check_box :solution_ecosystem_maps, class: 'form-checkbox', onclick: "return false;" %>
-
-
-
-
-
- Allow Transition Cards?
-
-
- <%= f.check_box :allow_transition_cards, class: 'form-checkbox', onclick: "return false;" %>
-
-
-<% end %>
diff --git a/app/views/application/_form_header.html.erb b/app/views/application/_form_header.html.erb
index 97f6c143..f12188ef 100644
--- a/app/views/application/_form_header.html.erb
+++ b/app/views/application/_form_header.html.erb
@@ -1,4 +1,4 @@
- <%= record.persisted? ? "Edit #{record.name}" : "New #{record.model_name.human}" %>
+ <%= record.persisted? ? "Edit #{record.name.presence || record.model_name.human }" : "New #{record.model_name.human}" %>
diff --git a/app/views/checklist_items/_link.html.erb b/app/views/checklist_items/_link.html.erb
index a7d2faa9..fb4fec6e 100644
--- a/app/views/checklist_items/_link.html.erb
+++ b/app/views/checklist_items/_link.html.erb
@@ -1,5 +1,5 @@
-
+
<%=
link_to(
edit_checklist_item_path(checklist_item),
diff --git a/app/views/checklist_items/edit.html.erb b/app/views/checklist_items/edit.html.erb
index fd9c86b6..2929988a 100644
--- a/app/views/checklist_items/edit.html.erb
+++ b/app/views/checklist_items/edit.html.erb
@@ -1,5 +1,5 @@
<%= turbo_frame_tag dom_id(@checklist_item) do %>
-
+
<%= @checklist_item.characteristic.name %>
diff --git a/app/views/impact_cards/_grid.html.erb b/app/views/impact_cards/_grid.html.erb
index fffa8b4a..b8ce25eb 100644
--- a/app/views/impact_cards/_grid.html.erb
+++ b/app/views/impact_cards/_grid.html.erb
@@ -1,6 +1,6 @@
<%= render 'labels/stylesheet', labels: @subsystem_tags %>
-
+
<%= form_with url: impact_card_path(@scorecard), method: :get, data: { grid_target: 'filterForm' } do |form| %>
@@ -26,7 +26,7 @@
<%=
form.multi_select(
:statuses,
- multi_select_options_for_statuses(@statuses, @selected_statuses),
+ multi_select_options_for_statuses(@statuses, @selected_statuses, @scorecard),
{ placeholder: 'Select statuses...' },
{ include_hidden: false, data: { grid_target: "statuses" } }
)
@@ -53,7 +53,7 @@
<%# TODO Move the lookup of the focus area details to @scorecard_grid %>
<%= focus_area_grid_element(grouped_checklist_item_data.first) %>
<%- grouped_checklist_item_data.each do |checklist_item_data| %>
- <%= checklist_list_item_grid_element(checklist_item_data) %>
+ <%= checklist_list_item_grid_element(checklist_item_data:, grid_mode: @scorecard.grid_mode) %>
<% end %>
<% end %>
diff --git a/app/views/organisations/_form.html.erb b/app/views/organisations/_form.html.erb
index a97c9bea..4d824f97 100644
--- a/app/views/organisations/_form.html.erb
+++ b/app/views/organisations/_form.html.erb
@@ -7,8 +7,9 @@
<%= render 'section_body' do %>
<%= form.label :name %>
-
<%= form.text_field(:name, placeholder: 'Stakeholder name', autofocus: true, required: true) %>
-
+
+ <%= form.text_field(:name, placeholder: 'Stakeholder name', autofocus: true, required: true) %>
+
diff --git a/db/data/20250107075016_set_classic_grid_mode_for_existing_accounts.rb b/db/data/20250107075016_set_classic_grid_mode_for_existing_accounts.rb
new file mode 100644
index 00000000..2c808b21
--- /dev/null
+++ b/db/data/20250107075016_set_classic_grid_mode_for_existing_accounts.rb
@@ -0,0 +1,11 @@
+# frozen_string_literal: true
+
+class SetClassicGridModeForExistingAccounts < ActiveRecord::Migration[8.0]
+ def up
+ Account.update_all(classic_grid_mode: true)
+ end
+
+ def down
+ Account.update_all(classic_grid_mode: false)
+ end
+end
diff --git a/db/data_schema.rb b/db/data_schema.rb
index fbd0a10c..c2309bde 100644
--- a/db/data_schema.rb
+++ b/db/data_schema.rb
@@ -1 +1 @@
-DataMigrate::Data.define(version: 20241029104713)
+DataMigrate::Data.define(version: 20250107075016)
diff --git a/db/migrate/20250106064920_add_classic_grid_mode_to_accounts.rb b/db/migrate/20250106064920_add_classic_grid_mode_to_accounts.rb
new file mode 100644
index 00000000..f8043982
--- /dev/null
+++ b/db/migrate/20250106064920_add_classic_grid_mode_to_accounts.rb
@@ -0,0 +1,5 @@
+class AddClassicGridModeToAccounts < ActiveRecord::Migration[8.0]
+ def change
+ add_column :accounts, :classic_grid_mode, :boolean, default: false
+ end
+end
diff --git a/db/migrate/20250106070451_remove_stakeholder_type_id_from_accounts.rb b/db/migrate/20250106070451_remove_stakeholder_type_id_from_accounts.rb
new file mode 100644
index 00000000..4dea7459
--- /dev/null
+++ b/db/migrate/20250106070451_remove_stakeholder_type_id_from_accounts.rb
@@ -0,0 +1,5 @@
+class RemoveStakeholderTypeIdFromAccounts < ActiveRecord::Migration[8.0]
+ def change
+ remove_column :accounts, :stakeholder_type_id, :integer
+ end
+end
diff --git a/db/migrate/20250107024008_deprecate_unused_account_columns.rb b/db/migrate/20250107024008_deprecate_unused_account_columns.rb
new file mode 100644
index 00000000..baa2d30c
--- /dev/null
+++ b/db/migrate/20250107024008_deprecate_unused_account_columns.rb
@@ -0,0 +1,9 @@
+class DeprecateUnusedAccountColumns < ActiveRecord::Migration[8.0]
+ def change
+ rename_column :accounts, :welcome_message, :deprecated_welcome_message
+ rename_column :accounts, :weblink, :deprecated_weblink
+ rename_column :accounts, :allow_sustainable_development_goal_alignment_cards, :deprecated_allow_sustainable_development_goal_alignment_cards
+ rename_column :accounts, :allow_transition_cards, :deprecated_allow_transition_cards
+ rename_column :accounts, :solution_ecosystem_maps, :deprecated_solution_ecosystem_maps
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 8ad259f3..543e0137 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema[8.0].define(version: 2024_12_30_085214) do
+ActiveRecord::Schema[8.0].define(version: 2025_01_07_024008) do
# These are extensions that must be enabled in order to support this database
enable_extension "pg_catalog.plpgsql"
enable_extension "pg_stat_statements"
@@ -19,9 +19,8 @@
create_table "accounts", id: :serial, force: :cascade do |t|
t.string "name"
t.string "description"
- t.string "weblink"
- t.integer "stakeholder_type_id"
- t.text "welcome_message"
+ t.string "deprecated_weblink"
+ t.text "deprecated_welcome_message"
t.boolean "deactivated"
t.datetime "deleted_at", precision: nil
t.datetime "created_at", precision: nil, null: false
@@ -29,9 +28,9 @@
t.date "expires_on"
t.integer "max_users", default: 1
t.integer "max_scorecards", default: 1
- t.boolean "solution_ecosystem_maps"
- t.boolean "allow_transition_cards", default: true
- t.boolean "allow_sustainable_development_goal_alignment_cards", default: false
+ t.boolean "deprecated_solution_ecosystem_maps"
+ t.boolean "deprecated_allow_transition_cards", default: true
+ t.boolean "deprecated_allow_sustainable_development_goal_alignment_cards", default: false
t.date "expiry_warning_sent_on"
t.string "transition_card_model_name", default: "Transition Card"
t.string "transition_card_focus_area_group_model_name", default: "Focus Area Group"
@@ -41,6 +40,7 @@
t.string "sdgs_alignment_card_focus_area_group_model_name", default: "Focus Area Group"
t.string "sdgs_alignment_card_focus_area_model_name", default: "Focus Area"
t.string "sdgs_alignment_card_characteristic_model_name", default: "Targets"
+ t.boolean "classic_grid_mode", default: false
end
create_table "accounts_users", id: :serial, force: :cascade do |t|
diff --git a/spec/factories/accounts.rb b/spec/factories/accounts.rb
index a23a8ea7..c7221991 100644
--- a/spec/factories/accounts.rb
+++ b/spec/factories/accounts.rb
@@ -4,31 +4,31 @@
#
# Table name: accounts
#
-# id :integer not null, primary key
-# allow_sustainable_development_goal_alignment_cards :boolean default(FALSE)
-# allow_transition_cards :boolean default(TRUE)
-# deactivated :boolean
-# deleted_at :datetime
-# description :string
-# expires_on :date
-# expiry_warning_sent_on :date
-# max_scorecards :integer default(1)
-# max_users :integer default(1)
-# name :string
-# sdgs_alignment_card_characteristic_model_name :string default("Targets")
-# sdgs_alignment_card_focus_area_group_model_name :string default("Focus Area Group")
-# sdgs_alignment_card_focus_area_model_name :string default("Focus Area")
-# sdgs_alignment_card_model_name :string default("SDGs Alignment Card")
-# solution_ecosystem_maps :boolean
-# transition_card_characteristic_model_name :string default("Characteristic")
-# transition_card_focus_area_group_model_name :string default("Focus Area Group")
-# transition_card_focus_area_model_name :string default("Focus Area")
-# transition_card_model_name :string default("Transition Card")
-# weblink :string
-# welcome_message :text
-# created_at :datetime not null
-# updated_at :datetime not null
-# stakeholder_type_id :integer
+# id :integer not null, primary key
+# classic_grid_mode :boolean default(FALSE)
+# deactivated :boolean
+# deleted_at :datetime
+# deprecated_allow_sustainable_development_goal_alignment_cards :boolean default(FALSE)
+# deprecated_allow_transition_cards :boolean default(TRUE)
+# deprecated_solution_ecosystem_maps :boolean
+# deprecated_weblink :string
+# deprecated_welcome_message :text
+# description :string
+# expires_on :date
+# expiry_warning_sent_on :date
+# max_scorecards :integer default(1)
+# max_users :integer default(1)
+# name :string
+# sdgs_alignment_card_characteristic_model_name :string default("Targets")
+# sdgs_alignment_card_focus_area_group_model_name :string default("Focus Area Group")
+# sdgs_alignment_card_focus_area_model_name :string default("Focus Area")
+# sdgs_alignment_card_model_name :string default("SDGs Alignment Card")
+# transition_card_characteristic_model_name :string default("Characteristic")
+# transition_card_focus_area_group_model_name :string default("Focus Area Group")
+# transition_card_focus_area_model_name :string default("Focus Area")
+# transition_card_model_name :string default("Transition Card")
+# created_at :datetime not null
+# updated_at :datetime not null
#
FactoryBot.define do
factory :account do
diff --git a/spec/models/account_spec.rb b/spec/models/account_spec.rb
index 27a53524..267561cb 100644
--- a/spec/models/account_spec.rb
+++ b/spec/models/account_spec.rb
@@ -4,31 +4,31 @@
#
# Table name: accounts
#
-# id :integer not null, primary key
-# allow_sustainable_development_goal_alignment_cards :boolean default(FALSE)
-# allow_transition_cards :boolean default(TRUE)
-# deactivated :boolean
-# deleted_at :datetime
-# description :string
-# expires_on :date
-# expiry_warning_sent_on :date
-# max_scorecards :integer default(1)
-# max_users :integer default(1)
-# name :string
-# sdgs_alignment_card_characteristic_model_name :string default("Targets")
-# sdgs_alignment_card_focus_area_group_model_name :string default("Focus Area Group")
-# sdgs_alignment_card_focus_area_model_name :string default("Focus Area")
-# sdgs_alignment_card_model_name :string default("SDGs Alignment Card")
-# solution_ecosystem_maps :boolean
-# transition_card_characteristic_model_name :string default("Characteristic")
-# transition_card_focus_area_group_model_name :string default("Focus Area Group")
-# transition_card_focus_area_model_name :string default("Focus Area")
-# transition_card_model_name :string default("Transition Card")
-# weblink :string
-# welcome_message :text
-# created_at :datetime not null
-# updated_at :datetime not null
-# stakeholder_type_id :integer
+# id :integer not null, primary key
+# classic_grid_mode :boolean default(FALSE)
+# deactivated :boolean
+# deleted_at :datetime
+# deprecated_allow_sustainable_development_goal_alignment_cards :boolean default(FALSE)
+# deprecated_allow_transition_cards :boolean default(TRUE)
+# deprecated_solution_ecosystem_maps :boolean
+# deprecated_weblink :string
+# deprecated_welcome_message :text
+# description :string
+# expires_on :date
+# expiry_warning_sent_on :date
+# max_scorecards :integer default(1)
+# max_users :integer default(1)
+# name :string
+# sdgs_alignment_card_characteristic_model_name :string default("Targets")
+# sdgs_alignment_card_focus_area_group_model_name :string default("Focus Area Group")
+# sdgs_alignment_card_focus_area_model_name :string default("Focus Area")
+# sdgs_alignment_card_model_name :string default("SDGs Alignment Card")
+# transition_card_characteristic_model_name :string default("Characteristic")
+# transition_card_focus_area_group_model_name :string default("Focus Area Group")
+# transition_card_focus_area_model_name :string default("Focus Area")
+# transition_card_model_name :string default("Transition Card")
+# created_at :datetime not null
+# updated_at :datetime not null
#
require 'rails_helper'