about_page 0.0.7 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- about_page (0.0.7)
4
+ about_page (0.1.0)
5
5
  rails (~> 3.2)
6
6
 
7
7
  GEM
@@ -1,19 +1,10 @@
1
1
  module AboutPage
2
2
  module AboutHelper
3
3
  def render_about_pane key, profile
4
- render :partial => partial_for_about_key(key), :locals => { :key => key, :profile => profile }
4
+ partial = (profile.class.partial rescue nil) || key.to_s
5
+ render :partial => partial, :locals => { :key => key, :profile => profile }
5
6
  rescue
6
7
  render :partial => 'exception', :locals => { :key => key, :profile => profile, :exception => $! }
7
8
  end
8
-
9
- def partial_for_about_key key
10
- about_page_partials[key] || key.to_s
11
- end
12
-
13
- private
14
-
15
- def about_page_partials
16
- { :solr => 'generic_hash', :fedora => 'generic_hash', :request => 'environment' }
17
- end
18
9
  end
19
10
  end
@@ -65,6 +65,13 @@ module AboutPage
65
65
  class Node
66
66
  include ActiveModel::Validations
67
67
 
68
+ class << self
69
+ attr_reader :partial
70
+ def render_with partial
71
+ @partial = partial
72
+ end
73
+ end
74
+
68
75
  def preflight request
69
76
  errors.clear
70
77
  @request_expectations = request.params.select { |k,v| k =~ /^#{namespace}\./ }
@@ -86,7 +93,6 @@ module AboutPage
86
93
  def add_header response, text
87
94
  response.headers['X-AboutPage-Warning'] ||= ""
88
95
  response.headers['X-AboutPage-Warning'] += "#{self.class.name}: #{text};"
89
-
90
96
  end
91
97
 
92
98
  protected
@@ -8,6 +8,8 @@ module AboutPage
8
8
  end
9
9
  end
10
10
 
11
+ render_with 'generic_hash'
12
+
11
13
  attr_accessor :rubydora
12
14
 
13
15
  def initialize rubydora_instance
@@ -2,6 +2,8 @@ module AboutPage
2
2
  class RequestEnvironment < Environment
3
3
  attr_accessor :environment
4
4
 
5
+ render_with 'environment'
6
+
5
7
  def preflight request
6
8
  @environment = request.env
7
9
  end
@@ -1,7 +1,7 @@
1
1
  module AboutPage
2
2
  class Solr < AboutPage::Configuration::Node
3
3
  delegate :each_pair, :to_json, :to_xml, :to => :to_h
4
-
4
+
5
5
  attr_accessor :rsolr, :options
6
6
 
7
7
  validates_each :schema do |record, attr, value|
@@ -11,6 +11,7 @@ module AboutPage
11
11
  end
12
12
  validates :numDocs, :numericality => { :greater_than_or_equal_to => Proc.new { |c| c.expects(:numDocs) } }
13
13
 
14
+ render_with 'generic_hash'
14
15
 
15
16
  def initialize rsolr_instance, options = {}
16
17
  self.rsolr = rsolr_instance
@@ -58,7 +59,7 @@ module AboutPage
58
59
  index#.merge(registry)
59
60
  end
60
61
 
61
- def numDocs; index[:numDocs]; end
62
+ def numDocs; index[:numDocs] || index['numDocs']; end
62
63
 
63
64
  def preflight request
64
65
  @schema = nil
@@ -1,3 +1,3 @@
1
1
  module AboutPage
2
- VERSION = "0.0.7"
2
+ VERSION = "0.1.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: about_page
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -186,7 +186,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
186
186
  version: '0'
187
187
  segments:
188
188
  - 0
189
- hash: -2743544211735886747
189
+ hash: -2674301641569901463
190
190
  required_rubygems_version: !ruby/object:Gem::Requirement
191
191
  none: false
192
192
  requirements:
@@ -195,7 +195,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
195
195
  version: '0'
196
196
  segments:
197
197
  - 0
198
- hash: -2743544211735886747
198
+ hash: -2674301641569901463
199
199
  requirements: []
200
200
  rubyforge_project:
201
201
  rubygems_version: 1.8.23