Skip to content

Commit

Permalink
Add usage info popup for visibility. Fixes #514
Browse files Browse the repository at this point in the history
  • Loading branch information
jcoyne committed Dec 4, 2015
1 parent 4946c73 commit f7f683c
Show file tree
Hide file tree
Showing 9 changed files with 67 additions and 3 deletions.
2 changes: 2 additions & 0 deletions app/assets/javascripts/curation_concerns/curation_concerns.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,7 @@ Blacklight.onLoad(function() {
$('abbr').tooltip();

$("[data-toggle='dropdown']").dropdown();
$('a[data-toggle="popover"]').popover({ html: true })
.click(function() { return false });

});
1 change: 1 addition & 0 deletions app/assets/stylesheets/curation_concerns/_modules.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@
@import 'modules/site_search';
@import 'modules/pagination';
@import 'modules/embargoes';
@import 'modules/icons';

3 changes: 0 additions & 3 deletions app/assets/stylesheets/curation_concerns/help_requests.scss

This file was deleted.

11 changes: 11 additions & 0 deletions app/assets/stylesheets/curation_concerns/modules/icons.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.large-icon {
font-size: 1.5em;
}

.help-icon {
@extend .glyphicon;
@extend .glyphicon-question-sign;
@extend .large-icon;
top: 5px;
}

1 change: 1 addition & 0 deletions app/helpers/curation_concerns/main_app_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ module CurationConcerns::MainAppHelpers
include CurationConcerns::EmbargoHelper
include CurationConcerns::LeaseHelper
include CurationConcerns::CollectionsHelper
include CurationConcerns::PermissionsHelper
end
20 changes: 20 additions & 0 deletions app/helpers/curation_concerns/permissions_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
module CurationConcerns
module PermissionsHelper
def help_link(file, title, aria_label)
link_to help_icon, '#', 'data-toggle': 'popover', 'data-content': capture_content(file),
'data-original-title': title, 'aria-label': aria_label
end

private

def capture_content(file)
capture do
render file
end
end

def help_icon
content_tag 'i', '', 'aria-hidden': true, class: 'help-icon'
end
end
end
3 changes: 3 additions & 0 deletions app/views/curation_concerns/base/_form_permission.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
<legend>
Visibility
<small>Who should be able to view or download this content?</small>
<span id="visibility_tooltip" class="h5">
<%= help_link 'visibility', 'Visibility', 'Usage information for visibility' %>
</span>
</legend>
<%= render "form_permission_note" %>
Expand Down
17 changes: 17 additions & 0 deletions app/views/curation_concerns/base/_visibility.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<p>This setting will determine who can view your file, and the associated metadata. Setting
the visibility to <span class='label label-success'>Open Access</span> will allow your
content to be discovered in Google and viewed by anyone. The visibility setting
<span class='label label-info'><%=t('curation_concerns.institution_name') %></span> will only allow
users who are logged into <%=t('curation_concerns.product_name') %> (via WebAccess) to view the content.
Files that are marked <span class='label label-danger'>Private</span> are only able to be viewed
by users and/or groups that have been given specific access in the &quot;Share With&quot; section.
</p>

<p>
Permissions in <%=t('curation_concerns.product_name') %> are hierarchical. This means that you cannot set
the visibility of a file to <span class='label label-success'>Open Access</span> or
<span class='label label-info'><%=t('curation_concerns.institution_name') %></span> and simultaneously
try to restrict the access of a single user. However, you may mark the visibility of
a file as <span class='label label-danger'>Private</span> and then grant access to
particular users and/or groups for that file in the &quot;Share With&quot; section.
</p>
12 changes: 12 additions & 0 deletions spec/helpers/curation_concerns/permissions_helper_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
require 'spec_helper'

describe CurationConcerns::PermissionsHelper do
describe "#help_link" do
subject { helper.help_link 'curation_concerns/base/visibility', 'Visibility', 'Usage information for visibility' }

it "draws help_icon" do
expect(subject).to match(/data-content="<p>This setting will determine who can view your file/)
expect(subject).to have_selector 'a i.help-icon'
end
end
end

0 comments on commit f7f683c

Please sign in to comment.