{"action":"created","issue":{"url":"https://api.github.com/repos/pimusicbox/mopidy-musicbox-webclient/issues/193","repository_url":"https://api.github.com/repos/pimusicbox/mopidy-musicbox-webclient","labels_url":"https://api.github.com/repos/pimusicbox/mopidy-musicbox-webclient/issues/193/labels{/name}","comments_url":"https://api.github.com/repos/pimusicbox/mopidy-musicbox-webclient/issues/193/comments","events_url":"https://api.github.com/repos/pimusicbox/mopidy-musicbox-webclient/issues/193/events","html_url":"https://github.com/pimusicbox/mopidy-musicbox-webclient/pull/193","id":150654192,"number":193,"title":"Tracklist popup menu overhaul","user":{"login":"jcass77","id":10268911,"avatar_url":"https://avatars.githubusercontent.com/u/10268911?v=3","gravatar_id":"","url":"https://api.github.com/users/jcass77","html_url":"https://github.com/jcass77","followers_url":"https://api.github.com/users/jcass77/followers","following_url":"https://api.github.com/users/jcass77/following{/other_user}","gists_url":"https://api.github.com/users/jcass77/gists{/gist_id}","starred_url":"https://api.github.com/users/jcass77/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jcass77/subscriptions","organizations_url":"https://api.github.com/users/jcass77/orgs","repos_url":"https://api.github.com/users/jcass77/repos","events_url":"https://api.github.com/users/jcass77/events{/privacy}","received_events_url":"https://api.github.com/users/jcass77/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2016-04-24T11:36:31Z","updated_at":"2016-04-25T16:07:27Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/pimusicbox/mopidy-musicbox-webclient/pulls/193","html_url":"https://github.com/pimusicbox/mopidy-musicbox-webclient/pull/193","diff_url":"https://github.com/pimusicbox/mopidy-musicbox-webclient/pull/193.diff","patch_url":"https://github.com/pimusicbox/mopidy-musicbox-webclient/pull/193.patch"},"body":"I've reworked the popup menus and refactored a few other small things along the way:\r\n\r\n![skitched-20160424-132044](https://cloud.githubusercontent.com/assets/10268911/14767160/66e500fc-0a1f-11e6-830a-8e2b978e475d.png)\r\n\r\n- Changed the look and feel of the popups.\r\n- Modularise ``controls.js`` so that it can be tested.\r\n- Fixes #124: now uses ``tlid`` exclusively for playback, so playing the wrong track should no longer be an issue. Unplayable tracks will just follow the current Mopidy skip-to-next convention.\r\n- Fixes #133 (sort of): now remembers the last popup action that was selected, and makes that the new default `onClick` action. The default is stored in a cookie to accommodate the preferences of different users using the same Mopidy backend. I'm not sure if that will work for everybody though. Ideally this should be a configurable default, but it will have to wait until the 'Settings' page has been enhanced to accommodate custom settings for MMW in addition to the Pi MusicBox stuff as well. Alternatively we could also specify that the user should perform at least two consecutive actions before the default is changed. I'm open to feedback / comments / suggestions on this.\r\n- A lot of code refactoring and consolidation behind the scenes. \r\n- Tests for the main functions that I worked on, but there is still a long way to go.\r\n\r\nThere are some follow-up actions that I would like to submit in a separate PR once this has been merged:\r\n- The popup functionality should ideally be split out into separate .js and .html files to make the code structure more modular.\r\n- There are a few global arrays that are being used to \"cache\" tracklist information (see ``popupData``, ``playlists``, and ``customTracklists`` in ``functionfars.js``. The contents of these are difficult to predict at any given point in time, as various parts of the code will overwrite values, and some store ``mopidy.models.Refs`` while others store ``mopidy.models.Track``. It's probably time to refactor this into a proper centralised cache that can be used to route ``mopidy.library.lookup`` calls through."},"comment":{"url":"https://api.github.com/repos/pimusicbox/mopidy-musicbox-webclient/issues/comments/214420615","html_url":"https://github.com/pimusicbox/mopidy-musicbox-webclient/pull/193#issuecomment-214420615","issue_url":"https://api.github.com/repos/pimusicbox/mopidy-musicbox-webclient/issues/193","id":214420615,"user":{"login":"jcass77","id":10268911,"avatar_url":"https://avatars.githubusercontent.com/u/10268911?v=3","gravatar_id":"","url":"https://api.github.com/users/jcass77","html_url":"https://github.com/jcass77","followers_url":"https://api.github.com/users/jcass77/followers","following_url":"https://api.github.com/users/jcass77/following{/other_user}","gists_url":"https://api.github.com/users/jcass77/gists{/gist_id}","starred_url":"https://api.github.com/users/jcass77/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jcass77/subscriptions","organizations_url":"https://api.github.com/users/jcass77/orgs","repos_url":"https://api.github.com/users/jcass77/repos","events_url":"https://api.github.com/users/jcass77/events{/privacy}","received_events_url":"https://api.github.com/users/jcass77/received_events","type":"User","site_admin":false},"created_at":"2016-04-25T16:07:27Z","updated_at":"2016-04-25T16:07:27Z","body":"Thank you for the review @kingosticks .\r\n\r\nI've added the ``on_track_click`` configuration option and squashed all of the commits.\r\n\r\nOnce you've given it a test run we can take a another look at adding the icons for the 'Show...' menu options if you still feel that it would make the interface easier to use.\r\n\r\nThe ``DYNAMIC`` functionality is encapsulated fairly neatly in https://github.com/pimusicbox/mopidy-musicbox-webclient/blob/581734aedf38e01d1570f89646a967a8756afc39/mopidy_musicbox_webclient/static/js/controls.js#L90-L109, so I don't think it is too bad."}}