Merge pull request #63 from Poniverse/feature/webpack

Feature/webpack
This commit is contained in:
Peter Deltchev 2016-02-16 04:16:31 -08:00
commit 0057533917
94 changed files with 274 additions and 30655 deletions

View file

@ -63,21 +63,13 @@ And then install all of the required local packages by invoking:
npm install npm install
Finally, build all of the scripts by executing: Finally, to compile and serve the assets in real time, run the following (and leave it running while you develop):
gulp build
During development, you should make a point to run "gulp watch". You can do this simply by executing:
gulp watch gulp watch
This will watch and compile the `.less` and `.coffee` files in real time.
Configuring the servers Configuring the servers
----------------------- -----------------------
Pony.fm uses nginx, php-fpm, redis, and MySQL. You can modify the configuration of these services by locating the appropriate config file in the `vagrant` folder. Once modified, you must reload the configuration by running the appropriate shell script (`reload-config.sh`) or bat files (`reload-config.bat` and `reload-config.vmware.bat`). These scripts simply tell Vagrant to run `copy-and-restart-config.sh` on the VM. Pony.fm uses nginx, php-fpm, redis, and MySQL. You can modify the configuration of these services by locating the appropriate config file in the `vagrant` folder. Once modified, you must reload the configuration by running the appropriate shell script (`reload-config.sh`) or bat files (`reload-config.bat` and `reload-config.vmware.bat`). These scripts simply tell Vagrant to run `copy-and-restart-config.sh` on the VM.
If you need to change any other configuration file on the VM - copy the entire file over into the vagrant folder, make your changes, and update the `copy-and-restart-config.sh` script to copy the modified config back into the proper folder. All potential configuration requirements should be represented in the `vagrant` folder **and never only on the VM itself** as changes will not be preserved. If you need to change any other configuration file on the VM - copy the entire file over into the vagrant folder, make your changes, and update the `copy-and-restart-config.sh` script to copy the modified config back into the proper folder. All potential configuration requirements should be represented in the `vagrant` folder **and never only on the VM itself** as changes will not be preserved.
**NOTE:** currently, Redis's configuration is not reloaded by the `copy-and-restart-config.sh`

View file

@ -20,21 +20,26 @@
class Assets class Assets
{ {
public static function scriptIncludes($area = 'app') public static function scriptIncludes(string $area) {
{ $scriptTags = '';
if (!Config::get("app.debug")) {
return '<script src="/build/scripts/' . $area . '.js?' . filemtime(public_path("/build/scripts/${area}.js")) . '"></script>'; if ('app' === $area) {
$scripts = ['app.js', 'templates.js'];
} elseif ('embed' === $area) {
$scripts = ['embed.js'];
} else {
throw new InvalidArgumentException('A valid app area must be specified!');
} }
$scripts = self::mergeGlobs(self::getScriptsForArea($area)); foreach ($scripts as $filename) {
$retVal = ""; $scriptTags .= "<script src='/build/scripts/{$filename}?" . filemtime(public_path("build/scripts/{$filename}")) . "'></script>";
foreach ($scripts as $script) {
$filename = self::replaceExtensionWith($script, ".coffee", ".js");
$retVal .= "<script src='/build/$filename?" . filemtime(public_path("/build/${filename}")) . "'></script>";
} }
return $retVal; if (Config::get("app.debug")) {
$scriptTags .= '<script src="http://localhost:61999/webpack-dev-server.js"></script>';
}
return $scriptTags;
} }
public static function styleIncludes($area = 'app') public static function styleIncludes($area = 'app')
@ -84,41 +89,6 @@ class Assets
return $files; return $files;
} }
private static function getScriptsForArea($area)
{
if ($area == 'app') {
return [
"scripts/base/jquery-2.0.2.js",
"scripts/base/angular.js",
"scripts/base/marked.js",
"scripts/base/*.{coffee,js}",
"scripts/shared/*.{coffee,js}",
"scripts/app/*.{coffee,js}",
"scripts/app/services/*.{coffee,js}",
"scripts/app/filters/*.{coffee,js}",
"scripts/app/directives/*.{coffee,js}",
"scripts/app/controllers/*.{coffee,js}",
"scripts/**/*.{coffee,js}"
];
} else {
if ($area == 'embed') {
return [
"scripts/base/jquery-2.0.2.js",
"scripts/base/jquery.cookie.js",
"scripts/base/jquery.viewport.js",
"scripts/base/underscore.js",
"scripts/base/moment.js",
"scripts/base/jquery.timeago.js",
"scripts/base/soundmanager2-nodebug.js",
"scripts/shared/jquery-extensions.js",
"scripts/embed/*.coffee"
];
}
}
throw new Exception();
}
private static function getStylesForArea($area) private static function getStylesForArea($area)
{ {
if ($area == 'app') { if ($area == 'app') {

View file

@ -17,9 +17,16 @@
*/ */
var gulp = require("gulp"), var gulp = require("gulp"),
gutil = require("gulp-util"),
plug = require("gulp-load-plugins")(), plug = require("gulp-load-plugins")(),
argv = require("yargs").argv, argv = require("yargs").argv,
header = require("gulp-header"); header = require("gulp-header"),
webpack = require("webpack"),
WebpackDevServer = require("webpack-dev-server"),
webpackDevConfig = require("./webpack.dev.config.js"),
webpackProductionConfig = require("./webpack.production.config.js"),
webpackStream = require('webpack-stream'),
_ = require("underscore");
var plumberOptions = { var plumberOptions = {
errorHandler: plug.notify.onError("Error: <%= error.message %>") errorHandler: plug.notify.onError("Error: <%= error.message %>")
@ -47,81 +54,31 @@ var licenseHeader = [
"" ""
].join('\n'); ].join('\n');
gulp.task("scripts-app", function () {
var paths = [
"resources/assets/scripts/app/**/*.{coffee,js}",
"resources/assets/scripts/base/**/*.{coffee,js}",
"resources/assets/scripts/shared/**/*.{coffee,js}"
];
if (!argv.production) { gulp.task("webpack-build", function() {
// we also want to add the embed stuff, since we're in development mode return gulp.src(_.values(webpackProductionConfig.entry))
// we want to watch embed files and re-compile them. However, we want .pipe(webpackStream(webpackProductionConfig))
// to leave this path out in production so that embed files are not bloating
// the js file
paths.push("resources/assets/scripts/embed/**/*.{coffee,js}");
}
return argv.production
// Production pipeline
? gulp.src(paths, {base: "resources/assets/scripts"})
.pipe(plug.plumber(plumberOptions))
.pipe(plug.order([
"resources/assets/scripts/base/jquery-2.0.2.js",
"resources/assets/scripts/base/angular.js",
"resources/assets/scripts/base/*.{coffee,js}",
"resources/assets/scripts/shared/*.{coffee,js}",
"resources/assets/scripts/app/*.{coffee,js}",
"resources/assets/scripts/app/services/*.{coffee,js}",
"resources/assets/scripts/app/filters/*.{coffee,js}",
"resources/assets/scripts/app/directives/*.{coffee,js}",
"resources/assets/scripts/app/controllers/*.{coffee,js}",
"resources/assets/scripts/**/*.{coffee,js}"
], {base: "."}))
.pipe(plug.if(/\.coffee/, plug.coffee()))
.pipe(plug.concat("app.js"))
.pipe(plug.uglify())
.pipe(header(licenseHeader)) .pipe(header(licenseHeader))
.pipe(gulp.dest("public/build/scripts")) .pipe(gulp.dest('public'));
// Development/watch pipeline
: gulp.src(paths, {base: "resources/assets/scripts"})
.pipe(plug.plumber(plumberOptions))
.pipe(plug.cached('scripts'))
.pipe(plug.sourcemaps.init())
.pipe(plug.if(/\.coffee/, plug.coffee()))
.pipe(header(licenseHeader))
.pipe(plug.sourcemaps.write())
.pipe(gulp.dest("public/build/scripts"));
}); });
gulp.task("scripts-embed", function () {
// note that this task should really only ever be invoked for production
// since development-mode watches and builds include the embed scripts
// already
var includedScripts = [ gulp.task("webpack-dev-server", function () {
"resources/assets/scripts/base/jquery-2.0.2.js", // Starts a webpack-dev-server
"resources/assets/scripts/base/jquery.cookie.js", var compiler = webpack(webpackDevConfig);
"resources/assets/scripts/base/jquery.viewport.js",
"resources/assets/scripts/base/underscore.js",
"resources/assets/scripts/base/moment.js",
"resources/assets/scripts/base/jquery.timeago.js",
"resources/assets/scripts/base/soundmanager2-nodebug.js",
"resources/assets/scripts/shared/jquery-extensions.js",
"resources/assets/scripts/embed/*.coffee"
];
return gulp.src(includedScripts, {base: "resources/assets/scripts"}) new WebpackDevServer(compiler, {
.pipe(plug.plumber(plumberOptions)) // server and middleware options, currently blank
.pipe(plug.if(/\.coffee/, plug.coffee())) }).listen(61999, "localhost", function (err) {
.pipe(plug.order(includedScripts, {base: "."})) if (err)
.pipe(plug.concat("embed.js")) throw new gutil.PluginError("webpack-dev-server", err);
.pipe(plug.uglify())
.pipe(header(licenseHeader)) // Server listening
.pipe(gulp.dest("public/build/scripts")); gutil.log("[webpack-dev-server]", "http://localhost:61999/webpack-dev-server/index.html");
});
}); });
gulp.task("styles-app", function () { gulp.task("styles-app", function () {
var includedStyles = [ var includedStyles = [
"resources/assets/styles/base/jquery-ui.css", "resources/assets/styles/base/jquery-ui.css",
@ -208,18 +165,19 @@ gulp.task('copy:templates', function () {
}); });
gulp.task('build', [ gulp.task('build', [
'scripts-app', 'webpack-build',
'copy:templates',
'styles-app', 'styles-app',
'scripts-embed',
'styles-embed' 'styles-embed'
]); ]);
gulp.task("watch", ["build"], function () { gulp.task("watch-legacy", ["build"], function () {
plug.livereload.listen();
gulp.watch("resources/assets/scripts/**/*.{coffee,js}", ["scripts-app"]);
gulp.watch("resources/assets/styles/**/*.{css,less}", ["styles-app"]); gulp.watch("resources/assets/styles/**/*.{css,less}", ["styles-app"]);
}); });
gulp.task("watch", ["webpack-dev-server", "watch-legacy"], function () {});
function endsWith(str, suffix) { function endsWith(str, suffix) {
return str.indexOf(suffix, str.length - suffix.length) !== -1; return str.indexOf(suffix, str.length - suffix.length) !== -1;
} }

View file

@ -1,22 +1,23 @@
{ {
"name": "pony.fm", "name": "pony.fm",
"version": "1.0.0", "version": "1.0.0",
"license": "AGPL", "license": "AGPL-3.0",
"repository": { "repository": {
"type": "git", "type": "git",
"url": "ssh://git@phabricator.poniverse.net/diffusion/PF/pony-fm.git" "url": "ssh://git@phabricator.poniverse.net/diffusion/PF/pony-fm.git"
}, },
"packages": {}, "packages": {},
"dependencies": { "dependencies": {},
"gulp-header": "^1.7.1"
},
"devDependencies": { "devDependencies": {
"angular": "^1.5.0",
"coffee-loader": "^0.7.2",
"gulp": "^3.9.0", "gulp": "^3.9.0",
"gulp-angular-templatecache": "^1.6.0", "gulp-angular-templatecache": "^1.6.0",
"gulp-autoprefixer": "^2.2.0", "gulp-autoprefixer": "^2.2.0",
"gulp-cached": "^1.0.4", "gulp-cached": "^1.0.4",
"gulp-coffee": "^2.3.1", "gulp-coffee": "^2.3.1",
"gulp-concat": "^2.5.2", "gulp-concat": "^2.5.2",
"gulp-header": "^1.7.1",
"gulp-if": "^1.2.5", "gulp-if": "^1.2.5",
"gulp-less": "^3.0.3", "gulp-less": "^3.0.3",
"gulp-livereload": "^3.8.0", "gulp-livereload": "^3.8.0",
@ -27,7 +28,15 @@
"gulp-plumber": "^1.0.0", "gulp-plumber": "^1.0.0",
"gulp-sourcemaps": "^1.5.1", "gulp-sourcemaps": "^1.5.1",
"gulp-uglify": "^1.2.0", "gulp-uglify": "^1.2.0",
"gulp-util": "^3.0.4", "gulp-util": "^3.0.7",
"gulp-webpack": "^1.5.0",
"jquery": "^2.2.0",
"jquery-ui": "^1.10.5",
"script-loader": "^0.6.1",
"underscore": "^1.8.3",
"webpack": "^1.12.13",
"webpack-dev-server": "^1.14.1",
"webpack-stream": "^3.1.0",
"yargs": "^3.7.2" "yargs": "^3.7.2"
} }
} }

View file

@ -14,25 +14,69 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# Some notes on what's going on here:
#
# - Webpack resolves all of these require statements.
#
# - jQuery is loaded before Angular so it replaces jqLite.
#
# - "script!" is used with dependencies that expect to interact with the global state.
#
# - The "ponyfm" module in this file must be initialized before the controllers
# and other Angular modules are brought in; they expect the "ponyfm" module to exist.
require 'script!../base/jquery-2.0.2'
require 'script!../base/jquery-ui'
angular = require 'angular'
require 'script!../base/angular-ui-date'
require '../base/angular-ui-router'
require '../base/angular-ui-sortable'
require '../base/angularytics'
require '../base/jquery.colorbox'
require '../base/jquery.cookie'
require '../base/jquery.timeago'
require '../base/jquery.viewport'
require 'script!../base/marked'
require 'script!../base/moment'
require '../base/soundmanager2-nodebug'
require 'script!../base/tumblr'
require '../base/ui-bootstrap-tpls-0.4.0'
require '../shared/pfm-angular-marked'
require '../shared/pfm-angular-sanitize'
require '../shared/init.coffee'
ponyfm = angular.module 'ponyfm', ['ui.bootstrap', 'ui.state', 'ui.date', 'ui.sortable', 'angularytics', 'ngSanitize', 'hc.marked']
window.pfm.preloaders = {} window.pfm.preloaders = {}
module = angular.module 'ponyfm', ['ui.bootstrap', 'ui.state', 'ui.date', 'ui.sortable', 'angularytics', 'ngSanitize', 'hc.marked'] # Inspired by: https://stackoverflow.com/a/30652110/3225811
requireDirectory = (r) ->
r.keys().forEach(r)
requireDirectory(require.context('./controllers/', false, /\.coffee$/));
requireDirectory(require.context('./directives/', false, /\.coffee$/));
requireDirectory(require.context('./filters/', false, /\.coffee$/));
requireDirectory(require.context('./services/', false, /\.coffee$/));
if window.pfm.environment == 'production' if window.pfm.environment == 'production'
module.run [ ponyfm.run [
'Angularytics', 'Angularytics',
(analytics) -> (analytics) ->
analytics.init() analytics.init()
] ]
module.run [ ponyfm.run [
'$rootScope', '$rootScope',
($rootScope) -> ($rootScope) ->
$rootScope.$on '$stateChangeStart', (event, toState, toParams, fromState, fromParams) -> $rootScope.$on '$stateChangeStart', (event, toState, toParams, fromState, fromParams) ->
$rootScope.description = '' $rootScope.description = ''
] ]
module.config [ ponyfm.config [
'$locationProvider', '$stateProvider', '$dialogProvider', 'AngularyticsProvider', '$httpProvider', '$sceDelegateProvider', 'markedProvider' '$locationProvider', '$stateProvider', '$dialogProvider', 'AngularyticsProvider', '$httpProvider', '$sceDelegateProvider', 'markedProvider'
(location, state, $dialogProvider, analytics, $httpProvider, $sceDelegateProvider, markedProvider) -> (location, state, $dialogProvider, analytics, $httpProvider, $sceDelegateProvider, markedProvider) ->
@ -330,3 +374,5 @@ module.config [
backdropClick: false backdropClick: false
] ]
module.exports = ponyfm

View file

@ -24,7 +24,7 @@ window.pfm.preloaders['account-albums-edit'] = [
$.when.all defs $.when.all defs
] ]
angular.module('ponyfm').controller "account-albums-edit", [ module.exports = angular.module('ponyfm').controller "account-albums-edit", [
'$scope', '$state', '$dialog', 'account-albums' '$scope', '$state', '$dialog', 'account-albums'
($scope, $state, $dialog, albums) -> ($scope, $state, $dialog, albums) ->
$scope.isNew = $state.params.album_id == undefined $scope.isNew = $state.params.album_id == undefined

View file

@ -20,7 +20,7 @@ window.pfm.preloaders['account-albums'] = [
$.when.all [tracks.refresh('published=true&in_album=false', true), albums.refresh(true)] $.when.all [tracks.refresh('published=true&in_album=false', true), albums.refresh(true)]
] ]
angular.module('ponyfm').controller "account-albums", [ module.exports = angular.module('ponyfm').controller "account-albums", [
'$scope', '$state', 'account-albums', 'account-tracks' '$scope', '$state', 'account-albums', 'account-tracks'
($scope, $state, albums, tracks) -> ($scope, $state, albums, tracks) ->

View file

@ -14,7 +14,7 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
angular.module('ponyfm').controller "account-image-select", [ module.exports = angular.module('ponyfm').controller "account-image-select", [
'$scope' '$scope'
($scope) -> ($scope) ->
$scope.images = [] $scope.images = []

View file

@ -19,7 +19,7 @@ window.pfm.preloaders['account-playlists'] = [
(playlists) -> playlists.refreshOwned true (playlists) -> playlists.refreshOwned true
] ]
angular.module('ponyfm').controller "account-playlists", [ module.exports = angular.module('ponyfm').controller "account-playlists", [
'$scope', 'auth', '$dialog', 'playlists' '$scope', 'auth', '$dialog', 'playlists'
($scope, auth, $dialog, playlists) -> ($scope, auth, $dialog, playlists) ->
$scope.playlists = [] $scope.playlists = []

View file

@ -14,7 +14,7 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
angular.module('ponyfm').controller "account-settings", [ module.exports = angular.module('ponyfm').controller "account-settings", [
'$scope', 'auth' '$scope', 'auth'
($scope, auth) -> ($scope, auth) ->
$scope.settings = {} $scope.settings = {}

View file

@ -14,7 +14,7 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
angular.module('ponyfm').controller "account-track", [ module.exports = angular.module('ponyfm').controller "account-track", [
'$scope', '$state' '$scope', '$state'
($scope, $state) -> ($scope, $state) ->
# All the fun stuff happens in the pfmTrackEditor directive. # All the fun stuff happens in the pfmTrackEditor directive.

View file

@ -20,7 +20,7 @@ window.pfm.preloaders['account-tracks'] = [
$.when.all [tracks.refresh(null, true), albums.refresh(true), taxonomies.refresh()] $.when.all [tracks.refresh(null, true), albums.refresh(true), taxonomies.refresh()]
] ]
angular.module('ponyfm').controller "account-tracks", [ module.exports = angular.module('ponyfm').controller "account-tracks", [
'$scope', '$state', 'taxonomies', '$dialog', 'lightbox', 'account-albums', 'account-tracks' '$scope', '$state', 'taxonomies', '$dialog', 'lightbox', 'account-albums', 'account-tracks'
($scope, $state, taxonomies, $dialog, lightbox, albums, tracks) -> ($scope, $state, taxonomies, $dialog, lightbox, albums, tracks) ->
$scope.data = $scope.data =

View file

@ -14,7 +14,7 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
angular.module('ponyfm').controller 'admin-genres', [ module.exports = angular.module('ponyfm').controller 'admin-genres', [
'$scope', '$state', 'admin-genres' '$scope', '$state', 'admin-genres'
($scope, $state, genres) -> ($scope, $state, genres) ->

View file

@ -20,7 +20,7 @@ window.pfm.preloaders['album'] = [
$.when.all [albums.fetch $state.params.id, playlists.refreshOwned(true)] $.when.all [albums.fetch $state.params.id, playlists.refreshOwned(true)]
] ]
angular.module('ponyfm').controller "album", [ module.exports = angular.module('ponyfm').controller "album", [
'$scope', '$rootScope', 'albums', '$state', 'playlists', 'auth', '$dialog', 'download-cached', '$window', '$timeout' '$scope', '$rootScope', 'albums', '$state', 'playlists', 'auth', '$dialog', 'download-cached', '$window', '$timeout'
($scope, $rootScope, albums, $state, playlists, auth, $dialog, cachedAlbum, $window, $timeout) -> ($scope, $rootScope, albums, $state, playlists, auth, $dialog, cachedAlbum, $window, $timeout) ->
album = null album = null

View file

@ -20,7 +20,7 @@ window.pfm.preloaders['albums-list'] = [
albums.fetchList($state.params.page, true) albums.fetchList($state.params.page, true)
] ]
angular.module('ponyfm').controller "albums-list", [ module.exports = angular.module('ponyfm').controller "albums-list", [
'$scope', 'albums', '$state' '$scope', 'albums', '$state'
($scope, albums, $state) -> ($scope, albums, $state) ->
albums.fetchList($state.params.page).done (list) -> albums.fetchList($state.params.page).done (list) ->

View file

@ -14,7 +14,7 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
angular.module('ponyfm').controller "albums", [ module.exports = angular.module('ponyfm').controller "albums", [
'$scope', 'albums', '$state' '$scope', 'albums', '$state'
($scope, albums, $state) -> ($scope, albums, $state) ->

View file

@ -14,7 +14,7 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
angular.module('ponyfm').controller "application", [ module.exports = angular.module('ponyfm').controller "application", [
'$scope', 'auth', '$location', 'upload', '$state', '$stateParams', '$injector', '$rootScope', 'playlists' '$scope', 'auth', '$location', 'upload', '$state', '$stateParams', '$injector', '$rootScope', 'playlists'
($scope, auth, $location, upload, $state, $stateParams, $injector, $rootScope, playlists) -> ($scope, auth, $location, upload, $state, $stateParams, $injector, $rootScope, playlists) ->
$scope.auth = auth.data $scope.auth = auth.data

View file

@ -20,7 +20,7 @@ window.pfm.preloaders['artist-content'] = [
$.when.all [artists.fetch($state.params.slug), artists.fetchContent($state.params.slug, true)] $.when.all [artists.fetch($state.params.slug), artists.fetchContent($state.params.slug, true)]
] ]
angular.module('ponyfm').controller "artist-content", [ module.exports = angular.module('ponyfm').controller "artist-content", [
'$scope', 'artists', '$state' '$scope', 'artists', '$state'
($scope, artists, $state) -> ($scope, artists, $state) ->
artists.fetchContent($state.params.slug) artists.fetchContent($state.params.slug)

View file

@ -20,7 +20,7 @@ window.pfm.preloaders['artist-favourites'] = [
$.when.all [artists.fetch($state.params.slug), artists.fetchFavourites($state.params.slug, true)] $.when.all [artists.fetch($state.params.slug), artists.fetchFavourites($state.params.slug, true)]
] ]
angular.module('ponyfm').controller "artist-favourites", [ module.exports = angular.module('ponyfm').controller "artist-favourites", [
'$scope', 'artists', '$state' '$scope', 'artists', '$state'
($scope, artists, $state) -> ($scope, artists, $state) ->
artists.fetchFavourites($state.params.slug).done (artistResponse) -> artists.fetchFavourites($state.params.slug).done (artistResponse) ->

View file

@ -20,7 +20,7 @@ window.pfm.preloaders['artist-profile'] = [
artists.fetch $state.params.slug, true artists.fetch $state.params.slug, true
] ]
angular.module('ponyfm').controller "artist-profile", [ module.exports = angular.module('ponyfm').controller "artist-profile", [
'$scope', 'artists', '$state' '$scope', 'artists', '$state'
($scope, artists, $state) -> ($scope, artists, $state) ->
] ]

View file

@ -20,7 +20,7 @@ window.pfm.preloaders['artist'] = [
artists.fetch $state.params.slug, true artists.fetch $state.params.slug, true
] ]
angular.module('ponyfm').controller "artist", [ module.exports = angular.module('ponyfm').controller "artist", [
'$scope', 'artists', '$state', 'follow' '$scope', 'artists', '$state', 'follow'
($scope, artists, $state, follow) -> ($scope, artists, $state, follow) ->
artists.fetch($state.params.slug) artists.fetch($state.params.slug)

View file

@ -20,7 +20,7 @@ window.pfm.preloaders['artists-list'] = [
artists.fetchList($state.params.page, true) artists.fetchList($state.params.page, true)
] ]
angular.module('ponyfm').controller "artists-list", [ module.exports = angular.module('ponyfm').controller "artists-list", [
'$scope', 'artists', '$state' '$scope', 'artists', '$state'
($scope, artists, $state) -> ($scope, artists, $state) ->
artists.fetchList($state.params.page).done (list) -> artists.fetchList($state.params.page).done (list) ->

View file

@ -14,7 +14,7 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
angular.module('ponyfm').controller "artists", [ module.exports = angular.module('ponyfm').controller "artists", [
'$scope', 'artists', '$state' '$scope', 'artists', '$state'
($scope, artists, $state) -> ($scope, artists, $state) ->

View file

@ -14,7 +14,7 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
angular.module('ponyfm').controller "credits", [ module.exports = angular.module('ponyfm').controller "credits", [
'$scope', 'dialog', '$scope', 'dialog',
($scope, dialog) -> ($scope, dialog) ->
$scope.close = () -> dialog.close(null) $scope.close = () -> dialog.close(null)

View file

@ -19,7 +19,7 @@ window.pfm.preloaders['dashboard'] = [
(dashboard) -> dashboard.refresh(true) (dashboard) -> dashboard.refresh(true)
] ]
angular.module('ponyfm').controller "dashboard", [ module.exports = angular.module('ponyfm').controller "dashboard", [
'$scope', 'dashboard', 'auth', '$http' '$scope', 'dashboard', 'auth', '$http'
($scope, dashboard, auth, $http) -> ($scope, dashboard, auth, $http) ->
$scope.recentTracks = null $scope.recentTracks = null

View file

@ -20,7 +20,7 @@ window.pfm.preloaders['favourites-albums'] = [
favourites.fetchAlbums(true) favourites.fetchAlbums(true)
] ]
angular.module('ponyfm').controller "favourites-albums", [ module.exports = angular.module('ponyfm').controller "favourites-albums", [
'$scope', 'favourites' '$scope', 'favourites'
($scope, favourites) -> ($scope, favourites) ->
favourites.fetchAlbums().done (res) -> favourites.fetchAlbums().done (res) ->

View file

@ -20,7 +20,7 @@ window.pfm.preloaders['favourites-playlists'] = [
favourites.fetchPlaylists(true) favourites.fetchPlaylists(true)
] ]
angular.module('ponyfm').controller "favourites-playlists", [ module.exports = angular.module('ponyfm').controller "favourites-playlists", [
'$scope', 'favourites' '$scope', 'favourites'
($scope, favourites) -> ($scope, favourites) ->
favourites.fetchPlaylists().done (res) -> favourites.fetchPlaylists().done (res) ->

View file

@ -20,7 +20,7 @@ window.pfm.preloaders['favourites-tracks'] = [
favourites.fetchTracks(true) favourites.fetchTracks(true)
] ]
angular.module('ponyfm').controller "favourites-tracks", [ module.exports = angular.module('ponyfm').controller "favourites-tracks", [
'$scope', 'favourites' '$scope', 'favourites'
($scope, favourites) -> ($scope, favourites) ->
favourites.fetchTracks().done (res) -> favourites.fetchTracks().done (res) ->

View file

@ -19,7 +19,7 @@ window.pfm.preloaders['home'] = [
(dashboard) -> dashboard.refresh(true) (dashboard) -> dashboard.refresh(true)
] ]
angular.module('ponyfm').controller "home", [ module.exports = angular.module('ponyfm').controller "home", [
'$scope', 'dashboard' '$scope', 'dashboard'
($scope, dashboard) -> ($scope, dashboard) ->
$scope.recentTracks = null $scope.recentTracks = null

View file

@ -14,7 +14,7 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
angular.module('ponyfm').controller "login", [ module.exports = angular.module('ponyfm').controller "login", [
'$scope', 'auth' '$scope', 'auth'
($scope, auth) -> ($scope, auth) ->

View file

@ -14,7 +14,7 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
angular.module('ponyfm').controller "playlist-form", [ module.exports = angular.module('ponyfm').controller "playlist-form", [
'$scope', 'dialog', 'playlists', 'playlist' '$scope', 'dialog', 'playlists', 'playlist'
($scope, dialog, playlists, playlist) -> ($scope, dialog, playlists, playlist) ->
$scope.isLoading = false $scope.isLoading = false

View file

@ -20,7 +20,7 @@ window.pfm.preloaders['playlist'] = [
playlists.fetch $state.params.id, true playlists.fetch $state.params.id, true
] ]
angular.module('ponyfm').controller 'playlist', [ module.exports = angular.module('ponyfm').controller 'playlist', [
'$scope', '$rootScope', '$state', 'playlists', '$dialog', 'download-cached', '$window', '$timeout' '$scope', '$rootScope', '$state', 'playlists', '$dialog', 'download-cached', '$window', '$timeout'
($scope, $rootScope, $state, playlists, $dialog, cachedPlaylist, $window, $timeout) -> ($scope, $rootScope, $state, playlists, $dialog, cachedPlaylist, $window, $timeout) ->
playlist = null playlist = null

View file

@ -20,7 +20,7 @@ window.pfm.preloaders['playlists-list'] = [
playlists.fetchList($state.params.page, true) playlists.fetchList($state.params.page, true)
] ]
angular.module('ponyfm').controller "playlists-list", [ module.exports = angular.module('ponyfm').controller "playlists-list", [
'$scope', 'playlists', '$state', '$scope', 'playlists', '$state',
($scope, playlists, $state) -> ($scope, playlists, $state) ->
playlists.fetchList($state.params.page).done (searchResults) -> playlists.fetchList($state.params.page).done (searchResults) ->

View file

@ -14,7 +14,7 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
angular.module('ponyfm').controller "playlists", [ module.exports = angular.module('ponyfm').controller "playlists", [
'$scope', 'playlists', '$state' '$scope', 'playlists', '$state'
($scope, playlists, $state) -> ($scope, playlists, $state) ->

View file

@ -14,7 +14,7 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
angular.module('ponyfm').controller "sidebar", [ module.exports = angular.module('ponyfm').controller "sidebar", [
'$scope', '$dialog', 'playlists' '$scope', '$dialog', 'playlists'
($scope, $dialog, playlists) -> ($scope, $dialog, playlists) ->
$scope.playlists = playlists.pinnedPlaylists $scope.playlists = playlists.pinnedPlaylists

View file

@ -15,7 +15,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
angular.module('ponyfm').controller "track-edit", [ module.exports = angular.module('ponyfm').controller "track-edit", [
'$scope', '$state' '$scope', '$state'
($scope, $state) -> ($scope, $state) ->
# All the fun stuff happens in the pfmTrackEditor directive. # All the fun stuff happens in the pfmTrackEditor directive.

View file

@ -20,7 +20,7 @@ window.pfm.preloaders['track-show'] = [
$.when.all [tracks.fetch $state.params.id, playlists.refreshOwned(true)] $.when.all [tracks.fetch $state.params.id, playlists.refreshOwned(true)]
] ]
angular.module('ponyfm').controller "track-show", [ module.exports = angular.module('ponyfm').controller "track-show", [
'$scope', 'tracks', '$state', 'playlists', 'auth', 'favourites', '$dialog' '$scope', 'tracks', '$state', 'playlists', 'auth', 'favourites', '$dialog'
($scope, tracks, $state, playlists, auth, favourites, $dialog) -> ($scope, tracks, $state, playlists, auth, favourites, $dialog) ->
] ]

View file

@ -14,7 +14,7 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
angular.module('ponyfm').controller "track", [ module.exports = angular.module('ponyfm').controller "track", [
'$scope', '$rootScope', 'tracks', '$state', 'playlists', 'auth', 'favourites', '$dialog', 'download-cached', '$window', '$timeout' '$scope', '$rootScope', 'tracks', '$state', 'playlists', 'auth', 'favourites', '$dialog', 'download-cached', '$window', '$timeout'
($scope, $rootScope, tracks, $state, playlists, auth, favourites, $dialog, cachedTrack, $window, $timeout) -> ($scope, $rootScope, tracks, $state, playlists, auth, favourites, $dialog, cachedTrack, $window, $timeout) ->
$scope.track $scope.track

View file

@ -25,7 +25,7 @@ window.pfm.preloaders['tracks-list'] = [
) )
] ]
angular.module('ponyfm').controller "tracks-list", [ module.exports = angular.module('ponyfm').controller "tracks-list", [
'$scope', 'tracks', '$state', '$scope', 'tracks', '$state',
($scope, tracks, $state) -> ($scope, tracks, $state) ->
tracks.mainQuery.fetch().done (searchResults) -> tracks.mainQuery.fetch().done (searchResults) ->

View file

@ -20,7 +20,7 @@ window.pfm.preloaders['tracks'] = [
tracks.loadFilters() tracks.loadFilters()
] ]
angular.module('ponyfm').controller "tracks", [ module.exports = angular.module('ponyfm').controller "tracks", [
'$scope', 'tracks', '$state', 'focus' '$scope', 'tracks', '$state', 'focus'
($scope, tracks, $state, focus) -> ($scope, tracks, $state, focus) ->
$scope.recentTracks = null $scope.recentTracks = null

View file

@ -14,7 +14,7 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
angular.module('ponyfm').controller "uploader", [ module.exports = angular.module('ponyfm').controller "uploader", [
'$scope', 'auth', 'upload', '$state' '$scope', 'auth', 'upload', '$state'
($scope, auth, upload, $state) -> ($scope, auth, upload, $state) ->
$scope.data = upload $scope.data = upload

View file

@ -14,7 +14,7 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
angular.module('ponyfm').directive 'pfmAlbumsList', () -> module.exports = angular.module('ponyfm').directive 'pfmAlbumsList', () ->
restrict: 'E' restrict: 'E'
replace: true replace: true
templateUrl: '/templates/directives/albums-list.html' templateUrl: '/templates/directives/albums-list.html'

View file

@ -16,7 +16,7 @@
# Based on http://stackoverflow.com/questions/14641791/how-to-use-colorbox-with-angular-js # Based on http://stackoverflow.com/questions/14641791/how-to-use-colorbox-with-angular-js
angular.module('ponyfm').directive 'colorbox', -> module.exports = angular.module('ponyfm').directive 'colorbox', ->
restrict: 'AC' restrict: 'AC'
link: (scope, element, attrs) -> link: (scope, element, attrs) ->
$(element).colorbox({maxWidth:'90%', maxHeight:'90%'}) $(element).colorbox({maxWidth:'90%', maxHeight:'90%'})

View file

@ -14,7 +14,7 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
angular.module('ponyfm').directive 'pfmComments', () -> module.exports = angular.module('ponyfm').directive 'pfmComments', () ->
restrict: 'E' restrict: 'E'
templateUrl: '/templates/directives/comments.html' templateUrl: '/templates/directives/comments.html'
scope: scope:

View file

@ -14,7 +14,7 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
angular.module('ponyfm').directive 'pfmEatClick', () -> module.exports = angular.module('ponyfm').directive 'pfmEatClick', () ->
(scope, element) -> (scope, element) ->
$(element).click (e) -> $(element).click (e) ->
e.preventDefault() e.preventDefault()

View file

@ -14,7 +14,7 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
angular.module('ponyfm').directive 'pfmFavouriteButton', () -> module.exports = angular.module('ponyfm').directive 'pfmFavouriteButton', () ->
restrict: 'E' restrict: 'E'
templateUrl: '/templates/directives/favourite-button.html' templateUrl: '/templates/directives/favourite-button.html'
scope: scope:

View file

@ -14,7 +14,7 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
angular.module('ponyfm').directive 'pfmImageUpload', () -> module.exports = angular.module('ponyfm').directive 'pfmImageUpload', () ->
$image = null $image = null
$uploader = null $uploader = null

View file

@ -17,7 +17,7 @@
# This directive calls the given function when Enter is pressed in a # This directive calls the given function when Enter is pressed in a
# standalone input field. # standalone input field.
angular.module('ponyfm').directive 'pfmOnEnter', () -> module.exports = angular.module('ponyfm').directive 'pfmOnEnter', () ->
(scope, element, attrs) -> (scope, element, attrs) ->
element.bind("keyup", (event) -> element.bind("keyup", (event) ->
if (event.which is 13) if (event.which is 13)

View file

@ -14,7 +14,7 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
angular.module('ponyfm').directive 'pfmPlayer', () -> module.exports = angular.module('ponyfm').directive 'pfmPlayer', () ->
$element = null $element = null
restrict: 'E' restrict: 'E'

View file

@ -14,7 +14,7 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
angular.module('ponyfm').directive 'pfmPlaylistsList', () -> module.exports = angular.module('ponyfm').directive 'pfmPlaylistsList', () ->
restrict: 'E' restrict: 'E'
replace: true replace: true
templateUrl: '/templates/directives/playlists-list.html' templateUrl: '/templates/directives/playlists-list.html'

View file

@ -14,7 +14,7 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
angular.module('ponyfm').directive 'pfmPopup', () -> module.exports = angular.module('ponyfm').directive 'pfmPopup', () ->
(scope, element, attrs) -> (scope, element, attrs) ->
align = 'left' align = 'left'
elementId = attrs.pfmPopup elementId = attrs.pfmPopup

View file

@ -14,7 +14,7 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
angular.module('ponyfm').directive 'pfmProgressBar', () -> module.exports = angular.module('ponyfm').directive 'pfmProgressBar', () ->
(scope, element, attrs) -> (scope, element, attrs) ->
scope.$watch attrs.pfmProgressBar, (val) -> scope.$watch attrs.pfmProgressBar, (val) ->
return if !val? return if !val?

View file

@ -14,7 +14,7 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
angular.module('ponyfm').directive 'pfmScrollRecorder', () -> module.exports = angular.module('ponyfm').directive 'pfmScrollRecorder', () ->
(scope, element, attrs) -> (scope, element, attrs) ->
timeout = null timeout = null
onScroll = null onScroll = null

View file

@ -14,7 +14,7 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
angular.module('ponyfm').directive 'pfmSearch', () -> module.exports = angular.module('ponyfm').directive 'pfmSearch', () ->
restrict: 'E' restrict: 'E'
templateUrl: '/templates/directives/search.html' templateUrl: '/templates/directives/search.html'
scope: scope:

View file

@ -14,7 +14,7 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
angular.module('ponyfm').directive 'pfmShareButtons', () -> module.exports = angular.module('ponyfm').directive 'pfmShareButtons', () ->
(scope, element) -> (scope, element) ->
window.setTimeout((-> window.setTimeout((->
Tumblr.activate_share_on_tumblr_buttons() Tumblr.activate_share_on_tumblr_buttons()

View file

@ -14,7 +14,7 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
angular.module('ponyfm').directive 'pfmSrcLoader', () -> module.exports = angular.module('ponyfm').directive 'pfmSrcLoader', () ->
(scope, element, attrs) -> (scope, element, attrs) ->
size = attrs.pfmSrcSize || 'normal' size = attrs.pfmSrcSize || 'normal'
element.css {opacity: .5} element.css {opacity: .5}

View file

@ -14,7 +14,7 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
angular.module('ponyfm').directive 'pfmTrackEditor', () -> module.exports = angular.module('ponyfm').directive 'pfmTrackEditor', () ->
restrict: 'E' restrict: 'E'
templateUrl: '/templates/directives/track-editor.html' templateUrl: '/templates/directives/track-editor.html'
scope: scope:

View file

@ -14,7 +14,7 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
angular.module('ponyfm').directive 'pfmTrackPlayer', () -> module.exports = angular.module('ponyfm').directive 'pfmTrackPlayer', () ->
restrict: 'E' restrict: 'E'
templateUrl: '/templates/directives/track-player.html' templateUrl: '/templates/directives/track-player.html'
scope: scope:

View file

@ -14,7 +14,7 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
angular.module('ponyfm').directive 'pfmTracksList', () -> module.exports = angular.module('ponyfm').directive 'pfmTracksList', () ->
restrict: 'E' restrict: 'E'
templateUrl: '/templates/directives/tracks-list.html' templateUrl: '/templates/directives/tracks-list.html'
replace: true replace: true

View file

@ -14,7 +14,7 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
angular.module('ponyfm').directive 'uploader', [ module.exports = angular.module('ponyfm').directive 'uploader', [
'upload' 'upload'
(upload) -> (scope, element) -> (upload) -> (scope, element) ->
$dropzone = $(element) $dropzone = $(element)

View file

@ -14,7 +14,7 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
angular.module('ponyfm').directive 'pfmUsersList', () -> module.exports = angular.module('ponyfm').directive 'pfmUsersList', () ->
restrict: 'E' restrict: 'E'
replace: true replace: true
templateUrl: '/templates/directives/users-list.html' templateUrl: '/templates/directives/users-list.html'

View file

@ -14,6 +14,6 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
angular.module('ponyfm').filter 'pfmLength', () -> module.exports = angular.module('ponyfm').filter 'pfmLength', () ->
(input) -> (input) ->
input.length input.length

View file

@ -14,6 +14,6 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
angular.module('ponyfm').filter 'momentFromNow', () -> module.exports = angular.module('ponyfm').filter 'momentFromNow', () ->
(input) -> (input) ->
moment.utc(input).fromNow() moment.utc(input).fromNow()

View file

@ -1,6 +1,6 @@
# Based on https://gist.github.com/kensnyder/49136af39457445e5982 # Based on https://gist.github.com/kensnyder/49136af39457445e5982
angular.module('ponyfm').filter 'nl2br', [ module.exports = angular.module('ponyfm').filter 'nl2br', [
'$sanitize' '$sanitize'
($sanitize) -> ($sanitize) ->
tag = if /xhtml/i.test(document.doctype) then '<br />' else '<br>' tag = if /xhtml/i.test(document.doctype) then '<br />' else '<br>'
@ -8,4 +8,4 @@ angular.module('ponyfm').filter 'nl2br', [
# ngSanitize's linky filter changes \r and \n to &#10; and &#13; respectively # ngSanitize's linky filter changes \r and \n to &#10; and &#13; respectively
msg = (msg + '').replace(/(\r\n|\n\r|\r|\n|&#10;&#13;|&#13;&#10;|&#10;|&#13;)/g, tag + '$1') msg = (msg + '').replace(/(\r\n|\n\r|\r|\n|&#10;&#13;|&#13;&#10;|&#10;|&#13;)/g, tag + '$1')
$sanitize msg $sanitize msg
] ]

View file

@ -14,7 +14,7 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
angular.module('ponyfm').filter 'noHTML', () -> module.exports = angular.module('ponyfm').filter 'noHTML', () ->
(input) -> (input) ->
return '' if !input return '' if !input

View file

@ -14,7 +14,7 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
angular.module('ponyfm').filter 'secondsDisplay', () -> module.exports = angular.module('ponyfm').filter 'secondsDisplay', () ->
(input) -> (input) ->
sec_num = parseInt(input, 10) sec_num = parseInt(input, 10)
return '00:00' if !sec_num return '00:00' if !sec_num

View file

@ -14,7 +14,7 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
angular.module('ponyfm').filter 'trust', [ module.exports = angular.module('ponyfm').filter 'trust', [
'$sce' '$sce'
($sce) -> ($sce) ->
(input) -> (input) ->

View file

@ -14,7 +14,7 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
angular.module('ponyfm').factory('account-albums', [ module.exports = angular.module('ponyfm').factory('account-albums', [
'$rootScope', '$http' '$rootScope', '$http'
($rootScope, $http) -> ($rootScope, $http) ->
def = null def = null

View file

@ -14,7 +14,7 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
angular.module('ponyfm').factory('account-tracks', [ module.exports = angular.module('ponyfm').factory('account-tracks', [
'$rootScope', '$http' '$rootScope', '$http'
($rootScope, $http) -> ($rootScope, $http) ->
cache = {} cache = {}

View file

@ -14,7 +14,7 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
angular.module('ponyfm').factory('admin-genres', [ module.exports = angular.module('ponyfm').factory('admin-genres', [
'$rootScope', '$http' '$rootScope', '$http'
($rootScope, $http) -> ($rootScope, $http) ->
def = null def = null

View file

@ -14,7 +14,7 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
angular.module('ponyfm').factory('albums', [ module.exports = angular.module('ponyfm').factory('albums', [
'$rootScope', '$http' '$rootScope', '$http'
($rootScope, $http) -> ($rootScope, $http) ->
albumPages = [] albumPages = []

View file

@ -14,7 +14,7 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
angular.module('ponyfm').factory('artists', [ module.exports = angular.module('ponyfm').factory('artists', [
'$rootScope', '$http' '$rootScope', '$http'
($rootScope, $http) -> ($rootScope, $http) ->
artistPage = [] artistPage = []

View file

@ -14,7 +14,7 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
angular.module('ponyfm').factory('auth', [ module.exports = angular.module('ponyfm').factory('auth', [
'$rootScope' '$rootScope'
($rootScope) -> ($rootScope) ->
data: {isLogged: window.pfm.auth.isLogged, user: window.pfm.auth.user} data: {isLogged: window.pfm.auth.isLogged, user: window.pfm.auth.user}

View file

@ -14,7 +14,7 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
angular.module('ponyfm').factory('comments', [ module.exports = angular.module('ponyfm').factory('comments', [
'$rootScope', '$http' '$rootScope', '$http'
($rootScope, $http) -> ($rootScope, $http) ->
commentCache = [] commentCache = []

View file

@ -14,7 +14,7 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
angular.module('ponyfm').factory('dashboard', [ module.exports = angular.module('ponyfm').factory('dashboard', [
'$rootScope', '$http' '$rootScope', '$http'
($rootScope, $http) -> ($rootScope, $http) ->
def = null def = null

View file

@ -14,7 +14,7 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
angular.module('ponyfm').factory('download-cached', [ module.exports = angular.module('ponyfm').factory('download-cached', [
'$rootScope', '$http', '$log' '$rootScope', '$http', '$log'
($rootScope, $http, $log) -> ($rootScope, $http, $log) ->
download = (type, id, format) -> download = (type, id, format) ->
@ -33,4 +33,4 @@ angular.module('ponyfm').factory('download-cached', [
$http.get(url).then(encodingComplete).catch encodingFailed $http.get(url).then(encodingComplete).catch encodingFailed
{download: download} {download: download}
]) ])

View file

@ -14,7 +14,7 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
angular.module('ponyfm').factory('favourites', [ module.exports = angular.module('ponyfm').factory('favourites', [
'$rootScope', '$http' '$rootScope', '$http'
($rootScope, $http) -> ($rootScope, $http) ->
tracksDef = null tracksDef = null

View file

@ -19,7 +19,7 @@
# using a jQuery selector. # using a jQuery selector.
# #
# Based on: https://stackoverflow.com/a/25597540/3225811 # Based on: https://stackoverflow.com/a/25597540/3225811
angular.module('ponyfm').factory('focus', ['$timeout', '$window', ($timeout, $window) -> module.exports = angular.module('ponyfm').factory('focus', ['$timeout', '$window', ($timeout, $window) ->
(selector) -> (selector) ->
$timeout () -> $timeout () ->
element = $window.jQuery("#{selector}") element = $window.jQuery("#{selector}")

View file

@ -14,7 +14,7 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
angular.module('ponyfm').factory('follow', [ module.exports = angular.module('ponyfm').factory('follow', [
'$rootScope', '$http' '$rootScope', '$http'
($rootScope, $http) -> ($rootScope, $http) ->
self = self =

View file

@ -14,7 +14,7 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
angular.module('ponyfm').factory('images', [ module.exports = angular.module('ponyfm').factory('images', [
'$rootScope' '$rootScope'
($rootScope) -> ($rootScope) ->
def = null def = null

View file

@ -14,7 +14,7 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
angular.module('ponyfm').factory('lightbox', [ module.exports = angular.module('ponyfm').factory('lightbox', [
() -> () ->
openDataUrl: (src) -> openDataUrl: (src) ->
$.colorbox $.colorbox

View file

@ -14,7 +14,7 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
angular.module('ponyfm').factory('player', [ module.exports = angular.module('ponyfm').factory('player', [
'$rootScope' '$rootScope'
($rootScope) -> ($rootScope) ->
readyDef = new $.Deferred() readyDef = new $.Deferred()

View file

@ -14,7 +14,7 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
angular.module('ponyfm').factory('playlists', [ module.exports = angular.module('ponyfm').factory('playlists', [
'$rootScope', '$state', '$http', 'auth' '$rootScope', '$state', '$http', 'auth'
($rootScope, $state, $http, auth) -> ($rootScope, $state, $http, auth) ->
playlistDef = null playlistDef = null

View file

@ -14,7 +14,7 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
angular.module('ponyfm').factory('search', [ module.exports = angular.module('ponyfm').factory('search', [
'$http' '$http'
($http) -> ($http) ->

View file

@ -14,7 +14,7 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
angular.module('ponyfm').factory('taxonomies', [ module.exports = angular.module('ponyfm').factory('taxonomies', [
'$rootScope', '$http' '$rootScope', '$http'
($rootScope, $http) -> ($rootScope, $http) ->
def = null def = null

View file

@ -14,7 +14,7 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
angular.module('ponyfm').factory('tracks', [ module.exports = angular.module('ponyfm').factory('tracks', [
'$rootScope', '$http', 'taxonomies' '$rootScope', '$http', 'taxonomies'
($rootScope, $http, taxonomies) -> ($rootScope, $http, taxonomies) ->
filterDef = null filterDef = null

View file

@ -14,7 +14,7 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
angular.module('ponyfm').factory('upload', [ module.exports = angular.module('ponyfm').factory('upload', [
'$rootScope', '$http', '$timeout', 'account-tracks' '$rootScope', '$http', '$timeout', 'account-tracks'
($rootScope, $http, $timeout, accountTracks) -> ($rootScope, $http, $timeout, accountTracks) ->
self = self =

File diff suppressed because it is too large Load diff

View file

@ -14,6 +14,17 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
require 'script!../base/jquery-2.0.2'
require '../base/jquery.timeago'
require '../base/soundmanager2-nodebug'
require './favourite.coffee'
require 'script!../base/underscore'
require '../shared/layout.coffee'
require 'script!../shared/underscore-extensions'
$('.timeago').timeago() $('.timeago').timeago()
loaderDef = new $.Deferred() loaderDef = new $.Deferred()

View file

@ -14,6 +14,12 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
require 'script!../base/underscore'
require './jquery-extensions'
require './layout.coffee'
require 'script!./underscore-extensions'
def = new $.Deferred() def = new $.Deferred()
pfm.soundManager = def.promise() pfm.soundManager = def.promise()

View file

@ -25,7 +25,7 @@
<script> <script>
window.fbAsyncInit = function() { window.fbAsyncInit = function() {
FB.init({ FB.init({
appId : '186765381447538', appId: '186765381447538',
status: true, status: true,
cookie: true, cookie: true,
xfbml: true xfbml: true
@ -158,11 +158,7 @@
</script> </script>
@endif @endif
{!! Assets::scriptIncludes() !!} {!! Assets::scriptIncludes('app') !!}
@if (!Config::get("app.debug"))
<script src="/build/scripts/templates.js"></script>
@endif
@yield('app_scripts') @yield('app_scripts')

31
webpack.base.config.js Normal file
View file

@ -0,0 +1,31 @@
var path = require('path');
var webpack = require('webpack');
// NOTE: This is a base config; it's not meant to be used directly!
module.exports = {
module: {
loaders: [
{test: /\.coffee$/, loader: "coffee"}
],
noParse: [/pfm-angular-marked\.js/]
},
plugins: [
new webpack.ProvidePlugin({
$: "jquery",
jQuery: "jquery"
})
],
entry: {
app: './resources/assets/scripts/app/app.coffee',
embed: './resources/assets/scripts/embed/embed.coffee'
},
output: {
path: __dirname + '/public',
filename: './build/scripts/[name].js'
// publicPath should be defined in the dev config!
},
resolve: {
extensions: ["", ".webpack.js", ".web.js", ".js", ".coffee"]
}
};

12
webpack.dev.config.js Normal file
View file

@ -0,0 +1,12 @@
var path = require('path');
var webpack = require('webpack');
var _ = require('underscore');
var webpackBaseConfig = require('./webpack.base.config.js');
var config = _.clone(webpackBaseConfig);
config.devtool = 'source-map';
config.output.publicPath = 'http://localhost:61999/build/';
module.exports = config;

View file

@ -0,0 +1,16 @@
var path = require('path');
var webpack = require('webpack');
var _ = require('underscore');
var webpackBaseConfig = require('./webpack.base.config.js');
var config = _.clone(webpackBaseConfig);
config.plugins.push(
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
}
})
);
module.exports = config;