material_raingular 0.1.5.1 → 0.1.5.2

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: 1a728062d5cbdaabed7c7a371c5b10b3ba3e0e14
4
- data.tar.gz: 7b9f0c149ae770fe180b02c481965e6c49ec26d9
3
+ metadata.gz: 3e503ebc7a84e7290dacfbc21e5311d9c4802197
4
+ data.tar.gz: fe96e83f7d1904f4bd8a83ad7073de629bc4b906
5
5
  SHA512:
6
- metadata.gz: 72bbe4064ef979057e9b7023b41ea98ded6445a7c8c6f4eff2e3e489e5366f81fa62d1b720f5f21fc526a32efc4b629f432ea0ee45a759495c647235b2a22191
7
- data.tar.gz: fc1aaafe38c72cc237d19b89cd53e8caef8741d98da5d8f91608a38a8d84e3a8fabd3dd54ecb86021d44127d4f4ab0ce19630ae3af64d42759c56f88344bf46c
6
+ metadata.gz: 3118079108faa8513fb88cdd5d1a67e9af2a7f494d11db788c9f175c6bf103251a7094064b0a42fd1f2886e21642ddb3c1bd9fb5648312a3a46350a1bb988e49
7
+ data.tar.gz: 9dc2e8bcc682d4528b7ef4411e9a72d94534504adf4d7497dc2e5b46003239547890f8cf44348002630df661d4dfcefae0d0bd38ff0773cd9867cbb59f58b669
@@ -62,20 +62,15 @@ class FileUpload
62
62
  return data
63
63
 
64
64
  class NgUploadEvents
65
- constructor: (@element,@file_upload) ->
66
- clicked = false
67
- @element.children('img').bind 'click', (event) =>
68
- return if clicked
69
- event.target.parentElement.getElementsByTagName('input')[0].click()
70
- @element.children('.button').bind 'click', (event) =>
71
- return if clicked
65
+ constructor: (@element,@file_upload,@disabled) ->
66
+ @element.children().bind 'click', (event) =>
67
+ return if @disabled()
68
+ return if event.target.tagName == 'A'
72
69
  event.target.parentElement.getElementsByTagName('input')[0].click()
73
- @element.children('input').bind 'click', (event) =>
74
- clicked = true
75
70
  @element.children('input').bind 'change', (event) =>
71
+ return if @disabled()
76
72
  file = event.target.files[0]
77
73
  @file_upload.uploadFile(file)
78
- clicked = false
79
74
 
80
75
  class NgDropFileEvents
81
76
  constructor: (@element,@file_upload) ->
@@ -119,12 +114,13 @@ angular.module('NgUpload', [])
119
114
  restrict: 'E'
120
115
  replace: true,
121
116
  require: ['ngModel','?ngCallback'],
122
- template:
117
+ template: (element,attributes) ->
118
+ disabled = typeof(attributes.disabled) != 'undefined'
123
119
  '<span class="ng-upload" style="outline: none">
124
120
  <div class="ng-progress-bar">
125
121
  <span class="bar" style="width: {{progress || 0}}%;"></span><span class="text" style="margin-left: -{{uploadProgress() || 0}}%;">{{uploadProgress()}}%</span>
126
122
  </div>
127
- <input accept="{{accept()}}" ng-model="ngModel" type="file" ng-class="{image: file_upload_show(&#39;image&#39;)}" /><img ng-show="file_upload_show(&#39;image&#39;)" ng-src="{{file_upload_data().thumb}}" />
123
+ <input accept="{{accept()}}" ng-model="ngModel" type="file" ng-class="{image: file_upload_show(&#39;image&#39;)}" ' + (if disabled then 'disabled ') + '/><img ng-show="file_upload_show(&#39;image&#39;)" ng-src="{{file_upload_data().thumb}}" />
128
124
  <div class="button" ng-show="file_upload_show(&#39;button&#39;)">
129
125
  Select File
130
126
  </div>
@@ -132,8 +128,13 @@ angular.module('NgUpload', [])
132
128
 
133
129
  link: (scope, element, attributes,controllers) ->
134
130
  file_upload = new FileUpload($parse,scope,controllers,attributes.ngModel,attributes.ngOverride,element)
135
- new NgUploadEvents(element,file_upload)
136
131
  options = $parse(attributes.ngUploadOptions)()
137
132
  scope.file_upload_show = (type) -> options[type]
138
133
  scope.file_upload_data = -> file_upload.fileData()
139
134
  scope.accept = -> attributes.accept || '*'
135
+ disabled = ->
136
+ el = element[0]
137
+ until !el.parentElement
138
+ return true if el.getAttribute('disabled')
139
+ el = el.parentElement
140
+ new NgUploadEvents(element,file_upload,disabled)
@@ -1,3 +1,3 @@
1
1
  module MaterialRaingular
2
- VERSION = "0.1.5.1"
2
+ VERSION = "0.1.5.2"
3
3
  end
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.1.5.1
4
+ version: 0.1.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Moody
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-17 00:00:00.000000000 Z
11
+ date: 2016-04-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -144,7 +144,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
144
144
  version: '0'
145
145
  requirements: []
146
146
  rubyforge_project:
147
- rubygems_version: 2.4.3
147
+ rubygems_version: 2.5.1
148
148
  signing_key:
149
149
  specification_version: 4
150
150
  summary: Angular v1.4 for rails. Angular Material v0.9.8.