diff --git a/www/plugins/es/css/style.css b/www/plugins/es/css/style.css index e652e2935cac8922bafdc9172d2270c028dec63f..84c986d42ff6b4d87455404c2740dad700ed5ad5 100644 --- a/www/plugins/es/css/style.css +++ b/www/plugins/es/css/style.css @@ -176,52 +176,3 @@ padding-top: 8px; padding-bottom: 8px; } - -/** -* Market record screen -*/ - -.market.view-record h1 { - font-size: 25px; - margin-top: 5px; -} - -/** -* Add specific Icons -*/ - -/* Association */ -.cion-registry-association:before { - font-family: "Ionicons"; - content: "\f212"; -} - -/* institution */ -.cion-registry-company:before { - font-family: "Cesiumicons"; - content: "\e903"; -} - -/* institution */ -.cion-registry-institution:before { - font-family: "Cesiumicons"; - content: "\e921"; -} - -/* shop */ -.cion-registry-shop:before { - font-family: "Ionicons"; - content: "\f110"; -} - -/* offer*/ -.cion-market-offer:before { - font-family: "Ionicons"; - content: "\f48d"; -} - -/* need */ -.cion-market-need:before { - font-family: "Ionicons"; - content: "\f27c"; -} diff --git a/www/plugins/es/js/controllers/app-controllers.js b/www/plugins/es/js/controllers/app-controllers.js index 0e098aeb33029774a1442967731df14edc6e35fc..744f68be091f4f18064926b06a957ec7afda1da5 100644 --- a/www/plugins/es/js/controllers/app-controllers.js +++ b/www/plugins/es/js/controllers/app-controllers.js @@ -13,10 +13,6 @@ angular.module('cesium.es.app.controllers', ['ngResource', 'cesium.es.services'] templateUrl: "plugins/es/templates/menu_extend.html", controller: "ESMenuExtendCtrl" }, - 'menu-main': { - templateUrl: "plugins/es/templates/menu_extend.html", - controller: "ESMenuExtendCtrl" - }, 'menu-user': { templateUrl: "plugins/es/templates/menu_extend.html", controller: "ESMenuExtendCtrl" @@ -80,10 +76,6 @@ function ESMenuExtendController($scope, $state, PluginService, esSettings, UIUti $scope.extensionPoint = PluginService.extensions.points.current.get(); $scope.enable = esSettings.isEnable(); - $scope.showMarketLookupView = function() { - $state.go(UIUtils.screen.isSmall() ? 'app.market_lookup': 'app.market_lookup_lg'); - }; - $scope.showRegistryLookupView = function() { $state.go(UIUtils.screen.isSmall() ? 'app.registry_lookup': 'app.registry_lookup_lg'); }; diff --git a/www/plugins/es/js/controllers/market-controllers.js b/www/plugins/es/js/controllers/market-controllers.js deleted file mode 100644 index e545deb4c9b3cc588d8132f586f416af61a53e23..0000000000000000000000000000000000000000 --- a/www/plugins/es/js/controllers/market-controllers.js +++ /dev/null @@ -1,802 +0,0 @@ -angular.module('cesium.es.market.controllers', ['cesium.es.services', 'cesium.es.common.controllers']) - - .config(function($stateProvider) { - 'ngInject'; - - $stateProvider - - .state('app.market_lookup', { - url: "/market?q&category&location&reload&type", - views: { - 'menuContent': { - templateUrl: "plugins/es/templates/market/lookup.html", - controller: 'ESMarketLookupCtrl' - } - }, - data: { - large: 'app.market_lookup_lg' - } - }) - - .state('app.market_lookup_lg', { - url: "/market/lg?q&category&location&reload&type", - views: { - 'menuContent': { - templateUrl: "plugins/es/templates/market/lookup_lg.html", - controller: 'ESMarketLookupCtrl' - } - } - }) - - .state('app.market_view_record', { - url: "/market/view/:id/:title?refresh", - views: { - 'menuContent': { - templateUrl: "plugins/es/templates/market/view_record.html", - controller: 'ESMarketRecordViewCtrl' - } - } - }) - - .state('app.market_view_record_anchor', { - url: "/market/view/:id/:title/:anchor?refresh", - views: { - 'menuContent': { - templateUrl: "plugins/es/templates/market/view_record.html", - controller: 'ESMarketRecordViewCtrl' - } - } - }) - - .state('app.market_add_record', { - cache: false, - url: "/market/add/:type", - views: { - 'menuContent': { - templateUrl: "plugins/es/templates/market/edit_record.html", - controller: 'ESMarketRecordEditCtrl' - } - } - }) - - .state('app.market_edit_record', { - cache: false, - url: "/market/edit/:id/:title", - views: { - 'menuContent': { - templateUrl: "plugins/es/templates/market/edit_record.html", - controller: 'ESMarketRecordEditCtrl' - } - } - }); - }) - - .controller('ESMarketLookupCtrl', ESMarketLookupController) - - .controller('ESMarketRecordViewCtrl', ESMarketRecordViewController) - - .controller('ESMarketRecordEditCtrl', ESMarketRecordEditController) - -; - -function ESMarketLookupController($scope, $state, $focus, $timeout, $filter, $q, csSettings, - UIUtils, ModalUtils, esHttp, esMarket, BMA) { - 'ngInject'; - - var defaultSearchLimit = 10; - - $scope.search = { - text: '', - type: null, - lastRecords: true, - results: [], - loading: true, - category: null, - location: null, - options: null, - loadingMore: false - }; - - $scope.$on('$ionicView.enter', function(e, state) { - if (!$scope.entered || !$scope.search.results || $scope.search.results.length === 0) { - var hasOptions = false; - var runSearch = false; - var finishEntered = function() { - $scope.search.options = hasOptions ? true : $scope.search.options; // keep null if first call - if (runSearch) { - $timeout(function() { - $scope.doSearch(); - }, 100); - } - else { // By default : get last record - $timeout(function() { - $scope.doGetLastRecord(); - }, 100); - } - // removeIf(device) - // Focus on search text (only if NOT device, to avoid keyboard opening) - $focus('marketSearchText'); - // endRemoveIf(device) - $scope.entered = true; - }; - - // Search by text - if (state.stateParams && state.stateParams.q) { // Query parameter - $scope.search.text=state.stateParams.q; - hasOptions = runSearch = true; - } - - // Search on type - if (state.stateParams && state.stateParams.type) { - $scope.search.type = state.stateParams.type; - hasOptions = runSearch = true; - } - - // Search on location - if (state.stateParams && state.stateParams.location) { - $scope.search.location = state.stateParams.location; - hasOptions = runSearch = true; - } - - // Search on category - if (state.stateParams && state.stateParams.category) { - esMarket.category.get({id: state.stateParams.category}) - .then(function(cat) { - $scope.search.category = cat; - hasOptions = runSearch = true; - finishEntered(); - }); - } - else { - finishEntered(); - } - } - $scope.showFab('fab-add-market-record'); - - - }); - - $scope.setAdType = function(type) { - if (type != $scope.search.type) { - $scope.search.type = type; - if ($scope.search.lastRecords) { - $scope.doGetLastRecord(); - } - else { - $scope.doSearch(); - } - } - }; - - $scope.doSearch = function(from) { - $scope.search.loading = !from; - $scope.search.lastRecords = false; - if (!$scope.search.options) { - $scope.search.options = false; - } - - var text = $scope.search.text.trim(); - var matches = []; - var filters = []; - if (text.length > 1) { - // pubkey : use a special 'term', because of 'non indexed' field - if (BMA.regexp.PUBKEY.test(text /*case sensitive*/)) { - matches = []; - filters.push({term : { issuer: text}}); - } - else { - text = text.toLowerCase(); - var matchFields = ["title", "description", "location"]; - matches.push({multi_match : { query: text, - fields: matchFields, - type: "phrase_prefix" - }}); - matches.push({match: { title: text}}); - matches.push({match: { description: text}}); - matches.push({prefix: { location: text}}); - matches.push({ - nested: { - path: "category", - query: { - bool: { - filter: { - match: { "category.name": text} - } - } - } - } - }); - } - } - if ($scope.search.options && $scope.search.category) { - filters.push({ - nested: { - path: "category", - query: { - bool: { - filter: { - term: { "category.id": $scope.search.category.id} - } - } - } - } - }); - } - if ($scope.search.options && $scope.search.location && $scope.search.location.length > 0) { - filters.push({match_phrase: { location: $scope.search.location}}); - } - - if (!matches.length && !filters.length) { - $scope.doGetLastRecord(); - return; - } - - if ($scope.search.type) { - filters.push({term: {type: $scope.search.type}}); - } - - var query = {bool: {}}; - if (matches.length > 0) { - query.bool.should = matches; - } - if (filters.length > 0) { - query.bool.filter = filters; - } - - return $scope.doRequest({query: query, from: from}); - }; - - $scope.doGetLastRecord = function(from) { - - $scope.search.lastRecords = true; - - var options = { - sort: { - "creationTime" : "desc" - }, - from: from - }; - - if ($scope.search.type) { - options.query = {bool: {filter: {term: {type: $scope.search.type}}}}; - } - - return $scope.doRequest(options); - }; - - $scope.showMore = function() { - var from = $scope.search.results ? $scope.search.results.length : 0; - - $scope.search.loadingMore = true; - - var searchFunction = ($scope.search.lastRecords) ? - $scope.doGetLastRecord : - $scope.doSearch; - - return searchFunction(from) - .then(function() { - $scope.search.loadingMore = false; - $scope.$broadcast('scroll.infiniteScrollComplete'); - }) - .catch(function(err) { - console.error(err); - $scope.search.loadingMore = false; - $scope.search.hasMore = false; - $scope.$broadcast('scroll.infiniteScrollComplete'); - }); - }; - - $scope.doRequest = function(options) { - options = options || {}; - options.from = options.from || 0; - options.size = options.size || defaultSearchLimit; - if (options.size < defaultSearchLimit) options.size = defaultSearchLimit; - $scope.search.loading = (options.from === 0); - - return esMarket.record.search(options) - .then(function(records){ - if (!records && !records.length) { - $scope.search.results = (options.from > 0) ? $scope.search.results : []; - $scope.search.hasMore = false; - $scope.search.loading = false; - return; - } - - // Filter on type (workaround if filter on term 'type' not working) - var formatSlug = $filter('formatSlug'); - records.reduce(function(res, record) { - if ($scope.search.type && $scope.search.type != record.type) { - return res; - } - record.urlTitle = formatSlug(record.title); - return res.concat(record); - }, []); - - // Replace results, or append if 'show more' clicked - if (!options.from) { - $scope.search.results = records; - } - else { - $scope.search.results = $scope.search.results.concat(records); - } - $scope.search.hasMore = $scope.search.results.length >= options.from + options.size; - $scope.search.loading = false; - - if (records.length > 0) { - // Set Motion - $timeout(function() { - UIUtils.motion.ripple({ - startVelocity: 3000 - }); - // Set Ink - UIUtils.ink({ - selector: '.item.ink' - }); - }, 10); - } - }) - .catch(function(err) { - $scope.search.loading = false; - $scope.search.results = (options.from > 0) ? $scope.search.results : []; - $scope.search.hasMore = false; - UIUtils.onError('MARKET.ERROR.LOOKUP_RECORDS_FAILED')(err); - }); - }; - - /* -- options -- */ - - $scope.onToggleOptions = function() { - if ($scope.search.entered) { - $scope.doSearch(); - } - }; - $scope.$watch('search.options', $scope.onToggleOptions, true); - - /* -- modals -- */ - - $scope.showCategoryModal = function() { - // load categories - return esMarket.category.all() - .then(function(categories){ - return ModalUtils.show('plugins/es/templates/common/modal_category.html', 'ESCategoryModalCtrl as ctrl', - {categories : categories}, - {focusFirstInput: true} - ); - }) - .then(function(cat){ - if (cat && cat.parent) { - $scope.search.category = cat; - $scope.doSearch(); - } - }); - }; - - $scope.showNewRecordModal = function() { - return $scope.loadWallet({minData: true}) - .then(function() { - return UIUtils.loading.hide(); - }).then(function() { - return ModalUtils.show('plugins/es/templates/market/modal_record_type.html'); - }) - .then(function(type){ - if (type) { - $state.go('app.market_add_record', {type: type}); - } - }); - }; -} - -function ESMarketRecordViewController($scope, $anchorScroll, $ionicPopover, $state, $ionicHistory, $q, - $timeout, $filter, Modals, - csWallet, esMarket, UIUtils, esHttp, csSettings) { - 'ngInject'; - - $scope.formData = {}; - $scope.id = null; - $scope.category = {}; - $scope.pictures = []; - $scope.canEdit = false; - $scope.maxCommentSize = 10; - $scope.loading = true; - - $scope.$on('$ionicView.enter', function (e, state) { - if (state.stateParams && state.stateParams.id) { // Load by id - if ($scope.loading || state.stateParams.refresh) { // prevent reload if same id (if not force) - $scope.load(state.stateParams.id, state.stateParams.anchor); - } - - // Notify child controllers - $scope.$broadcast('$recordView.enter', state); - } - else { - $state.go('app.market_lookup'); - } - }); - - $scope.$on('$ionicView.beforeLeave', function (event, args) { - $scope.$broadcast('$recordView.beforeLeave', args); - }); - - $scope.load = function (id, anchor) { - $scope.loading = true; - esMarket.record.load(id, { - fetchPictures: false,// lazy load for pictures - convertPrice: true // convert to user unit - }) - .then(function (data) { - $scope.formData = data.record; - $scope.id = data.id; - $scope.issuer = data.issuer; - $scope.canEdit = $scope.formData && csWallet.isUserPubkey($scope.formData.issuer); - UIUtils.loading.hide(); - $scope.loading = false; - // Set Motion (only direct children, to exclude .lazy-load children) - $timeout(function () { - UIUtils.motion.fadeSlideIn({ - selector: '.list > .item', - startVelocity: 3000 - }); - }); - }) - .catch(function (err) { - if (!$scope.secondTry) { - $scope.secondTry = true; - $q(function () { - $scope.load(id); // loop once - }, 100); - } - else { - $scope.loading = false; - UIUtils.loading.hide(); - if (err && err.ucode === 404) { - UIUtils.toast.show('MARKET.ERROR.RECORD_NOT_EXISTS'); - $state.go('app.market_lookup'); - } - else { - UIUtils.onError('MARKET.ERROR.LOAD_RECORD_FAILED')(err); - } - } - }); - - // Continue loading other data - $timeout(function () { - - // Load pictures - esMarket.record.picture.all({id: id}) - .then(function (hit) { - if (hit._source.pictures) { - $scope.pictures = hit._source.pictures.reduce(function (res, pic) { - return res.concat(esHttp.image.fromAttachment(pic.file)); - }, []); - } - }) - .then(function () { - // Set Motion - $timeout(function () { - UIUtils.motion.fadeSlideIn({ - selector: '.lazy-load .item.card-gallery', - startVelocity: 3000 - }); - }, 200); - }) - .catch(function () { - $scope.pictures = []; - }); - - // Load other data (from child controller) - $scope.$broadcast('$recordView.load', id, esMarket.record.comment); - - // scroll (if comment anchor) - if (anchor) $timeout(function () { - $anchorScroll(anchor); - }, 1000); - }); - - }; - - $scope.refreshConvertedPrice = function () { - $scope.loading = true; // force reloading if settings changed (e.g. unit price) - }; - $scope.$watch('$root.settings.useRelative', $scope.refreshConvertedPrice, true); - - $scope.edit = function () { - $state.go('app.market_edit_record', {id: $scope.id, title: $filter('formatSlug')($scope.formData.title)}); - }; - - $scope.delete = function () { - $scope.hideActionsPopover(); - - UIUtils.alert.confirm('MARKET.VIEW.REMOVE_CONFIRMATION') - .then(function (confirm) { - if (confirm) { - esMarket.record.remove($scope.id) - .then(function () { - $ionicHistory.nextViewOptions({ - historyRoot: true - }); - $state.go('app.market_lookup'); - UIUtils.toast.show('MARKET.INFO.RECORD_REMOVED'); - }) - .catch(UIUtils.onError('MARKET.ERROR.REMOVE_RECORD_FAILED')); - } - }); - }; - - /* -- modals & popover -- */ - - $scope.showActionsPopover = function (event) { - if (!$scope.actionsPopover) { - $ionicPopover.fromTemplateUrl('plugins/es/templates/market/view_popover_actions.html', { - scope: $scope - }).then(function (popover) { - $scope.actionsPopover = popover; - //Cleanup the popover when we're done with it! - $scope.$on('$destroy', function () { - $scope.actionsPopover.remove(); - }); - $scope.actionsPopover.show(event); - }); - } - else { - $scope.actionsPopover.show(event); - } - }; - - $scope.hideActionsPopover = function () { - if ($scope.actionsPopover) { - $scope.actionsPopover.hide(); - } - }; - - $scope.showSharePopover = function (event) { - $scope.hideActionsPopover(); - - var title = $scope.formData.title; - var url = $rootScope.rootPath + $state.href('app.market_view_record', {title: title, id: $scope.id}); - UIUtils.popover.share(event, { - bindings: { - url: url, - titleKey: 'MARKET.VIEW.POPOVER_SHARE_TITLE', - titleValues: {title: title}, - time: $scope.formData.time, - postMessage: title, - postImage: $scope.pictures.length > 0 ? $scope.pictures[0] : null - } - }); - }; - - $scope.buy = function () { - $scope.hideActionsPopover(); - - return $scope.loadWallet() - .then(function (walletData) { - UIUtils.loading.hide(); - if (walletData) { - return Modals.showTransfer({ - pubkey: $scope.issuer.pubkey, - uid: $scope.issuer.name || $scope.issuer.uid, - amount: $scope.formData.price - } - ) - .then(function (result) { - if (result) { - return UIUtils.toast.show('INFO.TRANSFER_SENT'); - } - }); - } - }); - }; -} - -function ESMarketRecordEditController($scope, $q, $timeout, $state, $ionicPopover, esMarket, $ionicHistory, $focus, - UIUtils, ModalUtils, esHttp, csSettings, csCurrency) { - 'ngInject'; - - $scope.formData = { - price: null, - category: {} - }; - $scope.id = null; - $scope.pictures = []; - $scope.loading = true; - - $scope.setForm = function(form) { - $scope.form = form; - }; - - $scope.$on('$ionicView.enter', function(e, state) { - // Load wallet - $scope.loadWallet({minData: true}) - .then(function() { - $scope.useRelative = csSettings.data.useRelative; - if (state.stateParams && state.stateParams.id) { // Load by id - $scope.load(state.stateParams.id); - } - else { - // New record - if (state.stateParams && state.stateParams.type) { - $scope.formData.type=state.stateParams.type; - } - // Set the default currency - csCurrency.get() - .then(function(currency){ - $scope.formData.currency = currency.name; - $scope.loading = false; - UIUtils.loading.hide(); - $timeout(function(){ - UIUtils.motion.ripple(); - }, 100); - }); - } - $focus('market-record-title'); - }); - }); - - $ionicPopover.fromTemplateUrl('plugins/es/templates/market/popover_unit.html', { - scope: $scope - }).then(function(popover) { - $scope.unitPopover = popover; - }); - - $scope.$on('$destroy', function() { - if (!!$scope.unitPopover) { - $scope.unitPopover.remove(); - } - }); - - $scope.cancel = function() { - $scope.closeModal(); - }; - - $scope.load = function(id) { - return esMarket.record.load(id, { - fetchPictures: true, - convertPrice: false // keep original price - }) - .then(function(data) { - $scope.formData = data.record; - if (data.record.unit === 'unit') { - $scope.formData.price = $scope.formData.price / 100; // add 2 decimals in quantitative mode - } - $scope.id = data.id; - $scope.pictures = data.record.pictures || []; - delete $scope.formData.pictures; // duplicated with $scope.pictures - $scope.useRelative = $scope.formData.price ? - (!$scope.formData.unit || $scope.formData.unit == 'UD') : - csSettings.data.useRelative; - $scope.loading = false; - UIUtils.loading.hide(); - $timeout(function(){ - UIUtils.motion.ripple({ - selector: '.animate-ripple .item, .card-gallery', - startVelocity: 3000 - }); - // Set Ink - UIUtils.ink(); - }, 100); - }) - .catch(UIUtils.onError('MARKET.ERROR.LOAD_RECORD_FAILED')); - }; - - $scope.save = function() { - $scope.form.$submitted=true; - if($scope.saving || // avoid multiple save - !$scope.form.$valid || !$scope.formData.category.id) { - return; - } - $scope.saving = true; - - return UIUtils.loading.show() - - // Preparing json (pictures + resizing thumbnail) - .then(function() { - var json = angular.copy($scope.formData); - - if (!!json.price && typeof json.price == "string") { - json.price = parseFloat(json.price.replace(new RegExp('[.,]'), '.')); // fix #124 - } - if (!!json.price) { - json.unit = json.unit || ($scope.useRelative ? 'UD' : 'unit'); - if (json.unit === 'unit') { - json.price = json.price * 100; // remove 2 decimals in quantitative mode - } - } - else { - delete json.unit; - } - json.time = esHttp.date.now(); - if (!json.currency) { - json.currency = $scope.currency; - } - - json.picturesCount = $scope.pictures.length; - if (json.picturesCount) { - json.pictures = $scope.pictures.reduce(function(res, pic) { - return res.concat({file: esHttp.image.toAttachment(pic)}); - }, []); - return UIUtils.image.resizeSrc($scope.pictures[0].src, true) // resize thumbnail - .then(function(imageSrc) { - json.thumbnail = esHttp.image.toAttachment({src: imageSrc}); - return json; - }); - } - else { - if ($scope.formData.thumbnail) { - // FIXME: this is a workaround to allow content deletion - // Is it a bug in the ES attachment-mapper ? - $scope.formData.thumbnail = { - _content: '', - _content_type: '' - }; - } - json.pictures = []; - return json; - } - }) - - // Send data (create or update) - .then(function(json) { - if (!$scope.id) { - json.creationTime = esHttp.date.now(); - return esMarket.record.add(json); - } - else { - return esMarket.record.update(json, {id: $scope.id}); - } - }) - - // Redirect to record view - .then(function(id) { - $scope.id= $scope.id || id; - $scope.saving = false; - $ionicHistory.clearCache($ionicHistory.currentView().stateId); // clear current view - $ionicHistory.nextViewOptions({historyRoot: true}); - $state.go('app.market_view_record', {id: $scope.id, refresh: true}); - }) - - .catch(function(err) { - $scope.saving = false; - UIUtils.onError('MARKET.ERROR.FAILED_SAVE_RECORD')(err); - }); - }; - - $scope.setUseRelative = function(useRelative) { - $scope.formData.unit = useRelative ? 'UD' : 'unit'; - $scope.useRelative = useRelative; - $scope.unitPopover.hide(); - }; - - $scope.openCurrencyLookup = function() { - alert('Not implemented yet. Please submit an issue if occur again.'); - }; - - $scope.cancel = function() { - $ionicHistory.goBack(); - }; - - /* -- modals -- */ - $scope.showRecordTypeModal = function() { - ModalUtils.show('plugins/es/templates/market/modal_record_type.html') - .then(function(type){ - if (type) { - $scope.formData.type = type; - } - }); - }; - - $scope.showCategoryModal = function() { - // load categories - esMarket.category.all() - .then(function(categories){ - return ModalUtils.show('plugins/es/templates/common/modal_category.html', 'ESCategoryModalCtrl as ctrl', - {categories : categories}, - {focusFirstInput: true} - ); - }) - .then(function(cat){ - if (cat && cat.parent) { - $scope.formData.category = cat; - } - }); - }; -} diff --git a/www/plugins/es/js/services/comment-services.js b/www/plugins/es/js/services/comment-services.js index 89766ee0bfe2f7a4c765edf3e447ef3c38813417..20854121a4a7ead1b4d7c6ef8a3748906ff84700 100644 --- a/www/plugins/es/js/services/comment-services.js +++ b/www/plugins/es/js/services/comment-services.js @@ -184,7 +184,8 @@ angular.module('cesium.es.comment.services', ['ngResource', 'cesium.bma.services // Open websocket var time = new Date().getTime(); console.info("[ES] [comment] Starting websocket to listen comments on [{0}/record/{1}]".format(index, recordId.substr(0,8))); - return exports.raw.wsChanges.open() + var wsChanges = exports.raw.wsChanges(); + return wsChanges.open() // Define source filter .then(function(sock) { @@ -194,7 +195,7 @@ angular.module('cesium.es.comment.services', ['ngResource', 'cesium.bma.services // Listen changes .then(function(){ console.debug("[ES] [comment] Websocket opened in {0} ms".format(new Date().getTime() - time)); - exports.raw.wsChanges.on(function(change) { + wsChanges.on(function(change) { if (!change) return; var comment = data.mapById[change._id]; if (change._operation === 'DELETE') { @@ -303,7 +304,7 @@ angular.module('cesium.es.comment.services', ['ngResource', 'cesium.bma.services comment.cleanAllListeners(); }); // Close previous - exports.raw.wsChanges.close(); + exports.raw.wsChanges().close(); }; // Expose functions diff --git a/www/plugins/es/js/services/market-services.js b/www/plugins/es/js/services/market-services.js deleted file mode 100644 index 20ff1f1f4d82772f3412eff96343371a7ab5b2eb..0000000000000000000000000000000000000000 --- a/www/plugins/es/js/services/market-services.js +++ /dev/null @@ -1,231 +0,0 @@ -angular.module('cesium.es.market.services', ['ngResource', 'cesium.services', 'cesium.es.http.services', 'cesium.es.comment.services']) - -.factory('esMarket', function($q, csSettings, BMA, esHttp, esComment, esUser) { - 'ngInject'; - - function EsMarket() { - - var - fields = { - commons: ["category", "title", "description", "issuer", "time", "location", "price", "unit", "currency", "thumbnail._content_type", "picturesCount", "type"] - }, - exports = { - _internal: {} - }; - - exports._internal.category= { - get: esHttp.get('/market/category/:id'), - all: esHttp.get('/market/category/_search?sort=order&from=0&size=1000&_source=name,parent') - }; - - - function getCategories() { - if (exports._internal.categories && exports._internal.categories.length) { - var deferred = $q.defer(); - deferred.resolve(exports._internal.categories); - return deferred.promise; - } - - return exports._internal.category.all() - .then(function(res) { - if (res.hits.total === 0) { - exports._internal.categories = []; - } - else { - var categories = res.hits.hits.reduce(function(result, hit) { - var cat = hit._source; - cat.id = hit._id; - return result.concat(cat); - }, []); - // add as map also - _.forEach(categories, function(cat) { - categories[cat.id] = cat; - }); - exports._internal.categories = categories; - } - return exports._internal.categories; - }); - } - - function getCategory(params) { - return exports._internal.category.get(params) - .then(function(hit) { - var res = hit._source; - res.id = hit._id; - return res; - }); - } - - - function readRecordFromHit(hit, categories, currentUD, convertPriceToUnit) { - - var record = hit._source; - if (record.category && record.category.id) { - record.category = categories[record.category.id]; - } - - if (record.price && convertPriceToUnit) { - if (!record.unit || record.unit==='UD') { - record.price = record.price * currentUD; - } - } - if (hit.highlight) { - if (hit.highlight.title) { - record.title = hit.highlight.title[0]; - } - if (hit.highlight.description) { - record.description = hit.highlight.description[0]; - } - if (hit.highlight.location) { - record.location = hit.highlight.location[0]; - } - if (record.category && hit.highlight["category.name"]) { - record.category.name = hit.highlight["category.name"][0]; - } - } - - // thumbnail - record.thumbnail = esHttp.image.fromHit(hit, 'thumbnail'); - - // pictures - if (hit._source.pictures && hit._source.pictures.reduce) { - record.pictures = hit._source.pictures.reduce(function(res, pic) { - return res.concat(esHttp.image.fromAttachment(pic.file)); - }, []); - } - - return record; - } - - exports._internal.searchText = esHttp.get('/market/record/_search?q=:search'); - exports._internal.search = esHttp.post('/market/record/_search'); - exports._internal.get = esHttp.get('/market/record/:id'); - exports._internal.getCommons = esHttp.get('/market/record/:id?_source=' + fields.commons.join(',')); - - function search(request) { - request = request || {}; - request.from = request.from || 0; - request.size = request.size || 20; - request._source = request._source || fields.commons; - request.highlight = request.highlight || { - fields : { - title : {}, - description : {}, - "category.name" : {} - } - }; - - return $q.all([ - // load categories - exports.category.all(), - - // Get last UD - BMA.blockchain.lastUd() - .then(function (currentUD) { - return currentUD; - }) - .catch(function(err) { - console.error(err); - return 1; - }), - - // Do search - exports._internal.search(request) - ]) - .then(function(res) { - var categories = res[0]; - var currentUD = res[1]; - res = res[2]; - - if (!res || !res.hits || !res.hits.total) { - return []; - } - return res.hits.hits.reduce(function(result, hit) { - var record = readRecordFromHit(hit, categories, currentUD, true); - record.id = hit._id; - return result.concat(record); - }, []); - }); - } - - function loadData(id, options) { - options = options || {}; - options.fetchPictures = angular.isDefined(options.fetchPictures) ? options.fetchPictures : true; - options.convertPrice = angular.isDefined(options.convertPrice) ? options.convertPrice : false; - - return $q.all([ - // load categories - exports.category.all(), - - // Get last UD - BMA.blockchain.lastUd() - .then(function (currentUD) { - return currentUD; - }) - .catch(function(err) { - console.error(err); - return 1; - }), - - // Do get source - options.fetchPictures ? - exports._internal.get({id: id}) : - exports._internal.getCommons({id: id}) - ]) - .then(function(res) { - var categories = res[0]; - var currentUD = res[1]; - var hit = res[2]; - - - var record = readRecordFromHit(hit, categories, currentUD, options.convertPrice); - - // Load issuer (avatar, name, uid, etc.) - return esUser.profile.fillAvatars([{pubkey: record.issuer}]) - .then(function(idties) { - var data = { - id: hit._id, - issuer: idties[0], - record: record - }; - - // Make sure currency if present (fix old data) - if (!record.currency) { - return csCurrency.get() - .then(function (currency) { - record.currency = currency.name; - return data; - }); - } - - return data; - }); - }); - } - - exports.category = { - all: getCategories, - get: getCategory, - searchText: esHttp.get('/market/category/_search?q=:search'), - search: esHttp.post('/market/category/_search'), - }; - exports.record = { - search: search, - load: loadData, - add: esHttp.record.post('/market/record'), - update: esHttp.record.post('/market/record/:id/_update'), - remove: esHttp.record.remove('market', 'record'), - fields: { - commons: fields.commons - }, - picture: { - all: esHttp.get('/market/record/:id?_source=pictures') - }, - comment: esComment.instance('market') - }; - return exports; - } - - return EsMarket(); -}) -; diff --git a/www/plugins/es/templates/market/edit_record.html b/www/plugins/es/templates/market/edit_record.html deleted file mode 100644 index 10f75a98b54477ae7629be327e5d151b120e21d7..0000000000000000000000000000000000000000 --- a/www/plugins/es/templates/market/edit_record.html +++ /dev/null @@ -1,163 +0,0 @@ -<ion-view left-buttons="leftButtons" id="editMarket"> - <ion-nav-title> - <span class="visible-xs" ng-if="id" ng-bind-html="formData.title"></span> - <span class="visible-xs" ng-if="!loading && !id" translate>MARKET.EDIT.TITLE_NEW</span> - </ion-nav-title> - - <ion-nav-buttons side="secondary"> - <button class="button button-clear button-icon icon visible-xs visible-sm" - ng-class="{'ion-android-send':!id, 'ion-android-done': id}" - ng-click="save()"> - </button> - </ion-nav-buttons> - - <ion-content scroll="true"> - - <div class="row no-padding"> - - <div class="col col-20 hidden-xs hidden-sm"> </div> - - <div class="col"> - - <!-- loading --> - <div class="center padding" ng-if="loading"> - <ion-spinner icon="android"></ion-spinner> - </div> - - <form name="recordForm" novalidate="" ng-submit="save()"> - <div class="list animate-ripple" ng-init="setForm(recordForm)"> - - <div class="item hidden-xs item-text-wrap"> - <h1 ng-if="id" ng-bind-html="formData.title"></h1> - <h1 ng-if="!id" translate>MARKET.EDIT.TITLE_NEW</h1> - </div> - <div class="item"> - <h4 class="gray" ng-if="id"> - <i class="icon ion-calendar"></i> - {{'COMMON.LAST_MODIFICATION_DATE'|translate}} {{formData.time | formatDate}} - </h4> - <div class="badge badge-balanced badge-editable" ng-click="showRecordTypeModal()"> - <span>{{'MARKET.TYPE.'+formData.type|upper|translate}}</span> - </div> - </div> - - <!-- pictures --> - <ng-include src="'plugins/es/templates/common/edit_pictures.html'"></ng-include> - - <!-- category --> - <a class="item item-icon-right ink" - ng-class="{'item-input-error': form.$submitted && !formData.category.id}" - ng-click="showCategoryModal()"> - <span class="item-label" translate>COMMON.CATEGORY</span> - <span class="badge badge-royal" ng-bind-html="formData.category.name"></span> - <i class="gray icon ion-ios-arrow-right"></i> - </a> - <div class="form-errors" - ng-show="form.$submitted && !formData.category.id"> - <div class="form-error"> - <span translate="ERROR.FIELD_REQUIRED"></span> - </div> - </div> - - <!-- title --> - <div class="item item-input item-floating-label" - ng-class="{'item-input-error': form.$submitted && form.title.$invalid}"> - <span class="input-label" translate>MARKET.EDIT.RECORD_TITLE</span> - <input type="text" placeholder="{{'MARKET.EDIT.RECORD_TITLE_HELP'|translate}}" - name="title" - id="market-record-title" - ng-model="formData.title" - ng-minlength="5" - required> - </div> - <div class="form-errors" - ng-show="form.$submitted && form.title.$error" - ng-messages="form.title.$error"> - <div class="form-error" ng-message="required"> - <span translate="ERROR.FIELD_REQUIRED"></span> - </div> - <div class="form-error" ng-message="minlength"> - <span translate="ERROR.FIELD_TOO_SHORT"></span> - </div> - </div> - - <div class="item item-input item-floating-label"> - <span class="input-label" translate>MARKET.EDIT.RECORD_DESCRIPTION</span> - <textarea placeholder="{{'MARKET.EDIT.RECORD_DESCRIPTION_HELP'|translate}}" - ng-model="formData.description" - rows="8" cols="10"></textarea> - </div> - - <!-- price --> - <div class="item item-input item-floating-label item-button-right" - ng-class="{'item-input-error': form.$submitted && form.price.$invalid}" - > - <div class="input-label">{{::'MARKET.EDIT.RECORD_PRICE' | translate}} (<span ng-bind-html="formData.currency| currencySymbol:useRelative"></span>)</div> - - <input type="number" name="price" placeholder="{{::'MARKET.EDIT.RECORD_PRICE_HELP' | translate}} ({{formData.currency | currencySymbolNoHtml:useRelative}})" - ng-model="formData.price" - number-float> - <span class="gray button button-block icon ion-arrow-swap hidden-xs hidden-sm" ng-click="unitPopover.show($event)"> - </span> - <span class="gray button button-block button-clear button-icon visible-xs visible-sm" ng-click="unitPopover.show($event)"> - <i class="icon ion-android-more-vertical"></i> - </span> - </div> - <div class="form-errors" - ng-show="form.$submitted && form.price.$error" - ng-messages="form.price.$error"> - <div class="form-error" ng-message="numberFloat"> - <span translate="ERROR.FIELD_NOT_NUMBER"></span> - </div> - <div class="form-error" ng-message="numberInt"> - <span translate="ERROR.FIELD_NOT_INT"></span> - </div> - </div> - - <!--dev class="item item-icon-right ink" - ng-show="formData.price" - ng-click="openCurrencyLookup()" > - <span class="item-label gray" translate>MARKET.EDIT.RECORD_CURRENCY</span> - <span class="badge badge-royal">{{formData.currency}}</span> - <i class="gray icon ion-ios-arrow-right"></i> - </dev--> - - <div class="item item-floating-label" ng-if="location.enable"> - <span class="input-label" translate>MARKET.EDIT.RECORD_LOCATION</span> - <div class="item-input-inset"> - <label class="item-input-wrapper"> - <input type="text" placeholder="{{'MARKET.EDIT.RECORD_LOCATION_HELP'|translate}}" ng-model="formData.location"> - </label> - <button class="button button-small button-positive" ng-click="localize()" ng-if="location.enable"> - <i class="icon ion-pinpoint"></i> - </button> - </div> - </div> - - <div class="item item-input item-floating-label" ng-if="!location.enable"> - <span class="input-label" translate>MARKET.EDIT.RECORD_LOCATION</span> - <textarea placeholder="{{'MARKET.EDIT.RECORD_LOCATION_HELP'|translate}}" ng-model="formData.location"></textarea> - </div> - - <!-- buttons --> - <div class="item padding hidden-xs hidden-sm text-right"> - <button class="button button-clear button-dark ink" ng-click="cancel()" type="button" translate> - COMMON.BTN_CANCEL - </button> - <button class="button button-positive button-raised ink" type="submit" ng-if="!id" translate> - COMMON.BTN_PUBLISH - </button> - <button class="button button-assertive button-raised ink" type="submit" ng-if="id" translate> - COMMON.BTN_SAVE - </button> - </div> - </div> - </form> - </div> - - <div class="col col-20 hidden-xs hidden-sm"> </div> - - </div> - </div> - </ion-content> -</ion-view> diff --git a/www/plugins/es/templates/market/lookup.html b/www/plugins/es/templates/market/lookup.html deleted file mode 100644 index baa6682013b6d5f9de51943a03edabc2a8b9f1a0..0000000000000000000000000000000000000000 --- a/www/plugins/es/templates/market/lookup.html +++ /dev/null @@ -1,102 +0,0 @@ -<ion-view left-buttons="leftButtons"> - <ion-nav-title> - <span translate>MARKET.SEARCH.TITLE</span> - </ion-nav-title> - - <ion-content class="lookupForm padding no-padding-xs" scroll="true" - bind-notifier="{ rebind:$root.settings.useRelative }"> - - <form ng-submit="doSearch()"> - <label class="item item-input"> - <i class="icon ion-search placeholder-icon"></i> - <input type="text" - placeholder="{{'MARKET.SEARCH.SEARCH_HELP'|translate}}" - ng-model="search.text" - ng-model-options="{ debounce: 650 }" - ng-change="doSearch()"> - </label> - - <!-- options --> - <ng-include src="'plugins/es/templates/market/lookup_options.html'"></ng-include> - </form> - - <div class="padding-top padding-xs" style="display: block; height: 60px;"> - <div class="pull-left"> - <h4 - ng-if="!search.loading && search.lastRecords && search.results.length" translate> - MARKET.SEARCH.LAST_RECORDS - </h4> - <h4 - ng-if="!search.loading && !search.lastRecords && (search.text.length || search.options != null)" translate> - COMMON.RESULTS_LIST - </h4> - </div> - </div> - - <div class="center" ng-if="search.loading"> - <ion-spinner icon="android"></ion-spinner> - </div> - - <div class="padding assertive" ng-if="!search.loading && search.results.length===0 && search.options != null" translate> - COMMON.SEARCH_NO_RESULT - </div> - - <div class="list animate-ripple" - ng-if="!search.loading && search.results.length"> - - <a ng-repeat="rec in search.results" - class="item no-padding-bottom no-padding-top" - ui-sref="app.market_view_record({id: rec.id, title: rec.urlTitle})"> - - <div class="card card-record stable-bg ink padding-top"> - - <div class="card-item item-thumbnail-left item-text-wrap padding-right"> - <i class="item-image" ng-if="rec.thumbnail" style="background-image: url('{{::rec.thumbnail.src}}')"></i> - <i class="item-image ion-speakerphone" ng-if="!rec.thumbnail"></i> - <h2 ng-bind-html="rec.title"></h2> - <h4 class="gray"> - <span ng-if="rec.location"> - <i class="icon ion-location"></i> - <span ng-bind-html="rec.location"></span> - </span> - <span ng-show="rec.time"> - <span ng-show="rec.location">|</span> - {{::rec.time | formatFromNow}} - </span> - </h4> - <h3 class="gray text-wrap" ng-bind-html="rec.description | truncText:200" ng-if="rec.description"></h3> - <div ng-if="rec.picturesCount > 1" - class="badge badge-balanced badge-picture-count">{{::rec.picturesCount}} <i class="icon ion-camera"></i> - </div> - - </div> - <div class="card-footer" style="height: 45px"> - - <div class="badge badge-price badge-calm" ng-if="rec.type=='offer'"> - <i class="cion-market-offer"></i> - <span ng-if="rec.price" ng-bind-html=":rebind:rec.price|formatAmount:{currency: rec.currency}"></span> - <span ng-if="!rec.price" translate>MARKET.TYPE.OFFER</span> - </div> - <div class="badge badge-energized badge-price" ng-if="rec.type=='need'"> - <i class="cion-market-need"></i> - {{'MARKET.TYPE.NEED'|translate}} - </div> - </div> - </div> - - </a> - </div> - - <ion-infinite-scroll - ng-if="!search.loading && search.hasMore" - spinner="android" - on-infinite="showMore()" - distance="1%"> - </ion-infinite-scroll> - </ion-content> - - <button id="fab-add-market-record bu" - class="button button-fab button-fab-bottom-right button-assertive icon ion-compose visible-xs visible-sm spin" - ng-click="showNewRecordModal()"> - </button> -</ion-view> diff --git a/www/plugins/es/templates/market/lookup_lg.html b/www/plugins/es/templates/market/lookup_lg.html deleted file mode 100644 index 6b739fa47f3d69d1119e98c651c3267b37c03388..0000000000000000000000000000000000000000 --- a/www/plugins/es/templates/market/lookup_lg.html +++ /dev/null @@ -1,129 +0,0 @@ -<ion-view left-buttons="leftButtons"> - <ion-nav-title> - <span translate>MARKET.SEARCH.TITLE</span> - </ion-nav-title> - - <ion-content class="lookupForm padding no-padding-xs" - bind-notifier="{ rebind:$root.settings.useRelative }"> - - <button class="button button-small button-positive button-clear ink pull-right padding-right hidden-sm hidden-xs" - ng-click="showNewRecordModal()"> - <i class="icon ion-compose"></i> - {{'MARKET.COMMON.BTN_NEW_AD' | translate}} - </button> - - <form ng-submit="doSearch()"> - <label class="item item-input"> - <i class="icon ion-search placeholder-icon"></i> - <input type="text" - class="visible-xs visible-sm" - placeholder="{{'MARKET.SEARCH.SEARCH_HELP'|translate}}" - ng-model="search.text" - ng-model-options="{ debounce: 650 }" - ng-change="doSearch()"> - <input type="text" - class="hidden-xs hidden-sm" - placeholder="{{'MARKET.SEARCH.SEARCH_HELP'|translate}}" - id="marketSearchText" - ng-model="search.text" - on-return="doSearch()"> - </label> - - <!-- options --> - <ng-include src="'plugins/es/templates/market/lookup_options.html'"></ng-include> - </form> - - <div class="padding-top padding-xs" style="display: block; height: 60px;"> - <div class="pull-left" ng-if="!search.loading"> - <h4 - ng-if="search.lastRecords && search.results.length" translate> - MARKET.SEARCH.LAST_RECORDS - </h4> - <h4 - ng-if="!search.lastRecords && (search.text.length || search.options != null)" translate> - COMMON.RESULTS_LIST - </h4> - </div> - - <div class="hidden-xs hidden-sm pull-right"> - <a class="button button-text button-small ink icon cion-market-offer" - ng-class="{'button-text-positive': search.type=='offer'}" - ng-click="setAdType('offer')"> - {{'MARKET.SEARCH.BTN_OFFERS' | translate}} - </a> - - <a class="button button-text button-small ink icon cion-market-need" - ng-class="{'button-text-positive': search.type=='need'}" - ng-click="setAdType('need')"> - {{'MARKET.SEARCH.BTN_NEEDS' | translate}} - </a> - - <button class="button button-small button-stable ink" - ng-click="doSearch()"> - {{'COMMON.BTN_SEARCH' | translate}} - </button> - </div> - </div> - - <div class="center" ng-if="search.loading"> - <ion-spinner icon="android"></ion-spinner> - </div> - - <div class="padding assertive" ng-if="!search.loading && search.results.length===0 && search.options != null" translate> - COMMON.SEARCH_NO_RESULT - </div> - - <div class="list animate-ripple" - ng-if="!search.loading && search.results.length"> - - <a ng-repeat="rec in search.results track by rec.id" - class="item item-record item-border-large ink padding-xs" - ui-sref="app.market_view_record({id: rec.id, title: rec.urlTitle})"> - - <div class="row row-record"> - <div class="col item-text-wrap item-thumbnail-left"> - <img ng-src="{{::rec.thumbnail.src}}" ng-if="rec.thumbnail"> - <i class="item-image ion-speakerphone" ng-if="!rec.thumbnail"></i> - <h2 ng-bind-html="rec.title"></h2> - <h4 class="gray"> - <i class="icon ion-location" ng-if="rec.location"></i> - <span ng-bind-html="rec.location"></span> - </h4> - <h4 class="gray" ng-if="rec.time"> - <i class="icon ion-clock" ></i> - {{::rec.time | formatFromNow}} - </h4> - <span ng-if="rec.picturesCount > 1" - class="badge badge-balanced badge-picture-count">{{::rec.picturesCount}} <i class="icon ion-camera"></i></span> - </div> - <div class="col col-20"> - <h3 class="gray" ng-if="rec.category" ng-bind-html="rec.category.name"></h3> - <div class="badge badge-price badge-calm" ng-if="rec.price"> - <i class="cion-market-offer"></i> - <span ng-bind-html=":rebind:rec.price|formatAmount:{currency: rec.currency}"></span> - </div> - <div class="badge badge-energized badge-price" ng-if="!search.type && !rec.price && rec.type=='need'"> - <i class="cion-market-need"></i> - {{'MARKET.TYPE.'+rec.type|upper|translate}} - </div> - </div> - <div class="col hidden-sm hidden-xs"> - <h3 class="gray text-wrap" ng-bind-html="rec.description | truncText:500" ng-if="rec.description"></h3> - </div> - </div> - </a> - </div> - - <ion-infinite-scroll - ng-if="!search.loading && search.hasMore" - spinner="android" - on-infinite="showMore()" - distance="10%"> - </ion-infinite-scroll> - </ion-content> - - <button id="fab-add-market-record" - class="button button-fab button-fab-bottom-right button-assertive icon ion-compose hidden-md hidden-lg spin" - ng-click="showNewRecordModal()"> - </button> -</ion-view> diff --git a/www/plugins/es/templates/market/lookup_options.html b/www/plugins/es/templates/market/lookup_options.html deleted file mode 100644 index be265e8af0e6056591093aed17b81b041a3243d5..0000000000000000000000000000000000000000 --- a/www/plugins/es/templates/market/lookup_options.html +++ /dev/null @@ -1,38 +0,0 @@ - - <div class="item item-toggle dark" ng-if="!search.lastRecords"> - <span translate>MARKET.SEARCH.BTN_OPTIONS</span> - <label class="toggle toggle-royal"> - <input type="checkbox" ng-model="search.options"> - <div class="track"> - <div class="handle"></div> - </div> - </label> - </div> - - <span class="item item-icon-right" ng-click="showCategoryModal()" ng-if="search.options"> - <span translate>COMMON.CATEGORY</span> - <span class="badge badge-royal badge-text-wrap" ng-bind-html="search.category.name"></span> - <i class="gray icon ion-ios-arrow-right"></i> - </span> - - <span class="item item-button-right" ng-if="search.options && location.enable"> - <span translate>MARKET.SEARCH.BTN_AROUND_ME</span> - <label class="toggle toggle-royal"> - <input type="checkbox" ng-model="search.localize"> - <div class="track"> - <div class="handle"></div> - </div> - </label> - </span> - - <span class="item item-button-right" ng-if="search.options && !location.enable"> - <span translate>MARKET.SEARCH.LOCATION</span> - <div class="item-input-inset"> - <label class="item-input-wrapper"> - <input type="text" placeholder="{{'MARKET.SEARCH.LOCATION_HELP'|translate}}" - ng-model="search.location" - ng-model-options="{ debounce: 350 }" - ng-change="doSearch()"/> - </label> - </div> - </span> diff --git a/www/plugins/es/templates/market/modal_record_type.html b/www/plugins/es/templates/market/modal_record_type.html deleted file mode 100644 index ea3df386baa3a7a281d7102e3c03225c31066cb2..0000000000000000000000000000000000000000 --- a/www/plugins/es/templates/market/modal_record_type.html +++ /dev/null @@ -1,18 +0,0 @@ -<ion-modal-view> - <ion-header-bar class="bar-positive"> - <button class="button button-clear" ng-click="closeModal()" translate>COMMON.BTN_CANCEL</button> - <h1 class="title" translate>MARKET.TYPE.TITLE</h1> - </ion-header-bar> - - <ion-content class="lookupForm"> - <div class="list padding"> - <h3 translate>MARKET.TYPE.SELECT_TYPE</h3> - <button class="button button-block button-stable icon icon-left cion-market-offer" - ng-click="closeModal('offer')" - translate>MARKET.TYPE.OFFER</button> - <button class="button button-block button-stable icon icon-left cion-market-need" - ng-click="closeModal('need')" - translate>MARKET.TYPE.NEED</button> - </div> -</ion-content> -</ion-modal-view> diff --git a/www/plugins/es/templates/market/popover_unit.html b/www/plugins/es/templates/market/popover_unit.html deleted file mode 100644 index eaeaf56e0f7139c38894b8e7da06ebce01c3b3c4..0000000000000000000000000000000000000000 --- a/www/plugins/es/templates/market/popover_unit.html +++ /dev/null @@ -1,18 +0,0 @@ -<ion-popover-view class="popover-unit"> - <ion-content scroll="false"> - <div class="list"> - <a class="item item-icon-left" - ng-class="{ 'selected': !useRelative}" - ng-click="setUseRelative(false)"> - <i class="icon" ng-class="{ 'ion-ios-checkmark-empty': !useRelative}"></i> - <i ng-bind-html="formData.currency | currencySymbol:false"></i> - </a> - <a class="item item-icon-left" - ng-class="{ 'selected': $parent.useRelative}" - ng-click="setUseRelative(true)"> - <i class="icon" ng-class="{ 'ion-ios-checkmark-empty': useRelative}"></i> - <i ng-bind-html="formData.currency | currencySymbol:true"></i> - </a> - </div> - </ion-content> -</ion-popover-view> diff --git a/www/plugins/es/templates/market/view_popover_actions.html b/www/plugins/es/templates/market/view_popover_actions.html deleted file mode 100644 index c094216673e5fe7b4ac112b0c480493ca5fec353..0000000000000000000000000000000000000000 --- a/www/plugins/es/templates/market/view_popover_actions.html +++ /dev/null @@ -1,29 +0,0 @@ -<ion-popover-view class="fit has-header"> - <ion-header-bar> - <h1 class="title" translate>MARKET.VIEW.MENU_TITLE</h1> - </ion-header-bar> - <ion-content scroll="false"> - <div class="list item-text-wrap"> - - <a class="item item-icon-left positive ink" - ng-if="!canEdit && formData.price && formData.type == 'offer'" - ng-click="buy()"> - <i class="icon ion-card"></i> - {{'MARKET.COMMON.BTN_BUY_DOTS' | translate}} - </a> - - <a class="item item-icon-left ink" - ng-click="showSharePopover($event)"> - <i class="icon ion-android-share-alt"></i> - {{'COMMON.BTN_SHARE' | translate}} - </a> - - <a class="item item-icon-left assertive ink " - ng-if="canEdit" - ng-click="delete()"> - <i class="icon ion-trash-a"></i> - {{'COMMON.BTN_DELETE' | translate}} - </a> - </div> - </ion-content> -</ion-popover-view> diff --git a/www/plugins/es/templates/market/view_record.html b/www/plugins/es/templates/market/view_record.html deleted file mode 100644 index 33c9116870e5a3c05ac99946e6d62099f2bf5e80..0000000000000000000000000000000000000000 --- a/www/plugins/es/templates/market/view_record.html +++ /dev/null @@ -1,150 +0,0 @@ -<ion-view left-buttons="leftButtons" class="market view-record"> - <ion-nav-title> - <span translate>MARKET.VIEW.TITLE</span> - </ion-nav-title> - - <ion-nav-buttons side="secondary"> - <button class="button button-bar button-icon button-clear visible-xs visible-sm" ng-click="edit()" ng-if="canEdit"> - <i class="icon ion-android-create"></i> - </button> - <button class="button button-bar button-icon button-clear icon ion-android-more-vertical visible-xs visible-sm" - ng-click="showActionsPopover($event)"> - </button> - </ion-nav-buttons> - - <ion-content scroll="true"> - - <div class="row no-padding"> - <div class="col col-20 hidden-xs hidden-sm"> </div> - - <div class="col no-padding"> - - <div class="center padding" ng-if="loading"> - <ion-spinner icon="android"></ion-spinner> - </div> - - <ion-list class="animate-fade-slide-in item-text-wrap no-padding-xs"> - - <div class="item item-text-wrap" ng-class="{'item-thumbnail-left': thumbnail}"> - <img ng-src="{{thumbnail.src}}" ng-if="thumbnail"> - <h1 class="padding-top" ng-bind-html="formData.title"></h1> - <h2 class="gray hidden-xs"> - <a ng-if="formData.location" ui-sref="app.market_lookup({location:formData.location})"> - <i class="icon ion-location"></i> - <span ng-bind-html="formData.location"></span> - </a> - <span ng-if="formData.location && formData.category.name"> | </span> - <a ng-if="formData.category.name" ui-sref="app.market_lookup({category:formData.category.id})"> - <i class="icon ion-flag"></i> - <span ng-bind-html="formData.category.name"></span> - </a> - </h2> - <h4 class="hidden-xs"> - <i class="icon ion-clock"></i> - <span translate>COMMON.SUBMIT_BY</span> - <a ng-class="{'positive': issuer.uid, 'gray': !issuer.uid}" - ui-sref="app.wot_identity({pubkey:issuer.pubkey, uid: issuer.name||issuer.uid})"> - <ng-if ng-if="issuer.uid"> - <i class="icon ion-person"></i> - {{issuer.name||issuer.uid}} - </ng-if> - <span ng-if="!issuer.uid"> - <i class="icon ion-key"></i> - {{issuer.pubkey|formatPubkey}} - </span> - </a> - <span> - {{formData.time|formatFromNow}} - <span class="gray hidden-xs">| - {{formData.time | formatDate}} - </span> - </span> - </h4> - <div class="badge badge-balanced"> - <span>{{'MARKET.TYPE.'+formData.type|upper|translate}}</span> - </div> - </div> - - <div class="item visible-xs no-padding-top no-padding-bottom"> - <h2 class="gray"> - <a ng-if="formData.location" ui-sref="app.market_lookup({location:formData.location})"> - <i class="icon ion-location"></i> - <span ng-bind-html="formData.location"></span> - </a> - <br/> - <a ng-if="formData.category.name" ui-sref="app.market_lookup({category:formData.category.id})"> - <i class="icon ion-flag"></i> - <span ng-bind-html="formData.category.name"></span> - </a> - </h2> - <h4> - <i class="icon ion-clock"></i> - <span translate>COMMON.SUBMIT_BY</span> - <a ng-class="{'positive': issuer.uid, 'gray': !issuer.uid}" - ui-sref="app.wot_identity({pubkey:issuer.pubkey, uid: issuer.name||issuer.uid})"> - <ng-if ng-if="issuer.uid"> - <i class="icon ion-person"></i> - {{issuer.name||issuer.uid}} - </ng-if> - <span ng-if="!issuer.uid"> - <i class="icon ion-key"></i> - {{issuer.pubkey|formatPubkey}} - </span> - </a> - <span> - {{formData.time|formatFromNow}} - <span class="gray hidden-xs">| - {{formData.time | formatDate}} - </span> - </span> - </h4> - </div> - - <!-- Buttons bar--> - <div class="item large-button-bar hidden-xs hidden-sm"> - <button class="button button-stable button-small-padding icon ion-android-share-alt" - ng-click="showSharePopover($event)"> - </button> - <button class="button button-calm ink-dark" - ng-click="buy()" - ng-if="!canEdit && formData.price && formData.type == 'offer'"> - {{'MARKET.COMMON.BTN_BUY' | translate}} - </button> - <button class="button button-stable icon-left ink-dark" - ng-if="canEdit" - ng-click="delete()"> - <i class="icon ion-trash-a assertive"></i> - <span class="assertive"> {{'COMMON.BTN_DELETE' | translate}}</span> - </button> - <button class="button button-calm icon-left ion-android-create ink" - ng-if="canEdit" - ng-click="edit()"> - {{'COMMON.BTN_EDIT' | translate}} - </button> - </div> - - <ion-item> - <h2> - <span class="text-keep-lines" ng-bind-html="formData.description"></span> - </h2> - </ion-item> - - <span class="item item-icon-left item-button-right" ng-if="formData.price"> - <i class="icon ion-pricetag"></i> - <span class="dark" ng-bind-html="formData.price | formatAmount:{currency:formData.currency}"></span> - </span> - - <div class="lazy-load"> - <!-- pictures --> - <ng-include src="'plugins/es/templates/common/view_pictures.html'"></ng-include> - - <!-- comments --> - <ng-include src="'plugins/es/templates/common/view_comments.html'"></ng-include> - </div> - </ion-list> - </div> - - <div class="col col-20 hidden-xs hidden-sm"> </div> - </div> - </ion-content> -</ion-view> diff --git a/www/plugins/es/templates/menu_extend.html b/www/plugins/es/templates/menu_extend.html index d434fe3515fbd69868ed0cbd1fd5be065421cb6f..352ff33f11423329d0f483c52e40b4a4ca3a3254 100644 --- a/www/plugins/es/templates/menu_extend.html +++ b/www/plugins/es/templates/menu_extend.html @@ -40,28 +40,6 @@ </ng-if> -<!-- Main section --> -<ng-if ng-if="enable && extensionPoint === 'menu-main'"> - - <!-- registry - <ion-item menu-close class="item item-icon-left" - active-link="active" - active-link-path-prefix="#/app/registry" - href="#/app/registry"> - <i class="icon ion-ios-book"></i> - <span translate>MENU.REGISTRY</span> - </ion-item>--> - - <!-- market - <ion-item menu-close class="item item-icon-left" - active-link="active" - active-link-path-prefix="#/app/market" - href="#/app/market"> - <i class="icon ion-speakerphone"></i> - <span translate>MENU.MARKET</span> - </ion-item>--> -</ng-if> - <!-- User section --> <ng-if ng-if="enable && extensionPoint === 'menu-user'" class="visible-xs visible-sm">