diff --git a/app/controllers/orgs_controller.rb b/app/controllers/orgs_controller.rb index 82c83a8..6376398 100644 --- a/app/controllers/orgs_controller.rb +++ b/app/controllers/orgs_controller.rb @@ -9,7 +9,7 @@ authorize org languages = Language.all.order("name") org.links = {"org": []} unless org.links.present? - render 'admin_edit', locals: {org: org, languages: languages, method: 'PUT', + render 'admin_edit', locals: {org: org, languages: languages, method: 'PUT', url: admin_update_org_path(org) } end @@ -22,14 +22,14 @@ @org.logo = attrs[:logo] if attrs[:logo] tab = (attrs[:feedback_enabled].present? ? 'feedback' : 'profile') if params[:org_links].present? - @org.links = JSON.parse(params[:org_links]) + @org.links = JSON.parse(params[:org_links]) end - + begin # Only allow super admins to change the org types and shib info - if current_user.can_super_admin? + if current_user.can_super_admin? # Handle Shibboleth identifiers if that is enabled - if Rails.application.config.shibboleth_use_filtered_discovery_service + if Rails.application.config.shibboleth_use_filtered_discovery_service shib = IdentifierScheme.find_by(name: 'shibboleth') shib_settings = @org.org_identifiers.select{ |ids| ids.identifier_scheme == shib}.first @@ -38,7 +38,7 @@ shib_settings.identifier = params[:shib_id] shib_settings.attrs = {domain: params[:shib_domain]} shib_settings.save - else + else if shib_settings.present? # The user cleared the shib values so delete the object shib_settings.destroy @@ -46,7 +46,7 @@ end end end - + if @org.update_attributes(attrs) flash[:notice] = success_message(_('organisation'), _('saved')) redirect_to "#{admin_edit_org_path(@org)}\##{tab}" @@ -63,14 +63,14 @@ # ---------------------------------------------------------------- def shibboleth_ds redirect_to root_path unless current_user.nil? - + @user = User.new - # Display the custom Shibboleth discovery service page. + # Display the custom Shibboleth discovery service page. @orgs = Org.joins(:identifier_schemes).where('identifier_schemes.name = ?', 'shibboleth').sort{|x,y| x.name <=> y.name } - + if @orgs.empty? flash[:alert] = _('No organisations are currently registered.') - redirect_to user_shibboleth_omniauth_authorize_path + redirect_to user_shibboleth_omniauth_authorize_path end end @@ -82,12 +82,12 @@ scheme = IdentifierScheme.find_by(name: 'shibboleth') shib_entity = OrgIdentifier.where(org_id: params[:org_name], identifier_scheme: scheme) - + if !shib_entity.empty? # Force SSL url = "#{request.base_url.gsub('http:', 'https:')}#{Rails.application.config.shibboleth_login}" target = "#{user_shibboleth_omniauth_callback_url.gsub('http:', 'https:')}" - + #initiate shibboleth login sequence redirect_to "#{url}?target=#{target}&entityID=#{shib_entity.first.identifier}" else @@ -104,6 +104,6 @@ private def org_params params.require(:org).permit(:name, :abbreviation, :logo, :contact_email, :contact_name, :remove_logo, :org_type, - :feedback_enabled, :feedback_email_subject, :feedback_email_msg) + :feedback_enabled, :feedback_email_subject, :feedback_email_msg, :banner_text) end -end \ No newline at end of file +end diff --git a/app/models/org.rb b/app/models/org.rb index 80cf63d..37e68f6 100644 --- a/app/models/org.rb +++ b/app/models/org.rb @@ -31,7 +31,7 @@ :token_permission_type_ids, :language_id, :contact_email, :contact_name, :language, :org_type, :region, :token_permission_types, :guidance_group_ids, :is_other, :region_id, :logo_uid, :logo_name, - :feedback_enabled, :feedback_email_subject, :feedback_email_msg + :feedback_enabled, :feedback_email_subject, :feedback_email_msg, :banner_text ## # Validators # validates :contact_email, email: true, allow_nil: true diff --git a/app/views/layouts/_branding.html.erb b/app/views/layouts/_branding.html.erb index 896ebee..5ac32a7 100644 --- a/app/views/layouts/_branding.html.erb +++ b/app/views/layouts/_branding.html.erb @@ -47,6 +47,9 @@ <% end %> <% end %> +
+ <%= current_user.org.banner_text %> +
<% end %> diff --git a/app/views/orgs/_profile_form.html.erb b/app/views/orgs/_profile_form.html.erb index d08b0ff..9425e82 100644 --- a/app/views/orgs/_profile_form.html.erb +++ b/app/views/orgs/_profile_form.html.erb @@ -12,7 +12,7 @@ -
+
<%= f.label :logo, _('Organization logo'), class: "control-label" %> @@ -32,8 +32,15 @@
+ <%= f.label :banner_text, _('Banner text'), class: 'control-label' %> + <%= f.text_area :banner_text, class: 'form-control', 'aria-required': true %> +
+
+ +
+
<%= render(partial: '/shared/links', - locals: { + locals: { context: 'org', title: _('Organisation URLs'), links: (org.links.present? ? org.links['org'] : []), @@ -78,7 +85,7 @@ <%= text_field_tag :shib_domain, shib_domain, class: "form-control", placeholder: _('Example: my-org.org') %>
- <% end %> + <% end %>
<%= f.label _('Organisation Types'), for: :funder, class: 'control-label' %> @@ -101,10 +108,10 @@ <% end %>
- +
<%= f.button(_('Save'), id:"save_org_submit", class: "btn btn-primary", type: "submit") %>
-<% end %> \ No newline at end of file +<% end %> diff --git a/lib/assets/stylesheets/application.scss b/lib/assets/stylesheets/application.scss index d260a65..c22ff88 100644 --- a/lib/assets/stylesheets/application.scss +++ b/lib/assets/stylesheets/application.scss @@ -24,3 +24,11 @@ clear: left; margin-bottom: 10px; } + +.org-banner-text { + display: inline; + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); +}