sufia 0.0.5 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. data/Gemfile +2 -1
  2. data/README.md +6 -2
  3. data/app/assets/javascripts/sufia.js +1 -0
  4. data/app/assets/javascripts/sufia/trophy.js +26 -0
  5. data/app/assets/stylesheets/sufia.css.scss +1 -0
  6. data/app/assets/stylesheets/trophy.css +7 -0
  7. data/app/controllers/batch_controller.rb +1 -1
  8. data/app/controllers/batch_edits_controller.rb +3 -3
  9. data/app/controllers/single_use_link_controller.rb +9 -17
  10. data/app/controllers/users_controller.rb +33 -4
  11. data/app/helpers/generic_file_helper.rb +57 -5
  12. data/{lib/devise/models/http_header_authenticatable.rb → app/helpers/trophy_helper.rb} +11 -13
  13. data/app/models/datastreams/batch_rdf_datastream.rb +0 -1
  14. data/app/models/datastreams/generic_file_rdf_datastream.rb +0 -1
  15. data/app/models/trophy.rb +12 -0
  16. data/app/views/_user_util_links.html.erb +1 -1
  17. data/app/views/batch/edit.html.erb +2 -2
  18. data/app/views/batch_edits/{_delete_selected → _delete_selected.html.erb} +1 -1
  19. data/app/views/batch_edits/_metadata.html.erb +16 -15
  20. data/app/views/batch_edits/edit.html.erb +15 -23
  21. data/app/views/catalog/_recent_document.html.erb +2 -5
  22. data/app/views/dashboard/_index_partials/_default_group.html.erb +1 -1
  23. data/app/views/dashboard/_index_partials/_list_files.html.erb +7 -3
  24. data/app/views/dashboard/index.html.erb +7 -7
  25. data/app/views/error/404.html.erb +1 -1
  26. data/app/views/error/500.html.erb +1 -1
  27. data/app/views/generic_files/_descriptions.html.erb +3 -18
  28. data/app/views/generic_files/_field_form.html.erb +17 -0
  29. data/app/views/generic_files/_rights_modal.html.erb +1 -1
  30. data/app/views/generic_files/edit_fields/_default.html.erb +7 -0
  31. data/app/views/generic_files/edit_fields/_description.html.erb +6 -0
  32. data/app/views/generic_files/edit_fields/_rights.html.erb +8 -0
  33. data/app/views/generic_files/edit_fields/_suffix.html.erb +9 -0
  34. data/app/views/generic_files/edit_fields/_type.html.erb +9 -0
  35. data/app/views/single_use_link/show.html.erb +5 -11
  36. data/app/views/static/versions.html.erb +14 -0
  37. data/app/views/users/_trophy_edit.html.erb +21 -0
  38. data/app/views/users/edit.html.erb +3 -0
  39. data/app/views/users/index.html.erb +1 -1
  40. data/app/views/users/show.html.erb +9 -2
  41. data/config/locales/sufia.en.yml +24 -0
  42. data/config/routes.rb +8 -6
  43. data/features/support/cleanup.rb +2 -2
  44. data/lib/generators/sufia/sufia_generator.rb +1 -1
  45. data/lib/generators/sufia/templates/config/sufia.rb +0 -37
  46. data/lib/generators/sufia/templates/migrations/create_trophies.rb +10 -0
  47. data/lib/sufia/downloads_controller_behavior.rb +7 -9
  48. data/lib/sufia/files_controller_behavior.rb +4 -4
  49. data/lib/sufia/generic_file.rb +21 -27
  50. data/lib/sufia/jobs/batch_update_job.rb +1 -1
  51. data/lib/sufia/user.rb +23 -1
  52. data/lib/sufia/version.rb +1 -1
  53. data/lib/tasks/fixtures.rake +2 -3
  54. data/spec/controllers/generic_files_controller_spec.rb +7 -0
  55. data/spec/controllers/single_use_link_controller_spec.rb +0 -2
  56. data/spec/controllers/users_controller_spec.rb +28 -2
  57. data/spec/helpers/generic_file_helper_spec.rb +21 -0
  58. data/spec/models/generic_file_spec.rb +21 -5
  59. data/spec/models/trophy_spec.rb +26 -0
  60. data/spec/models/user_spec.rb +2 -2
  61. data/spec/routing/route_spec.rb +11 -11
  62. data/spec/support/Gemfile +2 -4
  63. data/sufia.gemspec +1 -0
  64. metadata +35 -15
  65. data/app/controllers/sessions_controller.rb +0 -30
  66. data/app/views/batch/_metadata.html.erb +0 -195
  67. data/app/views/generic_files/_field_form +0 -46
  68. data/lib/devise/strategies/http_header_authenticatable.rb +0 -43
  69. data/lib/generators/sufia/templates/config/devise.rb +0 -222
  70. data/lib/redirect_to_web_access_failure.rb +0 -27
  71. data/lib/sufia/http_header_auth.rb +0 -60
  72. data/spec/config/host_to_vhost_spec.rb +0 -38
  73. data/spec/controllers/sessions_controller_spec.rb +0 -44
data/Gemfile CHANGED
@@ -16,7 +16,8 @@ group :development, :test do
16
16
  gem 'ruby-prof'
17
17
  gem 'cucumber-rails', '~> 1.0', :require => false
18
18
  gem 'database_cleaner'
19
- gem 'capybara'
19
+ gem 'devise'
20
+ gem 'capybara', '~>1.1.3'
20
21
  gem 'bcrypt-ruby'
21
22
  gem "jettywrapper"
22
23
  gem "factory_girl_rails", "~> 4.1.0"
data/README.md CHANGED
@@ -8,6 +8,7 @@ gem 'blacklight'
8
8
  gem 'hydra-head'
9
9
  gem 'sufia'
10
10
  gem 'jettywrapper'
11
+ gem 'font-awesome-sass-rails'
11
12
  ```
12
13
  Then `bundle install`
13
14
 
@@ -46,13 +47,16 @@ COUNT=4 QUEUE=* rake environment resque:work
46
47
  ```
47
48
  See https://github.com/defunkt/resque for more options
48
49
 
49
- ### If you want to enable transcoding of video
50
- #### Installing ffmpeg on a mac
50
+ ### If you want to enable transcoding of video, instal ffmpeg version 1.0+
51
+ #### On a mac
51
52
  Use homebrew:
52
53
  ```
53
54
  brew install ffmpeg --with-libvpx --with-libvorbis
54
55
  ```
55
56
 
57
+ #### On Ubuntu Linux
58
+ See https://ffmpeg.org/trac/ffmpeg/wiki/UbuntuCompilationGuide
59
+
56
60
  ## Developers:
57
61
  This information is for people who want to modify the engine itself, not an application that uses the engine:
58
62
  ### Create fixtures
@@ -40,6 +40,7 @@ limitations under the License.
40
40
  //= require fileupload
41
41
  //= require sufia/permissions
42
42
  //= require sufia/tabs
43
+ //= require sufia/trophy
43
44
 
44
45
  //over ride the blacklight default to submit
45
46
  //form when sort by or show per page change
@@ -0,0 +1,26 @@
1
+ // short hand for $(document).ready();
2
+ $(function() {
3
+
4
+ $('.trophy-class').click(function(){
5
+ var uid=$("#current_user").html();
6
+ $.ajax({
7
+ url:"/users/"+uid+"/trophy",
8
+ type:"post",
9
+ data: "file_id="+this.id,
10
+ success:function(data) {
11
+ var oldclass = $('#'+data.trophy.generic_file_id).find('i').attr("class");
12
+ if (oldclass.indexOf("trophy-on") != -1){
13
+ $('#'+data.trophy.generic_file_id).find('i').attr("title", "Highlight work");
14
+ } else {
15
+ $('#'+data.trophy.generic_file_id).find('i').attr("title", "Unhighlight work");
16
+ }
17
+
18
+ $('#'+data.trophy.generic_file_id).find('i').toggleClass("trophy-on");
19
+ $('#'+data.trophy.generic_file_id).find('i').toggleClass("trophy-off");
20
+ }
21
+ })
22
+ });
23
+
24
+ }); //closing function at the top of the page
25
+
26
+
@@ -2,6 +2,7 @@
2
2
  *= require_self
3
3
  *= require bootstrap.min
4
4
  *= require scholarsphere-bootstrap
5
+ *= require trophy
5
6
  *= require blacklight_more_facets
6
7
  *= require batch_edit
7
8
  *= require generic_files
@@ -0,0 +1,7 @@
1
+ .trophy-off:hover,.trophy-off {
2
+ color: black;
3
+ }
4
+
5
+ .trophy-on:hover,.trophy-on {
6
+ color: goldenrod;
7
+ }
@@ -38,7 +38,7 @@ class BatchController < ApplicationController
38
38
  @batch.status="processing"
39
39
  @batch.save
40
40
  Sufia.queue.push(BatchUpdateJob.new(current_user.user_key, params))
41
- flash[:notice] = 'Your files are being processed by ScholarSphere in the background. The metadata and access controls you specified are being applied. Files will be marked <span class="label label-important" title="Private">Private</span> until this process is complete (shouldn\'t take too long, hang in there!). You may need to refresh your dashboard to see these updates.'
41
+ flash[:notice] = 'Your files are being processed by ' + t('sufia.product_name') + ' in the background. The metadata and access controls you specified are being applied. Files will be marked <span class="label label-important" title="Private">Private</span> until this process is complete (shouldn\'t take too long, hang in there!). You may need to refresh your dashboard to see these updates.'
42
42
  redirect_to sufia.dashboard_index_path
43
43
  end
44
44
  end
@@ -5,13 +5,13 @@ class BatchEditsController < ApplicationController
5
5
  def edit
6
6
  super
7
7
  @generic_file = GenericFile.new
8
- @generic_file.depositor = current_user.login
8
+ @generic_file.depositor = current_user.user_key
9
9
  @groups = current_user.groups
10
- @terms = @generic_file.get_terms.reject{|k,v| (k=='generic_file__title')|| (k == 'generic_file__part_of')|| (k == 'generic_file__date_uploaded') || (k == 'generic_file__date_modified')}
10
+ @terms = @generic_file.editable_terms - [:title] # +:format, :resource_type
11
11
 
12
12
  # do we want to show the original values for anything...
13
13
  @show_file = GenericFile.new
14
- @show_file.depositor = current_user.login
14
+ @show_file.depositor = current_user.user_key
15
15
  h = {}
16
16
  @names = []
17
17
  permissions = []
@@ -4,10 +4,10 @@ class SingleUseLinkController < DownloadsController
4
4
  prepend_before_filter :normalize_identifier, :except => [:download, :show]
5
5
 
6
6
  def generate_download
7
- id = check_single_use_link
8
- @su = SingleUseLink.create_download(id)
7
+ @generic_file = GenericFile.find(params[:id])
8
+ authorize! :read, @generic_file
9
+ @su = SingleUseLink.create_download(params[:id])
9
10
  @link = sufia.download_single_use_link_path(@su.downloadKey)
10
- @generic_file = GenericFile.find(id)
11
11
  respond_to do |format|
12
12
  format.html
13
13
  format.js {render :js => @link}
@@ -16,10 +16,10 @@ class SingleUseLinkController < DownloadsController
16
16
  end
17
17
 
18
18
  def generate_show
19
- id = check_single_use_link
20
- @su = SingleUseLink.create_show(id)
19
+ @generic_file = GenericFile.find(params[:id])
20
+ authorize! :read, @generic_file
21
+ @su = SingleUseLink.create_show(params[:id])
21
22
  @link = sufia.show_single_use_link_path(@su.downloadKey)
22
- @generic_file = GenericFile.find(id)
23
23
  respond_to do |format|
24
24
  format.html
25
25
  format.js {render :js => @link}
@@ -38,7 +38,8 @@ class SingleUseLinkController < DownloadsController
38
38
  not_found if link.path != sufia.download_path(id)
39
39
 
40
40
  # send the data content
41
- send_content(id)
41
+ asset = ActiveFedora::Base.find(id, :cast=>true)
42
+ send_content(asset)
42
43
  end
43
44
 
44
45
  def show
@@ -52,8 +53,7 @@ class SingleUseLinkController < DownloadsController
52
53
 
53
54
  #show the file
54
55
  @generic_file = GenericFile.find(id)
55
- @terms = @generic_file.get_terms
56
- #render 'generic_files/show'
56
+ @terms = @generic_file.terms_for_display
57
57
 
58
58
  # create a dowload link that is single use for the user since we do not just want to show metadata we want to access it too
59
59
  @su = SingleUseLink.create_download(id)
@@ -62,14 +62,6 @@ class SingleUseLinkController < DownloadsController
62
62
 
63
63
  protected
64
64
 
65
- def check_single_use_link
66
- id = params[:id]
67
- # make sure the user is allowed to read the document before they generate the link
68
- perms = permissions_solr_doc_for_id(id)
69
- @can_read = can? :read, perms
70
- return id
71
- end
72
-
73
65
  def lookup_hash
74
66
  id = params[:id]
75
67
  # invalid hash send not found
@@ -14,8 +14,9 @@
14
14
 
15
15
  class UsersController < ApplicationController
16
16
  prepend_before_filter :find_user, :except => [:index, :search, :notifications_number]
17
- before_filter :authenticate_user!, only: [:edit, :update, :follow, :unfollow]
18
- before_filter :user_is_current_user, only: [:edit, :update]
17
+ before_filter :authenticate_user!, only: [:edit, :update, :follow, :unfollow, :toggle_trophy]
18
+ before_filter :user_is_current_user, only: [:edit, :update, :toggle_trophy]
19
+
19
20
  before_filter :user_not_current_user, only: [:follow, :unfollow]
20
21
 
21
22
  def index
@@ -35,6 +36,7 @@ class UsersController < ApplicationController
35
36
  else
36
37
  @events = []
37
38
  end
39
+ @trophies = @user.trophy_ids
38
40
  @followers = @user.followers
39
41
  @following = @user.all_following
40
42
  end
@@ -43,6 +45,7 @@ class UsersController < ApplicationController
43
45
  def edit
44
46
  @user = current_user
45
47
  @groups = @user.groups
48
+ @trophies = @user.trophy_ids
46
49
  end
47
50
 
48
51
  # Process changes from profile form
@@ -57,7 +60,33 @@ class UsersController < ApplicationController
57
60
  end
58
61
  Sufia.queue.push(UserEditProfileEventJob.new(@user.user_key))
59
62
  redirect_to sufia.profile_path(URI.escape(@user.to_s,'@.')), notice: "Your profile has been updated"
63
+ delete_trophy = params.keys.reject{|k,v|k.slice(0,'remove_trophy'.length)!='remove_trophy'}
64
+ delete_trophy = delete_trophy.map{|v| v.slice('remove_trophy_'.length..-1)}
65
+ delete_trophy.each do | smash_trophy |
66
+ Trophy.where(user_id: current_user.id, generic_file_id: smash_trophy.slice("#{Sufia::Engine.config.id_namespace}:".length..-1)).each.map(&:delete)
67
+ #Trophy.where(user_id: current_user.id, generic_file_id: smash_trophy.slice("#{Sufia::Engine.config.id_namespace}:".length..-1)).each.map(&:delete)
68
+ end
60
69
  end
70
+ def toggle_trophy
71
+ id = params[:file_id]
72
+ id = "#{Sufia::Engine.config.id_namespace}:#{id}" unless id.include?(":")
73
+ unless current_user.can? :edit, permissions_solr_doc_for_id(id)
74
+ redirect_to root_path, alert: "You do not have permissions to the file"
75
+ return false
76
+ end
77
+ # TO DO make sure current user has access to file
78
+ t = Trophy.where(:generic_file_id => params[:file_id], :user_id => current_user.id).first
79
+ if t.blank?
80
+ t = Trophy.create(:generic_file_id => params[:file_id], :user_id => current_user.id)
81
+ return false unless t.persisted?
82
+ else
83
+ t.delete
84
+ #TODO do this better says Mike
85
+ return false if t.persisted?
86
+ end
87
+ render :json => t
88
+ end
89
+
61
90
 
62
91
  # Follow a user
63
92
  def follow
@@ -79,12 +108,12 @@ class UsersController < ApplicationController
79
108
 
80
109
  private
81
110
  def find_user
82
- @user = User.find_by_user_key(params[:uid])
111
+ @user = User.from_url_component(params[:uid])
83
112
  redirect_to root_path, alert: "User '#{params[:uid]}' does not exist" if @user.nil?
84
113
  end
85
114
 
86
115
  def user_is_current_user
87
- redirect_to sufia.profile_path(URI.escape(@user.to_s,'@.')), alert: "You cannot edit #{@user.to_s}\'s profile" unless @user == current_user
116
+ redirect_to sufia.profile_path(URI.escape(@user.to_s,'@.')), alert: "Permission denied: cannot access this page." unless @user == current_user
88
117
  end
89
118
 
90
119
  def user_not_current_user
@@ -14,10 +14,62 @@
14
14
  # limitations under the License.
15
15
 
16
16
  module GenericFileHelper
17
- def display_title(gf)
18
- title = gf.title.join(' | ')
19
- title = gf.label if title.blank?
20
- title = 'No Title' if title.blank?
21
- return title
17
+ def display_title(gf)
18
+ title = gf.title.join(' | ')
19
+ title = gf.label if title.blank?
20
+ title = 'No Title' if title.blank?
21
+ title
22
+ end
23
+
24
+ def add_field (key)
25
+ more_or_less_button(key, 'adder', '+')
26
+ end
27
+
28
+ def subtract_field (key)
29
+ more_or_less_button(key, 'remover', '-')
30
+ end
31
+
32
+ def help_icon(key)
33
+ link_to '#', id: "generic_file_#{key.to_s}_help", rel: 'popover',
34
+ 'data-content' => metadata_help(key),
35
+ 'data-original-title' => get_label(key) do
36
+ content_tag 'i', '', class: "icon-question-sign icon-large"
37
+ end
38
+ end
39
+
40
+ def metadata_help(key)
41
+ I18n.t("sufia.metadata_help.#{key}", default: key.to_s.humanize)
42
+ end
43
+
44
+ def get_label(key)
45
+ I18n.t("sufia.field_label.#{key}", default: key.to_s.humanize)
46
+ end
47
+
48
+ def required?(key)
49
+ [:title, :creator, :tag, :rights].include?(key)
50
+ end
51
+
52
+ def render_edit_field_partial(key, locals)
53
+ ["generic_files/edit_fields/#{key}", "generic_files/edit_fields/default"].each do |str|
54
+ # XXX rather than handling this logic through exceptions, maybe there's a Rails internals method
55
+ # for determining if a partial template exists..
56
+ begin
57
+ return render :partial => str, :locals=>locals.merge({key: key})
58
+ rescue ActionView::MissingTemplate
59
+ nil
60
+ end
61
+ end
62
+ end
63
+
64
+ private
65
+
66
+ def more_or_less_button(key, html_class, symbol)
67
+ # TODO, there could be more than one element with this id on the page, but the fuctionality doesn't work without it.
68
+ content_tag('button', class: "#{html_class} btn", id: "additional_#{key}_submit", name: "additional_#{key}") do
69
+ (symbol +
70
+ content_tag('span', class: 'accessible-hidden') do
71
+ "add another #{key.to_s}"
72
+ end).html_safe
73
+ end
22
74
  end
23
75
  end
@@ -1,3 +1,4 @@
1
+ # -*- coding: utf-8 -*-
1
2
  # Copyright © 2012 The Pennsylvania State University
2
3
  #
3
4
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -12,18 +13,15 @@
12
13
  # See the License for the specific language governing permissions and
13
14
  # limitations under the License.
14
15
 
15
- require 'devise/strategies/http_header_authenticatable'
16
- module Devise
17
- module Models
18
- module HttpHeaderAuthenticatable
19
- extend ActiveSupport::Concern
16
+ module TrophyHelper
17
+ def display_trophy_link(user, noid)
18
+ trophyclass = "trophy-off"
19
+ trophytitle= "Highlight work "
20
+ if user.trophies.map(&:generic_file_id).include? noid
21
+ trophyclass = "trophy-on"
22
+ trophytitle= "Unhighlight work"
23
+ end
20
24
 
21
- def after_database_authentication
22
- end
23
-
24
- protected
25
-
26
-
27
- end
28
- end
25
+ return link_to raw("<i class='#{trophyclass} icon-trophy icon-large'></i>"),"", :class=> 'trophy-class', :title => trophytitle, :id => noid, :remote=>true # link to trophy
26
+ end
29
27
  end
@@ -13,7 +13,6 @@
13
13
  # limitations under the License.
14
14
 
15
15
  class BatchRdfDatastream < ActiveFedora::NtriplesRDFDatastream
16
- register_vocabularies RDF::DC
17
16
  map_predicates do |map|
18
17
  map.part(:to => "hasPart", :in => RDF::DC)
19
18
  map.creator(:to => "creator", :in => RDF::DC)
@@ -13,7 +13,6 @@
13
13
  # limitations under the License.
14
14
 
15
15
  class GenericFileRdfDatastream < ActiveFedora::NtriplesRDFDatastream
16
- register_vocabularies RDF::DC, RDF::FOAF, RDF::RDFS
17
16
  map_predicates do |map|
18
17
  map.part_of(:to => "isPartOf", :in => RDF::DC)
19
18
  map.contributor(:in => RDF::DC) do |index|
@@ -0,0 +1,12 @@
1
+ class Trophy < ActiveRecord::Base
2
+ attr_accessible :generic_file_id, :user_id
3
+
4
+ validate :count_within_limit, :on => :create
5
+
6
+ def count_within_limit
7
+ if Trophy.where(user_id:self.user_id).count >= 5
8
+ errors.add(:base, "Exceeded trophy limit")
9
+ end
10
+ end
11
+ end
12
+
@@ -15,7 +15,7 @@ limitations under the License.
15
15
  %>
16
16
  <% if current_user %>
17
17
  <%= render :partial => 'users/notify_link' %>
18
- <a href="<%= sufia.profile_path(URI.escape(current_user.to_s, '@.')) %>" class="btn btn-small " title="click for User Profile"><i class="icon-user">&nbsp;</i><%= current_user.name %></a>
18
+ <a href="<%= sufia.profile_path(current_user) %>" class="btn btn-small " title="click for User Profile"><i class="icon-user">&nbsp;</i><%= current_user.name %></a>
19
19
  <a class="btn btn-small dropdown-toggle" data-toggle="dropdown" href="#"><span class="icon-caret-down" title="click for additional menu options"></span></a>
20
20
  <ul class="dropdown-menu">
21
21
  <li><%= link_to raw('<i class="icon-dashboard"></i> my dashboard'), sufia.dashboard_index_path, :id => 'dashboard_nav_link' %></li>
@@ -46,13 +46,13 @@ function confirmExit(){
46
46
  <h1>Apply Metadata</h1>
47
47
  <br />
48
48
  <div class="alert">The information you provide for Title will be applied to the corresponding file only; however all other
49
- information you provide will be applied <em>to the entire batch of files</em> you have just deposited into ScholarSphere.
49
+ information you provide will be applied <em>to the entire batch of files</em> you have just deposited into <%= t('sufia.product_name') %>.
50
50
  You may edit individual files from <%= link_to '<i class="icon-dashboard"></i> my dashboard'.html_safe, sufia.dashboard_index_path %> once
51
51
  this step is finished.
52
52
  </div>
53
53
  <%= form_for([@batch, @generic_file], :url => sufia.batch_generic_files_path, :html => {:multipart => true, :class => 'form-horizontal'}) do |f| %>
54
54
 
55
- <%= render :partial => 'metadata', :formats => [:html], :locals => {:f => f, :gf => @generic_file} %>
55
+ <%= render :partial => 'batch_edits/metadata', :formats => [:html], :locals => {:f => f, :gf => @generic_file} %>
56
56
 
57
57
  <%= render :partial => 'generic_files/permission', :formats => [:html], :locals => { :gf => @generic_file, :batch => @batch } %>
58
58
 
@@ -1,5 +1,5 @@
1
1
  <%= form_tag(batch_edits_path, :method => :put, :class=> "batch-select-all hidden", "data-behavior" => 'batch-select-all') do -%>
2
2
  <%= hidden_field_tag('update_type', 'delete_all') %>
3
- <%= submit_tag("Delete Selected", :class=>'batch-all-button btn btn-primary', :data => { :confirm => 'Deleting a file from ScholarSphere is permanent. Click OK to delete this file from ScholarSphere, or Cancel to cancel this operation'}) %>
3
+ <%= submit_tag("Delete Selected", :class=>'batch-all-button btn btn-primary', :data => { :confirm => "Deleting a file from #{t('sufia.product_name')} is permanent. Click OK to delete this file from #{t('sufia.product_name')}, or Cancel to cancel this operation"}) %>
4
4
  <% end %>
5
5
 
@@ -10,7 +10,7 @@
10
10
  <%= f.label :title, "<span class='error'>*</span> Title #{index+1}".html_safe, :class=>"control-label" %>
11
11
  <div class="controls" id="additional_title_clone">
12
12
  <%= f.text_field :title, :name=>"title[#{gen_f.id}][]", :value=>gen_f.label, :required=> true %>
13
- <a href="#" id="generic_file_title_help" rel="popover" data-content="<%= Sufia::Engine.config.metadata_help["generic_file_title"] %>" data-original-title="Title"><i class="icon-question-sign icon-large"></i></a>
13
+ <%= help_icon(:title) %>
14
14
  </div>
15
15
  </div>
16
16
  <% end %>
@@ -27,11 +27,12 @@
27
27
  <h2 class="non lower">Bulk Descriptions <small>(applied to all files just uploaded)</small> <small class="pull-right"><span class="error">*</span> indicates required fields</small></h2>
28
28
  <div class="well">
29
29
  <div class="control-group" id="resources">
30
- <%= f.label :resource_type, "Resource Types", :class=>"control-label", :for=>"resource_type" %>
30
+ <%# See if this works: render_edit_field_partial(:type, f:f) %>
31
+ <%= f.label :resource_type, "Resource Types", :class=>"control-label", :for=>"resource_type" %>
31
32
  <div class="controls">
32
33
  <p class="help-block">You may select multiple types to apply to all files<p>
33
34
  <%= f.select "resource_type", Sufia::Engine::config.resource_types, {}, {:multiple=>true, :size=>7} %>
34
- <a href="#" id="generic_file_resource_type_help" rel="popover" data-content="<%= Sufia::Engine.config.metadata_help["generic_file_resource_type"] %>" data-original-title="Resource Type"><i class="icon-question-sign icon-large"></i></a>
35
+ <%= help_icon(:resource_type) %>
35
36
  </div>
36
37
  </div>
37
38
 
@@ -41,7 +42,7 @@
41
42
  <%= f.text_field :tag, :name=>"generic_file[tag][]", :value=>"", :required=> true %>
42
43
  <button class="adder btn" name="additional_tag" id="additional_tag_submit">+<span class="accessible-hidden">add another Tag</span></button>
43
44
  &nbsp;
44
- <a href="#" id="generic_file_tag_help" rel="popover" data-content="<%= Sufia::Engine.config.metadata_help["generic_file_tag"] %>" data-original-title="Keyword"><i class="icon-question-sign icon-large"></i></a>
45
+ <%= help_icon(:tag) %>
45
46
  </div>
46
47
  <div id="additional_tag_elements"></div>
47
48
  </div>
@@ -52,7 +53,7 @@
52
53
  <%= f.text_field :creator, :name=>"generic_file[creator][]", :value=>"", :required=> true %>
53
54
  <button class="adder btn" name="additional_creator" id="additional_creator_submit">+<span class="accessible-hidden">add another Creator</span></button>
54
55
  &nbsp;
55
- <a href="#" id="generic_file_creator_help" rel="popover" data-content="<%= Sufia::Engine.config.metadata_help["generic_file_creator"] %>" data-original-title="Creator"><i class="icon-question-sign icon-large"></i></a>
56
+ <%= help_icon(:creator) %>
56
57
  </div>
57
58
  <div id="additional_creator_elements"></div>
58
59
  </div>
@@ -63,7 +64,7 @@
63
64
  <%= f.select "rights", options_for_select(Sufia::Engine::config.cc_licenses, 'http://creativecommons.org/licenses/by-nc-nd/3.0/us/'), :required => true %>
64
65
  <button class="adder btn" name="additional_rights" id="additional_rights_submit">+<span class="accessible-hidden">add another Rights</span></button>
65
66
  &nbsp;
66
- <a href="#" id="generic_file_rights_help" rel="popover" data-content="<%= Sufia::Engine.config.metadata_help["generic_file_rights"] %>" data-original-title="Rights"><i class="icon-question-sign icon-large"></i></a>
67
+ <%= help_icon(:rights) %>
67
68
  <%= render :partial => "generic_files/rights_modal" %>
68
69
 
69
70
  </div>
@@ -82,7 +83,7 @@
82
83
  <%= f.text_field :related_url, :name=>"generic_file[related_url][]", :value=>"" %>
83
84
  <button class="adder btn" name="additional_related_url" id="additional_related_url_submit">+<span class="accessible-hidden">add another Related URL</span></button>
84
85
  &nbsp;
85
- <a href="#" id="generic_file_related_url_help" rel="popover" data-content="<%= Sufia::Engine.config.metadata_help["generic_file_related_url"] %>" data-original-title="Related URL"><i class="icon-question-sign icon-large"></i></a>
86
+ <%= help_icon(:related_url) %>
86
87
  </div>
87
88
  <div id="additional_related_url_elements"></div>
88
89
  </div>
@@ -93,7 +94,7 @@
93
94
  <%= f.text_field :based_near, :name=>"generic_file[based_near][]", :value=>"" %>
94
95
  <button class="adder btn" name="additional_based_near" id="additional_based_near_submit">+<span class="accessible-hidden">add another Location</span></button>
95
96
  &nbsp;
96
- <a href="#" id="generic_file_based_near_help" rel="popover" data-content="<%= Sufia::Engine.config.metadata_help["generic_file_based_near"] %>" data-original-title="Location"><i class="icon-question-sign icon-large"></i></a>
97
+ <%= help_icon(:based_near) %>
97
98
  </div>
98
99
  <div id="additional_based_near_elements"></div>
99
100
  </div>
@@ -104,7 +105,7 @@
104
105
  <%= f.text_field :contributor, :name=>"generic_file[contributor][]", :value=>gf.contributor[0] %>
105
106
  <button class="adder btn" name="additional_contributor" id="additional_contributor_submit">+<span class="accessible-hidden">add another Contributor</span></button>
106
107
  &nbsp;
107
- <a href="#" id="generic_file_contributor_help" rel="popover" data-content="<%= Sufia::Engine.config.metadata_help["generic_file_contributor"] %>" data-original-title="Contributor"><i class="icon-question-sign icon-large"></i></a>
108
+ <%= help_icon(:contributor) %>
108
109
  </div>
109
110
  <div id="additional_contributor_elements"></div>
110
111
  </div>
@@ -115,7 +116,7 @@
115
116
  <%= f.text_field :date_created, :name=>"generic_file[date_created][]", :value=>"" %>
116
117
  <button class="adder btn" name="additional_date_created" id="additional_date_created_submit">+<span class="accessible-hidden">add another Date Created</span></button>
117
118
  &nbsp;
118
- <a href="#" id="generic_file_date_created_help" rel="popover" data-content="<%= Sufia::Engine.config.metadata_help["generic_file_date_created"] %>" data-original-title="Date Created"><i class="icon-question-sign icon-large"></i></a>
119
+ <%= help_icon(:date_created) %>
119
120
  </div>
120
121
  <div id="additional_date_created_elements"></div>
121
122
  </div>
@@ -126,7 +127,7 @@
126
127
  <%= f.text_area :description, :name=>"generic_file[description][]", :value=>"" %>
127
128
  <button class="adder btn" name="additional_description" id="additional_description_submit">+<span class="accessible-hidden">add another Abstract or Summary</span></button>
128
129
  &nbsp;
129
- <a href="#" id="generic_file_description_help" rel="popover" data-content="<%= Sufia::Engine.config.metadata_help["generic_file_description"] %>" data-original-title="Abstract or Summary"><i class="icon-question-sign icon-large"></i></a>
130
+ <%= help_icon(:description) %>
130
131
  </div>
131
132
  <div id="additional_description_elements"></div>
132
133
  </div>
@@ -137,7 +138,7 @@
137
138
  <%= f.text_field :identifier, :name=>"generic_file[identifier][]", :value=>"" %>
138
139
  <button class="adder btn" name="additional_identifier" id="additional_identifier_submit">+<span class="accessible-hidden">add another Identifier</span></button>
139
140
  &nbsp;
140
- <a href="#" id="generic_file_identifier_help" rel="popover" data-content="<%= Sufia::Engine.config.metadata_help["generic_file_identifier"] %>" data-original-title="Identifier"><i class="icon-question-sign icon-large"></i></a>
141
+ <%= help_icon(:identifier) %>
141
142
  </div>
142
143
  <div id="additional_identifier_elements"></div>
143
144
  </div>
@@ -148,7 +149,7 @@
148
149
  <%= f.text_field :language, :name=>"generic_file[language][]", :value=>"" %>
149
150
  <button class="adder btn" name="additional_language" id="additional_language_submit">+<span class="accessible-hidden">add another Language</span></button>
150
151
  &nbsp;
151
- <a href="#" id="generic_file_language_help" rel="popover" data-content="<%= Sufia::Engine.config.metadata_help["generic_file_language"] %>" data-original-title="Language"><i class="icon-question-sign icon-large"></i></a>
152
+ <%= help_icon(:language) %>
152
153
  </div>
153
154
  <div id="additional_language_elements"></div>
154
155
  </div>
@@ -159,7 +160,7 @@
159
160
  <%= f.text_field :publisher, :name=>"generic_file[publisher][]", :value=>"" %>
160
161
  <button class="adder btn" name="additional_publisher" id="additional_publisher_submit">+<span class="accessible-hidden">add another Publisher</span></button>
161
162
  &nbsp;
162
- <a href="#" id="generic_file_publisher_help" rel="popover" data-content="<%= Sufia::Engine.config.metadata_help["generic_file_publisher"] %>" data-original-title="Publisher"><i class="icon-question-sign icon-large"></i></a>
163
+ <%= help_icon(:publisher) %>
163
164
  </div>
164
165
  <div id="additional_publisher_elements"></div>
165
166
  </div>
@@ -170,7 +171,7 @@
170
171
  <%= f.text_field :subject, :name=>"generic_file[subject][]", :value=>"" %>
171
172
  <button class="adder btn" name="additional_subject" id="additional_subject_submit">+<span class="accessible-hidden">add another Subject</span></button>
172
173
  &nbsp;
173
- <a href="#" id="generic_file_subject_help" rel="popover" data-content="<%= Sufia::Engine.config.metadata_help["generic_file_subject"] %>" data-original-title="Subject"><i class="icon-question-sign icon-large"></i></a>
174
+ <%= help_icon(:subject) %>
174
175
  </div>
175
176
  <div id="additional_subject_elements"></div>
176
177
  </div>