From 8ea17f1ed3f5391301ed0529f65a99e8b1a9dbe3 Mon Sep 17 00:00:00 2001 From: Anne Vandervord <72746727+AnneV-Learn@users.noreply.github.com> Date: Sun, 26 Mar 2023 11:30:09 +0100 Subject: [PATCH 1/4] Reason for change modifications Remove requirement for system_administrator and data_manager to enter a Reason for making addition - just default in "Created by 'user role' (userid)" --- app/controllers/freecen2_civil_parishes_controller.rb | 6 ++++++ app/views/freecen2_civil_parishes/new.html.erb | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/app/controllers/freecen2_civil_parishes_controller.rb b/app/controllers/freecen2_civil_parishes_controller.rb index e69205512..a4d27cbd9 100644 --- a/app/controllers/freecen2_civil_parishes_controller.rb +++ b/app/controllers/freecen2_civil_parishes_controller.rb @@ -18,6 +18,12 @@ def create @new_civil_parish_params = Freecen2CivilParish.transform_civil_parish_params(params[:freecen2_civil_parish]) @freecen2_civil_parish = Freecen2CivilParish.new(@new_civil_parish_params) + get_user_info_from_userid + if @user.present? && @user.person_role.present? + if @user.person_role == 'system_administrator' || @user.person_role == 'data_manager' + @freecen2_civil_parish.reason_changed = "Created by #{@user.person_role} (#{@user.userid})" + end + end @freecen2_civil_parish.save if @freecen2_civil_parish.errors.any? diff --git a/app/views/freecen2_civil_parishes/new.html.erb b/app/views/freecen2_civil_parishes/new.html.erb index b1b6061f4..4477cec84 100644 --- a/app/views/freecen2_civil_parishes/new.html.erb +++ b/app/views/freecen2_civil_parishes/new.html.erb @@ -3,7 +3,9 @@ <%= render 'flash_notice' %> <%= semantic_form_for @freecen2_civil_parish, :html => { :class => 'grid'} do |f| %> - <%= f.input :reason_changed,:label => 'Reason for making addition',required: true,:as => :text, :input_html => {:class => ' simple_form_bgcolour ', :placeholder => 'Enter the reason for addition', :size => '50x5' }%> + <% unless @user.person_role == "system_administrator" || @user.person_role == "data_manager" %> + <%= f.input :reason_changed,:label => 'Reason for making addition',required: true,:as => :text, :input_html => {:class => ' simple_form_bgcolour ', :placeholder => 'Enter the reason for addition', :size => '50x5' }%> + <% end %> <%= f.input :name , label: 'Civil Parish Name', :required => true, input_html: {class: ' simple_form_bgcolour', size:40 }%> <%= f.input :freecen2_place_id, label: 'Freecen2 Place name:',required: true, selected: @freecen2_place_name, include_blank: false, collection: @places, input_html: {class: ' simple_form_bgcolour very_large_selection_field_width', size:5 }%> <% if @scotland %> From 67879bc5514c732639172aaf0dbf1a3fc332be7c Mon Sep 17 00:00:00 2001 From: Anne Vandervord <72746727+AnneV-Learn@users.noreply.github.com> Date: Sun, 26 Mar 2023 12:55:36 +0100 Subject: [PATCH 2/4] Update freecen2_pieces_helper.rb Remove code related to session type locate_other_places as links are not used in the index display for locate_other_places and it was causing issues with the SHOW forms --- app/helpers/freecen2_pieces_helper.rb | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/app/helpers/freecen2_pieces_helper.rb b/app/helpers/freecen2_pieces_helper.rb index c05fc1354..036d92a5c 100644 --- a/app/helpers/freecen2_pieces_helper.rb +++ b/app/helpers/freecen2_pieces_helper.rb @@ -9,20 +9,16 @@ def tna(number) end def district_link(district) - if district.present? && session[:type] != 'locate_other_pieces' + if district.present? link_to "#{district.name}", freecen2_district_path(district), class: 'btn btn--small', title:' Displays all of the information about the District to which this Sub District (Piece) is linked' - elsif session[:type] == 'locate_other_pieces' - district.name else 'There is no district' end end def civil_link(piece) - if piece.present? && session[:type] != 'locate_other_pieces' + if piece.present? link_to 'Civil Parishes', index_for_piece_freecen2_civil_parishes_path(piece_id: piece.id, type: @type), class: 'btn btn--small', title:' Displays a list of the Civil Parishes which belong to this Sub District (Piece)' - elsif session[:type] == 'locate_other_pieces' - 'Civil Parishes' else 'There is no piece' end @@ -92,30 +88,24 @@ def piece_status(piece) end def csv_files_piece_link_unincorporated(piece) - if piece.present? && session[:type] != 'locate_other_pieces' + if piece.present? link_to 'Unincorporated Freecen CSV Files', freecen_csv_files_path, class: 'btn btn--small', title: 'Csv files for this Piece' - elsif session[:type] == 'locate_other_pieces' - 'Unincorporated Freecen CSV Files' else 'There is no piece' end end def csv_files_piece_link_incorporated(piece) - if piece.present? && session[:type] != 'locate_other_pieces' + if piece.present? link_to 'Incorporated Freecen CSV Files', freecen_csv_files_path, class: 'btn btn--small', title: 'Csv files for this Piece' - elsif session[:type] == 'locate_other_pieces' - 'Incorporated Freecen CSV Files' else 'There is no piece' end end def vld_files_piece_link(piece) - if piece.present? && session[:type] != 'locate_other_pieces' + if piece.present? link_to 'Freecen VLD Files', freecen1_vld_files_path, class: 'btn btn--small', title: 'VLD files for this Piece' - elsif session[:type] == 'locate_other_pieces' - 'Freecen VLD Files' else 'There is no piece' end @@ -126,10 +116,8 @@ def individual_civil_link(parish) end def place_link(place) - if place.present? && session[:type] != 'locate_other_pieces' + if place.present? link_to "#{place.place_name}", freecen2_place_path(place.id), class: 'btn btn--small', title: ' Displays all of the information about the place to which this Sub District (Piece) is linked' - elsif session[:type] == 'locate_other_pieces' - place.place_name else 'There is no place' end From 16ff0cdd8d2b55220158bf9c328d770e41d8da9f Mon Sep 17 00:00:00 2001 From: Anne Vandervord <72746727+AnneV-Learn@users.noreply.github.com> Date: Sun, 26 Mar 2023 13:55:42 +0100 Subject: [PATCH 3/4] Reason for change optional but defaulted if blank Reason for change optional but defaulted if blank --- app/controllers/freecen2_civil_parishes_controller.rb | 6 +----- app/views/freecen2_civil_parishes/new.html.erb | 6 ++++-- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/app/controllers/freecen2_civil_parishes_controller.rb b/app/controllers/freecen2_civil_parishes_controller.rb index a4d27cbd9..60d0061c0 100644 --- a/app/controllers/freecen2_civil_parishes_controller.rb +++ b/app/controllers/freecen2_civil_parishes_controller.rb @@ -19,11 +19,7 @@ def create @freecen2_civil_parish = Freecen2CivilParish.new(@new_civil_parish_params) get_user_info_from_userid - if @user.present? && @user.person_role.present? - if @user.person_role == 'system_administrator' || @user.person_role == 'data_manager' - @freecen2_civil_parish.reason_changed = "Created by #{@user.person_role} (#{@user.userid})" - end - end + @freecen2_civil_parish.reason_changed = "Created by #{@user.person_role} (#{@user.userid})" if @freecen2_civil_parish.reason_changed.blank? @freecen2_civil_parish.save if @freecen2_civil_parish.errors.any? diff --git a/app/views/freecen2_civil_parishes/new.html.erb b/app/views/freecen2_civil_parishes/new.html.erb index 4477cec84..39dfe7107 100644 --- a/app/views/freecen2_civil_parishes/new.html.erb +++ b/app/views/freecen2_civil_parishes/new.html.erb @@ -3,8 +3,10 @@ <%= render 'flash_notice' %> <%= semantic_form_for @freecen2_civil_parish, :html => { :class => 'grid'} do |f| %> - <% unless @user.person_role == "system_administrator" || @user.person_role == "data_manager" %> - <%= f.input :reason_changed,:label => 'Reason for making addition',required: true,:as => :text, :input_html => {:class => ' simple_form_bgcolour ', :placeholder => 'Enter the reason for addition', :size => '50x5' }%> + <% if @user.person_role == "system_administrator" || @user.person_role == "data_manager" %> + <%= f.input :reason_changed,:label => 'Reason for making addition',required: false,:as => :text,:input_html => {:class => ' simple_form_bgcolour ', :placeholder => 'Enter the reason for addition', :size => '50x5' }%> + <% else %> + <%= f.input :reason_changed,:label => 'Reason for making addition',required: true,:as => :text,:input_html => {:class => ' simple_form_bgcolour ', :placeholder => 'Enter the reason for addition', :size => '50x5' }%> <% end %> <%= f.input :name , label: 'Civil Parish Name', :required => true, input_html: {class: ' simple_form_bgcolour', size:40 }%> <%= f.input :freecen2_place_id, label: 'Freecen2 Place name:',required: true, selected: @freecen2_place_name, include_blank: false, collection: @places, input_html: {class: ' simple_form_bgcolour very_large_selection_field_width', size:5 }%> From 056ade4d05a6a57721b8343ae61e43c056cbc8ad Mon Sep 17 00:00:00 2001 From: Anne Vandervord <72746727+AnneV-Learn@users.noreply.github.com> Date: Sun, 26 Mar 2023 15:25:55 +0100 Subject: [PATCH 4/4] Civil parish changed code to fc_1509_av Reinstate civil parish code changes as they are in fc_1509_av now --- app/controllers/freecen2_civil_parishes_controller.rb | 2 -- app/views/freecen2_civil_parishes/new.html.erb | 6 +----- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/app/controllers/freecen2_civil_parishes_controller.rb b/app/controllers/freecen2_civil_parishes_controller.rb index 60d0061c0..e69205512 100644 --- a/app/controllers/freecen2_civil_parishes_controller.rb +++ b/app/controllers/freecen2_civil_parishes_controller.rb @@ -18,8 +18,6 @@ def create @new_civil_parish_params = Freecen2CivilParish.transform_civil_parish_params(params[:freecen2_civil_parish]) @freecen2_civil_parish = Freecen2CivilParish.new(@new_civil_parish_params) - get_user_info_from_userid - @freecen2_civil_parish.reason_changed = "Created by #{@user.person_role} (#{@user.userid})" if @freecen2_civil_parish.reason_changed.blank? @freecen2_civil_parish.save if @freecen2_civil_parish.errors.any? diff --git a/app/views/freecen2_civil_parishes/new.html.erb b/app/views/freecen2_civil_parishes/new.html.erb index 39dfe7107..b1b6061f4 100644 --- a/app/views/freecen2_civil_parishes/new.html.erb +++ b/app/views/freecen2_civil_parishes/new.html.erb @@ -3,11 +3,7 @@ <%= render 'flash_notice' %> <%= semantic_form_for @freecen2_civil_parish, :html => { :class => 'grid'} do |f| %> - <% if @user.person_role == "system_administrator" || @user.person_role == "data_manager" %> - <%= f.input :reason_changed,:label => 'Reason for making addition',required: false,:as => :text,:input_html => {:class => ' simple_form_bgcolour ', :placeholder => 'Enter the reason for addition', :size => '50x5' }%> - <% else %> - <%= f.input :reason_changed,:label => 'Reason for making addition',required: true,:as => :text,:input_html => {:class => ' simple_form_bgcolour ', :placeholder => 'Enter the reason for addition', :size => '50x5' }%> - <% end %> + <%= f.input :reason_changed,:label => 'Reason for making addition',required: true,:as => :text, :input_html => {:class => ' simple_form_bgcolour ', :placeholder => 'Enter the reason for addition', :size => '50x5' }%> <%= f.input :name , label: 'Civil Parish Name', :required => true, input_html: {class: ' simple_form_bgcolour', size:40 }%> <%= f.input :freecen2_place_id, label: 'Freecen2 Place name:',required: true, selected: @freecen2_place_name, include_blank: false, collection: @places, input_html: {class: ' simple_form_bgcolour very_large_selection_field_width', size:5 }%> <% if @scotland %>