Skip to content

Commit

Permalink
fix(hotkey): correction of hotkey in podcast details
Browse files Browse the repository at this point in the history
Close #11
  • Loading branch information
davinkevin committed Feb 28, 2015
1 parent f9b8a1d commit 146e369
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 113 deletions.
43 changes: 12 additions & 31 deletions src/main/webapp/app/html/podcast-detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,55 +4,36 @@
<br/>
<ol class="breadcrumb">
<li><a href="/#/podcasts">Podcasts</a></li>
<li><a class="active"> {{ podcast.title }}</a></li>
<li><a class="active"> {{ pdc.podcast.title }}</a></li>
</ol>

<div>
<div class="jumbotron podcast-details-header" ng-style="{ 'background-image' : 'url(\''+ podcast.cover.url + '\')'}">
<div class="jumbotron podcast-details-header" ng-style="{ 'background-image' : 'url(\''+ pdc.podcast.cover.url + '\')'}">
<div class="information-area">
<div class="information-text">
<h3><strong>{{ podcast.title }}</strong></h3>
<p>{{ podcast.totalItems }} Episodes</p>
<h3><strong>{{ pdc.podcast.title }}</strong></h3>
<p>{{ pdc.podcast.totalItems }} Episodes</p>
</div>
<div class="action-button pull-right">
<button ng-click="refresh()" type="button" class="btn btn-default"><span class="glyphicon glyphicon-refresh"></span></button>
<a type="button" class="btn btn-default" href="/api/podcast/{{ podcast.id }}/rss" target="_blank"><span class="ionicons ion-social-rss"></a>
<button ng-click="pdc.refresh()" type="button" class="btn btn-default"><span class="glyphicon glyphicon-refresh"></span></button>
<a type="button" class="btn btn-default" ng-href="/api/podcast/{{ pdc.podcast.id }}/rss" target="_blank"><span class="ionicons ion-social-rss"></span></a>
</div>
</div>
</div>
</div>
<br/>


<!--<div class="col-xs-12 col-sm-12 col-md-3 col-lg-3">
<div class="thumbnail">
<img ng-src="{{podcast.cover.url}}" width="{{podcast.cover.width}}" height="{{podcast.cover.height}}" alt="">
<div class="caption">
<h5 class="text-center "><strong>{{ podcast.title }}</strong></h5>
<p class="text-center">Nombre d'épisode : {{ podcast.totalItems }}</p>
<div class="col-lg-12 col-sm-12 col-md-12 col-xs-12 text-center">
<button ng-click="refresh()" type="button" class="btn btn-default"><span class="glyphicon glyphicon-refresh"></span></button>
<a type="button" class="btn btn-default" href="/api/podcast/{{ podcast.id }}/rss" target="_blank">RSS</a>
</div>
</div>
</div>
</div>-->
<div class="col-md-12 col-xs-12 col-sm-12 col-lg-12">

<tabset>
<!--
<tab ng-repeat="tab in tabs" heading="{{tab.title}}" active="tab.active" disabled="tab.disabled">
<ng-include src="tab.templateUrl" ></ng-include>
</tab>
-->
<tab heading="Episodes" active="tab.active" disabled="tab.disabled">
<podcast-items-list podcast="podcast"></podcast-items-list>
<tab heading="{{ pdc.podcastTabs[0].heading }}" active="pdc.podcastTabs[0].active" >
<podcast-items-list podcast="pdc.podcast"></podcast-items-list>
</tab>
<tab heading="Edition">
<podcast-edition podcast="podcast"></podcast-edition>
<tab heading="{{ pdc.podcastTabs[1].heading }}" active="pdc.podcastTabs[1].active" >
<podcast-edition podcast="pdc.podcast"></podcast-edition>
</tab>
<tab heading="Upload" ng-show="podcast.type == 'send'">
<podcast-upload podcast="podcast"></podcast-upload>
<tab heading="{{ pdc.podcastTabs[2].heading }}" ng-show="pdc.podcast.type === 'send'" active="pdc.podcastTabs[2].active" disabled="pdc.podcastTabs[2].disabled">
<podcast-upload podcast="pdc.podcast"></podcast-upload>
</tab>
</tabset>

Expand Down
98 changes: 40 additions & 58 deletions src/main/webapp/app/js/all.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,14 +203,7 @@ angular.module('ps.config.route', [
window.location.href = '#/download';
}]
])
.config(function($routeProvider, commonKey) {
/*$routeProvider.
when('/podcast/add', {
templateUrl: 'html/podcast-add.html',
controller: 'PodcastAddCtrl',
hotkeys: commonKey
});*/

.config(function($routeProvider) {
$routeProvider.
otherwise({
redirectTo: '/items'
Expand Down Expand Up @@ -761,55 +754,36 @@ module.run(['$templateCache', function($templateCache) {
' <br/>\n' +
' <ol class="breadcrumb">\n' +
' <li><a href="/#/podcasts">Podcasts</a></li>\n' +
' <li><a class="active"> {{ podcast.title }}</a></li>\n' +
' <li><a class="active"> {{ pdc.podcast.title }}</a></li>\n' +
' </ol>\n' +
'\n' +
' <div>\n' +
' <div class="jumbotron podcast-details-header" ng-style="{ \'background-image\' : \'url(\\\'\'+ podcast.cover.url + \'\\\')\'}">\n' +
' <div class="jumbotron podcast-details-header" ng-style="{ \'background-image\' : \'url(\\\'\'+ pdc.podcast.cover.url + \'\\\')\'}">\n' +
' <div class="information-area">\n' +
' <div class="information-text">\n' +
' <h3><strong>{{ podcast.title }}</strong></h3>\n' +
' <p>{{ podcast.totalItems }} Episodes</p>\n' +
' <h3><strong>{{ pdc.podcast.title }}</strong></h3>\n' +
' <p>{{ pdc.podcast.totalItems }} Episodes</p>\n' +
' </div>\n' +
' <div class="action-button pull-right">\n' +
' <button ng-click="refresh()" type="button" class="btn btn-default"><span class="glyphicon glyphicon-refresh"></span></button>\n' +
' <a type="button" class="btn btn-default" href="/api/podcast/{{ podcast.id }}/rss" target="_blank"><span class="ionicons ion-social-rss"></a>\n' +
' <button ng-click="pdc.refresh()" type="button" class="btn btn-default"><span class="glyphicon glyphicon-refresh"></span></button>\n' +
' <a type="button" class="btn btn-default" ng-href="/api/podcast/{{ pdc.podcast.id }}/rss" target="_blank"><span class="ionicons ion-social-rss"></span></a>\n' +
' </div>\n' +
' </div>\n' +
' </div>\n' +
' </div>\n' +
'<br/>\n' +
'\n' +
'\n' +
'<!--<div class="col-xs-12 col-sm-12 col-md-3 col-lg-3">\n' +
' <div class="thumbnail">\n' +
' <img ng-src="{{podcast.cover.url}}" width="{{podcast.cover.width}}" height="{{podcast.cover.height}}" alt="">\n' +
' <div class="caption">\n' +
' <h5 class="text-center "><strong>{{ podcast.title }}</strong></h5>\n' +
' <p class="text-center">Nombre d\'épisode : {{ podcast.totalItems }}</p>\n' +
' <div class="col-lg-12 col-sm-12 col-md-12 col-xs-12 text-center">\n' +
' <button ng-click="refresh()" type="button" class="btn btn-default"><span class="glyphicon glyphicon-refresh"></span></button>\n' +
' <a type="button" class="btn btn-default" href="/api/podcast/{{ podcast.id }}/rss" target="_blank">RSS</a>\n' +
' </div>\n' +
' </div>\n' +
' </div>\n' +
'</div>-->\n' +
'<div class="col-md-12 col-xs-12 col-sm-12 col-lg-12">\n' +
'\n' +
' <tabset>\n' +
' <!--\n' +
' <tab ng-repeat="tab in tabs" heading="{{tab.title}}" active="tab.active" disabled="tab.disabled">\n' +
' <ng-include src="tab.templateUrl" ></ng-include>\n' +
' </tab>\n' +
' -->\n' +
' <tab heading="Episodes" active="tab.active" disabled="tab.disabled">\n' +
' <podcast-items-list podcast="podcast"></podcast-items-list>\n' +
' <tab heading="{{ pdc.podcastTabs[0].heading }}" active="pdc.podcastTabs[0].active" >\n' +
' <podcast-items-list podcast="pdc.podcast"></podcast-items-list>\n' +
' </tab>\n' +
' <tab heading="Edition">\n' +
' <podcast-edition podcast="podcast"></podcast-edition>\n' +
' <tab heading="{{ pdc.podcastTabs[1].heading }}" active="pdc.podcastTabs[1].active" >\n' +
' <podcast-edition podcast="pdc.podcast"></podcast-edition>\n' +
' </tab>\n' +
' <tab heading="Upload" ng-show="podcast.type == \'send\'">\n' +
' <podcast-upload podcast="podcast"></podcast-upload>\n' +
' <tab heading="{{ pdc.podcastTabs[2].heading }}" ng-show="pdc.podcast.type === \'send\'" active="pdc.podcastTabs[2].active" disabled="pdc.podcastTabs[2].disabled">\n' +
' <podcast-upload podcast="pdc.podcast"></podcast-upload>\n' +
' </tab>\n' +
' </tabset>\n' +
'\n' +
Expand Down Expand Up @@ -1387,8 +1361,9 @@ angular.module('ps.podcast.creation', [
hotkeys: commonKey
});
})
.controller('PodcastAddCtrl', function ($scope, $location, tagService, podcastService) {
$scope.podcast = angular.extend(podcastService.getNewPodcast(), { hasToBeDeleted : true, cover : { height: 200, width: 200 } } );
.constant('defaultPodcast', { hasToBeDeleted : true, cover : { height: 200, width: 200 } })
.controller('PodcastAddCtrl', function ($scope, $location, defaultPodcast, tagService, podcastService) {
$scope.podcast = angular.extend(podcastService.getNewPodcast(), defaultPodcast );

$scope.findInfo = function() {
podcastService.findInfo($scope.podcast.url).then(function(podcastFetched) {
Expand Down Expand Up @@ -1887,33 +1862,40 @@ angular.module('ps.podcast.details', [
when('/podcast/:podcastId', {
templateUrl: 'html/podcast-detail.html',
controller: 'PodcastDetailCtrl',
controllerAs: 'pdc',
hotkeys: [
['r', 'Refresh', 'refreshItems()'],
['f', 'Force Refresh', 'refresh()'],
['l', 'List of Items', 'tabs[0].active = true'],
['m', 'Modification of Podcast', 'tabs[1].active = true']
['r', 'Refresh', 'pdc.refreshItems()'],
['f', 'Force Refresh', 'pdc.refresh()'],
['l', 'List of Items', 'pdc.podcastTabs[0].active = true'],
['m', 'Modification of Podcast', 'pdc.podcastTabs[1].active = true']
].concat(commonKey),
resolve : {
podcast : function (Restangular, $route) {
return Restangular.one('podcast', $route.current.params.podcastId).get();
podcast : function (podcastService, $route) {
return podcastService.findById($route.current.params.podcastId);
}
}
})
})
.controller('PodcastDetailCtrl', function ($scope, podcast, $routeParams, Restangular) {

$scope.podcast = podcast;

function refreshItems () {
.controller('PodcastDetailCtrl', function ($scope, podcast, Restangular) {
var vm = this;

vm.podcast = podcast;
vm.podcastTabs= [
{ heading : 'Episodes', active : true},
{ heading : 'Edition', active : false},
{ heading : 'Upload', disabled : podcast.type !== 'send'}
];

vm.refreshItems = function() {
$scope.$broadcast('podcastItems:refresh');
}

$scope.refresh = function () {
Restangular.one("task").customPOST($scope.podcast.id, "updateManager/updatePodcast/force")
.then(refreshItems);
};
$scope.$on("podcastEdition:save", refreshItems);

vm.refresh = function () {
Restangular.one("task").customPOST(vm.podcast.id, "updateManager/updatePodcast/force")
.then(vm.refreshItems);
};

$scope.$on("podcastEdition:save", vm.refreshItems);
});
'use strict';

Expand Down
4 changes: 2 additions & 2 deletions src/main/webapp/app/js/all.min.js

Large diffs are not rendered by default.

9 changes: 1 addition & 8 deletions src/main/webapp/app/js/modules/config/route.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,7 @@ angular.module('ps.config.route', [
window.location.href = '#/download';
}]
])
.config(function($routeProvider, commonKey) {
/*$routeProvider.
when('/podcast/add', {
templateUrl: 'html/podcast-add.html',
controller: 'PodcastAddCtrl',
hotkeys: commonKey
});*/

.config(function($routeProvider) {
$routeProvider.
otherwise({
redirectTo: '/items'
Expand Down
35 changes: 21 additions & 14 deletions src/main/webapp/app/js/modules/podcast/details/podcast.details.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ angular.module('ps.podcast.details', [
when('/podcast/:podcastId', {
templateUrl: 'html/podcast-detail.html',
controller: 'PodcastDetailCtrl',
controllerAs: 'pdc',
hotkeys: [
['r', 'Refresh', 'refreshItems()'],
['f', 'Force Refresh', 'refresh()'],
['l', 'List of Items', 'tabs[0].active = true'],
['m', 'Modification of Podcast', 'tabs[1].active = true']
['r', 'Refresh', 'pdc.refreshItems()'],
['f', 'Force Refresh', 'pdc.refresh()'],
['l', 'List of Items', 'pdc.podcastTabs[0].active = true'],
['m', 'Modification of Podcast', 'pdc.podcastTabs[1].active = true']
].concat(commonKey),
resolve : {
podcast : function (podcastService, $route) {
Expand All @@ -23,18 +24,24 @@ angular.module('ps.podcast.details', [
}
})
})
.controller('PodcastDetailCtrl', function ($scope, podcast, $routeParams, Restangular) {
.controller('PodcastDetailCtrl', function ($scope, podcast, Restangular) {
var vm = this;

vm.podcast = podcast;
vm.podcastTabs= [
{ heading : 'Episodes', active : true},
{ heading : 'Edition', active : false},
{ heading : 'Upload', disabled : podcast.type !== 'send'}
];

$scope.podcast = podcast;

function refreshItems () {
vm.refreshItems = function() {
$scope.$broadcast('podcastItems:refresh');
}

$scope.refresh = function () {
Restangular.one("task").customPOST($scope.podcast.id, "updateManager/updatePodcast/force")
.then(refreshItems);
};
$scope.$on("podcastEdition:save", refreshItems);

vm.refresh = function () {
Restangular.one("task").customPOST(vm.podcast.id, "updateManager/updatePodcast/force")
.then(vm.refreshItems);
};

$scope.$on("podcastEdition:save", vm.refreshItems);
});

0 comments on commit 146e369

Please sign in to comment.