diff --git a/app/assets/stylesheets/normal/helpers.scss b/app/assets/stylesheets/normal/helpers.scss index 9957a9d2a191d0d2f3f2e07d54bfe3bea748a06e..ed60a8441d33efa2c8c68fbbff401f2d831758cb 100644 --- a/app/assets/stylesheets/normal/helpers.scss +++ b/app/assets/stylesheets/normal/helpers.scss @@ -222,6 +222,7 @@ .txt-strong, .txt-bold { font-weight:bold; } .txt-italic { font-style: italic; } .txt-underline { text-decoration: underline; } +.txt-normal { font-weight: normal; } .txt-uppercase{ text-transform: uppercase; } .txt-lowercase{ text-transform: lowercase; } @@ -266,6 +267,18 @@ } +.show-on-parent-hover-parent .show-on-parent-hover { + visibility: hidden; + opacity: 0; + transition:opacity 300ms; +} + +.show-on-parent-hover-parent:hover .show-on-parent-hover { + visibility: visible; + opacity: 1; + transition:opacity 300ms; +} + /* -------------- CENTER -------------- */ diff --git a/app/controllers/admin/course_editions/project_imports_controller.rb b/app/controllers/admin/course_editions/project_imports_controller.rb index 771940e913f67492a7b200068d53d2d66b1e6282..6e37175b5a04638dfd909003fcc88ade11f99687 100644 --- a/app/controllers/admin/course_editions/project_imports_controller.rb +++ b/app/controllers/admin/course_editions/project_imports_controller.rb @@ -76,7 +76,6 @@ module Admin # Actually send notification if no failures occurred event.notify(User.with_role(:client, project), as: :client) - .notify(User.with_role(:registrar, project.offerer.actable) - User.with_role(:client, project), as: :registrar) .notify(User.with_role(:employee, project.offerer.actable) - User.with_role(:client, project), as: :employee) new_project diff --git a/app/controllers/admin/groups_controller.rb b/app/controllers/admin/groups_controller.rb index 51d56a4f861f13ff39f9c34ad77da92863186fc3..4d39eb0decb808c5516640dfe988439a0947363a 100644 --- a/app/controllers/admin/groups_controller.rb +++ b/app/controllers/admin/groups_controller.rb @@ -62,13 +62,35 @@ module Admin authorize! :update, @group csr = @group.project.course_edition.course_specific_roles.find_by id: params[:csr_id] - user = User.find_by id: params[:user_id] - if csr.nil? || user.nil? - raise ActionController::BadRequest, 'Role or user not found' - end + if params[:user_id] + # add registered user + user = User.find_by id: params[:user_id] + if user.nil? + raise ActionController::BadRequest, 'User not found' + end - UserCourseSpecificRole.create(user: user, resource: @group, course_specific_role: csr) + UserCourseSpecificRole.create!(user: user, resource: @group, course_specific_role: csr) + else + # add unregistered user + unless params[:name] && params[:email] + raise ActionController::BadRequest, 'Name or user not specified' + end + + user = User.find_by email: params[:email] + if user + # user actually exists + UserCourseSpecificRole.create!(user: user, resource: @group, course_specific_role: csr) + return + end + + UserCourseSpecificRole.create!( + resource: @group, + course_specific_role: csr, + unregistered_name: params[:name], + unregistered_email: params[:email] + ) + end redirect_to admin_group_path(@group) end diff --git a/app/controllers/admin/projects_controller.rb b/app/controllers/admin/projects_controller.rb index e0c160356c159bfac08537e9b9d34d427eb318c3..0ca479bad9bf5b8236a1c306a9af283aaecfae14 100644 --- a/app/controllers/admin/projects_controller.rb +++ b/app/controllers/admin/projects_controller.rb @@ -112,13 +112,39 @@ module Admin authorize! :update, @project csr = @project.course_edition.course_specific_roles.find_by id: params[:csr_id] - user = User.find_by id: params[:user_id] - if csr.nil? || user.nil? - raise ActionController::BadRequest, 'Role or user not found' + if csr.nil? + raise ActionController::BadRequest, 'Role not found' end - UserCourseSpecificRole.create(user: user, resource: @project, course_specific_role: csr) + if params[:user_id] + # add registered user + user = User.find_by id: params[:user_id] + if user.nil? + raise ActionController::BadRequest, 'User not found' + end + + UserCourseSpecificRole.create!(user: user, resource: @project, course_specific_role: csr) + else + # add unregistered user + unless params[:name] && params[:email] + raise ActionController::BadRequest, 'Name or user not specified' + end + + user = User.find_by email: params[:email] + if user + # user actually exists + UserCourseSpecificRole.create!(user: user, resource: @project, course_specific_role: csr) + return + end + + UserCourseSpecificRole.create!( + resource: @project, + course_specific_role: csr, + unregistered_name: params[:name], + unregistered_email: params[:email] + ) + end end def handle_user_csr_removal diff --git a/app/controllers/companies/role_invitations_controller.rb b/app/controllers/companies/role_invitations_controller.rb index 6ac15f9e9203ecb03b7cd25295ad1b060f417178..c3acb8e1ffa3996f9e383b8af1490fedd4b65745 100644 --- a/app/controllers/companies/role_invitations_controller.rb +++ b/app/controllers/companies/role_invitations_controller.rb @@ -62,7 +62,7 @@ module Companies end # do not create a new invitation if the user is already an employee - if user.has_role?(:employee, @company) || user.has_role?(:registrar, @company) + if user.has_role?(:employee, @company) flash[:danger] = 'This user is already an employee.' return end diff --git a/app/controllers/companies/roles_controller.rb b/app/controllers/companies/roles_controller.rb index 232fc0c0c45d6c5283396fd4f59956a942553f7b..074f4f9eacc14051fcd6bc23a86fce852c7d991a 100644 --- a/app/controllers/companies/roles_controller.rb +++ b/app/controllers/companies/roles_controller.rb @@ -15,16 +15,14 @@ module Companies protected - # Removes the current users employee/registrar role, checks whether there are enough employees on the company + # Removes the current users employee role, checks whether there are enough employees on the company # before removing the role. def remove_current_role if @company.confirmed_involved_users.count > 1 if current_user.remove_role(:employee, @company) - flash[:success] = 'Successfully left as employee' - elsif current_user.remove_role(:registrar, @company) - flash[:success] = 'Successfully left as registrar' + flash[:success] = 'Successfully left the company' else - flash[:danger] = 'Failed to leave as company' + flash[:danger] = 'Failed to leave company' end else flash[:danger] = 'Cannot leave company. The company must have at least one employee.' diff --git a/app/controllers/companies_controller.rb b/app/controllers/companies_controller.rb index 26502ac549a9047d67de9c493e99407cc1251580..8f986419c07166bc96fe199dde7d126e7496b0f2 100644 --- a/app/controllers/companies_controller.rb +++ b/app/controllers/companies_controller.rb @@ -21,7 +21,7 @@ class CompaniesController < OfferersController ## # Action to view an index of all of the user's involved companies. def index - @companies = current_user.involved_companies(%i[employee registrar unconfirmed_employee]) + @companies = current_user.involved_companies(%i[employee unconfirmed_employee]) @involved_in_companies = @companies.any? @company_invitations = current_user.invited_by_which_companies @has_company_invitations = @company_invitations.any? @@ -50,7 +50,7 @@ class CompaniesController < OfferersController extra_checks: { Image.model_name.human => -> { save_image }, Role.model_name.human => lambda do - current_user.add_role(:registrar, @company).persisted? + current_user.add_role(:employee, @company).persisted? rescue StandardError false end diff --git a/app/controllers/course_editions/projects/project_interests_controller.rb b/app/controllers/course_editions/projects/project_interests_controller.rb index 9c1ab3efd848be84176ad33bec344dfef8577434..1b0aeff4570af3fc4e96079a028cbf9b5903d1a3 100644 --- a/app/controllers/course_editions/projects/project_interests_controller.rb +++ b/app/controllers/course_editions/projects/project_interests_controller.rb @@ -25,7 +25,7 @@ module CourseEditions def destroy authorize! :destroy, @project_interest if @project_interest.present? - flash[:success] = 'You have been removed from the interest list.' + flash[:success] = 'You have been removed from the interest list.' unless request.xhr? @project_interest.destroy else flash[:danger] = "You were not found in the interest list. If this @@ -48,7 +48,7 @@ module CourseEditions flash[:danger] = 'You cannot join the interest list for this project when you are already in a group for this project.' else - flash[:success] = 'You have been placed in the interest list.' + flash[:success] = 'You have been placed in the interest list.' unless request.xhr? @project.interested_users << current_user end end diff --git a/app/controllers/dashboards_controller.rb b/app/controllers/dashboards_controller.rb index 0b14dd620be02d1b41d3352073dbf051934b353c..3e624797bd4de1e691915dfbb9592c7480061cef 100644 --- a/app/controllers/dashboards_controller.rb +++ b/app/controllers/dashboards_controller.rb @@ -17,7 +17,7 @@ class DashboardsController < ApplicationController @coached_groups = current_user.coached_groups(CourseEdition.active) @groups_awaiting_approval = Group.where(project_id: current_user.updatable_offerer_projects.ids).awaiting_client_approval - @companies = current_user.involved_companies(%i[employee registrar unconfirmed_employee]) + @companies = current_user.involved_companies(%i[employee unconfirmed_employee]) @research_groups = current_user.involved_research_groups end end diff --git a/app/helpers/translate_helper.rb b/app/helpers/translate_helper.rb index cb6257125e293fca1a7d7b91617c5f654acdefa7..daad0590521c174d8422c194a034dfc65cce0b92 100644 --- a/app/helpers/translate_helper.rb +++ b/app/helpers/translate_helper.rb @@ -7,7 +7,9 @@ module TranslateHelper groups_name: groups_name, project_name: project_name, projects_name: projects_name, - company_name: current_user.nil? ? 'company' : current_user.company_name + company_name: current_user.nil? ? 'company' : current_user.company_name, + company_name_capitalized: current_user.nil? ? 'Company' : current_user.company_name.capitalize, + companies_name: current_user.nil? ? 'companies' : current_user.companies_name } translate(path, **default_params.merge(custom_params)) end diff --git a/app/models/company.rb b/app/models/company.rb index ee852593b43b6520821bc006c83be442986bed5a..ba8a13e68d92179577f68cdcaa427201c6518397 100644 --- a/app/models/company.rb +++ b/app/models/company.rb @@ -1,7 +1,7 @@ class Company < ApplicationRecord include ElasticSearchable - ROLES = %i[registrar employee unconfirmed_employee].freeze + ROLES = %i[employee unconfirmed_employee].freeze resourcify acts_as :offerer @@ -20,11 +20,8 @@ class Company < ApplicationRecord # @return [ActiveRecord::Relation] all the employees of this company relate_users_role :employees, :employee - # @return [ActiveRecord::Relation] all the registrars of this company - relate_users_role :registrars, :registrar - - # @return [ActiveRecord::Relation] all the employees and registrars of this company - relate_users_role :confirmed_involved_users, %i[employee registrar] + # @return [ActiveRecord::Relation] all the employees of this company + relate_users_role :confirmed_involved_users, :employee # @return [ActiveRecord::Relation] all the unconfirmed employees of this company relate_users_role :unconfirmed_employees, :unconfirmed_employee @@ -32,11 +29,6 @@ class Company < ApplicationRecord # @return [ActiveRecord::Relation] all the (unique) users which are directly involved with this company relate_users_role :involved_users, -> { distinct } - # @return [User] The registrar of this company - def registrar - registrars.first - end - # @param user [User] the user # @return [Boolean] whether the given user is involved in ((unconfirmed) employee of) this company def involved?(user) diff --git a/app/models/concerns/user_concerns/associatable.rb b/app/models/concerns/user_concerns/associatable.rb index e1af92f0a75562dab78cb7ad2f68335fbb02204d..7bf2c293dc3e1ea60b4c42c2a65b388520ed6fd2 100644 --- a/app/models/concerns/user_concerns/associatable.rb +++ b/app/models/concerns/user_concerns/associatable.rb @@ -250,7 +250,7 @@ module UserConcerns end def involved_companies(roles = nil) - roles ||= %i[registrar employee] + roles ||= %i[employee] Company.with_role(roles, self) end @@ -278,7 +278,7 @@ module UserConcerns # Companies eligible to offer projects within the specified course edition def eligible_companies(course_edition = nil) - roles ||= %i[registrar employee unconfirmed_employee] + roles ||= %i[employee unconfirmed_employee] if course_edition.nil? Company.with_role(roles, self) elsif course_edition.configuration.allow_company_offerers @@ -338,7 +338,7 @@ module UserConcerns || involved_projects.generic_projects.any? \ || invited_groups('GenericProject').present? \ || coached_groups(nil, 'GenericProject').present? \ - || involved_companies(%i[registrar employee unconfirmed_employee]).any? + || involved_companies(%i[employee unconfirmed_employee]).any? end def offerer_groups diff --git a/app/views/admin/companies/_form.html.erb b/app/views/admin/companies/_form.html.erb index fe196d0515d6c7d8da1fb409af94ee897c1d3ffe..6f98c4e4420150772542f7d661d795f510b12435 100644 --- a/app/views/admin/companies/_form.html.erb +++ b/app/views/admin/companies/_form.html.erb @@ -11,13 +11,6 @@ <tr> <td><%= f.text_area :description, rows: 20 %></td> </tr> - <% if f.object.persisted? && f.object.registrar.present? %> - <tr><td> - <%= f.form_group :registrar, label: { text: Company.human_attribute_name(:registrar) } do %> - <%= f.object.registrar.full_name if f.object.registrar.present? %> - <% end %> - </td></tr> - <% end %> <tr> <td><%= f.text_field :email %></td> </tr> diff --git a/app/views/admin/companies/index.csv.erb b/app/views/admin/companies/index.csv.erb index 709f5b20a0ffa9c5024aa4b965f762f8ea78ffcb..ea44b847e1b7b4d7c384c5d7044ab63ee4d6fd28 100644 --- a/app/views/admin/companies/index.csv.erb +++ b/app/views/admin/companies/index.csv.erb @@ -1,7 +1,7 @@ <%- headers = [ Company.human_attribute_name(:id), Company.human_attribute_name(:name), - Company.human_attribute_name(:registrar), + Company.human_attribute_name(:employees), Company.human_attribute_name(:full_street_name), Company.human_attribute_name(:website_url) ] -%> @@ -10,7 +10,7 @@ <%= CSV.generate_line([ company.id, company.name, - company.registrar.name, + company.employees.map(&:full_name).to_sentence, company.full_street_name, company.website_url ]) -%> diff --git a/app/views/admin/companies/index.xlsx.axlsx b/app/views/admin/companies/index.xlsx.axlsx index 3d1d7afd328f4dd9accdf71f2c14927253b4d287..6eb36243f51c68a3ff7a6ea4ab98665d8660aca3 100644 --- a/app/views/admin/companies/index.xlsx.axlsx +++ b/app/views/admin/companies/index.xlsx.axlsx @@ -5,7 +5,7 @@ wb.add_worksheet(name: 'companies') do |sheet| sheet.add_row [ Company.human_attribute_name(:id), Company.human_attribute_name(:name), - Company.human_attribute_name(:registrar), + Company.human_attribute_name(:employees), Company.human_attribute_name(:full_street_name), Company.human_attribute_name(:website_url) ], style: styles[:legend] @@ -14,7 +14,7 @@ wb.add_worksheet(name: 'companies') do |sheet| sheet.add_row [ company.id, company.name, - company.registrar.name, + company.employees.map(&:full_name).to_sentence, company.full_street_name, company.website_url ] diff --git a/app/views/admin/companies/index/_table.html.erb b/app/views/admin/companies/index/_table.html.erb index 4eb86243ada87a322e91d4c59f2912d69e0e8cb4..7bf8234c131b1e2313e3a6363aef544723e543dd 100644 --- a/app/views/admin/companies/index/_table.html.erb +++ b/app/views/admin/companies/index/_table.html.erb @@ -4,7 +4,7 @@ <tr> <th><%= sort_link @q, :id %></th> <th><%= sort_link @q, :name %></th> - <th><%= Company.human_attribute_name :registrar %></th> + <th><%= Company.human_attribute_name :employees %></th> <th><%= sort_link @q, :city %></th> <th><%= sort_link @q, :projects_count %></th> </tr> @@ -19,9 +19,7 @@ <%= company.name %> </td> <td> - <% if company.registrar.present? %> - <%= company.registrar.full_name %> - <% end %> + <%= company.employees.map(&:full_name).to_sentence %> </td> <td> <%= company.city %> diff --git a/app/views/admin/course_specific_roles/component/_course_specific_role_assignments.erb b/app/views/admin/course_specific_roles/component/_course_specific_role_assignments.erb index bdf0122525c1afd3d0a301eb467df2e81ffcc672..6b8daf2366ea94684734a37f1c126382a83f0e0c 100644 --- a/app/views/admin/course_specific_roles/component/_course_specific_role_assignments.erb +++ b/app/views/admin/course_specific_roles/component/_course_specific_role_assignments.erb @@ -88,14 +88,41 @@ <% if can? :edit, resource %> <div class="collapse" id="add-course-specific-role-assignment-<%= csr.id %>"> <div class="list-group-item"> - <%= bootstrap_form_with url: addition_path, method: 'post' do |form| %> - <%= render 'admin/users/user_selection_dropdown', form: form, field_id: :user_id, - staff: other_staff, students: students, external: external %> - <%= form.submit "Add", class: 'btn btn-primary' %> - <%= form.hidden_field :csr_id, value: csr.id %> + <ul class="nav nav-tabs nav-justified mbm mtm" role="tablist"> + <li role="presentation" class="active"> + <a href="#add-course-specific-role-assignment-registered-<%= csr.id %>" + aria-controls="add-course-specific-role-assignment-registered-<%= csr.id %>" role="tab" data-toggle="tab"> + Add TU Delft User or Registered External User + </a> + </li> + <li role="presentation"> + <a href="#add-course-specific-role-assignment-unregistered-<%= csr.id %>" + aria-controls="add-course-specific-role-assignment-unregistered-<%= csr.id %>" role="tab" data-toggle="tab"> + Add Unregistered External User + </a> + </li> + </ul> + + <div class="tab-content"> + <div role="tabpanel" class="tab-pane active fade in" id="add-course-specific-role-assignment-registered-<%= csr.id %>"> + <%= bootstrap_form_with url: addition_path, method: 'post' do |form| %> + <%= render 'admin/users/user_selection_dropdown', form: form, field_id: :user_id, + staff: other_staff, students: students, external: external %> + <%= form.submit "Add", class: 'btn btn-primary' %> + <%= form.hidden_field :csr_id, value: csr.id %> + <% end %> + </div> + <div role="tabpanel" class="tab-pane fade" id="add-course-specific-role-assignment-unregistered-<%= csr.id %>"> + <%= bootstrap_form_with url: addition_path, method: 'post' do |form| %> + <%= form.text_field :name, placeholder: "Full name", required: true, value: ''%> + <%= form.email_field :email, placeholder: "someone@example.com", required: true, value: '' %> + <%= form.submit "Add", class: 'btn btn-primary' %> + <%= form.hidden_field :csr_id, value: csr.id %> + <% end %> + </div> + </div> - <% end %> </div> </div> <a class="list-group-item list-group-item--button" data-toggle="collapse" diff --git a/app/views/companies/index.html.erb b/app/views/companies/index.html.erb index 792697f1aac30d513d82a561d4d28590a0675fe8..ba2c2e7075c2592a1da3de34124b80d549a4afe0 100644 --- a/app/views/companies/index.html.erb +++ b/app/views/companies/index.html.erb @@ -16,7 +16,7 @@ <% end %> <form action="<%= new_company_path %>"> <%= button_tag glyphicon_text(:pencil, "Create #{@company_name.capitalize}"), class: 'btn btn-warning', disabled: !can_create_company %> - <% if !current_user.role_student? || current_user.involved_companies(%i[employee registrar unconfirmed_employee]).any? %> + <% if !current_user.role_student? || current_user.involved_companies(%i[employee unconfirmed_employee]).any? %> <%= modal_button "Join #{@company_name.capitalize}", 'join-company', class: 'btn btn-primary' %> <% end %> </form> @@ -35,6 +35,6 @@ <%= render 'companies/index/research_groups_list' %> <% end %> -<% if !current_user.role_student? || current_user.involved_companies(%i[employee registrar unconfirmed_employee]).any? %> +<% if !current_user.role_student? || current_user.involved_companies(%i[employee unconfirmed_employee]).any? %> <%= render 'companies/modals/modal_join_company' %> <% end %> \ No newline at end of file diff --git a/app/views/companies/modals/_modal_join_company.html.erb b/app/views/companies/modals/_modal_join_company.html.erb index 0d6fb0b6e9e76c03bfa42e299122441d5cd86bf1..c2bdea1db1317adda017731dd5426a6f2fcb4410 100644 --- a/app/views/companies/modals/_modal_join_company.html.erb +++ b/app/views/companies/modals/_modal_join_company.html.erb @@ -28,13 +28,13 @@ <%= bootstrap_form_tag url: join_companies_url, method: :post do |f| %> <div class="col-md-6 no-padding" id="form-div"> <%= f.collection_select :company, - Company.without_role(%i[registrar employee unconfirmed_employee], current_user), + Company.without_role(%i[employee unconfirmed_employee], current_user), :id, :name, { prompt: true, placeholder: "Select Company", skip_label: true }, { required: true, id: 'company-select' } %> </div> - <%= f.hidden_field "disabled_options", value: Company.without_role(%i[registrar employee unconfirmed_employee], current_user).where(allow_to_join: false).ids %> + <%= f.hidden_field "disabled_options", value: Company.without_role(%i[employee unconfirmed_employee], current_user).where(allow_to_join: false).ids %> <div class="col-md-6"> <%= f.submit "Join #{current_user.company_name.capitalize}", class: 'btn btn-primary' %> </div> diff --git a/app/views/course_editions/preferences/_preferences_logic.html.erb b/app/views/course_editions/preferences/_preferences_logic.html.erb index 878732447fad034d94f14774021a60147d49ee88..af57916984383801b7a1171725df306c9730b57e 100644 --- a/app/views/course_editions/preferences/_preferences_logic.html.erb +++ b/app/views/course_editions/preferences/_preferences_logic.html.erb @@ -96,5 +96,39 @@ update: markDirty }); <% end %> + + $('.toggle-interest-list').click(function () { + let btn = $(this); + let icon = btn.find('i'); + icon.addClass('fa-beat'); + btn.removeClass('show-on-parent-hover'); + + let interested = btn.data('interested'); + let url = btn.data('url'); + + $.ajax({ + type: interested ? 'DELETE' : 'POST', + url: url, + data: {authenticity_token: window._token}, + dataType: 'text' + }).done(function () { + if (interested) { + icon.removeClass('fa-solid'); + icon.addClass('fa-regular'); + btn.addClass('show-on-parent-hover'); + } else { + icon.removeClass('fa-regular'); + icon.addClass('fa-solid'); + } + + btn.data('interested', !interested); + + icon.removeClass('fa-beat'); + }).fail(function (e) { + console.log(e); + showResultMsg('Unable to ' + (interested ? 'leave' : 'join') + ' interest list', 'red'); + icon.removeClass('fa-beat'); + }); + }); }); </script> \ No newline at end of file diff --git a/app/views/course_editions/project_preferences/index.html.erb b/app/views/course_editions/project_preferences/index.html.erb index 71d4c43299c0a4830037d3fca18198cf20b7f77d..85cb59d32f5d33633a2e42fd912039294d5e290f 100644 --- a/app/views/course_editions/project_preferences/index.html.erb +++ b/app/views/course_editions/project_preferences/index.html.erb @@ -97,15 +97,18 @@ </div> <div class="panel-body sortable"> <% @projects.each_with_index do |project, index| %> - <span class="list-group-item" data-id="<%= project.id %>"> + <span class="list-group-item show-on-parent-hover-parent" data-id="<%= project.id %>"> <%# Show the number and a link to the project (opens in new tab) %> <span class='numbered'><%= index + 1 %></span> <a href="<%= course_edition_project_path(@course_edition, project) %>" target="_blank"> <%= project.last_approved_version_or_current.name %> - <% if project.interested_users.include?(current_user) %> - <%= popover "You have joined the Interest List of this #{project_name}", icon: icon(:fas, :star) %> - <% end %> + </a> + <% interested = project.interested_users.include?(current_user) %> + <a href="javascript:void(0)" class="<%= interested ? '' : 'show-on-parent-hover' %> toggle-interest-list" + data-interested="<%= interested %>" + data-url="<%= course_edition_project_interest_path(project.course_edition, project) %>"> + <i class="<%= interested ? 'fa-solid' : 'fa-regular' %> fa-star"></i> </a> <%# Show a green badge at the end if the project has an interested coach. %> diff --git a/app/views/course_editions/projects/groups/index/_group.html.erb b/app/views/course_editions/projects/groups/index/_group.html.erb index 5e2418f9631faf6f851e3c34e5045322d3b7b48b..077fee0ab394acb36aebb984022bc078762d782e 100644 --- a/app/views/course_editions/projects/groups/index/_group.html.erb +++ b/app/views/course_editions/projects/groups/index/_group.html.erb @@ -5,54 +5,58 @@ <div class="panel-heading"> <i><%= group.name %></i> (<%= group.memberships.count %> / <%= @course_edition.configuration.max_group_size %> students) </div> - <div class="panel-body"> - <table class="table table-condensed"> - <thead> - <tr> - <th>Name</th> - <th>Role</th> - </tr> - </thead> - <tbody> - <% group.memberships.includes(:user).each do |membership| %> - <% user = membership.user %> - <% if user == current_user %> - <%= render 'course_editions/projects/groups/modals/leave_group', group: group, membership: group.memberships.find_by(user: current_user) %> - <% end %> - <tr> - <td> - <%= user.full_name %> - </td> - <td> - <%= group_role_status_label membership.role, membership.human_enum(:role) %> - </td> - </tr> - <% end %> - </tbody> - </table> - <% if group.user_course_specific_roles.any? %> + <% if group.open? || + group.users.include?(current_user) || current_user.has_role?(:coach, group) || + can?(:read_detailed, @project) %> + <div class="panel-body"> <table class="table table-condensed"> <thead> <tr> - <th>Roles</th> + <th>Name</th> + <th>Role</th> </tr> </thead> <tbody> - <% group.user_course_specific_roles.each do |ucsr| %> - <tr> - <td > - <%= colored_label (ucsr.course_specific_role.role_type == 'coach' ? :primary : :success), - ucsr.course_specific_role.name %> - </td> - <td> - <%= ucsr.user.full_name %> - </td> - </tr> + <% group.memberships.includes(:user).each do |membership| %> + <% user = membership.user %> + <% if user == current_user %> + <%= render 'course_editions/projects/groups/modals/leave_group', group: group, membership: group.memberships.find_by(user: current_user) %> + <% end %> + <tr> + <td> + <%= user.full_name %> + </td> + <td> + <%= group_role_status_label membership.role, membership.human_enum(:role) %> + </td> + </tr> <% end %> </tbody> </table> - <% end %> - </div> + <% if group.user_course_specific_roles.any? %> + <table class="table table-condensed"> + <thead> + <tr> + <th>Roles</th> + </tr> + </thead> + <tbody> + <% group.user_course_specific_roles.each do |ucsr| %> + <tr> + <td > + <%= colored_label (ucsr.course_specific_role.role_type == 'coach' ? :primary : :success), + ucsr.course_specific_role.name %> + </td> + <td> + <%= ucsr.user.full_name %> + </td> + </tr> + <% end %> + </tbody> + </table> + <% end %> + </div> + <% end %> <% if group.looking_for_members %> <div class="txt-center mbm"> <%= glyphicon_text(:alert, t('.alert_looking_for_members')) %> diff --git a/app/views/course_editions/projects/shared/_interest_list.html.erb b/app/views/course_editions/projects/shared/_interest_list.html.erb index b8020081ad2e086972d62e369322ab8121236a23..e448758f04fda6a4d69bb723f13188f7e557977a 100644 --- a/app/views/course_editions/projects/shared/_interest_list.html.erb +++ b/app/views/course_editions/projects/shared/_interest_list.html.erb @@ -25,13 +25,24 @@ <!-- The interest list also allows existing groups that are not at the maximum limit to invite you into their group. --></p> <% end %> - <% if @project.interested_students.any? %> - <h3>Interested Users</h3> - <% @project.interested_students.each do |user| %> - <%= user.full_name %> (<%= user.email %>)<br> + <% if !@course_edition.configuration.project_preference && @course_edition.configuration.max_group_size > 1 %> + <% if @project.interested_students.any? %> + <h3>Interested Users</h3> + <% @project.interested_students.each do |user| %> + <%= user.full_name %> (<%= user.email %>)<br> + <% end %> + <% else %> + <strong>No users have signed up for the interest list of this <%= project_name %>.</strong> <% end %> <% else %> - <strong>No users have signed up for the interest list of this <%= project_name %>.</strong> + <p> + <strong><%= pluralize(@project.interested_students.size, 'student') %></strong> + <%= @project.interested_students.size == 1 ? 'has' : 'have' %> + signed up for the interest list of this <%= project_name %>. + </p> + <% if current_user.role_student? && @project.interested_users.include?(current_user) %> + <p><strong>You have joined the interest list.</strong></p> + <% end %> <% end %> </div> </div> diff --git a/app/views/dashboards/show/_organizations.html.erb b/app/views/dashboards/show/_organizations.html.erb index ef20e4dde0a9e6fc3d53b50a7f658e1c3be49cd1..61004c0f700da33557c9c2ae81a3606bfa23c55c 100644 --- a/app/views/dashboards/show/_organizations.html.erb +++ b/app/views/dashboards/show/_organizations.html.erb @@ -33,7 +33,7 @@ <div class="btn-group" role="group"> <%= link_to glyphicon_text('briefcase', "Overview"), companies_path, class: 'btn btn-info' %> <%= link_to glyphicon_text(:pencil, "Create #{current_user.company_name.capitalize}"), new_company_path, class: 'btn btn-warning' %> - <% if !current_user.role_student? || current_user.involved_companies(%i[employee registrar unconfirmed_employee]).any? %> + <% if !current_user.role_student? || current_user.involved_companies(%i[employee unconfirmed_employee]).any? %> <%= modal_button "Join #{current_user.company_name.capitalize}", 'join-company', class: 'btn btn-primary' %> <% end %> </div> @@ -42,6 +42,6 @@ </div> -<% if !current_user.role_student? || current_user.involved_companies(%i[employee registrar unconfirmed_employee]).any? %> +<% if !current_user.role_student? || current_user.involved_companies(%i[employee unconfirmed_employee]).any? %> <%= render 'companies/modals/modal_join_company' %> <% end %> \ No newline at end of file diff --git a/app/views/generic_projects/_course_specific_role_selection.erb b/app/views/generic_projects/_course_specific_role_selection.erb index e3c5e130d2b462bddc3037503ace6e803189b63a..5e434df3dec914700fe15fe5cf9f0ce49b77e607 100644 --- a/app/views/generic_projects/_course_specific_role_selection.erb +++ b/app/views/generic_projects/_course_specific_role_selection.erb @@ -4,10 +4,13 @@ Required fields: * @specific_project: the resource which roles should be assigned to - Required parameters: + Optional parameters: * f: the form modifying a resource with course-specific role assignments + (if unset, the assignments are read-only) %> +<% f ||= nil %> + <% unless @specific_project.course_edition.course_specific_roles.none? %> <div class="row"> <% @specific_project.course_edition.course_specific_roles.each do |csr| %> @@ -29,21 +32,29 @@ </p> <div class="list-group"> + <% has_assignments = false %> <% @specific_project.user_course_specific_roles.each do |ucsr| %> <% next if ucsr.course_specific_role_id != csr.id %> + <% has_assignments = true %> <div class="nested-fields list-group-item"> <%# If the role has been entered by a client, do not show the real name, but the name that the client has entered %> <%= ucsr.unregistered_name || ucsr.user.name %> (<%= ucsr.real_user ? ucsr.user.email : ucsr.unregistered_email %>) </div> <% end %> - <a class="list-group-item list-group-item--button add_fields cocoon" data-association-insertion-node="this" - data-association="<%= csr.name %>" data-associations="<%= csr.name %>s" id="<%= csr.name %>_add" data-association-insertion-template=" - <%= CGI.escapeHTML(render_association("new_"+ csr.name + "s", f, User.new, 'f', - { wrapper: 'inline', locals: { course_role_id: csr.id } }, - 'generic_projects/course_specific_role_field').to_str).html_safe %> - " href="#"> - <%= glyphicon_text('plus-sign', 'Add user') %> + <% if f %> + <a class="list-group-item list-group-item--button add_fields cocoon" data-association-insertion-node="this" + data-association="<%= csr.name %>" data-associations="<%= csr.name %>s" id="<%= csr.name %>_add" data-association-insertion-template=" + <%= CGI.escapeHTML(render_association("new_"+ csr.name + "s", f, User.new, 'f', + { wrapper: 'inline', locals: { course_role_id: csr.id } }, + 'generic_projects/course_specific_role_field').to_str).html_safe %> + " href="#"> + <%= glyphicon_text('plus-sign', 'Add user') %> + <% elsif !has_assignments %> + <div class="nested-fields list-group-item"> + <span class="txt-italic">No users</span> + </div> + <% end %> </a> </div> diff --git a/app/views/generic_projects/_form.html.erb b/app/views/generic_projects/_form.html.erb index 16391898a7e6df168cdf51b946e23da696191886..f0b112b6e7d819eda00d78e6cd23bd3bc6ed7e3b 100644 --- a/app/views/generic_projects/_form.html.erb +++ b/app/views/generic_projects/_form.html.erb @@ -2,19 +2,42 @@ <%# Project is the recurring project, show warning and option to transfer changes to other projects %> <% if !f.object.new_record? && @specific_project.course_edition.recurrent %> - <div class="alert alert-warning"> - <strong>You are currently modifying the recurrent version of this <%= project_name %>!</strong> - <br/> - <br/> - If you want the changes to also apply to current instances of the <%= project_name %>, you can select them here: - <%= f.collection_select :projects_modify, - Project.where(course_edition: CourseEdition.descendants_of(@specific_project.course_edition), original_project_id: @project.id) - .accessible_by(current_ability, :update), - :id, - ->(project) { "#{project.name} (#{project.course_edition.display_name})" }, - { required: false, hide_label: true }, - multiple: true, class: 'selectize' %> - </div> + <% modifiable_projects = Project.where(course_edition: CourseEdition.descendants_of(@specific_project.course_edition), + original_project_id: @project.id) + .accessible_by(current_ability, :update) %> + <% if modifiable_projects.any? %> + <div class="panel panel-warning"> + <div class="panel-heading"> + <p><strong>You are currently modifying the recurrent version of this <%= project_name %></strong></p> + <p>If you want the changes to also apply to current instances of the <%= project_name %>, you can select them + here:</p> + </div> + <div class="list-group c-dkgray"> + <label class="list-group-item txt-normal"> + <input class="disabled" type="checkbox" checked="checked" onclick="return false;"> + <span class="badge"> + <% if @specific_project.deactivated? %> + Recurrence paused + <% else %> + Recurrent + <% end %> + </span> + <strong><%= @project.display_name %></strong> + <%= project_status_tag @specific_project %><br> + (base version currently being edited) + </label> + <% modifiable_projects.each do |descendent_project| %> + <label class="list-group-item plx txt-normal"> + <input type="checkbox" name="generic_project[projects_modify][]" value="<%= descendent_project.id %>"> + <strong><%= descendent_project.display_name %></strong> + <%= project_status_tag descendent_project %> + <br> + in <%= render 'generic_projects/course_edition_short_details', course_edition: descendent_project.course_edition %> + </label> + <% end %> + </div> + </div> + <% end %> <% end %> <%# Project is copied from a recurring project, show warning and button to edit the recurring version instead. %> diff --git a/app/views/generic_projects/index.html.erb b/app/views/generic_projects/index.html.erb index 53e3cf90075ff3e763fe8c1251e1a1ed358d44af..5234fb5283d61d00247965700092854741bfabbd 100644 --- a/app/views/generic_projects/index.html.erb +++ b/app/views/generic_projects/index.html.erb @@ -3,7 +3,7 @@ <p>Overview of the <%= current_user.project_name %> proposals you or your organisation have created.</p> <% end %> -<% if !current_user.role_student? || current_user.involved_companies(%i[employee registrar unconfirmed_employee]).any? %> +<% if !current_user.role_student? || current_user.involved_companies(%i[employee unconfirmed_employee]).any? %> <%= render 'projects/index/new_proposal' %> <% end %> diff --git a/app/views/generic_projects/show/_information.html.erb b/app/views/generic_projects/show/_information.html.erb index 67ff6d1eecc51af686fc40a0dc448850c05df584..26b3f216be3da053d79e5229dd39789d72202b27 100644 --- a/app/views/generic_projects/show/_information.html.erb +++ b/app/views/generic_projects/show/_information.html.erb @@ -105,30 +105,40 @@ <% end %> </table> <div class="panel-body"> - <table class="table table-condensed"> - <thead> - <tr> - <th>Contact</th> - <th>E-mail</th> - </tr> - </thead> - <tbody> - <% User.with_role(:client, @project).each do |client| %> + <div class="panel panel-default mtl"> + <div class="panel-heading"> + Roles + </div> + <div class="panel-body"> + <%= render 'generic_projects/course_specific_role_selection' %> + + <table class="table table-condensed"> + <thead> <tr> - <td> <%= client.name %> </td> - <td> <%= client.email %> </td> + <th>Contact</th> + <th>E-mail</th> </tr> + </thead> + <tbody> + <% User.with_role(:client, @project).each do |client| %> + <tr> + <td> <%= client.name %> </td> + <td> <%= client.email %> </td> + </tr> + <% end %> + </tbody> + </table> + + <% if current_user.has_role?(:client, @project) %> + <% unless User.with_role(:client, @project).size == 1 %> + <%= glyphicon_link_to :plus, 'Stop being a Contact', '#stop-contact', class: 'btn btn-danger', 'data-toggle' => 'modal' %> + <%= render partial: 'projects/show/modals/stop_contact' %> + <% end %> + <% elsif !@project.offerer.user? && @project.offerer.involved?(current_user) %> + <%= glyphicon_link_to :plus, 'Become a Contact', '#become-contact', class: 'btn btn-primary', 'data-toggle' => 'modal' %> + <%= render partial: 'projects/show/modals/contact' %> <% end %> - </tbody> - </table> - <% if current_user.has_role?(:client, @project) %> - <% unless User.with_role(:client, @project).size == 1 %> - <%= glyphicon_link_to :plus, 'Stop being a Contact', '#stop-contact', class: 'btn btn-danger', 'data-toggle' => 'modal' %> - <%= render partial: 'projects/show/modals/stop_contact' %> - <% end %> - <% elsif !@project.offerer.user? && @project.offerer.involved?(current_user) %> - <%= glyphicon_link_to :plus, 'Become a Contact', '#become-contact', class: 'btn btn-primary', 'data-toggle' => 'modal' %> - <%= render partial: 'projects/show/modals/contact' %> - <% end %> + </div> + </div> </div> </div> diff --git a/app/views/offerers/show.html.erb b/app/views/offerers/show.html.erb index a6916b6dbd3e813fc6e1c80630b870b72459b252..8ce6f13e471e2d2086887849b484c4e0a948e2fc 100644 --- a/app/views/offerers/show.html.erb +++ b/app/views/offerers/show.html.erb @@ -9,7 +9,7 @@ <%= render 'offerers/show/description' %> -<% if !@specific_offerer.is_a?(Company) || current_user.has_any_role?( { name: :employee, resource: @specific_offerer }, { name: :registrar, resource: @specific_offerer })%> +<% if !@specific_offerer.is_a?(Company) || current_user.has_role?(:employee, @specific_offerer) %> <%= render 'offerers/show/location_information' %> <%= render 'offerers/show/contact_information' %> @@ -17,6 +17,6 @@ <%= render 'offerers/show/projects' %> -<% if !@specific_offerer.is_a?(Company) || current_user.has_any_role?( { name: :employee, resource: @specific_offerer }, { name: :registrar, resource: @specific_offerer })%> +<% if !@specific_offerer.is_a?(Company) || current_user.has_role?(:employee, @specific_offerer) %> <%= render 'offerers/show/employees' %> <% end %> \ No newline at end of file diff --git a/app/views/projects/new/_select_offerer.erb b/app/views/projects/new/_select_offerer.erb index 26afc0f700d0baa685c112092d5c1169e0e8b7ac..a970abc6de257960bd2307e133df1df6aaa213bb 100644 --- a/app/views/projects/new/_select_offerer.erb +++ b/app/views/projects/new/_select_offerer.erb @@ -67,7 +67,9 @@ <i><%= t('projects.form.offerer.types.company.not_listed_msg') %></i> </p> <p> - <%= modal_button t('projects.form.offerer.types.company.create_btn'), 'create-company', class: 'btn btn-primary' %> or + <% if can?(:create, Company) %> + <%= modal_button t('projects.form.offerer.types.company.create_btn'), 'create-company', class: 'btn btn-primary' %> or + <% end %> <%= modal_button t('projects.form.offerer.types.company.join_btn'), 'join-company', class: 'btn btn-success' %> </p> <p> diff --git a/config/locales/models/company/en.yml b/config/locales/models/company/en.yml index 38e889380039a087987480ca2987208c8cbf1357..7b2c6ee2f471e527915399f8763992285b54a047 100644 --- a/config/locales/models/company/en.yml +++ b/config/locales/models/company/en.yml @@ -16,7 +16,7 @@ en: description: Description other_information: Other information requires_nda: Requires signing of Non-Disclosure Agreement - registrar: Registrar + employees: Employees email: E-mail phone: Phone city: City diff --git a/config/locales/models/company/nl.yml b/config/locales/models/company/nl.yml index 77a798efa747b1c02ac58c28305c1f98b8869c4b..f892d25a9c51472b7a3210d3ec4cd5d4af36b226 100644 --- a/config/locales/models/company/nl.yml +++ b/config/locales/models/company/nl.yml @@ -16,7 +16,7 @@ nl: description: Beschrijving other_information: Overige informatie requires_nda: Vereist het tekenen van een geheimhoudingsovereenkomst - registrar: Registreerder + employees: Medewerkers email: E-mail phone: Telefoonnummer city: Stad diff --git a/config/locales/models/role/en.yml b/config/locales/models/role/en.yml index 136c4b21cfb654e0151d69cbf8a94863f43658eb..2183f6aaf3f3cd9585a517ff1751aeb0ada74704 100644 --- a/config/locales/models/role/en.yml +++ b/config/locales/models/role/en.yml @@ -16,7 +16,6 @@ en: course_coordinator: Course Coordinator # TODO Rename coordinator and use course_coordinator everywhere enrollment_manager: Enrollment Manager leader: Leader - registrar: Registrar employee: Employee unconfirmed_employee: Unconfirmed Employee member: Member diff --git a/config/locales/models/role/nl.yml b/config/locales/models/role/nl.yml index d053ef892b2e8902b3dc1e3215c1dc1a37da8ee8..1ab3ba962c77cf90646f43475519d6a9f307a60b 100644 --- a/config/locales/models/role/nl.yml +++ b/config/locales/models/role/nl.yml @@ -17,7 +17,6 @@ nl: course_coordinator: Vak Coordinator enrollment_manager: Inschrijvingsmanager leader: Leider - registrar: Registreerder employee: Medewerker unconfirmed_employee: Onbevestigde Medewerker member: Lid diff --git a/config/locales/views/en.yml b/config/locales/views/en.yml index 86048bfc50a475220597f398c1a11027b0781de2..3e522841d9eeca6cf6f2cb3fd7401dfb72201f69 100644 --- a/config/locales/views/en.yml +++ b/config/locales/views/en.yml @@ -14,20 +14,20 @@ Please have a look before submitting a proposal: types: user: name: Personally - description: You can make a proposal which is tied only to you personally, rather than to a company, department or organisation. + description: You can make a proposal which is tied only to you personally, rather than to a %{company_name}, department or organisation. no_project_notice: You are not offering any %{projects_name} personally. project_explanation: These are all the %{projects_name} that you are offering to students personally. company: - name: Company, Department or Organisation - description: You can make a proposal which is tied to a company, department or organisation which you are a part of. - not_listed_msg: Is the right company, department or organisation not listed? + name: '%{company_name_capitalized}, Department or Organisation' + description: You can make a proposal which is tied to a %{company_name}, department or organisation which you are a part of. + not_listed_msg: Is the right %{company_name}, department or organisation not listed? join_explanation_html: > - Some companies allow you to join directly, but you cannot see old/existing proposals until you are confirmed by another employee. - It is also possible for existing employees of the company to <a href="%{tutorial_invite_url}">invite you</a>, which will also give you full access to old/existing proposals. - create_btn: Create a Company - join_btn: Join an existing Company - no_project_notice: Your companies are not offering any %{projects_name}. - project_explanation: These are all the %{projects_name} that the companies you are a part of are offering to students. + Some %{companies_name} allow you to join directly, but you cannot see old/existing proposals until you are confirmed by another employee. + It is also possible for existing employees of the %{company_name} to <a href="%{tutorial_invite_url}">invite you</a>, which will also give you full access to old/existing proposals. + create_btn: Create a %{company_name_capitalized} + join_btn: Join an existing %{company_name_capitalized} + no_project_notice: Your %{companies_name} are not offering any %{projects_name}. + project_explanation: These are all the %{projects_name} that the %{companies_name} you are a part of are offering to students. research_group: name: Research Group description: You can make a proposal which is tied to a research group which you are a part of. @@ -169,7 +169,7 @@ will be assigned to all members of the group on the 'students' sheet automatical invite_by_email: popover: >- Allows you to invite people via their e-mail. - They will receive an invitation to register on Project Forum and a notification to join this company. + They will receive an invitation to register on Project Forum and a notification to join this %{company_name}. course_editions: projects: groups: diff --git a/config/locales/views/nl.yml b/config/locales/views/nl.yml index 261ca49aa525ed55d39d4aa0e91188e91a7f677d..f1b05ea90ab510aec7ce2c527814c140d3b881ac 100644 --- a/config/locales/views/nl.yml +++ b/config/locales/views/nl.yml @@ -13,13 +13,13 @@ Zou u deze willen lezen voor u een voorstel indient: types: user: name: Persoonlijk - description: U kunt een voorstel indienen wat aan u persoonlijk verbonden is, in plaats van bijvoorbeeld een bedrijf, afdeling of organisatie. + description: U kunt een voorstel indienen wat aan u persoonlijk verbonden is, in plaats van bijvoorbeeld een %{company_name}, afdeling of organisatie. no_project_notice: U biedt persoonlijk geen %{projects_name} aan. project_explanation: Dit zijn alle %{projects_name} die u op persoonlijke basis aanbiedt aan studenten. company: - name: Bedrijf, afdeling of organisatie - description: U kunt een voorstel indienen dat verbonden is aan een bedrijf, afdeling of organisatie waar u deel van uitmaakt. - not_listed_msg: Staat het juiste bedrijf, afdeling of organisatie hier niet bij? + name: '%{company_name_capitalized}, afdeling of organisatie' + description: U kunt een voorstel indienen dat verbonden is aan een %{company_name}, afdeling of organisatie waar u deel van uitmaakt. + not_listed_msg: Staat het juiste %{company_name}, afdeling of organisatie hier niet bij? join_explanation_html: > Sommige organisaties staan u toe om direct aan te sluiten, maar u kunt oude/bestaande voorstellen niet zien totdat u bevestigd bent door een andere medewerker. Het is ook mogelijk voor bestaande medewerkers van de organisatie om u <a href="%{tutorial_invite_url}">uit te nodigen</a>, wat u ook volledige toegang geeft tot oude/bestaande voorstellen. @@ -176,7 +176,7 @@ worden dan automatisch toegekend aan alle leden van de groep op de 'students' sh invite_by_email: popover: >- Hiermee kunt u andere mensen uitnodigen via hun email. - Zij zullen een uitnodiging ontvangen om een account te maken op Project Forum (indien nodig) en worden dan toegevoegd aan dit bedrijf. + Zij zullen een uitnodiging ontvangen om een account te maken op Project Forum (indien nodig) en worden dan toegevoegd aan dit %{company_name}. course_editions: projects: groups: diff --git a/db/migrate/20220821102031_remove_registrar_role.rb b/db/migrate/20220821102031_remove_registrar_role.rb new file mode 100644 index 0000000000000000000000000000000000000000..781d0dafc55839777686765e8a1285731e52a44e --- /dev/null +++ b/db/migrate/20220821102031_remove_registrar_role.rb @@ -0,0 +1,18 @@ +class RemoveRegistrarRole < ActiveRecord::Migration[6.1] + def up + Company.where('1=1').each do |company| + Company.transaction do + User.with_role(:registrar, company).each do |u| + u.remove_role(:registrar, company) + u.add_role(:employee, company) unless u.has_role?(:employee, company) + end + + company.roles.where(name: 'registrar').each { |r| r.destroy! } + end + end + end + + def down + # reverting is impossible but it makes no functional difference + end +end diff --git a/db/schema.rb b/db/schema.rb index 25f32574c2daa48d0d75c6f32705f1142a1a945f..fee730ea9bf9d3cd5ffe9f7a9aa53e9b16ea7dd8 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.define(version: 2022_08_08_191054) do +ActiveRecord::Schema.define(version: 2022_08_21_102031) do create_table "active_storage_attachments", force: :cascade do |t| t.string "name", null: false diff --git a/db/seeds/development/roles.seeds.rb b/db/seeds/development/roles.seeds.rb index 3102706036587a1b84ea2b2a6a811f75540c8e0b..35857026d8718b59ff1c834e7992808c8de75e44 100644 --- a/db/seeds/development/roles.seeds.rb +++ b/db/seeds/development/roles.seeds.rb @@ -29,10 +29,10 @@ after 'development:users' do ) User.external.first.add_role :client, Project.first - User.external.first.add_role :registrar, Company.first + User.external.first.add_role :employee, Company.first - User.external.first.add_role :registrar, Company.second - User.external.first.add_role :registrar, Company.third + User.external.first.add_role :employee, Company.second + User.external.first.add_role :employee, Company.third User.find_by(email: 'staff@tudelft.nl').add_role( :coach, diff --git a/test/fixtures/roles.yml b/test/fixtures/roles.yml index 6b0fd6548565494530f58642e0fb21a8e8a73253..8c1f4a21df9370b0a6a9f224bd74478b1fdcf960 100644 --- a/test/fixtures/roles.yml +++ b/test/fixtures/roles.yml @@ -6,13 +6,8 @@ # # On companies -registrar_role: - users: external - name: 'registrar' - resource: company (Company) - employee_role: - users: external_employee + users: external name: 'employee' resource: company (Company) diff --git a/test/models/company_test.rb b/test/models/company_test.rb index ba61d8f25fb00a2cc51995ab37fc7bc8f425f269..84b42b36afacee1ec05c9f5448697760982f51ad 100644 --- a/test/models/company_test.rb +++ b/test/models/company_test.rb @@ -14,8 +14,6 @@ class CompanyTest < ActiveSupport::TestCase test 'company has correct involved users' do involved = @company.involved_users user1 = users(:external) - user2 = users(:external_employee) assert_includes(involved, user1) - assert_includes(involved, user2) end end