umlaut 3.0.0alpha5 → 3.0.0alpha6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. data/app/assets/javascripts/umlaut/update_html.js +21 -0
  2. data/app/assets/javascripts/umlaut_ui.js +15 -0
  3. data/app/helpers/resolve_helper.rb +14 -4
  4. data/app/views/resolve/api.xml.builder +10 -14
  5. data/lib/#Untitled-1# +14 -0
  6. data/lib/umlaut/routes.rb +14 -1
  7. data/lib/umlaut/version.rb +1 -1
  8. data/lib/umlaut.rb +12 -9
  9. data/test/dummy/tmp/cache/assets/C5F/340/sprockets%2F99692920160b7a279b86a80415b79db7 +0 -0
  10. data/test/dummy/tmp/cache/assets/C70/4D0/sprockets%2F034ad2036e623081bd352800786dfe80 +0 -0
  11. data/test/dummy/tmp/cache/assets/CBB/9C0/sprockets%2F706f28923fb754cad04b9107c89986a1 +31 -0
  12. data/test/dummy/tmp/cache/assets/CBF/B60/sprockets%2F08ca89671549936265dcb673bf02e36f +0 -0
  13. data/test/dummy/tmp/cache/assets/CC9/9F0/sprockets%2F306166316e2cafd13c15e62b51a2339d +0 -0
  14. data/test/dummy/tmp/cache/assets/CF7/2B0/sprockets%2F25a7c73655bd3598173b39d9f98bcd46 +880 -0
  15. data/test/dummy/tmp/cache/assets/CFE/080/sprockets%2F37fe9f4255baddbd549a659914929398 +0 -0
  16. data/test/dummy/tmp/cache/assets/D0B/E10/sprockets%2F1444763abc4444a8e129efdb9a43235f +378 -0
  17. data/test/dummy/tmp/cache/assets/D1F/830/sprockets%2Fe6a7a907a8e9b43780a80fe69a92913d +11773 -0
  18. data/test/dummy/tmp/cache/assets/D22/060/sprockets%2F9aec77b768e91a802d284271c58e2f7e +21361 -0
  19. data/test/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705 +0 -0
  20. data/test/dummy/tmp/cache/assets/D33/6D0/sprockets%2F500129c57f1146e556ec3aacd6cd38c1 +158 -0
  21. data/test/dummy/tmp/cache/assets/D50/7B0/sprockets%2F6df95fb9a4189df351c1c88546c84a1d +394 -0
  22. data/test/dummy/tmp/cache/assets/D54/ED0/sprockets%2F71c9fa01091d432b131da3bb73faf3d4 +877 -0
  23. data/test/dummy/tmp/cache/assets/D69/820/sprockets%2F55a4f1a7c4918d71c0d4fb5b7dd4c055 +9272 -0
  24. data/test/dummy/tmp/cache/assets/D71/6B0/sprockets%2Fde558b71b494cf09b1bf055c8dff0353 +53 -0
  25. data/test/dummy/tmp/cache/assets/D72/610/sprockets%2Fa8c708eeb30ef93de34d755d4f45d023 +864 -0
  26. data/test/dummy/tmp/cache/assets/D76/AD0/sprockets%2Fe2158cde93188cf5ab6457bc6d6602ec +41 -0
  27. data/test/dummy/tmp/cache/assets/D84/210/sprockets%2Fabd0103ccec2b428ac62c94e4c40b384 +21744 -0
  28. data/test/dummy/tmp/cache/assets/D9B/770/sprockets%2F8aacf02eb7dbb0949704b28f27b87e0b +39 -0
  29. data/test/dummy/tmp/cache/assets/DD0/140/sprockets%2F1656d1d8f4c13fe42aff6553c6cdcda7 +11789 -0
  30. data/test/dummy/tmp/cache/assets/DE8/790/sprockets%2Fd1333bde2b9aafcc712d11dd09ab35d8 +0 -0
  31. data/test/dummy/tmp/cache/assets/DF1/AA0/sprockets%2Fedd37b0fdb6157fccb2297a8a10acc90 +9288 -0
  32. data/test/dummy/tmp/cache/assets/E03/570/sprockets%2F493bdc0ac14cd4f57fdfe4253f992bde +14 -0
  33. data/test/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af +0 -0
  34. data/test/dummy/tmp/cache/assets/E5F/960/sprockets%2Fdc007b6cad5c7ef08e33ec28cfff0ef6 +0 -0
  35. metadata +200 -98
  36. data/test/dummy/config/database-jhu.yml +0 -44
  37. data/test/dummy/config/database.yml +0 -53
@@ -148,5 +148,26 @@
148
148
  window.Umlaut = new Object();
149
149
  window.Umlaut.HtmlUpdater = HtmlUpdater;
150
150
 
151
+ /* LEGACY Loader was recommended for loading Umlaut JS behaviors
152
+ in an external page, for JQuery Content Utility.
153
+
154
+ var loader = new Umlaut.Loader();
155
+ loader.load();
156
+
157
+ We will provide just enough code to keep that from
158
+ error'ing (and halting js execution), although at present it does not
159
+ actually load the JS behaviors using new style, app wont' have
160
+ JS behaviors. */
161
+
162
+ window.Umlaut.Loader = function() {
163
+ this.load = function(option_list) {
164
+ // log problem in browsers that support it.
165
+ if (typeof console != "undefined" && typeof console.log != "undefined") {
166
+ console.log("WARN: Umlaut.Loader no longer supported in Umlaut 3.x, you have not loaded Umlaut JS Behaviors. See Umlaut documentation for new way.");
167
+ }
168
+ }
169
+ }
170
+
171
+
151
172
  })(jQuery);
152
173
 
@@ -0,0 +1,15 @@
1
+ /* This JS file can be referenced by external apps to add Umlaut JS UI behaviors
2
+ to a page that has had Umlaut content added to it via partial html snippets.
3
+
4
+ This is a sprockets manifest file requiring individual js behavior
5
+ files applicable.
6
+
7
+ At present, only expand/contract toggle behavior is actually supported,
8
+ others are non-applicable or hard to get working on an external site
9
+ due to cross-domain-origin stuff.
10
+
11
+
12
+ *= require 'umlaut/expand_contract_toggle.js'
13
+
14
+
15
+ */
@@ -77,7 +77,7 @@ module ResolveHelper
77
77
  # <% expand_contract_section("My Content", "div_id_to_use") do %>
78
78
  # this will be hidden and shown
79
79
  # <% end %>
80
- def expand_contract_section(arg_heading, id, options={}, &block)
80
+ def expand_contract_section(arg_heading, id, options={}, &block)
81
81
  expanded = (params["umlaut.show_#{id}"] == "true") || options[:initial_expand] || false
82
82
 
83
83
  icon = image_tag( ( expanded ? "list_open.png" : "list_closed.png"),
@@ -86,9 +86,20 @@ module ResolveHelper
86
86
  :border => "0")
87
87
  heading = content_tag(:span,( expanded ? "Hide " : "Show "), :class=>'expand_contract_action_label') + arg_heading
88
88
 
89
-
90
89
  link_params = params.merge('umlaut.request_id' => @user_request.id,
91
- "umlaut_show_#{id}" => (! expanded).to_s )
90
+ "umlaut.show_#{id}" => (! expanded).to_s ,
91
+
92
+ # Need to zero out format-related params for when we're coming
93
+ # from a partial html api request, so the link we generate
94
+ # is not to format json/xml/etc.
95
+ :format => nil,
96
+ 'umlaut.response_format' => nil,
97
+ 'umlaut.jsonp'=>nil,
98
+
99
+ # In Rails3, an :anchor param will actually be used for #fragmentIdentifier
100
+ # on end of url
101
+ :anchor => "#{id}_toggle_link"
102
+ )
92
103
 
93
104
  # Make sure a self-referencing link from partial_html_sections
94
105
  # really goes to full HTML view.
@@ -98,7 +109,6 @@ module ResolveHelper
98
109
 
99
110
  return content_tag(:div, :class => "expand_contract_section") do
100
111
  link_to( icon + heading, link_params,
101
- :anchor => "#{id}_toggle_link",
102
112
  :id => "#{id}_toggle_link",
103
113
  :class => "expand_contract_toggle" ) + "\n" +
104
114
  content_tag(:div, :id => id,
@@ -46,21 +46,17 @@ xml.umlaut do
46
46
  ["display_text", "url", "notes"].each do |att|
47
47
  xml.tag!(att, response.attributes[att])
48
48
  end
49
- response.service_data.keys.each do |key|
50
-
51
- xml.tag!(key) do
52
- value = nil
53
- # try calling to_xml, for instance for hashes
54
- begin
55
- value = response.service_data[key].to_xml(:root => "records", :skip_instruct => true)
56
- xml<< value
57
- rescue
58
- # oh well, no to_xml in there
59
- value = response.service_data[key]
60
- xml.text!(value.to_s) unless value.blank?
49
+
50
+ response.service_data.keys.each do |key|
51
+ value = response.service_data[key]
52
+ # If it's a complex obj with a :to_xml, like a hash, use it.
53
+ if value.respond_to?(:to_xml)
54
+ xml.tag!(key) do
55
+ xml << value.to_xml(:root => "records", :skip_instruct => true)
61
56
  end
62
-
63
- end
57
+ else
58
+ xml.tag!(key, value.to_s.strip)
59
+ end
64
60
  end
65
61
 
66
62
  xml.umlaut_passthrough_url(url_for(:controller=>'link_router', :action => "index", :id=>response.id, :only_path => false))
data/lib/#Untitled-1# ADDED
@@ -0,0 +1,14 @@
1
+ http://blacklight.mse.jhu.edu:3000/resolve/index?ctx_enc=info%3Aofi%2Fenc%3AUTF-8
2
+ &ctx_id=
3
+ &ctx_tim=2012-01-05T10%3A55%3A49-05%3A00
4
+ &ctx_ver=Z39.88-2004
5
+ &rfr_id=info%3Asid%3Alibrary.jhu.edu%2Fblacklight
6
+ &rft.genre=journal
7
+ &rft.issn=00987484
8
+ &rft.jtitle=JAMA%3A+the+journal+of+the+American+Medical+Association
9
+ &rft_id=https%3A%2F%2Fblacklight.mse.jhu.edu%2Fdemo%2Fcatalog%2Fbib_647591
10
+ &rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal
11
+ &umlaut.request_id=6
12
+ &umlaut_show_umlaut_fulltext=true
13
+ &url_ctx_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Actx
14
+ &url_ver=Z39.88-2004
data/lib/umlaut/routes.rb CHANGED
@@ -30,7 +30,7 @@ module Umlaut
30
30
  end
31
31
 
32
32
  def default_route_sets
33
- [:root, :permalinks, :a_z, :resolve, :open_search, :link_router, :export_email, :resources, :search]
33
+ [:root, :permalinks, :a_z, :resolve, :open_search, :link_router, :export_email, :resources, :search, :javascript]
34
34
  end
35
35
 
36
36
  module RouteSets
@@ -129,6 +129,19 @@ module Umlaut
129
129
  match 'search(/:action(/:id(.:format)))' => "search"
130
130
  end
131
131
  end
132
+
133
+ def javascript
134
+ add_routes do |options|
135
+ # Legacy location for update_html.js used by JQuery Content Utility
136
+ # to embed JS on external sites. Redirect to new location.
137
+ # Intentionally non-fingerprinted, most efficient thing
138
+ # we can do in this case is let the web server take care
139
+ # of Last-modified-by etc headers.
140
+ match 'javascripts/jquery/umlaut/update_html.js' => redirect("/assets/umlaut/update_html.js", :status => 301)
141
+
142
+ match 'images/spinner.gif' => redirect("/assets/spinner.gif")
143
+ end
144
+ end
132
145
 
133
146
  end
134
147
  include RouteSets
@@ -1,3 +1,3 @@
1
1
  module Umlaut
2
- VERSION = "3.0.0alpha5"
2
+ VERSION = "3.0.0alpha6"
3
3
  end
data/lib/umlaut.rb CHANGED
@@ -25,14 +25,17 @@ module Umlaut
25
25
  # I don't entirely understand what's going on.
26
26
  #config.eager_load_paths << File.join(self.root, "lib")
27
27
 
28
- # This makes our rake tasks visible. NOT NEEDED, tasks in lib/tasks
29
- # are avail by default, this ends up doing a double load.
30
- #rake_tasks do
31
- # Dir.chdir(File.expand_path(File.join(File.dirname(__FILE__), '..'))) do
32
- # Dir.glob(File.join('lib', 'tasks', '*.rake')).each do |railtie|
33
- # load railtie
34
- # end
35
- # end
36
- #end
28
+ # We need the update_html.js script to be available as it's own
29
+ # JS file too, not just compiled into application.js, so we can
30
+ # deliver it to external apps using it (JQuery Content Utility).
31
+ # It will now be available from path /assets/umlaut/update_html.js
32
+ # in production mode with precompiled assets, also in dev mode,
33
+ # whatevers.
34
+ initializer "#{engine_name}.asset_pipeline" do |app|
35
+ app.config.assets.precompile << 'umlaut/update_html.js'
36
+ app.config.assets.precompile << "umlaut_ui.js"
37
+ end
38
+
39
+
37
40
  end
38
41
  end
@@ -0,0 +1,31 @@
1
+ o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1325695618.004611: @value{ I" length:EFi{I" digest;
2
+ F"%169a41ce2d19740e03908cf9124200d3I" source;
3
+ FI"{/* expand_contract_toggle.js: Support for show more/hide more in lists of umlaut content. */
4
+
5
+ jQuery(document).ready(function($) {
6
+
7
+ $(".expand_contract_toggle").live("click", function() {
8
+ var content = $(this).next(".expand_contract_content");
9
+ var icon = $(this).parent().find('img.toggle_icon');
10
+
11
+ if (content.is(":visible")) {
12
+ icon.attr("src", icon.attr("src").replace("list_open.png", "list_closed.png"));
13
+ $(this).find(".expand_contract_action_label").text("Show ");
14
+
15
+ content.hide();
16
+
17
+ }
18
+ else {
19
+ icon.attr("src", icon.attr("src").replace("list_closed.png", "list_open.png"));
20
+ $(this).find(".expand_contract_action_label").text("Hide ");
21
+ content.show();
22
+ }
23
+
24
+ return false;
25
+ });
26
+
27
+
28
+ });
29
+ ;
30
+ FI"
31
+ F"%742ae9e3db24ddeb5c807914bde33141