Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
bevacqua committed Aug 4, 2015
0 parents commit ec7e9b4
Show file tree
Hide file tree
Showing 26 changed files with 30,146 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# editorconfig.org
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules
npm-debug.log
.DS_Store
Thumbs.db
4 changes: 4 additions & 0 deletions .jshintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules
bower_components
dist
example
23 changes: 23 additions & 0 deletions .jshintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"curly": true,
"eqeqeq": true,
"newcap": true,
"noarg": true,
"noempty": true,
"nonew": true,
"sub": true,
"undef": true,
"unused": true,
"trailing": true,
"boss": true,
"eqnull": true,
"strict": true,
"immed": true,
"expr": true,
"latedef": "nofunc",
"quotmark": "single",
"validthis": true,
"indent": 2,
"node": true,
"browser": true
}
43 changes: 43 additions & 0 deletions angular-dragula.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
'use strict';

var dragula = require('dragula');
var dragulaService = require('./service');
var replicateEvents = require('./replicate-events');

function register (angular) {
var app = angular.module('dragula', ['ng']);

app.factory('dragulaService', dragulaService);
app.directive('dragula', ['dragulaService', angularDragula]);

return 'dragula';

function angularDragula (dragulaService) {
return {
restrict: 'A',
link: link
};

function link (scope, elem, attrs) {
var container = elem[0];
var name = scope.$eval(attrs.dragula);
var bag = dragulaService.find(scope, name);
if (bag) {
bag.drake.containers.push(container); return;
}
var drake = dragula({
containers: [container]
});
var destroyDrake = drake.destroy;
drake.destroy = destroy;
bag = dragulaService.add(scope, name, drake);
replicateEvents(angular, bag, scope);
function destroy () {
dragulaService.remove(scope, name);
destroyDrake.call(drake);
}
}
}
}

module.exports = register;
15 changes: 15 additions & 0 deletions bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "angular-dragula",
"version": "0.0.0",
"description": "Drag and drop so simple it hurts",
"main": [
"dist/angular-dragula.js",
"dist/dragula.css"
],
"ignore": [],
"homepage": "https://github.com/bevacqua/angular-dragula",
"authors": [
"Nicolas Bevacqua <[email protected]>"
],
"license": "MIT"
}
8 changes: 8 additions & 0 deletions changelog.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# 1.0.1 Atog

- Use `atoa` instead of casting things on our own
- Cast `arguments` to true array when applying it onto `dragula`

# 1.0.0 IPO

- Initial Public Release
Loading

0 comments on commit ec7e9b4

Please sign in to comment.