Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update _show_header_links.html.erb #2652

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 5 additions & 15 deletions app/controllers/userid_details_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ class UseridDetailsController < ApplicationController
require 'import_users_from_csv'
skip_before_action :require_login, only: [:general, :create, :researcher_registration, :transcriber_registration, :technical_registration]
rescue_from ActiveRecord::RecordInvalid, with: :record_validation_errors
PERMITTED_ROLES = ['system_administrator', 'syndicate_coordinator', 'county_coordinator', 'country_coordinator', 'master_county_coordinator', 'newsletter_coordinator']
STATS_PERMITTED_ROLES = ['system_administrator', 'executive_director', 'project_manager', 'engagement_coordinator', 'contacts_coordinator', 'newsletter_coordinator']
PERMITTED_ROLES = ['system_administrator', 'syndicate_coordinator', 'county_coordinator', 'country_coordinator', 'master_county_coordinator', 'newsletter_coordinator', 'executive_director']

def all
session[:user_index_page] = params[:page] if params[:page]
Expand Down Expand Up @@ -360,7 +359,7 @@ def return_percentage_all_existing_active_users_accepted_transcriber_agreement_o
((total_existing_active_users_accepted / total_existing_active_users) * 100).round(2)
end



def role
@userids = UseridDetail.role(params[:role]).all.order_by(userid_lower_case: 1)
Expand Down Expand Up @@ -637,21 +636,12 @@ def permitted_role?
end

def permitted_secondary_roles?
roles = @current_user.secondary_role & PERMITTED_ROLES
roles.present?
roles = @current_user.secondary_role & PERMITTED_ROLES
roles.present?
end

def stats_permitted_users?
stats_access_role? || stats_access_secondary?
end

def stats_access_role?
STATS_PERMITTED_ROLES.include? @current_user.person_role
end

def stats_access_secondary?
roles = @current_user.secondary_role & STATS_PERMITTED_ROLES
roles.present?
%w[system_administrator executive_director project_manager engagement_coordinator].include? @current_user.person_role
end

def get_option_parameter(option, location)
Expand Down
4 changes: 2 additions & 2 deletions app/views/freecen1_vld_files/_index_header.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
<% session[:file_page] = params[:page]%>
<h1 style="text-align: center">Listing of <%= @freecen1_vld_files.length if @freecen1_vld_files.present? %> FreeCen1 VLD Files for <%= @chapman_code%></h1>
<%= render 'flash_notice' %>
<% if %w[system_administrator data_manager county_coordinator country_coordinator master_county_coordinator].include?(@user.person_role)%>
<% if %w[system_administrator data_manager executive_director county_coordinator country_coordinator master_county_coordinator].include?(@user.person_role)%>
<div class="text--center">
<%= link_to 'List Deleted VLD Files', freecen1_vld_file_audits_path, method: :get , :class => "btn btn--small"%><br>
<% if %w[system_administrator data_manager country_coordinator].include?(@user.person_role)%>
To upload a new file: click this <%= link_to 'Upload new VLD file', new_freecen1_vld_file_path, method: :get , :class => "btn btn--small"%><br>
<% end %>
<% if %w[system_administrator data_manager county_coordinator master_county_coordinator].include?(@user.person_role)%>
<% if %w[system_administrator data_manager executive_director county_coordinator master_county_coordinator].include?(@user.person_role)%>
<%= form_for(:listinvalidcivilparishes, url: list_invalid_civil_parishes_freecen1_vld_file_path, method: :get, data: { confirm: "Are you sure you want to generate a list of VLD fies with invalid Civil Parishes?"}) do |f| %>
<fieldset class="inputs">
<%= f.submit 'List files with invalid Civil Parishes', :class => "btn btn--small", title: 'Sends a list via Email (CSV file attachment)',data: { disable_with: false } %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/freecen1_vld_files/_show_header.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<h1 style="text-align: center">Listing of <%= @freecen1_vld_file.file_name %> for <%= @chapman_code%></h1>
<%= render 'flash_notice' %>
<div style="text-align: center">
<% if %w[data_manager county_coordinator country_coordinator master_county_coordinator system_administrator].include?(@user.person_role)%>
<% if %w[data_manager executive_director county_coordinator country_coordinator master_county_coordinator system_administrator].include?(@user.person_role)%>
<%= edit_freecen1_vld_file %>
<%= edit_cp_freecen1_vld_file %>
<%= link_to 'Download file as CSVPro', csv_download_freecen1_vld_file_path(file: @freecen1_vld_file.id) , :class => "btn btn--small" %>
Expand Down
4 changes: 2 additions & 2 deletions app/views/freecen1_vld_files/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<th class='sticky-header '>Loaded At</th>
<th class='sticky-header '>Uploaded By</th>
<th class='sticky-header '>Transcriber</th>
<% if %w[system_administrator data_manager county_coordinator country_coordinator master_county_coordinator].include?(@user.person_role)%>
<% if %w[system_administrator data_manager executive_director county_coordinator country_coordinator master_county_coordinator].include?(@user.person_role)%>
<th colspan = "6" class='sticky-header '>Actions</th>
<% else%>
<th colspan = "1" class='sticky-header '>Actions</th>
Expand All @@ -28,7 +28,7 @@
<td><%= freecen1_vld_file.userid %></td>
<td><%= freecen1_vld_file.transcriber_name %></td>
<td><%= link_to 'Show', freecen1_vld_file_path(freecen1_vld_file) %></td>
<% if %w[system_administrator data_manager county_coordinator country_coordinator master_county_coordinator].include?(@user.person_role)%>
<% if %w[system_administrator data_manager executive_director county_coordinator country_coordinator master_county_coordinator].include?(@user.person_role)%>
<% if %w[system_administrator data_manager country_coordinator].include?(@user.person_role)%>
<td><%= link_to 'Download', download_vld_file_freecen1_vld_file_path(file: freecen1_vld_file.id), title: 'Download VLD file',data: { confirm: 'Confirm you want to download this VLD file'}, method: :get %></td>
<td><%= link_to 'Replace', new_freecen1_vld_file_path(replace: freecen1_vld_file.file_name), data: { confirm: 'Confirm you want to replace this file'}, method: :get %></td>
Expand Down
4 changes: 2 additions & 2 deletions app/views/freecen2_civil_parishes/_basic_index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
<td ><%= freecen2_civil_parish.number %></td>
<% end%>
<td ><%= link_to 'Show',freecen2_civil_parish_path(freecen2_civil_parish, type: @type), :class => "btn btn--small"%>
<% if %w[county_coordinator country_coordinator master_county_coordinator data_manager system_administrator].include?(@user.person_role)%>
<td ><%= link_to 'Edit', edit_freecen2_civil_parish_path(freecen2_civil_parish, type: @type), data: { confirm: 'Are you sure?' }, :class => "btn btn--small", title: 'Editing is restricted to, coordinators, data managers and system administrators'%></td>
<% if %w[county_coordinator country_coordinator master_county_coordinator data_manager executive_director system_administrator].include?(@user.person_role)%>
<td ><%= link_to 'Edit', edit_freecen2_civil_parish_path(freecen2_civil_parish, type: @type), data: { confirm: 'Are you sure?' }, :class => "btn btn--small", title: 'Editing is restricted to, coordinators, data managers, executive directors and system administrators'%></td>
<% end %>
</tr>
<% end %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/freecen2_civil_parishes/_show_header.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<%= link_to 'Edit Civil Parish Name', edit_name_freecen2_civil_parish_path(@freecen2_civil_parish, type: @type), data: { confirm: 'Are you sure?' }, :class => "btn btn--small", title: 'Edit of the name allows a correction but will NOT permit a rename to a Parish with the new name'%>
</div>
<% end%>
<% if %w[data_manager system_administrator].include?(@user.person_role) or (%w[county_coordinator master_county_coordinator].include?(@user.person_role) and ("1901" "1911").include?(@freecen2_civil_parish.year))%>
<% if %w[data_manager system_administrator].include?(@user.person_role) or (%w[county_coordinator master_county_coordinator executive_director].include?(@user.person_role) and ("1901" "1911").include?(@freecen2_civil_parish.year))%>
<div style="text-align: center">
<%= link_to 'Delete Civil Parish', freecen2_civil_parish_path(@freecen2_civil_parish), method: :delete, data: { confirm: 'Are you sure you want to delete this Civil Parish?' } , :class => "btn btn--small"%>
</div>
Expand Down
2 changes: 1 addition & 1 deletion app/views/freecen2_districts/_show_header.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<h2 style="text-align: center">Details of FreeCen2 District:- <%= @freecen2_district.name%> in <%=ChapmanCode.name_from_code(@chapman_code)%> (<%=@chapman_code%>) </h2>
<%= render 'flash_notice' %>
<h3 style="text-align: center"> Name changes will normally be done with the Edit District Name action and extremely rarely using the main Edit action</h3>
<% if %w[county_coordinator master_county_coordinator country_coordinator data_manager system_administrator].include?(@user.person_role)%>
<% if %w[county_coordinator master_county_coordinator country_coordinator data_manager executive_director system_administrator].include?(@user.person_role)%>
<div style="text-align: center">
<%= link_to 'Edit District', edit_freecen2_district_path(@freecen2_district, type: @type), data: { confirm: 'Are you sure?' }, :class => "btn btn--small", title: 'Edit of all fields; note the edit of a district name functions as a merge of this District into another District'%>
</div>
Expand Down
2 changes: 1 addition & 1 deletion app/views/freecen2_pieces/_show_header.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<%= link_to 'Delete Piece', freecen2_piece_path(@freecen2_piece), method: :delete, data: { confirm: 'Are you sure you want to destroy this Piece.? It will not happen if there are dependants!' } , :class => "btn btn--small"%>
</div>
<% end%>
<% if %w[data_manager system_administrator].include?(@user.person_role) or (%w[county_coordinator master_county_coordinator].include?(@user.person_role) and ("1901" "1911").include?(@freecen2_piece.year))%>
<% if %w[data_manager system_administrator].include?(@user.person_role) or (%w[county_coordinator master_county_coordinator executive_director].include?(@user.person_role) and ("1901" "1911").include?(@freecen2_piece.year))%>
<div style="text-align: center">
<%= link_to 'Add Civil Parish', new_freecen2_civil_parish_path(piece: @freecen2_piece, type: @type), data: { confirm: 'Are you sure?' }, :class => "btn btn--small", title: 'Adding a Civil Parish is restricted to data managers and system administrators. For 1901 and 1911 this is also possible for county coordinators'%>
</div>
Expand Down
2 changes: 1 addition & 1 deletion app/views/freecen_csv_files/_coordinator_header.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<% breadcrumb :freecen_csv_files, @freecen_csv_file %>
<p class=" text--center">Videos describing <%= link_to 'this page', "https://youtu.be/GnkkKkVGXs8", target: '_blank' %>, <%= link_to 'download a spreadsheet file', "https://youtu.be/2ekZ_VXmTn0", target: '_blank' %>, <%= link_to 'upload traditional file', "https://youtu.be/DM889numA-s" , target: '_blank'%>, <%= link_to 'upload new CSVProc file', "https://youtu.be/GnkkKkVGXs8" , target: '_blank'%>, <%= link_to 'show details of the file', "https://youtu.be/f0l1tlWESII" , target: '_blank' %>, <%= link_to 'errors display', "https://youtu.be/f0l1tlWESII" , target: '_blank' %>, <%= link_to 'replace a file', "https://youtu.be/XH-QBKRg9gQ" , target: '_blank' %> (all open in new tabs)<br>
</p>
<% if %w[system_administrator data_manager county_coordinator country_coordinator master_county_coordinator].include?(@user.person_role) && session[:selection] == 'all'%>
<% if %w[system_administrator executive_director data_manager county_coordinator country_coordinator master_county_coordinator].include?(@user.person_role) && session[:selection] == 'all'%>
<div class="text--center">
<%= link_to 'List CSV files that have been Unincorporated/Removed/Deleted', freecen_csv_file_audits_path, method: :get , :class => "btn btn--small"%><br>
</div>
Expand Down
6 changes: 3 additions & 3 deletions app/views/freecen_csv_files/_form.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<%= semantic_form_for @freecen_csv_file , :html => { :class => 'grid'} do |f| %>
<%= f.input :transcriber_name , :input_html => {:class => ' simple_form_bgcolour ', :size => 30 }%>
<% if session[:my_own] || %w[syndicate_coordinator master_county_coordinator county_coordinator system_administrator country_coordinator data_manager].include?(session[:role]) %>
<% if session[:my_own] || %w[syndicate_coordinator master_county_coordinator county_coordinator system_administrator country_coordinator data_manager executive_director].include?(session[:role]) %>
<%= f.input :locked_by_transcriber, :label => 'Locked by transcriber ',:include_blank => false,
:collection => [ true, false],:input_html => {:class => ' simple_form_bgcolour medium_selection_field_width', :size => 3} %>
<% if session[:my_own]%>
Expand All @@ -13,11 +13,11 @@
<%= f.input :locked_by_transcriber, :input_html => { :disabled => true, :size => 3} %>
<%= f.input :locked_by_coordinator, :input_html => {:disabled => true, :size => 3} %>
<% end %>
<% if %w[master_county_coordinator county_coordinator system_administrator country_coordinator data_manager].include?(session[:role]) %>
<% if %w[master_county_coordinator county_coordinator system_administrator country_coordinator data_manager executive_director].include?(session[:role]) %>
<%= f.input :incorporation_lock, :label => 'Incorporation lock ',:include_blank => false,
:collection => [ true, false],:input_html => {:class => ' simple_form_bgcolour medium_selection_field_width', :size => 3} %>
<% end %>
<% if %w[master_county_coordinator county_coordinator system_administrator country_coordinator data_manager].include?(session[:role]) %>
<% if %w[master_county_coordinator county_coordinator system_administrator country_coordinator data_manager executive_director].include?(session[:role]) %>
<%= f.input :incorporating_lock, :label => 'Incorporating lock ',:include_blank => false,
:collection => [ true, false],:input_html => {:class => ' simple_form_bgcolour medium_selection_field_width', :size => 3} %>
<% end %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/freecen_pieces/chapman_year_index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<td class="t20"><%= link_to 'Show', freecen_piece , :class => "btn btn--small"%>
<%= link_to 'Edit', edit_freecen_piece_path(freecen_piece.id), data: { confirm: 'Are you sure?' }, :class => "btn btn--small" %>
<%= link_to 'Destroy', freecen_piece_path(freecen_piece.id), method: :delete, :class => "btn btn--small",
data: { confirm: 'Are you sure you want to destroy this Piece.? It will not happen if there are dependants!' } if ['data_manager', 'system_administrator', 'county_coordinator', 'master_county_coordinator'].include?(@user.person_role) %></td>
data: { confirm: 'Are you sure you want to destroy this Piece.? It will not happen if there are dependants!' } if ['data_manager', 'executive_director', 'system_administrator', 'county_coordinator', 'master_county_coordinator'].include?(@user.person_role) %></td>
</tr>
<% end %>
</tbody>
Expand Down
6 changes: 3 additions & 3 deletions app/views/userid_details/_form_freecen.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@
<!--span>I hereby prefer not to sign, the <%#= link_to 'Transcription Agreement(pdf)', "http://www.freeukgenealogy.org.uk/files/Documents/FreeUKGenealogyTranscriptionAgreement.pdf", target: '_blank', title: "Click here to view or download the Agreement" %></span><br /><br /-->
</div>
<% end %>
<% if %w[system_administrator county_coordinator master_county_coordinator syndicate_coordinator volunteer_coordinator].include?(@user.person_role) && !session[:my_own] %>
<% if %w[system_administrator executive_director county_coordinator master_county_coordinator syndicate_coordinator volunteer_coordinator].include?(@user.person_role) && !session[:my_own] %>
<%= f.input :syndicate,:label => "Syndicate",:include_blank => false, :collection => @syndicates,:input_html => { :class => "text-input simple_form_bgcolour simple_form_position", :size => 4 }, :hint => "The syndicate MUST be selected"%>
<% end%>
<% if %w[system_administrator county_coordinator master_county_coordinator syndicate_coordinator].include?(@user.person_role) && !session[:my_own] %>
<% if %w[system_administrator executive_director county_coordinator master_county_coordinator syndicate_coordinator].include?(@user.person_role) && !session[:my_own] %>
<%= f.input :person_role, :collection => UseridRole::VALUES, :include_blank => false,:label => "Role in #{appname} :", :input_html => { :class => " simple_form_bgcolour simple_form_position overide_selection_field_width", :size => 4 } %>
<%= f.input :secondary_role, :collection => UseridRole::VALUES, :include_blank => true,:label => "Secondary Role(s) in #{appname} :", :input_html => { :class => " simple_form_bgcolour simple_form_position overide_selection_field_width", :size => 4, multiple: true }, include_hidden: true, :hint => "Hold Ctrl or Shift to select multiple roles" unless appname.downcase == 'freecen'%>
<% end %>
Expand Down Expand Up @@ -67,6 +67,6 @@
$("#form_control").hide();
}
});

});
</script>
10 changes: 6 additions & 4 deletions app/views/userid_details/_show_header_links.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
<% if session[:edit_userid] %>
<%= list_userid_files %>
<%= link_to 'Edit', edit_userid_detail_path(@userid, page_name: @page_name), method: :get, :class => "btn btn--small " %>
<% if %w[system_administrator syndicate_coordinator volunteer_coordinator county_coordinator master_county_coordinator country_coordinator ].include?(@user.person_role) %>
<%= link_to " Send password change request", change_password_userid_detail_path(@userid, page_name: @page_name), data: { confirm: 'You are sending a password reset email to the user. Do you wish to proceed?' }, method: :get, class: "btn btn--small ", title: 'The person will receive an email within a minute or 2. If they do not get them to check their spam folder and check their email address'%>
<%= link_to ' Move to inactive syndicate', move_userid_detail_path(@userid), data: { confirm: 'Are you absolutely sure?' }, method: :get, :class => "btn btn--small " unless @userid.syndicate == 'To be Destroyed' && @user.person_role == 'system_administrator'%>
<%= link_to ' Destroy', userid_detail_path(@userid), data: { confirm: 'Are you absolutely sure?' }, method: :delete, :class => "btn btn--small " if @userid.syndicate == 'To be Destroyed' && @user.person_role == 'system_administrator'%>
<% if %w[system_administrator executive_director syndicate_coordinator volunteer_coordinator county_coordinator master_county_coordinator country_coordinator ].include?(@user.person_role)%>
<%= link_to " Send password change request", change_password_userid_detail_path(@userid, page_name: @page_name), data: { confirm: 'You are sending a password reset email to the user. Do you wish to proceed?' }, method: :get, class: "btn btn--small ", title: 'The person will receive an email within a minute or 2. If they do not get them to check their spam folder and check their email address' unless @user.person_role == 'executive_director'%>
<% if %w[system_administrator executive_director].include?(@user.person_role) %>
<%= link_to ' Move to inactive syndicate', move_userid_detail_path(@userid), data: { confirm: 'Are you absolutely sure?' }, method: :get, :class => "btn btn--small " unless @userid.syndicate == 'To be Destroyed'%>
<%= link_to ' Destroy', userid_detail_path(@userid), data: { confirm: 'Are you absolutely sure?' }, method: :delete, :class => "btn btn--small " if @userid.syndicate == 'To be Destroyed'%>
<% end %>
<% end %>
<% end %>
</div>