Files
meanTorrent/modules/core/client/controllers/home.client.controller.js

56 lines
1.5 KiB
JavaScript
Raw Normal View History

(function () {
'use strict';
2014-02-10 13:09:31 +02:00
angular
.module('core')
.controller('HomeController', HomeController);
2017-04-02 13:37:40 +08:00
HomeController.$inject = ['$scope', '$translate', 'TorrentsService', 'Notification', 'TMDBConfig'];
2017-04-02 13:37:40 +08:00
function HomeController($scope, $translate, TorrentsService, Notification, TMDBConfig) {
var vm = this;
2017-04-02 13:37:40 +08:00
vm.tmdbConfig = TMDBConfig.tmdbConfig;
2017-04-04 01:02:21 +08:00
vm.movieTopList = undefined;
2017-04-02 13:37:40 +08:00
2017-04-01 15:00:59 +08:00
vm.info_is_ready = false;
//$translate.use('en');
vm.COMING = 'coming soon...';
2017-04-01 14:22:11 +08:00
vm.initInfo = function () {
TorrentsService.getTMDBInfo({
tmdbid: '329865',
language: 'en'
}, function (res) {
Notification.success({
message: '<i class="glyphicon glyphicon-ok"></i> ' + $translate.instant('TMDB_ID_OK')
});
vm.movieinfo = res;
2017-04-01 15:00:59 +08:00
vm.info_is_ready = true;
2017-04-02 13:37:40 +08:00
$('.backdrop').css('backgroundImage', 'url(' + vm.tmdbConfig.backdrop_img_base_url + res.backdrop_path + ')');
2017-04-01 14:22:11 +08:00
}, function (err) {
Notification.error({
message: '<i class="glyphicon glyphicon-remove"></i> ' + $translate.instant('TMDB_ID_ERROR')
});
});
};
2017-04-04 01:02:21 +08:00
vm.getTopInfo = function () {
vm.getMovieTopInfo();
};
vm.getMovieTopInfo = function () {
vm.moviesInfo = TorrentsService.query({
limit: 8
}, function (items) {
vm.movieTopList = items;
}, function (err) {
Notification.error({
message: '<i class="glyphicon glyphicon-remove"></i> ' + $translate.instant('TOP_MOVIE_INFO_ERROR')
});
});
};
}
}());