Diff
Modified: branches/packs/Rakefile (3667 => 3668)
--- branches/packs/Rakefile 2013-09-04 09:16:13 UTC (rev 3667)
+++ branches/packs/Rakefile 2013-09-04 09:22:07 UTC (rev 3668)
@@ -6,9 +6,11 @@
require 'rake'
require 'rake/testtask'
require 'rdoc/task'
-
require 'tasks/rails'
+require 'sunspot/rails/tasks'
+require 'sunspot/solr/tasks'
+
desc 'Rebuild Solr index'
task "myexp:refresh:solr" do
require File.dirname(__FILE__) + '/config/environment'
Modified: branches/packs/app/controllers/license_attributes_controller.rb (3667 => 3668)
--- branches/packs/app/controllers/license_attributes_controller.rb 2013-09-04 09:16:13 UTC (rev 3667)
+++ branches/packs/app/controllers/license_attributes_controller.rb 2013-09-04 09:22:07 UTC (rev 3668)
@@ -13,7 +13,7 @@
begin
@license_attribute = LicenseAttribute.find(params[:id])
rescue ActiveRecord::RecordNotFound
- error("License Attribute not found", "is invalid")
+ render_404("License Attribute not found.")
end
end
Copied: branches/packs/app/helpers/content_helper.rb (from rev 3667, trunk/app/helpers/content_helper.rb) (0 => 3668)
--- branches/packs/app/helpers/content_helper.rb (rev 0)
+++ branches/packs/app/helpers/content_helper.rb 2013-09-04 09:22:07 UTC (rev 3668)
@@ -0,0 +1,26 @@
+# myExperiment: app/helpers/content_helper.rb
+#
+# Copyright (c) 2007-2013 The University of Manchester, the University of
+# Oxford, and the University of Southampton. See license.txt for details.
+
+module ContentHelper
+ def filter_sets(objects)
+ size = Conf.initial_filter_size
+ sets = []
+
+ objects.each_index do |i|
+
+ object = objects[i]
+ visible = (i < size) || object[:selected]
+
+ if sets.empty? || sets.last[1] != visible
+ sets << [[object], visible]
+ else
+ sets.last[0] << object
+ end
+ end
+
+ sets
+ end
+end
+
Modified: branches/packs/app/views/content/_index.rhtml (3667 => 3668)
--- branches/packs/app/views/content/_index.rhtml 2013-09-04 09:16:13 UTC (rev 3667)
+++ branches/packs/app/views/content/_index.rhtml 2013-09-04 09:22:07 UTC (rev 3668)
@@ -21,6 +21,9 @@
<div class="filters">
<% @pivot[:filters].each do |filter| %>
<% query_name = "#{filter[:query_option]}_query" %>
+ <% fold_name_1 = "FOLD_#{filter["query_option"]}_1" %>
+ <% fold_name_2 = "FOLD_#{filter["query_option"]}_2" %>
+
<% if @pivot[:cancel_filter_query_url] %>
<div class="category"><%= filter["title"].capitalize -%> results</div>
<% else %>
@@ -29,17 +32,25 @@
<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 %> />
- <a href="" url_with_params(request.path, object[:label_uri]) -%>">
- <div class='count'><%= object[:count] -%></div>
- <div class='label'><span class='truncate'><%= h(object[:label]) -%></span></div>
- </a>
- </div>
- <% end %>
- </div>
+ <% filter_sets(filter[:objects]).each do |set, visible| %>
+ <div class="options <%= visible ? "" : "extra_options #{fold_name_2}" -%>">
+ <% set.each do |object| %>
+ <div title='<%= h(object[:plain_label]) -%>'<%= object[:selected] ? ' class="selected"' : '' -%>>
+ <input class='checkbox' type='checkbox' <% if object[:selected] %> checked='checked' <% end %> />
+ <a href="" url_with_params(request.path, object[:label_uri]) -%>">
+ <div class='count'><%= object[:count] -%></div>
+ <div class='label'><span class='truncate'><%= h(object[:label]) -%></span></div>
+ </a>
+ </div>
+ <% end %>
+ </div>
+ <% end %>
+
+ <% if (filter[:objects].length > Conf.initial_filter_size) %>
+ <a class="more" href="" id="<%= fold_name_1 -%>" style="display: none" fold_name_1 %>').style.display = 'none'; var els = document.getElementsByClassName('<%= fold_name_2 %>'); for (var i = 0; i < els.length; i++) { els[i].style.display = 'block'; els[i].style.maxHeight = '1000px'; }; return false;">More...</a>
+ <% end %>
+ <script>document.getElementById("<%= fold_name_1 -%>").style.display = "block";</script>
+ <script>var els = document.getElementsByClassName("<%= fold_name_2 %>"); for (var i = 0; i < els.length; i++) { els[i].style.maxHeight = "0px"; }</script>
</div>
<% end %>
</div>
Modified: branches/packs/config/boot.rb (3667 => 3668)
--- branches/packs/config/boot.rb 2013-09-04 09:16:13 UTC (rev 3667)
+++ branches/packs/config/boot.rb 2013-09-04 09:22:07 UTC (rev 3668)
@@ -110,5 +110,19 @@
end
end
+class Rails::Boot
+ def run
+ load_initializer
+
+ Rails::Initializer.class_eval do
+ def load_gems
+ @bundler_loaded ||= Bundler.require :default, Rails.env
+ end
+ end
+
+ Rails::Initializer.run(:set_load_path)
+ end
+end
+
# All that for this:
Rails.boot!
Modified: branches/packs/config/default_settings.yml (3667 => 3668)
--- branches/packs/config/default_settings.yml 2013-09-04 09:16:13 UTC (rev 3667)
+++ branches/packs/config/default_settings.yml 2013-09-04 09:22:07 UTC (rev 3668)
@@ -672,6 +672,16 @@
num_options: ["10", "20", "25", "50", "100"]
+# initial_filter_size - The number of entries shown for each pivot filter by
+# default.
+
+initial_filter_size: 10
+
+# expanded_filter_size - The number of entries shown for each pivot filter when
+# it is expanded.
+
+expanded_filter_size: 25
+
# Shortcut keywords
# These are special keywords that, when typed into the search box (when 'All' is selected) will instantly jump to a
# specified page instead of returning a list of search results.
@@ -1770,3 +1780,4 @@
- extensions: [t2flow]
image: /images/famfamfam_silk/page_white_gear.png
label: Taverna 2 workflow
+
Copied: branches/packs/config/preinitializer.rb (from rev 3667, trunk/config/preinitializer.rb) (0 => 3668)
--- branches/packs/config/preinitializer.rb (rev 0)
+++ branches/packs/config/preinitializer.rb 2013-09-04 09:22:07 UTC (rev 3668)
@@ -0,0 +1,23 @@
+# Load gems from Gemfile.
+# From: http://bundler.io/rails23.html
+
+begin
+ require 'rubygems'
+ require 'bundler'
+rescue LoadError
+ raise "Could not load the bundler gem. Install it with `gem install bundler`."
+end
+
+if Gem::Version.new(Bundler::VERSION) <= Gem::Version.new("0.9.24")
+ raise RuntimeError, "Your bundler version is too old for Rails 2.3.\n" +
+ "Run `gem install bundler` to upgrade."
+end
+
+begin
+ # Set up load paths for all bundled gems
+ ENV["BUNDLE_GEMFILE"] = File.expand_path("../../Gemfile", __FILE__)
+ Bundler.setup
+rescue Bundler::GemNotFound
+ raise RuntimeError, "Bundler couldn't find some gems.\n" +
+ "Did you run `bundle install`?"
+end
Modified: branches/packs/config/routes.rb (3667 => 3668)
--- branches/packs/config/routes.rb 2013-09-04 09:16:13 UTC (rev 3667)
+++ branches/packs/config/routes.rb 2013-09-04 09:22:07 UTC (rev 3668)
@@ -24,7 +24,7 @@
:rerun => :post,
:render_output => :get }
end
-
+
# Ontologies
map.resources :ontologies
@@ -162,9 +162,6 @@
# content_types
map.resources :content_types
- # all downloads and viewings
- map.resources :downloads, :viewings
-
# messages
map.resources :messages, :collection => { :sent => :get, :delete_all_selected => :delete }
Modified: branches/packs/lib/conf.rb (3667 => 3668)
--- branches/packs/lib/conf.rb 2013-09-04 09:16:13 UTC (rev 3667)
+++ branches/packs/lib/conf.rb 2013-09-04 09:22:07 UTC (rev 3668)
@@ -210,6 +210,14 @@
self.fetch_entry('sesame_repository')
end
+ def self.initial_filter_size
+ self.fetch_entry('initial_filter_size')
+ end
+
+ def self.expanded_filter_size
+ self.fetch_entry('expanded_filter_size')
+ end
+
def self.research_object_default_folders
self.fetch_entry('research_object_default_folders')
end
Modified: branches/packs/lib/pivoting.rb (3667 => 3668)
--- branches/packs/lib/pivoting.rb 2013-09-04 09:16:13 UTC (rev 3667)
+++ branches/packs/lib/pivoting.rb 2013-09-04 09:22:07 UTC (rev 3668)
@@ -195,6 +195,7 @@
end
rescue
+ raise unless Rails.env == "production"
return false
end
@@ -260,7 +261,7 @@
current = find_filter(opts[:filters], filter["query_option"]) ? find_filter(opts[:filters], filter["query_option"])[:expr][:terms] : []
if opts[:ids].nil?
- limit = 10
+ limit = Conf.expanded_filter_size
else
conditions << "(#{filter_id_column} IN ('#{opts[:ids].map do |id| escape_sql(id) end.join("','")}'))"
limit = nil
Modified: branches/packs/public/stylesheets/styles.css (3667 => 3668)
--- branches/packs/public/stylesheets/styles.css 2013-09-04 09:16:13 UTC (rev 3667)
+++ branches/packs/public/stylesheets/styles.css 2013-09-04 09:22:07 UTC (rev 3668)
@@ -2108,6 +2108,20 @@
background: #ffe0c0;
}
+.pivot .extra_options {
+ transition-property: max-height;
+ transition-duration: 2s;
+ -webkit-transition-property: max-height;
+ -webkit-transition-duration: 2s;
+ overflow: hidden;
+}
+
+.pivot .more {
+ padding-top: 4px;
+ padding-left: 4px;
+ font-size: 90%;
+}
+
.pivot .checkbox {
display: inline;
padding-top: 0;