Commit graph

17 commits

Author SHA1 Message Date
Hyzual
9f24576d04 Refactor queue.js
- Added angular-ui's ui-sortable directive
- Removed our custom drag & drop handlers, they are replaced by ui-sortable.
- Refactored queue.js to better comply with https://github.com/johnpapa/angular-styleguide#controllers. Having the exposed
2015-07-12 01:53:01 +02:00
Hyzual
5d35c2bd1a Replaced Underscore with Lodash
Lodash has more useful functions and is more regularly updated.
2015-07-07 22:06:59 +02:00
Hyzual
96aa1be2cf Display the loading spinner gif for all angular ajax requests
Remove the ajax-loader.gif which appeared only in unused styles.
2015-05-28 22:07:17 +02:00
Hyzual
fb65ae48bf Removes the angular constant jamstashVersion, goes back to using the json changelog as latest version
- Adds tests to checkVersion & checkVersionNewer: if the second version (older or required version) is undefined, it always returns true. This enables us to upgrade the settings even if there never was a Jamstash version stored in local storage.
2015-03-24 18:36:55 +01:00
Hyzual
fe6c10bc4a Rewrites checkVersion and checkVersionNewer in utils-service.js, refines upgradeToVersion
- Adds unit tests that cover all cases.
- Adds call to parseVersionString() so we can pass it version string e.g. '1.0.1'
- persistence-service.js now also manages JamstashVersion. It is set in localStorage from app.js's constant, and not from the changelog so we don't have to add a version to the changelog to actually do stuff.
- persistence-service.js's upgradeToVersion() now only applies newer changesets. This ensures we won't erase users' settings with changesets at every new version, e.g. resetting songSearchType to song every time.
- upgradeToVersion() will also notify the user of the upgrade, which was formerly done in settings.js
2015-03-24 18:36:55 +01:00
Hyzual
ae703c1542 Refines the changesets mechanism.
- Adds an angular "value" that will contain an array of objects with version and change to be applied to the settings.
- Adds the possibility to run multiple changesets (e.g. upgrade from v1.0.0 to v1.0.2).
- Adds todos in the utils service for things related to version comparisons.
2015-03-24 18:36:54 +01:00
Hyzual
a97e5159bc Uses angular-locker to store settings in localStorage
- settings.js now has its own module : 'jamstash.settings.controller'. This makes it easier to test it and identify what dependencies it has.
- Renames 'jamstash.settings' module into 'jamstash.settings.service'
- Adds an angular constant to hold the current Jamstash version in app.js.
- Adds a way to upgrade incrementally what was in localStorage : in 4.4.5, DefaultSearchType will no longer be an object but an int, so we must init it with an int value, otherwise a blank option will be displayed. We detect what version we are using and what version was stored using persistence-service.js and run the upgrade accordingly.

- Refactors almost completely persistence-service_test.js
- Unit-tests some of settings.js's methods.
2015-03-24 18:36:54 +01:00
Hyzual
8529e331a2 Adds angular-ui/ui-utils/ui-keypress dependency
It provides a directive to bind keypress / keyup / keydown events to the DOM.
- Adds back toggling play / pause by pressing space.
- Renames player-service's pause() to togglePause(), which is its actual behavior
- Adds unit tests to togglePause() in player-service
2015-02-08 22:46:47 +01:00
Hyzual
42830bbdbf Extracts everything related to localStorage in common/persistence-service.js
That way, whenever we want to use something else (like a JSON file, or a DB) we will only have to change persistence-service.js
- Migrated the unit tests there too.
- Added replay in case of jPlayer error.
2015-01-17 19:15:07 +01:00
Hyzual
83869b7808 Adds angular-locker dependency.
- It makes it easier to use localStorage and sessionStorage "the angular way". It also does all the error handling so we don't need to.
- Adds back the automatic saving of the current track's position and playing queue in localStorage. It's fully unit tested.
- Adds back the notifications. Every time we change songs (if the setting is true), it displays a notification. Clicking on it goes to the next song, just like before.
- Bumps up the versions to the actual value on the various json files.
2015-01-17 19:13:43 +01:00
Hyzual
226a768987 Renamed all controlles from 'Ctrl' to 'Controller' to better follow angular best practices. 2015-01-17 19:13:40 +01:00
Hyzual
e5846e30f9 Removes the player functions from the rootScope.
However, saving track's position is broken.
Some are still there because of problems I don't know how to solve, e.g. circular dependency between notifications and player.
Uses the queue controller for the sidebar queue.
Moves loadTrackPosition to the main controller.
2015-01-17 19:12:56 +01:00
Hyzual
74ac275ece Refactors the player service.
The idea is that the service should ideally be used directly, so we know who depends on what and don't end up with cycles.
To achieve this, we should not add functions to $rootScope but instead provide them from our service.
Services can use them directly, and controllers have to create other functions in their own scope.

This means that we have a player-controller that does not do much by itself but it enables us to avoid filling up the $rootScope.

I have left the $rootScope additions at the end of player-service because it's going to take some time to refactor it, so in the meantime I want things to keep working.
2015-01-17 19:12:56 +01:00
Hyzual
608d4f98e2 Extracts the player into its own files.
Creates a player directive, controller and service.
Moves the HTML from inside index.html to its own player.html file.

Conflicts:
	app/index.html
2015-01-17 19:12:55 +01:00
Hyzual
b49830adbe Separates the Archive controller and service into their own modules.
Moves $scope.getMusicFolders to the Subsonic controller since its only used by it. It also made the tests crash :p

Adds variable declarations where they were missing. It causes an error with "use strict".
2014-11-09 18:39:03 +01:00
Hyzual
1fb70ea5ec Adds the first working grunt build aimed for deployment on production.
TL;DR : everything but CSS is minified and packed in a neat dist/ directory.

This build :
- Merges all vendor dependencies (jquery, angular, etc) into one minified file.
- Merges the non-bower vendor dependencies (UnityShim, jquery-split-pane, etc). into one minified file.
- Merges all our javascript into one minified file.
- Copies all the needed CSS (couldn't minify and rename it because of dependencies in the JS).
- Renames all the images, the minified javascripts (but not the CSS) in order to avoid browser caching.
- Minifies all our html files.

Adds usemin commentaries (the ones with build) to index.html. Don't remove them or the build will break.

Renames the json files to .json so the build can find them and copy them.

Corrects all the angular-injectable functions to use the long form (with the array) in order to be minified. The build should also do that now with ng-Annotate but since I did it when debugging problems with the build, might as well keep it.

Note: the grunt test target is broken. Haven't figured out why yet.

Conflicts:
	app/app.js
	app/common/directives.js
	app/index.html
	app/settings/settings.js
2014-11-09 18:39:02 +01:00
Hyzual
a1d48bbd30 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
2014-11-09 16:10:34 +01:00
Renamed from js/app.js (Browse further)