Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

Commit 87dfa69

Browse files
committed
Complete rewrite with AngularJS
1 parent 49e64b4 commit 87dfa69

File tree

5 files changed

+360
-636
lines changed

5 files changed

+360
-636
lines changed

public/index.html

Lines changed: 36 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,52 @@
11
<!doctype html>
2-
3-
<!--[if lt IE 7]> <html lang="en" class="no-js ie6"> <![endif]-->
4-
<!--[if IE 7]> <html lang="en" class="no-js ie7"> <![endif]-->
5-
<!--[if IE 8]> <html lang="en" class="no-js ie8"> <![endif]-->
6-
<!--[if IE 9]> <html lang="en" class="no-js ie9"> <![endif]-->
7-
<!--[if (gt IE 9)|!(IE)]><!--> <html lang="en" class="no-js"> <!--<![endif]-->
2+
<html lang="en">
83
<head>
94
<meta charset="utf-8">
105

11-
<title>Backbone Tunes</title>
6+
<title>Angular Tunes</title>
127
<meta name="author" content="David Goodlad <[email protected]>">
8+
<meta name="author" content="Igor Minar <[email protected]>">
139

1410
<link rel="stylesheet" href="style/screen.css" media="screen, projection">
1511
<link rel="stylesheet" href="style/fancypants.css" media="screen, projection">
1612

17-
<script src="js/vendor/modernizr-1.6.min.js"></script>
18-
<script src="js/vendor/jquery-1.5.1.min.js"></script>
19-
<script src="js/vendor/underscore.js"></script>
20-
<script src="js/vendor/backbone.js"></script>
13+
<script src="js/vendor/angular.js" ng:autobind></script>
2114
<script src="js/Tunes.js"></script>
22-
23-
<script type="text/template" id="library-template">
24-
<h1>Music Library</h1>
25-
<ul class="albums"></ul>
26-
</script>
27-
28-
<script type="text/template" id="playlist-template">
29-
<h1>Playlist</h1>
30-
<nav>
31-
<button class="control play">Play</button>
32-
<button class="control pause">Pause</button>
33-
<button class="control prev">Prev</button>
34-
<button class="control next">Next</button>
35-
</nav>
36-
<ul class="albums">
37-
</ul>
38-
</script>
39-
40-
<script type="text/template" id="album-template">
41-
<button class="queue add"><img src="/images/add.png"></button>
42-
<button class="queue remove"><img src="/images/remove.png"></button>
43-
<span class="album-title"><%= title %></span>&nbsp;&nbsp;
44-
<span class="artist-name"><%= artist %></span>
45-
<ol class="tracks">
46-
<% _.each(tracks, function(track) { %>
47-
<li><%= track.title %></li>
48-
<% }); %>
49-
</ol>
50-
</script>
51-
52-
<script type="application/javascript">
53-
jQuery(function() {
54-
window.library.fetch();
55-
});
56-
</script>
5715
</head>
5816

59-
<body>
17+
<body ng:controller="TunesCtrl">
6018
<div id="container">
19+
<div class="playlist">
20+
<h1>Playlist</h1>
21+
<nav>
22+
<button class="control play" ng:click="player.play()" ng:hide="player.playing">Play</button>
23+
<button class="control pause" ng:click="player.pause()" ng:show="player.playing">Pause</button>
24+
<button class="control prev" ng:click="player.previous()">Prev</button>
25+
<button class="control next" ng:click="player.next()">Next</button>
26+
</nav>
27+
<ul class="albums">
28+
<li class="album" ng:repeat="album in player.playlist"
29+
ng:class="player.current.album == $index && 'current'">
30+
<button class="queue remove" ng:click="player.playlist.remove(album)"></button>
31+
<span class="album-title">{{album.title}}</span>
32+
<span class="artist-name">{{album.artist}}</span>
33+
<ol class="tracks">
34+
<li ng:repeat="track in album.tracks"
35+
ng:class="player.current.track == $index && 'current'">{{track.title}}</li>
36+
</ol>
37+
</li>
38+
</ul>
39+
</div>
40+
<section class="library">
41+
<h1>Music Library</h1>
42+
<ul class="albums">
43+
<li class="album current" ng:repeat="album in albums">
44+
<button class="queue add" ng:click="player.playlist.add(album)"></button>
45+
<span class="album-title">{{album.title}}</span>
46+
<span class="artist-name">{{album.artist}}</span>
47+
</li>
48+
</ul>
49+
</section>
6150
</div>
6251
</body>
6352
</html>

0 commit comments

Comments
 (0)