populate-me 0.0.13 → 0.0.14
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/populate_me/ext.rb +16 -0
- data/lib/populate_me/mongo/crushyform.rb +2 -5
- data/lib/populate_me/mongo/mutation.rb +1 -1
- data/lib/populate_me/mongo.rb +1 -0
- data/populate-me.gemspec +1 -1
- metadata +4 -2
@@ -0,0 +1,16 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
# Extends standard classes
|
4
|
+
|
5
|
+
Integer.class_eval do
|
6
|
+
def to_price_string
|
7
|
+
("%.2f" % (self/100.0)).sub(/\.00/, '')
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
String.class_eval do
|
12
|
+
def to_price_integer
|
13
|
+
("%.2f" % self.gsub(/[^\d\.\-]/, '')).gsub(/\./,'').to_i
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
@@ -33,11 +33,8 @@ module PopulateMe
|
|
33
33
|
crushyform_types[:string].call(m,c,o)
|
34
34
|
end,
|
35
35
|
:price => proc do |m,c,o|
|
36
|
-
|
37
|
-
|
38
|
-
out = "<input type='text' name='%s[]' id='%s-main' class='%s price-main' value='%s' size='10' /> • "
|
39
|
-
out << "<input type='text' name='%s[]' id='%s-cents' class='%s price-cents' value='%s' size='2' maxlength='2' />"
|
40
|
-
out % [o[:input_name], crushid, o[:input_class], price_main, o[:input_name], crushid, o[:input_class], "%02d" % price_cents]
|
36
|
+
value = o[:input_value].to_price_string if o[:input_value].respond_to?(:to_price_string)
|
37
|
+
"<input type='%s' name='%s' value=\"%s\" id='%s' class='%s' %s />%s\n" % [o[:input_type]||'text', o[:input_name], value, m.field_id_for(c), o[:input_class], o[:required]&&'required', o[:required]]
|
41
38
|
end,
|
42
39
|
:boolean => proc do |m,c,o|
|
43
40
|
crushid = m.field_id_for(c)
|
@@ -213,7 +213,7 @@ module PopulateMe
|
|
213
213
|
def after_validation; end
|
214
214
|
def fix_type_integer(k,v); @doc[k] = v.to_i; end
|
215
215
|
def fix_type_price(k,v)
|
216
|
-
|
216
|
+
@doc[k] = v.respond_to?(:to_price_integer) ? v.to_price_integer : v
|
217
217
|
end
|
218
218
|
def fix_type_boolean(k,v); @doc[k] = (v=='true'||v==true) ? true : false; end
|
219
219
|
def fix_type_slug(k,v); @doc[k] = self.auto_slug if v.to_s==''; end
|
data/lib/populate_me/mongo.rb
CHANGED
data/populate-me.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'populate-me'
|
3
|
-
s.version = "0.0.
|
3
|
+
s.version = "0.0.14"
|
4
4
|
s.platform = Gem::Platform::RUBY
|
5
5
|
s.summary = "ALPHA !!! Populate Me is relatively complete but simple CMS"
|
6
6
|
s.description = "ALPHA !!! Populate Me is relatively complete but simple CMS. It includes a Rack middleware for putting in your Rack stack, and a bespoke MongoDB ODM. But Populate Me is not really finished yet."
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: populate-me
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.14
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-07-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rack-golem
|
@@ -87,6 +87,7 @@ files:
|
|
87
87
|
- lib/populate_me/control/_public/js/plugin.quicksearch.js
|
88
88
|
- lib/populate_me/control/_public/js/plugin.underwood.js
|
89
89
|
- lib/populate_me/control/views/populate_me_layout.erb
|
90
|
+
- lib/populate_me/ext.rb
|
90
91
|
- lib/populate_me/mongo.rb
|
91
92
|
- lib/populate_me/mongo/backend_api_plug.rb
|
92
93
|
- lib/populate_me/mongo/crushyform.rb
|
@@ -120,3 +121,4 @@ signing_key:
|
|
120
121
|
specification_version: 3
|
121
122
|
summary: ALPHA !!! Populate Me is relatively complete but simple CMS
|
122
123
|
test_files: []
|
124
|
+
has_rdoc:
|