Newer
Older
dmpopidor / app / views / devise / registrations / _external_identifier.html.erb
<% if id.nil? || id.identifier == '' %>
    <% if scheme.name.downcase == 'orcid' %>
        <%= link_to _("Create or connect your ORCID iD"),
                     Rails.application.routes.url_helpers.send("user_orcid_omniauth_authorize_path"),
                     id: "connect-orcid-button", target: '_blank',
                     title: _("ORCID provides a persistent digital identifier that distinguishes you from other researchers. Learn more at orcid.org"),
                     'data-toggle': "tooltip" %>
    <% elsif scheme.name.downcase == 'shibboleth' %>
        <i class="fa fa-user" title="<%= _('Institutional credentials') %>" aria-hidden="true"></i>
        &nbsp;
        <%= link_to _('Link your institutional credentials'),
                    Rails.application.routes.url_helpers.send("user_shibboleth_omniauth_authorize_path"),
                    title: _("Link your institutional credentials to access your account with them."),
                    'data-toggle': "tooltip" %>
    <% end %>
<% else %>
    <% if scheme.name.downcase == 'orcid' %>
        <% titletext = _("ORCID provides a persistent digital identifier that distinguishes you from other researchers. Learn more at orcid.org") %>
        <% unlinktext = _("Disconnect your account from ORCID. You can reconnect at any time.") %>
        <% unlinkconf = _("Are you sure you want to disconnect your ORCID ID?") %>
        <%= link_to "#{scheme.user_landing_url}/#{id.identifier}",
                    id: 'orcid-id',
                    target: '_blank',
                    style: 'text-decoration: none',
                    title: titletext,
                    'aria-label': titletext,
                    'data-toggle': "tooltip" do %>
            <%= image_tag "#{scheme.logo_url}", id: 'orcid-id-logo', alt: scheme.description %>
            &nbsp;
            <%= "#{scheme.user_landing_url}/#{id.identifier}" %>
        <% end %>
    <% elsif scheme.name.downcase == 'shibboleth' %>
        <% titletext  = _("Your account has been linked to your organisation. You can now login with that method.") %>
        <% unlinktext = _("Unlink your account from your organisation. You can link again at any time.") %>
        <% unlinkconf = _("Are you sure you want to unlink your institutional credentials?") %>
        <% if scheme.user_landing_url.nil? %>
            <i class="fa fa-user" title="<%= _('Institutional credentials') %>" aria-hidden="true"></i>
            &nbsp;
            <%= titletext %>
        <% else %>
            <%= link_to "#{scheme.user_landing_url}/#{id.identifier}",
                        target: '_blank',
                        style: 'text-decoration: none',
                        title: titletext,
                        'aria-label': titletext,
                        'data-toggle': "tooltip" do %>
                <i class="fa fa-user" title="<%= scheme.description %>" aria-hidden="true"></i>
                &nbsp;
                <%= titletext %>
            <% end %>
        <% end %>
    <% else %>
        <% titletext = _("Your account has been linked to #{scheme.description}.") %>
        <% if scheme.user_landing_url.nil? %>
            <% if scheme.logo_url.nil? %>
                <i class="fa fa-user" title="<%= scheme.description %>" aria-hidden="true"></i>
            <% else %>
                <%= image_tag "#{scheme.logo_url}", id: 'orcid-id-logo', alt: scheme.description %>
            <% end %>
            &nbsp;
            <%= titletext %>
        <% else %>
            <%= link_to "#{scheme.user_landing_url}/#{id.identifier}",
                        target: '_blank',
                        style: 'text-decoration: none',
                        title: titletext,
                        'aria-label': titletext,
                        'data-toggle': "tooltip" do %>
                <% if scheme.logo_url.nil? %>
                    <i class="fa fa-user" title="<%= scheme.description %>" aria-hidden="true"></i>
                <% else %>
                    <%= image_tag "#{scheme.logo_url}", id: 'orcid-id-logo', alt: scheme.description %>
                <% end %>
                &nbsp;
                <%= titletext %>
            <% end %>
        <% end %>
        <% unlinktext = _("Unlink your account from #{scheme.description}. You can link again at any time.") %>
        <% unlinkconf = _("Are you sure you want to unlink #{scheme.description} ID?") %>
    <% end %>
    <%= link_to '<i class="fa fa-fw fa-times-circle" aria-hidden="true"></i>'.html_safe,
                destroy_user_identifier_path(id),
                method: :delete,
                title: unlinktext,
                data: {confirm: unlinkconf},
                'aria-label': unlinktext,
                'data-toggle': "tooltip" %>
<% end %>