listly 0.1.3 → 0.1.4
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.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +15 -7
- data/lib/listly/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 06730e4bf6465e967b61301ae338d24863e58c6a
|
|
4
|
+
data.tar.gz: cfd63cdd96c7192d9a1846fc3ca723ea0c5fc692
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2143ec5091d4ac1eb46602ac782b612c34e8067390c6a6059e6e4308a15574a772c706600963428d1b23e19c06f8ace9eb7e571e0aea34f6166d5776cd5a133b
|
|
7
|
+
data.tar.gz: 7015231ed9ebbbb9a218aeb8e6787f284efe624cf27ed5209a05d23a3c971c4d84a1b0e4d418920ea559b1473c319b5484dd8e4a89c4aa3c6151106453cdb190
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
|
@@ -43,7 +43,7 @@ module YourRailsApp
|
|
|
43
43
|
class Application < Rails::Application
|
|
44
44
|
...
|
|
45
45
|
config.listly.listly_store_location = :local_list_store
|
|
46
|
-
config.listly.listly_constants_module = :local_list_constants
|
|
46
|
+
config.listly.listly_constants_module = :local_list_constants # <--- ModuleName as symbol
|
|
47
47
|
...
|
|
48
48
|
end
|
|
49
49
|
end
|
|
@@ -54,10 +54,10 @@ Here is an example of the module and some sample constants that will be turned i
|
|
|
54
54
|
|
|
55
55
|
```ruby
|
|
56
56
|
|
|
57
|
-
module LocalListConstants
|
|
57
|
+
module LocalListConstants # <------ Module name see the symbol "listly_constants_module" above
|
|
58
58
|
|
|
59
|
-
STATE_TYPES = :state_type_hash
|
|
60
|
-
SEX_TYPES = :sex_type_hash
|
|
59
|
+
STATE_TYPES = :state_type_hash # <----- see the hash stored in locales below
|
|
60
|
+
SEX_TYPES = :sex_type_hash # <----- see the hash stored in locales below
|
|
61
61
|
|
|
62
62
|
end
|
|
63
63
|
|
|
@@ -68,13 +68,13 @@ put the respective data relating to the above constant values.
|
|
|
68
68
|
|
|
69
69
|
```ruby
|
|
70
70
|
|
|
71
|
-
|
|
71
|
+
state_types_hash: [ # <------- Array of hashes - name corresponds to constants see above
|
|
72
72
|
{code: 'act', name: 'ACT', desc: 'Australian Capital Teritory'},
|
|
73
73
|
{code: 'nsw', name: 'NSW', desc: 'New South Wales'},
|
|
74
74
|
{code: 'nt', name: 'NT', desc: 'Northern Teritory'},
|
|
75
75
|
{code: 'qld', name: 'QLD', desc: 'Queensland'},
|
|
76
76
|
]
|
|
77
|
-
sex_types_hash: [
|
|
77
|
+
sex_types_hash: [ # <------- Array of hashes - name corresponds to constants see above
|
|
78
78
|
{code: 'male', name: 'Male'},
|
|
79
79
|
{code: 'female', name: 'Female'},
|
|
80
80
|
{code: 'notset', name: 'Not Set'}
|
|
@@ -103,7 +103,8 @@ module Wrapper
|
|
|
103
103
|
include PageHeader
|
|
104
104
|
include Mustache::FormBuilder
|
|
105
105
|
include Wrapper::Person::Form
|
|
106
|
-
include
|
|
106
|
+
include SexTypes # <------ This is the included list module - see the SEX_TYPES
|
|
107
|
+
# constant in the LocalListConstants module above
|
|
107
108
|
|
|
108
109
|
```
|
|
109
110
|
|
|
@@ -122,6 +123,13 @@ sex_field: f.collection_select(:sex, all_sex_types, :sex_type_code, :sex_type_na
|
|
|
122
123
|
}
|
|
123
124
|
}),
|
|
124
125
|
|
|
126
|
+
# 'all_sex_types' --> is a listly defined method to get the whole list
|
|
127
|
+
# 'sex_type_code' --> is a listly defined attribute on the inner class
|
|
128
|
+
# 'sex_type_name' --> is a listly defined attribute on the inner class
|
|
129
|
+
|
|
130
|
+
# NB: The gem creates attributes from the names of the hash codes and gives the attributes
|
|
131
|
+
# values according to the hash values - i.e. from the data in the i18n stored array of hashes!
|
|
132
|
+
|
|
125
133
|
```
|
|
126
134
|
|
|
127
135
|
## Development
|
data/lib/listly/version.rb
CHANGED