trenni-formatters 0.2.1 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- NGYwNzExYWY3NjEzOGI5MTlhYTY5NjdlMjkwZTZmZWY0NGNjM2I3Nw==
5
- data.tar.gz: !binary |-
6
- MTk3MmY0MDg4NjFjN2E1MDQwYTNlZGRmNWM2ODMxZDJmMzQ1NmMzYg==
7
- !binary "U0hBNTEy":
8
- metadata.gz: !binary |-
9
- YmQ1NDA0Zjc1ZGYzZTIxNjYxYjA4YmNlOTUwMjg1NTBkOWJlZWY4NmQ4ZjIy
10
- ZWFhYzhhZDA5YTY1OTUyZTc4ZmY4ZmJmNGUyOWYyYjU4YTI2ZWRkMzNjYTRk
11
- YTYwZDliN2YzNmM0ODg4MzI3MDI4NWUxZWU2MjMxMzk0M2MyM2E=
12
- data.tar.gz: !binary |-
13
- YjcwZmM0OTY4YjczMTk5MjQ4NTdlNGRmZjU3MTE1ZmJlMzY1OTU1OGI2Zjhj
14
- OGE2OTk2ZTI4NzRkNTdhMzkyMDZkODcwMTc5MTk3NDJmOWNkNjg3MDQ1MTE4
15
- NDY2Yzg1OTMwMjkzMmMxMjZjZDcyNzYwMGVkZDY3YTEyY2RjNGU=
2
+ SHA1:
3
+ metadata.gz: 541558e37b2508160c0f53b739a55fca59dc2bbb
4
+ data.tar.gz: 57e9b3758e6ea0bfb835cc39358d441a6d3bc08c
5
+ SHA512:
6
+ metadata.gz: 7f0c5bf2ecddaa4031ab0cc05fe75a91fea59671f12787d4f2ff0b37be6b5671f80346eac8e55d9502e24a135df7459195ca2818789673e7ef25e43fd19c800f
7
+ data.tar.gz: a6d55bbf536c9b503b5f89b10d8e35c343ea15e3fdf74d9accf07a0e7244718881031d5771cb75be1b59d0fb854b6710560d77f80783eefa798317134fd73c51
@@ -53,17 +53,28 @@ module Trenni
53
53
  end
54
54
 
55
55
  def pattern_for(options)
56
- nil
56
+ options[:pattern]
57
+ end
58
+
59
+ def placeholder_for(options)
60
+ options[:placeholder]
57
61
  end
58
62
 
59
63
  def input_attributes_for(options)
60
- return {
61
- :type => options[:type],
62
- :name => name_for(options),
63
- :value => value_for(options),
64
- :required => options[:required] ? true : false,
65
- :pattern => pattern_for(options)
64
+ attributes = {
65
+ :type => options[:type],
66
+ :name => name_for(options),
67
+ :value => value_for(options),
68
+ :required => options[:required] ? true : false,
69
+ :pattern => pattern_for(options),
70
+ :placeholder => placeholder_for(options)
66
71
  }
72
+
73
+ if explicit_attributes = options[:attributes]
74
+ attributes.update(explicit_attributes)
75
+ end
76
+
77
+ return attributes
67
78
  end
68
79
 
69
80
  # An input field (single line text).
@@ -83,6 +94,7 @@ module Trenni
83
94
  return {
84
95
  :name => name_for(options),
85
96
  :required => options[:required] ? true : false,
97
+ :placeholder => placeholder_for(options),
86
98
  }
87
99
  end
88
100
 
@@ -36,6 +36,8 @@ module Trenni
36
36
  @object = formatter.object
37
37
  @field = options[:field]
38
38
 
39
+ @options = options
40
+
39
41
  @builder = builder
40
42
  end
41
43
 
@@ -54,7 +56,7 @@ module Trenni
54
56
  def option_attributes_for(options)
55
57
  return {
56
58
  :value => value_for(options),
57
- :selected => options[:selected],
59
+ :selected => options.fetch(:selected){ value_for(@options) == value_for(options) },
58
60
  }
59
61
  end
60
62
 
@@ -20,6 +20,6 @@
20
20
 
21
21
  module Trenni
22
22
  module Formatters
23
- VERSION = "0.2.1"
23
+ VERSION = "0.3.1"
24
24
  end
25
25
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trenni-formatters
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-07-31 00:00:00.000000000 Z
11
+ date: 2014-05-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: trenni
@@ -24,11 +24,10 @@ dependencies:
24
24
  - - ~>
25
25
  - !ruby/object:Gem::Version
26
26
  version: 1.2.0
27
- description: ! "\tTrenni is a templating system, and these formatters assist with
28
- the development\n\tof typical view and form based web interface. A formatter is
29
- a high-level\n\tadapter that turns model data into presentation text.\n\n\tFormatters
30
- are designed to be customised, typically per-project, for specific\n\tformatting
31
- needs.\n"
27
+ description: "\tTrenni is a templating system, and these formatters assist with the
28
+ development\n\tof typical view and form based web interface. A formatter is a high-level\n\tadapter
29
+ that turns model data into presentation text.\n\n\tFormatters are designed to be
30
+ customised, typically per-project, for specific\n\tformatting needs.\n"
32
31
  email:
33
32
  - samuel.williams@oriontransfer.co.nz
34
33
  executables: []
@@ -58,20 +57,21 @@ require_paths:
58
57
  - lib
59
58
  required_ruby_version: !ruby/object:Gem::Requirement
60
59
  requirements:
61
- - - ! '>='
60
+ - - '>='
62
61
  - !ruby/object:Gem::Version
63
62
  version: '0'
64
63
  required_rubygems_version: !ruby/object:Gem::Requirement
65
64
  requirements:
66
- - - ! '>='
65
+ - - '>='
67
66
  - !ruby/object:Gem::Version
68
67
  version: '0'
69
68
  requirements: []
70
69
  rubyforge_project:
71
- rubygems_version: 2.0.6
70
+ rubygems_version: 2.0.3
72
71
  signing_key:
73
72
  specification_version: 4
74
73
  summary: Formatters for Trenni, to assist with typical views and form based interfaces.
75
74
  test_files:
76
75
  - test/test_formatters.rb
77
76
  - test/test_forms_formatter.rb
77
+ has_rdoc: