picky-client 1.3.4 → 1.4.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.
@@ -4,27 +4,37 @@ module Picky
4
4
  #
5
5
  class Helper
6
6
 
7
- @@localized_interface = lambda { |options|
7
+ @@localized_input = lambda { |options|
8
8
  search_button_text = options[:button] || 'search'
9
- no_results = options[:no_results] || 'Sorry, no results found!'
10
- more_allocations = options[:more] || 'more'
11
9
  <<-HTML
12
- <div id="picky">
13
- <div class="dashboard empty">
14
- <div class="feedback">
15
- <div class="status"></div>
16
- <input type="text" autocorrect="off" class="query"/>
17
- <div class="reset" title="clear"></div>
18
- </div>
19
- <input type="button" class="search_button" value="#{search_button_text}">
20
- </div>
21
- <ol class="results"></ol>
22
- <div class="no_results">#{no_results}</div>
23
- <div class="allocations">
24
- <ol class="shown"></ol>
25
- <ol class="more">#{more_allocations}</ol>
26
- <ol class="hidden"></ol>
10
+ <div class="dashboard empty">
11
+ <div class="feedback">
12
+ <div class="status"></div>
13
+ <input type="text" autocorrect="off" class="query"/>
14
+ <div class="reset" title="clear"></div>
27
15
  </div>
16
+ <input type="button" class="search_button" value="#{search_button_text}">
17
+ </div>
18
+ HTML
19
+ }
20
+ @@localized_results = lambda { |options|
21
+ no_results = options[:no_results] || 'Sorry, no results found!'
22
+ more_allocations = options[:more] || 'more'
23
+ <<-HTML
24
+ <div class="results"></div>
25
+ <div class="no_results">#{no_results}</div>
26
+ <div class="allocations">
27
+ <ol class="shown"></ol>
28
+ <ol class="more">#{more_allocations}</ol>
29
+ <ol class="hidden"></ol>
30
+ </div>
31
+ HTML
32
+ }
33
+ @@localized_interface = lambda { |options|
34
+ <<-HTML
35
+ <div id="picky">
36
+ #{@@localized_input[options]}
37
+ #{@@localized_results[options]}
28
38
  </div>
29
39
  HTML
30
40
  }
@@ -44,7 +54,13 @@ HTML
44
54
  #
45
55
  #
46
56
  def self.interface options = {}
47
- @@localized_interface[options].gsub!(/[\n]/, '').squeeze! ' '
57
+ @@localized_interface[options]
58
+ end
59
+ def self.input options = {}
60
+ @@localized_input[options]
61
+ end
62
+ def self.results options = {}
63
+ @@localized_results[options]
48
64
  end
49
65
 
50
66
  # Returns a cached version if you always use a single language.
@@ -17,12 +17,30 @@ describe Picky::Helper do
17
17
  end
18
18
  end
19
19
 
20
+ describe "input" do
21
+ it "should return good html" do
22
+ Picky::Helper.input.should == "<div class=\"dashboard empty\">\n <div class=\"feedback\">\n <div class=\"status\"></div>\n <input type=\"text\" autocorrect=\"off\" class=\"query\"/>\n <div class=\"reset\" title=\"clear\"></div>\n </div>\n <input type=\"button\" class=\"search_button\" value=\"search\">\n</div>\n"
23
+ end
24
+ it "should return good html" do
25
+ Picky::Helper.input(:button => 'find').should == "<div class=\"dashboard empty\">\n <div class=\"feedback\">\n <div class=\"status\"></div>\n <input type=\"text\" autocorrect=\"off\" class=\"query\"/>\n <div class=\"reset\" title=\"clear\"></div>\n </div>\n <input type=\"button\" class=\"search_button\" value=\"find\">\n</div>\n"
26
+ end
27
+ end
28
+
29
+ describe "results" do
30
+ it "should return good html" do
31
+ Picky::Helper.input.should == "<div class=\"dashboard empty\">\n <div class=\"feedback\">\n <div class=\"status\"></div>\n <input type=\"text\" autocorrect=\"off\" class=\"query\"/>\n <div class=\"reset\" title=\"clear\"></div>\n </div>\n <input type=\"button\" class=\"search_button\" value=\"search\">\n</div>\n"
32
+ end
33
+ it "should return good html" do
34
+ Picky::Helper.input(:no_results => 'SORRY!', :more => 'Click for more!').should == "<div class=\"dashboard empty\">\n <div class=\"feedback\">\n <div class=\"status\"></div>\n <input type=\"text\" autocorrect=\"off\" class=\"query\"/>\n <div class=\"reset\" title=\"clear\"></div>\n </div>\n <input type=\"button\" class=\"search_button\" value=\"search\">\n</div>\n"
35
+ end
36
+ end
37
+
20
38
  describe "interface" do
21
39
  it "should return good html" do
22
- Picky::Helper.interface.should == "<div id=\"picky\"> <div class=\"dashboard empty\"> <div class=\"feedback\"> <div class=\"status\"></div> <input type=\"text\" autocorrect=\"off\" class=\"query\"/> <div class=\"reset\" title=\"clear\"></div> </div> <input type=\"button\" class=\"search_button\" value=\"search\"> </div> <ol class=\"results\"></ol> <div class=\"no_results\">Sorry, no results found!</div> <div class=\"allocations\"> <ol class=\"shown\"></ol> <ol class=\"more\">more</ol> <ol class=\"hidden\"></ol> </div></div>"
40
+ Picky::Helper.interface.should == "<div id=\"picky\">\n <div class=\"dashboard empty\">\n <div class=\"feedback\">\n <div class=\"status\"></div>\n <input type=\"text\" autocorrect=\"off\" class=\"query\"/>\n <div class=\"reset\" title=\"clear\"></div>\n </div>\n <input type=\"button\" class=\"search_button\" value=\"search\">\n</div>\n\n <div class=\"results\"></div>\n<div class=\"no_results\">Sorry, no results found!</div>\n<div class=\"allocations\">\n <ol class=\"shown\"></ol>\n <ol class=\"more\">more</ol>\n <ol class=\"hidden\"></ol>\n</div>\n\n</div>\n"
23
41
  end
24
42
  it "should return good html" do
25
- Picky::Helper.interface(:button => 'find', :no_results => 'SORRY!', :more => 'Click for more!').should == "<div id=\"picky\"> <div class=\"dashboard empty\"> <div class=\"feedback\"> <div class=\"status\"></div> <input type=\"text\" autocorrect=\"off\" class=\"query\"/> <div class=\"reset\" title=\"clear\"></div> </div> <input type=\"button\" class=\"search_button\" value=\"find\"> </div> <ol class=\"results\"></ol> <div class=\"no_results\">SORRY!</div> <div class=\"allocations\"> <ol class=\"shown\"></ol> <ol class=\"more\">Click for more!</ol> <ol class=\"hidden\"></ol> </div></div>"
43
+ Picky::Helper.interface(:button => 'find', :no_results => 'SORRY!', :more => 'Click for more!').should == "<div id=\"picky\">\n <div class=\"dashboard empty\">\n <div class=\"feedback\">\n <div class=\"status\"></div>\n <input type=\"text\" autocorrect=\"off\" class=\"query\"/>\n <div class=\"reset\" title=\"clear\"></div>\n </div>\n <input type=\"button\" class=\"search_button\" value=\"find\">\n</div>\n\n <div class=\"results\"></div>\n<div class=\"no_results\">SORRY!</div>\n<div class=\"allocations\">\n <ol class=\"shown\"></ol>\n <ol class=\"more\">Click for more!</ol>\n <ol class=\"hidden\"></ol>\n</div>\n\n</div>\n"
26
44
  end
27
45
  end
28
46
 
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: picky-client
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.3.4
5
+ version: 1.4.0
6
6
  platform: ruby
7
7
  authors:
8
8
  - Florian Hanke
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-02-12 00:00:00 +01:00
13
+ date: 2011-02-19 00:00:00 +01:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency