umlaut 3.0.3 → 3.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -45,3 +45,5 @@ https://github.com/team-umlaut/umlaut/
45
45
 
46
46
  You can join the umlaut listserv at:
47
47
  http://rubyforge.org/mail/?group_id=4382
48
+
49
+ ## Build Status [![Build Status](https://secure.travis-ci.org/team-umlaut/umlaut.png)](http://travis-ci.org/team-umlaut/umlaut)
@@ -0,0 +1,23 @@
1
+ # ajax_windows.js. Support for modal popup windows in Umlaut items.
2
+ $ ->
3
+ shared_modal_d = $("<div></div>").dialog({autoOpen: false, modal: true, width: "400px"})
4
+ $("a.ajax_window").live "click", (event)->
5
+ $(shared_modal_d).load this.href, ->
6
+ heading = shared_modal_d.find("h1, h2, h3, h4, h5, h6").eq(0).remove()
7
+ $(shared_modal_d).dialog "option", "title", heading.text()
8
+ $(shared_modal_d).dialog "open"
9
+ false
10
+
11
+ ajax_form_catch = (event) ->
12
+ $(shared_modal_d).load $(event.target).closest("form").attr("action"), $(event.target).closest("form").serialize(), ->
13
+ heading = shared_modal_d.find("h1, h2, h3, h4, h5, h6").eq(0).remove()
14
+ $(shared_modal_d).dialog "option", "title", heading.text()
15
+ $(shared_modal_d).dialog "open"
16
+ return false;
17
+
18
+ # # Trapping two events, click on the submit button or submit on the form
19
+ # # is strangely needed in IE7 to trap both return-in-field submits
20
+ # # and click-on-button submits. In FF just the second "submit" version
21
+ # # is sufficient.
22
+ $("form.modal_dialog_form input[type=submit]").live "click", ajax_form_catch
23
+ $("form.modal_dialog_form").live "submit", ajax_form_catch
@@ -2,11 +2,10 @@ class ExportEmailController < UmlautController
2
2
 
3
3
  before_filter :load_objects
4
4
  layout Proc.new { |controller|
5
- if (controller.request.xhr? ||
6
- controller.params["X-Requested-With"] == "XmlHttpRequest")
5
+ if (controller.request.xhr? || controller.params["X-Requested-With"] == "XmlHttpRequest")
7
6
  nil
8
7
  else
9
- config.layout
8
+ umlaut_config.layout
10
9
  end
11
10
  }
12
11
 
@@ -16,108 +15,78 @@ class ExportEmailController < UmlautController
16
15
  end
17
16
 
18
17
  def email
19
-
20
18
  end
21
19
 
22
20
  def txt
23
-
24
21
  end
25
22
 
26
23
  def send_email
27
24
  @email = params[:email]
28
25
  @fulltexts = @user_request.get_service_type('fulltext', { :refresh=>true })
29
26
  @holdings = @user_request.get_service_type('holding', { :refresh=>true })
30
-
31
- if valid_email?
32
- Emailer.citation(@email, @user_request, @fulltexts, @holdings).deliver
33
- respond_to do |format|
34
- format.html { render }
35
- end
36
- else
37
- @partial = "email"
38
- flash[:error] = email_validation_error
39
- redirect_to params_preserve_xhr(params.merge(:action => "email"))
27
+ if valid_email?
28
+ Emailer.citation(@email, @user_request, @fulltexts, @holdings).deliver
29
+ respond_to do |format|
30
+ format.html { render }
40
31
  end
41
-
32
+ else
33
+ @partial = "email"
34
+ flash[:error] = email_validation_error
35
+ redirect_to params_preserve_xhr(params.merge(:action => "email"))
36
+ end
42
37
  end
43
38
 
44
39
  def send_txt
45
40
  @number = params[:number]
46
41
  # Remove any punctuation or spaces etc
47
42
  @number.gsub!(/[^\d]/, '') if @number
48
-
49
-
50
43
  @provider = params[:provider]
51
-
52
44
  @email = "#{@number}@#{@provider}" unless @number.nil? or @provider.nil?
53
-
54
45
  @holding_id = params[:holding]
55
-
56
- if valid_txt_number? && valid_txt_holding?
57
- Emailer.short_citation(@email, @user_request, location(@holding_id), call_number(@holding_id)).deliver
58
-
59
- render # send_txt.rhtml
60
- else
61
- flash[:error] = txt_validation_error
62
- redirect_to params_preserve_xhr(params.merge(:action => "txt"))
63
- end
46
+ if valid_txt_number? && valid_txt_holding?
47
+ Emailer.short_citation(@email, @user_request, holding_location(@holding_id), call_number(@holding_id)).deliver
48
+ render # send_txt.rhtml
49
+ else
50
+ flash[:error] = txt_validation_error
51
+ redirect_to params_preserve_xhr(params.merge(:action => "txt"))
52
+ end
64
53
  end
65
54
 
66
55
  private
67
- def valid_txt_number?
68
- return (! @number.blank?) && @number.length == 10
69
- end
56
+ def valid_txt_number?
57
+ return (! @number.blank?) && @number.length == 10
58
+ end
70
59
 
71
- def valid_txt_holding?
72
- return ! @holding_id.blank?
73
- end
74
-
75
- def valid_email?
76
- return @email =~ /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i
77
- end
78
-
60
+ def valid_txt_holding?
61
+ return ! @holding_id.blank?
62
+ end
63
+
64
+ def valid_email?
65
+ return @email =~ /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i
66
+ end
79
67
 
80
68
  def txt_validation_error
81
- rv = ""
82
- unless valid_txt_number? && valid_txt_holding?
83
- rv += "<div class=\"validation_errors\">"
84
- rv += "<span>Please provide the following:</span>"
85
- rv += "<ul>"
86
- rv += "<li>a valid number</li>" unless valid_txt_number?
87
- rv += "<li>the item you wish to send</li>" unless valid_txt_holding?
88
- rv += "</ul>"
89
- rv += "</div>"
90
- end
91
- return rv
69
+ errors = []
70
+ errors << "a valid number" unless valid_txt_number?
71
+ errors << "the item you wish to send" unless valid_txt_holding?
72
+ errors
92
73
  end
93
74
 
94
75
  def email_validation_error
95
- rv = ""
96
- unless valid_email?
97
- rv += "<div class=\"validation_errors\">"
98
- rv += "<span>Please provide the following:</span>"
99
- rv += "<ul>"
100
- rv += "<li>a valid email address</li>"
101
- rv += "</ul>"
102
- rv += "</div>"
103
- end
104
- return rv
76
+ errors = []
77
+ errors << "a valid email address"
78
+ errors
105
79
  end
106
80
 
107
81
  def holding(id)
108
82
  return ServiceResponse.find(id) unless id.nil?
109
83
  end
110
84
 
111
- def location(id)
85
+ def holding_location(id)
112
86
  return holding(id).view_data[:collection_str] unless holding(id).nil?
113
87
  end
114
88
 
115
89
  def call_number(id)
116
90
  return holding(id).view_data[:call_number] unless holding(id).nil?
117
91
  end
118
-
119
-
120
-
121
-
122
-
123
- end
92
+ end
@@ -288,13 +288,13 @@ class SearchController < UmlautController
288
288
  end
289
289
 
290
290
  def search_method_module
291
- umlaut_config.lookup!("az_search_method", SearchMethods::Sfx4)
291
+ umlaut_config.lookup!("search.az_search_method", SearchMethods::Sfx4)
292
292
  end
293
293
 
294
294
  # sfx a-z profile as defined in config, used for direct db connections
295
295
  # to sfx.
296
296
  def sfx_az_profile
297
- umlaut_config.lookup!("sfx_az_profile", "default")
297
+ umlaut_config.lookup!("search.sfx_az_profile", "default")
298
298
  end
299
299
  helper_method :sfx_az_profile
300
300
 
@@ -3,18 +3,14 @@ module ExportEmailHelper
3
3
 
4
4
  def formatted_txt_holding_status(view_data)
5
5
  output = ""
6
-
7
6
  output << view_data[:collection_str] if view_data[:collection_str]
8
7
  output << " " + view_data[:call_number] if view_data[:call_number]
9
8
  output << " " + view_data[:status] if view_data[:status]
10
-
11
9
  return output
12
10
  end
13
11
 
14
12
  def formatted_html_holding_status(view_data)
15
13
  output = "".html_safe
16
-
17
-
18
14
  if view_data[:collection_str]
19
15
  output << content_tag("span", view_data[:collection_str], :class => "collection")
20
16
  end
@@ -24,11 +20,19 @@ module ExportEmailHelper
24
20
  if view_data[:status]
25
21
  output << " ".html_safe << content_tag("span", view_data[:status], :class => "status")
26
22
  end
27
-
28
23
  return output
29
24
  end
30
25
 
31
-
32
-
33
-
34
- end
26
+ def validation_error(errors)
27
+ return content_tag(:div, :class => "validation_errors") do
28
+ return content_tag(:span, "Please provide the following:") +
29
+ content_tag(:ul) do
30
+ e = "".html_safe
31
+ errors.each do |error|
32
+ e << content_tag(:li, error)
33
+ end
34
+ e
35
+ end
36
+ end
37
+ end
38
+ end
@@ -1,4 +1,5 @@
1
1
  class ReferentValue < ActiveRecord::Base
2
+ attr_accessible :key_name, :value, :normalized_value, :metadata, :private_data
2
3
  belongs_to :referent, :include => :referent_values
3
4
 
4
5
  # Class method to normalize a string for normalized_value attribute.
@@ -3,15 +3,17 @@ module SfxDb
3
3
  self.table_name = 'AZ_TITLE_VER3'
4
4
  self.primary_key = 'AZ_TITLE_VER3_ID'
5
5
 
6
- belongs_to :object,
7
- :foreign_key => 'OBJECT_ID',
8
- :class_name => "SfxDb::Object"
9
-
6
+ belongs_to :object,
7
+ :foreign_key => 'OBJECT_ID',
8
+ :class_name => "SfxDb::Object"
9
+
10
10
  has_many :az_additional_titles,
11
- :foreign_key => 'AZ_TITLE_VER3_ID'
12
- has_many :az_letter_groups,
13
- :foreign_key => 'AZ_TITLE_VER3_ID'
11
+ :foreign_key => 'AZ_TITLE_VER3_ID',
12
+ :class_name => "SfxDb::AzAdditionalTitle"
14
13
 
14
+ has_many :az_letter_groups,
15
+ :foreign_key => 'AZ_TITLE_VER3_ID',
16
+ :class_name => "SfxDb::AzLetterGroup"
15
17
 
16
18
  def to_context_object
17
19
  #require 'openurl'
@@ -3,7 +3,8 @@ module SfxDb
3
3
  self.table_name = 'TARGET'
4
4
  self.primary_key = 'INTERNAL_ID'
5
5
 
6
- has_many :target_services,
7
- :foreign_key => 'TARGET'
6
+ has_many :target_services,
7
+ :foreign_key => 'TARGET',
8
+ :class_name => "SfxDb::TargetService"
8
9
  end
9
10
  end
@@ -7,7 +7,7 @@ cite = @user_request.referent.to_citation %>
7
7
  <h2>Email the title and locations</h2>
8
8
 
9
9
  <div class="formError">
10
- <%= @error || flash[:error] %>
10
+ <%= validation_error( @error || flash[:error]) if ( @error || flash[:error]) %>
11
11
  </div>
12
12
 
13
13
  <h3><strong>Title:</strong> <%= h(cite[:title]) %>/<%= h(cite[:author]) %></h3>
@@ -7,7 +7,7 @@ unless @user_request.nil?
7
7
  <h2>Send the title and location of an item to your mobile phone</h2>
8
8
 
9
9
  <div class="formError">
10
- <%= @error || flash[:error] %>
10
+ <%= validation_error( @error || flash[:error]) if ( @error || flash[:error]) %>
11
11
  </div>
12
12
 
13
13
  <h3><strong>Title:</strong>
@@ -54,7 +54,7 @@ class PrimoSource < PrimoService
54
54
  service_data[attr] = holding.method(attr).call
55
55
  end
56
56
  @source_attributes.each do |attr|
57
- service_data[attr.to_sym] = holding.method(attr.to_sym).call
57
+ service_data[attr.to_sym] = holding.method(attr.to_sym).call if holding.respond_to?(attr.to_sym)
58
58
  end
59
59
  service_data.merge!({
60
60
  :call_number => holding.call_number, :collection => holding.collection,
@@ -1,3 +1,3 @@
1
1
  module Umlaut
2
- VERSION = "3.0.3"
2
+ VERSION = "3.0.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: umlaut
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.3
4
+ version: 3.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-08-21 00:00:00.000000000 Z
12
+ date: 2012-11-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -304,8 +304,8 @@ files:
304
304
  - app/assets/images/error.gif
305
305
  - app/assets/javascripts/umlaut_ui.js
306
306
  - app/assets/javascripts/umlaut.js
307
+ - app/assets/javascripts/umlaut/ajax_windows.js.coffee
307
308
  - app/assets/javascripts/umlaut/update_html.js
308
- - app/assets/javascripts/umlaut/ajax_windows.js
309
309
  - app/assets/javascripts/umlaut/simple_visible_toggle.js
310
310
  - app/assets/javascripts/umlaut/ensure_window_size.js.erb
311
311
  - app/assets/javascripts/umlaut/expand_contract_toggle.js
@@ -468,7 +468,6 @@ files:
468
468
  - README.md
469
469
  - ./test/integration/request_test.rb
470
470
  - ./test/integration/request_reuse_test.rb
471
- - ./test/integration/permalinks_test.rb
472
471
  - ./test/dummy/tmp/cache/assets/D16/F90/sprockets%2F5fe3c021048c6f9a6086bed7736d87b1
473
472
  - ./test/dummy/tmp/cache/assets/DE8/790/sprockets%2Fd1333bde2b9aafcc712d11dd09ab35d8
474
473
  - ./test/dummy/tmp/cache/assets/CD1/F20/sprockets%2F385e5fb31cf27e262480d1174be1d500
@@ -575,7 +574,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
575
574
  version: '0'
576
575
  segments:
577
576
  - 0
578
- hash: -1929703717396747492
577
+ hash: 1628836782081809943
579
578
  required_rubygems_version: !ruby/object:Gem::Requirement
580
579
  none: false
581
580
  requirements:
@@ -584,7 +583,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
584
583
  version: '0'
585
584
  segments:
586
585
  - 0
587
- hash: -1929703717396747492
586
+ hash: 1628836782081809943
588
587
  requirements: []
589
588
  rubyforge_project:
590
589
  rubygems_version: 1.8.24
@@ -595,7 +594,6 @@ summary: For Libraries, a just-in-time last-mile service aggregator, taking Open
595
594
  test_files:
596
595
  - ./test/integration/request_test.rb
597
596
  - ./test/integration/request_reuse_test.rb
598
- - ./test/integration/permalinks_test.rb
599
597
  - ./test/dummy/tmp/cache/assets/D16/F90/sprockets%2F5fe3c021048c6f9a6086bed7736d87b1
600
598
  - ./test/dummy/tmp/cache/assets/DE8/790/sprockets%2Fd1333bde2b9aafcc712d11dd09ab35d8
601
599
  - ./test/dummy/tmp/cache/assets/CD1/F20/sprockets%2F385e5fb31cf27e262480d1174be1d500
@@ -1,35 +0,0 @@
1
- /* ajax_windows.js. Support for modal popup windows in Umlaut items. */
2
- jQuery(document).ready(function($) {
3
-
4
- var shared_modal_d = $("<div></div>").dialog({autoOpen: false, modal: true, width: "400px"}) ;
5
-
6
- $("a.ajax_window").live("click", function(event) {
7
-
8
- $(shared_modal_d).load( this.href, function() {
9
- var heading = shared_modal_d.find("h1, h2, h3, h4, h5, h6").eq(0).remove();
10
- $(shared_modal_d).dialog("option", "title", heading.text());
11
- $(shared_modal_d).dialog("open");
12
- });
13
- return false;
14
- });
15
-
16
- function ajax_form_catch(event) {
17
- $(shared_modal_d).load( $(event.target).closest("form").attr("action"), $(event.target).closest("form").serialize(), function() {
18
- var heading = shared_modal_d.find("h1, h2, h3, h4, h5, h6").eq(0).remove();
19
- $(shared_modal_d).dialog("option", "title", heading.text());
20
- $(shared_modal_d).dialog("open");
21
-
22
- });
23
- return false;
24
- }
25
-
26
- //Trapping two events, click on the submit button or submit on the form
27
- //is strangely needed in IE7 to trap both return-in-field submits
28
- //and click-on-button submits. In FF just the second "submit" version
29
- //is sufficient.
30
- $("form.modal_dialog_form input[type=submit]").live("click", ajax_form_catch );
31
- $("form.modal_dialog_form").live( "submit", ajax_form_catch);
32
-
33
-
34
-
35
- });
@@ -1,19 +0,0 @@
1
- require 'test_helper'
2
-
3
- class PermalinksTest < ActionDispatch::IntegrationTest
4
-
5
-
6
- test "missing id" do
7
- sess = open_session
8
-
9
- missing_id = 999999999
10
-
11
- sess.get "/go/#{missing_id}"
12
-
13
- assert_response(:missing)
14
-
15
- end
16
-
17
-
18
-
19
- end