Commit 1891a991 authored by qa_quantgroup's avatar qa_quantgroup

add TEMP

parent dcffc10b

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.

/qa_shell_script/TEMP/*
.idea/ .idea/
*.swp *.swp
...@@ -15,7 +15,7 @@ if [[ $target_ip == "ALL" ]]; then ...@@ -15,7 +15,7 @@ if [[ $target_ip == "ALL" ]]; then
set timeout 10 set timeout 10
spawn ssh root@${IP_host_first}${ip_last_num} spawn ssh root@${IP_host_first}${ip_last_num}
expect \"]#\" expect \"]#\"
send \"umount $script_path\r\" send \"umount -l $script_path\\ \r\"
set timeout -1 set timeout -1
expect \"]#\" expect \"]#\"
send \"rm -rf $script_path\r\" send \"rm -rf $script_path\r\"
...@@ -27,7 +27,7 @@ if [[ $target_ip == "ALL" ]]; then ...@@ -27,7 +27,7 @@ if [[ $target_ip == "ALL" ]]; then
send \"mount -t nfs 192.168.4.3:$script_path $script_path\r\" send \"mount -t nfs 192.168.4.3:$script_path $script_path\r\"
set timeout -1 set timeout -1
expect \"]#\" expect \"]#\"
send \"umount $config_files\r\" send \"umount -l $config_files\\ \r\"
set timeout -1 set timeout -1
expect \"]#\" expect \"]#\"
send \"rm -rf $config_files\r\" send \"rm -rf $config_files\r\"
......
...@@ -19,7 +19,7 @@ if [ -n "$project_folder" ];then ...@@ -19,7 +19,7 @@ if [ -n "$project_folder" ];then
cd ./$project_name cd ./$project_name
git checkout ./ git checkout ./
git fetch git fetch
git pull #git pull
if [ -n "$git_branch" ]; then if [ -n "$git_branch" ]; then
echo "checkout specified branch $git_branch" echo "checkout specified branch $git_branch"
git checkout -f $git_branch git checkout -f $git_branch
...@@ -31,8 +31,10 @@ if [ -n "$project_folder" ];then ...@@ -31,8 +31,10 @@ if [ -n "$project_folder" ];then
exit -1 exit -1
fi fi
else else
echo "checkout default branch master" #echo "checkout default branch master"
git checkout -f master #git checkout -f master
git_branch=`git branch | grep '*' | awk '{print $2}'`
echo "current branch: $git_branch"
git pull git pull
fi fi
else else
...@@ -42,4 +44,16 @@ else ...@@ -42,4 +44,16 @@ else
git_path=`node $config_server/get_project_config.js -name $project_name -attr git_path` git_path=`node $config_server/get_project_config.js -name $project_name -attr git_path`
echo "git clone $git_path" echo "git clone $git_path"
git clone $git_path git clone $git_path
cd ./$project_name
if [ -n "$git_branch" ]; then
echo "checkout specified branch $git_branch"
git checkout -f $git_branch
if [ $? = 0 ]; then
echo "checkout branch $git_branch is ok".
git pull
else
echo "Fail to checkout branch $git_branch".
exit -1
fi
fi
fi fi
...@@ -35,7 +35,7 @@ function getCode() ...@@ -35,7 +35,7 @@ function getCode()
#如果拉代码失败,则获取现在所处分支,然后删掉现在的项目,重新clone #如果拉代码失败,则获取现在所处分支,然后删掉现在的项目,重新clone
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "error: Pulling is not possible because you have unmerged files" echo "error: Pulling is not possible because you have unmerged files"
git_branch=`git branch | grep '*' | awk '{print $3}'` git_branch=`git branch | grep '*' | awk '{print $2}'`
echo $git_branch echo $git_branch
cd $project_path cd $project_path
rm -rf $project_folder rm -rf $project_folder
......
...@@ -50,6 +50,12 @@ function buildJavaProject() ...@@ -50,6 +50,12 @@ function buildJavaProject()
echo "mvn clean package -P${profile} -Dmaven.test.skip=true" echo "mvn clean package -P${profile} -Dmaven.test.skip=true"
mvn clean package -P${profile} -Dmaven.test.skip=true mvn clean package -P${profile} -Dmaven.test.skip=true
if [ $? = 0 ]; then
echo "${project} build ok"
else
echo "${project} build fail"
exit -1
fi
echo "$target_path" echo "$target_path"
mv $project_path/$project/$target_path/*.jar $project_path/$project/$project.jar mv $project_path/$project/$target_path/*.jar $project_path/$project/$project.jar
} }
...@@ -119,7 +125,7 @@ function buildNodeProject() ...@@ -119,7 +125,7 @@ function buildNodeProject()
cd $project_path/$project cd $project_path/$project
#第二步 关联配置文件 #第二步 关联配置文件
rm -rf ./$config_file rm -rf ./$config_file
echo " ------------ln -s $config_path/node/$project.* ./$config_file" echo "------ln -s $config_path/node/$project.* ./$config_file"
ln -s $config_path/node/$project.* ./$config_file ln -s $config_path/node/$project.* ./$config_file
npm config set "@types:registry" http://registry.npmjs.org/ npm config set "@types:registry" http://registry.npmjs.org/
npm --registry http://172.16.3.15:4873 install npm --registry http://172.16.3.15:4873 install
......
...@@ -66,6 +66,7 @@ function restartJavaProject() ...@@ -66,6 +66,7 @@ function restartJavaProject()
if [ $? -ne 0 ] if [ $? -ne 0 ]
then then
echo "Fail to start" echo "Fail to start"
exit -1
fi fi
} }
...@@ -82,6 +83,11 @@ function restartNodeProject() ...@@ -82,6 +83,11 @@ function restartNodeProject()
# pm2 stop $project # pm2 stop $project
start_command=`node $config_server/get_project_config.js -name $project -attr command` start_command=`node $config_server/get_project_config.js -name $project -attr command`
$start_command $start_command
if [ $? -ne 0 ]
then
echo "Fail to start"
exit -1
fi
# setup_path_temp=`find ./ -maxdepth 2 -path "./node_modules" -prune -o -type f -name "app.js" -print` # setup_path_temp=`find ./ -maxdepth 2 -path "./node_modules" -prune -o -type f -name "app.js" -print`
# echo "------setup_path_temp:$setup_path_temp" # echo "------setup_path_temp:$setup_path_temp"
# #
......
{
"name": "angular-animate",
"version": "1.4.14",
"license": "MIT",
"main": "./angular-animate.js",
"ignore": [],
"dependencies": {
"angular": "1.4.14"
},
"homepage": "https://github.com/angular/bower-angular-animate",
"_release": "1.4.14",
"_resolution": {
"type": "version",
"tag": "v1.4.14",
"commit": "e7f778fc054a086ba3326d898a00fa1bc78650a8"
},
"_source": "https://github.com/angular/bower-angular-animate.git",
"_target": "~1.4.3",
"_originalSource": "angular-animate"
}
\ No newline at end of file
The MIT License (MIT)
Copyright (c) 2016 Angular
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
# packaged angular-animate
This repo is for distribution on `npm` and `bower`. The source for this module is in the
[main AngularJS repo](https://github.com/angular/angular.js/tree/master/src/ngAnimate).
Please file issues and pull requests against that repo.
## Install
You can install this package either with `npm` or with `bower`.
### npm
```shell
npm install angular-animate
```
Then add `ngAnimate` as a dependency for your app:
```javascript
angular.module('myApp', [require('angular-animate')]);
```
### bower
```shell
bower install angular-animate
```
Then add a `<script>` to your `index.html`:
```html
<script src="/bower_components/angular-animate/angular-animate.js"></script>
```
Then add `ngAnimate` as a dependency for your app:
```javascript
angular.module('myApp', ['ngAnimate']);
```
## Documentation
Documentation is available on the
[AngularJS docs site](http://docs.angularjs.org/api/ngAnimate).
## License
The MIT License
Copyright (c) 2010-2015 Google, Inc. http://angularjs.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
This source diff could not be displayed because it is too large. You can view the blob instead.
{
"name": "angular-animate",
"version": "1.4.14",
"license": "MIT",
"main": "./angular-animate.js",
"ignore": [],
"dependencies": {
"angular": "1.4.14"
}
}
require('./angular-animate');
module.exports = 'ngAnimate';
{
"name": "angular-animate",
"version": "1.4.14",
"description": "AngularJS module for animations",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "https://github.com/angular/angular.js.git"
},
"keywords": [
"angular",
"framework",
"browser",
"animation",
"client-side"
],
"author": "Angular Core Team <angular-core+npm@google.com>",
"license": "MIT",
"bugs": {
"url": "https://github.com/angular/angular.js/issues"
},
"homepage": "http://angularjs.org",
"jspm": {
"shim": {
"angular-animate": {
"deps": ["angular"]
}
}
}
}
{
"author": {
"name": "https://github.com/angular-ui/bootstrap/graphs/contributors"
},
"name": "angular-bootstrap",
"keywords": [
"angular",
"angular-ui",
"bootstrap"
],
"license": "MIT",
"ignore": [],
"description": "Native AngularJS (Angular) directives for Bootstrap.",
"version": "0.13.4",
"main": [
"./ui-bootstrap-tpls.js"
],
"dependencies": {
"angular": ">=1.3.0"
},
"homepage": "https://github.com/angular-ui/bootstrap-bower",
"_release": "0.13.4",
"_resolution": {
"type": "version",
"tag": "0.13.4",
"commit": "a5f2d4bdcbbbae9cc6bd34a0a79f24e9aacc8ab9"
},
"_source": "https://github.com/angular-ui/bootstrap-bower.git",
"_target": "~0.13.0",
"_originalSource": "angular-bootstrap"
}
\ No newline at end of file
### UI Bootstrap - [AngularJS](http://angularjs.org/) directives specific to [Bootstrap](http://getbootstrap.com)
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/angular-ui/bootstrap?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Build Status](https://secure.travis-ci.org/angular-ui/bootstrap.svg)](http://travis-ci.org/angular-ui/bootstrap)
[![devDependency Status](https://david-dm.org/angular-ui/bootstrap/dev-status.svg?branch=master)](https://david-dm.org/angular-ui/bootstrap#info=devDependencies)
### Quick links
- [Demo](#demo)
- [Installation](#installation)
- [NPM](#install-with-npm)
- [Bower](#install-with-bower)
- [NuGet](#install-with-nuget)
- [Custom](#custom-build)
- [Manual](#manual-download)
- [Support](#support)
- [FAQ](#faq)
- [Supported browsers](#supported-browsers)
- [Need help?](#need-help)
- [Found a bug?](#found-a-bug)
- [Contributing to the project](#contributing-to-the-project)
- [Development, meeting minutes, roadmap and more.](#development-meeting-minutes-roadmap-and-more)
# Demo
Do you want to see directives in action? Visit http://angular-ui.github.io/bootstrap/!
# Installation
Installation is easy as UI Bootstrap has minimal dependencies - only the AngularJS and Twitter Bootstrap's CSS are required.
Note: Since version 0.13.0, UI Bootstrap depends on [ngAnimate](https://docs.angularjs.org/api/ngAnimate) for transitions and animations, such as the accordion, carousel, etc. Include `ngAnimate` in the module dependencies for your app in order to enable animation.
#### Install with NPM
```sh
$ npm install angular-ui-bootstrap
```
This will install AngularJS and Bootstrap NPM packages.
#### Install with Bower
```sh
$ bower install angular-bootstrap
```
Note: do not install 'angular-ui-bootstrap'. A separate repository - [bootstrap-bower](https://github.com/angular-ui/bootstrap-bower) - hosts the compiled javascript file and bower.json.
#### Install with NuGet
To install AngularJS UI Bootstrap, run the following command in the Package Manager Console
```sh
PM> Install-Package Angular.UI.Bootstrap
```
#### Custom build
Head over to http://angular-ui.github.io/bootstrap/ and hit the *Custom build* button to create your own custom UI Bootstrap build, just the way you like it.
#### Manual download
After downloading dependencies (or better yet, referencing them from your favorite CDN) you need to download build version of this project. All the files and their purposes are described here:
https://github.com/angular-ui/bootstrap/tree/gh-pages#build-files
Don't worry, if you are not sure which file to take, opt for `ui-bootstrap-tpls-[version].min.js`.
### Adding dependency to your project
When you are done downloading all the dependencies and project files the only remaining part is to add dependencies on the `ui.bootstrap` AngularJS module:
```js
angular.module('myModule', ['ui.bootstrap']);
```
If you're a Browserify or Webpack user, you can do:
```js
var uibs = require('angular-ui-bootstrap');
angular.module('myModule', [uibs]);
```
# Support
## FAQ
https://github.com/angular-ui/bootstrap/wiki/FAQ
## Supported browsers
Directives from this repository are automatically tested with the following browsers:
* Chrome (stable and canary channel)
* Firefox
* IE 9 and 10
* Opera
* Safari
Modern mobile browsers should work without problems.
## Need help?
Need help using UI Bootstrap?
* Live help in the IRC (`#angularjs` channel at the `freenode` network). Use this [webchat](https://webchat.freenode.net/) or your own IRC client.
* Ask a question in [StackOverflow](http://stackoverflow.com/) under the [angular-ui-bootstrap](http://stackoverflow.com/questions/tagged/angular-ui-bootstrap) tag.
**Please do not create new issues in this repository to ask questions about using UI Bootstrap**
## Found a bug?
Please take a look at [CONTRIBUTING.md](CONTRIBUTING.md#you-think-youve-found-a-bug) and submit your issue [here](https://github.com/angular-ui/bootstrap/issues/new).
----
# Contributing to the project
We are always looking for the quality contributions! Please check the [CONTRIBUTING.md](CONTRIBUTING.md) for the contribution guidelines.
# Development, meeting minutes, roadmap and more.
Head over to the [Wiki](https://github.com/angular-ui/bootstrap/wiki) for notes on development for UI Bootstrap, meeting minutes from the UI Bootstrap team, roadmap plans, project philosophy and more.
{
"author": {
"name": "https://github.com/angular-ui/bootstrap/graphs/contributors"
},
"name": "angular-bootstrap",
"keywords": [
"angular",
"angular-ui",
"bootstrap"
],
"license": "MIT",
"ignore": [],
"description": "Native AngularJS (Angular) directives for Bootstrap.",
"version": "0.13.4",
"main": ["./ui-bootstrap-tpls.js"],
"dependencies": {
"angular": ">=1.3.0"
}
}
require('./ui-bootstrap-tpls');
module.exports = 'ui.bootstrap';
{
"name": "angular-ui-bootstrap",
"version": "0.13.4",
"description": "Bootstrap widgets for Angular",
"main": "index.js",
"homepage": "http://angular-ui.github.io/bootstrap/",
"repository": {
"type": "git",
"url": "https://github.com/angular-ui/bootstrap.git"
},
"keywords": [
"angular",
"bootstrap",
"angular-ui",
"components",
"client-side"
],
"author": "https://github.com/angular-ui/bootstrap/graphs/contributors",
"peerDependencies": {
"angular": "^1.3.x || >= 1.4.0-beta.0 || >= 1.5.0-beta.0",
"bootstrap": "^3.x"
},
"license": "MIT"
}
/* Include this file in your html if you are using the CSP mode. */
.ng-animate.item:not(.left):not(.right) {
-webkit-transition: 0s ease-in-out left;
transition: 0s ease-in-out left
}
\ No newline at end of file
{
"name": "angular-cookies",
"version": "1.6.1",
"license": "MIT",
"main": "./angular-cookies.js",
"ignore": [],
"dependencies": {
"angular": "1.6.1"
},
"homepage": "https://github.com/angular/bower-angular-cookies",
"_release": "1.6.1",
"_resolution": {
"type": "version",
"tag": "v1.6.1",
"commit": "7abd6b5182e5a477799bd731f5dcf74ec713e855"
},
"_source": "https://github.com/angular/bower-angular-cookies.git",
"_target": ">=1.2.*",
"_originalSource": "angular-cookies"
}
\ No newline at end of file
The MIT License (MIT)
Copyright (c) 2016 Angular
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
# packaged angular-cookies
This repo is for distribution on `npm` and `bower`. The source for this module is in the
[main AngularJS repo](https://github.com/angular/angular.js/tree/master/src/ngCookies).
Please file issues and pull requests against that repo.
## Install
You can install this package either with `npm` or with `bower`.
### npm
```shell
npm install angular-cookies
```
Then add `ngCookies` as a dependency for your app:
```javascript
angular.module('myApp', [require('angular-cookies')]);
```
### bower
```shell
bower install angular-cookies
```
Add a `<script>` to your `index.html`:
```html
<script src="/bower_components/angular-cookies/angular-cookies.js"></script>
```
Then add `ngCookies` as a dependency for your app:
```javascript
angular.module('myApp', ['ngCookies']);
```
## Documentation
Documentation is available on the
[AngularJS docs site](http://docs.angularjs.org/api/ngCookies).
## License
The MIT License
Copyright (c) 2010-2015 Google, Inc. http://angularjs.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
/*
AngularJS v1.6.1
(c) 2010-2016 Google, Inc. http://angularjs.org
License: MIT
*/
(function(n,c){'use strict';function l(b,a,g){var d=g.baseHref(),k=b[0];return function(b,e,f){var g,h;f=f||{};h=f.expires;g=c.isDefined(f.path)?f.path:d;c.isUndefined(e)&&(h="Thu, 01 Jan 1970 00:00:00 GMT",e="");c.isString(h)&&(h=new Date(h));e=encodeURIComponent(b)+"="+encodeURIComponent(e);e=e+(g?";path="+g:"")+(f.domain?";domain="+f.domain:"");e+=h?";expires="+h.toUTCString():"";e+=f.secure?";secure":"";f=e.length+1;4096<f&&a.warn("Cookie '"+b+"' possibly not set or overflowed because it was too large ("+
f+" > 4096 bytes)!");k.cookie=e}}c.module("ngCookies",["ng"]).provider("$cookies",[function(){var b=this.defaults={};this.$get=["$$cookieReader","$$cookieWriter",function(a,g){return{get:function(d){return a()[d]},getObject:function(d){return(d=this.get(d))?c.fromJson(d):d},getAll:function(){return a()},put:function(d,a,m){g(d,a,m?c.extend({},b,m):b)},putObject:function(d,b,a){this.put(d,c.toJson(b),a)},remove:function(a,k){g(a,void 0,k?c.extend({},b,k):b)}}}]}]);c.module("ngCookies").factory("$cookieStore",
["$cookies",function(b){return{get:function(a){return b.getObject(a)},put:function(a,c){b.putObject(a,c)},remove:function(a){b.remove(a)}}}]);l.$inject=["$document","$log","$browser"];c.module("ngCookies").provider("$$cookieWriter",function(){this.$get=l})})(window,window.angular);
//# sourceMappingURL=angular-cookies.min.js.map
{
"version":3,
"file":"angular-cookies.min.js",
"lineCount":8,
"mappings":"A;;;;;aAKC,SAAQ,CAACA,CAAD,CAASC,CAAT,CAAkB,CAmR3BC,QAASA,EAAc,CAACC,CAAD,CAAYC,CAAZ,CAAkBC,CAAlB,CAA4B,CACjD,IAAIC,EAAaD,CAAAE,SAAA,EAAjB,CACIC,EAAcL,CAAA,CAAU,CAAV,CAmClB,OAAO,SAAQ,CAACM,CAAD,CAAOC,CAAP,CAAcC,CAAd,CAAuB,CAjCW,IAC3CC,CAD2C,CACrCC,CACVF,EAAA,CAgCoDA,CAhCpD,EAAqB,EACrBE,EAAA,CAAUF,CAAAE,QACVD,EAAA,CAAOX,CAAAa,UAAA,CAAkBH,CAAAC,KAAlB,CAAA,CAAkCD,CAAAC,KAAlC,CAAiDN,CACpDL,EAAAc,YAAA,CAAoBL,CAApB,CAAJ,GACEG,CACA,CADU,+BACV,CAAAH,CAAA,CAAQ,EAFV,CAIIT,EAAAe,SAAA,CAAiBH,CAAjB,CAAJ,GACEA,CADF,CACY,IAAII,IAAJ,CAASJ,CAAT,CADZ,CAIIK,EAAAA,CAAMC,kBAAA,CAqB6BV,CArB7B,CAANS,CAAiC,GAAjCA,CAAuCC,kBAAA,CAAmBT,CAAnB,CAE3CQ,EAAA,CADAA,CACA,EADON,CAAA,CAAO,QAAP,CAAkBA,CAAlB,CAAyB,EAChC,GAAOD,CAAAS,OAAA,CAAiB,UAAjB,CAA8BT,CAAAS,OAA9B,CAA+C,EAAtD,CACAF,EAAA,EAAOL,CAAA,CAAU,WAAV,CAAwBA,CAAAQ,YAAA,EAAxB,CAAgD,EACvDH,EAAA,EAAOP,CAAAW,OAAA,CAAiB,SAAjB,CAA6B,EAMhCC,EAAAA,CAAeL,CAAAM,OAAfD,CAA4B,CACb,KAAnB,CAAIA,CAAJ,EACEnB,CAAAqB,KAAA,CAAU,UAAV,CASqChB,CATrC,CACE,6DADF;AAEEc,CAFF,CAEiB,iBAFjB,CASFf,EAAAkB,OAAA,CAJOR,CAG6B,CArCW,CAjQnDjB,CAAA0B,OAAA,CAAe,WAAf,CAA4B,CAAC,IAAD,CAA5B,CAAAC,SAAA,CAOY,UAPZ,CAOwB,CAAaC,QAAyB,EAAG,CAkC7D,IAAIC,EAAW,IAAAA,SAAXA,CAA2B,EAiC/B,KAAAC,KAAA,CAAY,CAAC,gBAAD,CAAmB,gBAAnB,CAAqC,QAAQ,CAACC,CAAD,CAAiBC,CAAjB,CAAiC,CACxF,MAAO,CAWLC,IAAKA,QAAQ,CAACC,CAAD,CAAM,CACjB,MAAOH,EAAA,EAAA,CAAiBG,CAAjB,CADU,CAXd,CAyBLC,UAAWA,QAAQ,CAACD,CAAD,CAAM,CAEvB,MAAO,CADHzB,CACG,CADK,IAAAwB,IAAA,CAASC,CAAT,CACL,EAAQlC,CAAAoC,SAAA,CAAiB3B,CAAjB,CAAR,CAAkCA,CAFlB,CAzBpB,CAuCL4B,OAAQA,QAAQ,EAAG,CACjB,MAAON,EAAA,EADU,CAvCd,CAuDLO,IAAKA,QAAQ,CAACJ,CAAD,CAAMzB,CAAN,CAAaC,CAAb,CAAsB,CACjCsB,CAAA,CAAeE,CAAf,CAAoBzB,CAApB,CAAuCC,CAvFpC,CAAUV,CAAAuC,OAAA,CAAe,EAAf,CAAmBV,CAAnB,CAuF0BnB,CAvF1B,CAAV,CAAkDmB,CAuFrD,CADiC,CAvD9B,CAuELW,UAAWA,QAAQ,CAACN,CAAD,CAAMzB,CAAN,CAAaC,CAAb,CAAsB,CACvC,IAAA4B,IAAA,CAASJ,CAAT,CAAclC,CAAAyC,OAAA,CAAehC,CAAf,CAAd,CAAqCC,CAArC,CADuC,CAvEpC,CAsFLgC,OAAQA,QAAQ,CAACR,CAAD,CAAMxB,CAAN,CAAe,CAC7BsB,CAAA,CAAeE,CAAf,CAAoBS,IAAAA,EAApB,CAA2CjC,CAtHxC,CAAUV,CAAAuC,OAAA,CAAe,EAAf,CAAmBV,CAAnB,CAsH8BnB,CAtH9B,CAAV,CAAkDmB,CAsHrD,CAD6B,CAtF1B,CADiF,CAA9E,CAnEiD,CAAzC,CAPxB,CAwKA7B,EAAA0B,OAAA,CAAe,WAAf,CAAAkB,QAAA,CA+BS,cA/BT;AA+ByB,CAAC,UAAD,CAAa,QAAQ,CAACC,CAAD,CAAW,CAErD,MAAO,CAWLZ,IAAKA,QAAQ,CAACC,CAAD,CAAM,CACjB,MAAOW,EAAAV,UAAA,CAAmBD,CAAnB,CADU,CAXd,CAyBLI,IAAKA,QAAQ,CAACJ,CAAD,CAAMzB,CAAN,CAAa,CACxBoC,CAAAL,UAAA,CAAmBN,CAAnB,CAAwBzB,CAAxB,CADwB,CAzBrB,CAsCLiC,OAAQA,QAAQ,CAACR,CAAD,CAAM,CACpBW,CAAAH,OAAA,CAAgBR,CAAhB,CADoB,CAtCjB,CAF8C,CAAhC,CA/BzB,CAmIAjC,EAAA6C,QAAA,CAAyB,CAAC,WAAD,CAAc,MAAd,CAAsB,UAAtB,CAEzB9C,EAAA0B,OAAA,CAAe,WAAf,CAAAC,SAAA,CAAqC,gBAArC,CAAoEoB,QAA+B,EAAG,CACpG,IAAAjB,KAAA,CAAY7B,CADwF,CAAtG,CA/T2B,CAA1B,CAAD,CAoUGF,MApUH,CAoUWA,MAAAC,QApUX;",
"sources":["angular-cookies.js"],
"names":["window","angular","$$CookieWriter","$document","$log","$browser","cookiePath","baseHref","rawDocument","name","value","options","path","expires","isDefined","isUndefined","isString","Date","str","encodeURIComponent","domain","toUTCString","secure","cookieLength","length","warn","cookie","module","provider","$CookiesProvider","defaults","$get","$$cookieReader","$$cookieWriter","get","key","getObject","fromJson","getAll","put","extend","putObject","toJson","remove","undefined","factory","$cookies","$inject","$$CookieWriterProvider"]
}
{
"name": "angular-cookies",
"version": "1.6.1",
"license": "MIT",
"main": "./angular-cookies.js",
"ignore": [],
"dependencies": {
"angular": "1.6.1"
}
}
require('./angular-cookies');
module.exports = 'ngCookies';
{
"name": "angular-cookies",
"version": "1.6.1",
"description": "AngularJS module for cookies",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "https://github.com/angular/angular.js.git"
},
"keywords": [
"angular",
"framework",
"browser",
"cookies",
"client-side"
],
"author": "Angular Core Team <angular-core+npm@google.com>",
"license": "MIT",
"bugs": {
"url": "https://github.com/angular/angular.js/issues"
},
"homepage": "http://angularjs.org",
"jspm": {
"shim": {
"angular-cookies": {
"deps": ["angular"]
}
}
}
}
{
"name": "angular-elastic",
"version": "2.5.1",
"main": "elastic.js",
"ignore": [
"**/.*",
"node_modules",
"components"
],
"dependencies": {
"angular": ">=1.0.6"
},
"homepage": "https://github.com/monospaced/angular-elastic",
"_release": "2.5.1",
"_resolution": {
"type": "version",
"tag": "v2.5.1",
"commit": "4c2c75e413e668b4117bf2b3741272b2ab9e24c5"
},
"_source": "https://github.com/monospaced/angular-elastic.git",
"_target": "~2.5.0",
"_originalSource": "angular-elastic"
}
\ No newline at end of file
The MIT License (MIT)
Copyright (c) 2014 Monospaced
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
\ No newline at end of file
Angular Elastic
===============
Elastic (autosize) textareas for AngularJS, without jQuery dependency.
[See it in action](http://monospaced.github.io/angular-elastic).
Usage
-----
as attribute
<textarea msd-elastic ng-model="foo">
...
</textarea>
as class
<textarea class="msd-elastic" ng-model="bar">
...
</textarea>
optionally append whitespace to the end of the height calculation (an extra newline improves the apperance when animating)
<textarea msd-elastic="\n" ng-model="foo">
...
</textarea>
<textarea class="msd-elastic: \n;" ng-model="bar">
...
</textarea>
or configure whitespace globally
app.config(['msdElasticConfig', function(msdElasticConfig) {
msdElasticConfig.append = '\n';
}])
the directive also emits an `elastic:resize` event which you can listen for
$scope.$on('elastic:resize', function(event, element, oldHeight, newHeight) {
// do stuff
});
Single line textareas
--------------
Set the `rows` attribute to `1`, as browsers default to `2`.
<textarea rows="1" msd-elastic ng-model="foo">
...
</textarea>
Install
-------
bower install angular-elastic
npm install angular-elastic
Include the `elastic.js` script provided by this component in your app.
Make sure to add `monospaced.elastic` to your app’s module dependencies.
```
angular
.module('yourApp', [
'monospaced.elastic'
]);
````
Support
-------
__Modern browsers__ only—Internet Explorer 6, 7 & 8 retain their default textarea behaviour.
Demo
----------------
* [monospaced.github.io/angular-elastic](http://monospaced.github.io/angular-elastic)
* [plunker](http://plnkr.co/edit/9y6YLriAwsK9hqdu72WT?p=preview)
How it works
------------
By creating a hidden textarea that mirrors the textarea to which the directive was applied, Angular Elastic can measure the required height and adjust the textarea accordingly. Adjustments are done on:
* Keystroke events
* Window resize events
* Model changes
This works well in most cases with no additional code required other than described in the Usage section above. However, it may occur that the adjustment must be invoked manually at a time that is not covered by the events listed above. E.g. textareas with the style `display: none;` may not have a valid width in Safari which produces incorrect adjustments. In this case the adjustment needs to be invoked once these textareas become visible. For that Angular Elastic listens to the `elastic:adjust` event on its scope. To invoke the adjustment for all textareas covered by Angular Elastic use:
$rootScope.$broadcast('elastic:adjust');
Inspiration
----------------
* [jQuery Autosize](http://www.jacklmoore.com/autosize/)
* [jQuery Elastic](http://unwrongest.com/projects/elastic/)
{
"name": "angular-elastic",
"version": "2.5.1",
"main": "elastic.js",
"ignore": [
"**/.*",
"node_modules",
"components"
],
"dependencies": {
"angular": ">=1.0.6"
}
}
\ No newline at end of file
/*
* angular-elastic v2.5.1
* (c) 2014 Monospaced http://monospaced.com
* License: MIT
*/
if (typeof module !== 'undefined' &&
typeof exports !== 'undefined' &&
module.exports === exports){
module.exports = 'monospaced.elastic';
}
angular.module('monospaced.elastic', [])
.constant('msdElasticConfig', {
append: ''
})
.directive('msdElastic', [
'$timeout', '$window', 'msdElasticConfig',
function($timeout, $window, config) {
'use strict';
return {
require: 'ngModel',
restrict: 'A, C',
link: function(scope, element, attrs, ngModel) {
// cache a reference to the DOM element
var ta = element[0],
$ta = element;
// ensure the element is a textarea, and browser is capable
if (ta.nodeName !== 'TEXTAREA' || !$window.getComputedStyle) {
return;
}
// set these properties before measuring dimensions
$ta.css({
'overflow': 'hidden',
'overflow-y': 'hidden',
'word-wrap': 'break-word'
});
// force text reflow
var text = ta.value;
ta.value = '';
ta.value = text;
var append = attrs.msdElastic ? attrs.msdElastic.replace(/\\n/g, '\n') : config.append,
$win = angular.element($window),
mirrorInitStyle = 'position: absolute; top: -999px; right: auto; bottom: auto;' +
'left: 0; overflow: hidden; -webkit-box-sizing: content-box;' +
'-moz-box-sizing: content-box; box-sizing: content-box;' +
'min-height: 0 !important; height: 0 !important; padding: 0;' +
'word-wrap: break-word; border: 0;',
$mirror = angular.element('<textarea aria-hidden="true" tabindex="-1" ' +
'style="' + mirrorInitStyle + '"/>').data('elastic', true),
mirror = $mirror[0],
taStyle = getComputedStyle(ta),
resize = taStyle.getPropertyValue('resize'),
borderBox = taStyle.getPropertyValue('box-sizing') === 'border-box' ||
taStyle.getPropertyValue('-moz-box-sizing') === 'border-box' ||
taStyle.getPropertyValue('-webkit-box-sizing') === 'border-box',
boxOuter = !borderBox ? {width: 0, height: 0} : {
width: parseInt(taStyle.getPropertyValue('border-right-width'), 10) +
parseInt(taStyle.getPropertyValue('padding-right'), 10) +
parseInt(taStyle.getPropertyValue('padding-left'), 10) +
parseInt(taStyle.getPropertyValue('border-left-width'), 10),
height: parseInt(taStyle.getPropertyValue('border-top-width'), 10) +
parseInt(taStyle.getPropertyValue('padding-top'), 10) +
parseInt(taStyle.getPropertyValue('padding-bottom'), 10) +
parseInt(taStyle.getPropertyValue('border-bottom-width'), 10)
},
minHeightValue = parseInt(taStyle.getPropertyValue('min-height'), 10),
heightValue = parseInt(taStyle.getPropertyValue('height'), 10),
minHeight = Math.max(minHeightValue, heightValue) - boxOuter.height,
maxHeight = parseInt(taStyle.getPropertyValue('max-height'), 10),
mirrored,
active,
copyStyle = ['font-family',
'font-size',
'font-weight',
'font-style',
'letter-spacing',
'line-height',
'text-transform',
'word-spacing',
'text-indent'];
// exit if elastic already applied (or is the mirror element)
if ($ta.data('elastic')) {
return;
}
// Opera returns max-height of -1 if not set
maxHeight = maxHeight && maxHeight > 0 ? maxHeight : 9e4;
// append mirror to the DOM
if (mirror.parentNode !== document.body) {
angular.element(document.body).append(mirror);
}
// set resize and apply elastic
$ta.css({
'resize': (resize === 'none' || resize === 'vertical') ? 'none' : 'horizontal'
}).data('elastic', true);
/*
* methods
*/
function initMirror() {
var mirrorStyle = mirrorInitStyle;
mirrored = ta;
// copy the essential styles from the textarea to the mirror
taStyle = getComputedStyle(ta);
angular.forEach(copyStyle, function(val) {
mirrorStyle += val + ':' + taStyle.getPropertyValue(val) + ';';
});
mirror.setAttribute('style', mirrorStyle);
}
function adjust() {
var taHeight,
taComputedStyleWidth,
mirrorHeight,
width,
overflow;
if (mirrored !== ta) {
initMirror();
}
// active flag prevents actions in function from calling adjust again
if (!active) {
active = true;
mirror.value = ta.value + append; // optional whitespace to improve animation
mirror.style.overflowY = ta.style.overflowY;
taHeight = ta.style.height === '' ? 'auto' : parseInt(ta.style.height, 10);
taComputedStyleWidth = getComputedStyle(ta).getPropertyValue('width');
// ensure getComputedStyle has returned a readable 'used value' pixel width
if (taComputedStyleWidth.substr(taComputedStyleWidth.length - 2, 2) === 'px') {
// update mirror width in case the textarea width has changed
width = parseInt(taComputedStyleWidth, 10) - boxOuter.width;
mirror.style.width = width + 'px';
}
mirrorHeight = mirror.scrollHeight;
if (mirrorHeight > maxHeight) {
mirrorHeight = maxHeight;
overflow = 'scroll';
} else if (mirrorHeight < minHeight) {
mirrorHeight = minHeight;
}
mirrorHeight += boxOuter.height;
ta.style.overflowY = overflow || 'hidden';
if (taHeight !== mirrorHeight) {
scope.$emit('elastic:resize', $ta, taHeight, mirrorHeight);
ta.style.height = mirrorHeight + 'px';
}
// small delay to prevent an infinite loop
$timeout(function() {
active = false;
}, 1, false);
}
}
function forceAdjust() {
active = false;
adjust();
}
/*
* initialise
*/
// listen
if ('onpropertychange' in ta && 'oninput' in ta) {
// IE9
ta['oninput'] = ta.onkeyup = adjust;
} else {
ta['oninput'] = adjust;
}
$win.bind('resize', forceAdjust);
scope.$watch(function() {
return ngModel.$modelValue;
}, function(newValue) {
forceAdjust();
});
scope.$on('elastic:adjust', function() {
initMirror();
forceAdjust();
});
$timeout(adjust, 0, false);
/*
* destroy
*/
scope.$on('$destroy', function() {
$mirror.remove();
$win.unbind('resize', forceAdjust);
});
}
};
}
]);
<!DOCTYPE html>
<html lang="en-gb" data-ng-app="elasticDemo" id="ng-app">
<head>
<meta charset="utf-8">
<title>Angular Elastic</title>
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="//necolas.github.io/normalize.css/2.1.1/normalize.css">
<style>
html {
background: #e7f3ff;
color: #1c000e;
text-shadow: 0 1px 0 #fff;
}
body {
margin: 8px auto;
max-width: 90%;
width: 480px;
}
h1 {
margin: 0 0 8px;
font-weight: normal;
font-size: 30px;
}
a {
color: #0074e7;
text-decoration: none;
-webkit-transition: all 250ms ease-in-out;
-moz-transition: all 250ms ease-in-out;
-o-transition: all 250ms ease-in-out;
transition: all 250ms ease-in-out;
}
a:hover,
a:focus,
a:active {
color: #0067ce;
-webkit-transition: none;
-moz-transition: none;
-o-transition: none;
transition: none;
}
textarea {
padding: 10px;
width: 300px;
max-width: 90%;
}
.animate:focus {
-webkit-transition: height 50ms ease-in-out;
-moz-transition: height 50ms ease-in-out;
-o-transition: height 50ms ease-in-out;
transition: height 50ms ease-in-out;
}
.msd-elastic {
max-height: 400px;
}
#first {
font-size: 30px;
}
</style>
</head>
<body data-ng-controller="elasticDemoController">
<h1>Angular Elastic</h1>
<form data-ng-submit="submit()">
<p>
<textarea class="msd-elastic" data-ng-model="foo" id="first" data-ng-show="show" data-ng-controller="elasticCallbackController"></textarea>
</p>
<small data-ng-show="show"><a href data-ng-click="show = false">Hide</a> | </small>
<small data-ng-show="!show"><a href data-ng-click="show = true">Show</a> | </small>
<small><a href data-ng-click="foo = 'Model changed'">Change model</a></small>
<p>
<textarea class="animate msd-elastic: \n;" data-ng-model="bar"></textarea>
</p>
<p>
<input type="submit" value="Submit and reset">
</p>
</form>
<small>
<a href="https://github.com/monospaced/angular-elastic">https://github.com/monospaced/angular-elastic</a> <br>
<a href="http://monospaced.github.io/">Monospaced Labs</a>
</small>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.6/angular.min.js"></script>
<script src="elastic.js"></script>
<script>
angular.module('elasticDemo', ['monospaced.elastic'])
.controller('elasticDemoController', ['$scope', '$log', function($scope, $log){
'use strict';
$scope.foo = 'This textarea is going to grow when you fill it with text. Just type a few more words in it and you will see. This textarea is going to grow when you fill it with text.';
$scope.bar = 'Elastic with a CSS transition. Try typing something...';
$scope.submit = function(){
$scope.bar = '';
};
$scope.show = true;
}])
.controller('elasticCallbackController', ['$scope', '$log', function($scope, $log){
'use strict';
$scope.$on('elastic:resize', function(){
$log.log('Height was adjusted!');
});
}]);
</script>
</body>
</html>
\ No newline at end of file
{
"name": "angular-elastic",
"version": "2.5.1",
"description": "Elastic (autosize) textareas for AngularJS, without jQuery dependency.",
"keywords": [
"angular",
"angularjs",
"textarea",
"elastic",
"autosize"
],
"homepage": "http://monospaced.github.io/angular-elastic/",
"main": "elastic",
"bugs": "http://github.com/monospaced/angular-elastic/issues",
"license" : "MIT",
"repository" : {
"type" : "git",
"url" : "http://github.com/monospaced/angular-elastic"
},
"author": {
"name" : "Scott Boyle",
"email" : "scott@monospaced.com",
"url" : "http://scottboyle.co.uk/about"
},
"files": [
"elastic.js",
"package.json"
],
"dependencies": {
"angular": ">=1.0.6"
}
}
\ No newline at end of file
{
"name": "angular-file-upload",
"main": "dist/angular-file-upload.min.js",
"homepage": "https://github.com/nervgh/angular-file-upload",
"ignore": [
"examples"
],
"dependencies": {
"angular": "^1.1.5"
},
"devDependencies": {
"es5-shim": ">=3.4.0"
},
"keywords": [
"angular",
"file",
"upload",
"module"
],
"version": "2.1.4",
"_release": "2.1.4",
"_resolution": {
"type": "version",
"tag": "v2.1.4",
"commit": "888127c60b2946196784a3af474931ae48a8afca"
},
"_source": "https://github.com/nervgh/angular-file-upload.git",
"_target": "~2.1.0",
"_originalSource": "angular-file-upload"
}
\ No newline at end of file
.temp
.idea
*.iml
node_modules
bower_components
{
"camelcase" : true,
"indent": 4,
"strict": true,
"undef": true,
"unused": true,
"quotmark": "single",
"maxlen": 120,
"trailing": true,
"curly": true,
"devel": true,
"browser":true,
"jquery":true,
"predef": [
"angular",
"define",
"require",
"app"
]
}
\ No newline at end of file
# Angular File Upload
---
## About
**Angular File Upload** is a module for the [AngularJS](http://angularjs.org/) framework. Supports drag-n-drop upload, upload progress, validation filters and a file upload queue. It supports native HTML5 uploads, but degrades to a legacy iframe upload method for older browsers. Works with any server side platform which supports standard HTML form uploads.
When files are selected or dropped into the component, one or more filters are applied. Files which pass all filters are added to the queue. When file is added to the queue, for him is created instance of `{FileItem}` and uploader options are copied into this object. After, items in the queue (FileItems) are ready for uploading.
## Package managers
### Bower
```
bower install angular-file-upload
```
You could find this module in bower like [_angular file upload_](http://bower.io/search/?q=angular%20file%20upload).
### NPM
```
npm install angular-file-upload
```
You could find this module in npm like [_angular file upload_](https://www.npmjs.com/search?q=angular%20file%20upload).
## Demos
1. [Simple example](http://nervgh.github.io/pages/angular-file-upload/examples/simple)
2. [Uploads only images (with canvas preview)](http://nervgh.github.io/pages/angular-file-upload/examples/image-preview)
3. [Without bootstrap example](http://nervgh.github.io/pages/angular-file-upload/examples/without-bootstrap)
## More Info
1. [Introduction](https://github.com/nervgh/angular-file-upload/wiki/Introduction)
2. [Module API](https://github.com/nervgh/angular-file-upload/wiki/Module-API)
3. [FAQ](https://github.com/nervgh/angular-file-upload/wiki/FAQ)
4. [Migrate from 0.x.x to 1.x.x](https://github.com/nervgh/angular-file-upload/wiki/Migrate-from-0.x.x-to-1.x.x)
5. [RubyGem](https://github.com/marthyn/angularjs-file-upload-rails)
{
"name": "angular-file-upload",
"main": "dist/angular-file-upload.min.js",
"homepage": "https://github.com/nervgh/angular-file-upload",
"ignore": ["examples"],
"dependencies": {
"angular": "^1.1.5"
},
"devDependencies": {
"es5-shim": ">=3.4.0"
},
"keywords": [
"angular",
"file",
"upload",
"module"
]
}
This source diff could not be displayed because it is too large. You can view the blob instead.
var pkg = require('./package.json');
// https://github.com/gulpjs/gulp/blob/master/docs/README.md
var gulp = require('gulp');
// http://webpack.github.io/docs/
var webpack = require('webpack');
// https://github.com/shama/webpack-stream
var webpackStream = require('webpack-stream');
gulp.task(
pkg.name + '/build',
function() {
return gulp
.src('./src/index.js')
.pipe(webpackStream({
module: {
loaders: [
// https://github.com/babel/babel-loader
{test: /\.js$/, loader: 'babel'},
// https://github.com/webpack/json-loader
{test: /\.json$/, loader: 'json'},
// https://github.com/webpack/html-loader
{test: /\.html$/, loader: 'html'}
]
},
plugins: [
// http://webpack.github.io/docs/list-of-plugins.html#uglifyjsplugin
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
}
}),
// http://webpack.github.io/docs/list-of-plugins.html#bannerplugin
new webpack.BannerPlugin(
'/*\n' +
' ' + pkg.name + ' v' + pkg.version + '\n' +
' ' + pkg.homepage + '\n' +
'*/\n'
, {
entryOnly: true,
raw: true
})
],
devtool: 'source-map',
debug: true,
output: {
library: pkg.name,
libraryTarget: 'umd',
filename: pkg.name + '.min.js'
}
}))
.pipe(gulp.dest('./dist'));
}
);
gulp.task(
pkg.name + '/watch', function() {
return gulp
.watch(
[
'./src/**/*.js',
'./src/**/*.json',
'./src/**/*.html'
],
[
pkg.name + '/build'
]
);
}
);
The MIT License
Copyright (c) 2013 nerv. https://github.com/nervgh
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
{
"name": "angular-file-upload",
"version": "2.1.4",
"homepage": "https://github.com/nervgh/angular-file-upload",
"description": "Angular File Upload is a module for the AngularJS framework",
"author": {
"name": "nerv",
"url": "https://github.com/nervgh"
},
"main": "dist/angular-file-upload.min.js",
"devDependencies": {
"babel": "^4.7.16",
"babel-loader": "^4.0.0",
"json-loader": "^0.5.1",
"html-loader": "^0.2.3",
"gulp": "^3.9.0",
"webpack": "^1.10.1",
"webpack-stream": "^2.0.0"
}
}
{
"name": "angularFileUpload"
}
\ No newline at end of file
'use strict';
import CONFIG from './../config.json';
export default ($parse, FileUploader, FileDrop) => {
return {
link: (scope, element, attributes) => {
var uploader = scope.$eval(attributes.uploader);
if (!(uploader instanceof FileUploader)) {
throw new TypeError('"Uploader" must be an instance of FileUploader');
}
if (!uploader.isHTML5) return;
var object = new FileDrop({
uploader: uploader,
element: element
});
object.getOptions = $parse(attributes.options).bind(object, scope);
object.getFilters = () => attributes.filters;
}
};
}
module.exports.$inject = [
'$parse',
'FileUploader',
'FileDrop'
];
\ No newline at end of file
'use strict';
import CONFIG from './../config.json';
export default (FileUploader, FileOver) => {
return {
link: (scope, element, attributes) => {
var uploader = scope.$eval(attributes.uploader);
if (!(uploader instanceof FileUploader)) {
throw new TypeError('"Uploader" must be an instance of FileUploader');
}
var object = new FileOver({
uploader: uploader,
element: element
});
object.getOverClass = () => attributes.overClass || object.overClass;
}
};
}
module.exports.$inject = [
'FileUploader',
'FileOver'
];
\ No newline at end of file
'use strict';
import CONFIG from './../config.json';
export default ($parse, FileUploader, FileSelect) => {
return {
link: (scope, element, attributes) => {
var uploader = scope.$eval(attributes.uploader);
if (!(uploader instanceof FileUploader)) {
throw new TypeError('"Uploader" must be an instance of FileUploader');
}
var object = new FileSelect({
uploader: uploader,
element: element
});
object.getOptions = $parse(attributes.options).bind(object, scope);
object.getFilters = () => attributes.filters;
}
};
}
module.exports.$inject = [
'$parse',
'FileUploader',
'FileSelect'
];
\ No newline at end of file
'use strict';
import CONFIG from './config.json';
import options from './values/options'
import serviceFileUploader from './services/FileUploader';
import serviceFileLikeObject from './services/FileLikeObject';
import serviceFileItem from './services/FileItem';
import serviceFileDirective from './services/FileDirective';
import serviceFileSelect from './services/FileSelect';
import serviceFileDrop from './services/FileDrop';
import serviceFileOver from './services/FileOver';
import directiveFileSelect from './directives/FileSelect';
import directiveFileDrop from './directives/FileDrop';
import directiveFileOver from './directives/FileOver';
angular
.module(CONFIG.name, [])
.value('fileUploaderOptions', options)
.factory('FileUploader', serviceFileUploader)
.factory('FileLikeObject', serviceFileLikeObject)
.factory('FileItem', serviceFileItem)
.factory('FileDirective', serviceFileDirective)
.factory('FileSelect', serviceFileSelect)
.factory('FileDrop', serviceFileDrop)
.factory('FileOver', serviceFileOver)
.directive('nvFileSelect', directiveFileSelect)
.directive('nvFileDrop', directiveFileDrop)
.directive('nvFileOver', directiveFileOver)
.run([
'FileUploader',
'FileLikeObject',
'FileItem',
'FileDirective',
'FileSelect',
'FileDrop',
'FileOver',
function(FileUploader, FileLikeObject, FileItem, FileDirective, FileSelect, FileDrop, FileOver) {
// only for compatibility
FileUploader.FileLikeObject = FileLikeObject;
FileUploader.FileItem = FileItem;
FileUploader.FileDirective = FileDirective;
FileUploader.FileSelect = FileSelect;
FileUploader.FileDrop = FileDrop;
FileUploader.FileOver = FileOver;
}
]);
'use strict';
import CONFIG from './../config.json';
let {
extend
} = angular;
export default () => {
class FileDirective {
/**
* Creates instance of {FileDirective} object
* @param {Object} options
* @param {Object} options.uploader
* @param {HTMLElement} options.element
* @param {Object} options.events
* @param {String} options.prop
* @constructor
*/
constructor(options) {
extend(this, options);
this.uploader._directives[this.prop].push(this);
this._saveLinks();
this.bind();
}
/**
* Binds events handles
*/
bind() {
for(var key in this.events) {
var prop = this.events[key];
this.element.bind(key, this[prop]);
}
}
/**
* Unbinds events handles
*/
unbind() {
for(var key in this.events) {
this.element.unbind(key, this.events[key]);
}
}
/**
* Destroys directive
*/
destroy() {
var index = this.uploader._directives[this.prop].indexOf(this);
this.uploader._directives[this.prop].splice(index, 1);
this.unbind();
// this.element = null;
}
/**
* Saves links to functions
* @private
*/
_saveLinks() {
for(var key in this.events) {
var prop = this.events[key];
this[prop] = this[prop].bind(this);
}
}
}
/**
* Map of events
* @type {Object}
*/
FileDirective.prototype.events = {};
return FileDirective;
}
module.exports.$inject = [
];
\ No newline at end of file
'use strict';
import CONFIG from './../config.json';
let {
extend,
forEach
} = angular;
export default (FileDirective) => {
class FileDrop extends FileDirective {
/**
* Creates instance of {FileDrop} object
* @param {Object} options
* @constructor
*/
constructor(options) {
let extendedOptions = extend(options, {
// Map of events
events: {
$destroy: 'destroy',
drop: 'onDrop',
dragover: 'onDragOver',
dragleave: 'onDragLeave'
},
// Name of property inside uploader._directive object
prop: 'drop'
});
super(extendedOptions);
}
/**
* Returns options
* @return {Object|undefined}
*/
getOptions() {
}
/**
* Returns filters
* @return {Array<Function>|String|undefined}
*/
getFilters() {
}
/**
* Event handler
*/
onDrop(event) {
var transfer = this._getTransfer(event);
if(!transfer) return;
var options = this.getOptions();
var filters = this.getFilters();
this._preventAndStop(event);
forEach(this.uploader._directives.over, this._removeOverClass, this);
this.uploader.addToQueue(transfer.files, options, filters);
}
/**
* Event handler
*/
onDragOver(event) {
var transfer = this._getTransfer(event);
if(!this._haveFiles(transfer.types)) return;
transfer.dropEffect = 'copy';
this._preventAndStop(event);
forEach(this.uploader._directives.over, this._addOverClass, this);
}
/**
* Event handler
*/
onDragLeave(event) {
if(event.currentTarget === this.element[0]) return;
this._preventAndStop(event);
forEach(this.uploader._directives.over, this._removeOverClass, this);
}
/**
* Helper
*/
_getTransfer(event) {
return event.dataTransfer ? event.dataTransfer : event.originalEvent.dataTransfer; // jQuery fix;
}
/**
* Helper
*/
_preventAndStop(event) {
event.preventDefault();
event.stopPropagation();
}
/**
* Returns "true" if types contains files
* @param {Object} types
*/
_haveFiles(types) {
if(!types) return false;
if(types.indexOf) {
return types.indexOf('Files') !== -1;
} else if(types.contains) {
return types.contains('Files');
} else {
return false;
}
}
/**
* Callback
*/
_addOverClass(item) {
item.addOverClass();
}
/**
* Callback
*/
_removeOverClass(item) {
item.removeOverClass();
}
}
return FileDrop;
}
module.exports.$inject = [
'FileDirective'
];
\ No newline at end of file
'use strict';
import CONFIG from './../config.json';
let {
copy,
extend,
element,
isElement
} = angular;
export default ($compile, FileLikeObject) => {
class FileItem {
/**
* Creates an instance of FileItem
* @param {FileUploader} uploader
* @param {File|HTMLInputElement|Object} some
* @param {Object} options
* @constructor
*/
constructor(uploader, some, options) {
var isInput = isElement(some);
var input = isInput ? element(some) : null;
var file = !isInput ? some : null;
extend(this, {
url: uploader.url,
alias: uploader.alias,
headers: copy(uploader.headers),
formData: copy(uploader.formData),
removeAfterUpload: uploader.removeAfterUpload,
withCredentials: uploader.withCredentials,
method: uploader.method
}, options, {
uploader: uploader,
file: new FileLikeObject(some),
isReady: false,
isUploading: false,
isUploaded: false,
isSuccess: false,
isCancel: false,
isError: false,
progress: 0,
index: null,
_file: file,
_input: input
});
if (input) this._replaceNode(input);
}
/**********************
* PUBLIC
**********************/
/**
* Uploads a FileItem
*/
upload() {
try {
this.uploader.uploadItem(this);
} catch(e) {
this.uploader._onCompleteItem(this, '', 0, []);
this.uploader._onErrorItem(this, '', 0, []);
}
}
/**
* Cancels uploading of FileItem
*/
cancel() {
this.uploader.cancelItem(this);
}
/**
* Removes a FileItem
*/
remove() {
this.uploader.removeFromQueue(this);
}
/**
* Callback
* @private
*/
onBeforeUpload() {
}
/**
* Callback
* @param {Number} progress
* @private
*/
onProgress(progress) {
}
/**
* Callback
* @param {*} response
* @param {Number} status
* @param {Object} headers
*/
onSuccess(response, status, headers) {
}
/**
* Callback
* @param {*} response
* @param {Number} status
* @param {Object} headers
*/
onError(response, status, headers) {
}
/**
* Callback
* @param {*} response
* @param {Number} status
* @param {Object} headers
*/
onCancel(response, status, headers) {
}
/**
* Callback
* @param {*} response
* @param {Number} status
* @param {Object} headers
*/
onComplete(response, status, headers) {
}
/**********************
* PRIVATE
**********************/
/**
* Inner callback
*/
_onBeforeUpload() {
this.isReady = true;
this.isUploading = true;
this.isUploaded = false;
this.isSuccess = false;
this.isCancel = false;
this.isError = false;
this.progress = 0;
this.onBeforeUpload();
}
/**
* Inner callback
* @param {Number} progress
* @private
*/
_onProgress(progress) {
this.progress = progress;
this.onProgress(progress);
}
/**
* Inner callback
* @param {*} response
* @param {Number} status
* @param {Object} headers
* @private
*/
_onSuccess(response, status, headers) {
this.isReady = false;
this.isUploading = false;
this.isUploaded = true;
this.isSuccess = true;
this.isCancel = false;
this.isError = false;
this.progress = 100;
this.index = null;
this.onSuccess(response, status, headers);
}
/**
* Inner callback
* @param {*} response
* @param {Number} status
* @param {Object} headers
* @private
*/
_onError(response, status, headers) {
this.isReady = false;
this.isUploading = false;
this.isUploaded = true;
this.isSuccess = false;
this.isCancel = false;
this.isError = true;
this.progress = 0;
this.index = null;
this.onError(response, status, headers);
}
/**
* Inner callback
* @param {*} response
* @param {Number} status
* @param {Object} headers
* @private
*/
_onCancel(response, status, headers) {
this.isReady = false;
this.isUploading = false;
this.isUploaded = false;
this.isSuccess = false;
this.isCancel = true;
this.isError = false;
this.progress = 0;
this.index = null;
this.onCancel(response, status, headers);
}
/**
* Inner callback
* @param {*} response
* @param {Number} status
* @param {Object} headers
* @private
*/
_onComplete(response, status, headers) {
this.onComplete(response, status, headers);
if(this.removeAfterUpload) this.remove();
}
/**
* Destroys a FileItem
*/
_destroy() {
if(this._input) this._input.remove();
if(this._form) this._form.remove();
delete this._form;
delete this._input;
}
/**
* Prepares to uploading
* @private
*/
_prepareToUploading() {
this.index = this.index || ++this.uploader._nextIndex;
this.isReady = true;
}
/**
* Replaces input element on his clone
* @param {JQLite|jQuery} input
* @private
*/
_replaceNode(input) {
var clone = $compile(input.clone())(input.scope());
clone.prop('value', null); // FF fix
input.css('display', 'none');
input.after(clone); // remove jquery dependency
}
}
return FileItem;
}
module.exports.$inject = [
'$compile',
'FileLikeObject'
];
\ No newline at end of file
'use strict';
import CONFIG from './../config.json';
let {
copy,
isElement,
isString
} = angular;
export default () => {
class FileLikeObject {
/**
* Creates an instance of FileLikeObject
* @param {File|HTMLInputElement|Object} fileOrInput
* @constructor
*/
constructor(fileOrInput) {
var isInput = isElement(fileOrInput);
var fakePathOrObject = isInput ? fileOrInput.value : fileOrInput;
var postfix = isString(fakePathOrObject) ? 'FakePath' : 'Object';
var method = '_createFrom' + postfix;
this[method](fakePathOrObject);
}
/**
* Creates file like object from fake path string
* @param {String} path
* @private
*/
_createFromFakePath(path) {
this.lastModifiedDate = null;
this.size = null;
this.type = 'like/' + path.slice(path.lastIndexOf('.') + 1).toLowerCase();
this.name = path.slice(path.lastIndexOf('/') + path.lastIndexOf('\\') + 2);
}
/**
* Creates file like object from object
* @param {File|FileLikeObject} object
* @private
*/
_createFromObject(object) {
this.lastModifiedDate = copy(object.lastModifiedDate);
this.size = object.size;
this.type = object.type;
this.name = object.name;
}
}
return FileLikeObject;
}
module.exports.$inject = [
];
\ No newline at end of file
'use strict';
import CONFIG from './../config.json';
let {
extend
} = angular;
export default (FileDirective) => {
class FileOver extends FileDirective {
/**
* Creates instance of {FileDrop} object
* @param {Object} options
* @constructor
*/
constructor(options) {
let extendedOptions = extend(options, {
// Map of events
events: {
$destroy: 'destroy'
},
// Name of property inside uploader._directive object
prop: 'over',
// Over class
overClass: 'nv-file-over'
});
super(extendedOptions);
}
/**
* Adds over class
*/
addOverClass() {
this.element.addClass(this.getOverClass());
}
/**
* Removes over class
*/
removeOverClass() {
this.element.removeClass(this.getOverClass());
}
/**
* Returns over class
* @returns {String}
*/
getOverClass() {
return this.overClass;
}
}
return FileOver;
}
module.exports.$inject = [
'FileDirective'
];
\ No newline at end of file
'use strict';
import CONFIG from './../config.json';
let {
extend
} = angular;
export default (FileDirective) => {
class FileSelect extends FileDirective {
/**
* Creates instance of {FileSelect} object
* @param {Object} options
* @constructor
*/
constructor(options) {
let extendedOptions = extend(options, {
// Map of events
events: {
$destroy: 'destroy',
change: 'onChange'
},
// Name of property inside uploader._directive object
prop: 'select'
});
super(extendedOptions);
if(!this.uploader.isHTML5) {
this.element.removeAttr('multiple');
}
this.element.prop('value', null); // FF fix
}
/**
* Returns options
* @return {Object|undefined}
*/
getOptions() {
}
/**
* Returns filters
* @return {Array<Function>|String|undefined}
*/
getFilters() {
}
/**
* If returns "true" then HTMLInputElement will be cleared
* @returns {Boolean}
*/
isEmptyAfterSelection() {
return !!this.element.attr('multiple');
}
/**
* Event handler
*/
onChange() {
var files = this.uploader.isHTML5 ? this.element[0].files : this.element[0];
var options = this.getOptions();
var filters = this.getFilters();
if(!this.uploader.isHTML5) this.destroy();
this.uploader.addToQueue(files, options, filters);
if(this.isEmptyAfterSelection()) {
this.element.prop('value', null);
this.element.replaceWith(this.element = this.element.clone(true)); // IE fix
}
}
}
return FileSelect;
}
module.exports.$inject = [
'FileDirective'
];
'use strict';
export default {
url: '/',
alias: 'file',
headers: {},
queue: [],
progress: 0,
autoUpload: false,
removeAfterUpload: false,
method: 'POST',
filters: [],
formData: [],
queueLimit: Number.MAX_VALUE,
withCredentials: false
};
\ No newline at end of file
{
"name": "angular-promise-buttons",
"description": "Fabulous helper to help you with your daily form coding.",
"version": "0.1.19",
"authors": [
"Johannes Millan <johannes.millan@gmail.com>"
],
"repository": {
"type": "git",
"url": "https://github.com/johannesjo/angular-promise-buttons.git"
},
"homepage": "http://johannesjo.github.io/angular-promise-buttons/",
"license": "LGPL-2.1",
"main": "dist/angular-promise-buttons.js",
"keywords": [
"angular",
"AngularJS",
"form",
"forms",
"form helper",
"buttons",
"button",
"loading-button"
],
"ignore": [
"gh-pages",
"node_modules",
"bower_components",
"test",
"tests"
],
"dependencies": {
"angular": ">=1.3.0 <2.0.0"
},
"devDependencies": {
"angular-animate": ">=1.3.0 <2.0.0",
"angular-mocks": ">=1.3.0 <2.0.0"
},
"_release": "0.1.19",
"_resolution": {
"type": "version",
"tag": "v0.1.19",
"commit": "9660e6c5d32eb14a45b467768e71c4c5273d4fe7"
},
"_source": "https://github.com/johannesjo/angular-promise-buttons.git",
"_target": "~0.1.6",
"_originalSource": "angular-promise-buttons"
}
\ No newline at end of file
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# editorconfig.org
root = true
[*]
# Change these settings to your own preference
indent_style = space
indent_size = 4
# We recommend you to keep these unchanged
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.md]
trim_trailing_whitespace = false
node_modules
.tmp
.sass-cache
.grunt
bower_components
dist/example
.idea/
*.DS_*
npm-debug.log
coverage
{
"newcap": false,
"eqeqeq": false,
"node": true,
"browser": true,
"esnext": true,
"bitwise": true,
"camelcase": true,
"boss": true,
"curly": true,
"immed": true,
"indent": 4,
"latedef": true,
"noarg": true,
"quotmark": "single",
"regexp": true,
"undef": true,
"unused": false,
"strict": true,
"trailing": true,
"smarttabs": true,
"globals": {
"_": false,
"angular": false,
"$": false,
"moment": false,
"jasmine": false,
"spyOn": false,
"describe": false,
"it": false,
"before": false,
"beforeEach": false,
"after": false,
"afterEach": false,
"expect": false,
"inject": false
}
}
language: node_js
before_install:
- "set -e"
- "export DISPLAY=:99.0"
- "sh -e /etc/init.d/xvfb start"
- sleep 3
node_js:
- 'v5.11.1'
before_script:
- 'npm install -g bower grunt-cli karma'
- 'bower install'
script: grunt test:all
The MIT License (MIT)
Copyright (c) 2016 Johannes Millan
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWAR
[![Stories in Ready](https://badge.waffle.io/johannesjo/angular-promise-buttons.svg?label=ready&title=Ready)](http://waffle.io/johannesjo/angular-promise-buttons)
[![Stories in progress](https://badge.waffle.io/johannesjo/angular-promise-buttons.svg?label=in%20progress&title=In%20Progress)](http://waffle.io/johannesjo/angular-promise-buttons)
[![Build Status](https://travis-ci.org/johannesjo/angular-promise-buttons.svg)](https://travis-ci.org/johannesjo/angular-promise-buttons?branch=master)
[![Coverage Status](https://coveralls.io/repos/johannesjo/angular-promise-buttons/badge.svg?branch=master)](https://coveralls.io/r/johannesjo/angular-promise-buttons?branch=master)
angular-promise-buttons
===========
*Chilled Buttons for AngularJS*
There are cool loading buttons out there for angular. Only thing which annoys me, is that you (most of the times) have to manually trigger their loading state via a boolean which leads to a bit of repetition, declaring those again and again. ```angular-promise-buttons``` exists to take away some of that, by handling the loading state directly by passing the promise. Saves you at least two lines of code every time. Check out the [DEMO](http://johannesjo.github.io/angular-promise-buttons/#demo)!
Also you can play with the code on [Plnkr](http://plnkr.co/edit/yKrlohXVL15fRjTjZHBJ?p=preview).
[Bug-reports or feature request](https://github.com/johannesjo/angular-promise-buttons/issues) as well as any other kind of **feedback is highly welcome!**
## getting started
Install it via bower
```
bower install angular-promise-buttons -S
```
and add `angularPromiseButtons` as dependency in your main module:
```
angular.module('yourApp',[
'angularPromiseButtons'
]);
```
Using the buttons is easy. Just return the promise in question in your service caller and you're good to go:
You can also directly return the promise via the function passed to `ng-click`:
```html
<button ng-click="yourServiceCaller()"
promise-btn>Click me to spin!</button>
```
```javascript
// inside some controller
$scope.yourServiceCaller = function ()
{
return fakeFactory.method().then(...);
};
```
### using it for forms
For using the promise buttons with `ng-submit` you need to apply them to the form directive and add `type="submit" to the buttons you want to show a loader for:
```html
<form ng-submit="yourServiceCaller()"
promise-btn>
<button type="submit">MyBtn</button>
</form>
```
```javascript
// inside some controller
$scope.yourServiceCaller = function ()
{
return fakeFactory.method().then(...);
};
```
### alternative syntax
There is also an alternative syntax, which allows you to share promises between buttons (and possibly other directives):
```html
<button ng-click="yourServiceCaller()"
promise-btn="yourPromise">MyBtn</button>
```
Now you just have to assign a promise to ```yourPromise```:
```javascript
// inside some controller
$scope.yourServiceCaller = function ()
{
$scope.yourPromise = fakeFactory.method().then(...);
};
```
## styling the button
The base-styles might not be overwhelmingly sexy, but it is easy to fix that! There are lots of free css-spinners out there. Just find one of your liking and add the css.
**Ressources:**
* http://cssload.net/
* http://projects.lukehaas.me/css-loaders/
* http://tobiasahlin.com/spinkit/
## configuration
There are also some defaults for you to set, if you like. You can do this by using the ```angularPromiseButtonsProvider```:
```javascript
angular.module('exampleApp', [
'angularPromiseButtons'
])
.config(function (angularPromiseButtonsProvider)
{
angularPromiseButtonsProvider.extendConfig({
spinnerTpl: '<span class="btn-spinner"></span>',
disableBtn: true,
btnLoadingClass: 'is-loading',
addClassToCurrentBtnOnly: false,
disableCurrentBtnOnly: false,
minDuration: false,
CLICK_EVENT: 'click',
CLICK_ATTR: 'ngClick',
SUBMIT_EVENT: 'submit',
SUBMIT_ATTR: 'ngSubmit',
BTN_SELECTOR: 'button'
});
});
```
## change options via `promise-btn-options`
You can also change all the options (**but not the spinner template**) by specifying the options via `promise-btn-options`:
```html
<button class="btn"
ng-click="yourServiceCaller()"
promise-btn-options="options"
promise-btn="yourPromise">MyBtn <span>Look I'm nested content</span>
</button>
```
Now you just have to assign a promise to ```yourPromise```:
```javascript
// inside some controller
$scope.options = {
disableBtn: false,
btnLoadingClass: 'is-spinning'
};
$scope.yourServiceCaller = function ()
{
$scope.yourPromise = fakeFactory.method().then(...);
};
```
Thats all the logic there is (for now). Adjusting the look and feel of the spinner can be done using your own styles.
## ❤ contribute ❤
I'm happy for any [issue or feature request](https://github.com/johannesjo/angular-promise-buttons/issues), you might encounter or want to have. Even a one liner is better, than no feedback at all. Pull requests are also highly welcome. Just fork the repository, clone it and run `grunt serve` for development. Another important factor is the number of developers using and thus testing `angular-promise-buttons`. Tell your fellow programmers, [say that you use it on ng-modules](http://ngmodules.org/modules/angular-promise-buttons), tweet or even blog about it.
`angular-promise-buttons` is published under the [The GNU Lesser General Public License V2.1](https://github.com/johannesjo/angular-promise-buttons/blob/master/LICENSE).
## (possible) promising future features
* [your feature request](https://github.com/johannesjo/angular-promise-buttons/issues)!
{
"name": "angular-promise-buttons",
"description": "Fabulous helper to help you with your daily form coding.",
"version": "0.1.19",
"authors": [
"Johannes Millan <johannes.millan@gmail.com>"
],
"repository": {
"type": "git",
"url": "https://github.com/johannesjo/angular-promise-buttons.git"
},
"homepage": "http://johannesjo.github.io/angular-promise-buttons/",
"license": "LGPL-2.1",
"main": "dist/angular-promise-buttons.js",
"keywords": [
"angular",
"AngularJS",
"form",
"forms",
"form helper",
"buttons",
"button",
"loading-button"
],
"ignore": [
"gh-pages",
"node_modules",
"bower_components",
"test",
"tests"
],
"dependencies": {
"angular": ">=1.3.0 <2.0.0"
},
"devDependencies": {
"angular-animate": ">=1.3.0 <2.0.0",
"angular-mocks": ">=1.3.0 <2.0.0"
}
}
angular.module("angularPromiseButtons",[]),angular.module("angularPromiseButtons").directive("promiseBtn",["angularPromiseButtons","$parse","$timeout","$compile",function(a,b,c,d){"use strict";return{restrict:"EA",priority:a.config.priority,scope:{promiseBtn:"=",promiseBtnOptions:"=?"},link:function(e,f,g){function h(a){t.btnLoadingClass&&!t.addClassToCurrentBtnOnly&&a.addClass(t.btnLoadingClass),t.disableBtn&&!t.disableCurrentBtnOnly&&a.attr("disabled","disabled")}function i(a){t.minDuration&&!r||!s||(t.btnLoadingClass&&a.removeClass(t.btnLoadingClass),t.disableBtn&&a.removeAttr("disabled"))}function j(a,b){e.$watch(a,function(a){r=!1,s=!1,t.minDuration&&(q=c(function(){r=!0,i(b)},t.minDuration)),a&&a.then?(h(b),a.finally(function(){s=!0,i(b)})):a&&a.$promise&&(h(b),a.$promise.finally(function(){s=!0,i(b)}))})}function k(a){return a.split(";").map(function(a){return b(a)})}function l(a){a.append(d(t.spinnerTpl)(e))}function m(a){t.addClassToCurrentBtnOnly&&a.on(t.CLICK_EVENT,function(){a.addClass(t.btnLoadingClass)}),t.disableCurrentBtnOnly&&a.on(t.CLICK_EVENT,function(){a.attr("disabled","disabled")})}function n(a,b,c){e.$evalAsync(function(){var d=k(g[b]);f.unbind(a),f.bind(a,function(){e.$apply(function(){d.forEach(function(b){var d=b(e.$parent,{$event:a});p||(p=j(function(){return d},c))})})})})}function o(b){for(var c=[],d=b.find(a.config.BTN_SELECTOR),e=0;e<d.length;e++){var f=d[e];"submit"===angular.element(f).attr("type")&&c.push(f)}return angular.element(c)}var p,q,r,s,t=a.config;if(g.promiseBtn)l(f),m(f),j(function(){return e.promiseBtn},f);else if(g.hasOwnProperty(t.CLICK_ATTR))l(f),m(f),n(t.CLICK_EVENT,t.CLICK_ATTR,f);else if(g.hasOwnProperty(t.SUBMIT_ATTR)){var u=o(f);l(u),m(u),n(t.SUBMIT_EVENT,t.SUBMIT_ATTR,u)}e.$watch("promiseBtnOptions",function(a){angular.isObject(a)&&(t=angular.extend({},t,a))},!0),e.$on("$destroy",function(){c.cancel(q)})}}}]),angular.module("angularPromiseButtons").provider("angularPromiseButtons",function(){"use strict";var a={spinnerTpl:'<span class="btn-spinner"></span>',priority:0,disableBtn:!0,btnLoadingClass:"is-loading",addClassToCurrentBtnOnly:!1,disableCurrentBtnOnly:!1,minDuration:!1,CLICK_EVENT:"click",CLICK_ATTR:"ngClick",SUBMIT_EVENT:"submit",SUBMIT_ATTR:"ngSubmit",BTN_SELECTOR:"button"};return{extendConfig:function(b){a=angular.extend(a,b)},$get:function(){return{config:a}}}});
\ No newline at end of file
<!doctype html>
<!--[if lt IE 9]>
<html class="old-browser no-js"><![endif]-->
<!--[if gt IE 8]><!-->
<html class="no-js"><!--<![endif]-->
<head>
<meta charset="utf-8">
<title>angular-promise-buttons example</title>
<meta name="viewport"
content="width=device-width">
<!-- Place favicon.ico and apple-touch-icon.png in the root directory -->
<!-- bower:css -->
<!-- endbower -->
<link rel="stylesheet"
href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">
<link rel="stylesheet"
href="//cdnjs.cloudflare.com/ajax/libs/octicons/2.1.2/octicons.css">
<link rel="stylesheet"
href="style.css">
</head>
<body>
<div class="container"
ng-app="exampleApp"
ng-controller="exampleCtrl">
<a name="demo"></a>
<h1>Demos</h1>
<div ng-include="'example1.html'"
class="example"></div>
</div>
<!-- /add ga tracking -->
<!-- bower:js -->
<script src="bower_components/angular/angular.js"></script>
<script src="bower_components/angular-animate/angular-animate.js"></script>
<script src="bower_components/angular-mocks/angular-mocks.js"></script>
<!-- endbower -->
<!-- build:js({.tmp,src}) angular-promise-buttons.min.js -->
<!-- fileblock:js module -->
<script src="_angular-promise-buttons.js"></script>
<script src="promise-btn-d.js"></script>
<script src="angular-promise-buttons-p.js"></script>
<script src="tpls.js"></script>
<!-- endfileblock -->
<!-- endbuild -->
<!-- fileblock:js example -->
<script src="scripts/example.js"></script>
<!-- endfileblock -->
</body>
</html>
<button class="btn"
ng-click="success($event)"
promise-btn="successPromise">Success after delay
</button>
<button class="btn"
ng-click="error()"
promise-btn="errorPromise">Error after delay
</button>
<br>
<br>
<button class="btn"
ng-click="endless()"
promise-btn="endlessPromise">Never resolving promise
</button>
<button class="btn"
ng-click="auto()"
promise-btn="autoPromise">Loading initially and forever
</button>
<h3>Same promise buttons</h3>
<button class="btn"
ng-click="success($event)"
promise-btn="successPromise">We
</button>
<button class="btn"
ng-click="success($event)"
promise-btn="successPromise">share
</button>
<h3>Chained promise buttons</h3>
<button class="btn"
ng-click="chain()"
promise-btn="chainedPromises">Load promise chain {{ v.promiseIndex }}
</button>
<h3>Inside a form</h3>
<form ng-submit="submit()">
<button class="btn"
type="submit"
promise-btn="submitPromise">Submit
</button>
</form>
<h3>ngClick only</h3>
<button class="btn"
ng-click="successDirectlyReturnedPromise()"
promise-btn>Success after delay
</button>
<button class="btn"
ng-click="chain()"
promise-btn>For promise chain
</button>
<h3>ngSubmit only inside form</h3>
<form ng-submit="submitDirectlyReturnPromise()"
promise-btn>
<button class="btn"
type="submit">Submit promise
</button>
<button type="button">I'm just a button</button>
</form>
<!doctype html>
<!--[if lt IE 9]>
<html class="old-browser no-js"><![endif]-->
<!--[if gt IE 8]><!-->
<html class="no-js"><!--<![endif]-->
<head>
<meta charset="utf-8">
<title>angular-promise-buttons</title>
<meta name="viewport"
content="width=device-width">
<!-- Place favicon.ico and apple-touch-icon.png in the root directory -->
<!-- bower:css -->
<!-- endbower -->
<link rel="stylesheet"
href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">
<link rel="stylesheet"
href="//cdnjs.cloudflare.com/ajax/libs/octicons/2.1.2/octicons.css">
<link rel="stylesheet"
href="style.css">
<style>
.form-group {
position: relative;
}
.anchor {
display: none;
}
.main-header {
background: #000;
padding-bottom: 15px;
color: #eee;
}
.main-header h1 {
color: #eee;
}
p.header {
font-style: italic;
}
.motto {
font-size: 16px;
}
.help-block .list-unstyled {
padding: 0;
margin: 0;
display: block;
}
</style>
</head>
<body>
<header class="main-header">
<div class="container">
<h1 class="header">angular-promise-buttons</h1>
<p class="header motto">Chilled Buttons for Angular</p>
<a class="buttons btn btn-primary "
href="https://github.com/johannesjo/angular-promise-buttons/zipball/master">
<span class="octicon octicon-cloud-download"></span> Download ZIP
<span class="octicon octicon-cloud-download"></span></a>
<a class="buttons btn btn-primary "
href="https://github.com/johannesjo/angular-promise-buttons/tarball/master">
<span class="octicon octicon-cloud-download"></span> Download TAR
<span class="octicon octicon-cloud-download"></span></a>
<a class="buttons btn btn-primary github"
href="https://github.com/johannesjo/angular-promise-buttons"><span class="octicon octicon-mark-github"></span> View On
GitHub <span class="octicon octicon-mark-github"></span></a>
<a class="buttons btn btn-primary "
href="#demo"><span class="octicon octicon-squirrel"></span> Demo
<span class="octicon octicon-squirrel"></span></a>
<a class="buttons btn btn-primary "
href="#discussion"><span class="octicon octicon-organization"></span> Discuss
<span class="octicon octicon-organization"></span></a>
<p class="header"><br>This project is maintained by <a class="header name"
href="https://github.com/johannesjo">johannesjo</a></p>
<a href="https://github.com/johannesjo/angular-promise-buttons"
class="github-button"
data-icon="octicon-star"
data-count-href="/johannesjo/angular-promise-buttons/stargazers"
data-count-api="/repos/johannesjo/angular-promise-buttons#stargazers_count">Star</a>
<a href="https://github.com/johannesjo/angular-promise-buttons"
class="github-button"
data-icon="octicon-git-branch"
data-count-href="/johannesjo/angular-promise-buttons/network"
data-count-api="/repos/johannesjo/angular-promise-buttons#forks_count">Fork</a>
<a href="https://github.com/johannesjo/angular-promise-buttons/issues"
class="github-button"
data-icon="octicon-issue-opened"
data-count-api="/repos/johannesjo/angular-promise-buttons#open_issues_count">Issue</a>
<script async
defer
id="github-bjs"
src="https://buttons.github.io/buttons.js"></script>
</div>
</header>
<div class="container">
<%= document %>
</div>
<hr>
<div class="container"
ng-app="exampleApp"
ng-controller="exampleCtrl">
<a name="demo"></a>
<h1>Demos</h1>
<div ng-include="'example1.html'"
class="example"></div>
</div>
<!-- bower:js -->
<script src="bower_components/angular/angular.js"></script>
<script src="bower_components/angular-animate/angular-animate.js"></script>
<script src="bower_components/angular-mocks/angular-mocks.js"></script>
<!-- endbower -->
<!-- build:js({.tmp,src}) angular-promise-buttons.min.js -->
<!-- fileblock:js module -->
<script src="_angular-promise-buttons.js"></script>
<script src="promise-btn-d.js"></script>
<script src="angular-promise-buttons-p.js"></script>
<script src="tpls.js"></script>
<!-- endfileblock -->
<!-- endbuild -->
<!-- fileblock:js example -->
<script src="scripts/example.js"></script>
<!-- endfileblock -->
</body>
</html>
angular.module('angularPromiseButtons')
.provider('angularPromiseButtons', function angularPromiseButtonsProvider() {
'use strict';
// *****************
// DEFAULTS & CONFIG
// *****************
var config = {
spinnerTpl: '<span class="btn-spinner"></span>',
priority: 0,
disableBtn: true,
btnLoadingClass: 'is-loading',
addClassToCurrentBtnOnly: false,
disableCurrentBtnOnly: false,
minDuration: false,
CLICK_EVENT: 'click',
CLICK_ATTR: 'ngClick',
SUBMIT_EVENT: 'submit',
SUBMIT_ATTR: 'ngSubmit',
BTN_SELECTOR: 'button'
};
// *****************
// SERVICE-FUNCTIONS
// *****************
// *************************
// PROVIDER-CONFIG-FUNCTIONS
// *************************
return {
extendConfig: function(newConfig) {
config = angular.extend(config, newConfig);
},
// ************************************************
// ACTUAL FACTORY FUNCTION - used by the directive
// ************************************************
$get: function() {
return {
config: config
};
}
};
});
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment