material_raingular 0.0.2.6.5 → 0.0.2.6.6
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.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9363bb292aa1992eaac5f4db8c618dc0bcf0e116
|
4
|
+
data.tar.gz: a242910252986cceed0538da545ac836eb139612
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a04b9a06342d7b0e09c129811d672ed4527987ea42aa69c336eae548403df770d6164894e12bea26f51877937df2ae4477c0e6aa3b6f6667f7b85f5e5a628487
|
7
|
+
data.tar.gz: 7afe7429e2bb6cd1cbea1e6bdb043f56be3c23ed26e896694be14712cc2d0dce57c3981c387e84c6772ab977ca77d90ab5457cfdd881f56c9023bd99de7440fa
|
@@ -0,0 +1,67 @@
|
|
1
|
+
angular.module('AComplete', [ 'FactoryName'])
|
2
|
+
|
3
|
+
.directive 'acList', ($parse,$filter)->
|
4
|
+
restrict: 'A'
|
5
|
+
require: 'ngModel'
|
6
|
+
link: (scope, element, attributes, ngModelCtrl) ->
|
7
|
+
scope.autoCompleteList = ->
|
8
|
+
[item,list] = attributes.acList.split(' in ')
|
9
|
+
actions = item.split('.')
|
10
|
+
actions.shift()
|
11
|
+
constructed = '.' + actions.join('.') if actions.length > 0
|
12
|
+
constructed = '' unless actions.length > 0
|
13
|
+
records = $filter('filter')($parse(list)(scope), (ngModelCtrl.$viewValue || '')) || []
|
14
|
+
result = for record in records
|
15
|
+
eval("record" + constructed)
|
16
|
+
result || []
|
17
|
+
controller: ($scope) ->
|
18
|
+
@list = ->
|
19
|
+
$scope.autoCompleteList()
|
20
|
+
return
|
21
|
+
.directive 'aComplete', ->
|
22
|
+
restrict: 'E'
|
23
|
+
replace: true
|
24
|
+
require: ['ngModel','acList']
|
25
|
+
template: (element, attributes) ->
|
26
|
+
element.addClass('autocomplete')
|
27
|
+
input = element[0].outerHTML.replace(/a-complete/g,'input')
|
28
|
+
input = angular.element(input).attr('md-update','')
|
29
|
+
"<md-input-container>" + input[0].outerHTML + "<div class='autocomplete menu md-whiteframe-z1'><a class='item' ng-click='select(item)' ng-repeat='item in list()'>{{item}}</a></div></md-input-container>"
|
30
|
+
|
31
|
+
link: (scope,element,attributes,controllers) ->
|
32
|
+
element.css('position','relative').css('display', 'block')
|
33
|
+
scope.select = (item) ->
|
34
|
+
controllers[0].$setViewValue(item)
|
35
|
+
controllers[0].$render()
|
36
|
+
scope.list = controllers[1].list
|
37
|
+
menuNode = angular.element(element[0].getElementsByClassName('autocomplete menu'))
|
38
|
+
inputNode = element.find('input')
|
39
|
+
inputNode.css('padding-top','14px')
|
40
|
+
inputNode.bind 'blur', ->
|
41
|
+
active = angular.element(menuNode[0].getElementsByClassName('active')[0])
|
42
|
+
active.removeClass('active')
|
43
|
+
controllers[0].$setViewValue(inputNode.val())
|
44
|
+
controllers[0].$render()
|
45
|
+
inputNode.bind 'keydown', (input)->
|
46
|
+
keypress = (direction) ->
|
47
|
+
index = if direction == 'next' then 0 else menuNode.find('a').length - 1
|
48
|
+
selected = angular.element(menuNode[0].getElementsByClassName('active')[0])
|
49
|
+
if selected.hasClass('active')
|
50
|
+
selected.removeClass('active')
|
51
|
+
until complete
|
52
|
+
selected = angular.element(selected[0][direction + 'Sibling']) if selected[0]
|
53
|
+
complete = !!selected[0]
|
54
|
+
complete = selected[0].tagName == 'A' if complete
|
55
|
+
complete = true if !selected[0]
|
56
|
+
selected = angular.element(menuNode.find('a')[index]) unless selected[0]
|
57
|
+
ind = 0
|
58
|
+
for el,i in menuNode[0].getElementsByTagName('a')
|
59
|
+
ind = i if el == selected[0]
|
60
|
+
scroll = selected[0].scrollHeight * ind
|
61
|
+
selected[0].parentElement.scrollTop = scroll
|
62
|
+
selected.addClass('active')
|
63
|
+
inputNode.val(selected.text())
|
64
|
+
if input.keyCode == 40
|
65
|
+
keypress('next')
|
66
|
+
if input.keyCode == 38
|
67
|
+
keypress('previous')
|
@@ -37,8 +37,8 @@ class ElementUpdate
|
|
37
37
|
delay = if eu.element.hasClass('autocomplete') then 300 else 0
|
38
38
|
eu.timeout ->
|
39
39
|
eu.scope.$apply ->
|
40
|
-
newValue =
|
41
|
-
|
40
|
+
newValue = eu.element.val()
|
41
|
+
eu.updater.update(newValue) if (newValue != oldValue)
|
42
42
|
, delay
|
43
43
|
|
44
44
|
bindElement: ->
|
@@ -16,7 +16,7 @@
|
|
16
16
|
# //= require identifier_interceptor
|
17
17
|
# //= require rails_updater
|
18
18
|
|
19
|
-
angular.module('materialRaingular', ['AutoComplete', 'NgDownload', 'NgChangeOnBlur', 'NgDrag', 'NgAuthorize'
|
19
|
+
angular.module('materialRaingular', ['AutoComplete', 'NgDownload', 'NgChangeOnBlur', 'NgDrag', 'NgAuthorize', 'AComplete'
|
20
20
|
'NgRepeatList', 'NgUpdate', 'NgPopup', 'NgBoolean', 'Table', 'NgWatchShow', 'NgTrackBy'
|
21
21
|
'NgUpload', 'NgDestroy', 'NgCreate', 'Video','NgAuthorize', 'TextArea', 'MdUpdate'
|
22
22
|
'NgSlide', 'NgMatches','NgFade','NgSwipe', 'NgLoad', 'NgWatchContent', 'RailsUpdater'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: material_raingular
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.2.6.
|
4
|
+
version: 0.0.2.6.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Moody
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-10-
|
11
|
+
date: 2015-10-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -70,6 +70,7 @@ files:
|
|
70
70
|
- lib/assets/javascripts/ajax_errors.js.coffee
|
71
71
|
- lib/assets/javascripts/dateconverter.coffee
|
72
72
|
- lib/assets/javascripts/dateparser.coffee
|
73
|
+
- lib/assets/javascripts/directives/acomplete.js.coffee
|
73
74
|
- lib/assets/javascripts/directives/mdupdate.coffee
|
74
75
|
- lib/assets/javascripts/directives/ngauthorize.js.coffee
|
75
76
|
- lib/assets/javascripts/directives/ngautocomplete.js.coffee
|
@@ -140,7 +141,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
140
141
|
version: '0'
|
141
142
|
requirements: []
|
142
143
|
rubyforge_project:
|
143
|
-
rubygems_version: 2.
|
144
|
+
rubygems_version: 2.4.3
|
144
145
|
signing_key:
|
145
146
|
specification_version: 4
|
146
147
|
summary: Angular v1.4 for rails. Angular Material v0.9.8.
|