Skip to content
Browse files

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...
1 parent 859e270 commit ec770beace430ecac1c2c9a4eaf8a069f3264a74 Dan Funk committed Jan 31, 2011
View
4 app/controllers/application_controller.rb
@@ -116,9 +116,9 @@ def access_denied
# send the user home if the access was previously denied by the same
# request to avoid sending the user back to the login page
# (e.g. protected page -> logout -> returned to protected page -> home)
- redirect_to root_url and flash.discard and return if request.referer and request.referer.ends_with? request.request_uri
+ redirect_to root_url and flash.discard and return if request.referer and request.referer.ends_with? request.fullpath
- redirect_to login_url(:referer => request.request_uri)
+ redirect_to login_url(:referer => request.fullpath)
end
end
View
2 app/helpers/application_helper.rb
@@ -147,7 +147,7 @@ def sidebar_items
end
def extra_body_classes
- @extra_body_classes ||= ['blacklight-' + @controller.controller_name, 'blacklight-' + [@controller.controller_name, @controller.action_name].join('-')]
+ @extra_body_classes ||= ['blacklight-' + controller.controller_name, 'blacklight-' + [controller.controller_name, controller.action_name].join('-')]
end
#
View
2 app/views/catalog/_document_list.html.erb
@@ -16,7 +16,7 @@
<% # main title container for doc partial view -%>
<div class="yui-u">
- <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>
+ <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>
</div>
</div>
View
4 app/views/catalog/_folder_control.html.erb
@@ -1,6 +1,6 @@
<%- # 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 -%>
-<% 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 -%>
+<%= 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 -%>
<%= hidden_field_tag("id_#{document[:id]}".to_sym, h(document[:id]), :name=>"id") %>
<%= hidden_field_tag("title_#{document[:id]}".to_sym, h(document[document_show_link_field]), :name=>"title" ) %>
<%= submit_tag "#{item_in_folder?(document[:id]) ? "Remove from" : "Add to"} folder", :id => "folder_submit_#{document[:id]}" %>
-<% end %>
+<% end %>
View
6 app/views/catalog/_search_form.html.erb
@@ -1,14 +1,14 @@
<div id="search" class="search">
- <% form_tag catalog_index_path, :method => :get do %>
+ <%= form_tag catalog_index_path, :method => :get do %>
<h2 class="search"><%= label_tag(:q, "Search ") %></h2>
<%= text_field_tag :q, params[:q], :class => "q" %>
<%= label_tag(:search_field, " in ") %>
<%= select_tag(:search_field, options_for_select(search_fields, h(params[:search_field])), :title => "Targeted search options", :class=>"search_field") %>
- <%= search_as_hidden_fields(:omit_keys => [:q, :search_field, :qt, :page]) %>
+ <%= search_as_hidden_fields(:omit_keys => [:q, :search_field, :qt, :page]).html_safe %>
<%= submit_tag 'search', :class=>'submit' %>
<% end %>
<hr/>
-</div>
+</div>
View
19 app/views/catalog/_sort_and_per_page.html.erb
@@ -1,19 +1,20 @@
<div id="sortAndPerPage">
<% unless @response.response['numFound'] < 2 %>
<%-# 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 -%>
- <% form_tag params[:controller] == "folder" ? folder_index_path : catalog_index_path, :method=>:get, :class=>'per_page' do %>
- <%= 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") %>
- <%= search_as_hidden_fields(:omit_keys => [:page, :per_page]) %>
+ <%= form_tag params[:controller] == "folder" ? folder_index_path : catalog_index_path, :method=>:get, :class=>'per_page' do %>
+ 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") %>
+ <%= raw(search_as_hidden_fields(:omit_keys => [:page, :per_page])) %>
<noscript><%= submit_tag 'update' %></noscript>
<% end %>
<%-# 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 -%>
- <% form_tag params[:controller] == "folder" ? folder_index_path : catalog_index_path, :method=>:get, :class=>'sort', :id => "sort_form" do %>
- <%= label_tag(:sort, "Sort by ") %>
- <%= select_tag(:sort, options_for_select(sort_fields, h(params[:sort])), :onchange => 'this.form.submit()') %>
- <%= search_as_hidden_fields(:omit_keys => [:page, :sort]) %>
- <noscript><%= submit_tag 'sort results' %></noscript>
+ <%= form_tag params[:controller] == "folder" ? folder_index_path : catalog_index_path, :method=>:get, :class=>'sort', :id => "sort_form" do %>
+
+ <%= label_tag(:sort, "Sort by ") %>
+ <%= select_tag(:sort, options_for_select(sort_fields, h(params[:sort])), :onchange => 'this.form.submit()') %>
+ <%= raw(search_as_hidden_fields(:omit_keys => [:page, :sort])) %>
+ <noscript><%= submit_tag 'sort results' %></noscript>
<% end %>
<% end %>
-</div>
+</div>
View
9 app/views/catalog/index.html.erb
@@ -1,11 +1,12 @@
+
<% unless has_search_parameters? %>
<%# if there are no input/search related params, display the "home" partial -%>
<%= render 'home' %>
<% else %>
<% @page_title = application_name + " Search Results" %>
- <% extra_head_content << render_opensearch_response_metadata %>
+ <% extra_head_content << render_opensearch_response_metadata.html_safe %>
<%= render :partial => 'search_form' %>
@@ -14,13 +15,13 @@
<%= render 'constraints', :localized_params=>params %>
<div class="pageEntriesInfo">
- <%= page_entries_info @response.docs, :entry_name=>'item' %>
- <%=link_to "Start&nbsp;over&thinsp;", catalog_index_path, :id=>"startOverLink" %>
+ <%= (page_entries_info @response.docs, :entry_name=>'item').html_safe %>
+ <%=link_to raw("Start&nbsp;over&thinsp;"), catalog_index_path, :id=>"startOverLink" %>
</div>
<%= render 'sort_and_per_page' %>
- <%= render 'results_pagination' %>
+ <%= render 'results_pagination' %>
<%= render_document_list_partial %>
View
18 app/views/layouts/application.html.erb
@@ -9,21 +9,21 @@
<title><%= h(@page_title || application_name) %></title>
<link href="<%= url_for :controller=>'catalog',:action => 'opensearch', :format => 'xml', :only_path => false %>" title="<%= application_name%>" type="application/opensearchdescription+xml" rel="search"/>
- <%= render_head_content %>
+ <%= raw(render_head_content) %>
</head>
<% if params[:q].to_s.empty? and params[:f].to_s.empty? and params[:id].nil? %>
<body onload="$('input#q').focus();" class="<%= render_body_class %>">
<% else %>
- <body class="<%= render_body_class %>">
+ <body class="<%= render_body_class.html_safe %>">
<% end %>
<div id="doc4" class="yui-t2">
<div id="hd">
<div class="yui-g">
<div class="yui-u first">
- <h1 class="site_title"><%= link_to application_name, root_path %><%= (params[:controller] == "catalog" and !params[:id]) ? "<span id='results_text'>Search Results</span>" : "" %></h1>
+ <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>
</div>
<div class="yui-u">
<%= render :partial=>'/user_util_links' %>
@@ -40,13 +40,11 @@
</div>
</div>
- <div class="yui-b sidebar"><%= sidebar_items.join('') %></div>
+ <div class="yui-b sidebar"><%= sidebar_items.join('').html_safe %></div>
</div>
-
- <div id="ft"><%= @footer %></div>
-
+ <div id="ft"><%= raw(@footer) %></div>
</div>
- </body>
-
-</html>
+ </body>
+
+ </html>
View
2 app/views/user_sessions/_login_form.html.erb
@@ -1,4 +1,4 @@
-<% form_for @user_session do |f| %>
+<%= form_for @user_session do |f| %>
<div class="row"><%= f.label :login %> <%= f.text_field :login %></div>
<div class="row"><%= f.label :password %> <%= f.password_field :password %></div>
<div class="row submit"><%= f.submit 'Login' %></div>
View
2 config.ru
@@ -1,4 +1,4 @@
# This file is used by Rack-based servers to start the application.
require ::File.expand_path('../config/environment', __FILE__)
-run Blacklight::Application
+run BlacklightApp::Application

0 comments on commit ec770be

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