blacklight 3.1.2 → 3.2.0pre1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (121) hide show
  1. data/.gitignore +5 -2
  2. data/README.md +7 -2
  3. data/VERSION +1 -1
  4. data/app/assets/images/favicon.ico +0 -0
  5. data/app/assets/javascripts/blacklight/blacklight.js +23 -1
  6. data/app/assets/stylesheets/blacklight/_catalog.css.scss +369 -0
  7. data/app/assets/stylesheets/blacklight/_facets.css.scss +117 -0
  8. data/app/assets/stylesheets/blacklight/_folder.css.scss +38 -0
  9. data/app/assets/stylesheets/blacklight/_formatting.css.scss +164 -0
  10. data/app/assets/stylesheets/blacklight/_header.css.scss +36 -0
  11. data/app/assets/stylesheets/blacklight/_layout.css.scss +79 -0
  12. data/app/assets/stylesheets/blacklight/_print.css.scss +54 -0
  13. data/app/assets/stylesheets/blacklight/_search_history.css.scss +44 -0
  14. data/app/assets/stylesheets/blacklight/_susy_framework.css.scss +228 -0
  15. data/app/assets/stylesheets/blacklight/blacklight.css.scss +27 -0
  16. data/app/assets/stylesheets/blacklight/blacklight_defaults.css.scss +48 -0
  17. data/app/controllers/bookmarks_controller.rb +2 -1
  18. data/app/controllers/folder_controller.rb +4 -0
  19. data/app/controllers/saved_searches_controller.rb +4 -0
  20. data/app/controllers/search_history_controller.rb +4 -0
  21. data/app/helpers/blacklight/blacklight_helper_behavior.rb +64 -104
  22. data/app/helpers/blacklight/catalog_helper_behavior.rb +4 -4
  23. data/app/helpers/blacklight/facets_helper_behavior.rb +52 -5
  24. data/app/helpers/blacklight/render_constraints_helper_behavior.rb +14 -59
  25. data/app/helpers/blacklight/search_history_constraints_helper_behavior.rb +56 -0
  26. data/app/helpers/search_history_constraints_helper.rb +3 -0
  27. data/app/models/record_mailer.rb +1 -2
  28. data/app/views/_flash_msg.html.erb +4 -5
  29. data/app/views/_user_util_links.html.erb +3 -1
  30. data/app/views/bookmarks/index.html.erb +2 -2
  31. data/app/views/catalog/_bookmark_control.html.erb +6 -6
  32. data/app/views/catalog/_facet_layout.html.erb +4 -0
  33. data/app/views/catalog/_facet_limit.html.erb +20 -33
  34. data/app/views/catalog/_facets.html.erb +1 -5
  35. data/app/views/catalog/_folder_control.html.erb +5 -5
  36. data/app/views/catalog/_index_default.html.erb +1 -1
  37. data/app/views/catalog/_search_form.html.erb +4 -3
  38. data/app/views/catalog/_show_default.html.erb +1 -1
  39. data/app/views/catalog/_show_tools.html.erb +6 -6
  40. data/app/views/catalog/_sort_and_per_page.html.erb +1 -1
  41. data/app/views/catalog/index.atom.builder +2 -2
  42. data/app/views/catalog/index.rss.builder +1 -1
  43. data/app/views/catalog/opensearch.xml.builder +10 -0
  44. data/app/views/catalog/show.html.erb +1 -1
  45. data/app/views/folder/_tools.html.erb +4 -4
  46. data/app/views/layouts/blacklight.html.erb +25 -37
  47. data/app/views/record_mailer/email_record.text.erb +1 -1
  48. data/app/views/record_mailer/sms_record.text.erb +2 -2
  49. data/app/views/search_history/index.html.erb +1 -1
  50. data/blacklight.gemspec +11 -9
  51. data/lib/{generators/blacklight/templates/SolrMarc.jar → SolrMarc.jar} +0 -0
  52. data/lib/blacklight.rb +5 -3
  53. data/lib/blacklight/catalog.rb +3 -4
  54. data/lib/blacklight/configurable.rb +54 -39
  55. data/lib/blacklight/configuration.rb +126 -0
  56. data/lib/blacklight/configuration/fields.rb +142 -0
  57. data/lib/blacklight/configuration/search_field.rb +12 -0
  58. data/lib/blacklight/configuration/solr_field.rb +12 -0
  59. data/lib/blacklight/configuration/sort_field.rb +17 -0
  60. data/lib/blacklight/controller.rb +16 -14
  61. data/lib/blacklight/engine.rb +1 -1
  62. data/lib/blacklight/global_configurable.rb +46 -0
  63. data/lib/blacklight/search_fields.rb +21 -54
  64. data/lib/blacklight/solr/document.rb +13 -3
  65. data/lib/blacklight/solr_helper.rb +88 -52
  66. data/lib/blacklight/utils.rb +18 -0
  67. data/lib/generators/blacklight/assets_generator.rb +14 -20
  68. data/lib/generators/blacklight/blacklight_generator.rb +14 -6
  69. data/lib/generators/blacklight/jetty_generator.rb +1 -1
  70. data/lib/generators/blacklight/templates/assets/standard.css.scss +51 -0
  71. data/lib/generators/blacklight/templates/catalog_controller.rb +148 -0
  72. data/lib/generators/blacklight/templates/config/blacklight_config.rb +2 -239
  73. data/lib/generators/blacklight/templates/config/sass.rb +5 -0
  74. data/lib/generators/blacklight/templates/solr_conf/schema.xml +514 -164
  75. data/lib/generators/blacklight/templates/solr_conf/solrconfig.xml +1591 -323
  76. data/lib/generators/blacklight/templates/solr_document.rb +2 -0
  77. data/lib/railties/all_tests.rake +36 -3
  78. data/lib/railties/blacklight_cucumber.rake +6 -4
  79. data/lib/railties/blacklight_rspec.rake +5 -4
  80. data/test_support/bin/run-tests.sh +2 -13
  81. data/test_support/bin/test.sh +30 -23
  82. data/test_support/features/did_you_mean.feature +14 -13
  83. data/test_support/features/step_definitions/saved_searches_steps.rb +1 -1
  84. data/test_support/features/step_definitions/search_steps.rb +4 -4
  85. data/test_support/spec/controllers/application_controller_spec.rb +3 -13
  86. data/test_support/spec/controllers/catalog_controller_spec.rb +102 -24
  87. data/test_support/spec/controllers/folder_controller_spec.rb +7 -1
  88. data/test_support/spec/helpers/blacklight_helper_spec.rb +45 -34
  89. data/test_support/spec/helpers/facets_helper_spec.rb +68 -0
  90. data/test_support/spec/helpers/html_head_helper_spec.rb +37 -0
  91. data/test_support/spec/helpers/{render_constraints_helper_spec.rb → search_history_constraints_helper_spec.rb} +26 -7
  92. data/test_support/spec/lib/blacklight_configurable_spec.rb +92 -0
  93. data/test_support/spec/lib/blacklight_configuration_spec.rb +295 -0
  94. data/test_support/spec/lib/{configurable_spec.rb → global_configurable_spec.rb} +2 -2
  95. data/test_support/spec/lib/search_fields_spec.rb +26 -29
  96. data/test_support/spec/{helpers → lib}/solr_helper_spec.rb +268 -287
  97. data/test_support/spec/lib/tasks/solr_marc_task_spec.rb +1 -1
  98. data/test_support/spec/lib/utils_spec.rb +58 -0
  99. data/test_support/spec/models/solr_docment_spec.rb +4 -8
  100. data/test_support/spec/views/catalog/_facets.html.erb_spec.rb +27 -170
  101. data/test_support/spec/views/catalog/_index_default.erb_spec.rb +38 -20
  102. data/test_support/spec/views/catalog/_show_default.erb_spec.rb +38 -19
  103. data/test_support/spec/views/catalog/index.atom.builder_spec.rb +19 -1
  104. metadata +148 -145
  105. data/app/assets/stylesheets/blacklight/blacklight.css +0 -493
  106. data/app/assets/stylesheets/yui.css +0 -31
  107. data/app/views/catalog/opensearch.xml.erb +0 -11
  108. data/doc/Atom-Responses.md +0 -90
  109. data/doc/CUSTOMIZING.md +0 -121
  110. data/doc/Extending-blacklight-with-the-document-extension-framework.md +0 -1
  111. data/doc/Extending-or-Modifying-Blacklight-Search-Behavior.md +0 -131
  112. data/doc/Features.md +0 -147
  113. data/doc/Integration-with-Rails-Footnotes.md +0 -20
  114. data/doc/Pagination.md +0 -38
  115. data/doc/Quickstart.md +0 -97
  116. data/doc/Upgrading-Guide.md +0 -98
  117. data/doc/User-Authentication.md +0 -54
  118. data/doc/Using-a-custom-solr-uniquekey-field.md +0 -36
  119. data/lib/blacklight/comma_link_renderer.rb +0 -28
  120. data/lib/railties/jetty_solr_server.rb +0 -108
  121. data/test_support/spec/views/catalog/show.html.erb_spec.rb +0 -101
@@ -4,9 +4,7 @@
4
4
  # implementations can be of course.
5
5
  #
6
6
  # Includes methods for rendering contraints graphically on the
7
- # search results page (render_constraints(_*)), and also
8
- # for rendering more textually on Search History page
9
- # (render_search_to_s(_*))
7
+ # search results page (render_constraints(_*))
10
8
  module Blacklight::RenderConstraintsHelperBehavior
11
9
 
12
10
  # Render actual constraints, not including header or footer
@@ -19,10 +17,10 @@ module Blacklight::RenderConstraintsHelperBehavior
19
17
  # So simple don't need a view template, we can just do it here.
20
18
  if (!localized_params[:q].blank?)
21
19
  label =
22
- if (localized_params[:search_field] == Blacklight.default_search_field[:key] or localized_params[:search_field].blank? )
20
+ if (localized_params[:search_field].blank? || (default_search_field && localized_params[:search_field] == default_search_field[:key] ) )
23
21
  nil
24
22
  else
25
- Blacklight.label_for_search_field(localized_params[:search_field])
23
+ label_for_search_field(localized_params[:search_field])
26
24
  end
27
25
 
28
26
  render_constraint_element(label,
@@ -36,18 +34,22 @@ module Blacklight::RenderConstraintsHelperBehavior
36
34
 
37
35
  def render_constraints_filters(localized_params = params)
38
36
  return "".html_safe unless localized_params[:f]
39
- content = ""
37
+ content = []
40
38
  localized_params[:f].each_pair do |facet,values|
41
- values.each do |val|
42
- content << render_constraint_element( facet_field_labels[facet],
39
+ content << render_filter_element(facet, values, localized_params)
40
+ end
41
+
42
+ return content.flatten.join("\n").html_safe
43
+ end
44
+
45
+ def render_filter_element(facet, values, localized_params)
46
+ values.map do |val|
47
+ render_constraint_element( facet_field_labels[facet],
43
48
  val,
44
49
  :remove => catalog_index_path(remove_facet_params(facet, val, localized_params)),
45
50
  :classes => ["filter", "filter-" + facet.parameterize]
46
51
  ) + "\n"
47
- end
48
- end
49
-
50
- return content.html_safe
52
+ end
51
53
  end
52
54
 
53
55
  # Render a label/value constraint on the screen. Can be called
@@ -71,51 +73,4 @@ module Blacklight::RenderConstraintsHelperBehavior
71
73
  render(:partial => "catalog/constraints_element", :locals => {:label => label, :value => value, :options => options})
72
74
  end
73
75
 
74
-
75
- # Simpler textual version of constraints, used on Search History page.
76
- # Theoretically can may be DRY'd up with results page render_constraints,
77
- # maybe even using the very same HTML with different CSS?
78
- # But too tricky for now, too many changes to existing CSS. TODO.
79
- def render_search_to_s(params)
80
- render_search_to_s_q(params) +
81
- render_search_to_s_filters(params)
82
- end
83
-
84
- def render_search_to_s_q(params)
85
- return "".html_safe if params[:q].blank?
86
-
87
- label = (params[:search_field] == Blacklight.default_search_field[:key]) ?
88
- nil :
89
- Blacklight.label_for_search_field(params[:search_field])
90
-
91
- render_search_to_s_element(label , params[:q] )
92
- end
93
- def render_search_to_s_filters(params)
94
- return "".html_safe unless params[:f]
95
-
96
- params[:f].collect do |facet_field, value_list|
97
- render_search_to_s_element(Blacklight.config[:facet][:labels][facet_field],
98
- value_list.collect do |value|
99
- render_filter_value(value)
100
- end.join(content_tag(:span, 'and', :class =>'label')).html_safe
101
- )
102
- end.join(" \n ").html_safe
103
- end
104
-
105
- # value can be Array, in which case elements are joined with
106
- # 'and'. Pass in option :escape_value => false to pass in pre-rendered
107
- # html for value. key with escape_key if needed.
108
- def render_search_to_s_element(key, value, options = {})
109
- content_tag(:span, render_filter_name(key) + render_filter_value(value), :class => 'constraint')
110
- end
111
-
112
- def render_filter_name name
113
- return "".html_safe if name.blank?
114
- content_tag(:span, h(name) + ":", :class => 'filterName')
115
- end
116
-
117
- def render_filter_value value
118
- content_tag(:span, h(value), :class => 'filterValue')
119
- end
120
-
121
76
  end
@@ -0,0 +1,56 @@
1
+ # -*- encoding : utf-8 -*-
2
+ # All methods in here are 'api' that may be over-ridden by plugins and local
3
+ # code, so method signatures and semantics should not be changed casually.
4
+ # implementations can be of course.
5
+ #
6
+ # Includes methods for rendering more textually on Search History page
7
+ # (render_search_to_s(_*))
8
+ module Blacklight::SearchHistoryConstraintsHelperBehavior
9
+
10
+ # Simpler textual version of constraints, used on Search History page.
11
+ # Theoretically can may be DRY'd up with results page render_constraints,
12
+ # maybe even using the very same HTML with different CSS?
13
+ # But too tricky for now, too many changes to existing CSS. TODO.
14
+ def render_search_to_s(params)
15
+ render_search_to_s_q(params) +
16
+ render_search_to_s_filters(params)
17
+ end
18
+
19
+ def render_search_to_s_q(params)
20
+ return "".html_safe if params[:q].blank?
21
+
22
+ label = (params[:search_field] == default_search_field[:key]) ?
23
+ nil :
24
+ label_for_search_field(params[:search_field])
25
+
26
+ render_search_to_s_element(label , params[:q] )
27
+ end
28
+ def render_search_to_s_filters(params)
29
+ return "".html_safe unless params[:f]
30
+
31
+ params[:f].collect do |facet_field, value_list|
32
+ render_search_to_s_element(blacklight_config.facet_fields[facet_field].label,
33
+ value_list.collect do |value|
34
+ render_filter_value(value)
35
+ end.join(content_tag(:span, 'and', :class =>'label')).html_safe
36
+ )
37
+ end.join(" \n ").html_safe
38
+ end
39
+
40
+ # value can be Array, in which case elements are joined with
41
+ # 'and'. Pass in option :escape_value => false to pass in pre-rendered
42
+ # html for value. key with escape_key if needed.
43
+ def render_search_to_s_element(key, value, options = {})
44
+ content_tag(:span, render_filter_name(key) + render_filter_value(value), :class => 'constraint')
45
+ end
46
+
47
+ def render_filter_name name
48
+ return "".html_safe if name.blank?
49
+ content_tag(:span, h(name) + ":", :class => 'filterName')
50
+ end
51
+
52
+ def render_filter_value value
53
+ content_tag(:span, h(value), :class => 'filterValue')
54
+ end
55
+
56
+ end
@@ -0,0 +1,3 @@
1
+ module SearchHistoryConstraintsHelper
2
+ include Blacklight::SearchHistoryConstraintsHelperBehavior
3
+ end
@@ -4,8 +4,7 @@ class RecordMailer < ActionMailer::Base
4
4
 
5
5
  def email_record(documents, details, from_host, url_gen_params)
6
6
  #raise ArgumentError.new("RecordMailer#email_record only works with documents with a #to_marc") unless document.respond_to?(:to_marc)
7
-
8
- recipients details[:to]
7
+
9
8
  if documents.size == 1
10
9
  subject = "Item Record: #{documents.first.to_semantic_values[:title] rescue 'N/A'}"
11
10
  else
@@ -1,6 +1,5 @@
1
- <% if flash_notice = flash[:notice] %>
2
- <div class="ui-state-highlight ui-corner-all notice"><%= flash_notice %></div>
1
+ <% [:notice, :error, :alert].each do |type| %>
2
+ <% if flash[type] %>
3
+ <div class="ui-state-<%= type == :error ? 'error' : 'highlight' %> ui-corner-all <%= type.to_s %>"><%= flash[type] %></div>
4
+ <% end %>
3
5
  <% end %>
4
- <% if flash_error = flash[:error] %>
5
- <div class="ui-state-error ui-corner-all error"><%= flash_error %></div>
6
- <% end %>
@@ -1,4 +1,5 @@
1
- <% if current_user %>
1
+ <% if has_user_authentication_provider? %>
2
+ <% if current_user%>
2
3
  <%= link_to "Log Out", destroy_user_session_path %> [<%= link_to current_user, edit_user_registration_path %>]
3
4
  |
4
5
  <%= link_to 'Your Bookmarks', bookmarks_path %>
@@ -8,6 +9,7 @@
8
9
  <%= link_to 'Login', new_user_session_path %>
9
10
  <% end %>
10
11
  |
12
+ <% end %>
11
13
  <%= link_to "Selected Items", folder_index_path %> (<span id="folder_number"><%= "#{session[:folder_document_ids] ? session[:folder_document_ids].length : 0}" %></span>)
12
14
  |
13
15
  <%= link_to "Search History", search_history_path %>
@@ -21,8 +21,8 @@
21
21
  <table class="zebra">
22
22
  <% @bookmarks.each do |bm| %>
23
23
  <tr>
24
- <td><%= link_to h(bm.title), catalog_path(bm.document_id) %></td>
25
- <td><%= button_to 'Remove', {:controller => "bookmarks", :action => "destroy", :id => bm.document_id},
24
+ <td><%= link_to h(bm.title), catalog_path(CGI.escape(bm.document_id)) %></td>
25
+ <td><%= button_to 'Remove', {:controller => "bookmarks", :action => "destroy", :id => CGI.escape(bm.document_id)},
26
26
  :method => :delete, :confirm => 'Remove this bookmark?' %></td>
27
27
  </tr>
28
28
  <% end %>
@@ -1,5 +1,5 @@
1
- <% if current_user %>
2
- <%- existing_bookmark = current_user.existing_bookmark_for(document[:id]) -%>
1
+ <% if has_user_authentication_provider? and current_user %>
2
+ <%- existing_bookmark = current_user.existing_bookmark_for(document.id) -%>
3
3
  <%-
4
4
  # Note these two forms are pretty similar but for different :methods, classes, and labels.
5
5
  # but it was simpler to leave them seperate instead of DRYing them, got confusing trying that.
@@ -7,16 +7,16 @@
7
7
  -%>
8
8
  <% unless existing_bookmark %>
9
9
 
10
- <%= form_tag( bookmark_path( document[:id]), :method => :put, :class => "bookmark_toggle", "data-doc-id" => document[:id], :title=> document[document_show_link_field] ) do %>
10
+ <%= form_tag( bookmark_path( document ), :method => :put, :class => "bookmark_toggle", "data-doc-id" => document.id, :title=> document[document_show_link_field] ) do %>
11
11
  <%= hidden_field(:bookmark, :title, :value => document[document_show_link_field] ) %>
12
- <%= submit_tag("Bookmark", :id => "bookmark_toggle_#{document[:id]}", :class => "bookmark_add") %>
12
+ <%= submit_tag("Bookmark", :id => "bookmark_toggle_#{document.id.to_s.parameterize}", :class => "bookmark_add") %>
13
13
  <% end %>
14
14
 
15
15
  <% else %>
16
16
 
17
- <%= form_tag( bookmark_path( document[:id]), :method => :delete, :class => "bookmark_toggle", "data-doc-id" => document[:id], :title=> document[document_show_link_field]) do %>
17
+ <%= form_tag( bookmark_path( document ), :method => :delete, :class => "bookmark_toggle", "data-doc-id" => document.id, :title=> document[document_show_link_field]) do %>
18
18
  <%= hidden_field(:bookmark, :title, :value => document[document_show_link_field] ) %>
19
- <%= submit_tag("Remove bookmark", :id => "bookmark_toggle_#{document[:id]}", :class => "bookmark_remove") %>
19
+ <%= submit_tag("Remove bookmark", :id => "bookmark_toggle_#{document.id.to_s.parameterize}", :class => "bookmark_remove") %>
20
20
  <% end %>
21
21
 
22
22
  <% end %>
@@ -0,0 +1,4 @@
1
+ <div class="facet_limit blacklight-<%= facet_field.field.parameterize %>">
2
+ <h3><%= facet_field.label -%></h3>
3
+ <%= yield %>
4
+ </div>
@@ -1,33 +1,20 @@
1
- <%- # required to pass in local :solr_field
2
- # optional :display_heading parameter, sometimes set to false
3
- # by plugins that might re-use this inside something else.
4
- display_heading = true unless local_assigns.has_key?(:display_heading)
5
- -%>
6
-
7
- <% display_facet = @response.facets.detect {|f| f.name == solr_field} -%>
8
- <% if display_facet && display_facet.items.length > 0 %>
9
- <% if display_heading %>
10
- <h3><%= facet_field_labels[solr_field] -%></h3>
11
- <% end %>
12
- <ul>
13
- <% paginator =
14
- Blacklight::Solr::FacetPaginator.new(display_facet.items,
15
- :limit => facet_limit_for(solr_field))
16
- %>
17
- <% paginator.items.each do |item| -%>
18
- <li>
19
- <% if facet_in_params?( solr_field, item.value ) %>
20
- <%= render_selected_facet_value(solr_field, item) %>
21
- <% else %>
22
- <%= render_facet_value(solr_field, item) %>
23
- <% end -%>
24
- </li>
25
- <% end %>
26
-
27
- <% if(paginator.has_next?) %>
28
- <li class="more_facets_link"><%= link_to('more »', params.merge(:id => solr_field, :action=>"facet"), :class => "more_facets_link") %></li>
29
- <% end %>
30
-
31
- </ul>
32
- <% end %>
33
-
1
+ <ul>
2
+ <% paginator =
3
+ Blacklight::Solr::FacetPaginator.new(display_facet.items,
4
+ :limit => facet_limit_for(solr_field))
5
+ %>
6
+ <% paginator.items.each do |item| -%>
7
+ <li>
8
+ <% if facet_in_params?( solr_field, item.value ) %>
9
+ <%= render_selected_facet_value(solr_field, item) %>
10
+ <% else %>
11
+ <%= render_facet_value(solr_field, item) %>
12
+ <% end -%>
13
+ </li>
14
+ <% end %>
15
+
16
+ <% if(paginator.has_next?) %>
17
+ <li class="more_facets_link"><%= link_to('more »', params.merge(:id => solr_field, :action=>"facet"), :class => "more_facets_link") %></li>
18
+ <% end %>
19
+
20
+ </ul>
@@ -1,9 +1,5 @@
1
1
  <% # main container for facets/limits menu -%>
2
2
  <div id="facets" class="facets">
3
3
  <h2>Limit your search</h2>
4
- <% facet_field_names.each do |solr_fname| %>
5
- <div class="facet_limit blacklight-<%= solr_fname.parameterize %>">
6
- <%= render_facet_limit(solr_fname) %>
7
- </div>
8
- <% end %>
4
+ <%= render_facet_partials %>
9
5
  </div>
@@ -1,12 +1,12 @@
1
1
  <%-
2
2
  # pass in local :document with a SolrDocument
3
- method = (item_in_folder?(document[:id]) ? "delete" : "put")
4
- label = (item_in_folder?(document[:id]) ? "Unselect" : "Select")
5
- cssClass = (item_in_folder?(document[:id]) ? "deleteFolder" : "addFolder")
3
+ method = (item_in_folder?(document.id) ? "delete" : "put")
4
+ label = (item_in_folder?(document.id) ? "Unselect" : "Select")
5
+ cssClass = (item_in_folder?(document.id) ? "deleteFolder" : "addFolder")
6
6
  -%>
7
7
 
8
- <%= form_tag( folder_path(document[:id]), :method => method, :class=> "folder_toggle #{cssClass}", "data-doc-id" => document[:id], :title=>h(document[document_show_link_field])) do -%>
8
+ <%= form_tag( folder_path(document), :method => method, :class=> "folder_toggle #{cssClass}", "data-doc-id" => document.id, :title=>h(document[document_show_link_field])) do -%>
9
9
  <%= hidden_field(:bookmark, :title, :value => document[document_show_link_field]) %>
10
- <%= submit_tag(label, :class=>"folder_submit", :id => "folder_submit_#{document[:id]}") %>
10
+ <%= submit_tag(label, :class=>"folder_submit", :id => "folder_submit_#{document.id}") %>
11
11
  <% end %>
12
12
 
@@ -1,7 +1,7 @@
1
1
  <%# default partial to display solr document fields in catalog index view -%>
2
2
  <dl class="defList">
3
3
 
4
- <% index_field_names.each do |solr_fname| -%>
4
+ <% index_fields.each do |solr_fname, field| -%>
5
5
  <% if document.has? solr_fname %>
6
6
  <dt class="blacklight-<%= solr_fname.parameterize %>"><%= render_index_field_label :field => solr_fname %></dt>
7
7
  <dd class="blacklight-<%= solr_fname.parameterize %>"><%= render_index_field_value :document => document, :field => solr_fname %></dd>
@@ -2,9 +2,10 @@
2
2
  <%= form_tag catalog_index_path, :method => :get do %>
3
3
  <h2 class="search"><%= label_tag(:q, "Search ") %></h2>
4
4
  <%= text_field_tag :q, params[:q], :class => "q" %>
5
- <%= label_tag(:search_field, " in ") %>
6
- <%= select_tag(:search_field, options_for_select(search_fields, h(params[:search_field])), :title => "Targeted search options", :class=>"search_field") %>
7
-
5
+ <% unless search_fields.empty? %>
6
+ <%= label_tag(:search_field, " in ") %>
7
+ <%= select_tag(:search_field, options_for_select(search_fields, h(params[:search_field])), :title => "Targeted search options", :class=>"search_field") %>
8
+ <% end %>
8
9
  <%= search_as_hidden_fields(:omit_keys => [:q, :search_field, :qt, :page]).html_safe %>
9
10
 
10
11
  <%= submit_tag 'search', :class=>'submit' %>
@@ -1,6 +1,6 @@
1
1
  <%# default partial to display solr document fields in catalog show view -%>
2
2
  <dl class="defList">
3
- <% document_show_fields.each do |solr_fname| -%>
3
+ <% document_show_fields.each do |solr_fname, field| -%>
4
4
  <% if document.has? solr_fname %>
5
5
  <dt class="blacklight-<%= solr_fname.parameterize %>"><%= render_document_show_field_label :field => solr_fname %></dt>
6
6
  <dd class="blacklight-<%= solr_fname.parameterize %>"><%= render_document_show_field_value :document => document, :field => solr_fname %></dd>
@@ -10,36 +10,36 @@
10
10
 
11
11
  <% if (@document.respond_to?(:export_as_mla_citation_txt) || @document.respond_to?(:export_as_apa_citation_txt)) %>
12
12
  <li class="cite">
13
- <%= link_to "Cite This", citation_catalog_path(:id => @document[:id]), {:id => 'citeLink', :name => 'citation', :class => 'lightboxLink'} %>
13
+ <%= link_to "Cite This", citation_catalog_path(:id => @document), {:id => 'citeLink', :name => 'citation', :class => 'lightboxLink'} %>
14
14
  </li>
15
15
  <% end %>
16
16
 
17
17
  <% if @document.export_formats.keys.include?( :refworks_marc_txt ) %>
18
18
  <li class="refworks">
19
- <%= link_to "Export to RefWorks", refworks_export_url(@document) %>
19
+ <%= link_to "Export to RefWorks", refworks_export_url(:id => @document) %>
20
20
  </li>
21
21
  <% end %>
22
22
 
23
23
  <% if @document.export_formats.keys.include?( :endnote ) %>
24
24
  <li class="endnote">
25
- <%= link_to "Export to EndNote", catalog_path(@document[:id], :format => 'endnote') %>
25
+ <%= link_to "Export to EndNote", catalog_path(@document, :format => 'endnote') %>
26
26
  </li>
27
27
  <% end %>
28
28
 
29
29
  <% if @document.respond_to?( :to_email_text ) %>
30
30
  <li class="email">
31
- <%= link_to "Email This", email_catalog_path(:id => @document[:id]), {:id => 'emailLink', :name => 'email', :class => 'lightboxLink'} %>
31
+ <%= link_to "Email This", email_catalog_path(:id => @document), {:id => 'emailLink', :name => 'email', :class => 'lightboxLink'} %>
32
32
  </li>
33
33
  <%- end -%>
34
34
  <%- if @document.respond_to?( :to_sms_text ) -%>
35
35
  <li class="sms">
36
- <%= link_to "SMS This", sms_catalog_path(:id => @document[:id]), {:id => 'smsLink', :name => 'sms', :class => 'lightboxLink'} %>
36
+ <%= link_to "SMS This", sms_catalog_path(:id => @document), {:id => 'smsLink', :name => 'sms', :class => 'lightboxLink'} %>
37
37
  </li>
38
38
  <%- end -%>
39
39
 
40
40
  <% if @document.respond_to?(:to_marc) %>
41
41
  <li class="librarian_view">
42
- <%= link_to "Librarian View", librarian_view_catalog_path(@document[:id]), {:id => 'librarianLink', :name => 'librarian_view', :class => 'lightboxLink'} %>
42
+ <%= link_to "Librarian View", librarian_view_catalog_path(@document), {:id => 'librarianLink', :name => 'librarian_view', :class => 'lightboxLink'} %>
43
43
  </li>
44
44
  <% end %>
45
45
 
@@ -15,6 +15,6 @@
15
15
  <%= select_tag(:sort, options_for_select(sort_fields, h(params[:sort]))) %>
16
16
  <%= search_as_hidden_fields(:omit_keys => [:page, :sort]) %>
17
17
  <%= submit_tag 'sort results' %>
18
- <% end %>
18
+ <% end unless sort_fields.empty? %>
19
19
  <% end %>
20
20
  </div>
@@ -48,12 +48,12 @@ xml.feed("xmlns" => "http://www.w3.org/2005/Atom",
48
48
 
49
49
  @document_list.each do |doc|
50
50
  xml.entry do
51
- xml.title doc.to_semantic_values[:title][0] || doc[:id]
51
+ xml.title doc.to_semantic_values[:title][0] || doc.id
52
52
 
53
53
  # updated is required, for now we'll just set it to now, sorry
54
54
  xml.updated Time.now.strftime("%Y-%m-%dT%H:%M:%SZ")
55
55
 
56
- xml.link "rel" => "alternate", "type" => "text/html", "href" => catalog_url(doc[:id])
56
+ xml.link "rel" => "alternate", "type" => "text/html", "href" => catalog_url(doc)
57
57
  # add other doc-specific formats, atom only lets us have one per
58
58
  # content type, so the first one in the list wins.
59
59
  xml << render_link_rel_alternates(doc, :unique => true)
@@ -9,7 +9,7 @@ xml.rss(:version=>"2.0") {
9
9
  xml.language('en-us')
10
10
  @document_list.each do |doc|
11
11
  xml.item do
12
- xml.title( doc.to_semantic_values[:title][0] || doc[:id] )
12
+ xml.title( doc.to_semantic_values[:title][0] || doc.id )
13
13
  xml.link(catalog_url(doc[:id]))
14
14
  xml.author( doc.to_semantic_values[:author][0] ) if doc.to_semantic_values[:author][0]
15
15
  end