mirror of
https://github.com/danbee/mpd-client
synced 2025-03-04 08:39:09 +00:00
Can display Library.
This commit is contained in:
parent
e34dca53eb
commit
d4a8cfc4a3
@ -17,13 +17,3 @@ body
|
||||
|
||||
#content
|
||||
height: 100%
|
||||
|
||||
.header
|
||||
position: fixed
|
||||
top: 0
|
||||
width: $interface-width
|
||||
background: rgba(248, 248, 248, 0.95)
|
||||
border-bottom: 1px solid rgba(0, 0, 0, 0.1)
|
||||
h1
|
||||
text-align: center
|
||||
font-size: 1em
|
||||
|
||||
9
assets/css/includes/header.css.sass
Normal file
9
assets/css/includes/header.css.sass
Normal file
@ -0,0 +1,9 @@
|
||||
.header
|
||||
position: fixed
|
||||
top: 0
|
||||
width: $interface-width
|
||||
background: rgba(248, 248, 248, 0.95)
|
||||
border-bottom: 1px solid rgba(0, 0, 0, 0.1)
|
||||
h1
|
||||
text-align: center
|
||||
font-size: 1em
|
||||
19
assets/css/includes/list.css.sass
Normal file
19
assets/css/includes/list.css.sass
Normal file
@ -0,0 +1,19 @@
|
||||
.list
|
||||
list-style: none
|
||||
margin: 0
|
||||
padding: 0
|
||||
li
|
||||
position: relative
|
||||
padding: 10px
|
||||
padding-right: 42px
|
||||
border-bottom: 1px solid #ddd
|
||||
|
||||
.ordered-list
|
||||
@extend .list
|
||||
counter-reset: index
|
||||
li
|
||||
counter-increment: index
|
||||
&:before
|
||||
float: left
|
||||
padding: 0.5em 1em 0.5em 0
|
||||
content: counter(index,decimal-leading-zero)
|
||||
@ -7,5 +7,12 @@
|
||||
height: 100%
|
||||
width: 100%
|
||||
z-index: 2
|
||||
&.show
|
||||
display: block
|
||||
header
|
||||
@extend .header
|
||||
a.close
|
||||
position: absolute
|
||||
right: 10px
|
||||
top: 8px
|
||||
@include button
|
||||
|
||||
@ -4,6 +4,8 @@
|
||||
@import 'includes/fonts'
|
||||
@import 'includes/colours'
|
||||
@import 'includes/button'
|
||||
@import 'includes/header'
|
||||
@import 'includes/list'
|
||||
@import 'common'
|
||||
@import 'transport'
|
||||
@import 'queue'
|
||||
|
||||
@ -5,16 +5,29 @@
|
||||
header
|
||||
z-index: 1
|
||||
@extend .header
|
||||
button.library
|
||||
a.library
|
||||
position: absolute
|
||||
left: 10px
|
||||
top: 8px
|
||||
@include button
|
||||
ol
|
||||
list-style: none
|
||||
margin: 0
|
||||
padding: 0
|
||||
counter-reset: index
|
||||
@extend .ordered-list
|
||||
li
|
||||
&.playing
|
||||
.title
|
||||
color: $highlight
|
||||
&:before
|
||||
font-weight: bold
|
||||
&:after
|
||||
@extend .icon
|
||||
position: absolute
|
||||
font-size: 1.25em
|
||||
right: 10px
|
||||
top: 10px
|
||||
padding: 0.3em
|
||||
content: "playing"
|
||||
.length
|
||||
display: none
|
||||
p
|
||||
margin: 0
|
||||
.artist
|
||||
@ -33,28 +46,3 @@
|
||||
padding: 0.8em 0
|
||||
right: 10px
|
||||
top: 10px
|
||||
li
|
||||
position: relative
|
||||
padding: 10px
|
||||
padding-right: 42px
|
||||
border-bottom: 1px solid #ddd
|
||||
counter-increment: index
|
||||
&:before
|
||||
float: left
|
||||
padding: 0.5em 1em 0.5em 0
|
||||
content: counter(index,decimal-leading-zero)
|
||||
&.playing
|
||||
.title
|
||||
color: $highlight
|
||||
&:before
|
||||
font-weight: bold
|
||||
&:after
|
||||
@extend .icon
|
||||
position: absolute
|
||||
font-size: 1.25em
|
||||
right: 10px
|
||||
top: 10px
|
||||
padding: 0.3em
|
||||
content: "playing"
|
||||
.length
|
||||
display: none
|
||||
|
||||
@ -1,9 +1,27 @@
|
||||
var Library = can.Control.extend({
|
||||
|
||||
init: function(element, options) {
|
||||
this.element = element
|
||||
element.html(
|
||||
can.view( 'views/library.ejs')
|
||||
can.view('views/library.ejs')
|
||||
);
|
||||
},
|
||||
|
||||
show: function() {
|
||||
$(this.element).addClass('show');
|
||||
},
|
||||
|
||||
hide: function() {
|
||||
$(this.element).removeClass('show');
|
||||
},
|
||||
|
||||
'a.close click': 'hide',
|
||||
|
||||
':page route': function(data) {
|
||||
console.log(data);
|
||||
if (data.page == 'library') {
|
||||
this.show();
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
3
assets/js/models/album.js
Normal file
3
assets/js/models/album.js
Normal file
@ -0,0 +1,3 @@
|
||||
var Album = can.Model.extend({
|
||||
findAll: 'GET /api/albums'
|
||||
}, {});
|
||||
3
assets/js/models/artist.js
Normal file
3
assets/js/models/artist.js
Normal file
@ -0,0 +1,3 @@
|
||||
var Artist = can.Model.extend({
|
||||
findAll: 'GET /api/artists'
|
||||
}, {});
|
||||
3
assets/js/models/song.js
Normal file
3
assets/js/models/song.js
Normal file
@ -0,0 +1,3 @@
|
||||
var Song = can.Model.extend({
|
||||
findAll: 'GET /api/songs'
|
||||
}, {});
|
||||
@ -2,9 +2,9 @@
|
||||
//= require ./libs/can.jquery.min.js
|
||||
//= require ./libs/can.ejs.js
|
||||
|
||||
//= require ./routes.js
|
||||
//= require_tree ./models/
|
||||
//= require_tree ./helpers/
|
||||
//= require_tree ./controls/
|
||||
//= require_tree ./constructs/
|
||||
//= require ./router.js
|
||||
//= require ./application.js
|
||||
|
||||
@ -1 +0,0 @@
|
||||
|
||||
2
assets/js/routes.js
Normal file
2
assets/js/routes.js
Normal file
@ -0,0 +1,2 @@
|
||||
can.route(':page');
|
||||
can.route.ready();
|
||||
@ -1,8 +1,7 @@
|
||||
<header>
|
||||
<a class="close" href="#!">Close</a>
|
||||
<h1>Library</h1>
|
||||
</header>
|
||||
<ol class="list">
|
||||
<li>Artists</li>
|
||||
<li>Albums</li>
|
||||
<li>Songs</li>
|
||||
<%== can.view.render('views/library/root.ejs', {}) %>
|
||||
</ol>
|
||||
|
||||
3
public/views/library/root.ejs
Normal file
3
public/views/library/root.ejs
Normal file
@ -0,0 +1,3 @@
|
||||
<li><%== can.route.link('Artists', { page: 'library', mode: 'artists' }) %></li>
|
||||
<li><%== can.route.link('Albums', { page: 'library', mode: 'albums' }) %></li>
|
||||
<li><%== can.route.link('Songs', { page: 'library', mode: 'songs' }) %></li>
|
||||
@ -1,5 +1,5 @@
|
||||
<header>
|
||||
<button class="library">Library</button>
|
||||
<a class="library" href="#!library">Library</a>
|
||||
<h1>Queue</h1>
|
||||
</header>
|
||||
<ol class="queue">
|
||||
|
||||
Loading…
Reference in New Issue
Block a user