Publish Vulpes Preview 15 sources for desktop, Android and Tundra
Share Gaia assets and adapters, keep private profiles and development documents local, and update both public READMEs.
This commit is contained in:
parent
93e3a48004
commit
b38dea0597
25901 changed files with 9982925 additions and 369 deletions
40
gaia/apps/music/views/playlist-detail/index.html
Executable file
40
gaia/apps/music/views/playlist-detail/index.html
Executable file
|
|
@ -0,0 +1,40 @@
|
|||
<!DOCTYPE html>
|
||||
<html class="theme-media">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title data-l10n-id="playlists2">Playlists</title>
|
||||
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1">
|
||||
<!-- Localization -->
|
||||
<meta name="defaultLanguage" content="en-US">
|
||||
<meta name="availableLanguages" content="en-US">
|
||||
<link rel="localization" href="/locales/music.{locale}.properties">
|
||||
<link rel="localization" href="/shared/locales/media/media.{locale}.properties">
|
||||
<!-- Stylesheets -->
|
||||
<link rel="stylesheet" href="/components/gaia-icons/gaia-icons.css">
|
||||
<link rel="stylesheet" href="/components/gaia-theme/gaia-theme.css">
|
||||
<link rel="stylesheet" href="/css/view.css">
|
||||
<link rel="stylesheet" href="view.css">
|
||||
<!-- Deferred Scripts -->
|
||||
<script defer src="/components/bridge/client.js"></script>
|
||||
<script defer src="/shared/js/intl/l20n-client.js"></script>
|
||||
<script defer src="/shared/js/intl_helper.js"></script>
|
||||
<script defer src="/components/dom-scheduler/lib/dom-scheduler.js"></script>
|
||||
<script defer src="/components/fast-list/fast-list.js"></script>
|
||||
<script defer src="/components/poplar/poplar.js"></script>
|
||||
<script defer src="/components/gaia-component/gaia-component.js"></script>
|
||||
<script defer src="/components/gaia-fast-list/gaia-fast-list.js"></script>
|
||||
<script defer src="/js/config.js"></script>
|
||||
<script defer src="/js/view.js"></script>
|
||||
<script defer src="view.js"></script>
|
||||
</head>
|
||||
<body role="application">
|
||||
<gaia-fast-list id="list" top="50" bottom="0">
|
||||
<template>
|
||||
<a href="/player" data-file-path="${name}" data-number="${index}">
|
||||
<h3 dir="auto">${title}</h3>
|
||||
<p dir="auto">${artist}</p>
|
||||
</a>
|
||||
</template>
|
||||
</gaia-fast-list>
|
||||
</body>
|
||||
</html>
|
||||
3
gaia/apps/music/views/playlist-detail/view.css
Executable file
3
gaia/apps/music/views/playlist-detail/view.css
Executable file
|
|
@ -0,0 +1,3 @@
|
|||
gaia-fast-list em {
|
||||
line-height: 0;
|
||||
}
|
||||
65
gaia/apps/music/views/playlist-detail/view.js
Executable file
65
gaia/apps/music/views/playlist-detail/view.js
Executable file
|
|
@ -0,0 +1,65 @@
|
|||
/* global View, IntlHelper */
|
||||
'use strict';
|
||||
|
||||
var PlaylistDetailView = View.extend(function PlaylistDetailView() {
|
||||
View.call(this); // super();
|
||||
|
||||
this.list = document.getElementById('list');
|
||||
|
||||
this.list.addEventListener('click', (evt) => {
|
||||
var link = evt.target.closest('a[data-file-path]');
|
||||
if (link) {
|
||||
this.queuePlaylist(link.dataset.filePath);
|
||||
}
|
||||
});
|
||||
|
||||
this.client.on('databaseChange', () => this.update());
|
||||
|
||||
this.update();
|
||||
});
|
||||
|
||||
PlaylistDetailView.prototype.update = function() {
|
||||
return this.getPlaylist().then((songs) => {
|
||||
this.songs = songs;
|
||||
return this.render();
|
||||
});
|
||||
};
|
||||
|
||||
PlaylistDetailView.prototype.destroy = function() {
|
||||
this.client.destroy();
|
||||
View.prototype.destroy.call(this); // super(); // Always call *last*
|
||||
};
|
||||
|
||||
PlaylistDetailView.prototype.render = function() {
|
||||
return this.list.setModel(this.songs)
|
||||
.then(this.onRenderDone);
|
||||
};
|
||||
|
||||
PlaylistDetailView.prototype.getPlaylist = function() {
|
||||
var unpaddedIndex = IntlHelper.get('unpaddedIndex');
|
||||
|
||||
return this.fetch('/api/playlists/info/' + this.params.id)
|
||||
.then(response => response.json())
|
||||
.then(songs => {
|
||||
return songs.map((song, index) => {
|
||||
return {
|
||||
index: unpaddedIndex.format(index + 1),
|
||||
name: song.name,
|
||||
title: song.metadata.title,
|
||||
artist: song.metadata.artist
|
||||
};
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
PlaylistDetailView.prototype.queuePlaylist = function(filePath) {
|
||||
this.fetch('/api/queue/playlist/' + this.params.id + '/song/' + filePath);
|
||||
};
|
||||
|
||||
IntlHelper.define('unpaddedIndex', 'number', {
|
||||
style: 'decimal',
|
||||
useGrouping: false,
|
||||
minimumIntegerDigits: 1
|
||||
});
|
||||
|
||||
window.view = new PlaylistDetailView();
|
||||
Loading…
Reference in a new issue