ice 0.3.0 → 0.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.
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.3.0
data/ice.gemspec DELETED
@@ -1,87 +0,0 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
- # -*- encoding: utf-8 -*-
5
-
6
- Gem::Specification.new do |s|
7
- s.name = %q{ice}
8
- s.version = "0.3.0"
9
-
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Nate Kidwell"]
12
- s.date = %q{2010-10-04}
13
- s.description = %q{User templates written in javascript}
14
- s.email = %q{nate@ludicast.com}
15
- s.extra_rdoc_files = [
16
- "LICENSE",
17
- "README.markdown"
18
- ]
19
- s.files = [
20
- ".gitignore",
21
- ".specification",
22
- "LICENSE",
23
- "README.markdown",
24
- "Rakefile",
25
- "VERSION",
26
- "ice.gemspec",
27
- "ice_js/History.md",
28
- "ice_js/Readme.md",
29
- "ice_js/lib/form_tag_inputs.js",
30
- "ice_js/lib/path_helper.js",
31
- "ice_js/spec/commands/example_command.rb",
32
- "ice_js/spec/dom.html",
33
- "ice_js/spec/node.js",
34
- "ice_js/spec/rhino.js",
35
- "ice_js/spec/server.html",
36
- "ice_js/spec/server.rb",
37
- "ice_js/spec/support/js.jar",
38
- "ice_js/spec/unit/spec.helper.js",
39
- "ice_js/spec/unit/spec.js",
40
- "init.rb",
41
- "lib/extras/ice_view.rb",
42
- "lib/ice.rb",
43
- "lib/ice/base.rb",
44
- "lib/ice/base_cube.rb",
45
- "lib/ice/cube_association.rb",
46
- "lib/ice/cubeable.rb",
47
- "lib/ice/railtie.rb",
48
- "lib/parser.js",
49
- "spec/base_cube_spec.rb",
50
- "spec/cube_spec.rb",
51
- "spec/ice_spec.rb",
52
- "spec/spec.opts",
53
- "spec/spec_helper.rb",
54
- "togo"
55
- ]
56
- s.homepage = %q{http://github.com/ludicast/ice}
57
- s.rdoc_options = ["--charset=UTF-8"]
58
- s.require_paths = ["lib"]
59
- s.rubygems_version = %q{1.3.7}
60
- s.summary = %q{User templates written in javascript}
61
- s.test_files = [
62
- "spec/base_cube_spec.rb",
63
- "spec/cube_spec.rb",
64
- "spec/ice_spec.rb",
65
- "spec/spec_helper.rb"
66
- ]
67
-
68
- if s.respond_to? :specification_version then
69
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
70
- s.specification_version = 3
71
-
72
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
73
- s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
74
- s.add_runtime_dependency(%q<therubyracer>, ["= 0.7.5"])
75
- s.add_runtime_dependency(%q<rails>, ["= 3.0.0"])
76
- else
77
- s.add_dependency(%q<rspec>, [">= 1.2.9"])
78
- s.add_dependency(%q<therubyracer>, ["= 0.7.5"])
79
- s.add_dependency(%q<rails>, ["= 3.0.0"])
80
- end
81
- else
82
- s.add_dependency(%q<rspec>, [">= 1.2.9"])
83
- s.add_dependency(%q<therubyracer>, ["= 0.7.5"])
84
- s.add_dependency(%q<rails>, ["= 3.0.0"])
85
- end
86
- end
87
-
data/ice_js/History.md DELETED
@@ -1,5 +0,0 @@
1
-
2
- 0.0.1 / YYYY-MM-DD
3
- ------------------
4
-
5
- * Initial release
data/ice_js/Readme.md DELETED
@@ -1,29 +0,0 @@
1
-
2
- # YourLib
3
-
4
- Description
5
-
6
- ## License
7
-
8
- (The MIT License)
9
-
10
- Copyright (c) 2009 Your Name &lt;Your Email&gt;
11
-
12
- Permission is hereby granted, free of charge, to any person obtaining
13
- a copy of this software and associated documentation files (the
14
- 'Software'), to deal in the Software without restriction, including
15
- without limitation the rights to use, copy, modify, merge, publish,
16
- distribute, sublicense, and/or sell copies of the Software, and to
17
- permit persons to whom the Software is furnished to do so, subject to
18
- the following conditions:
19
-
20
- The above copyright notice and this permission notice shall be
21
- included in all copies or substantial portions of the Software.
22
-
23
- THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
24
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
26
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
27
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
28
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
29
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,91 +0,0 @@
1
- function humanize(name) {
2
- match = name.match(/(.*)_id$/)
3
- if (match) {
4
- name = match[1]
5
- }
6
-
7
- return name.split('_').join(' ')
8
- }
9
-
10
- function get_type_value(type, opts){
11
- switch (type) {
12
- case "disabled":
13
- return opts[type] ? "disabled" : ""
14
- case "checked":
15
- return opts[type] ? "checked" : ""
16
- }
17
- return opts[type]
18
- }
19
-
20
- function get_attribute_string(type, opts) {
21
- return (opts && opts[type] && type + "=\"" + get_type_value(type,opts) + "\" ") || ""
22
- }
23
-
24
- function get_size_string(opts) {
25
- return get_attribute_string('size', opts)
26
- }
27
-
28
- function get_class_string(opts) {
29
- return get_attribute_string('class', opts)
30
- }
31
-
32
- function get_disabled_string(opts) {
33
- return get_attribute_string('disabled', opts)
34
- }
35
-
36
- function get_checked_string(opts) {
37
- return get_attribute_string('checked', opts)
38
- }
39
-
40
- function get_maxlength_string(opts) {
41
- return get_attribute_string('maxlength', opts)
42
- }
43
-
44
- function label_tag(name, opts) {
45
- label = ((typeof opts == 'string') && opts) || humanize(name)
46
- class_string = get_class_string(opts)
47
- return "<label "+ class_string + "for=\"" + name + "\">" + label.charAt(0).toUpperCase() + label.substr(1) + "</label>"
48
- }
49
-
50
- var BaseInputTag = function(tag_type) {
51
- this.tag_type = tag_type
52
- }
53
-
54
- BaseInputTag.prototype.render = function () {
55
- return "<input "+ this.checked_string + this.disabled_string + this.class_string +"id=\"" + this.name +"\" " + this.maxlength_string + "name=\"" + this.name +"\" " + this.size_string + "type=\"" + this.tag_type + "\" " + this.value + "/>"
56
- }
57
-
58
- BaseInputTag.prototype.set_opts = function () {
59
- this.class_string = get_class_string(opts)
60
- this.size_string = get_size_string(opts)
61
- this.disabled_string = get_disabled_string(opts)
62
- this.maxlength_string = get_maxlength_string(opts)
63
- }
64
-
65
-
66
- function password_field_tag(name) {
67
- tag = new BaseInputTag("password")
68
- tag.name = name
69
- tag.value = ((typeof arguments[1] == 'string') && "value=\"" + arguments[1] + "\" ") || ""
70
- opts = arguments[2] || arguments[1]
71
-
72
-
73
- tag.set_opts(opts)
74
- tag.checked_string = ""
75
- return tag.render()
76
-
77
- }
78
-
79
- function check_box_tag(name) {
80
- tag = new BaseInputTag("checkbox")
81
- tag.name = name
82
- tag.value = "value=\"" + (((typeof arguments[1] == 'string') && arguments[1]) || 1) + "\" "
83
- tag.checked_string = (arguments[2] === true) ? "checked=\"checked\" " : ""
84
-
85
- opts = arguments[2] || arguments[1]
86
-
87
-
88
-
89
- tag.set_opts(opts)
90
- return tag.render()
91
- }
@@ -1,49 +0,0 @@
1
- function link_to(label, link, opts) {
2
- if (! link) {
3
- link = label
4
- }
5
- return "<a href=\"" + link + "\">" + label + "</a>"
6
- }
7
-
8
- var NavBar = function (options) {
9
- var defaults = NavBar.default_options
10
- for (var default_option in defaults) {
11
- if (defaults.hasOwnProperty(default_option)) {
12
- this[default_option] = defaults[default_option]
13
- }
14
- }
15
-
16
- for (var option in options) {
17
- if (options.hasOwnProperty(option)) {
18
- this[option] = options[option]
19
- }
20
- }
21
- }
22
-
23
- NavBar.prototype.link_to = function (label, link) {
24
- link_code = link_to(label, link)
25
-
26
- if (this.link_wrapper) {
27
- link_data = this.link_wrapper(link_code)
28
- } else {
29
- link_data = "<li>" + link_code + "</li>"
30
- }
31
- if (link_data) {
32
- if (this.link_data && this.separator) {
33
- link_data = this.separator + link_data
34
- }
35
- this.link_data = link_data
36
- }
37
- return link_data;
38
- }
39
-
40
-
41
- NavBar.prototype.open = function () {
42
- return this.nav_open || "<ul class=\"linkBar\">"
43
- }
44
-
45
- NavBar.prototype.close = function () {
46
- return this.nav_close || "</ul>"
47
- }
48
-
49
- NavBar.default_options = {}
@@ -1,19 +0,0 @@
1
-
2
- # uncomment and call with `$ jspec example `
3
-
4
- # command :example do |c|
5
- # c.syntax = 'jspec example [options]'
6
- # c.description = 'Just an example command'
7
- # c.option '-f', '--foo string', 'Does some foo with <string>'
8
- # c.option '-b', '--bar [string]', 'Does some bar with [string]'
9
- # c.example 'Do some foo', 'jspec example --foo bar'
10
- # c.example 'Do some bar', 'jspec example --bar'
11
- # c.when_called do |args, options|
12
- # p args
13
- # p options.__hash__
14
- # # options.foo
15
- # # options.bar
16
- # # options.__hash__[:foo]
17
- # # options.__hash__[:bar]
18
- # end
19
- # end
data/ice_js/spec/dom.html DELETED
@@ -1,23 +0,0 @@
1
- <html>
2
- <head>
3
- <link type="text/css" rel="stylesheet" href="/Users/natekidwell/.rvm/gems/ruby-1.9.1-p378/gems/jspec-4.3.1/lib/jspec.css" />
4
- <script src="/Users/natekidwell/.rvm/gems/ruby-1.9.1-p378/gems/jspec-4.3.1/lib/jspec.js"></script>
5
- <script src="/Users/natekidwell/.rvm/gems/ruby-1.9.1-p378/gems/jspec-4.3.1/lib/jspec.xhr.js"></script>
6
- <script src="../lib/path_helper.js"></script>
7
- <script src="../lib/form_tag_inputs.js"></script>
8
- <script src="unit/spec.helper.js"></script>
9
- <script>
10
- function runSuites() {
11
- JSpec
12
- .exec('unit/spec.js')
13
- .run({ fixturePath: 'fixtures' })
14
- .report()
15
- }
16
- </script>
17
- </head>
18
- <body class="jspec" onLoad="runSuites();">
19
- <div id="jspec-top"><h2 id="jspec-title">JSpec <em><script>document.write(JSpec.version)</script></em></h2></div>
20
- <div id="jspec"></div>
21
- <div id="jspec-bottom"></div>
22
- </body>
23
- </html>
data/ice_js/spec/node.js DELETED
@@ -1,10 +0,0 @@
1
-
2
- require.paths.unshift('spec', '/Users/natekidwell/.rvm/gems/ruby-1.9.1-p378/gems/jspec-4.3.1/lib', 'lib')
3
- require('jspec')
4
- require('unit/spec.helper')
5
- require('yourlib')
6
-
7
- JSpec
8
- .exec('spec/unit/spec.js')
9
- .run({ reporter: JSpec.reporters.Terminal, fixturePath: 'spec/fixtures', failuresOnly: true })
10
- .report()
data/ice_js/spec/rhino.js DELETED
@@ -1,10 +0,0 @@
1
-
2
- load('/Users/natekidwell/.rvm/gems/ruby-1.9.1-p378/gems/jspec-4.3.1/lib/jspec.js')
3
- load('/Users/natekidwell/.rvm/gems/ruby-1.9.1-p378/gems/jspec-4.3.1/lib/jspec.xhr.js')
4
- load('lib/yourlib.js')
5
- load('spec/unit/spec.helper.js')
6
-
7
- JSpec
8
- .exec('spec/unit/spec.js')
9
- .run({ reporter: JSpec.reporters.Terminal, fixturePath: 'spec/fixtures' })
10
- .report()
@@ -1,18 +0,0 @@
1
- <html>
2
- <head>
3
- <script src="/jspec/jspec.js"></script>
4
- <script src="/jspec/jspec.xhr.js"></script>
5
- <script src="/lib/yourlib.js"></script>
6
- <script src="/spec/unit/spec.helper.js"></script>
7
- <script>
8
- function runSuites() {
9
- JSpec
10
- .exec('unit/spec.js')
11
- .run({ reporter: JSpec.reporters.Server, verbose: true, failuresOnly: true, fixturePath: '/spec/fixtures' })
12
- .report()
13
- }
14
- </script>
15
- </head>
16
- <body class="jspec" onLoad="runSuites();">
17
- </body>
18
- </html>
@@ -1,4 +0,0 @@
1
-
2
- get '/lib/*' do |path|
3
- send_file File.dirname(__FILE__) + '/../lib/' + path
4
- end
Binary file
File without changes
@@ -1,180 +0,0 @@
1
- describe "NavBar"
2
-
3
- describe "by default"
4
- before_each
5
- bar = new NavBar()
6
- end
7
-
8
-
9
- it "should generate list by default"
10
- (bar.open() + bar.close()).should.eql "<ul class=\"linkBar\"></ul>"
11
- end
12
-
13
- it "should generate list with internal links"
14
-
15
- links = (bar.open() + bar.link_to("ff") + bar.link_to("aa") + bar.close())
16
-
17
- links.should.eql "<ul class=\"linkBar\"><li><a href=\"ff\">ff</a></li><li><a href=\"aa\">aa</a></li></ul>"
18
- end
19
-
20
- it "should take optional titles"
21
-
22
- links = (bar.open() + bar.link_to("ff", "aa") + bar.close())
23
-
24
- links.should.eql "<ul class=\"linkBar\"><li><a href=\"aa\">ff</a></li></ul>"
25
- end
26
-
27
- end
28
-
29
- describe "with options"
30
- before_each
31
- bar = new NavBar( {nav_open:"<div>", nav_close:"</div>",link_wrapper:function(link){
32
- return "<span>" + link + "</span>"
33
- }} )
34
- end
35
-
36
- it "should generate list with wrappers"
37
- links = (bar.open() + bar.link_to("ff") + bar.close())
38
-
39
- links.should.eql "<div><span><a href=\"ff\">ff</a></span></div>"
40
- end
41
-
42
- end
43
-
44
- describe "with separator"
45
- before_each
46
- separator = " --- "
47
- bar = new NavBar({separator: separator})
48
- end
49
-
50
- it "should not separate single links"
51
- links = (bar.open() + bar.link_to("ff") + bar.close())
52
- links.should.eql "<ul class=\"linkBar\"><li><a href=\"ff\">ff</a></li></ul>"
53
- end
54
-
55
- it "should separate multiple links"
56
- links = (bar.open() + bar.link_to("ff") + bar.link_to("aa") + bar.close())
57
- links.should.eql "<ul class=\"linkBar\"><li><a href=\"ff\">ff</a></li>" + separator + "<li><a href=\"aa\">aa</a></li></ul>"
58
- end
59
-
60
- it "should not display for missing links"
61
- bar.nav_open = "<div>"
62
- bar.nav_close = "</div>"
63
- bar.link_wrapper = function (link) {
64
- if (link.match(/aa/)) {
65
- return ""
66
- } else {
67
- return link
68
- }
69
- }
70
-
71
- links = (bar.open() + bar.link_to("ff") + bar.link_to("aa") + bar.link_to("gg") + bar.close())
72
- links.should.eql "<div><a href=\"ff\">ff</a>" + separator + "<a href=\"gg\">gg</a></div>"
73
-
74
- end
75
- end
76
-
77
-
78
- describe "with class-wide options"
79
- before_each
80
- NavBar.default_options = {nav_open:"<div>", nav_close:"</div>",link_wrapper:function(link){
81
- return "<span>" + link + "</span>"
82
- }}
83
- bar = new NavBar( )
84
- end
85
-
86
- it "should generate list with wrappers"
87
- links = (bar.open() + bar.link_to("ff") + bar.close())
88
-
89
- links.should.eql "<div><span><a href=\"ff\">ff</a></span></div>"
90
- end
91
-
92
- after_each
93
- NavBar.default_options = {}
94
- end
95
-
96
- end
97
-
98
-
99
- end
100
-
101
-
102
- describe "Form Builder Tags"
103
- describe "label_tag"
104
- it "assigns default value"
105
- tag = label_tag('name')
106
- tag.should.eql '<label for="name">Name</label>'
107
- end
108
- it "assigns humanized default value"
109
- tag = label_tag('supervising_boss_id')
110
- tag.should.eql '<label for="supervising_boss_id">Supervising boss</label>'
111
- end
112
- it "allows alternative value"
113
- tag = label_tag('name', 'Your Name')
114
- tag.should.eql '<label for="name">Your Name</label>'
115
- end
116
- it "allows class to be assigned"
117
- tag = label_tag('name', {'class':'small_label'})
118
- tag.should.eql '<label class="small_label" for="name">Name</label>'
119
- end
120
-
121
- end
122
-
123
- describe "for password_field_tag"
124
- it "should generate regular password tag"
125
- tag = password_field_tag('pass')
126
- tag.should.eql '<input id="pass" name="pass" type="password" />'
127
- end
128
-
129
- it "should have alternate value"
130
- tag = password_field_tag('secret', 'Your secret here')
131
- tag.should.eql '<input id="secret" name="secret" type="password" value="Your secret here" />'
132
- end
133
-
134
- it "should take class"
135
- tag = password_field_tag('masked', {'class':'masked_input_field'})
136
- tag.should.eql '<input class="masked_input_field" id="masked" name="masked" type="password" />'
137
- end
138
-
139
- it "should take size"
140
- tag = password_field_tag('token','', {size:15})
141
- tag.should.eql '<input id="token" name="token" size="15" type="password" value="" />'
142
- end
143
-
144
- it "should take maxlength"
145
- tag = password_field_tag('key',{maxlength:16})
146
- tag.should.eql '<input id="key" maxlength="16" name="key" type="password" />'
147
- end
148
-
149
-
150
- it "should take disabled option"
151
- tag = password_field_tag('confirm_pass',{disabled:true})
152
- tag.should.eql '<input disabled="disabled" id="confirm_pass" name="confirm_pass" type="password" />'
153
- end
154
-
155
- it "should take multiple options"
156
- tag = password_field_tag('pin','1234',{maxlength:4,size:6, 'class':'pin-input'})
157
- tag.should.eql '<input class="pin-input" id="pin" maxlength="4" name="pin" size="6" type="password" value="1234" />'
158
- end
159
-
160
- end
161
-
162
- describe "for check_box_tag"
163
-
164
- it "should generate basic checkbox"
165
- tag = check_box_tag('accept')
166
- tag.should.eql '<input id="accept" name="accept" type="checkbox" value="1" />'
167
- end
168
-
169
- it "should take alternate values"
170
- tag = check_box_tag('rock', 'rock music')
171
- tag.should.eql '<input id="rock" name="rock" type="checkbox" value="rock music" />'
172
- end
173
- it "should take parameter for checked"
174
- tag = check_box_tag('receive_email', 'yes', true)
175
- tag.should.eql '<input checked="checked" id="receive_email" name="receive_email" type="checkbox" value="yes" />'
176
- end
177
- end
178
-
179
- end
180
-