diff --git a/app/controllers/registrations_controller.rb b/app/controllers/registrations_controller.rb
index ae1542d..0f74a00 100644
--- a/app/controllers/registrations_controller.rb
+++ b/app/controllers/registrations_controller.rb
@@ -3,6 +3,8 @@
def edit
@languages = Language.all.order("name")
+ @orgs = Org.where(parent_id: nil).order("name")
+ @other_organisations = Org.where(parent_id: nil, is_other: true).pluck(:id)
end
# POST /resource
diff --git a/app/views/devise/registrations/edit.html.erb b/app/views/devise/registrations/edit.html.erb
index 0b3bdbd..9e320e7 100644
--- a/app/views/devise/registrations/edit.html.erb
+++ b/app/views/devise/registrations/edit.html.erb
@@ -37,15 +37,11 @@
| <%= t("helpers.org_type.organisation") %> |
<%= collection_select(:user,
- :org_id, Org.where("parent_id IS NULL").order("name"),
+ :org_id, @orgs,
:id, :name, {include_blank: constant("organisation_types.organisation")},
{ class: "typeahead org_sign_up" }) %> |
- <% other_organisations = Array.new %>
- <% Org.where("parent_id IS ? AND is_other = ?", nil, true).each do |org| %>
- <% other_organisations << org.id %>
- <% end %>
- ">
+
">
| <%= t("helpers.org_type.org_name")%> |
<%= f.text_field :other_organisation,
as: :string,
@@ -83,16 +79,16 @@
- <% if Rails.application.config.shibboleth_enabled %>
- <% if resource.shibboleth_id.nil? || resource.shibboleth_id.length == 0 then %>
- <%= link_to t("helpers.shibboleth_to_link_text"), user_omniauth_shibboleth_path, class: "a-orange" %>
- <% else %>
- <%= t("helpers.shibboleth_linked_text") %>
-
- <%= t("helpers.shibboleth_unlink_label")%>
-
- <% end %>
- <% end %>
+ <% if Rails.application.config.shibboleth_enabled %>
+ <% if resource.shibboleth_id.nil? || resource.shibboleth_id.length == 0 then %>
+ <%= link_to t("helpers.shibboleth_to_link_text"), user_omniauth_shibboleth_path, class: "a-orange" %>
+ <% else %>
+ <%= t("helpers.shibboleth_linked_text") %>
+
+ <%= t("helpers.shibboleth_unlink_label")%>
+
+ <% end %>
+ <% end %>
@@ -102,7 +98,7 @@
<% if devise_mapping.confirmable? && resource.pending_reconfirmation? %>
- <%= t('custom_devise.waiting_for_confirmation') %><%= resource.unconfirmed_email %>
+ <%= t('custom_devise.waiting_for_confirmation') %><%= resource.unconfirmed_email %>
<% end %>
| <%= t("helpers.current_password") %> |
|