material_raingular 0.0.2.3.alpha → 0.0.2.4.1.alpha
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 67f94836a6a2f4e0e20656141b315284323ee284
|
4
|
+
data.tar.gz: da2c296a0bd60a11df64967ee19b663f03a1aeaa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 22129d7051ed549973b8a2cafe815feb370aedcd3e1d4f1cbd22be8b94cead984c3ff715b0d96038b21b0c9b7e019fe412561dde1760cf9bd50b744b1b48656b
|
7
|
+
data.tar.gz: 989428c351f44abf460b3f5163340e3b74d46072eebb06b36a3d8e996ce0785bf49663f60ce72f94b269b00f3331aa1d36ee484b62881ff113b3b95829a9c14a
|
@@ -14,3 +14,24 @@ Array.prototype.drop = (entry)->
|
|
14
14
|
String.prototype.titleize = ->
|
15
15
|
return this.replace(/\_/g,' ').replace(/\b[a-z]/g, (letter)->
|
16
16
|
return letter[0].toUpperCase())
|
17
|
+
Array.prototype.pluck = (property) ->
|
18
|
+
return [] if !(this && property)
|
19
|
+
property = String(property)
|
20
|
+
return this.map (object) ->
|
21
|
+
object = Object(object)
|
22
|
+
return object[property] if (object.hasOwnProperty(property))
|
23
|
+
return ''
|
24
|
+
Array.prototype.unique = (filterOn) ->
|
25
|
+
equiv = (first,second) ->
|
26
|
+
return true if first == second
|
27
|
+
return !first && !second
|
28
|
+
newItems = []
|
29
|
+
for item in this
|
30
|
+
item = item[filterOn] if filterOn
|
31
|
+
for newItem in newItems
|
32
|
+
isDuplicate = false
|
33
|
+
if equiv(item,newItem)
|
34
|
+
isDuplicate = true
|
35
|
+
break
|
36
|
+
newItems.push(item) if (!isDuplicate)
|
37
|
+
return newItems
|
@@ -0,0 +1,39 @@
|
|
1
|
+
angular.module('materialFilters', [])
|
2
|
+
.filter 'trimLength', ->
|
3
|
+
return (input, num, scope) ->
|
4
|
+
return input unless typeof input == 'string'
|
5
|
+
return input.substring(0,num || 20) + '...'
|
6
|
+
.filter 'titleize', ->
|
7
|
+
return (input) ->
|
8
|
+
return unless input
|
9
|
+
return input.replace(/\_/g,' ').replace(/\b[a-z]/g, (letter)->
|
10
|
+
return letter[0].toUpperCase())
|
11
|
+
.filter 'pluck', ->
|
12
|
+
pluck = (objects, property) ->
|
13
|
+
return [] if !(objects && property && angular.isArray(objects))
|
14
|
+
property = String(property)
|
15
|
+
return objects.map( (object) ->
|
16
|
+
object = Object(object)
|
17
|
+
return object[property] if (object.hasOwnProperty(property))
|
18
|
+
return '')
|
19
|
+
return (objects, property) ->
|
20
|
+
return pluck(objects, property)
|
21
|
+
.filter 'unique', ->
|
22
|
+
return (items, filterOn) ->
|
23
|
+
return items if filterOn == false
|
24
|
+
if (filterOn || angular.isUndefined(filterOn)) && angular.isArray(items)
|
25
|
+
newItems = []
|
26
|
+
extractValueToCompare = (item) ->
|
27
|
+
if angular.isObject(item) && angular.isString(filterOn) then item[filterOn] else item
|
28
|
+
for item in items
|
29
|
+
for newItem in newItems
|
30
|
+
isDuplicate = false
|
31
|
+
if (angular.equals(extractValueToCompare(newItem), extractValueToCompare(item)))
|
32
|
+
isDuplicate = true
|
33
|
+
break
|
34
|
+
newItems.push(item) if (!isDuplicate)
|
35
|
+
items = newItems
|
36
|
+
return items;
|
37
|
+
.filter 'join', ->
|
38
|
+
return (list, token) ->
|
39
|
+
return (list||[]).join(token)
|
@@ -6,6 +6,7 @@
|
|
6
6
|
# //= require angular-animate
|
7
7
|
# //= require angular-aria
|
8
8
|
# //= require angular-material.min
|
9
|
+
# //= require material_filters
|
9
10
|
# //= require material_raingular/factories
|
10
11
|
# //= require factory_name
|
11
12
|
# //= require_tree ./directives
|
@@ -18,4 +19,4 @@ angular.module('materialRaingular', ['AutoComplete', 'NgDownload', 'NgChangeOnBl
|
|
18
19
|
'NgRepeatList', 'NgUpdate', 'NgPopup', 'NgBoolean', 'Table', 'NgWatchShow'
|
19
20
|
'NgUpload', 'NgDestroy', 'NgCreate', 'Video','NgAuthorize', 'TextArea'
|
20
21
|
'NgSlide', 'NgMatches','NgFade','NgSwipe', 'NgLoad', 'NgWatchContent'
|
21
|
-
'ngRoute', 'ngMaterial', 'ngMessages', 'ngResource'])
|
22
|
+
'ngRoute', 'ngMaterial', 'ngMessages', 'ngResource', 'materialFilters'])
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: material_raingular
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.2.
|
4
|
+
version: 0.0.2.4.1.alpha
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Moody
|
@@ -95,6 +95,7 @@ files:
|
|
95
95
|
- lib/assets/javascripts/extensions.coffee
|
96
96
|
- lib/assets/javascripts/factory_name.js.coffee
|
97
97
|
- lib/assets/javascripts/identifier_interceptor.js.coffee
|
98
|
+
- lib/assets/javascripts/material_filters.coffee
|
98
99
|
- lib/assets/javascripts/material_raingular.js.coffee
|
99
100
|
- lib/material_raingular.rb
|
100
101
|
- lib/material_raingular/version.rb
|