ultimate-base 0.3.4.0 → 0.3.5.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/Gemfile.lock +1 -1
- data/app/assets/javascripts/ultimate/backbone/views/slider.js.coffee +3 -2
- data/app/assets/javascripts/ultimate/helpers/form_tag.js.coffee +4 -6
- data/app/assets/javascripts/ultimate/helpers/tag.js.coffee +3 -3
- data/app/assets/javascripts/ultimate/helpers/url.js.coffee +1 -1
- data/app/assets/javascripts/ultimate/jquery-plugin-class.js.coffee +11 -6
- data/app/assets/stylesheets/ultimate/mixins/_routines.scss +9 -0
- data/app/assets/stylesheets/ultimate/mixins/css3/_text-shadow.scss +2 -2
- data/lib/ultimate/base/version.rb +1 -1
- data/test/javascripts/tests/helpers/form_tag_test.js.coffee +1 -0
- data/test/javascripts/tests/helpers/tag_test.js.coffee +1 -0
- metadata +2 -2
data/Gemfile.lock
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# TODO timeout without cycling, maybe bouce effect
|
2
2
|
# TODO mousewheel
|
3
|
+
# TODO touch events
|
3
4
|
|
4
5
|
Ultimate.Backbone.Views ||= {}
|
5
6
|
|
@@ -23,11 +24,11 @@ class Ultimate.Backbone.Views.Slider extends Ultimate.Backbone.View
|
|
23
24
|
cycling: false
|
24
25
|
interval: 0
|
25
26
|
durationPerPixel: 2
|
27
|
+
moveItems: 0
|
26
28
|
|
27
29
|
totalItems: 0
|
28
30
|
itemSize: 0
|
29
31
|
displayItems: 0
|
30
|
-
moveItems: 0
|
31
32
|
overItems: 0
|
32
33
|
prevItems: 0 # can as setting
|
33
34
|
|
@@ -46,7 +47,7 @@ class Ultimate.Backbone.Views.Slider extends Ultimate.Backbone.View
|
|
46
47
|
needSize = @totalItems * @itemSize
|
47
48
|
@jLine[@sizeAttr](needSize) if @jLine[@sizeAttr]() < needSize
|
48
49
|
@displayItems = Math.round(@jDisplay[@sizeAttr]() / @itemSize)
|
49
|
-
@moveItems
|
50
|
+
@moveItems ||= Math.round(@displayItems / 2)
|
50
51
|
@overItems = @totalItems - @displayItems
|
51
52
|
if @overItems
|
52
53
|
if @prevItems
|
@@ -26,17 +26,15 @@
|
|
26
26
|
Ultimate.Helpers.Tag.tag 'input', _.extend({type: 'text', name: name, id: @_sanitize_to_id(name), value: value}, options)
|
27
27
|
|
28
28
|
label_tag: (name = null, content_or_options = null, options = null, block = null) ->
|
29
|
-
if
|
30
|
-
options = content_or_options
|
31
|
-
|
32
|
-
options ||= {}
|
29
|
+
if block = _.outcasts.blockGiven(arguments)
|
30
|
+
[options, content_or_options] = [content_or_options, block()]
|
31
|
+
options ||= {}
|
33
32
|
if _.isString(name) and not _.string.isBlank(name)
|
34
33
|
unless _.has(options, 'for')
|
35
34
|
options = _.clone(options)
|
36
35
|
options['for'] = @_sanitize_to_id(name)
|
37
36
|
content_or_options ||= _.string.humanize(name)
|
38
|
-
content_or_options
|
39
|
-
Ultimate.Helpers.Tag.content_tag 'label', content_or_options, options, block
|
37
|
+
Ultimate.Helpers.Tag.content_tag_string 'label', content_or_options, options, true, false
|
40
38
|
|
41
39
|
hidden_field_tag: (name, value = null, options = {}) ->
|
42
40
|
@text_field_tag name, value, _.extend(options, type: 'hidden')
|
@@ -70,12 +70,12 @@
|
|
70
70
|
# TODO more zen features: +, *x, {content}
|
71
71
|
# TODO cache
|
72
72
|
selectorToHtml: (selector) ->
|
73
|
-
if matches = selector.match(/^[\s>]*([\w
|
73
|
+
if matches = selector.match(/^[\s>]*([\w\-\.#]+)(.*)$/)
|
74
74
|
selector = matches[1]
|
75
75
|
continuation = matches[2] # in v1 {(if continuation then ">" + content else " />")}
|
76
76
|
tag_name = selector.match(/^\w+/)?[0] or 'div'
|
77
|
-
id = selector.match(/#(\w+)/)?[1]
|
78
|
-
classes = _.map( selector.match(
|
77
|
+
id = selector.match(/#([\w\-]+)/)?[1]
|
78
|
+
classes = _.map( selector.match(/\.[\w\-]+/g), (c) -> _.string.ltrim(c, '.') )
|
79
79
|
html_options = {}
|
80
80
|
html_options['id'] = id if id
|
81
81
|
html_options['class'] = classes.join(' ') if classes.length
|
@@ -123,7 +123,7 @@ __string_encode = (str) -> _.map(str, (char) -> "&##{char.charCodeAt(0)};" ).joi
|
|
123
123
|
|
124
124
|
_add_method_to_attributes: (html_options, method) ->
|
125
125
|
if _.isString(method) and method.toLowerCase() isnt 'get' and not /nofollow/.test(html_options['rel'])
|
126
|
-
html_options['rel'] =
|
126
|
+
html_options['rel'] = Ultimate.Helpers.Tag.concat_class(html_options['rel'], 'nofollow')
|
127
127
|
html_options['data-method'] = method
|
128
128
|
|
129
129
|
_convert_boolean_attributes: (html_options, bool_attrs) ->
|
@@ -18,22 +18,25 @@
|
|
18
18
|
# 1 _.string.startsWith
|
19
19
|
|
20
20
|
class Ultimate.Plugin
|
21
|
+
cid: null
|
21
22
|
el: null
|
22
23
|
$el: null
|
23
|
-
nodes:
|
24
|
-
events:
|
24
|
+
nodes: null
|
25
|
+
events: null
|
25
26
|
|
26
|
-
options:
|
27
|
+
options: null
|
27
28
|
|
28
29
|
# @defaultLocales: { en: {} }
|
29
30
|
locale: 'en'
|
30
|
-
translations:
|
31
|
+
translations: null
|
31
32
|
|
32
33
|
constructor: (options) ->
|
34
|
+
# TODO
|
33
35
|
throw new Error('Property `el` must be specified at first argument of Ultimate.Plugin.constructor') unless options?.el
|
34
36
|
@cid = _.uniqueId('ultimatePlugin_')
|
35
37
|
@_configure options
|
36
|
-
@$el = $(@el)
|
38
|
+
@$el = $(@el).first()
|
39
|
+
@el = @$el[0]
|
37
40
|
@findNodes()
|
38
41
|
@initialize? arguments...
|
39
42
|
@delegateEvents()
|
@@ -99,7 +102,8 @@ class Ultimate.Plugin
|
|
99
102
|
events = normalizedEvents
|
100
103
|
events
|
101
104
|
|
102
|
-
_configure: (options) ->
|
105
|
+
_configure: (options = {}) ->
|
106
|
+
@options ||= {}
|
103
107
|
_.extend @options, options
|
104
108
|
#cout '@options', @options
|
105
109
|
@_reflectOptions()
|
@@ -112,6 +116,7 @@ class Ultimate.Plugin
|
|
112
116
|
|
113
117
|
# use I18n, and modify locale and translations
|
114
118
|
_initTranslations: ->
|
119
|
+
@translations ||= {}
|
115
120
|
if @constructor.defaultLocales?
|
116
121
|
if not @options["locale"] and I18n?.locale of @constructor.defaultLocales
|
117
122
|
@locale = I18n.locale
|
@@ -109,3 +109,12 @@
|
|
109
109
|
@each $item in $list { @if $item == $var { @return true; } }
|
110
110
|
@return false;
|
111
111
|
}
|
112
|
+
|
113
|
+
@function find-typed-item($list, $type, $default: false) {
|
114
|
+
@each $item in $list { @if type-of($item) == $type { @return $item; } }
|
115
|
+
@return $default;
|
116
|
+
}
|
117
|
+
|
118
|
+
@function find-color($list, $default: false) {
|
119
|
+
@return find-typed-item($list, color, $default);
|
120
|
+
}
|
@@ -19,9 +19,9 @@ $support-ie: true !default;
|
|
19
19
|
text-shadow: $params;
|
20
20
|
@if $support-ie {
|
21
21
|
$params-offset: 0;
|
22
|
-
@if type-of($color) !=
|
22
|
+
@if type-of($color) != color {
|
23
23
|
$color: nth($params, 1);
|
24
|
-
@if type-of($color) ==
|
24
|
+
@if type-of($color) == color {
|
25
25
|
$params-offset: 1;
|
26
26
|
} @else {
|
27
27
|
$color: #000;
|
@@ -79,6 +79,7 @@ test "label_tag", ->
|
|
79
79
|
equal label_tag("title", "My Title"), '<label for="title">My Title</label>'
|
80
80
|
equal label_tag("title", "My Title", class: "small-label"), '<label class="small-label" for="title">My Title</label>'
|
81
81
|
equal label_tag( -> "Blocked" ), '<label>Blocked</label>'
|
82
|
+
equal label_tag( -> content_tag('span', "Blocked SPAN", class: 'inner') ), '<label><span class="inner">Blocked SPAN</span></label>'
|
82
83
|
equal label_tag("clock", -> "Grandfather"), '<label for="clock">Grandfather</label>'
|
83
84
|
equal label_tag("clock", id: "label_clock", -> "Grandfather"), '<label for="clock" id="label_clock">Grandfather</label>'
|
84
85
|
|
@@ -49,6 +49,7 @@ test "concat_class", ->
|
|
49
49
|
test "selectorToHtml", ->
|
50
50
|
equal selectorToHtml(''), ''
|
51
51
|
equal selectorToHtml('.lol'), '<div class="lol"></div>'
|
52
|
+
equal selectorToHtml('.mega-lol'), '<div class="mega-lol"></div>'
|
52
53
|
equal selectorToHtml('tr.lol'), '<tr class="lol"></tr>'
|
53
54
|
equal selectorToHtml('tr.lol#rofl'), '<tr class="lol" id="rofl"></tr>'
|
54
55
|
equal selectorToHtml('#rofl.lol'), '<div class="lol" id="rofl"></div>'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ultimate-base
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.5.0
|
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: 2012-
|
12
|
+
date: 2012-12-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|