<%= form_for(org, url: url, html: { multipart: true, method: method, id: "edit_org_profile_form" } ) do |f| %>
<div class="row">
<div class="form-group col-xs-8">
<%= f.label :name, _('Organisation full name'), class: "control-label" %>
<%= f.text_field :name, id: "org_name", class: "form-control", "aria-required": true %>
</div>
</div>
<div class="row">
<div class="form-group col-xs-8">
<%= f.label :abbreviation, _('Organisation abbreviated name'), class: "control-label" %>
<%= f.text_field :abbreviation, id: "org_abbreviation", class: "form-control", "aria-required": true %>
</div>
</div>
<div class="row">
<div class="form-group col-xs-8">
<%= f.label :logo, _('Organization logo'), class: "control-label" %>
<% if org.logo.present? %>
<div class="clearfix"></div>
<%= image_tag org.logo.url, alt: "#{org.name} #{_('logo')}" %>
<div class="org-logo-controls checkbox">
<%= f.label :remove_logo do %>
<%= f.check_box :remove_logo,
title: _("This will remove your organisation's logo") %>
<%= _('Remove logo') %>
<% end %>
<strong> - <%= _('or') %> - </strong>
<span class="btn btn-default btn-file"><%= f.file_field :logo %></span>
</div>
<% else %>
<%= f.file_field :logo %>
<% end %>
</div>
</div>
<div class="row">
<div class="col-xs-8">
<%= render(partial: '/shared/links',
locals: {
context: 'org',
title: _('Organisation URLs'),
links: (org.links.present? ? org.links['org'] : []),
max_number_links: MAX_NUMBER_LINKS_FUNDER,
tooltip: _('Links will be displayed next to your organisation\'s logo') }) %>
<%= hidden_field_tag('org_links', value: org.links) %>
</div>
</div>
<div class="row">
<div class="form-group col-xs-8">
<h3><%= _("Administrator contact") %></h3>
</div>
</div>
<div class="row">
<div class="form-group col-xs-4">
<%= f.label :contact_email, _('Contact email'), class: "control-label" %>
<%= f.email_field :contact_email, class: "form-control", 'aria-required': true %>
</div>
<div class="form-group col-xs-4">
<%= f.label :contact_name, _('Link text'), class: "control-label" %>
<%= f.text_field :contact_name, class: "form-control" %>
</div>
</div>
<div class="bordered col-xs-8" data-toggle="tooltip" title="<%= _('This information can only be changed by a system administrator. Contact the Help Desk if you have questions or to request changes.') %>">
<h3><%= _('Organisational Configuration Information') %></h3>
<% if current_user.can_super_admin? %>
<% if Rails.application.config.shibboleth_use_filtered_discovery_service %>
<% shibboleth = org.org_identifiers.select{ |ids| ids.identifier_scheme == IdentifierScheme.find_by(name: 'shibboleth')} %>
<% shib_id = (shibboleth.first.present? ? shibboleth.first.identifier : '') %>
<% shib_domain = shibboleth.first.present? ? (shibboleth.first.attrs.present? ? JSON.parse(shibboleth.first.attrs)['domain'] : '') : '' %>
<div class="row">
<div class="form-group col-xs-8">
<%= f.label :shib_id, _('Shibboleth Entity Id'), class: "control-label" %>
<%= text_field_tag :shib_id, shib_id, class: "form-control", placeholder: _('Example: urn:mace:incommon:my-org.org') %>
</div>
</div>
<div class="row">
<div class="form-group col-xs-8">
<%= f.label :shib_domain, _('Shibboleth Domain'), class: "control-label" %>
<%= text_field_tag :shib_domain, shib_domain, class: "form-control", placeholder: _('Example: my-org.org') %>
</div>
</div>
<% end %>
<div class="row">
<fieldset class="col-xs-8">
<legend><%= _('Organisation Types') %></legend>
<div class="checkbox">
<%= f.label :funder do %>
<%= check_box_tag :funder, 2, org.funder?, class: 'org_types' %>
<%= _('Funder') %>
<% end %>
</div>
<div class="checkbox">
<%= f.label :institution do %>
<%= check_box_tag :institution, 1, org.institution?, class: 'org_types' %>
<%= _('Institution') %>
<% end %>
</div>
<div class="checkbox">
<%= f.label :organisation do %>
<%= check_box_tag :organisation, 4, org.organisation?, class: 'org_types' %>
<%= _('Organisation') %>
<% end %>
</div>
<%= f.hidden_field :org_type, data: {
validation: 'text',
validation_error: _('You must select at least one organisation type') }
%>
</fieldset>
</div>
<% else %>
<dl>
<dt><%= _('Organisation type(s)') %></dt>
<dd><%= org.org_type_to_s %></dd>
</dl>
<% end %>
</div>
<div class="row">
<div class="form-group col-xs-8">
<%= f.button(_('Save'), id:"save_org_details_submit", class: "btn btn-primary", type: "submit") %>
</div>
</div>
<% end %>