' + '' + value + '';
+ },
+ replace: function (value) {
+ return ':' + value + ': ';
+ },
+ index: 1
+ }
+ ]);
+
+ e.setContent(c.overview);
+ $('#' + e.$editor.attr('id') + ' .md-input').attr('maxlength', vm.inputLengthConfig.collectionsOverviewLength);
+
+ var elei = $('#' + e.$editor.attr('id') + ' .md-input');
+ angular.element(elei).css('height', '200px');
+ angular.element(elei).css('color', '#333');
+
+ var inputInfo = angular.element('');
+ inputInfo.addClass('pull-right');
+ inputInfo.addClass('input-length');
+ inputInfo.text(e.getContent().length + '/' + vm.inputLengthConfig.collectionsOverviewLength);
+ $('#' + e.$editor.attr('id') + ' .md-header').append(inputInfo);
+ $('#' + e.$editor.attr('id') + ' .md-input').on('input propertychange', function (evt) {
+ inputInfo.text(e.getContent().length + '/' + vm.inputLengthConfig.collectionsOverviewLength);
+ });
+
+ var ele = $('#' + e.$editor.attr('id') + ' .md-footer');
+ angular.element(ele).addClass('text-right');
+ angular.element(ele[0].childNodes[0]).addClass('btn-width-80');
+ ele[0].childNodes[0].innerText = $translate.instant('FORUMS.BTN_SAVE');
+
+ var cbtn = angular.element('');
+ cbtn.bind('click', function (evt) {
+ e.setContent(c.overview);
+ e.$options.hideable = true;
+ e.blur();
+ });
+ ele.append(cbtn);
+ $compile(e.$editor.contents())($scope);
+ },
+ onPreview: function (e) {
+ $('#' + e.$editor.attr('id') + ' .md-footer').css('display', 'none');
+ },
+ onPreviewEnd: function (e) {
+ $('#' + e.$editor.attr('id') + ' .md-footer').css('display', 'block');
+ }
+ });
+ };
+
+ /**
+ * vm.setRecommendLevel
+ */
+ vm.setRecommendLevel = function (item, rl) {
+ CollectionsService.setRecommendLevel({
+ _id: item._id,
+ rlevel: rl.value
+ }, function (res) {
+ vm.collection = res;
+ NotifycationService.showSuccessNotify('COLLECTIONS.SETRLEVEL_SUCCESSFULLY');
+ }, function (res) {
+ NotifycationService.showSuccessNotify('COLLECTIONS.SETRLEVEL_ERROR');
+ });
+ };
+
+ /**
+ * removeFromCollections
+ * @param item
+ */
+ vm.removeFromCollections = function (item) {
+ var modalOptions = {
+ closeButtonText: $translate.instant('COLLECTIONS.REMOVE_CONFIRM_CANCEL'),
+ actionButtonText: $translate.instant('COLLECTIONS.REMOVE_CONFIRM_OK'),
+ headerText: $translate.instant('COLLECTIONS.REMOVE_CONFIRM_HEADER_TEXT'),
+ bodyText: $translate.instant('COLLECTIONS.REMOVE_CONFIRM_BODY_TEXT')
+ };
+
+ ModalConfirmService.showModal({}, modalOptions)
+ .then(function (result) {
+ CollectionsService.removeFromCollection({
+ collectionId: vm.collection._id,
+ torrentId: item._id
+ }, function (res) {
+ mtDebug.info(res);
+ vm.collection = res;
+ NotifycationService.showSuccessNotify('COLLECTIONS.REMOVE_SUCCESSFULLY');
+ }, function (res) {
+ NotifycationService.showErrorNotify(res.data.message, 'COLLECTIONS.REMOVE_FAILED');
+ });
+ });
+ };
+ }
+}());
diff --git a/modules/albums/client/controllers/albums.client.controller.js b/modules/albums/client/controllers/albums.client.controller.js
new file mode 100644
index 00000000..c615c58a
--- /dev/null
+++ b/modules/albums/client/controllers/albums.client.controller.js
@@ -0,0 +1,106 @@
+(function () {
+ 'use strict';
+
+ angular
+ .module('albums')
+ .controller('AlbumController', AlbumController);
+
+ AlbumController.$inject = ['$scope', '$translate', 'getStorageLangService', 'MeanTorrentConfig', 'CollectionsService', 'NotifycationService',
+ 'DebugConsoleService'];
+
+ function AlbumController($scope, $translate, getStorageLangService, MeanTorrentConfig, CollectionsService, NotifycationService,
+ mtDebug) {
+ var vm = this;
+ vm.lang = getStorageLangService.getLang();
+ vm.appConfig = MeanTorrentConfig.meanTorrentConfig.app;
+ vm.itemsPerPageConfig = MeanTorrentConfig.meanTorrentConfig.itemsPerPage;
+ vm.tmdbConfig = MeanTorrentConfig.meanTorrentConfig.tmdbConfig;
+
+
+ /**
+ * buildPager
+ */
+ vm.buildPager = function () {
+ vm.pagedItems = [];
+ vm.itemsPerPage = vm.itemsPerPageConfig.collectionsListPerPage;
+ vm.currentPage = 1;
+
+ vm.figureOutItemsToDisplay();
+ };
+
+ /**
+ * figureOutItemsToDisplay
+ * @param callback
+ */
+ vm.figureOutItemsToDisplay = function (callback) {
+ vm.getCollectionsList(vm.currentPage, function (items) {
+ vm.filterLength = items.total;
+ vm.pagedItems = items.rows;
+
+ if (callback) callback();
+ });
+ };
+
+ /**
+ * getCollectionsList
+ * @param p
+ * @param callback
+ */
+ vm.getCollectionsList = function (p, callback) {
+ CollectionsService.get({
+ skip: (p - 1) * vm.itemsPerPage,
+ limit: vm.itemsPerPage,
+ keys: vm.search
+ }, function (data) {
+ mtDebug.info(data);
+ callback(data);
+ }, function (err) {
+ NotifycationService.showErrorNotify(err.data.message, 'COLLECTIONS.LIST_ERROR');
+ });
+ };
+
+ /**
+ * getVoteAverage
+ * @param c
+ * @returns {number}
+ */
+ vm.getVoteAverage = function (c) {
+ var total = 0;
+ var count = 0;
+ var avg = 0;
+
+ angular.forEach(c.torrents, function (t) {
+ total += t.resource_detail_info.vote_average;
+ count += 1;
+ });
+ avg = Math.floor((total / count) * 10) / 10;
+
+ return avg || 0;
+ };
+
+ /**
+ * getMinMaxRelease
+ * @param c
+ * @returns {{min: *, max: *}}
+ */
+ vm.getMinMaxRelease = function (c) {
+ var re = [];
+
+ angular.forEach(c.torrents, function (t) {
+ re.push(parseInt(t.resource_detail_info.release_date, 10));
+ });
+
+ return {
+ min: re.length > 0 ? Math.min.apply(null, re) : '',
+ max: re.length > 0 ? Math.max.apply(null, re) : ''
+ };
+ };
+
+ /**
+ * pageChanged
+ */
+ vm.pageChanged = function () {
+ vm.figureOutItemsToDisplay();
+ };
+ }
+}());
diff --git a/modules/albums/client/services/albums.client.service.js b/modules/albums/client/services/albums.client.service.js
new file mode 100644
index 00000000..c8060c33
--- /dev/null
+++ b/modules/albums/client/services/albums.client.service.js
@@ -0,0 +1,78 @@
+(function () {
+ 'use strict';
+
+ // Users service used for communicating with the users REST endpoint
+ angular
+ .module('albums.services')
+ .factory('AlbumsService', AlbumsService);
+
+ AlbumsService.$inject = ['$resource', 'CacheFactory'];
+
+ function AlbumsService($resource, CacheFactory) {
+ var albumsCache = CacheFactory.get('albumsCache') || CacheFactory.createCache('albumsCache');
+ var removeCache = function (res) {
+ albumsCache.removeAll();
+ return res.resource;
+ };
+
+ var album = $resource('/api/albums/:albumId', {
+ albumId: '@_id'
+ }, {
+ get: {
+ method: 'GET',
+ cache: albumsCache
+ },
+ query: {
+ method: 'GET',
+ isArray: true,
+ cache: albumsCache
+ },
+ update: {
+ method: 'PUT',
+ interceptor: {response: removeCache}
+ },
+ save: {
+ method: 'POST',
+ interceptor: {response: removeCache}
+ },
+ remove: {
+ method: 'DELETE',
+ interceptor: {response: removeCache}
+ },
+ delete: {
+ method: 'DELETE',
+ interceptor: {response: removeCache}
+ },
+ insertIntoAlbum: {
+ method: 'PUT',
+ url: '/api/albums/:albumId/insert/:torrentId',
+ params: {
+ albumId: '@albumId',
+ torrentId: '@torrentId'
+ },
+ interceptor: {response: removeCache}
+ },
+ removeFromAlbum: {
+ method: 'PUT',
+ url: '/api/albums/:albumId/remove/:torrentId',
+ params: {
+ albumId: '@albumId',
+ torrentId: '@torrentId'
+ },
+ interceptor: {response: removeCache}
+ },
+ setRecommendLevel: {
+ method: 'PUT',
+ url: '/api/albums/:albumId/set/recommendlevel/:rlevel',
+ params: {
+ albumId: '@_id',
+ rlevel: '@rlevel'
+ },
+ interceptor: {response: removeCache}
+ }
+
+ });
+
+ return album;
+ }
+}());
diff --git a/modules/albums/client/views/album-view.client.view.html b/modules/albums/client/views/album-view.client.view.html
new file mode 100644
index 00000000..e331929f
--- /dev/null
+++ b/modules/albums/client/views/album-view.client.view.html
@@ -0,0 +1,104 @@
+| + | {{ 'TABLE_FIELDS.INFO' | translate}} | +{{ 'TABLE_FIELDS.VOTES' | translate}} | +{{ 'TABLE_FIELDS.LIFETIME' | translate}} | +{{ 'TABLE_FIELDS.SIZE' | translate}} | ++ + {{ 'TABLE_FIELDS.SEEDS_LEECHERS_FINISHED' | translate}} + + | +{{ 'TABLE_FIELDS.PUBLISHER' | translate}} | +
|---|