sufia 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -1
- data/app/assets/javascripts/sufia.js +6 -5
- data/app/assets/javascripts/terms_of_service.js +28 -0
- data/app/controllers/batch_edits_controller.rb +2 -2
- data/app/controllers/generic_files_controller.rb +2 -2
- data/app/models/datastreams/fits_datastream.rb +1 -1
- data/app/views/batch/edit.html.erb +6 -6
- data/app/views/batch_edits/edit.html.erb +10 -6
- data/app/views/catalog/_search_form.html.erb +2 -2
- data/app/views/dashboard/index.html.erb +7 -7
- data/app/views/generic_files/_asset_updated_flash.html.erb +1 -1
- data/app/views/generic_files/_descriptions.html.erb +1 -1
- data/app/views/generic_files/_versioning.html.erb +1 -1
- data/app/views/generic_files/edit.html.erb +10 -10
- data/app/views/generic_files/new.html.erb +3 -3
- data/app/views/generic_files/show.html.erb +1 -1
- data/app/views/users/edit.html.erb +3 -3
- data/config/locales/sufia.en.yml +10 -3
- data/features/step_definitions/scholarsphere.rb +3 -1
- data/features/support/paths.rb +1 -1
- data/lib/sufia/generic_file.rb +2 -3
- data/lib/sufia/generic_file/characterization.rb +1 -1
- data/lib/sufia/jobs/batch_update_job.rb +2 -2
- data/lib/sufia/version.rb +1 -1
- data/lib/tasks/resque.rake +27 -1
- data/spec/models/file_content_datastream_spec.rb +2 -2
- data/spec/models/generic_file_spec.rb +7 -4
- data/sufia.gemspec +3 -5
- data/vendor/assets/javascripts/fileupload.js +1 -3
- data/vendor/assets/javascripts/fileupload/application.js +0 -25
- data/vendor/assets/javascripts/fileupload/tmpl.js +86 -0
- data/vendor/assets/javascripts/jquery-ui-1.9.2/jquery.ui.autocomplete.js +602 -0
- data/vendor/assets/javascripts/jquery-ui-1.9.2/jquery.ui.core.js +356 -0
- data/vendor/assets/javascripts/jquery-ui-1.9.2/jquery.ui.menu.js +610 -0
- data/vendor/assets/javascripts/jquery-ui-1.9.2/jquery.ui.widget.js +528 -0
- data/vendor/assets/javascripts/swfobject.js +4 -0
- metadata +15 -37
- data/app/assets/javascripts/generic_files.js +0 -17
- data/tasks/resque.rake +0 -27
- data/vendor/assets/javascripts/blacklight.js +0 -513
- data/vendor/assets/javascripts/bootstrap-collapse.js +0 -157
- data/vendor/assets/javascripts/bootstrap-popover.js +0 -98
- data/vendor/assets/javascripts/bootstrap-tooltip.js +0 -275
- data/vendor/assets/javascripts/fileupload/tmpl.min.js +0 -1
- data/vendor/assets/javascripts/jquery-1.7.2.min.js +0 -4
- data/vendor/assets/javascripts/jquery-1.8.2.js +0 -9440
- data/vendor/assets/javascripts/jquery-1.8.2.min.js +0 -2
- data/vendor/assets/javascripts/jquery-ui-1.8.16.custom.min.js +0 -791
- data/vendor/assets/javascripts/jquery-ui-1.8.23.custom.min.js +0 -125
- data/vendor/assets/javascripts/jquery_ujs.js +0 -377
data/Gemfile
CHANGED
@@ -13,7 +13,7 @@ group :development, :test do
|
|
13
13
|
# gem "rails_indexes", :git => "git://github.com/warpc/rails_indexes.git", :ref => '4a550270'
|
14
14
|
gem 'selenium-webdriver'
|
15
15
|
gem 'headless'
|
16
|
-
gem 'rspec-rails', '
|
16
|
+
gem 'rspec-rails', '~> 2.12.0'
|
17
17
|
gem 'ruby-prof'
|
18
18
|
gem 'cucumber-rails', '~> 1.0', :require => false
|
19
19
|
gem 'database_cleaner'
|
@@ -14,15 +14,16 @@ See the License for the specific language governing permissions and
|
|
14
14
|
limitations under the License.
|
15
15
|
*/
|
16
16
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
17
|
+
//= require jquery-ui-1.9.2/jquery.ui.core
|
18
|
+
//= require jquery-ui-1.9.2/jquery.ui.widget
|
19
|
+
//= require jquery-ui-1.9.2/jquery.ui.menu
|
20
|
+
//= require jquery-ui-1.9.2/jquery.ui.autocomplete
|
21
21
|
//= require bootstrap-dropdown
|
22
22
|
//= require bootstrap-button
|
23
23
|
//= require bootstrap-collapse
|
24
24
|
//= require batch_edit
|
25
|
-
//= require
|
25
|
+
//= require terms_of_service
|
26
|
+
//= require fileupload
|
26
27
|
|
27
28
|
//over ride the blacklight default to submit
|
28
29
|
//form when sort by or show per page change
|
@@ -0,0 +1,28 @@
|
|
1
|
+
$(function () {
|
2
|
+
$('#main_upload_start').attr('disabled', true);
|
3
|
+
$("#upload_tooltip").hide();
|
4
|
+
$("#main_upload_start_span").mousemove(function(e){
|
5
|
+
if ( !$('#terms_of_service').is(':checked') ){
|
6
|
+
$('#main_upload_start').attr('disabled', true);
|
7
|
+
$("#upload_tooltip").show();
|
8
|
+
$("#upload_tooltip").css({
|
9
|
+
top: (e.clientY+5)+ "px",
|
10
|
+
left: (e.clientX+5) + "px"
|
11
|
+
});
|
12
|
+
} else {
|
13
|
+
if (filestoupload > 0) $('#main_upload_start').attr('disabled', false);
|
14
|
+
$("#upload_tooltip").hide();
|
15
|
+
}
|
16
|
+
});
|
17
|
+
$("#main_upload_start_span").mouseout(function(e){
|
18
|
+
$("#upload_tooltip").hide();
|
19
|
+
});
|
20
|
+
$("#main_upload_start_span").mouseleave(function(e){
|
21
|
+
$("#upload_tooltip").hide();
|
22
|
+
});
|
23
|
+
$('#terms_of_service').click(function () {
|
24
|
+
$('#main_upload_start').attr('disabled', !((this.checked) && (filestoupload > 0)));
|
25
|
+
$("#upload_tooltip").hide();
|
26
|
+
});
|
27
|
+
});
|
28
|
+
|
@@ -36,7 +36,7 @@ class BatchEditsController < ApplicationController
|
|
36
36
|
end
|
37
37
|
|
38
38
|
def after_update
|
39
|
-
redirect_to dashboard_index_path unless request.xhr?
|
39
|
+
redirect_to sufia.dashboard_index_path unless request.xhr?
|
40
40
|
end
|
41
41
|
|
42
42
|
def update_document(obj)
|
@@ -48,7 +48,7 @@ class BatchEditsController < ApplicationController
|
|
48
48
|
def update
|
49
49
|
# keep the batch around if we are doing ajax calls
|
50
50
|
batch_sav = batch.dup if request.xhr?
|
51
|
-
catalog_index_path = dashboard_index_path
|
51
|
+
catalog_index_path = sufia.dashboard_index_path
|
52
52
|
type = params["update_type"]
|
53
53
|
if (type == "update")
|
54
54
|
#params["generic_file"].reject! {|k,v| (v.blank? || (v.respond_to?(:length) && v.length==1 && v.first.blank?))}
|
@@ -154,10 +154,10 @@ class GenericFilesController < ApplicationController
|
|
154
154
|
version_event = true
|
155
155
|
Sufia.queue.push(ContentNewVersionEventJob.new(@generic_file.pid, current_user.user_key))
|
156
156
|
end
|
157
|
-
@generic_file.
|
157
|
+
@generic_file.attributes = params[:generic_file].reject { |k,v| %w{ Filedata Filename revision part_of date_modified date_uploaded format }.include? k}
|
158
158
|
@generic_file.set_visibility(params[:visibility])
|
159
159
|
@generic_file.date_modified = Time.now.ctime
|
160
|
-
@generic_file.save
|
160
|
+
@generic_file.save!
|
161
161
|
# do not trigger an update event if a version event has already been triggered
|
162
162
|
Sufia.queue.push(ContentUpdateEventJob.new(@generic_file.pid, current_user.user_key)) unless version_event
|
163
163
|
record_version_committer(@generic_file, current_user)
|
@@ -22,7 +22,7 @@ class FitsDatastream < ActiveFedora::NokogiriDatastream
|
|
22
22
|
t.identification {
|
23
23
|
t.identity {
|
24
24
|
t.format_label(:path=>{:attribute=>"format"})
|
25
|
-
t.mime_type(:path=>{:attribute=>"mimetype"})
|
25
|
+
t.mime_type(:path=>{:attribute=>"mimetype"}, index_as: [:searchable])
|
26
26
|
}
|
27
27
|
}
|
28
28
|
t.fileinfo {
|
@@ -16,14 +16,14 @@ limitations under the License.
|
|
16
16
|
|
17
17
|
|
18
18
|
|
19
|
-
<% content_for :
|
20
|
-
|
21
|
-
|
22
|
-
|
19
|
+
<% content_for :js_head do %>
|
20
|
+
<%= javascript_include_tag 'bootstrap-tooltip.js'%>
|
21
|
+
<%= javascript_include_tag 'bootstrap-popover.js'%>
|
22
|
+
<%= javascript_include_tag 'bootstrap-modal.js'%>
|
23
23
|
|
24
|
-
|
24
|
+
<%= javascript_include_tag 'batch.js' %>
|
25
25
|
|
26
|
-
|
26
|
+
<%= javascript_include_tag 'jquery.validate.js' %>
|
27
27
|
<style type="text/css">
|
28
28
|
label.error { float: left; color: red; padding-left: .5em; vertical-align: top; }
|
29
29
|
|
@@ -1,8 +1,10 @@
|
|
1
|
-
<%
|
2
|
-
|
3
|
-
|
1
|
+
<% content_for :js_head do %>
|
2
|
+
<%= javascript_include_tag 'bootstrap-modal.js'%>
|
3
|
+
<%= javascript_include_tag 'bootstrap-tooltip.js'%>
|
4
|
+
<%= javascript_include_tag 'bootstrap-popover.js'%>
|
5
|
+
<% end %>
|
4
6
|
|
5
|
-
<%
|
7
|
+
<% stylesheet_link_tag "jquery-ui-1.8.23.custom.css" %>
|
6
8
|
|
7
9
|
<% content_for :local_js do %>
|
8
10
|
|
@@ -34,9 +36,10 @@ $("a[rel=popover]").popover();
|
|
34
36
|
function after_ajax(form_id){
|
35
37
|
var key = form_id.replace("form_","");
|
36
38
|
var save_button = "#"+key+"_save";
|
39
|
+
var outer_div = "#collapse_"+key;
|
37
40
|
$("#status_"+key).html("Changes Saved");
|
38
41
|
$(save_button).removeAttr("disabled");
|
39
|
-
$(
|
42
|
+
$(outer_div).removeClass("loading");
|
40
43
|
$('#'+form_id).children([".control-group"]).removeClass('hidden')
|
41
44
|
}
|
42
45
|
|
@@ -46,8 +49,9 @@ $("a[rel=popover]").popover();
|
|
46
49
|
function before_ajax(form_id){
|
47
50
|
var key = form_id.replace("form_","");
|
48
51
|
var save_button = "#"+key+"_save";
|
52
|
+
var outer_div = "#collapse_"+key;
|
49
53
|
$(save_button).attr("disabled", "disabled");
|
50
|
-
$(
|
54
|
+
$(outer_div).addClass("loading");
|
51
55
|
$('#'+form_id).children([".control-group"]).addClass('hidden')
|
52
56
|
}
|
53
57
|
|
@@ -5,8 +5,8 @@
|
|
5
5
|
<%= search_as_hidden_fields(:omit_keys => [:q, :search_field, :qt, :page]).html_safe %>
|
6
6
|
<div class="controls">
|
7
7
|
<div class="input-append">
|
8
|
-
<label class="accessible-hidden"
|
9
|
-
<%= text_field_tag :q, q, :class => "q span50", :id => "search-field-header", :placeholder =>
|
8
|
+
<label class="accessible-hidden"><%= t('sufia.search.form.q.label') %></label>
|
9
|
+
<%= text_field_tag :q, q, :class => "q span50", :id => "search-field-header", :placeholder => t('sufia.search.form.q.placeholder') %><button type="submit" class="btn btn-info" id="search-submit-header"><i class="icon-search"></i> Go</button>
|
10
10
|
<!-- <input type="submit" class="btn btn-info" id="search-submit-header" value="GO"><i class="icon-search"></i></input>
|
11
11
|
-->
|
12
12
|
<%# link_to 'more options', params.merge(:controller=>"advanced", :action=>"index") , :class=>"advanced_search" if ! current_page?(advanced_path)%>
|
@@ -14,13 +14,12 @@ See the License for the specific language governing permissions and
|
|
14
14
|
limitations under the License.
|
15
15
|
%>
|
16
16
|
|
17
|
-
<% content_for :
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
<% javascript_include_tag 'jquery.clippy.js' %>
|
17
|
+
<% content_for :js_head do %>
|
18
|
+
<%= javascript_include_tag 'video.js' %>
|
19
|
+
<%= javascript_include_tag 'audio.min.js' %>
|
20
|
+
<%= stylesheet_link_tag 'video-js.css' %>
|
21
|
+
<%= javascript_include_tag 'dashboard.js' %>
|
22
|
+
<%= javascript_include_tag 'swfobject.js' %>
|
24
23
|
|
25
24
|
<script type = "text/javascript">
|
26
25
|
|
@@ -101,6 +100,7 @@ limitations under the License.
|
|
101
100
|
toggleButtons();
|
102
101
|
});
|
103
102
|
|
103
|
+
$('#documents').batchEdit();
|
104
104
|
|
105
105
|
/*$('a.copypaste').zclip({
|
106
106
|
path: "/assets/ZeroClipboard.swf",
|
@@ -14,4 +14,4 @@ See the License for the specific language governing permissions and
|
|
14
14
|
limitations under the License.
|
15
15
|
%>
|
16
16
|
|
17
|
-
The file <%= link_to(display_title(generic_file), generic_file_url(generic_file.noid)) %> has been updated.
|
17
|
+
The file <%= link_to(display_title(generic_file), sufia.generic_file_url(generic_file.noid)) %> has been updated.
|
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
|
14
14
|
limitations under the License.
|
15
15
|
%>
|
16
16
|
|
17
|
-
<%= form_for @generic_file, :url => sufia.generic_file_path, :html => {:multipart => true, :class => 'form-horizontal'
|
17
|
+
<%= form_for @generic_file, :url => sufia.generic_file_path, :html => {:multipart => true, :class => 'form-horizontal'} do |f| %>
|
18
18
|
<%= hidden_field_tag('generic_file[terms_of_service]', '1') %>
|
19
19
|
<%= hidden_field_tag('redirect_tab', 'descriptions') %>
|
20
20
|
<div id="descriptions_display">
|
@@ -17,7 +17,7 @@ limitations under the License.
|
|
17
17
|
<div id="versioning_display">
|
18
18
|
<h2 class="non lower">Versions</h2>
|
19
19
|
<div class="well">
|
20
|
-
<%= form_for @generic_file, :url => sufia.generic_file_path, :html => {:multipart => true, :class => 'form-horizontal'
|
20
|
+
<%= form_for @generic_file, :url => sufia.generic_file_path, :html => {:multipart => true, :class => 'form-horizontal'} do |f| %>
|
21
21
|
<%= hidden_field_tag('generic_file[terms_of_service]', '1') %>
|
22
22
|
<%= hidden_field_tag('redirect_tab', 'versions') %>
|
23
23
|
<h3>Upload New Version</h3>
|
@@ -14,17 +14,17 @@ See the License for the specific language governing permissions and
|
|
14
14
|
limitations under the License.
|
15
15
|
%>
|
16
16
|
|
17
|
-
<% content_for :
|
18
|
-
|
19
|
-
|
20
|
-
|
17
|
+
<% content_for :js_head do %>
|
18
|
+
<%= javascript_include_tag 'video.js' %>
|
19
|
+
<%= javascript_include_tag 'audio.min.js' %>
|
20
|
+
<%= stylesheet_link_tag 'video-js.css' %>
|
21
21
|
|
22
|
-
|
23
|
-
|
24
|
-
|
22
|
+
<%= javascript_include_tag 'bootstrap-tooltip.js'%>
|
23
|
+
<%= javascript_include_tag 'bootstrap-popover.js'%>
|
24
|
+
<%= javascript_include_tag 'bootstrap-modal.js'%>
|
25
25
|
|
26
26
|
|
27
|
-
|
27
|
+
<%= javascript_include_tag 'jquery.validate.js' %>
|
28
28
|
|
29
29
|
<style type="text/css">
|
30
30
|
label.error { float: left; color: red; padding-left: .5em; vertical-align: top; }
|
@@ -35,7 +35,7 @@ label.error { float: left; color: red; padding-left: .5em; vertical-align: top;
|
|
35
35
|
|
36
36
|
<% content_for :local_js do %>
|
37
37
|
if (navigator.userAgent.match("MSIE")){
|
38
|
-
$("
|
38
|
+
$("form").validate();
|
39
39
|
}
|
40
40
|
initialize_audio();
|
41
41
|
|
@@ -92,7 +92,7 @@ $("a[rel=popover]").popover();
|
|
92
92
|
</ul>
|
93
93
|
<%= render :partial => "descriptions", :locals => { :generic_file => @generic_file } %>
|
94
94
|
|
95
|
-
<%= form_for @generic_file, :url => sufia.generic_file_path, :html => {:multipart => true, :class => 'form-horizontal', :id => '
|
95
|
+
<%= form_for @generic_file, :url => sufia.generic_file_path, :html => {:multipart => true, :class => 'form-horizontal', :id => 'permission'} do |f| %>
|
96
96
|
<%= hidden_field_tag('redirect_tab', 'permissions') %>
|
97
97
|
<%= render :partial => "permission", :locals => { :gf => @generic_file, :f=> f } %>
|
98
98
|
<% end %>
|
@@ -17,14 +17,14 @@ limitations under the License.
|
|
17
17
|
<h2>Upload</h2>
|
18
18
|
|
19
19
|
<div class="alert">
|
20
|
-
<strong>Note:</strong> You must agree to <a href='/agreement/' target="_blank"
|
20
|
+
<strong>Note:</strong> You must agree to <a href='/agreement/' target="_blank"><%= t('sufia.deposit_agreement') %></a> before starting your upload.
|
21
21
|
</div>
|
22
22
|
|
23
23
|
<div class="alert alert-info hide" id="redirect-loc" type="text/x-jquery-tmpl">
|
24
24
|
<%=sufia.batch_edit_path(@batch_noid)%>
|
25
25
|
</div>
|
26
26
|
|
27
|
-
<div id="upload_tooltip"
|
27
|
+
<div id="upload_tooltip"><%= t('sufia.upload_tooltip') %></div>
|
28
28
|
|
29
29
|
<div class="alert alert-info hide" id="success">
|
30
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.
|
@@ -51,7 +51,7 @@ limitations under the License.
|
|
51
51
|
<%= hidden_field_tag(:batch_id, @batch_noid) %>
|
52
52
|
<label class="checkbox">
|
53
53
|
<%= check_box_tag 'terms_of_service' %> I have read and do agree
|
54
|
-
to <%= link_to
|
54
|
+
to <%= link_to t('sufia.deposit_agreement'),
|
55
55
|
'/agreement/', :target => "_blank" %>.
|
56
56
|
</label>
|
57
57
|
<!-- The fileupload-buttonbar contains buttons to add/delete files and start/cancel the upload -->
|
@@ -238,7 +238,7 @@ var addthis_config = {"data_track_addressbar":true};
|
|
238
238
|
<th>Related Files</th>
|
239
239
|
<td>
|
240
240
|
<% @generic_file.related_files.each do |f| %>
|
241
|
-
<dd><%= link_to(f.label, generic_file_url(f.noid)) %></dd>
|
241
|
+
<dd><%= link_to(f.label, sufia.generic_file_url(f.noid)) %></dd>
|
242
242
|
<% end %>
|
243
243
|
</td>
|
244
244
|
</tr>
|
@@ -14,10 +14,10 @@ See the License for the specific language governing permissions and
|
|
14
14
|
limitations under the License.
|
15
15
|
%>
|
16
16
|
|
17
|
-
<% content_for :
|
17
|
+
<% content_for :js_head do %>
|
18
18
|
|
19
|
-
|
20
|
-
|
19
|
+
<%= javascript_include_tag 'bootstrap-tooltip.js'%>
|
20
|
+
<%= javascript_include_tag 'bootstrap-popover.js'%>
|
21
21
|
<% end %>
|
22
22
|
|
23
23
|
<% content_for :local_js do %>
|
data/config/locales/sufia.en.yml
CHANGED
@@ -1,6 +1,13 @@
|
|
1
1
|
en:
|
2
2
|
sufia:
|
3
|
-
product_name:
|
4
|
-
account_name:
|
5
|
-
institution_name:
|
3
|
+
product_name: "ScholarSphere"
|
4
|
+
account_name: "Penn State Access Account Id"
|
5
|
+
institution_name: "Penn State"
|
6
|
+
deposit_agreement: "ScholarSphere's Deposit Agreement"
|
7
|
+
upload_tooltip: "Please accept Deposit Agreement before you can upload."
|
8
|
+
search:
|
9
|
+
form:
|
10
|
+
q:
|
11
|
+
label: "Search Scholarsphere"
|
12
|
+
placeholder: "Type keywords in here"
|
6
13
|
|
@@ -11,6 +11,8 @@
|
|
11
11
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
12
|
# See the License for the specific language governing permissions and
|
13
13
|
# limitations under the License.
|
14
|
+
require "cucumber/rspec/doubles"
|
15
|
+
|
14
16
|
When /^I attach a file "([^"]*)" to the dynamically created "([^"]*)"$/ do |path, field|
|
15
17
|
find(field).native.send_keys(File.expand_path(path, Rails.root))
|
16
18
|
end
|
@@ -25,7 +27,7 @@ Given /^And I click within the anchor "(.*?)"$/ do |selector|
|
|
25
27
|
end
|
26
28
|
|
27
29
|
Given /^I have a mail server$/ do
|
28
|
-
ContactForm.any_instance.
|
30
|
+
ContactForm.any_instance.stub(:deliver).and_return(true)
|
29
31
|
end
|
30
32
|
|
31
33
|
Then /^I reset the mail server$/ do
|
data/features/support/paths.rb
CHANGED
data/lib/sufia/generic_file.rb
CHANGED
@@ -19,7 +19,6 @@ module Sufia
|
|
19
19
|
include Sufia::GenericFile::Audit
|
20
20
|
include Sufia::GenericFile::Permissions
|
21
21
|
|
22
|
-
@@FIELD_LABEL_MAP = {"based_near"=>"Location", 'description'=>"Abstract or Summary", 'tag'=>"Keyword", 'date_created'=>"Date Created", 'related_url'=>"Related URL"}
|
23
22
|
|
24
23
|
included do
|
25
24
|
has_metadata :name => "descMetadata", :type => GenericFileRdfDatastream
|
@@ -38,8 +37,6 @@ module Sufia
|
|
38
37
|
around_save :characterize_if_changed, :retry_warming
|
39
38
|
|
40
39
|
#make sure the terms of service is present and set to 1 before saving
|
41
|
-
# note GenericFile.create will no longer save a GenericFile as the terms_of_service will not be set
|
42
|
-
terms_of_service = nil
|
43
40
|
validates_acceptance_of :terms_of_service, :allow_nil => false
|
44
41
|
end
|
45
42
|
|
@@ -177,6 +174,8 @@ module Sufia
|
|
177
174
|
end
|
178
175
|
|
179
176
|
module ClassMethods
|
177
|
+
@@FIELD_LABEL_MAP = {"based_near"=>"Location", 'description'=>"Abstract or Summary", 'tag'=>"Keyword", 'date_created'=>"Date Created", 'related_url'=>"Related URL"}
|
178
|
+
|
180
179
|
def get_label(key)
|
181
180
|
label = @@FIELD_LABEL_MAP[key]
|
182
181
|
label = key.gsub('_',' ').titleize if label.blank?
|
@@ -34,7 +34,7 @@ module Sufia
|
|
34
34
|
|
35
35
|
## Extract the metadata from the content datastream and record it in the characterization datastream
|
36
36
|
def characterize
|
37
|
-
self.characterization.
|
37
|
+
self.characterization.ng_xml = self.content.extract_metadata
|
38
38
|
self.append_metadata
|
39
39
|
self.filename = self.label
|
40
40
|
self.terms_of_service = '1'
|
@@ -60,12 +60,12 @@ class BatchUpdateJob
|
|
60
60
|
return
|
61
61
|
end
|
62
62
|
gf.title = title[gf.pid] if title[gf.pid] rescue gf.label
|
63
|
-
gf.
|
63
|
+
gf.attributes=file_attributes
|
64
64
|
gf.set_visibility(visibility)
|
65
65
|
|
66
66
|
save_tries = 0
|
67
67
|
begin
|
68
|
-
gf.save
|
68
|
+
gf.save!
|
69
69
|
rescue RSolr::Error::Http => error
|
70
70
|
save_tries += 1
|
71
71
|
logger.warn "BatchUpdateJob caught RSOLR error on #{gf.pid}: #{error.inspect}"
|
data/lib/sufia/version.rb
CHANGED
data/lib/tasks/resque.rake
CHANGED
@@ -1 +1,27 @@
|
|
1
|
-
|
1
|
+
# Copyright © 2012 The Pennsylvania State University
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
|
15
|
+
require 'resque/pool/tasks'
|
16
|
+
|
17
|
+
# This provides access to the Rails env within all Resque workers
|
18
|
+
task 'resque:setup' => :environment
|
19
|
+
|
20
|
+
# Set up resque-pool
|
21
|
+
task 'resque:pool:setup' do
|
22
|
+
ActiveRecord::Base.connection.disconnect!
|
23
|
+
Resque::Pool.after_prefork do |job|
|
24
|
+
ActiveRecord::Base.establish_connection
|
25
|
+
Resque.redis.client.reconnect
|
26
|
+
end
|
27
|
+
end
|