Reorganizes the entire app to follow Google's best practice recommendations for Angular App Structure.
see: https://docs.google.com/document/d/1XXMvReO8-Awi1EZXAXS4PzDzdNvV6pGcuaF4Q9821Es/pub The files are now grouped by view / component. Tests are located beside tested js files. The Grunt build will be responsible for only distributing actual files without the tests. Each partial is at the same level as the js files related to it. Ideally css files should be at the same level, maybe I'll refactor this later. Moves all non-bower plugins to app/vendor. Moves all images to app/images and styles to app/styles. Merges the test and non-test jshintrc files. Adds all the Jamstash contributors to the package.json file while I was refactoring. Conflicts: app/app.js app/images/vgrabber.gif app/images/vgrabber2-active.gif app/images/vgrabber2-normal.gif app/index.html
This commit is contained in:
parent
b190d2f99f
commit
a1d48bbd30
135 changed files with 78 additions and 103 deletions
|
@ -1,134 +0,0 @@
|
|||
'use strict';
|
||||
|
||||
var jamstash = angular.module('JamStash');
|
||||
|
||||
jamstash.directive('sortable', function () {
|
||||
return {
|
||||
link: function (scope, elm, attrs) {
|
||||
elm.sortable({
|
||||
start: scope.dragStart,
|
||||
update: scope.dragEnd
|
||||
});
|
||||
elm.disableSelection();
|
||||
}
|
||||
};
|
||||
});
|
||||
/*
|
||||
jamstash.directive('split', function () {
|
||||
return {
|
||||
link: function (scope, elm, attrs) {
|
||||
elm.splitPane();
|
||||
}
|
||||
};
|
||||
});
|
||||
*/
|
||||
jamstash.directive('fancybox', function ($compile) {
|
||||
return {
|
||||
restrict: 'A',
|
||||
replace: false,
|
||||
link: function($scope, element, attrs) {
|
||||
$scope.fancyboxOpen = function() {
|
||||
var el = angular.element(element.html()),
|
||||
compiled = $compile(el);
|
||||
$.fancybox.open(el);
|
||||
compiled($scope);
|
||||
};
|
||||
$scope.fancyboxOpenUrl = function () {
|
||||
var el = angular.element(element.html()),
|
||||
compiled = $compile(el);
|
||||
$.fancybox.open(el);
|
||||
compiled($scope);
|
||||
};
|
||||
}
|
||||
};
|
||||
});
|
||||
jamstash.directive('songpreview', function ($compile, subsonic) {
|
||||
return {
|
||||
restrict: 'E',
|
||||
templateUrl: 'js/partials/songs.html',
|
||||
replace: false,
|
||||
// pass these two names from attrs into the template scope
|
||||
scope: {
|
||||
song: '@'
|
||||
},
|
||||
link: function (scope, element, attrs) {
|
||||
subsonic.getSongTemplate(function (data) {
|
||||
scope.song = data;
|
||||
//var el = angular.element(element.html()),
|
||||
//var el = element.html(),
|
||||
//compiled = $compile(el);
|
||||
$.fancybox.open(element);
|
||||
//compiled($scope);
|
||||
});
|
||||
}
|
||||
};
|
||||
});
|
||||
jamstash.directive('stopEvent', function () {
|
||||
return {
|
||||
restrict: 'A',
|
||||
link: function (scope, element, attr) {
|
||||
element.bind(attr.stopEvent, function (e) {
|
||||
e.stopPropagation();
|
||||
});
|
||||
}
|
||||
};
|
||||
});
|
||||
jamstash.directive('ngEnter', function () {
|
||||
return {
|
||||
scope: { onEnter: '&' },
|
||||
link: function (scope, element) {
|
||||
console.log(scope);
|
||||
element.bind("keydown keypress", function (event) {
|
||||
if (event.which === 13) {
|
||||
scope.onEnter();
|
||||
scope.$apply();
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
});
|
||||
jamstash.directive('ngDownload', function ($compile) {
|
||||
return {
|
||||
restrict: 'E',
|
||||
scope: { data: '=' },
|
||||
link: function (scope, elm, attrs) {
|
||||
function getUrl() {
|
||||
return URL.createObjectURL(new Blob([JSON.stringify(scope.data)], { type: "application/json" }));
|
||||
}
|
||||
|
||||
elm.append($compile(
|
||||
'<a class="button" download="backup.json"' +
|
||||
'href="' + getUrl() + '">' +
|
||||
'Download' +
|
||||
'</a>'
|
||||
)(scope));
|
||||
|
||||
scope.$watch(scope.data, function () {
|
||||
elm.children()[0].href = getUrl();
|
||||
});
|
||||
}
|
||||
};
|
||||
});
|
||||
jamstash.directive('stopEvent', function () {
|
||||
return {
|
||||
restrict: 'A',
|
||||
link: function (scope, element, attr) {
|
||||
element.bind(attr.stopEvent, function (e) {
|
||||
e.stopPropagation();
|
||||
});
|
||||
}
|
||||
};
|
||||
});
|
||||
jamstash.directive('ngEnter', function () {
|
||||
return function (scope, element, attrs) {
|
||||
element.bind("keydown keypress", function (event) {
|
||||
if (event.which === 13) {
|
||||
scope.$apply(function () {
|
||||
scope.$eval(attrs.ngEnter);
|
||||
});
|
||||
|
||||
event.preventDefault();
|
||||
}
|
||||
});
|
||||
};
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue