diff --git a/app/controllers/public_pages_controller.rb b/app/controllers/public_pages_controller.rb index 081b19c..de6a531 100644 --- a/app/controllers/public_pages_controller.rb +++ b/app/controllers/public_pages_controller.rb @@ -76,8 +76,8 @@ @phases = Phase.includes(sections: :questions).where(id: a_p_ids).order(:number) # name of owner and any co-owners @creator_text = @plan.owner.name(false) - @plan.roles.administrator.not_creator.each do |co_owner| - @creator_text += ", " + co_owner.name(false) + @plan.roles.administrator.not_creator.each do |role| + @creator_text += ", " + role.user.name(false) end # Org name of plan owner @affiliation = @plan.owner.org.name diff --git a/app/views/devise/registrations/_personal_details.html.erb b/app/views/devise/registrations/_personal_details.html.erb index 94ffde3..c928f7f 100644 --- a/app/views/devise/registrations/_personal_details.html.erb +++ b/app/views/devise/registrations/_personal_details.html.erb @@ -28,25 +28,7 @@ <%= f.password_field(:password, class: "form-control", "aria-required": true) %> -
- <%= f.label(:org_name, _('Organisation'), class: 'control-label') %> - <%= render partial: "shared/accessible_combobox", - locals: {name: "#{resource_name}[org_name]", - id: "#{resource_name}_org_name", - default_selection: @default_org, - models: @orgs, - attribute: 'name'} %> - - - - <% other_organisations = Org.where("parent_id IS ? AND is_other = ?", nil, true).pluck(:id) %> -
- <%= f.label _('Organisation name'), for: :other_organisation, class: 'control-label' %> - <%= f.text_field :other_organisation, :autocomplete => "off", class: "form-control", 'data-toggle' => "tooltip", 'title': _('Please enter the name of your organisation.') %> -
-
+ <%= render partial: "shared/org_dropdown", locals: {f: f, default_org: @default_org, orgs: @orgs, allow_other_orgs: true} %> <% if MANY_LANGUAGES %>
diff --git a/app/views/shared/_org_dropdown.html.erb b/app/views/shared/_org_dropdown.html.erb new file mode 100644 index 0000000..f186af4 --- /dev/null +++ b/app/views/shared/_org_dropdown.html.erb @@ -0,0 +1,25 @@ +<% others = allow_other_orgs ||= false %> +<% left_size = (others ? 5 : 8) %> + +
+ <%= f.label :org_name, _('Organisation'), class: 'control-label' %> + <%= render partial: "shared/accessible_combobox", + locals: {name: "user[org_name]", + id: "user_org_name", + default_selection: default_org, + models: orgs, + attribute: 'name'} %> + + <% if others %> + <%= f.text_field :other_organisation, autocomplete: "off", class: "form-control hide", + placeholder: _('Please enter the name of your organisation') %> + <% end %> +
+ +<% if others %> +
+ +
+<% end %> diff --git a/lib/assets/javascripts/utils/autoComplete.js b/lib/assets/javascripts/utils/autoComplete.js index 83376fb..50c3658 100644 --- a/lib/assets/javascripts/utils/autoComplete.js +++ b/lib/assets/javascripts/utils/autoComplete.js @@ -52,6 +52,9 @@ debounced($(el)); }); + // add a Bootstrap 'hide' class to the invisible help text + $('.invisible').addClass('hide'); + // Show/hide the clear button on page load toggleClearButton(el);