Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…into RoopeHakulinen-v2

# Conflicts:
#	bower.json
#	package.json
  • Loading branch information
RoopeHakulinen committed Feb 1, 2016
1 parent dd7b107 commit 057e4ce
Show file tree
Hide file tree
Showing 19 changed files with 739 additions and 496 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -1,2 +1,3 @@
/node_modules/
/bower_components/
.idea/*
63 changes: 25 additions & 38 deletions Gruntfile.js
@@ -1,64 +1,66 @@
'use strict';
module.exports = function (grunt) {
'use strict';
// Load all grunt tasks
require('load-grunt-tasks')(grunt);
// Show elapsed time at the end
require('time-grunt')(grunt);

var distPath = 'dist/';
// Project configuration.
grunt.initConfig({
// Metadata.
pkg: grunt.file.readJSON('package.json'),
babel: {
options: {
sourceMap: true,
presets: ['es2015']
},
dist: {
files: {
'dist/angular-flash.js': 'src/angular-flash.js'
}
}
},
banner: '/*! angular-flash - v<%= pkg.version %> - ' +
'<%= grunt.template.today("yyyy-mm-dd") %>\n' +
'<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +
'* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
' Licensed MIT */\n',
// Task configuration.
clean: {
files: ['dist']
},
concat: {
options: {
banner: '<%= banner %>',
stripBanners: true
},
basic: {
src: ['src/angular-flash.js'],
dest: 'dist/angular-flash.js'
src: [distPath + 'angular-flash.js'],
dest: distPath + 'angular-flash.js'
},
extras: {
src: ['src/angular-flash.css'],
dest: 'dist/angular-flash.css'
dest: distPath + 'angular-flash.css'
}
},
uglify: {
options: {
banner: '<%= banner %>'
},
dist: {
src: 'src/angular-flash.js',
dest: 'dist/angular-flash.min.js'
src: distPath + 'angular-flash.js',
dest: distPath + 'angular-flash.min.js'
}
},
cssmin: {
target: {
files: [{
expand: true,
cwd: 'src',
src: ['*.css', '!*.min.css'],
dest: 'dist',
cwd: '',
src: [distPath + '*.css', '!*.min.css'],
dest: '',
ext: '.min.css'
}]
}
},
qunit: {
all: {
options: {
urls: ['http://localhost:9000/test/angular-flash.html']
}
}
},
jshint: {
options: {
reporter: require('jshint-stylish')
Expand All @@ -68,18 +70,6 @@ module.exports = function (grunt) {
jshintrc: '.jshintrc'
},
src: 'Gruntfile.js'
},
src: {
options: {
jshintrc: 'src/.jshintrc'
},
src: ['src/**/*.js']
},
test: {
options: {
jshintrc: 'test/.jshintrc'
},
src: ['test/**/*.js']
}
},
watch: {
Expand Down Expand Up @@ -107,11 +97,8 @@ module.exports = function (grunt) {
});

// Default task.
grunt.registerTask('default', ['jshint', 'connect', 'qunit', 'clean', 'concat', 'uglify', 'cssmin']);
grunt.registerTask('server', function () {
grunt.log.warn('The `server` task has been deprecated. Use `grunt serve` to start a server.');
grunt.task.run(['serve']);
});
grunt.registerTask('lint', ['jshint']);
grunt.registerTask('default', ['babel', 'lint', 'connect', 'concat', 'uglify', 'cssmin']);
grunt.registerTask('serve', ['connect', 'watch']);
grunt.registerTask('test', ['jshint', 'connect', 'qunit']);
};
grunt.registerTask('test', ['lint', 'connect']);
};
67 changes: 40 additions & 27 deletions README.md
Expand Up @@ -3,7 +3,7 @@
![bower](https://img.shields.io/bower/v/angular-flash-alert.svg)
![npm](https://img.shields.io/npm/v/angular-flash-alert.svg)
# angular-flash
A simple lightweight flash message module for angularjs.
A simple lightweight flash message module for AngularJS and Bootstrap.


Demo
Expand All @@ -14,67 +14,80 @@ Demo

How to use
---
#### Bower

You can Install angular-flash using the [Bower](http://bower.io) package manager.
#### npm

You can also find angular-flash on [npm](http://npmjs.org)

```sh
$ bower install angular-flash-alert --save
$ npm install angular-flash-alert
```

#### npm
#### Bower

You can also find angular-flash on [npm](http://npmjs.org)
You can Install angular-flash using the [Bower](http://bower.io) package manager.

```sh
$ npm install angular-flash-alert
$ bower install angular-flash-alert --save
```

Add the Following code to the &lt;head&gt; of your document.
```html
<link type="text/css" rel="stylesheet" href="css/angular-flash.min.css" />
<link type="text/css" rel="stylesheet" href="dist/angular-flash.min.css" />
// If you are using bootstrap v3 no need to include angular-flash.css
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.26/angular.min.js"></script>
<script src="angular-flash.min.js"></script>
<script src="dist/angular-flash.min.js"></script>
// Do not include both angular-flash.js and angular-flash.min.js
```
Add `flash` dependency to your module
Add `ngFlash` dependency to your module
```javascript
var myApp = angular.module("app", ["flash"])
var myApp = angular.module("app", ["ngFlash"])
```
Include `<div flash-message="5000" ></div>` directive in your html template.
Include directive below in your HTML template.
```html
<div flash-message="5000" ></div>
<!-- 5000 milli-secs is the display duration.
Flash alert will be automatically dismissed after 5000 milli-secs.
<flash-message duration="5000"></flash-message>
<!-- 5000ms as the default duration to show flash message.
-->
```
Inject the `Flash` factory in your controller
```javascript
myApp.controller('demoCtrl', ['Flash', function(Flash) {
$scope.successAlert = function () {
var message = '<strong>Well done!</strong> You successfully read this important alert message.';
Flash.create('success', message, 'custom-class');
// First argument (success) is the type of the flash alert
// Second argument (message) is the message displays in the flash alert
// you can inclide html as message (not just text)
// Third argument (custom-class) is the custom class for the perticular flash alert
Flash.create('success', message, 0, 'custom-class');
// First argument is the type of the flash alert
// Second argument is the message displays in the flash alert (HTML ok)
// Third argument (optional) is the duration of showing the flash. 0 to not automatically hide flash (user needs to click the cross on top-right corner).
// Fourth argument (optional) is the custom class to be added for the flash message created
}
}]);
```
####flash alert types####
####Flash types####
+ success
+ info
+ warning
+ danger

#### Methods ####
These methods are mostly for internal usage but can be used also from outside.

``` javascript
Flash.pause();
// Pause flash auto dismiss.
Flash.dismiss()
// Dismiss the flash
Flash.pause(4);
// Pause the fifth flash' auto dismiss.
Flash.dismiss(1);
// Dismiss the second flash shown
```
#### [guidelines for contributors](https://github.com/sachinchoolur/angular-flash/blob/master/contributing.md)
#### [Guidelines for contributors](https://github.com/sachinchoolur/angular-flash/blob/master/contributing.md)

#### Running tests
```
npm install
./node_modules/karma/bin/karma start
```

#### Contributors
* [Sachin Choluur](https://github.com/sachinchoolur) (Original author)
* [Roope Hakulinen](https://github.com/RoopeHakulinen) (Version 2)

#### MIT © [Sachin](https://twitter.com/sachinchoolur)
#### License
MIT © [Sachin Choluur](https://twitter.com/sachinchoolur)
11 changes: 4 additions & 7 deletions bower.json
@@ -1,12 +1,12 @@
{
"name": "angular-flash-alert",
"version": "1.1.1",
"version": "2.0.0",
"homepage": "https://github.com/sachinchoolur/angular-flash",
"authors": [
"Sachin N <sachi77n@gmail.com>"
],
"description": "Flash message for angularjs",
"main": ["dist/angular-flash.js", "dist/angular-flash.css"],
"description": "Flash messages for AngularJS and Bootstrap",
"main": ["angular-flash.js", "angular-flash.css"],
"keywords": [
"angular-flash",
"flash",
Expand All @@ -16,10 +16,7 @@
"bootstrap"
],
"dependencies": {
"angular": ">=1.2.0"
},
"devDependencies": {
"qunit": "~1.12.0"
"angular": ">=1.4.8"
},
"ignore": [
"README.md",
Expand Down
15 changes: 5 additions & 10 deletions contributing.md
@@ -1,32 +1,27 @@
# Contributing

## Important notes
Please don't edit files in the `dist` subdirectory as they are generated via Grunt. You'll find source code in the `src` subdirectory!
Please don't edit files in the root directory of repository as they are generated via Grunt. You'll find source code in the `src` subdirectory!

### Code style
Regarding code style like indentation and whitespace, **follow the conventions you see used in the source already.**

### PhantomJS
While Grunt can run the included unit tests via [PhantomJS](http://phantomjs.org/), this shouldn't be considered a substitute for the real thing. Please be sure to test the `test/*.html` unit test file(s) in _actual_ browsers.
Regarding code style like indentation and whitespace, **follow the conventions you see used in the source already.** There is also a `.editorconfig` to apply styles on your IDE of choice.

## Modifying the code
First, ensure that you have the latest [Node.js](http://nodejs.org/) and [npm](http://npmjs.org/) installed.

Test that Grunt's CLI and Bower are installed by running `grunt --version` and `bower --version`. If the commands aren't found, run `npm install -g grunt-cli bower`. For more information about installing the tools, see the [getting started with Grunt guide](http://gruntjs.com/getting-started) or [bower.io](http://bower.io/) respectively.
Test that Grunt's CLI and Bower are installed by running `grunt --version`. If the command isn't found, run `npm install -g grunt-cli`. For more information about installing the tools, see the [getting started with Grunt guide](http://gruntjs.com/getting-started).

1. Fork and clone the repo.
1. Run `npm install` to install all build dependencies (including Grunt).
1. Run `bower install` to install the front-end dependencies.
1. Run `grunt` to grunt this project.

Assuming that you don't see any red, you're ready to go. Just be sure to run `grunt` after making any changes, to ensure that nothing is broken.
Assuming that you don't see anything on red, you're ready to go. Just be sure to run `grunt` after making any changes, to ensure that nothing is broken.

## Submitting pull requests

1. Create a new branch, please don't work in your `master` branch directly.
1. Add failing tests for the change you want to make. Run `grunt` to see the tests fail.
1. Fix stuff.
1. Run `grunt` to see if the tests pass. Repeat steps 2-4 until done.
1. Open `test/*.html` unit test file(s) in actual browser to ensure tests pass everywhere.
1. Run tests (see README for instructions) and see the tests pass. Repeat steps 2-4 until all tests pass.
1. Update the documentation to reflect any changes.
1. Push to your fork and submit a pull request.

0 comments on commit 057e4ce

Please sign in to comment.