sufia 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. data/Gemfile +1 -4
  2. data/README.md +1 -1
  3. data/app/assets/javascripts/sufia.js +5 -312
  4. data/app/assets/javascripts/sufia/permissions.js +216 -0
  5. data/app/assets/javascripts/sufia/tabs.js +58 -0
  6. data/app/assets/stylesheets/generic_files.css +4 -0
  7. data/app/assets/stylesheets/jquery-ui.css +474 -0
  8. data/app/assets/stylesheets/{sufia.css → sufia.css.scss} +4 -1
  9. data/app/controllers/directory_controller.rb +17 -11
  10. data/app/controllers/users_controller.rb +5 -3
  11. data/app/models/datastreams/file_content_datastream.rb +2 -53
  12. data/app/views/batch/_metadata.html.erb +0 -1
  13. data/app/views/batch_edits/_metadata.html.erb +0 -1
  14. data/app/views/batch_edits/edit.html.erb +0 -1
  15. data/app/views/dashboard/_facet_pagination.html.erb +20 -39
  16. data/app/views/dashboard/_index_partials/_thumbnail_display.html.erb +1 -1
  17. data/app/views/dashboard/facet.html.erb +29 -34
  18. data/app/views/generic_files/_descriptions.html.erb +0 -1
  19. data/app/views/generic_files/_groups_description.html.erb +5 -0
  20. data/app/views/generic_files/_multiple_upload.html.erb +135 -0
  21. data/app/views/generic_files/_permission.html.erb +2 -5
  22. data/app/views/generic_files/_versioning.html.erb +0 -1
  23. data/app/views/generic_files/edit.html.erb +0 -3
  24. data/app/views/generic_files/new.html.erb +2 -138
  25. data/app/views/layouts/hydra-head.html.erb +1 -0
  26. data/app/views/users/index.html.erb +6 -4
  27. data/config/locales/sufia.en.yml +2 -0
  28. data/lib/sufia.rb +1 -1
  29. data/lib/sufia/file_content.rb +8 -0
  30. data/lib/sufia/file_content/extract_metadata.rb +53 -0
  31. data/lib/sufia/file_content/versions.rb +23 -0
  32. data/lib/sufia/files_controller_behavior.rb +17 -33
  33. data/lib/sufia/generic_file.rb +0 -8
  34. data/lib/sufia/generic_file/characterization.rb +0 -1
  35. data/lib/sufia/generic_file/thumbnail.rb +2 -4
  36. data/lib/sufia/jobs/unzip_job.rb +0 -1
  37. data/lib/sufia/user.rb +0 -3
  38. data/lib/sufia/version.rb +1 -1
  39. data/spec/controllers/batch_controller_spec.rb +11 -12
  40. data/spec/controllers/catalog_controller_spec.rb +2 -3
  41. data/spec/controllers/generic_files_controller_spec.rb +14 -16
  42. data/spec/controllers/single_use_link_controller_spec.rb +0 -1
  43. data/spec/models/batch_update_job_spec.rb +2 -3
  44. data/spec/models/checksum_audit_log_spec.rb +1 -2
  45. data/spec/models/file_content_datastream_spec.rb +1 -6
  46. data/spec/models/generic_file_spec.rb +2 -9
  47. data/spec/models/single_use_link_spec.rb +0 -2
  48. data/spec/models/transcode_video_job_spec.rb +1 -1
  49. data/spec/support/Gemfile +3 -5
  50. data/sufia.gemspec +2 -2
  51. data/vendor/assets/javascripts/jquery-ui-1.9.2/jquery.ui.effect-highlight.js +50 -0
  52. data/vendor/assets/javascripts/jquery-ui-1.9.2/jquery.ui.effect.js +1276 -0
  53. data/vendor/assets/javascripts/jquery-ui-1.9.2/jquery.ui.position.js +498 -0
  54. metadata +26 -21
  55. data/app/assets/stylesheets/font-awesome-ie7.css +0 -645
  56. data/app/assets/stylesheets/font-awesome.css +0 -303
  57. data/app/views/catalog/_facet_pagination.html.erb +0 -28
  58. data/app/views/catalog/facet.html.erb +0 -27
  59. data/public/robots.txt +0 -4
  60. data/vendor/assets/fonts/fontawesome-webfont.eot +0 -0
@@ -59,10 +59,7 @@ limitations under the License.
59
59
  <button class="btn btn-mini btn-inverse" onclick="return false;"><i class="icon-plus-sign" ></i>Add</button>.
60
60
  </p>
61
61
 
62
- <p>
63
- The list of groups in the drop-down marked &quot;Select a group&quot; is a list of User Managed Groups that you are a member of, and are managed by <%=t('sufia.institution_name') %>'s ITS department. You may select a specific group and assign an access
64
- level for a file within <%=t('sufia.product_name') %>, similarly to adding user access levels. However, management of these groups and their membership is handled centrally at <a href="http://umg.its.psu.edu" target="_blank">umg.its.psu.edu</a>.
65
- </p>
62
+ <%= render partial: 'groups_description' %>
66
63
 
67
64
  <h3>Permission Definitions</h3>
68
65
  <p>
@@ -97,7 +94,7 @@ limitations under the License.
97
94
  <div id="new-user">
98
95
  <div class="input-append">
99
96
  <p class="help-block">Enter <%=t('sufia.account_label') %> (one at a time)</p>
100
- <%= text_field_tag 'new_user_name_skel', nil, :class => "span29" %><span class="add-on">@psu.edu</span>
97
+ <%= text_field_tag 'new_user_name_skel', nil, :class => "span29" %><span class="add-on"><%=t('sufia.directory.suffix') %></span>
101
98
  <%= select_tag 'new_user_permission_skel', options_for_select(Sufia::Engine.config.permission_levels), :class=> 'span17' %>
102
99
  <button class="btn btn-mini btn-inverse" id="add_new_user_skel"><i class="icon-plus-sign"></i> Add</button>
103
100
  <br /> <span id="directory_user_result"></span>
@@ -18,7 +18,6 @@ limitations under the License.
18
18
  <h2 class="non lower">Versions</h2>
19
19
  <div class="well">
20
20
  <%= form_for @generic_file, :url => sufia.generic_file_path, :html => {:multipart => true, :class => 'form-horizontal'} do |f| %>
21
- <%= hidden_field_tag('generic_file[terms_of_service]', '1') %>
22
21
  <%= hidden_field_tag('redirect_tab', 'versions') %>
23
22
  <h3>Upload New Version</h3>
24
23
  <p>Upload a new version of this file from your computer.</p>
@@ -58,9 +58,6 @@ $("a[rel=popover]").popover();
58
58
  label.error { float: left; color: red; padding-left: .5em; vertical-align: top; }
59
59
  <% end %>
60
60
 
61
-
62
-
63
- <% end %>
64
61
  <%= render :partial => 'breadcrumbs' %>
65
62
 
66
63
  <h1 class="lower">Edit <%= display_title(@generic_file) %></h1>
@@ -15,141 +15,5 @@ limitations under the License.
15
15
  %>
16
16
 
17
17
  <h2>Upload</h2>
18
-
19
- <div class="alert">
20
- <strong>Note:</strong> You must agree to <a href='/agreement/' target="_blank"><%= t('sufia.deposit_agreement') %></a> before starting your upload.
21
- </div>
22
-
23
- <div class="alert alert-info hide" id="redirect-loc" type="text/x-jquery-tmpl">
24
- <%=sufia.batch_edit_path(@batch_noid)%>
25
- </div>
26
-
27
- <div id="upload_tooltip"><%= t('sufia.upload_tooltip') %></div>
28
-
29
- <div class="alert alert-info hide" id="success">
30
- You have successfully uploaded some of your files. Either continue to upload or edit use the links below to abandon the rest of your added files.
31
- <p>
32
- <%= link_to 'Add Descriptions', sufia.batch_edit_path(@batch_noid), :class=>'btn' %>
33
- </p>
34
- </div>
35
-
36
- <div class="alert hide" id="fail">
37
- There was a problem during upload. Please click the &quot;Start Upload&quot; button or <%= link_to 'start over', sufia.new_generic_file_path %>
38
- </div>
39
-
40
- <div class="alert hide" id="partial_fail">
41
- One or more files did not upload successfully. To continue using the files uploaded use one of the links below.<br />
42
- <%= link_to 'Add Descriptions', sufia.batch_edit_path(@batch_noid), :class=>'btn' %>
43
- </div>
44
-
45
- <div class="alert hide" id="errmsg"> </div>
46
-
47
- <!-- The file upload form used as target for the file upload widget -->
48
- <%= form_for(@generic_file, :url => sufia.generic_files_path, :html => {:multipart => true, :class => 'form-horizontal well', :id => 'fileupload'}) do |f| %>
49
- <%= hidden_field_tag(:total_upload_size, 0) %>
50
- <%= hidden_field_tag(:relative_path) %>
51
- <%= hidden_field_tag(:batch_id, @batch_noid) %>
52
- <label class="checkbox">
53
- <%= check_box_tag 'terms_of_service' %> I have read and do agree
54
- to <%= link_to t('sufia.deposit_agreement'),
55
- '/agreement/', :target => "_blank" %>.
56
- </label>
57
- <!-- The fileupload-buttonbar contains buttons to add/delete files and start/cancel the upload -->
58
- <div class="row fileupload-buttonbar">
59
- <div class="span70">
60
- <!-- The fileinput-button span is used to style the file input field as button -->
61
- <span class="btn btn-success fileinput-button">
62
- <i class="icon-plus icon-white"></i>
63
- <span>Select files...</span>
64
- <input type="file" name="files[]" multiple />
65
- </span>
66
- <% ua = request.env['HTTP_USER_AGENT'] %>
67
- <% if !!(ua =~ /Chrome/) %>
68
- <span class="btn btn-success fileinput-button">
69
- <i class="icon-plus icon-white"></i>
70
- <span>Select folder...</span>
71
- <input type="file" name="files[]" directory webkitdirectory mozdirectory />
72
- </span>
73
- <% end %>
74
- <span id="main_upload_start_span">
75
- <button type="submit" class="btn btn-primary start" id='main_upload_start'>
76
- <i class="icon-upload icon-white"></i>
77
- <span>Start upload</span>
78
- </button>
79
- </span>
80
- <button type="reset" class="btn btn-warning cancel">
81
- <i class="icon-ban-circle icon-white"></i>
82
- <span>Cancel upload</span>
83
- </button>
84
- </div>
85
- <div class="span50">
86
- <!-- The global progress bar -->
87
- <div class="progress progress-success progress-striped active fade">
88
- <div class="bar" style="width:0%;"></div>
89
- </div>
90
- </div>
91
- </div>
92
- <!-- The loading indicator is shown during image processing -->
93
- <div class="fileupload-loading"></div>
94
- <br />
95
- <!-- The table listing the files available for upload/download -->
96
- <table id="file-table" class="table table-striped"><tbody class="files" data-toggle="modal-gallery" data-target="#modal-gallery"></tbody></table>
97
- </form>
98
- <% end %>
99
-
100
- <!-- The template to display files available for upload -->
101
- <script id="template-upload" type="text/x-jquery-tmpl">
102
- {% for (var i=0, file; file=o.files[i]; i++) { %}
103
-
104
- <tr class="template-upload fade">
105
- <td class="preview"><span class="fade"></span></td>
106
- <td class="name"><span>{%=file.name%}</span></td>
107
- <td class="size"><span>{%=o.formatFileSize(file.size)%}</span></td>
108
- {% if (file.error) { %}
109
- <td class="error" colspan="2"><span class="label label-important">{%=locale.fileupload.error%}</span> {%=locale.fileupload.errors[file.error] || file.error%}</td>
110
- {% } else if (o.files.valid && !i) { %}
111
- <td>
112
- <div class="progress progress-success progress-striped active"><div class="bar" style="width:0%;"></div></div>
113
- </td>
114
- <td class="start">{% if (!o.options.autoUpload) { %}
115
- <button class="btn btn-primary hide">
116
- <i class="icon-upload icon-white"></i>
117
- <span>{%=locale.fileupload.start%}</span>
118
- </button>
119
- {% } %}</td>
120
- {% } else { %}
121
- <td colspan="2"></td>
122
- {% } %}
123
- <td class="cancel">{% if (!i) { %}
124
- <button class="btn btn-warning">
125
- <i class="icon-ban-circle icon-white"></i>
126
- <span>{%=locale.fileupload.cancel%}</span>
127
- </button>
128
- {% } %}</td>
129
- </tr>
130
- {% } %}
131
- </script>
132
- <!-- The template to display files available for download -->
133
- <script id="template-download" type="text/x-jquery-tmpl">
134
- {% for (var i=0, file; file=o.files[i]; i++) { %}
135
- <tr class="template-download fade">
136
- {% if (file.error) { %}
137
- <td><span></span></td>
138
- <td class="name"><span>{%=file.name%}</span></td>
139
- <td class="size"><span>{%=o.formatFileSize(file.size)%}</span></td>
140
- <td class="error" colspan="2"><span class="label label-important">{%=locale.fileupload.error%}</span> {%=locale.fileupload.errors[file.error] || file.error%}</td>
141
- {% } else { %}
142
- <td class="preview">
143
- {% if (file.thumbnail_url) { %} <span class="label label-success">Success</span> {% } %}
144
- </td>
145
- <td class="name">
146
- {%=file.name%}
147
- <!--a href="{%=file.url%}" title="{%=file.name%}" rel="{%=file.thumbnail_url&&'gallery'%}" download="{%=file.name%}" target="_blank">{%=file.name%}</a-->
148
- </td>
149
- <td class="size"><span>{%=o.formatFileSize(file.size)%}</span></td>
150
- <td colspan="2"></td>
151
- {% } %}
152
- </tr>
153
- {% } %}
154
- </script>
155
-
18
+ <%# using partials rather than inlining, so implementers can add or change stuff on this page without much duplication %>
19
+ <%= render partial: 'multiple_upload' %>
@@ -96,5 +96,6 @@ limitations under the License.
96
96
  </div><!-- /.container -->
97
97
  </div><!-- /#wrapper -->
98
98
  <%= render partial: '/footer' %>
99
+ <div id="ajax-modal" class="modal hide fade" tabindex="-1"></div>
99
100
  </body>
100
101
  </html>
@@ -32,9 +32,9 @@ limitations under the License.
32
32
  <tbody>
33
33
  <% @users.each do |user| %>
34
34
  <tr class="<%= cycle("","zebra") %>">
35
- <td><a href="<%= sufia.profile_path(URI.escape(user.login,'@.'i)) %>" class="btn btn-small " ><%= image_tag user.avatar.url(:thumb), :width => 30 %></a></td>
36
- <td ><a href="<%= sufia.profile_path(URI.escape(user.login,'@.'i)) %>" ><%= user.name %><a></td>
37
- <td><a href="<%= sufia.profile_path(URI.escape(user.login,'@.'i)) %>" ><%= user.login %><a></td>
35
+ <td><a href="<%= sufia.profile_path(URI.escape(user.user_key,'@.')) %>" class="btn btn-small " ><%= image_tag user.avatar.url(:thumb), :width => 30 %></a></td>
36
+ <td ><a href="<%= sufia.profile_path(URI.escape(user.user_key,'@.')) %>" ><%= user.name %><a></td>
37
+ <td><a href="<%= sufia.profile_path(URI.escape(user.user_key,'@.')) %>" ><%= user.user_key %><a></td>
38
38
  <td><%= user.department %> </td>
39
39
  <td><%= GenericFile.find(:depositor_t => user.to_s).count %> </td>
40
40
  </tr>
@@ -42,5 +42,7 @@ limitations under the License.
42
42
  <% end %>
43
43
  </tbody>
44
44
  </table>
45
- <%= will_paginate @users, :class => 'pager', :previous_label => '&laquo; Previous', :next_label => 'Next &raquo;'%>
45
+ <div class="pager">
46
+ <%= paginate @users, :theme => 'blacklight'%>
47
+ </div>
46
48
  </div>
@@ -5,6 +5,8 @@ en:
5
5
  institution_name: "Penn State"
6
6
  deposit_agreement: "ScholarSphere's Deposit Agreement"
7
7
  upload_tooltip: "Please accept Deposit Agreement before you can upload."
8
+ directory:
9
+ suffix: "@psu.edu"
8
10
  search:
9
11
  form:
10
12
  q:
@@ -8,7 +8,6 @@ require 'resque/server'
8
8
  require 'mailboxer'
9
9
  require 'acts_as_follower'
10
10
  require 'paperclip'
11
- require 'will_paginate'
12
11
  require 'nest'
13
12
  require 'RMagick'
14
13
  require 'activerecord-import'
@@ -78,5 +77,6 @@ module Sufia
78
77
  autoload :SolrDocumentBehavior
79
78
  autoload :FilesControllerBehavior
80
79
  autoload :DownloadsControllerBehavior
80
+ autoload :FileContent
81
81
  end
82
82
 
@@ -0,0 +1,8 @@
1
+ module Sufia
2
+ module FileContent
3
+ extend ActiveSupport::Autoload
4
+
5
+ autoload :ExtractMetadata
6
+ autoload :Versions
7
+ end
8
+ end
@@ -0,0 +1,53 @@
1
+ require 'open3'
2
+ module Sufia
3
+ module FileContent
4
+ module ExtractMetadata
5
+ include Open3
6
+
7
+ def extract_metadata
8
+ out = nil
9
+ to_tempfile do |f|
10
+ out = run_fits!(f.path)
11
+ end
12
+ out
13
+ end
14
+
15
+ def to_tempfile &block
16
+ return if content.nil?
17
+ f = Tempfile.new("#{pid}-#{dsVersionID}")
18
+ f.binmode
19
+ if content.respond_to? :read
20
+ f.write(content.read)
21
+ else
22
+ f.write(content)
23
+ end
24
+ f.close
25
+ content.rewind if content.respond_to? :rewind
26
+ yield(f)
27
+ f.unlink
28
+
29
+ end
30
+
31
+ private
32
+
33
+
34
+ def run_fits!(file_path)
35
+ command = "#{fits_path} -i #{file_path}"
36
+ stdin, stdout, stderr = popen3(command)
37
+ stdin.close
38
+ out = stdout.read
39
+ stdout.close
40
+ err = stderr.read
41
+ stderr.close
42
+ raise "Unable to execute command \"#{command}\"\n#{err}" unless err.empty? or err.include? "Error parsing Exiftool XML Output"
43
+ out
44
+ end
45
+
46
+
47
+ def fits_path
48
+ Sufia::Engine.config.fits_path
49
+ end
50
+
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,23 @@
1
+ module Sufia
2
+ module FileContent
3
+ module Versions
4
+ def get_version(version_id)
5
+ self.versions.select { |v| v.versionID == version_id}.first
6
+ end
7
+
8
+ def latest_version
9
+ self.versions.first
10
+ end
11
+
12
+ def version_committer(version)
13
+ vc = VersionCommitter.where(:obj_id => version.pid,
14
+ :datastream_id => version.dsid,
15
+ :version_id => version.versionID)
16
+ return vc.empty? ? nil : vc.first.committer_login
17
+ end
18
+
19
+
20
+ end
21
+ end
22
+ end
23
+
@@ -78,23 +78,22 @@ module Sufia
78
78
  begin
79
79
  retval = " "
80
80
  # check error condition No files
81
- if !params.has_key?(:files)
82
- retval = render :json => [{:error => "Error! No file to save"}].to_json
81
+ return render(:json => [{:error => "Error! No file to save"}].to_json) if !params.has_key?(:files)
83
82
 
83
+ file = params[:files][0]
84
84
  # check error condition empty file
85
- elsif ((params[:files][0].respond_to?(:tempfile)) && (params[:files][0].tempfile.size == 0))
86
- retval = render :json => [{ :name => params[:files][0].original_filename, :error => "Error! Zero Length File!"}].to_json
87
-
88
- elsif ((params[:files][0].respond_to?(:size)) && (params[:files][0].size == 0))
89
- retval = render :json => [{ :name => params[:files][0].original_filename, :error => "Error! Zero Length File!"}].to_json
90
-
85
+ if ((file.respond_to?(:tempfile)) && (file.tempfile.size == 0))
86
+ retval = render :json => [{ :name => file.original_filename, :error => "Error! Zero Length File!"}].to_json
87
+ elsif ((file.respond_to?(:size)) && (file.size == 0))
88
+ retval = render :json => [{ :name => file.original_filename, :error => "Error! Zero Length File!"}].to_json
91
89
  elsif (params[:terms_of_service] != '1')
92
- retval = render :json => [{ :name => params[:files][0].original_filename, :error => "You must accept the terms of service!"}].to_json
90
+ retval = render :json => [{ :name => file.original_filename, :error => "You must accept the terms of service!"}].to_json
93
91
 
94
92
  # process file
95
93
  else
96
- create_and_save_generic_file
94
+ create_and_save_generic_file(file, params[:relative_path], params[:batch_id], file.original_filename)
97
95
  if @generic_file
96
+ Sufia.queue.push(UnzipJob.new(@generic_file.pid)) if file.content_type == 'application/zip'
98
97
  Sufia.queue.push(ContentDepositEventJob.new(@generic_file.pid, current_user.user_key))
99
98
  respond_to do |format|
100
99
  format.html {
@@ -115,7 +114,7 @@ module Sufia
115
114
  retval = render :json => [{:error => "Error occurred while creating generic file."}].to_json
116
115
  ensure
117
116
  # remove the tempfile (only if it is a temp file)
118
- params[:files][0].tempfile.delete if params[:files][0].respond_to?(:tempfile)
117
+ file.tempfile.delete if file.respond_to?(:tempfile)
119
118
  end
120
119
 
121
120
  return retval
@@ -154,7 +153,7 @@ module Sufia
154
153
 
155
154
  if params.has_key?(:filedata)
156
155
  return unless virus_check(params[:filedata]) == 0
157
- add_posted_blob_to_asset(@generic_file, params[:filedata])
156
+ add_posted_blob_to_asset(@generic_file, params[:filedata], params[:filedata].original_filename)
158
157
  version_event = true
159
158
  Sufia.queue.push(ContentNewVersionEventJob.new(@generic_file.pid, current_user.user_key))
160
159
  end
@@ -192,35 +191,21 @@ module Sufia
192
191
  end
193
192
  end
194
193
 
195
- def create_and_save_generic_file
196
- unless params.has_key?(:files)
197
- logger.warn "!!!! No Files !!!!"
198
- return
199
- end
200
- file = params[:files][0]
194
+ def create_and_save_generic_file(file, relative_path, batch_id, file_name)
201
195
  return nil unless virus_check(file) == 0
202
196
 
203
197
  @generic_file = ::GenericFile.new
204
- @generic_file.terms_of_service = params[:terms_of_service]
205
- # if we want to be able to save zero length files then we can use this to make the file 1 byte instead of zero length and fedora will take it
206
- #if (file.tempfile.size == 0)
207
- # logger.warn "Encountered an empty file... Creating a new temp file with on space."
208
- # f = Tempfile.new ("emptyfile")
209
- # f.write " "
210
- # f.rewind
211
- # file.tempfile = f
212
- #end
213
- add_posted_blob_to_asset(@generic_file,file)
198
+ #This depends on the 3 arg constructor in hh 5.2.0
199
+ add_posted_blob_to_asset(@generic_file,file, file_name)
214
200
 
215
201
  @generic_file.apply_depositor_metadata(user_key)
216
202
  @generic_file.date_uploaded = Time.now.ctime
217
203
  @generic_file.date_modified = Time.now.ctime
218
- @generic_file.relative_path = params[:relative_path] if params.has_key?(:relative_path)
204
+ @generic_file.relative_path = relative_path if relative_path
219
205
  @generic_file.creator = current_user.name
220
206
 
221
- if params.has_key?(:batch_id)
222
- batch_id = Sufia::Noid.namespaceize(params[:batch_id])
223
- @generic_file.add_relationship("isPartOf", "info:fedora/#{batch_id}")
207
+ if batch_id
208
+ @generic_file.add_relationship("isPartOf", "info:fedora/#{Sufia::Noid.namespaceize(batch_id)}")
224
209
  else
225
210
  logger.warn "unable to find batch to attach to"
226
211
  end
@@ -238,7 +223,6 @@ module Sufia
238
223
  end
239
224
 
240
225
  record_version_committer(@generic_file, current_user)
241
- Sufia.queue.push(UnzipJob.new(@generic_file.pid)) if file.content_type == 'application/zip'
242
226
  return @generic_file
243
227
  end
244
228
  end
@@ -35,10 +35,6 @@ module Sufia
35
35
  :publisher, :date_created, :subject,
36
36
  :resource_type, :identifier, :language]
37
37
  around_save :characterize_if_changed, :retry_warming
38
-
39
- #make sure the terms of service is present and set to 1 before saving
40
- validates_acceptance_of :terms_of_service, :allow_nil => false
41
- after_find :preset_terms
42
38
  end
43
39
 
44
40
  def pdf?
@@ -174,10 +170,6 @@ module Sufia
174
170
  return (!self.batch.status.empty?) && (self.batch.status.count == 1) && (self.batch.status[0] == "processing")
175
171
  end
176
172
 
177
- def preset_terms
178
- self.terms_of_service = '1'
179
- end
180
-
181
173
  module ClassMethods
182
174
  # TODO this could probably be better handled by i18n
183
175
  @@FIELD_LABEL_MAP = {"based_near"=>"Location", 'description'=>"Abstract or Summary", 'tag'=>"Keyword", 'date_created'=>"Date Created", 'related_url'=>"Related URL"}