Skip to content

Commit

Permalink
fix indentation with tabs in the playlist view
Browse files Browse the repository at this point in the history
  • Loading branch information
Rayman committed Nov 22, 2014
1 parent 78b57d3 commit 2b9ec82
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 46 deletions.
54 changes: 27 additions & 27 deletions client/views/playlists/playlist.html
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ <h3 class="panel-title">Stats</h3>

{{>suggestions}}

{{#if isOwner}}
{{>ownerPanel}}
{{/if}}
{{#if isOwner}}
{{>ownerPanel}}
{{/if}}
</div>

<div class="col-md-8">
Expand Down Expand Up @@ -117,32 +117,32 @@ <h3 class="panel-title">Owner's panel</h3>

<template name="songs">
{{#each songs}}
{{#if sessionIs 'songView' 'list'}}
<div class="row song">
{{> playlistEntry}}
</div>
{{else}}
{{> playlistGridEntry}}
{{/if}}
{{#if sessionIs 'songView' 'list'}}
<div class="row song">
{{> playlistEntry}}
</div>
{{else}}
{{> playlistGridEntry}}
{{/if}}
{{/each}}
</template>

<template name="playlistGridEntry">
<div class="col-md-4 col-xs-6 grid song">
<div class="thumb" style="background-image:url('{{this.snippet.thumbnails.high.url}}')" >
<span class="title">{{this.snippet.title}}</span>
<span class="length label label-info">({{formatDuration this.contentDetails.duration}})</span>
<div class="controls">
{{> playlistEntryControls}}
{{>loveSong}}
</div>
</div>
</div>
<div class="col-md-4 col-xs-6 grid song">
<div class="thumb" style="background-image:url('{{this.snippet.thumbnails.high.url}}')" >
<span class="title">{{this.snippet.title}}</span>
<span class="length label label-info">({{formatDuration this.contentDetails.duration}})</span>
<div class="controls">
{{> playlistEntryControls}}
{{>loveSong}}
</div>
</div>
</div>
</template>

<template name="playlistEntry">
<div class="col-md-1 col-xs-1">
{{>loveSong}}
{{>loveSong}}
</div>
<div class="col-md-9 col-xs-9 songtitle">
<p>
Expand All @@ -154,20 +154,20 @@ <h3 class="panel-title">Owner's panel</h3>
{{> userLink}}
{{/each}}
</p>
<p class="meta">Added by {{#with this.author}}{{> userLink}}{{/with}} {{this.addedFromNow}}</p>
<p class="meta">Added by {{#with this.author}}{{> userLink}}{{/with}} {{this.addedFromNow}}</p>
</div>

<div class="col-md-2 col-xs-2 controls">
<div class="col-md-4 hidden-xs">&nbsp;</div>
{{> playlistEntryControls}}
<div class="col-md-4 hidden-xs">&nbsp;</div>
{{> playlistEntryControls}}
</div>
</template>

<template name="playlistEntryControls">
<div class="col-md-4 col-xs-6"><span data-action="play" class="glyphicon glyphicon-play"></span></div>
<div class="col-md-4 col-xs-6"><span data-action="remove" class="glyphicon glyphicon-remove"></span></div>
<div class="col-md-4 col-xs-6"><span data-action="play" class="glyphicon glyphicon-play"></span></div>
<div class="col-md-4 col-xs-6"><span data-action="remove" class="glyphicon glyphicon-remove"></span></div>
</template>

<template name="loveSong">
<span data-action="lovesong" class="glyphicon glyphicon-heart {{isLoved}}"></span>
<span data-action="lovesong" class="glyphicon glyphicon-heart {{isLoved}}"></span>
</template>
37 changes: 18 additions & 19 deletions client/views/playlists/playlist.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ Template.playlist.totalDuration = function() {
return memo.add(duration);
}, moment.duration());

return sum.humanize();
return sum.humanize();
};

Template.playlist.following = function () {
Expand Down Expand Up @@ -103,7 +103,7 @@ Template.playlist.players = function () {

//This should probably not run on the client
Template.playlist.isOwner = function() {
return this.owner == Meteor.userId();
return this.owner == Meteor.userId();
};

Template.playlist.owner = function () {
Expand Down Expand Up @@ -209,22 +209,21 @@ Template.songs.events = {
var index = $(e.delegateTarget).children('div.song').index(row);
console.log('removing song at index', index);

var songrow = $(row[0]);
//set styles
songrow.css("box-shadow","0px 0px 15px rgba(155, 155, 155, 0.55)");
songrow.css("left","125%");

//animation takes 300 seconds
setTimeout(function(){
// removing a element at a position is impossible in mongodb,
// so just set the shole array
if (index >= 0) {
var songs = _.clone(template.data.songs); // clone is important!!!
songs.splice(index, 1); // remove 1 element at position index
Playlists.update({_id: template.data._id}, { $set : {"songs": songs}});
}
},300);

var songrow = $(row[0]);
//set styles
songrow.css("box-shadow","0px 0px 15px rgba(155, 155, 155, 0.55)");
songrow.css("left","125%");

//animation takes 300 seconds
setTimeout(function () {
// removing a element at a position is impossible in mongodb,
// so just set the shole array
if (index >= 0) {
var songs = _.clone(template.data.songs); // clone is important!!!
songs.splice(index, 1); // remove 1 element at position index
Playlists.update({_id: template.data._id}, { $set : {"songs": songs}});
}
}, 300);

},
'click [data-action="lovesong"]' : function(e) {
Expand Down Expand Up @@ -299,5 +298,5 @@ Template.songs.songs = function() {
};

Template.songs.rendered = function() {
Session.setDefault("songView","list");
Session.setDefault("songView","list");
};

0 comments on commit 2b9ec82

Please sign in to comment.