Skip to content
This repository
Browse code

just some simple changes to views and controllers to get the actual d…

…isplay up and working when you run rails server.
  • Loading branch information...
commit ec770beace430ecac1c2c9a4eaf8a069f3264a74 1 parent 859e270
Dan Funk authored
4 app/controllers/application_controller.rb
@@ -116,9 +116,9 @@ def access_denied
116 116 # send the user home if the access was previously denied by the same
117 117 # request to avoid sending the user back to the login page
118 118 # (e.g. protected page -> logout -> returned to protected page -> home)
119   - redirect_to root_url and flash.discard and return if request.referer and request.referer.ends_with? request.request_uri
  119 + redirect_to root_url and flash.discard and return if request.referer and request.referer.ends_with? request.fullpath
120 120
121   - redirect_to login_url(:referer => request.request_uri)
  121 + redirect_to login_url(:referer => request.fullpath)
122 122 end
123 123
124 124 end
2  app/helpers/application_helper.rb
@@ -147,7 +147,7 @@ def sidebar_items
147 147 end
148 148
149 149 def extra_body_classes
150   - @extra_body_classes ||= ['blacklight-' + @controller.controller_name, 'blacklight-' + [@controller.controller_name, @controller.action_name].join('-')]
  150 + @extra_body_classes ||= ['blacklight-' + controller.controller_name, 'blacklight-' + [controller.controller_name, controller.action_name].join('-')]
151 151 end
152 152
153 153 #
2  app/views/catalog/_document_list.html.erb
@@ -16,7 +16,7 @@
16 16 <% # main title container for doc partial view -%>
17 17
18 18 <div class="yui-u">
19   - <h3 class="index_title"><%= counter + 1 + @response.params[:start].to_i %>. <%= link_to_document document, :label=>document_show_link_field, :counter => (counter + 1 + @response.params[:start].to_i) %></h3>
  19 + <h3 class="index_title"><%= counter + 1 + @response.params[:start].to_i %>. <%= raw(link_to_document document, :label=>document_show_link_field, :counter => (counter + 1 + @response.params[:start].to_i)) %></h3>
20 20 </div>
21 21
22 22 </div>
4 app/views/catalog/_folder_control.html.erb
... ... @@ -1,6 +1,6 @@
1 1 <%- # would like to find a better way to determine the path, but the routes weren't working as expected and passing a hash causes route matching errors in cucumber -%>
2   -<% form_tag("/folder#{item_in_folder?(document[:id]) ? '/destroy' : nil}", :name => "folder#{document[:id]}", :class=>"#{item_in_folder?(document[:id]) ? "delete" : "add"}Folder", :title=>h(document[document_show_link_field])) do -%>
  2 +<%= form_tag("/folder#{item_in_folder?(document[:id]) ? '/destroy' : nil}", :name => "folder#{document[:id]}", :class=>"#{item_in_folder?(document[:id]) ? "delete" : "add"}Folder", :title=>h(document[document_show_link_field])) do -%>
3 3 <%= hidden_field_tag("id_#{document[:id]}".to_sym, h(document[:id]), :name=>"id") %>
4 4 <%= hidden_field_tag("title_#{document[:id]}".to_sym, h(document[document_show_link_field]), :name=>"title" ) %>
5 5 <%= submit_tag "#{item_in_folder?(document[:id]) ? "Remove from" : "Add to"} folder", :id => "folder_submit_#{document[:id]}" %>
6   -<% end %>
  6 +<% end %>
6 app/views/catalog/_search_form.html.erb
... ... @@ -1,14 +1,14 @@
1 1 <div id="search" class="search">
2   - <% form_tag catalog_index_path, :method => :get do %>
  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 5 <%= label_tag(:search_field, " in ") %>
6 6 <%= select_tag(:search_field, options_for_select(search_fields, h(params[:search_field])), :title => "Targeted search options", :class=>"search_field") %>
7 7
8   - <%= search_as_hidden_fields(:omit_keys => [:q, :search_field, :qt, :page]) %>
  8 + <%= search_as_hidden_fields(:omit_keys => [:q, :search_field, :qt, :page]).html_safe %>
9 9
10 10 <%= submit_tag 'search', :class=>'submit' %>
11 11 <% end %>
12 12
13 13 <hr/>
14   -</div>
  14 +</div>
19 app/views/catalog/_sort_and_per_page.html.erb
... ... @@ -1,19 +1,20 @@
1 1 <div id="sortAndPerPage">
2 2 <% unless @response.response['numFound'] < 2 %>
3 3 <%-# kind of hacky way to get this to work on catalog and folder controllers. May be able to simple do {:action=>"index"} but I'm not sure -%>
4   - <% form_tag params[:controller] == "folder" ? folder_index_path : catalog_index_path, :method=>:get, :class=>'per_page' do %>
5   - <%= label_tag(:per_page, "Show " + select_tag(:per_page, options_for_select(['10', '20', '50', '100'], h(params[:per_page])), :title => "Number of results to display per page", :onchange => 'this.form.submit()') + " per page") %>
6   - <%= search_as_hidden_fields(:omit_keys => [:page, :per_page]) %>
  4 + <%= form_tag params[:controller] == "folder" ? folder_index_path : catalog_index_path, :method=>:get, :class=>'per_page' do %>
  5 + Show <%= label_tag(:per_page, select_tag(:per_page, options_for_select(['10', '20', '50', '100'], params[:per_page]), :title => "Number of results to display per page", :onchange => 'this.form.submit()') + " per page") %>
  6 + <%= raw(search_as_hidden_fields(:omit_keys => [:page, :per_page])) %>
7 7 <noscript><%= submit_tag 'update' %></noscript>
8 8 <% end %>
9 9
10 10 <%-# kind of hacky way to get this to work on catalog and folder controllers. May be able to simple do {:action=>"index"} but I'm not sure -%>
11   - <% form_tag params[:controller] == "folder" ? folder_index_path : catalog_index_path, :method=>:get, :class=>'sort', :id => "sort_form" do %>
12   - <%= label_tag(:sort, "Sort by ") %>
13   - <%= select_tag(:sort, options_for_select(sort_fields, h(params[:sort])), :onchange => 'this.form.submit()') %>
14   - <%= search_as_hidden_fields(:omit_keys => [:page, :sort]) %>
15   - <noscript><%= submit_tag 'sort results' %></noscript>
  11 + <%= form_tag params[:controller] == "folder" ? folder_index_path : catalog_index_path, :method=>:get, :class=>'sort', :id => "sort_form" do %>
  12 +
  13 + <%= label_tag(:sort, "Sort by ") %>
  14 + <%= select_tag(:sort, options_for_select(sort_fields, h(params[:sort])), :onchange => 'this.form.submit()') %>
  15 + <%= raw(search_as_hidden_fields(:omit_keys => [:page, :sort])) %>
  16 + <noscript><%= submit_tag 'sort results' %></noscript>
16 17 <% end %>
17 18
18 19 <% end %>
19   -</div>
  20 +</div>
9 app/views/catalog/index.html.erb
... ... @@ -1,3 +1,4 @@
  1 +
1 2 <% unless has_search_parameters? %>
2 3 <%# if there are no input/search related params, display the "home" partial -%>
3 4 <%= render 'home' %>
@@ -5,7 +6,7 @@
5 6
6 7 <% @page_title = application_name + " Search Results" %>
7 8
8   - <% extra_head_content << render_opensearch_response_metadata %>
  9 + <% extra_head_content << render_opensearch_response_metadata.html_safe %>
9 10
10 11 <%= render :partial => 'search_form' %>
11 12
@@ -14,13 +15,13 @@
14 15 <%= render 'constraints', :localized_params=>params %>
15 16
16 17 <div class="pageEntriesInfo">
17   - <%= page_entries_info @response.docs, :entry_name=>'item' %>
18   - <%=link_to "Start&nbsp;over&thinsp;", catalog_index_path, :id=>"startOverLink" %>
  18 + <%= (page_entries_info @response.docs, :entry_name=>'item').html_safe %>
  19 + <%=link_to raw("Start&nbsp;over&thinsp;"), catalog_index_path, :id=>"startOverLink" %>
19 20 </div>
20 21
21 22 <%= render 'sort_and_per_page' %>
22 23
23   - <%= render 'results_pagination' %>
  24 + <%= render 'results_pagination' %>
24 25
25 26
26 27 <%= render_document_list_partial %>
18 app/views/layouts/application.html.erb
@@ -9,21 +9,21 @@
9 9 <title><%= h(@page_title || application_name) %></title>
10 10 <link href="<%= url_for :controller=>'catalog',:action => 'opensearch', :format => 'xml', :only_path => false %>" title="<%= application_name%>" type="application/opensearchdescription+xml" rel="search"/>
11 11
12   - <%= render_head_content %>
  12 + <%= raw(render_head_content) %>
13 13
14 14
15 15 </head>
16 16 <% if params[:q].to_s.empty? and params[:f].to_s.empty? and params[:id].nil? %>
17 17 <body onload="$('input#q').focus();" class="<%= render_body_class %>">
18 18 <% else %>
19   - <body class="<%= render_body_class %>">
  19 + <body class="<%= render_body_class.html_safe %>">
20 20 <% end %>
21 21 <div id="doc4" class="yui-t2">
22 22
23 23 <div id="hd">
24 24 <div class="yui-g">
25 25 <div class="yui-u first">
26   - <h1 class="site_title"><%= link_to application_name, root_path %><%= (params[:controller] == "catalog" and !params[:id]) ? "<span id='results_text'>Search Results</span>" : "" %></h1>
  26 + <h1 class="site_title"><%= link_to application_name, root_path %><%= (params[:controller] == "catalog" and !params[:id]) ? "<span id='results_text'>Search Results</span>".html_safe : "" %></h1>
27 27 </div>
28 28 <div class="yui-u">
29 29 <%= render :partial=>'/user_util_links' %>
@@ -40,13 +40,11 @@
40 40 </div>
41 41 </div>
42 42
43   - <div class="yui-b sidebar"><%= sidebar_items.join('') %></div>
  43 + <div class="yui-b sidebar"><%= sidebar_items.join('').html_safe %></div>
44 44
45 45 </div>
46   -
47   - <div id="ft"><%= @footer %></div>
48   -
  46 + <div id="ft"><%= raw(@footer) %></div>
49 47 </div>
50   - </body>
51   -
52   -</html>
  48 + </body>
  49 +
  50 + </html>
2  app/views/user_sessions/_login_form.html.erb
... ... @@ -1,4 +1,4 @@
1   -<% form_for @user_session do |f| %>
  1 +<%= form_for @user_session do |f| %>
2 2 <div class="row"><%= f.label :login %> <%= f.text_field :login %></div>
3 3 <div class="row"><%= f.label :password %> <%= f.password_field :password %></div>
4 4 <div class="row submit"><%= f.submit 'Login' %></div>
2  config.ru
... ... @@ -1,4 +1,4 @@
1 1 # This file is used by Rack-based servers to start the application.
2 2
3 3 require ::File.expand_path('../config/environment', __FILE__)
4   -run Blacklight::Application
  4 +run BlacklightApp::Application

0 comments on commit ec770be

Please sign in to comment.
Something went wrong with that request. Please try again.