Skip to content

Commit

Permalink
#84 - updated component's defintion to now-playlist
Browse files Browse the repository at this point in the history
  • Loading branch information
orizens committed Jan 4, 2016
1 parent eebdab6 commit bbd8956
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 36 deletions.
5 changes: 3 additions & 2 deletions src/components/now-playing/now-playlist/index.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import angular from 'angular';
import AngularSortableView from 'angular-sortable-view/src/angular-sortable-view.js';
import nowPlaylist from './now-playlist.component.js';
import NowPlaylistComponent from './now-playlist.component';

export default angular.module('now-playlist', [
'app.core',
'angular-sortable-view'
])
.config(config)
.directive('nowPlaylist', nowPlaylist)
.directive(NowPlaylistComponent.controllerAs, () => NowPlaylistComponent)
// .directive(NowPlaylistComponent.controllerAs, () => NowPlaylistComponent)
;
/* @ngInject */
function config () {
Expand Down
36 changes: 24 additions & 12 deletions src/components/now-playing/now-playlist/now-playlist.component.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@
import NowPlaylistCtrl from './now-playlist.ctrl.js';
import template from './now-playlist.tpl.html';

/* @ngInject */
export default function nowPlaylist() {
// Usage:
// <now-playlist></now-playlist>
// Creates:
//
var directive = {
export let NowPlaylistComponent = {
template,
controller: NowPlaylistCtrl,
controllerAs: 'nowPlaylist',
// or "bindings" to follow ng1.5 "component" factory
scope: {
videos: '=',
filter: '=',
Expand All @@ -21,7 +14,26 @@ export default function nowPlaylist() {
},
bindToController: true,
replace: true,
restrict: 'E'
};
return directive;
restrict: 'E',
controller:
/* @ngInject */
class NowPlaylistCtrl {
/* @ngInject */
constructor () {
// injected with this.videos, this.onRemove, this.onSelect
this.showPlaylistSaver = false;
}

removeVideo($event, video, $index) {
this.onRemove && this.onRemove({ $event, video, $index });
}

selectVideo (video, $index) {
this.onSelect && this.onSelect({ video, $index });
}

sortVideo($item, $indexTo) {
this.onSort && this.onSort({ $item, $indexTo });
}
}
}
20 changes: 0 additions & 20 deletions src/components/now-playing/now-playlist/now-playlist.ctrl.js

This file was deleted.

2 changes: 1 addition & 1 deletion src/components/user-profile/user-profile.less
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
> li a:hover,
> li.active a:hover,
> li.active a {
background: @primary-color;
background: @brand-primary;
color: @inverse;
}
}
Expand Down
1 change: 0 additions & 1 deletion src/css/style.less
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
@import url('modules/Sidebar.less');
@import url('modules/social.less');
@import url('modules/updates.less');
@import url('modules/user-profile.less');
@import url('modules/youtube-player.less');
@import url('modules/YoutubeItem.less');
@import url('modules/YoutubePlaylistItem.less');
Expand Down

0 comments on commit bbd8956

Please sign in to comment.