umlaut 3.0.0alpha3 → 3.0.0alpha4

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -13,6 +13,7 @@ knowledge base. But it's actually quite a bit more than that.
13
13
  It could also be described as: a just-in-time aggregator of "last mile"
14
14
  specific-citation services, taking input as OpenURL, and providing both an
15
15
  HTML UI and an api suite for embedding Umlaut services in other products.
16
+ [What do you mean by this?](https://github.com/team-umlaut/umlaut/wiki/What-is-Umlaut-anyway)
16
17
 
17
18
  Umlaut is distributed as a ruby Rails engine gem. It's a very heavyweight engine,
18
19
  the point of distro'ing as a gem is to make it easy to keep local
@@ -105,10 +105,11 @@ h4 {
105
105
  border: 1px solid #FCF1D4;
106
106
  }
107
107
 
108
- .headerStatusBar {
108
+ .permalink_bar {
109
109
  border-bottom: 1px solid #eeb211;
110
110
  background-color: #FCF1D4;
111
- padding: .25em;
111
+ padding: .25em;
112
+ text-align: right;
112
113
  }
113
114
  .header {
114
115
  background-color: #FFFDEA;
@@ -48,7 +48,7 @@ class ResolveController < UmlautController
48
48
  # to view actual response.
49
49
  headers["x-umlaut-request_id"] = @user_request.id
50
50
  headers["x-umlaut-resolve_url"] = url_for( :controller => 'resolve', 'umlaut.request_id'.to_sym => @user_request.id )
51
- headers["x-umlaut-permalink_url"] = permalink_url( request, @user_request )
51
+ headers["x-umlaut-permalink_url"] = current_permalink_url()
52
52
 
53
53
  # Return empty body. Once we have the xml response done,
54
54
  # this really ought to return an xml response, but with
@@ -6,7 +6,7 @@ module Umlaut::ControllerLogic
6
6
  extend ActiveSupport::Concern
7
7
 
8
8
  included do
9
- helper_method :escape_xml, :url_for_with_co, :permalink_url, :with_format
9
+ helper_method :escape_xml, :url_for_with_co, :current_permalink_url, :with_format
10
10
  end
11
11
 
12
12
  protected
@@ -62,7 +62,7 @@ module Umlaut::ControllerLogic
62
62
  # helper method we need available in controllers too
63
63
  # Absolute URL for permalink for given request.
64
64
  # Have to supply rails request and umlaut request.
65
- def permalink_url(rails_request, umlaut_request, options = {})
65
+ def current_permalink_url(rails_request=request, umlaut_request=@user_request, options = {})
66
66
  # if we don't have everything, we can't make a permalink.
67
67
  unless (umlaut_request && umlaut_request.referent &&
68
68
  umlaut_request.referent.permalinks &&
@@ -170,11 +170,7 @@ module ResolveHelper
170
170
  end
171
171
 
172
172
 
173
- def link_to_toggle_debug_info(name = "[D]", options = {})
174
- javascript = " jQuery('.debug_info').toggle();"
175
-
176
- return link_to_function(name, javascript, options)
177
- end
173
+
178
174
 
179
175
  ##
180
176
  # Methods to grab SectionRenderer definitions from config. Caching in
@@ -48,7 +48,7 @@ module Umlaut::FooterHelper
48
48
  url += @user_request.to_context_object.kev
49
49
  url += "&sfx.ignore_date_threshold=1" if respond_to?(:title_level_request) && title_level_request?
50
50
 
51
- link_to "[S]", url
51
+ link_to "[S]", url, :title => "View in SFX"
52
52
  end
53
53
  end
54
54
 
@@ -57,8 +57,17 @@ module Umlaut::FooterHelper
57
57
  # debugging.
58
58
  def link_to_test_resolve
59
59
  if (test_base = umlaut_config.lookup!("test_resolve_base")) && @user_request
60
- link_to "[T]", test_base.chomp("?") + "?" + @user_request.to_context_object.kev
60
+ link_to "[T]", test_base.chomp("?") + "?" + @user_request.to_context_object.kev, :title => "View in Test #{umlaut_config.app_name}"
61
61
  end
62
62
  end
63
+
64
+ def link_to_toggle_debug_info(options = {})
65
+ options = {:text => "[D]", :title => "Toggle on-screen debug info"}.merge(options)
66
+
67
+ text = options.delete(:text)
68
+ javascript = " jQuery('.debug_info').toggle();"
69
+
70
+ return link_to_function(text, javascript, options)
71
+ end
63
72
 
64
73
  end
@@ -34,4 +34,9 @@ module Umlaut::HtmlHeadHelper
34
34
  render_opensearch_link + render_meta_refresh
35
35
  end
36
36
 
37
+ # String meant for use in <title>
38
+ def umlaut_title_text
39
+ umlaut_config.app_name + (@page_title ? " | #{@page_title}" : "")
40
+ end
41
+
37
42
  end
@@ -9,7 +9,7 @@
9
9
  <%= javascript_include_tag 'application' %>
10
10
 
11
11
  <title>
12
- <%= umlaut_config.app_name %> <%= "| #{@page_title}" if @page_title %>
12
+ <%= umlaut_title_text %>
13
13
  </title>
14
14
 
15
15
  <%= render_umlaut_head_content %>
@@ -19,18 +19,15 @@
19
19
 
20
20
  <div class="umlaut container">
21
21
 
22
- <div class="header">
22
+ <div id="header" class="header">
23
23
  <h1><%= umlaut_config.app_name %></h1>
24
24
  </div>
25
25
 
26
26
 
27
- <% if @user_request %>
28
- <div class="headerStatusBar">
29
- <div align="right" class="largeText">URL:
30
- <% url = permalink_url(request, @user_request) %>
31
- <%= link_to url, url %>
32
- </div>
33
- </div>
27
+ <% if permalink = current_permalink_url() %>
28
+ <div class="permalink_bar">
29
+ URL: <%= link_to current_permalink_url, current_permalink_url %>
30
+ </div>
34
31
  <% end %>
35
32
 
36
33
 
@@ -422,34 +422,6 @@ class SectionRenderer
422
422
  end
423
423
 
424
424
 
425
- # Convenience method for re-ordering sections in local resolve_views
426
- # initializer.
427
- # Swaps elements if necessary to ensure they are in the specified order.
428
- # For example, make sure holding comes before document_delivery:
429
- # SectionRenderer.ensureOrder("holding", "document_delivery")
430
- # Maybe in the future we'll expand this to take variable arguments.
431
- def self.swap_if_needed!(first, second)
432
-
433
- list = AppConfig.param("resolve_sections")
434
- return unless list
435
-
436
- index1 = find_index(list) {|s| s[:div_id] == first}
437
- index2 = find_index(list) {|s| s[:div_id] == second}
438
-
439
- (list[index1], list[index2] = list[index2], list[index1]) if index1 && index2 && (index1 > index2)
440
-
441
- list
442
- end
443
-
444
- # helper for swap_if_needed! and ensure_order!
445
- def self.find_index(array, &block)
446
- array.each_with_index do |value, index|
447
- return index if block.call(value)
448
- end
449
- return nil
450
- end
451
-
452
-
453
425
  protected
454
426
 
455
427
  def construct_options(arguments)
@@ -1,4 +1,3 @@
1
-
2
1
  namespace :umlaut do
3
2
  desc "Perform nightly maintenance. Set up in cron."
4
3
  task :nightly_maintenance => [:load_sfx_urls, :expire_sessions, :expire_old_data]
@@ -44,7 +43,7 @@ namespace :umlaut do
44
43
  hosts.each {|h| SfxUrl.new({:url => h}).save! unless ignore_urls.find {|ignore| ignore === h }}
45
44
  end
46
45
  else
47
- puts "Skipping load of SFXURLs via direct access to SFX db. No direct access is configured. Configure in config/umlaut_config/database.yml"
46
+ puts "Skipping load of SFXURLs via direct access to SFX db. No direct access is configured. Configure in config/database.yml sfx_db"
48
47
  end
49
48
  end
50
49
 
@@ -12,8 +12,8 @@ namespace :umlaut do
12
12
  end
13
13
 
14
14
  # Turn off all caching we can think of with AR, cause it's gonna
15
- # take too much memory!
16
- IdentityMap.enabled = false
15
+ # take too much memory! I _think_ this will do that.
16
+ ActiveRecord::IdentityMap.enabled = false
17
17
 
18
18
 
19
19
  unless ActiveRecord::Base.configurations[old_connection_name]
@@ -55,37 +55,39 @@ namespace :umlaut do
55
55
  }
56
56
  bulk_queue = []
57
57
  i = 0
58
- OldPermalink.find_each(:batch_size => 20000) do |old_p|
59
- i += 1
60
-
61
- if old_p.context_obj_serialized.blank?
62
- could_not_migrate[:count] += 1
63
- count_not_migrate[:highest_id] = [count_not_migrate[:highest_id], old_p.id].max
64
- could_not_migrate[:latest_date] = [could_not_migrate[:latest_date], old_p.created_on].max
65
- else
66
- new_p = Permalink.new
67
- new_p.id = old_p.id # keep the id the same!
68
- new_p.created_on = old_p.created_on # why not keep it the same?
69
- new_p.orig_rfr_id = old_p.orig_rfr_id # why not
58
+ ActiveRecord::Base.uncached do
59
+ OldPermalink.find_each(:batch_size => 20000) do |old_p|
60
+ i += 1
70
61
 
71
- # the important thing to be able to actually resolve it
72
- new_p.context_obj_serialized = old_p.context_obj_serialized
62
+ if old_p.context_obj_serialized.blank?
63
+ could_not_migrate[:count] += 1
64
+ count_not_migrate[:highest_id] = [count_not_migrate[:highest_id], old_p.id].max
65
+ could_not_migrate[:latest_date] = [could_not_migrate[:latest_date], old_p.created_on].max
66
+ else
67
+ new_p = Permalink.new
68
+ new_p.id = old_p.id # keep the id the same!
69
+ new_p.created_on = old_p.created_on # why not keep it the same?
70
+ new_p.orig_rfr_id = old_p.orig_rfr_id # why not
71
+
72
+ # the important thing to be able to actually resolve it
73
+ new_p.context_obj_serialized = old_p.context_obj_serialized
74
+
75
+ if ar_import
76
+ bulk_queue << new_p
77
+ else
78
+ new_p.save!
79
+ end
80
+ end
81
+
82
+ print(".") if i % 1000 == 0
73
83
 
74
- if ar_import
75
- bulk_queue << new_p
76
- else
77
- new_p.save!
84
+ if ar_import && i % 10000 == 0
85
+ print "+"
86
+ Permalink.import(bulk_queue, :validate => false, :timestamps => false)
87
+ bulk_queue.clear
78
88
  end
89
+
79
90
  end
80
-
81
- print(".") if i % 1000 == 0
82
-
83
- if ar_import && i % 10000 == 0
84
- print "+"
85
- Permalink.import(bulk_queue, :validate => false, :timestamps => false)
86
- bulk_queue.clear
87
- end
88
-
89
91
  end
90
92
 
91
93
  unless bulk_queue.empty?
@@ -1,3 +1,3 @@
1
1
  module Umlaut
2
- VERSION = "3.0.0alpha3"
2
+ VERSION = "3.0.0alpha4"
3
3
  end
@@ -14,9 +14,12 @@ module UmlautConfigurable
14
14
  class_attribute :umlaut_config
15
15
  helper_method :umlaut_config
16
16
  self.umlaut_config = Confstruct::Configuration.new
17
+
18
+
17
19
  end
18
20
 
19
-
21
+
22
+
20
23
 
21
24
  # Call as UmlautConfigurable.set_default_configuration!(confstruct_obj)
22
25
  # to initialize
@@ -211,6 +214,29 @@ module UmlautConfigurable
211
214
  #
212
215
  # Look in comments at top of SectionRenderer class for what the keys
213
216
  # in each entry mean.
217
+
218
+
219
+ # We add a custom method into the resolve_sections array,
220
+ # ensure_order!.
221
+ resolve_sections [].extend Module.new do
222
+ # Convenience method for re-ordering sections
223
+ # Swaps elements if necessary to ensure they are in the specified order.
224
+ # For example, make sure holding comes before document_delivery:
225
+ # resolve_sections.ensure_order!("holding", "document_delivery")
226
+ # Maybe in the future we'll expand this to take variable arguments.
227
+ def self.ensure_order!(first, second)
228
+
229
+ list = self
230
+
231
+ index1 = list.index {|s| s[:div_id].to_s == first.to_s}
232
+ index2 = list.index {|s| s[:div_id].to_s == second.to_s}
233
+
234
+ (list[index1], list[index2] = list[index2], list[index1]) if index1 && index2 && (index1 > index2)
235
+
236
+ list
237
+ end
238
+ end
239
+
214
240
  add_resolve_sections! do
215
241
  div_id "cover_image"
216
242
  partial "cover_image"
@@ -250,7 +276,7 @@ module UmlautConfigurable
250
276
  end
251
277
 
252
278
  add_resolve_sections! do
253
- div_id :holding
279
+ div_id "holding"
254
280
  section_title ServiceTypeValue[:holding].display_name_pluralize
255
281
  html_area :main
256
282
  partial 'holding'
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: umlaut
3
3
  version: !ruby/object:Gem::Version
4
- hash: -3702664390
4
+ hash: -3702664396
5
5
  prerelease: 5
6
6
  segments:
7
7
  - 3
8
8
  - 0
9
9
  - 0
10
10
  - alpha
11
- - 3
12
- version: 3.0.0alpha3
11
+ - 4
12
+ version: 3.0.0alpha4
13
13
  platform: ruby
14
14
  authors:
15
15
  - Jonathan Rochkind, et al
@@ -17,7 +17,7 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2011-12-29 00:00:00 Z
20
+ date: 2012-01-03 00:00:00 Z
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
23
23
  requirement: &id001 !ruby/object:Gem::Requirement
@@ -176,7 +176,6 @@ files:
176
176
  - app/controllers/umlaut/controller_behavior.rb
177
177
  - app/controllers/resource_controller.rb
178
178
  - app/controllers/resolve_controller.rb
179
- - app/controllers/application_controller.rb
180
179
  - app/controllers/umlaut_controller.rb
181
180
  - app/controllers/search_controller.rb
182
181
  - app/assets/images/jhu_findit.gif
@@ -278,7 +277,6 @@ files:
278
277
  - app/views/umlaut/README
279
278
  - app/views/layouts/umlaut.html.erb
280
279
  - app/helpers/emailer_helper.rb
281
- - app/helpers/application_helper.rb
282
280
  - app/helpers/export_email_helper.rb
283
281
  - app/helpers/umlaut/html_head_helper.rb
284
282
  - app/helpers/umlaut/footer_helper.rb
@@ -399,7 +397,6 @@ files:
399
397
  - ./test/dummy/db/schema.rb
400
398
  - ./test/dummy/db/migrate/20111228211210_umlaut_init.rb
401
399
  - ./test/dummy/log/production.log
402
- - ./test/dummy/log/development.log
403
400
  - ./test/performance/browsing_test.rb
404
401
  - ./test/unit/aleph_record_benchmarks.rb
405
402
  - ./test/unit/aws_product_sign_test.rb
@@ -490,7 +487,6 @@ test_files:
490
487
  - ./test/dummy/db/schema.rb
491
488
  - ./test/dummy/db/migrate/20111228211210_umlaut_init.rb
492
489
  - ./test/dummy/log/production.log
493
- - ./test/dummy/log/development.log
494
490
  - ./test/performance/browsing_test.rb
495
491
  - ./test/unit/aleph_record_benchmarks.rb
496
492
  - ./test/unit/aws_product_sign_test.rb
@@ -1,14 +0,0 @@
1
- # Filters added to this controller apply to all controllers in the application.
2
- # Likewise, all the methods added will be available for all controllers.
3
-
4
- class ApplicationController < ActionController::Base
5
-
6
-
7
- protect_from_forgery
8
-
9
-
10
-
11
-
12
- end
13
-
14
-
@@ -1,4 +0,0 @@
1
- # Methods added to this helper will be available to all templates in the application.
2
- module ApplicationHelper
3
-
4
- end
File without changes