angular_progress 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ Y2QzOTg4YTA0MjE3Y2MzNjZkMzAzYjJiZjRhMTNlNzZjNzQ1ODc3ZA==
5
+ data.tar.gz: !binary |-
6
+ NzIyMmU5YzE4YTk0MGYyMWE1OGNlZjdiNDU3YzkxY2JkMjU3MWUxOQ==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ MDBiNGJjYTAyNTFmMGUyNThmNGZhN2VlMTcyMTI0ZjQwY2E2NjAwZDczYzRj
10
+ MzViMTkzMmJmZWFjNWE2YTFkNWI2OGM5OWJlNmU3MzI5MzhhMzdjOGM1ODFk
11
+ YzIwNTkwYjIwNDRmNjJmNGE2OGI2NWY2YzYyNjI3ZmE4NWNkMmI=
12
+ data.tar.gz: !binary |-
13
+ YTNhMWQyMTAwNzc4MWM2M2IyOWY4MWY1ODZhZjBkNWU0MzVhZTAyZDg1YTk5
14
+ YmFiODA4NDAzZTA4NTMyNmQwMWFlODIwNmNjNDA1YmNlOTYyZDc4YzU4YTFm
15
+ YjhmMDQyMGEzNGM4OWYwYTUzMTNiMTQwYWNkODZjOWY3ZTBhMjY=
data/.gitignore ADDED
@@ -0,0 +1,34 @@
1
+ *.gem
2
+ *.rbc
3
+ /.config
4
+ /coverage/
5
+ /InstalledFiles
6
+ /pkg/
7
+ /spec/reports/
8
+ /test/tmp/
9
+ /test/version_tmp/
10
+ /tmp/
11
+
12
+ ## Specific to RubyMotion:
13
+ .dat*
14
+ .repl_history
15
+ build/
16
+
17
+ ## Documentation cache and generated files:
18
+ /.yardoc/
19
+ /_yardoc/
20
+ /doc/
21
+ /rdoc/
22
+
23
+ ## Environment normalisation:
24
+ /.bundle/
25
+ /lib/bundler/man/
26
+ .idea
27
+ # for a library or gem, you might want to ignore these files since the code is
28
+ # intended to run in multiple environments; otherwise, check them in:
29
+ # Gemfile.lock
30
+ # .ruby-version
31
+ # .ruby-gemset
32
+
33
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
34
+ .rvmrc
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in angular_progress.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,92 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ angular_progress (0.0.1)
5
+ rails (>= 3.1)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ actionmailer (4.1.0)
11
+ actionpack (= 4.1.0)
12
+ actionview (= 4.1.0)
13
+ mail (~> 2.5.4)
14
+ actionpack (4.1.0)
15
+ actionview (= 4.1.0)
16
+ activesupport (= 4.1.0)
17
+ rack (~> 1.5.2)
18
+ rack-test (~> 0.6.2)
19
+ actionview (4.1.0)
20
+ activesupport (= 4.1.0)
21
+ builder (~> 3.1)
22
+ erubis (~> 2.7.0)
23
+ activemodel (4.1.0)
24
+ activesupport (= 4.1.0)
25
+ builder (~> 3.1)
26
+ activerecord (4.1.0)
27
+ activemodel (= 4.1.0)
28
+ activesupport (= 4.1.0)
29
+ arel (~> 5.0.0)
30
+ activesupport (4.1.0)
31
+ i18n (~> 0.6, >= 0.6.9)
32
+ json (~> 1.7, >= 1.7.7)
33
+ minitest (~> 5.1)
34
+ thread_safe (~> 0.1)
35
+ tzinfo (~> 1.1)
36
+ arel (5.0.1.20140414130214)
37
+ builder (3.2.2)
38
+ erubis (2.7.0)
39
+ hike (1.2.3)
40
+ i18n (0.6.9)
41
+ json (1.8.1)
42
+ mail (2.5.4)
43
+ mime-types (~> 1.16)
44
+ treetop (~> 1.4.8)
45
+ mime-types (1.25.1)
46
+ minitest (5.3.3)
47
+ multi_json (1.9.2)
48
+ polyglot (0.3.4)
49
+ rack (1.5.2)
50
+ rack-test (0.6.2)
51
+ rack (>= 1.0)
52
+ rails (4.1.0)
53
+ actionmailer (= 4.1.0)
54
+ actionpack (= 4.1.0)
55
+ actionview (= 4.1.0)
56
+ activemodel (= 4.1.0)
57
+ activerecord (= 4.1.0)
58
+ activesupport (= 4.1.0)
59
+ bundler (>= 1.3.0, < 2.0)
60
+ railties (= 4.1.0)
61
+ sprockets-rails (~> 2.0)
62
+ railties (4.1.0)
63
+ actionpack (= 4.1.0)
64
+ activesupport (= 4.1.0)
65
+ rake (>= 0.8.7)
66
+ thor (>= 0.18.1, < 2.0)
67
+ rake (10.3.1)
68
+ sprockets (2.12.1)
69
+ hike (~> 1.2)
70
+ multi_json (~> 1.0)
71
+ rack (~> 1.0)
72
+ tilt (~> 1.1, != 1.3.0)
73
+ sprockets-rails (2.1.3)
74
+ actionpack (>= 3.0)
75
+ activesupport (>= 3.0)
76
+ sprockets (~> 2.8)
77
+ thor (0.19.1)
78
+ thread_safe (0.3.3)
79
+ tilt (1.4.1)
80
+ treetop (1.4.15)
81
+ polyglot
82
+ polyglot (>= 0.3.1)
83
+ tzinfo (1.1.0)
84
+ thread_safe (~> 0.1)
85
+
86
+ PLATFORMS
87
+ ruby
88
+
89
+ DEPENDENCIES
90
+ angular_progress!
91
+ bundler (~> 1.3)
92
+ rake
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2014 Tushar Ranka
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Tushar Ranka
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # AngularProgress
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'angular_progress'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install angular_progress
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'angular_progress/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "angular_progress"
8
+ spec.version = AngularProgress::VERSION
9
+ spec.authors = ["Tushar Ranka"]
10
+ spec.email = ["tusharranka@gmail.com"]
11
+ spec.description = %q{ Angular directive for tracking progress. Easily add spinner and progress indicators using AngularJS}
12
+ spec.summary = %q{Angular directive for tracking progress}
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
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"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.3"
22
+ spec.add_development_dependency "rake"
23
+ spec.add_runtime_dependency "rails", ">= 3.1"
24
+ end
@@ -0,0 +1,6 @@
1
+ require "angular_progress/version"
2
+ require "angular_progress/engine"
3
+ require "active_support/dependencies"
4
+
5
+ module AngularProgress
6
+ end
@@ -0,0 +1,5 @@
1
+ module AngularProgress
2
+ class Engine < Rails::Engine
3
+
4
+ end
5
+ end
@@ -0,0 +1,3 @@
1
+ module AngularProgress
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,3 @@
1
+ //= require angular_progress/app
2
+ //= require angular_progress/directives/http_progress
3
+ //= require angular_progress/interceptors/http_progress_interceptor
@@ -0,0 +1,4 @@
1
+ angular.module('AngularProgress', [])
2
+ angular.module('AngularProgress').config ['$httpProvider', ($httpProvider) ->
3
+ $httpProvider.interceptors.push('httpProgressInterceptor')
4
+ ]
@@ -0,0 +1,59 @@
1
+ angular.module('AngularProgress').directive 'httpProgress', [ '$timeout', '$sce', ($timeout, $sce) ->
2
+ template: """
3
+ <div ng-show="requestInProgress" ng-bind-html="httpPending"></div>
4
+ <div ng-show="requestSucceeded" ng-bind-html="httpOnSuccess"></div>
5
+ <div ng-show="requestFailed" ng-bind-html="httpOnError"></div>
6
+ <div ng-transclude ng-show="!requestInProgress && !requestSucceeded && !requestFailed"></div>
7
+ """
8
+ restrict: 'AE'
9
+ scope: {}
10
+ transclude: true
11
+ link: (scope, element, attributes, controller) ->
12
+ scope.requestName = attributes.requestName || attributes.httpProgress
13
+ scope.requestCount = 0
14
+ scope.httpOnSuccess = $sce.trustAsHtml(attributes.httpSuccess)
15
+ scope.httpOnError = $sce.trustAsHtml(attributes.httpError)
16
+ scope.httpPending = $sce.trustAsHtml(attributes.httpPending)
17
+ scope.requestInProgress = false
18
+ scope.requestSucceeded = false
19
+ scope.requestFailed = false
20
+
21
+ scope.revertToOriginal = ->
22
+ scope.requestInProgress = false
23
+ scope.requestSucceeded = false
24
+ scope.requestFailed = false
25
+
26
+ scope.httpProgressSuccess = ->
27
+ if scope.httpOnSuccess
28
+ scope.requestInProgress = false
29
+ scope.requestSucceeded = true
30
+ scope.requestFailed = false
31
+ $timeout(scope.revertToOriginal, 3000)
32
+ else
33
+ scope.revertToOriginal()
34
+
35
+ scope.httpProgressError = ->
36
+ if scope.httpOnError
37
+ scope.requestInProgress = false
38
+ scope.requestSucceeded = false
39
+ scope.requestFailed = true
40
+ $timeout(scope.revertToOriginal, 5000)
41
+ else
42
+ scope.revertToOriginal()
43
+
44
+ scope.$on 'startHttpProgress', (event, target) ->
45
+ return unless scope.requestName is target.requestName
46
+ scope.requestCount += 1
47
+ if scope.requestCount >= 1
48
+ scope.revertToOriginal()
49
+ scope.requestInProgress = true
50
+
51
+ scope.$on 'stopHttpProgress', (event, target) ->
52
+ return unless scope.requestName is target.requestName
53
+ scope.requestCount -= 1
54
+ scope.requestCount = 0 if scope.requestCount < 0
55
+ if target.success is true && scope.requestCount is 0
56
+ scope.httpProgressSuccess()
57
+ else if scope.requestCount is 0
58
+ scope.httpProgressError()
59
+ ]
@@ -0,0 +1,21 @@
1
+ angular.module('angularProgress').factory 'httpProgressInterceptor', ['$q', '$rootScope', ($q, $rootScope) ->
2
+ request: (request) ->
3
+ requestName = request.requestName || request.config?.requestName || request.data?.requestName
4
+ if requestName
5
+ $rootScope.$broadcast('startHttpProgress', { requestName: requestName })
6
+ request
7
+
8
+ response: (response) ->
9
+ requestName = response.config?.requestName || response.config?.data?.requestName
10
+ if requestName
11
+ $rootScope.$broadcast('stopHttpProgress', { requestName: requestName, success: true })
12
+ response
13
+
14
+ responseError: (rejection) ->
15
+ requestName = rejection.config?.requestName || rejection.data?.requestName
16
+ if requestName
17
+ $rootScope.$broadcast('stopHttpProgress', { requestName: requestName, success: false })
18
+
19
+ $q.reject(rejection)
20
+ ]
21
+
metadata ADDED
@@ -0,0 +1,102 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: angular_progress
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Tushar Ranka
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-06-13 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ! '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rails
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ! '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '3.1'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '3.1'
55
+ description: ! ' Angular directive for tracking progress. Easily add spinner and progress
56
+ indicators using AngularJS'
57
+ email:
58
+ - tusharranka@gmail.com
59
+ executables: []
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - .gitignore
64
+ - Gemfile
65
+ - Gemfile.lock
66
+ - LICENSE
67
+ - LICENSE.txt
68
+ - README.md
69
+ - Rakefile
70
+ - angular_progress.gemspec
71
+ - lib/angular_progress.rb
72
+ - lib/angular_progress/engine.rb
73
+ - lib/angular_progress/version.rb
74
+ - vendor/assets/javascripts/angular_progress.js
75
+ - vendor/assets/javascripts/angular_progress/app.js.coffee
76
+ - vendor/assets/javascripts/angular_progress/directives/http_progress.js.coffee
77
+ - vendor/assets/javascripts/angular_progress/interceptors/http_progress_interceptor.js.coffee
78
+ homepage: ''
79
+ licenses:
80
+ - MIT
81
+ metadata: {}
82
+ post_install_message:
83
+ rdoc_options: []
84
+ require_paths:
85
+ - lib
86
+ required_ruby_version: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ! '>='
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
91
+ required_rubygems_version: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ! '>='
94
+ - !ruby/object:Gem::Version
95
+ version: '0'
96
+ requirements: []
97
+ rubyforge_project:
98
+ rubygems_version: 2.2.1
99
+ signing_key:
100
+ specification_version: 4
101
+ summary: Angular directive for tracking progress
102
+ test_files: []