material_raingular 0.1.8.1 → 0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/assets/javascripts/directives/filteredselect.js.coffee +17 -7
- data/lib/assets/javascripts/directives/mdupdate.coffee +0 -7
- data/lib/material_raingular/version.rb +1 -1
- data/vendor/assets/angular/angular-material.min.css +2 -2
- data/vendor/assets/angular/angular-material.min.js +12 -10
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0da8e34bdf3bd3f3e7fbb4802eeae30cbb3e0e37
|
4
|
+
data.tar.gz: c8f5bb5cb11b0116bbdab77427e76ba48a71173c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f750651f1a186f99dc253ec2500ba62d7d435cb1dc77c224cc52cf3d46bb27ac8c21362371d65cb4d33b4fc68b643c4314a229408d6b655214b536498cb9743c
|
7
|
+
data.tar.gz: 86f95b39d99dea9008e7b800f5bbbae5dd50ddb0a9c5661cdf83a898999533a23a61f6444d9668e5f4b9040908c31186b682856fd0e3ff70fb8369355881a307
|
@@ -74,9 +74,9 @@ class MobileTemplate
|
|
74
74
|
@tempHolder.removeClass('active')
|
75
75
|
|
76
76
|
class StandardTemplate
|
77
|
-
constructor: (@element
|
77
|
+
constructor: (@element,@attrs,functions,@disabled,@viewOptions,@mdInputContainer) ->
|
78
78
|
@span = angular.element "<span></span>"
|
79
|
-
@search = angular.element "<input class='autocomplete' type='search'
|
79
|
+
@search = angular.element "<input class='autocomplete' type='search'>"
|
80
80
|
@tempHolder = angular.element "<div class='autocomplete menu md-whiteframe-z1'>"
|
81
81
|
@template = @tempHolder
|
82
82
|
@typeAhead = angular.element "<span style='position:absolute;'></span>"
|
@@ -104,12 +104,16 @@ class StandardTemplate
|
|
104
104
|
@search.bind 'input', (event)=>
|
105
105
|
@inputFunction(@search,@typeAhead,event)
|
106
106
|
@search.bind 'focus', (event)=>
|
107
|
+
@mdInputContainer?.setFocused(true)
|
107
108
|
@stylize()
|
108
109
|
@focusFunction(@template,event)
|
109
110
|
@search.bind 'blur', (event)=>
|
111
|
+
@mdInputContainer?.setHasValue(@search.val())
|
112
|
+
@mdInputContainer?.setFocused(false)
|
110
113
|
@blurFunction(@search,@typeAhead,@template,event)
|
111
114
|
@search.bind 'keydown', (event)=>
|
112
115
|
@keydownFunction(@search,@typeAhead,@template,event)
|
116
|
+
|
113
117
|
attachElements: ->
|
114
118
|
@span.append @typeAhead
|
115
119
|
@span.append @search
|
@@ -215,8 +219,10 @@ class EventFunctions
|
|
215
219
|
|
216
220
|
angular.module('FilteredSelect', [])
|
217
221
|
.directive 'ngFilteredSelect', ($parse,$filter,$timeout)->
|
218
|
-
require: 'ngModel'
|
219
|
-
link: (scope,element,attrs,
|
222
|
+
require: ['ngModel', '?^mdInputContainer']
|
223
|
+
link: (scope,element,attrs,controllers) ->
|
224
|
+
ngModel = controllers[0]
|
225
|
+
mdInputContainer = controllers[1]
|
220
226
|
viewOptions = JSON.parse(attrs.filterOptions || '{}')
|
221
227
|
equiv = (left,right) ->
|
222
228
|
return true if left == right
|
@@ -273,9 +279,10 @@ angular.module('FilteredSelect', [])
|
|
273
279
|
val = if viewScope then (functions.altValue(viewScope) || functions.viewValueFn(viewScope)).replace(/^\s+/g,'') else ''
|
274
280
|
elements.search.val(val)
|
275
281
|
elements.typeAhead.html(elements.search.val())
|
282
|
+
mdInputContainer?.setHasValue(val)
|
276
283
|
else
|
277
284
|
unless model = scope.$eval(attrs.ngModel)
|
278
|
-
view =
|
285
|
+
view = ''
|
279
286
|
element.css('color','rgba(0,0,0,0.4)')
|
280
287
|
else
|
281
288
|
element.css('color','')
|
@@ -286,10 +293,11 @@ angular.module('FilteredSelect', [])
|
|
286
293
|
obj[functions.modelValue] = model
|
287
294
|
list = $filter('filter')(functions.collection(scope), obj,true)
|
288
295
|
viewScope = list[0] if list
|
289
|
-
view = if viewScope then functions.viewValueFn(viewScope) else
|
296
|
+
view = if viewScope then functions.viewValueFn(viewScope) else ''
|
290
297
|
element.html('')
|
291
298
|
element.html(view)
|
292
299
|
|
300
|
+
|
293
301
|
updateValue = (model) ->
|
294
302
|
return if @clickedVal && @clickedVal != model
|
295
303
|
$timeout =>
|
@@ -325,7 +333,9 @@ angular.module('FilteredSelect', [])
|
|
325
333
|
if isMobile = typeof attrs.ngMobile != 'undefined'
|
326
334
|
elements = new MobileTemplate(element,eFunctions.mobile())
|
327
335
|
else
|
328
|
-
elements = new StandardTemplate(element,attrs,eFunctions.standard(),disabled(),viewOptions)
|
336
|
+
elements = new StandardTemplate(element,attrs,eFunctions.standard(),disabled(),viewOptions,mdInputContainer)
|
337
|
+
mdInputContainer?.setHasPlaceholder(attrs.mdPlaceholder)
|
338
|
+
mdInputContainer?.input = elements.search
|
329
339
|
scope.$watchCollection functions.collection, (newVal,oldVal) ->
|
330
340
|
return if newVal == oldVal
|
331
341
|
setInitialValue()
|
@@ -9,11 +9,9 @@ class ElementUpdate
|
|
9
9
|
@isInput = @tagName == 'INPUT'
|
10
10
|
@scope = scope
|
11
11
|
@element = element
|
12
|
-
@placeholder = attributes.placeholder
|
13
12
|
@timeout = timeout
|
14
13
|
@bindInput() if @isInput
|
15
14
|
@bindElement() unless @isInput
|
16
|
-
@setPlaceholder() if typeof @placeholder == 'undefined'
|
17
15
|
watcher: ->
|
18
16
|
eu = @
|
19
17
|
@scope.$watch @modelVal, (updated,old) ->
|
@@ -52,11 +50,6 @@ class ElementUpdate
|
|
52
50
|
,750
|
53
51
|
else
|
54
52
|
@watcher()
|
55
|
-
setPlaceholder: ->
|
56
|
-
placeholder = ''
|
57
|
-
for word in @modelName.split('.').pop().split('_')
|
58
|
-
placeholder += word[0].toUpperCase() + word[1..-1].toLowerCase() + ' '
|
59
|
-
@element.attr('placeholder',placeholder)
|
60
53
|
|
61
54
|
angular.module 'MdUpdate', ['Factories', 'FactoryName','RailsUpdater']
|
62
55
|
.directive 'mdUpdate', ($timeout, factoryName, $injector, RailsUpdater,$parse) ->
|