Diff
Modified: branches/biocat/app/controllers/services_controller.rb (2654 => 2655)
--- branches/biocat/app/controllers/services_controller.rb 2011-07-25 14:29:38 UTC (rev 2654)
+++ branches/biocat/app/controllers/services_controller.rb 2011-07-25 14:47:39 UTC (rev 2655)
@@ -5,6 +5,8 @@
class ServicesController < ApplicationController
+ include ApplicationHelper
+
# before_filter :find_service, : [:show]
before_filter :find_services, : [:all]
@@ -24,7 +26,23 @@
# GET /services
def index
respond_to do |format|
- format.html # index.rhtml
+ format.html {
+ @pivot_options = pivot_options
+
+ begin
+ expr = parse_filter_expression(params["filter"]) if params["filter"]
+ rescue Exception => ex
+ puts "ex = #{ex.inspect}"
+ flash.now[:error] = "Problem with query _expression_: #{ex}"
+ expr = nil
+ end
+
+ @pivot = contributions_list(Contribution, params, current_user,
+ :lock_filter => { 'CATEGORY' => 'Service' },
+ :filters => expr)
+
+ # index.rhtml
+ }
end
end
Modified: branches/biocat/app/views/content/_index.rhtml (2654 => 2655)
--- branches/biocat/app/views/content/_index.rhtml 2011-07-25 14:29:38 UTC (rev 2654)
+++ branches/biocat/app/views/content/_index.rhtml 2011-07-25 14:47:39 UTC (rev 2655)
@@ -1,48 +1,52 @@
<div class="pivot">
<div class="left">
- <div class="category">Search filter terms</div>
- <div class="search_filters">
- <form action="" url_for(request.query_parameters) -%>" method="GET">
- <div class="filter_search_box">
- <input class="query" name="filter_query" value="<%= params[:filter_query] -%>" />
- <% @pivot[:filter_query_url].each do |key, value| %>
- <input name="<%= key -%>" type="hidden" value="<%= value.gsub('"', '"') -%>" />
- <% end %>
+ <% if @pivot[:filters].length > 0 %>
+ <div class="category">Search filter terms</div>
+ <div class="search_filters">
+ <form action="" url_for(request.query_parameters) -%>" method="GET">
+ <div class="filter_search_box">
+ <input class="query" name="filter_query" value="<%= params[:filter_query] -%>" />
+ <% @pivot[:filter_query_url].each do |key, value| %>
+ <input name="<%= key -%>" type="hidden" value="<%= value.gsub('"', '"') -%>" />
+ <% end %>
+ <% if @pivot[:cancel_filter_query_url] %>
+ <%= link_to('<img src="" />',
+ @pivot[:cancel_filter_query_url]) -%>
+ <% else %>
+ <input class="submit" type="image" src="" name="submit" />
+ <% end %>
+ </div>
+ </form>
+ </div>
+ <div class="filters">
+ <% @pivot[:filters].each do |filter| %>
+ <% query_name = "#{filter[:query_option]}_query" %>
<% if @pivot[:cancel_filter_query_url] %>
- <%= link_to('<img src="" />',
- @pivot[:cancel_filter_query_url]) -%>
+ <div class="category"><%= filter[:title].capitalize -%> results</div>
<% else %>
- <input class="submit" type="image" src="" name="submit" />
+ <div class="category">Filter by <%= filter[:title] -%></div>
<% end %>
- </div>
- </form>
- </div>
- <div class="filters">
- <% @pivot[:filters].each do |filter| %>
- <% query_name = "#{filter[:query_option]}_query" %>
- <% if @pivot[:cancel_filter_query_url] %>
- <div class="category"><%= filter[:title].capitalize -%> results</div>
- <% else %>
- <div class="category">Filter by <%= filter[:title] -%></div>
+ <div id="<%= query_name -%>" style="display: <%= @pivot[:cancel_filter_query_url] ? "block" : "none" -%>">
+ </div>
+ <div class="filter">
+ <div class="options">
+ <% filter[:objects].each do |object| %>
+ <div title='<%= h(object[:plain_label]) -%>'<%= object[:selected] ? ' class="selected"' : '' -%>>
+ <input class='checkbox' type='checkbox' <% if object[:selected] %> checked='checked' <% end %> />
+ <%= link_to("<div class='count'>#{object[:count]}</div> <div class='label'><span class='truncate'>#{object[:label]}</span></div>", object[:label_uri]) -%>
+ </div>
+ <% end %>
+ </div>
+ </div>
<% end %>
- <div id="<%= query_name -%>" style="display: <%= @pivot[:cancel_filter_query_url] ? "block" : "none" -%>">
+ </div>
+ <% if @pivot[:cancel_filter_query_url] && @pivot[:filters].empty? %>
+ <div class="no-filter-query-results">
+ Your search did not match any filter terms.
</div>
- <div class="filter">
- <div class="options">
- <% filter[:objects].each do |object| %>
- <div title='<%= h(object[:plain_label]) -%>'<%= object[:selected] ? ' class="selected"' : '' -%>>
- <input class='checkbox' type='checkbox' <% if object[:selected] %> checked='checked' <% end %> />
- <%= link_to("<div class='count'>#{object[:count]}</div> <div class='label'><span class='truncate'>#{object[:label]}</span></div>", object[:label_uri]) -%>
- </div>
- <% end %>
- </div>
- </div>
<% end %>
- </div>
- <% if @pivot[:cancel_filter_query_url] && @pivot[:filters].empty? %>
- <div class="no-filter-query-results">
- Your search did not match any filter terms.
- </div>
+ <% else %>
+ <div class="category">No search filters available.</div>
<% end %>
</div>
<div class="main">
Deleted: branches/biocat/app/views/services/all.rhtml (2654 => 2655)
--- branches/biocat/app/views/services/all.rhtml 2011-07-25 14:29:38 UTC (rev 2654)
+++ branches/biocat/app/views/services/all.rhtml 2011-07-25 14:47:39 UTC (rev 2655)
@@ -1,8 +0,0 @@
-<h2>All Services</h2>
-
-<%= render :partial => "layouts/paginate", :locals => { :collection => @contributables } %>
-
-<%= render :partial => "services/table", :locals => { :collection => @contributables } %>
-
-<%= render :partial => "layouts/paginate", :locals => { :collection => @contributables } %>
-
Modified: branches/biocat/app/views/services/index.rhtml (2654 => 2655)
--- branches/biocat/app/views/services/index.rhtml 2011-07-25 14:29:38 UTC (rev 2654)
+++ branches/biocat/app/views/services/index.rhtml 2011-07-25 14:47:39 UTC (rev 2655)
@@ -1,15 +1,4 @@
-<ul class="sectionIcons">
- <li style="margin-left: 0;"><%= icon "view-all", all_services_path, nil, nil, "View All Services" %></li>
-</ul>
+<h1>Services</h1>
-<div style="text-align: center; margin-top: 1.5em;">
- <span style="vertical-align: middle; font-size: 116%;">
- Web Services from:
- </span>
- <br/>
- <span style="vertical-align: middle;">
- <%= link_to(image_tag("biocat_logo.png", :alt => "BioCatalogue logo"), "http://www.biocatalogue.org") -%>
- </span>
-</div>
+<%= render :partial => "content/index" -%>
-<%= render :partial => "contributions/most_tabs", :locals => { :type => "Service" } %>
Modified: branches/biocat/config/routes.rb (2654 => 2655)
--- branches/biocat/config/routes.rb 2011-07-25 14:29:38 UTC (rev 2654)
+++ branches/biocat/config/routes.rb 2011-07-25 14:47:39 UTC (rev 2655)
@@ -171,7 +171,7 @@
end
# services
- map.resources :services, :collection => { :all => :get, :search => :get }
+ map.resources :services, :collection => { :search => :get }
# content_types
map.resources :content_types
Modified: branches/biocat/public/stylesheets/styles.css (2654 => 2655)
--- branches/biocat/public/stylesheets/styles.css 2011-07-25 14:29:38 UTC (rev 2654)
+++ branches/biocat/public/stylesheets/styles.css 2011-07-25 14:47:39 UTC (rev 2655)
@@ -838,6 +838,7 @@
margin-bottom: 0.5em;
padding: 1em 0.5em;
vertical-align: top;
+ width: 737px;
}
table.alt_table tr.odd_row td {