documentation 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b5e399e51d0a72a5c02f5f3ca8f685db8bd1c108
4
- data.tar.gz: 87fd194fa118aab0f340dfe7e2d309aeda1316b3
3
+ metadata.gz: a6a7eb85e7b85787e4d484056de4034f93aea7b8
4
+ data.tar.gz: 235d5670da70ba8f1b7468dac9584eb2fdfe52cb
5
5
  SHA512:
6
- metadata.gz: 0e55f1375b4c19e75f6a3fa5b3f9abc2bd151d57f963da9a0b39e52170ac9079a1acb31178e6f7f1adc3c0cf2bd7a30427c3fd5051976f4bdc04e10d992981bf
7
- data.tar.gz: a93324934c94310c07f929aabf6b0531a6f93c5e106f8c371172608ee7162f15d43e8e0688698491f99c3f4f43b6e70c0e14c7341923c9a7c812fb4853ebf82d
6
+ metadata.gz: cfc40c753fe359e3697e9fedd1cd30245c0e73f5df68e8aa4f0f17f416a7bec369a71d441bf3adfdef9401e37715269ab48c23ec540e1d45909be3ca74b9f918
7
+ data.tar.gz: e2a26c2538c3bdaccce81624ad5bee3d3566bfd6b3ad7ba5e8ee243880037c272a75c3281076f79e5819e0aeabec881674b551e420ffc9f3b993d323bd70893f
@@ -6,21 +6,7 @@
6
6
  %p.noSearchResults= t('.no_results', :query => params[:query])
7
7
  - else
8
8
  %h1= t('.title', :query => params[:query])
9
- %p.searchSummary= t('.summary', :total_results => @result.total_results, :start_result => @result.start_result_number, :end_result => @result.end_result_number)
10
-
11
- %ul.searchResults
12
- - for page in @result.results
13
- %li
14
- %h4= link_to page.title, page_path(page.full_permalink)
15
- - unless page.parents.empty?
16
- %p.in
17
- = t('.in')
18
- = page.parents.map { |c| link_to(h(c.title), page_path(c.full_permalink))}.join(" ⇒ ").html_safe
19
- %p.excerpt= @result.excerpt_for(page)
20
-
21
-
22
- %p.pagination
23
- - unless @result.first_page?
24
- = link_to t('.previous_page'), search_path(:query => params[:query], :page => @result.page - 1), :class => 'button'
25
- - unless @result.last_page?
26
- = link_to t('.next_page'), search_path(:query => params[:query], :page => @result.page + 1), :class => 'button'
9
+ %p.searchSummary= documentation_search_summary(@result)
10
+ = documentation_search_results(@result)
11
+ %p.pagination= documentation_search_pagination(@result, :link_class => 'button')
12
+
@@ -14,7 +14,14 @@ en:
14
14
  helpers:
15
15
  documentation_breadcrumb_for:
16
16
  default_root_link: Home
17
-
17
+ documentation_search_summary:
18
+ text: "Found %{total_results} pages matching your query. Showing results %{start_result} to %{end_result}"
19
+ documentation_search_results:
20
+ in: in
21
+ documentation_search_pagination:
22
+ next: Next page
23
+ previous: Previous page
24
+
18
25
  pages:
19
26
  index:
20
27
  welcome_title: Welcome to Documentation
@@ -50,7 +57,5 @@ en:
50
57
  search:
51
58
  title: "Search results for '%{query}'"
52
59
  no_results: "No pages were found matching '%{query}'"
53
- summary: "Found %{total_results} pages matching your query. Showing results %{start_result} to %{end_result}"
54
- in: in
55
60
  next_page: Next page
56
61
  previous_page: Previous page
@@ -1,3 +1,3 @@
1
1
  module Documentation
2
- VERSION = '1.0.0'
2
+ VERSION = '1.0.1'
3
3
  end
@@ -109,5 +109,51 @@ module Documentation
109
109
  @documentation_authorizer ||= Documentation.config.authorizer.new(controller)
110
110
  end
111
111
 
112
+ #
113
+ # Return summary information for search results
114
+ #
115
+ def documentation_search_summary(result)
116
+ t('documentation.helpers.documentation_search_summary.text', :total_results => result.total_results, :start_result => result.start_result_number, :end_result => result.end_result_number, :query => result.query)
117
+ end
118
+
119
+ #
120
+ # Return the search results
121
+ #
122
+ def documentation_search_results(result, options = {})
123
+ options[:class] ||= 'searchResults'
124
+ String.new.tap do |s|
125
+ s << "<ul class='#{options[:class]}'>"
126
+ result.results.each do |page|
127
+ s << "<li>"
128
+ s << "<h4><a href='#{documentation_doc_root}/#{page.full_permalink}'>#{page.title}</a></h4>"
129
+ unless page.parents.empty?
130
+ s << "<p class='in'>#{t('documentation.helpers.documentation_search_results.in')} "
131
+ s << page.parents.map { |c| link_to(h(c.title), "#{documentation_doc_root}/#{c.full_permalink}")}.join(" &#8658; ").html_safe
132
+ s << "</p>"
133
+ end
134
+ s << "<p class='excerpt'>#{result.excerpt_for(page)}</p>"
135
+ s << "</li>"
136
+ end
137
+ s << "</ul>"
138
+ end.html_safe
139
+ end
140
+
141
+ #
142
+ # Return search pagination links
143
+ #
144
+ def documentation_search_pagination(result, options = {})
145
+ String.new.tap do |s|
146
+ unless result.first_page?
147
+ querystring = {:query => result.query, :page => result.page - 1}.to_query
148
+ s << link_to(t('documentation.helpers.documentation_search_pagination.previous'), "#{documentation_doc_root}/search?#{querystring}", :class => [options[:link_class], options[:previous_link_class]].compact.join(' '))
149
+ end
150
+
151
+ unless result.last_page?
152
+ querystring = {:query => result.query, :page => result.page + 1}.to_query
153
+ s << link_to(t('documentation.helpers.documentation_search_pagination.next'), "#{documentation_doc_root}/search?#{querystring}", :class => [options[:link_class], options[:next_link_class]].compact.join(' '))
154
+ end
155
+ end.html_safe
156
+ end
157
+
112
158
  end
113
159
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: documentation
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Cooke
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-14 00:00:00.000000000 Z
11
+ date: 2014-07-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -98,14 +98,14 @@ dependencies:
98
98
  requirements:
99
99
  - - "~>"
100
100
  - !ruby/object:Gem::Version
101
- version: '4.0'
101
+ version: '4'
102
102
  type: :runtime
103
103
  prerelease: false
104
104
  version_requirements: !ruby/object:Gem::Requirement
105
105
  requirements:
106
106
  - - "~>"
107
107
  - !ruby/object:Gem::Version
108
- version: '4.0'
108
+ version: '4'
109
109
  - !ruby/object:Gem::Dependency
110
110
  name: uglifier
111
111
  requirement: !ruby/object:Gem::Requirement