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
45
gaia/apps/music/views/albums/index.html
Executable file
45
gaia/apps/music/views/albums/index.html
Executable file
|
|
@ -0,0 +1,45 @@
|
|||
<!DOCTYPE html>
|
||||
<html class="theme-media">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title data-l10n-id="albums">Albums</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">
|
||||
<!-- Deferred Scripts -->
|
||||
<script defer src="/components/bridge/client.js"></script>
|
||||
<script defer src="/shared/js/intl/l20n-client.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="/components/gaia-sub-header/gaia-sub-header.js"></script>
|
||||
<script defer src="/components/gaia-text-input/gaia-text-input.js"></script>
|
||||
<script defer src="/elements/music-search-box.js"></script>
|
||||
<script defer src="/elements/music-search-results.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" hidden>
|
||||
<gaia-fast-list id="list" top="50" bottom="0" caching>
|
||||
<music-search-box id="search-box" results="#search-results"></music-search-box>
|
||||
<template>
|
||||
<a href="${url}">
|
||||
<div class="image"><img/></div>
|
||||
<h3 dir="auto">${album}</h3>
|
||||
<p dir="auto">${artist}</p>
|
||||
</a>
|
||||
</template>
|
||||
</gaia-fast-list>
|
||||
<music-search-results id="search-results"></music-search-results>
|
||||
</body>
|
||||
</html>
|
||||
86
gaia/apps/music/views/albums/view.js
Executable file
86
gaia/apps/music/views/albums/view.js
Executable file
|
|
@ -0,0 +1,86 @@
|
|||
/* global View */
|
||||
'use strict';
|
||||
|
||||
var AlbumsView = View.extend(function AlbumsView() {
|
||||
View.call(this); // super();
|
||||
|
||||
this.searchBox = document.getElementById('search-box');
|
||||
this.searchResults = document.getElementById('search-results');
|
||||
this.list = document.getElementById('list');
|
||||
|
||||
this.client.on('databaseChange', () => this.update());
|
||||
|
||||
this.setupSearch();
|
||||
this.setupList();
|
||||
|
||||
this.update();
|
||||
});
|
||||
|
||||
AlbumsView.prototype.update = function() {
|
||||
return this.getAlbums().then((albums) => {
|
||||
this.albums = albums;
|
||||
return this.render();
|
||||
});
|
||||
};
|
||||
|
||||
AlbumsView.prototype.destroy = function() {
|
||||
this.client.destroy();
|
||||
View.prototype.destroy.call(this); // super(); // Always call *last*
|
||||
};
|
||||
|
||||
AlbumsView.prototype.render = function() {
|
||||
return this.list.setModel(this.albums)
|
||||
.then(() => this.list.cache())
|
||||
.then(this.onRenderDone);
|
||||
};
|
||||
|
||||
AlbumsView.prototype.getAlbums = function() {
|
||||
return document.l10n.formatValues('unknownAlbum', 'unknownArtist')
|
||||
.then(([unknownAlbum, unknownArtist]) => {
|
||||
return this.fetch('/api/albums/list')
|
||||
.then(response => response.json())
|
||||
.then((albums) => {
|
||||
return albums.map((album) => {
|
||||
return {
|
||||
name: album.name,
|
||||
url: '/album-detail?id=' + encodeURIComponent(album.name),
|
||||
album: album.metadata.album || unknownAlbum,
|
||||
artist: album.metadata.artist || unknownArtist
|
||||
};
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
AlbumsView.prototype.getThumbnail = function(filePath) {
|
||||
return this.fetch('/api/artwork/url/thumbnail/' + filePath)
|
||||
.then(response => response.json());
|
||||
};
|
||||
|
||||
AlbumsView.prototype.search = function(query) {
|
||||
if (!query) {
|
||||
return Promise.resolve(this.searchResults.clearResults());
|
||||
}
|
||||
|
||||
return document.l10n.formatValues(
|
||||
'unknownAlbum', 'unknownArtist'
|
||||
).then(([unknownAlbum, unknownArtist]) => {
|
||||
return this.fetch('/api/search/album/' + query)
|
||||
.then(response => response.json())
|
||||
.then((albums) => {
|
||||
var results = albums.map((album) => {
|
||||
return {
|
||||
name: album.name,
|
||||
title: album.metadata.album || unknownAlbum,
|
||||
subtitle: album.metadata.artist || unknownArtist,
|
||||
section: 'albums',
|
||||
url: '/album-detail?id=' + encodeURIComponent(album.name)
|
||||
};
|
||||
});
|
||||
|
||||
return this.searchResults.setResults(results);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
window.view = new AlbumsView();
|
||||
Loading…
Reference in a new issue