material_raingular 0.0.1.alpha

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +14 -0
  3. data/Gemfile +4 -0
  4. data/Gemfile.lock +17 -0
  5. data/LICENSE.txt +22 -0
  6. data/README.md +32 -0
  7. data/Rakefile +2 -0
  8. data/lib/assets/javascripts/ajax_errors.js.coffee +13 -0
  9. data/lib/assets/javascripts/dateconverter.coffee +23 -0
  10. data/lib/assets/javascripts/directives/ngauthorize.js.coffee +8 -0
  11. data/lib/assets/javascripts/directives/ngautocomplete.js.coffee +135 -0
  12. data/lib/assets/javascripts/directives/ngboolean.js.coffee +34 -0
  13. data/lib/assets/javascripts/directives/ngchangeonblur.js.coffee +19 -0
  14. data/lib/assets/javascripts/directives/ngcreate.js.coffee +27 -0
  15. data/lib/assets/javascripts/directives/ngdestroy.js.coffee +24 -0
  16. data/lib/assets/javascripts/directives/ngdownload.js.coffee +8 -0
  17. data/lib/assets/javascripts/directives/ngdrag.js.coffee +122 -0
  18. data/lib/assets/javascripts/directives/ngfade.js.coffee +21 -0
  19. data/lib/assets/javascripts/directives/ngload.js.coffee +16 -0
  20. data/lib/assets/javascripts/directives/ngmatches.js.coffee +14 -0
  21. data/lib/assets/javascripts/directives/ngpopup.js.coffee +37 -0
  22. data/lib/assets/javascripts/directives/ngrepeatlist.js.coffee +52 -0
  23. data/lib/assets/javascripts/directives/ngslide.js.coffee +82 -0
  24. data/lib/assets/javascripts/directives/ngswipe.js.coffee +60 -0
  25. data/lib/assets/javascripts/directives/ngupdate.js.coffee +62 -0
  26. data/lib/assets/javascripts/directives/ngupload.js.coffee +127 -0
  27. data/lib/assets/javascripts/directives/ngwatchcontent.js.coffee +13 -0
  28. data/lib/assets/javascripts/directives/ngwatchshow.js.coffee +15 -0
  29. data/lib/assets/javascripts/directives/table.js.coffee +43 -0
  30. data/lib/assets/javascripts/directives/textarea.coffee +11 -0
  31. data/lib/assets/javascripts/directives/video.js.coffee +10 -0
  32. data/lib/assets/javascripts/factory_name.js.coffee +9 -0
  33. data/lib/assets/javascripts/material_raingular.js.coffee +17 -0
  34. data/lib/material_raingular/version.rb +3 -0
  35. data/lib/material_raingular.rb +8 -0
  36. data/lib/tasks/material_raingular.rake +42 -0
  37. data/material_raingular.gemspec +25 -0
  38. data/vendor/assets/angular/.jshintrc +181 -0
  39. data/vendor/assets/angular/angular-animate.js +3708 -0
  40. data/vendor/assets/angular/angular-aria.js +378 -0
  41. data/vendor/assets/angular/angular-cookies.js +320 -0
  42. data/vendor/assets/angular/angular-loader.js +429 -0
  43. data/vendor/assets/angular/angular-material.min.css +6 -0
  44. data/vendor/assets/angular/angular-material.min.js +14 -0
  45. data/vendor/assets/angular/angular-message-format.js +980 -0
  46. data/vendor/assets/angular/angular-messages.js +678 -0
  47. data/vendor/assets/angular/angular-resource.js +668 -0
  48. data/vendor/assets/angular/angular-route.js +991 -0
  49. data/vendor/assets/angular/angular-sanitize.js +683 -0
  50. data/vendor/assets/angular/angular-touch.js +627 -0
  51. data/vendor/assets/angular/angular.js +28133 -0
  52. metadata +139 -0
@@ -0,0 +1,52 @@
1
+ angular.module 'NgRepeatList', ['Factories']
2
+ .directive 'ngRepeatList', ->
3
+ restrict: 'A',
4
+ replace: true
5
+ link: (scope, element, attributes) ->
6
+ filters = attributes.ngRepeatList.split('|')
7
+ parsed = filters.splice(0,1)[0].split(' in ')
8
+ factory = parsed.pop().replace(/\s+/g, '')
9
+ element.parent().addClass('loading')
10
+ list = element.injector().get(factory)
11
+ context = {}
12
+ if attributes.ngContext
13
+ name = attributes.ngContext
14
+ if name.match(/\_id$/)
15
+ watch = name
16
+ else
17
+ watch = name + '.id'
18
+ name += "_id"
19
+ scope.$watch watch, (newVal) ->
20
+ if newVal
21
+ context[name] = eval("scope." + watch)
22
+ list.index context, (data) ->
23
+ scope[factory] = data
24
+ element.parent().removeClass('loading')
25
+ else
26
+ list.index context, (data) ->
27
+ scope[factory] = data
28
+ element.parent().removeClass('loading')
29
+ template: (element, attributes) ->
30
+ element[0].setAttribute('ng-repeat', attributes.ngRepeatList)
31
+ element[0].removeAttribute('ng-repeat-list')
32
+ html = element[0].outerHTML
33
+ return html
34
+ .directive 'ngRepeatStartList', ->
35
+ restrict: 'A',
36
+ replace: true
37
+ link: (scope, element, attributes) ->
38
+ filters = attributes.ngRepeatStartList.split('|')
39
+ parsed = filters.splice(0,1)[0].split(' in ')
40
+ factory = parsed.pop().replace(/\s+/g, '')
41
+ element.parent().addClass('loading')
42
+ list = element.injector().get(factory)
43
+ context = {}
44
+ context[attributes.ngContext + '_id'] = scope[attributes.ngContext].id if attributes.ngContext
45
+ list.index context, (data) ->
46
+ scope[factory] = data
47
+ element.parent().removeClass('loading')
48
+ template: (element, attributes) ->
49
+ element[0].setAttribute('ng-repeat-start', attributes.ngRepeatStartList)
50
+ element[0].removeAttribute('ng-repeat-start-list')
51
+ html = element[0].outerHTML
52
+ return html
@@ -0,0 +1,82 @@
1
+ angular.module('NgSlide', [])
2
+ .factory 'PreviousHeight', ->
3
+ object = []
4
+ object.set = (height) ->
5
+ this.push(height)
6
+ object.get = ->
7
+ return this.pop()
8
+ return object
9
+ .directive 'ngSlide', (PreviousHeight)->
10
+ link: (scope, element) ->
11
+ window.onresize = ->
12
+ for slider in angular.element('[ng-slide]')
13
+ for att in slider.attributes['ng-slide'].value.split('{')[1].split(',')
14
+ margin = att.split(':')[1].trim() if att.indexOf('margin') > -1
15
+ margin = margin.replace(/{|}|'|"| /g, "") #' <-syntax highlighting thing
16
+ element = angular.element(slider)
17
+ element.css(margin,calcStart(slider)) unless element.css(margin) == '0px'
18
+ contents = ->
19
+ return element.html()
20
+ calcStart = (element) ->
21
+ amount = Math.max(element.offsetWidth,element.offsetHeight) + 'px'
22
+ return amount if params[0] == 'left'
23
+ return '-' + amount if params[0] == 'right'
24
+ return '-' + amount
25
+ hash = element[0].attributes['ng-slide'].value.split('{')
26
+ params = hash[0].split(',')
27
+ params[2] = hash[1]
28
+ margin = 'margin'
29
+ start = '0'
30
+ end = '-100%'
31
+ delay = '0.3'
32
+ if params[0] == 'up'
33
+ margin += '-top'
34
+ start = '100%'
35
+ end = '0'
36
+ else if params[0] == 'left'
37
+ margin += '-right'
38
+ else if params[0] == 'right'
39
+ margin += '-left'
40
+ else
41
+ margin += '-top'
42
+ strings = params[2].replace(/{|}|'|"| /g, "").split(',') #' <-syntax highlighting thing
43
+ params[2] = {}
44
+ for obj in strings
45
+ keyValue = obj.split(':')
46
+ params[2][keyValue[0]] = keyValue[1]
47
+ if params[2]
48
+ delay = params[2].duration if params[2].duration
49
+ start = params[2].start if params[2].start
50
+ end = params[2].end if params[2].end
51
+ margin = params[2].margin if params[2].margin
52
+ delay += 's ' + margin
53
+ element.css('transition', delay)
54
+ if params[2].auto
55
+ scope.$watch contents, (newVal, oldVal) ->
56
+ if newVal != oldVal
57
+ start = calcStart(element[0])
58
+ end = 0 + 'px'
59
+ if scope[params[1]]
60
+ element.css(margin, end)
61
+ else
62
+ element.css(margin, start)
63
+ setHeight = (element) ->
64
+ rect = element[0].getBoundingClientRect()
65
+ content = angular.element('.content')[0].getBoundingClientRect()
66
+ height = rect.height + rect.top - content.top unless params[0] == 'down'
67
+ height = rect.height + rect.bottom if params[0] == 'down'
68
+ angular.element('.content').css('height',height)
69
+ scope.$watch params[1], (newValue, oldValue)->
70
+ if params[2].auto
71
+ start = calcStart(element[0])
72
+ end = 0 + 'px'
73
+ if newValue
74
+ PreviousHeight.set(angular.element('.content')[0].getBoundingClientRect().height)
75
+ element.css(margin, end)
76
+ setHeight(element)
77
+ watcher = scope.$watch contents, (newVal) ->
78
+ setHeight(element)
79
+ else
80
+ watcher() if watcher
81
+ element.css(margin, start)
82
+ angular.element('.content').css('height', PreviousHeight.get())
@@ -0,0 +1,60 @@
1
+ angular.module('NgSwipe', [])
2
+ .factory 'SwipeStart', ->
3
+ object = {}
4
+
5
+ object.set = (x,y) ->
6
+ this.x = x
7
+ this.y = y
8
+
9
+ object.get = ->
10
+ return this
11
+
12
+ return object
13
+ .directive 'ngSwipeUp', ->
14
+ controller: ($scope, $element, SwipeStart) ->
15
+ callFunction = $element[0].attributes['ng-swipe-up'].value
16
+ if callFunction.indexOf('=') > -1
17
+ split = callFunction.split('=')
18
+ callFunction = []
19
+ for arg in split
20
+ unless arg.indexOf('true') > -1 || arg.indexOf('false') > -1
21
+ callFunction.push('!$scope.' + arg.replace(/!/g,'').trim()) if arg.indexOf('!') > -1
22
+ callFunction.push('$scope.' + arg) if arg.indexOf('!') < 0
23
+ else
24
+ callFunction.push('!' + arg.replace(/!/g,'').trim()) if arg.indexOf('!') > -1
25
+ callFunction.push(arg) if arg.indexOf('!') < 0
26
+ callFunction = callFunction.join(' = ')
27
+ else
28
+ callFunction = '$scope.' + callFunction.trim()
29
+ $element.bind 'touchstart', (event) ->
30
+ touchStart = event.originalEvent.targetTouches[0]
31
+ SwipeStart.set(touchStart.screenX, touchStart.screenY)
32
+ $element.bind 'touchend', (event) ->
33
+ touchEnd = event.originalEvent.changedTouches[0]
34
+ if (Math.abs(SwipeStart.get().x - touchEnd.screenX) < Math.abs(SwipeStart.get().y - touchEnd.screenY)) && (SwipeStart.get().y - touchEnd.screenY > 0)
35
+ $scope.$apply ->
36
+ eval callFunction
37
+ .directive 'ngSwipeDown', ->
38
+ controller: ($scope, $element, SwipeStart) ->
39
+ callFunction = $element[0].attributes['ng-swipe-down'].value
40
+ if callFunction.indexOf('=') > -1
41
+ split = callFunction.split('=')
42
+ callFunction = []
43
+ for arg in split
44
+ unless arg.indexOf('true') > -1 || arg.indexOf('false') > -1
45
+ callFunction.push('!$scope.' + arg.replace(/!/g,'').trim()) if arg.indexOf('!') > -1
46
+ callFunction.push('$scope.' + arg) if arg.indexOf('!') < 0
47
+ else
48
+ callFunction.push('!' + arg.replace(/!/g,'').trim()) if arg.indexOf('!') > -1
49
+ callFunction.push(arg) if arg.indexOf('!') < 0
50
+ callFunction = callFunction.join(' = ')
51
+ else
52
+ callFunction = '$scope.' + callFunction.trim()
53
+ $element.bind 'touchstart', (event) ->
54
+ touchStart = event.originalEvent.targetTouches[0]
55
+ SwipeStart.set(touchStart.screenX, touchStart.screenY)
56
+ $element.bind 'touchend', (event) ->
57
+ touchEnd = event.originalEvent.changedTouches[0]
58
+ if (Math.abs(SwipeStart.get().x - touchEnd.screenX) < Math.abs(SwipeStart.get().y - touchEnd.screenY)) && (SwipeStart.get().y - touchEnd.screenY < 0)
59
+ $scope.$apply ->
60
+ eval callFunction
@@ -0,0 +1,62 @@
1
+ angular.module 'NgUpdate', ['Factories', 'FactoryName']
2
+
3
+ .directive 'ngUpdate', ($timeout, $compile) ->
4
+ restrict: 'A'
5
+
6
+ link: (scope, element, attributes, ngModelCtrl) ->
7
+ model = attributes.ngUpdate.split('"').join('\'')
8
+ html = element[0].outerHTML
9
+ html = angular.element(html)
10
+ html[0].setAttribute("ng-model", model.split(',')[0])
11
+ callModel = model
12
+ if element[0].attributes['placeholder']
13
+ placeholder = element[0].attributes['placeholder'].value
14
+ else
15
+ placeholder = ''
16
+ for word in callModel.split('.').pop().split('_')
17
+ placeholder += word[0].toUpperCase() + word[1..-1].toLowerCase() + ' '
18
+ callModel += ',' + attributes.ngTrackBy if attributes.ngTrackBy
19
+ callFunction = 'update("' + callModel + '")'
20
+ callFunction += ';' + attributes.ngCallback if attributes.ngCallback
21
+ if element[0].tagName == 'INPUT'
22
+ html[0].setAttribute("ng-change-on-blur", callFunction) if attributes.type != 'radio' && attributes.type != 'checkbox' && attributes.type != 'hidden'
23
+ html[0].setAttribute("ng-change", callFunction) unless attributes.type != 'radio' && attributes.type != 'checkbox' && attributes.type != 'hidden'
24
+ else if element[0].tagName == 'SELECT'
25
+ html[0].setAttribute("ng-change", callFunction)
26
+ else if element[0].tagName == 'TEXTAREA'
27
+ html[0].setAttribute("ng-change-debounce", callFunction)
28
+ else
29
+ callFunction = callModel + ' = !' + callModel + ' ; update("' + callModel + '")'
30
+ callFunction += ';' + attributes.ngCallback if attributes.ngCallback
31
+ html[0].setAttribute("ng-click", callFunction)
32
+ html[0].setAttribute('placeholder',placeholder)
33
+ html[0].removeAttribute('ng-update')
34
+ element.replaceWith html
35
+ $compile(html)(scope)
36
+
37
+ controller: ($scope, $injector,factoryName, $element) ->
38
+ $scope.update = (modelName)->
39
+ override = if $element[0].attributes['ng-override'] then $element[0].attributes['ng-override'].value.split('.') else []
40
+ input = modelName.split(',')
41
+ trackby = input.pop() if input.length > 1
42
+ trackby = trackby.split(';') if trackby
43
+ trackby = [] unless trackby
44
+ data = input.splice(0,1)[0].split('.')
45
+ functions = input.join(',').split(')')
46
+ factory = factoryName(override[0] || data[0])
47
+ if override[1]
48
+ object = {id: $scope.$eval(override[0]).id}
49
+ object[override[1]] = $scope.$eval(override[1])
50
+ else
51
+ object = {id: $scope[data[0]]['id']}
52
+ object[data[0]] = {id: $scope[data[0]]['id']}
53
+ object[data[0]][data[1]] = $scope[data[0]][data[1]]
54
+ list = $injector.get(factory)
55
+ list.update object, (returnData) ->
56
+ for tracked in trackby
57
+ $scope[data[0]][tracked] = returnData[tracked]
58
+ $scope[data[0]][data[1]] = returnData[data[1]] if $scope[data[0]][data[1]] == object[data[0]][data[1]]
59
+ callFunctions = []
60
+ for callFunction in functions
61
+ callFunctions.push(callFunction + ',' + JSON.stringify(returnData) + ')') if callFunction.length > 0
62
+ $scope.$eval( callFunctions.join('') ) if callFunctions.join('').length > 0
@@ -0,0 +1,127 @@
1
+ selectFile = (scope,event,attributes,file) ->
2
+ model = attributes.ngModel.split('.')
3
+ id = scope[attributes.ngModel.split('.')[0]].id
4
+ parent = null
5
+ if attributes.ngContext
6
+ parent = attributes.ngContext
7
+ scope.uploadFiles(model,id,file,parent)
8
+ event.preventDefault()
9
+
10
+ fileData = (scope,attributes) ->
11
+ data = {}
12
+ unparsedModel = attributes.ngModel.split('.')
13
+ if scope[unparsedModel[0]]
14
+ if scope[unparsedModel[0]][unparsedModel[1]]
15
+ unparsed = scope[unparsedModel[0]][unparsedModel[1]].location.split('/')
16
+ name = unparsed.pop()
17
+ id = unparsed.pop()
18
+ mounted_as = unparsed.pop()
19
+ model = unparsed.pop()
20
+ data.path = scope[unparsedModel[0]][unparsedModel[1]].url
21
+ data.name = name
22
+ data.thumb = scope[unparsedModel[0]].thumb.url if scope[unparsedModel[0]].thumb
23
+ return data
24
+
25
+ uploadFiles = (scope,element,model,id,file,parent,timeout) ->
26
+ scope.progress = 0
27
+ element.addClass('covered')
28
+ route = Routes[element[0].attributes['ng-model'].value.split('.')[0] + '_path'](id: id) + '.json'
29
+ formData = new FormData()
30
+ formData.append model[0] + '[id]', id
31
+ formData.append model[0] + '[' + model[1] + ']', file
32
+ formData.append model[0] + '[' + parent + '_id]', $scope[parent].id if parent
33
+ xhr = new XMLHttpRequest()
34
+ xhr.upload.addEventListener "progress", (event) ->
35
+ if event.lengthComputable
36
+ scope.$apply ->
37
+ scope.progress = Math.round(event.loaded * 100 / event.total)
38
+ , false
39
+ xhr.addEventListener "readystatechange", (event) ->
40
+ if this.readyState == 4 && !(this.status > 399)
41
+ data = JSON.parse(event.target.response)
42
+ scope.$apply ->
43
+ scope[model[0]][model[1]] = data[model[1]]
44
+ scope[model[0]].thumb = data.thumb
45
+ scope.progress = 100
46
+ element.removeClass('covered')
47
+
48
+ else if this.readyState == 4 && this.status > 399
49
+ failed()
50
+ , false
51
+ xhr.addEventListener "error", (event) ->
52
+ failed()
53
+ , false
54
+ failed = ->
55
+ element.addClass('failed')
56
+
57
+ timeout ->
58
+ element.removeClass('failed')
59
+ element.removeClass('covered')
60
+ , 2000
61
+
62
+ xhr.open("PUT", route)
63
+ xhr.setRequestHeader('X-CSRF-Token', $('meta[name=csrf-token]').attr('content'))
64
+ xhr.send(formData)
65
+
66
+ angular.module('NgUpload', [])
67
+
68
+ .directive 'ngDropFile', ->
69
+ restrict: 'A'
70
+ require: 'ngModel'
71
+ link: (scope, element, attributes) ->
72
+ element.bind 'dragover', (event) ->
73
+ event.preventDefault()
74
+ event.stopPropagation()
75
+ element.bind 'drop', (event) ->
76
+ event.preventDefault()
77
+ event.stopPropagation()
78
+ file = event.originalEvent.dataTransfer.files[0]
79
+ selectFile(scope,event,attributes,file)
80
+ scope.file = ->
81
+ fileData(scope,attributes)
82
+
83
+ controller: ($scope, $element, $http, $timeout) ->
84
+ $scope.uploadFiles = (model,id,file,parent) ->
85
+ uploadFiles($scope,$element,model,id,file,parent,$timeout)
86
+ $scope.progress = 0
87
+ $scope.uploadProgress = ->
88
+ return $scope.progress
89
+ .directive 'ngUpload', ->
90
+ restrict: 'E'
91
+ replace: true,
92
+ require: 'ngModel',
93
+ template:
94
+ '<span class="ng-upload">
95
+ <div class="ng-progress-bar">
96
+ <span class="bar" style="width: {{uploadProgress() || 0}}%;"></span><span class="text" style="margin-left: -{{uploadProgress() || 0}}%;">{{uploadProgress()}}%</span>
97
+ </div>
98
+ <input accept="{{accept()}}" ng-model="ngModel" type="file" /><img ng-show="show(&#39;image&#39;)" ng-src="{{file().thumb}}" />
99
+ <div class="button" ng-show="show(&#39;button&#39;)">
100
+ Select File
101
+ </div>
102
+ <a download="" href="{{file().path}}" ng-show="show(&#39;text&#39;)" target="_blank">{{file().name}}</a></span>'
103
+
104
+ link: (scope, element, attributes) ->
105
+ element.children('img').bind 'click', (event) ->
106
+ this.parentElement.getElementsByTagName('input')[0].click()
107
+ element.children('.button').bind 'click', (event) ->
108
+ this.parentElement.getElementsByTagName('input')[0].click()
109
+ element.children('input').bind 'click', (event) ->
110
+ event.stopPropagation()
111
+ element.children('input').bind 'change', (event) ->
112
+ file = event.target.files[0]
113
+ selectFile(scope,event,attributes,file)
114
+ scope.file = ->
115
+ fileData(scope,attributes)
116
+ scope.accept = ->
117
+ return attributes.accept if attributes.accept
118
+ return '*'
119
+ controller: ($scope, $element, $http, $timeout) ->
120
+ $scope.show = (type) ->
121
+ options = $element[0].attributes['ng-upload-options'].value.replace('{','').replace('}','').split(',')
122
+ for option in options
123
+ if option.indexOf(type) > -1
124
+ return true if option.indexOf('true') > -1
125
+ return false
126
+ $scope.uploadFiles = (model,id,file,parent) ->
127
+ uploadFiles($scope,$element,model,id,file,parent,$timeout)
@@ -0,0 +1,13 @@
1
+ angular.module('NgWatchContent', [])
2
+ .directive 'ngWatchContent', ->
3
+ controller: ($scope, $rootScope) ->
4
+ $scope.watchContents = ->
5
+ contents = ''
6
+ for element in angular.element('[ng-watch-content]')
7
+ contents += element.outerHTML
8
+ return contents
9
+ $rootScope.contentWatcher = $scope.$watch 'watchContents()', ->
10
+ height = 0
11
+ for element in angular.element('[ng-watch-content]')
12
+ height += element.getBoundingClientRect().height
13
+ angular.element('.content').css('min-height', height)
@@ -0,0 +1,15 @@
1
+ angular.module('NgWatchShow', [])
2
+ .directive 'ngWatchShow', ($timeout)->
3
+ link: (scope, element, attributes) ->
4
+ scope.$watch attributes.ngWatchShow, (newVal) ->
5
+ if (newVal)
6
+ element.removeClass('ng-hide')
7
+ else
8
+ if element.is(":focus")
9
+ inputs = document.getElementsByTagName('input')
10
+ for input, index in inputs
11
+ inputIndex = index if input == element[0]
12
+ input = angular.element inputs[inputIndex + 1]
13
+ $timeout ->
14
+ input.focus()
15
+ element.addClass('ng-hide')
@@ -0,0 +1,43 @@
1
+ angular.module('Table', [])
2
+ .directive 'stickyHeader', ($timeout) ->
3
+ restrict: 'A'
4
+ link: (scope, element, attributes) ->
5
+ tableLoaded = ->
6
+ element.find('tbody').find('td').length > 0
7
+ parentHeights = ->
8
+ heights = [element[0].offsetHeight]
9
+ parent = element[0].parentElement
10
+ until !parent
11
+ heights.push(parent.offsetHeight)
12
+ parent = parent.parentElement
13
+ minimumParentHeight = ->
14
+ Math.min.apply(Math, parentHeights())
15
+ maximumParentHeight = ->
16
+ Math.max.apply(Math, parentHeights())
17
+ tbody = ->
18
+ angular.element(element.find('tbody')[0])
19
+ thead = ->
20
+ angular.element(element.find('thead')[0])
21
+ initialize = ->
22
+ parent = angular.element(element[0].parentElement)
23
+ parent.css('min-height', minimumParentHeight() + 'px')
24
+ parent.css('max-height', maximumParentHeight() + 'px')
25
+ parent.css('overflow-y', 'hidden')
26
+ for col in element.find('th')
27
+ col.style.width = col.offsetWidth + 'px'
28
+ for col in element.find('td')
29
+ col.style.width = col.offsetWidth + 'px'
30
+ theight = minimumParentHeight() - thead()[0].offsetHeight - 20
31
+ tbody().css('display', 'block').css('overflow-y', 'auto').css('height', theight + 'px').css('overflow-x', 'hidden')
32
+ thead().css('display','block').css('width', tbody().find('tr')[0].offsetWidth + 'px')
33
+ reinitialize = ->
34
+ tbody().css('display','')
35
+ thead().css('display','')
36
+ initialize()
37
+ if element[0].tagName.toLowerCase() == 'table'
38
+ loadedWatcher = scope.$watch tableLoaded, (isLoaded) ->
39
+ if isLoaded
40
+ initialize()
41
+ window.addEventListener 'resize', ->
42
+ reinitialize()
43
+ loadedWatcher()
@@ -0,0 +1,11 @@
1
+ angular.module('TextArea', [])
2
+ .directive 'textarea', ($timeout) ->
3
+ restrict: 'E'
4
+ link: (scope, element, attributes) ->
5
+ scope.initialHeight = scope.initialHeight || element[0].style.height
6
+ element.css('resize','none').css('overflow','hidden').css('border','0px')
7
+ resize = ->
8
+ element[0].style.height = scope.initialHeight
9
+ element[0].style.height = "" + Math.max(20,element[0].scrollHeight) + "px"
10
+ element.on("blur keyup change", resize)
11
+ $timeout(resize, 0)
@@ -0,0 +1,10 @@
1
+ angular.module('Video', [])
2
+ .directive 'video',($timeout) ->
3
+ restrict: 'E'
4
+ link: (scope, element, attributes) ->
5
+ element[0].addEventListener 'click', (event)->
6
+ if element[0].paused
7
+ element[0].play()
8
+ else
9
+ element[0].pause()
10
+
@@ -0,0 +1,9 @@
1
+ angular.module 'FactoryName', []
2
+ .factory 'factoryName', ->
3
+ return (modelName) ->
4
+ raw_factory = modelName.split('_')
5
+ factory=[]
6
+ for word in raw_factory
7
+ factory.push(word.charAt(0).toUpperCase() + word.slice(1))
8
+ factory = factory.join('')
9
+ return factory
@@ -0,0 +1,17 @@
1
+ # //= require angular
2
+ # //= require angular-route
3
+ # //= require angular-resource
4
+ # //= require angular-animate
5
+ # //= require angular-aria
6
+ # //= require angular-material.min
7
+ # //= require material_raingular/factories
8
+ # //= require factory_name
9
+ # //= require_tree ./directives
10
+ # //= require js-routes
11
+ # //= require dateconverter
12
+ # //= require ajax_errors
13
+
14
+ angular.module('materialRaingular', ['AutoComplete', 'NgDownload', 'NgChangeOnBlur', 'NgDrag', 'NgAuthorize'
15
+ 'NgRepeatList', 'NgUpdate', 'NgPopup', 'NgBoolean', 'Table', 'NgWatchShow'
16
+ 'NgUpload', 'NgDestroy', 'NgCreate', 'Video','NgAuthorize', 'TextArea'
17
+ 'NgSlide', 'NgMatches','NgFade','NgSwipe', 'NgLoad', 'NgWatchContent'])
@@ -0,0 +1,3 @@
1
+ module MaterialRaingular
2
+ VERSION = "0.0.1.alpha"
3
+ end
@@ -0,0 +1,8 @@
1
+ require "material_raingular/version"
2
+
3
+ module MaterialRaingular
4
+ module Rails
5
+ class Engine < ::Rails::Engine
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,42 @@
1
+ namespace :material_raingular do
2
+ desc "Generate Material Raingular Factories"
3
+ task factories: :environment do
4
+ variances = Rails.application.config.raingular_variances rescue {}
5
+ puts "Rewriting angular factories:"
6
+ controllers = HashWithIndifferentAccess.new
7
+ factories = "angular.factories = angular.module('Factories', [])\n"
8
+ Rails.application.routes.routes.each do |route|
9
+ unless route.constraints[:request_method].nil? || route.defaults[:controller].nil? || (route.app.constraints.present? rescue false)
10
+ controllers[route.defaults[:controller]] ||= {}
11
+ controllers[route.defaults[:controller]][:parent_model_name_and_format_symbol] ||= []
12
+ controllers[route.defaults[:controller]][:parent_model_name_and_format_symbol] |= route.parts
13
+ controllers[route.defaults[:controller]][route.defaults[:action]] = {url: route.path.spec.to_s.gsub('(.:format)',''), method: route.constraints[:request_method].inspect.delete('/^$')}
14
+ end
15
+ end
16
+ controllers.each do |controller,routes|
17
+ parts = routes.delete(:parent_model_name_and_format_symbol)
18
+ parts.delete(:format)
19
+ ids = parts.map{|p| "#{p.to_sym}: '@#{p}'"}.join(', ')
20
+ factories += "angular.factories.factory('#{controller.try(:classify)}', function($resource) {return $resource("
21
+ factories += "'/#{controller}/:id.json', {#{ids}},{"
22
+ routes.each do |action,route|
23
+ ary = action.to_sym != :create && action.to_sym != :new && !(route[:url] =~ /\/:id/)
24
+ if (variances[controller.to_sym][action.to_sym].present? rescue false)
25
+ ary = variances[controller.to_sym][action.to_sym][:array]
26
+ end
27
+ factories += " #{action}: { method: '#{route[:method]}', url: '#{route[:url]}.json', isArray: #{ary} },"
28
+ end
29
+ factories = factories[0...-1] + "});});\n"
30
+ end
31
+ dirname = Rails.root.join("vendor","assets","javascripts","material_raingular")
32
+ unless File.directory?(dirname)
33
+ FileUtils.mkdir_p(dirname)
34
+ end
35
+ File.write(dirname.join("factories.js") ,Uglifier.compile(factories,mangle: false))
36
+ end
37
+ end
38
+ namespace :db do
39
+ task :migrate do
40
+ Rake::Task["material_raingular:factories"].invoke
41
+ end
42
+ end
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'material_raingular/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "material_raingular"
8
+ spec.version = MaterialRaingular::VERSION
9
+ spec.authors = ["Chris Moody"]
10
+ spec.email = ["cmoody@transcon.com"]
11
+ spec.summary = %q{Angular v1.4 for rails. Angular Material v0.9.8.}
12
+ spec.description = %q{Angular is fastly evolving and has surpassed this version; however, no good convention over configuration assets exist and most of these methods have been developed using this version of angular.}
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib","vendor"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.7"
22
+ spec.add_development_dependency "rake", "~> 10.0"
23
+
24
+ spec.add_runtime_dependency "js-routes"
25
+ end