diff --git a/www/i18n/locale-fr-FR.json b/www/i18n/locale-fr-FR.json index d863dda03adfd5642ba03d62366eed37f193bce8..f09236dcbc188c87d5ba01afcb742da8551851b4 100644 --- a/www/i18n/locale-fr-FR.json +++ b/www/i18n/locale-fr-FR.json @@ -63,7 +63,7 @@ "UID": "Pseudonyme", "ENABLE": "Activé", "DISABLE": "Désactivé", - "RESULTS_LIST": "Résultats :", + "RESULTS_LIST": "Résultats", "RESULTS_COUNT": "{{count}} résultats", "EXECUTION_TIME": "executé en {{duration|formatDurationMs}}", "SHOW_VALUES": "Afficher les valeurs en clair ?", @@ -328,8 +328,10 @@ }, "LOOKUP": { "TITLE": "Annuaire", - "NEWCOMERS": "Nouveaux membres :", - "PENDING": "Inscriptions en attente :", + "NEWCOMERS": "Nouveaux membres", + "NEWCOMERS_COUNT": "{{count}} membres", + "PENDING": "Inscriptions en attente", + "PENDING_COUNT": "{{count}} inscriptions en attente", "REGISTERED": "Inscrit {{sigDate | formatFromNow}}", "MEMBER_FROM": "Membre depuis {{memberDate|formatFromNowShort}}", "BTN_NEWCOMERS": "Nouveaux membres", diff --git a/www/js/controllers/wot-controllers.js b/www/js/controllers/wot-controllers.js index 132179cdc0611a76bad2be00734e61d8dd16b370..486d204172743cfa0ba4260efdbb111681bd3f82 100644 --- a/www/js/controllers/wot-controllers.js +++ b/www/js/controllers/wot-controllers.js @@ -124,7 +124,7 @@ angular.module('cesium.wot.controllers', ['cesium.services']) ; -function WotLookupController($scope, $state, $q, $timeout, $focus, $ionicPopover, $location, +function WotLookupController($scope, $state, $timeout, $focus, $ionicPopover, $location, UIUtils, csConfig, csCurrency, csSettings, Device, BMA, csWallet, csWot) { 'ngInject'; @@ -187,7 +187,7 @@ function WotLookupController($scope, $state, $q, $timeout, $focus, $ionicPopover } else { - $scope.doRefreshLocationHref(); + $scope.updateLocationHref(); if ($scope.search.results && $scope.search.results.length) { $scope.motion.show({selector: '.lookupForm .list .item', ink: true}); } @@ -203,7 +203,7 @@ function WotLookupController($scope, $state, $q, $timeout, $focus, $ionicPopover }; }; - $scope.doRefreshLocationHref = function() { + $scope.updateLocationHref = function() { var stateParams = { q: undefined, @@ -231,16 +231,17 @@ function WotLookupController($scope, $state, $q, $timeout, $focus, $ionicPopover $scope.doSearchText = function() { $scope.doSearch(); - $scope.doRefreshLocationHref(); + $scope.updateLocationHref(); }; $scope.doSearch = function() { $scope.search.loading = true; var text = $scope.search.text.trim(); if ((UIUtils.screen.isSmall() && text.length < 3) || !text.length) { - $scope.search.results = []; + $scope.search.results = undefined; $scope.search.loading = false; $scope.search.type = 'none'; + $scope.search.total = undefined; } else { $scope.search.type = 'text'; @@ -254,7 +255,12 @@ function WotLookupController($scope, $state, $q, $timeout, $focus, $ionicPopover } else { $scope.doDisplayResult(idties); - $scope.search.total = idties && idties.length; + + // count, skipping divider + var countBy = _.countBy(idties, function(hit) { + return hit.divider && 'divider' || 'results'; + }); + $scope.search.total = countBy && countBy.results || 0; } }) .catch(UIUtils.onError('ERROR.WOT_LOOKUP_FAILED')); @@ -272,7 +278,7 @@ function WotLookupController($scope, $state, $q, $timeout, $focus, $ionicPopover // Update location href if (!offset && !skipLocationUpdate) { - $scope.doRefreshLocationHref(); + $scope.updateLocationHref(); } return csWot.newcomers(offset, size) @@ -305,7 +311,7 @@ function WotLookupController($scope, $state, $q, $timeout, $focus, $ionicPopover // Update location href if (!offset && !skipLocationUpdate) { - $scope.doRefreshLocationHref(); + $scope.updateLocationHref(); } return searchFunction(offset, size) @@ -549,7 +555,7 @@ function WotLookupModalController($scope, $controller, $focus, parameters){ $scope.closeModal($scope.selection); }; - $scope.doRefreshLocationHref = function() { + $scope.updateLocationHref = function() { // Do NOT change location href }; diff --git a/www/js/directives.js b/www/js/directives.js index 7a78f61bb7d320d16dc22dc094249aa13027f529..23d3823d6984df86e158cc93409c2d687f0254fa 100644 --- a/www/js/directives.js +++ b/www/js/directives.js @@ -79,13 +79,30 @@ angular.module('cesium.directives', []) }; }) - .directive('geoPointRequired', function() { + .directive('requiredIf', function() { return { require: '?ngModel', link: function(scope, element, attributes, ngModel) { - if (ngModel) { + if (ngModel && attributes.requiredIf) { ngModel.$validators.required = function(value) { - return ngModel.$isEmpty(value) || !value.lat || !value.lon ; + return !(scope.$eval(attributes.requiredIf)) || !ngModel.$isEmpty(value); + }; + + scope.$watch(attributes.requiredIf, function() { + ngModel.$validate(); + }); + } + } + }; + }) + + .directive('geoPoint', function() { + return { + require: '?ngModel', + link: function(scope, element, attributes, ngModel) { + if (ngModel) { + ngModel.$validators.geoPoint = function(value) { + return ngModel.$isEmpty(value) || (angular.isDefined(value.lat) && angular.isDefined(value.lon)); }; } } diff --git a/www/plugins/es/css/style.css b/www/plugins/es/css/style.css index 7991c6df30ed32a01b69d61a5ba4cd537a866179..f3ae8a68123e830755e2746c2a560b38ea456573 100644 --- a/www/plugins/es/css/style.css +++ b/www/plugins/es/css/style.css @@ -30,7 +30,7 @@ .row-record { border-bottom: solid 1px #ccc !important; padding: 0 !important; - height: 100px !important; + height: 84px !important; overflow: hidden; } diff --git a/www/plugins/es/i18n/locale-en-GB.json b/www/plugins/es/i18n/locale-en-GB.json index acbf0184e8e21f9895aab8f52b96a2190ab846c9..e8096bb488519fec2769cb1bee74a09dc293339e 100644 --- a/www/plugins/es/i18n/locale-en-GB.json +++ b/www/plugins/es/i18n/locale-en-GB.json @@ -284,7 +284,7 @@ "BTN_ADD": "Create my profile", "BTN_EDIT": "Edit my profile", "BTN_GEOLOC_ADDRESS": "Find my address on the map", - "USE_GEO_POINT": "Appear on the members map?", + "USE_GEO_POINT": "Appear on {{'COMMON.APP_NAME'|translate}} maps?", "LOADING_LOCATION": "Searching address...", "UID": "Pseudonym", "TITLE": "Lastname, FirstName", diff --git a/www/plugins/es/i18n/locale-en.json b/www/plugins/es/i18n/locale-en.json index acbf0184e8e21f9895aab8f52b96a2190ab846c9..e8096bb488519fec2769cb1bee74a09dc293339e 100644 --- a/www/plugins/es/i18n/locale-en.json +++ b/www/plugins/es/i18n/locale-en.json @@ -284,7 +284,7 @@ "BTN_ADD": "Create my profile", "BTN_EDIT": "Edit my profile", "BTN_GEOLOC_ADDRESS": "Find my address on the map", - "USE_GEO_POINT": "Appear on the members map?", + "USE_GEO_POINT": "Appear on {{'COMMON.APP_NAME'|translate}} maps?", "LOADING_LOCATION": "Searching address...", "UID": "Pseudonym", "TITLE": "Lastname, FirstName", diff --git a/www/plugins/es/i18n/locale-es-ES.json b/www/plugins/es/i18n/locale-es-ES.json index a8a00781f62bb571a811e173c90cd638bd9e94f0..0f426a80ab3ed9f8753932fc48958b551af14836 100644 --- a/www/plugins/es/i18n/locale-es-ES.json +++ b/www/plugins/es/i18n/locale-es-ES.json @@ -335,7 +335,7 @@ "BTN_ADD": "Ingresar mi perfil", "BTN_EDIT": "Editar mi perfil", "BTN_GEOLOC_ADDRESS": "Actualizar desde la dirección", - "USE_GEO_POINT": "Aparecer en la tarjeta de membresÃa?", + "USE_GEO_POINT": "Aparecer en la tarjeta {{'COMMON.APP_NAME'|translate}} ?", "LOADING_LOCATION": "Encontrar la dirección ...", "UID": "Seudónimo", "TITLE": "Nombre, Apellido", diff --git a/www/plugins/es/i18n/locale-fr-FR.json b/www/plugins/es/i18n/locale-fr-FR.json index 639b0dc9afa19cefc7f862494628d47add37fb9a..c147ec51ca257a8b0fe629e1411f6f7f3f5ad8a4 100644 --- a/www/plugins/es/i18n/locale-fr-FR.json +++ b/www/plugins/es/i18n/locale-fr-FR.json @@ -267,6 +267,8 @@ "SOCIAL_NETWORKS_DIVIDER": "Réseaux sociaux et site web", "TECHNICAL_DIVIDER": "Informations techniques", "BTN_NEW": "Créer une page", + "MY_PAGES": "Mes pages", + "NO_PAGE": "Aucune page", "SEARCH": { "TITLE": "Pages", "TITLE_SMALL_DEVICE": "Pages", @@ -313,6 +315,10 @@ "RECORD_PUBKEY": "Clé publique", "RECORD_PUBKEY_HELP": "Clé publique de réception des paiements" }, + "WALLET": { + "REGISTRY_DIVIDER": "Pages", + "REGISTRY_HELP": "Les pages référencent des activités acceptant la monnaie ou la favorisant : commerces, entreprises, association, institution." + }, "ERROR": { "LOAD_CATEGORY_FAILED": "Erreur de chargement de la liste des activités", "LOAD_RECORD_FAILED": "Erreur lors du chargement de la page", @@ -335,7 +341,7 @@ "BTN_ADD": "Saisir mon profil", "BTN_EDIT": "Editer mon profil", "BTN_GEOLOC_ADDRESS": "Trouver mon adresse sur la carte", - "USE_GEO_POINT": "Apparaître sur la carte des membres ?", + "USE_GEO_POINT": "Apparaître sur les cartes {{'COMMON.APP_NAME'|translate}} ?", "LOADING_LOCATION": "Recherche de l'adresse...", "UID": "Pseudonyme", "TITLE": "Nom, Prénom", diff --git a/www/plugins/es/js/controllers/common-controllers.js b/www/plugins/es/js/controllers/common-controllers.js index 12241291cfc78be29e56f65990c54ccb5d413e17..c69f2a24531c1145e282f84b8344b73ee6b1cb89 100644 --- a/www/plugins/es/js/controllers/common-controllers.js +++ b/www/plugins/es/js/controllers/common-controllers.js @@ -423,17 +423,20 @@ function ESAvatarModalController($scope) { } -function ESPositionEditController($scope, $timeout, csConfig, esGeo, ModalUtils) { +function ESPositionEditController($scope, csConfig, esGeo, ModalUtils) { 'ngInject'; // The default country used for address localisation var defaultCountry = csConfig.plugins && csConfig.plugins.es && csConfig.plugins.es.defaultCountry; var loadingCurrentPosition = false; - $scope.loadingPosition = false; + $scope.formPosition = { + loading: false, + enable: undefined + }; $scope.tryToLocalize = function() { - if ($scope.loadingPosition || loadingCurrentPosition) return; + if ($scope.formPosition.loading || loadingCurrentPosition) return; var searchText = $scope.getAddressToSearch(); @@ -448,11 +451,11 @@ function ESPositionEditController($scope, $timeout, csConfig, esGeo, ModalUtils) .catch(function(err) { console.error(err); // Silent loadingCurrentPosition = false; - $scope.form.geoPoint.$setValidity('required', false); + //$scope.form.geoPoint.$setValidity('required', false); }); } - $scope.loadingPosition = true; + $scope.formPosition.loading = true; return esGeo.point.searchByAddress(searchText) .then(function(res) { if (res && res.length == 1) { @@ -465,11 +468,11 @@ function ESPositionEditController($scope, $timeout, csConfig, esGeo, ModalUtils) }); }) .then(function() { - $scope.loadingPosition = false; + $scope.formPosition.loading = false; }) .catch(function(err) { console.error(err); // Silent - $scope.loadingPosition = false; + $scope.formPosition.loading = false; }); }; @@ -478,18 +481,17 @@ function ESPositionEditController($scope, $timeout, csConfig, esGeo, ModalUtils) if ($scope.form) { $scope.form.$valid = undefined; } - if ($scope.formData.enableGeoPoint) { + if ($scope.formPosition.enable) { return $scope.tryToLocalize(); } }; $scope.onUseGeopointChanged = function() { if ($scope.loading) return; - if (!$scope.formData.enableGeoPoint) { + if (!$scope.formPosition.enable) { if ($scope.formData.geoPoint) { - $scope.formData.geoPoint.lat = null; - $scope.formData.geoPoint.lon = null; - $scope.form.geoPoint.$setValidity('required', true); + $scope.formData.geoPoint = null; + //$scope.form.geoPoint.$setValidity('required', true); $scope.dirty = true; } } @@ -500,7 +502,7 @@ function ESPositionEditController($scope, $timeout, csConfig, esGeo, ModalUtils) $scope.onGeopointChanged = function() { if ($scope.loading) { - $scope.formData.enableGeoPoint = $scope.formData.geoPoint && !!$scope.formData.geoPoint.lat && !!$scope.formData.geoPoint.lon; + $scope.formPosition.enable = $scope.formData.geoPoint && !!$scope.formData.geoPoint.lat && !!$scope.formData.geoPoint.lon; } }; $scope.$watch('formData.geoPoint', $scope.onGeopointChanged); @@ -514,10 +516,7 @@ function ESPositionEditController($scope, $timeout, csConfig, esGeo, ModalUtils) $scope.updateGeoPoint = function(res) { // user cancel if (!res || !res.lat || !res.lon) { - // Force use GeoPoint as invalid (if not already a position) - if ($scope.formData.enableGeoPoint && (!$scope.formData.geoPoint || !$scope.formData.geoPoint.lat)) { - $scope.form.geoPoint.$setValidity('required', false); - } + // nothing to do return; } @@ -525,7 +524,6 @@ function ESPositionEditController($scope, $timeout, csConfig, esGeo, ModalUtils) $scope.formData.geoPoint = $scope.formData.geoPoint || {}; $scope.formData.geoPoint.lat = parseFloat(res.lat); $scope.formData.geoPoint.lon = parseFloat(res.lon); - $scope.form.geoPoint.$setValidity('required', true); if (res.address && res.address.city) { var cityParts = [res.address.city]; diff --git a/www/plugins/es/js/controllers/invitation-controllers.js b/www/plugins/es/js/controllers/invitation-controllers.js index fc4c8ec4d9d0ea2874988ddbfa8f40e33643171b..a86470ffd2052a75e0afa0327d930ff87aac1b33 100644 --- a/www/plugins/es/js/controllers/invitation-controllers.js +++ b/www/plugins/es/js/controllers/invitation-controllers.js @@ -194,12 +194,7 @@ function InvitationsController($scope, $q, $ionicPopover, $state, $timeout, UIUt $scope.showNewInvitationModal = function() { $scope.hideActionsPopover(); - // Not allow for non-member - issue #561 - if (!csWallet.data.isMember) { - return UIUtils.alert.error('ERROR.ONLY_MEMBER_CAN_EXECUTE_THIS_ACTION'); - } - - esModals.showNewInvitation({}); + return esModals.showNewInvitation({}); }; /* -- Popover -- */ diff --git a/www/plugins/es/js/controllers/profile-controllers.js b/www/plugins/es/js/controllers/profile-controllers.js index 156960c22e7ba8097734a3b2a3bdc3670fc3a50d..7ca440f35f4d3aff9e121bb67e20e82e1b2e3f6f 100644 --- a/www/plugins/es/js/controllers/profile-controllers.js +++ b/www/plugins/es/js/controllers/profile-controllers.js @@ -13,7 +13,8 @@ angular.module('cesium.es.profile.controllers', ['cesium.es.services']) }, cache: false, data: { - auth: true + //auth: true + login: true } }); @@ -35,7 +36,7 @@ function ESViewEditProfileController($scope, $rootScope, $q, $timeout, $state, $ title: null, description: null, socials: [], - geoPoint: {} + geoPoint: null }; $scope.loading = true; $scope.dirty = false; @@ -143,7 +144,6 @@ function ESViewEditProfileController($scope, $rootScope, $q, $timeout, $state, $ if (profile.avatar) { $scope.avatarStyle={'background-image':'url("'+$scope.avatar.src+'")'}; } - $scope.formData.geoPoint = $scope.formData.geoPoint || {}; $scope.motion.show(); UIUtils.loading.hide(); @@ -161,19 +161,17 @@ function ESViewEditProfileController($scope, $rootScope, $q, $timeout, $state, $ $scope.$watch('formData', $scope.onFormDataChanged, true); $scope.save = function(silent, hasWaitDebounce) { - if(!$scope.form.$valid || !$rootScope.walletData || $scope.saving) { + if($scope.form.$invalid || !$rootScope.walletData || ($scope.saving && !hasWaitDebounce)) { return $q.reject(); } if (!hasWaitDebounce) { - console.debug('[ES] [profile] Waiting debounce end, before saving...'); + $scope.saving = true; return $timeout(function() { return $scope.save(silent, true); }, 650); } - - $scope.saving = true; console.debug('[ES] [profile] Saving user profile...'); // removeIf(no-device) @@ -229,12 +227,14 @@ function ESViewEditProfileController($scope, $rootScope, $q, $timeout, $state, $ if (formData.position) { formData.position = null; } + + // Make sure to convert lat/lon to float if (formData.geoPoint && formData.geoPoint.lat && formData.geoPoint.lon) { formData.geoPoint.lat = parseFloat(formData.geoPoint.lat); formData.geoPoint.lon = parseFloat(formData.geoPoint.lon); } else{ - formData.geoPoint = null; + formData.geoPoint = null; // force to null, need by ES update request } if (!$scope.existing) { diff --git a/www/plugins/es/js/controllers/registry-controllers.js b/www/plugins/es/js/controllers/registry-controllers.js index 55443387dd1fb5b801aae87d6523fba3777e84b4..ac7bf89494a25ee04282b8e7f763a85dd8b9d7bf 100644 --- a/www/plugins/es/js/controllers/registry-controllers.js +++ b/www/plugins/es/js/controllers/registry-controllers.js @@ -28,6 +28,20 @@ angular.module('cesium.es.registry.controllers', ['cesium.es.services', 'cesium. } }) + .state('app.wallet_pages', { + url: "/wallet/pages?refresh", + views: { + 'menuContent': { + templateUrl: "plugins/es/templates/registry/view_wallet_pages.html", + controller: 'ESWalletPagesCtrl' + } + }, + data: { + login: true, + minData: true + } + }) + .state('app.view_page', { url: "/page/view/:id/:title?refresh", views: { @@ -82,13 +96,16 @@ angular.module('cesium.es.registry.controllers', ['cesium.es.services', 'cesium. .controller('ESRegistryLookupCtrl', ESRegistryLookupController) + .controller('ESWalletPagesCtrl', ESWalletPagesController) + .controller('ESRegistryRecordViewCtrl', ESRegistryRecordViewController) .controller('ESRegistryRecordEditCtrl', ESRegistryRecordEditController) ; -function ESRegistryLookupController($scope, $state, $focus, $timeout, esRegistry, UIUtils, ModalUtils, $filter, BMA) { +function ESRegistryLookupController($scope, $focus, $timeout, $filter, + UIUtils, ModalUtils, BMA, esModals, esRegistry) { 'ngInject'; var defaultSearchLimit = 10; @@ -103,8 +120,9 @@ function ESRegistryLookupController($scope, $state, $focus, $timeout, esRegistry location: null, options: null }; + $scope.searchTextId = 'registrySearchText'; - $scope.$on('$ionicView.enter', function(e, state) { + $scope.enter = function(e, state) { if (!$scope.entered || !$scope.search.results || $scope.search.results.length === 0) { var hasOptions = false; var runSearch = false; @@ -122,7 +140,9 @@ function ESRegistryLookupController($scope, $state, $focus, $timeout, esRegistry } // removeIf(device) // Focus on search text (only if NOT device, to avoid keyboard opening) - $focus('registrySearchText'); + if ($scope.searchTextId) { + $focus($scope.searchTextId); + } // endRemoveIf(device) $scope.entered = true; @@ -162,6 +182,9 @@ function ESRegistryLookupController($scope, $state, $focus, $timeout, esRegistry } $scope.showFab('fab-add-registry-record'); + }; + $scope.$on('$ionicView.enter', function(e, state) { + return $scope.enter(e, state); // can be override by sub controller }); $scope.doSearch = function(from) { @@ -323,6 +346,7 @@ function ESRegistryLookupController($scope, $state, $focus, $timeout, esRegistry }; /* -- modals -- */ + $scope.showRecordTypeModal = function() { ModalUtils.show('plugins/es/templates/registry/modal_record_type.html') .then(function(type){ @@ -349,18 +373,8 @@ function ESRegistryLookupController($scope, $state, $focus, $timeout, esRegistry }); }; - $scope.showNewRecordModal = function() { - $scope.loadWallet({minData: true}) - .then(function(walletData) { - UIUtils.loading.hide(); - $scope.walletData = walletData; - ModalUtils.show('plugins/es/templates/registry/modal_record_type.html') - .then(function(type){ - if (type) { - $state.go('app.registry_add_record', {type: type}); - } - }); - }); + $scope.showNewPageModal = function() { + return esModals.showNewPage(); }; // TODO: remove auto add account when done @@ -371,6 +385,35 @@ function ESRegistryLookupController($scope, $state, $focus, $timeout, esRegistry */ } + +function ESWalletPagesController($scope, $controller, $timeout, UIUtils, csWallet) { + 'ngInject'; + + // Initialize the super class and extend it. + angular.extend(this, $controller('ESRegistryLookupCtrl', {$scope: $scope})); + + $scope.searchTextId = undefined; // avoid focus + + var enter = $scope.enter; + $scope.enter = function(e, state) { + if (!$scope.entered) { + return csWallet.login({minData: true}) + .then(function(walletData) { + UIUtils.loading.hide(); + $scope.search.text = walletData.pubkey; + return enter(e, state); + }); + } + else { + // Asking refresh + if (state.stateParams && state.stateParams.refresh) { + return $timeout($scope.doSearch, 500 /*waiting for propagation, if deletion*/); + } + } + }; +} + + function ESRegistryRecordViewController($scope, $state, $q, $timeout, $ionicPopover, $ionicHistory, $translate, $anchorScroll, csConfig, csWallet, esRegistry, UIUtils, esHttp) { @@ -489,10 +532,13 @@ function ESRegistryRecordViewController($scope, $state, $q, $timeout, $ionicPopo if (confirm) { esRegistry.record.remove($scope.id) .then(function () { + if (csWallet.data.pages && csWallet.data.pages.count) { + csWallet.data.pages.count--; + } $ionicHistory.nextViewOptions({ historyRoot: true }); - $state.go('app.registry_lookup'); + $state.go('app.wallet_pages', {refresh: true}); UIUtils.toast.show(translations['REGISTRY.INFO.RECORD_REMOVED']); }) .catch(UIUtils.onError('REGISTRY.ERROR.REMOVE_RECORD_FAILED')); @@ -549,7 +595,7 @@ function ESRegistryRecordViewController($scope, $state, $q, $timeout, $ionicPopo } function ESRegistryRecordEditController($scope, $timeout, $state, $q, $ionicHistory, $focus, $translate, $controller, - Device, UIUtils, ModalUtils, esHttp, esRegistry) { + Device, UIUtils, ModalUtils, csWallet, esHttp, esRegistry) { 'ngInject'; // Initialize the super class and extend it. angular.extend(this, $controller('ESPositionEditCtrl', {$scope: $scope})); @@ -782,7 +828,7 @@ function ESRegistryRecordEditController($scope, $timeout, $state, $q, $ionicHis // Avatar if ($scope.avatar && $scope.avatar.src) { - return UIUtils.image.resizeSrc($scope.avatar.src, true) // resize to thumbnail + return UIUtils.image.resizeSrc($scope.avatar.src, true) // resize to avatar .then(function(imageSrc) { json.avatar = esHttp.image.toAttachment({src: imageSrc}); return json; @@ -809,6 +855,9 @@ function ESRegistryRecordEditController($scope, $timeout, $state, $q, $ionicHis .then(function(id) { console.info("[ES] [page] Record successfully saved."); + if (!$scope.id && csWallet.data.pages && csWallet.data.pages.count) { + csWallet.data.pages.count++; + } $scope.id = $scope.id || id; $scope.saving = false; $scope.dirty = false; diff --git a/www/plugins/es/js/controllers/wallet-controllers.js b/www/plugins/es/js/controllers/wallet-controllers.js index 2fc4ca2b4ad11547bea1c8acf78046e4f462f5b5..6f1693c3bcc9d969c15f25fe314e592a02944dfe 100644 --- a/www/plugins/es/js/controllers/wallet-controllers.js +++ b/www/plugins/es/js/controllers/wallet-controllers.js @@ -9,7 +9,7 @@ angular.module('cesium.es.wallet.controllers', ['cesium.es.services']) points: { 'after-general': { templateUrl: "plugins/es/templates/wallet/view_wallet_extend.html", - controller: 'ESWotIdentityViewCtrl' + controller: 'ESWalletCtrl' } } }) @@ -18,5 +18,21 @@ angular.module('cesium.es.wallet.controllers', ['cesium.es.services']) }) + + .controller('ESWalletCtrl', ESWalletController) + ; +function ESWalletController($scope, $controller, esModals) { + 'ngInject'; + + // Initialize the super class and extend it. + angular.extend(this, $controller('ESWotIdentityViewCtrl', {$scope: $scope})); + + /* -- modals -- */ + + $scope.showNewPageModal = function() { + return esModals.showNewPage(); + }; +} + diff --git a/www/plugins/es/js/services/http-services.js b/www/plugins/es/js/services/http-services.js index 74654c4123f70cd1bff4c9da595db79690371494..4a13997488e8e46dc2824c6f714b7d62a8a2132e 100644 --- a/www/plugins/es/js/services/http-services.js +++ b/www/plugins/es/js/services/http-services.js @@ -253,8 +253,7 @@ angular.module('cesium.es.http.services', ['ngResource', 'ngApi', 'cesium.servic var now = that.date.now(); record.time = (!record.time || record.time < now) ? now : (record.time+1); - var obj = {}; - angular.copy(record, obj); + var obj = angular.copy(record); delete obj.signature; delete obj.hash; obj.issuer = walletData.pubkey; @@ -267,16 +266,16 @@ angular.module('cesium.es.http.services', ['ngResource', 'ngApi', 'cesium.servic fillRecordTags(obj, options.tagFields); } + console.debug("Will send obj: ", obj); var str = JSON.stringify(obj); return CryptoUtils.util.hash(str) .then(function(hash) { return CryptoUtils.sign(hash, walletData.keypair) .then(function(signature) { - obj.hash = hash; - obj.signature = signature; - str = '{"hash":"' + hash + '","signature":"' + signature + '",' - + str.substring(1); + // Prepend hash+signature + str = '{"hash":"{0}","signature":"{1}",'.format(hash, signature) + str.substring(1); + // Send data return postRequest(str, params) .then(function (id){ return id; @@ -305,9 +304,10 @@ angular.module('cesium.es.http.services', ['ngResource', 'ngApi', 'cesium.servic .then(function (hash) { return CryptoUtils.sign(hash, walletData.keypair) .then(function (signature) { - obj.hash = hash; - obj.signature = signature; - return that.post('/history/delete')(obj) + // Prepend hash+signature + str = '{"hash":"{0}","signature":"{1}",'.format(hash, signature) + str.substring(1); + // Send data + return that.post('/history/delete')(str) .then(function (id) { return id; }); diff --git a/www/plugins/es/js/services/modal-services.js b/www/plugins/es/js/services/modal-services.js index 68057cdb378796b35cb77baefd2e7b03d368d3cc..440fd56e0701a17b8452c2b7d9a5652636568940 100644 --- a/www/plugins/es/js/services/modal-services.js +++ b/www/plugins/es/js/services/modal-services.js @@ -1,6 +1,6 @@ angular.module('cesium.es.modal.services', ['cesium.modal.services', 'cesium.es.message.services']) -.factory('esModals', function(ModalUtils, UIUtils) { +.factory('esModals', function($state, ModalUtils, UIUtils, csWallet) { 'ngInject'; function showMessageCompose(parameters) { @@ -38,14 +38,39 @@ angular.module('cesium.es.modal.services', ['cesium.modal.services', 'cesium.es. } function showNewInvitation(parameters) { - return ModalUtils.show('plugins/es/templates/invitation/modal_new_invitation.html', 'ESNewInvitationModalCtrl', - parameters); + return csWallet.auth({minData: true}) + .then(function(walletData) { + UIUtils.loading.hide(); + + // Not allow for non-member - issue #561 + if (!walletData.isMember) { + return UIUtils.alert.error('ERROR.ONLY_MEMBER_CAN_EXECUTE_THIS_ACTION'); + } + return ModalUtils.show('plugins/es/templates/invitation/modal_new_invitation.html', 'ESNewInvitationModalCtrl', + parameters); + }); + } + + function showNewPage() { + return csWallet.auth({minData: true}) + .then(function() { + UIUtils.loading.hide(); + + return ModalUtils.show('plugins/es/templates/registry/modal_record_type.html') + .then(function(type){ + if (type) { + $state.go('app.registry_add_record', {type: type}); + } + }); + }); + ; } return { showMessageCompose: showMessageCompose, showNotifications: showNotificationsPopover, - showNewInvitation: showNewInvitation + showNewInvitation: showNewInvitation, + showNewPage: showNewPage }; }); diff --git a/www/plugins/es/js/services/profile-services.js b/www/plugins/es/js/services/profile-services.js index c0114c87c0896888381318c914b3581994248bbe..2a96bb410799ef1f947bb89b7f1be73fb64e756e 100644 --- a/www/plugins/es/js/services/profile-services.js +++ b/www/plugins/es/js/services/profile-services.js @@ -158,8 +158,8 @@ angular.module('cesium.es.profile.services', ['cesium.services', 'cesium.es.http }; // TODO: uncomment - //var mixedSearch = text && esSettings.wot.isMixedSearchEnable(); - var mixedSearch = false; + var mixedSearch = text && esSettings.wot.isMixedSearchEnable(); + //var mixedSearch = false; if (mixedSearch) { request._source = request._source.concat(["description", "city", "creationTime", "membersCount", "type"]); console.debug("[ES] [profile] Mixed search: enable"); @@ -259,8 +259,6 @@ angular.module('cesium.es.profile.services', ['cesium.services', 'cesium.es.http values=[value]; datas.push(value); } - - avatar = esHttp.image.fromHit(hit, 'avatar'); } // Page or group @@ -286,10 +284,10 @@ angular.module('cesium.es.profile.services', ['cesium.services', 'cesium.es.http }; values=[item]; datas.push(item); - avatarFieldName = 'thumbnail'; + avatarFieldName = 'avatar'; } - avatar = esHttp.image.fromHit(hit, avatarFieldName); + var avatar = esHttp.image.fromHit(hit, avatarFieldName); _.forEach(values, function(data) { data.avatar= avatar; _fillSearchResultFromHit(data, hit); diff --git a/www/plugins/es/js/services/registry-services.js b/www/plugins/es/js/services/registry-services.js index 630fe31f6d58fc8413538dce798cf845c8a11564..5c65d0ce09dcd1e046f65c2bd898009026999eb7 100644 --- a/www/plugins/es/js/services/registry-services.js +++ b/www/plugins/es/js/services/registry-services.js @@ -1,190 +1,267 @@ angular.module('cesium.es.registry.services', ['ngResource', 'cesium.services', 'cesium.es.http.services']) - -.factory('esRegistry', function($q, csSettings, esHttp, esComment, csWot) { +.config(function(PluginServiceProvider, csConfig) { 'ngInject'; - function EsRegistry() { + var enable = csConfig.plugins && csConfig.plugins.es; + if (enable) { + // Will force to load this service + PluginServiceProvider.registerEagerLoadingService('esRegistry'); + } + +}) - var - fields = { - commons: ["title", "description", "issuer", "time", "address", "city", "creationTime", "avatar._content_type", "picturesCount", "type", "category", "socials", "pubkey"] - }; - var - exports = { - _internal: {}, - }; +.factory('esRegistry', function($rootScope, $q, csPlatform, csSettings, csWallet, esHttp, esComment, csWot) { + 'ngInject'; - exports._internal.getCategories = esHttp.get('/page/category/_search?sort=order&from=0&size=1000&_source=name,parent'); + var + fields = { + commons: ["title", "description", "issuer", "time", "address", "city", "creationTime", "avatar._content_type", "picturesCount", "type", "category", "socials", "pubkey"] + }, + that = this, + listeners; - 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.getCategories() - .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; - }); + that.raw = { + count: esHttp.get('/page/record/_search?size=0&q=issuer::pubkey'), + searchText: esHttp.get('/page/record/_search?q=:search'), + search: esHttp.post('/page/record/_search'), + get: esHttp.get('/page/record/:id'), + getCommons: esHttp.get('/page/record/:id?_source=' + fields.commons.join(',')), + category: { + get: esHttp.get('/page/category/:id'), + all: esHttp.get('/page/category/_search?sort=order&from=0&size=1000&_source=name,parent') } + }; - exports._internal.getCategory = esHttp.get('/page/category/:id'); + function onWalletReset(data) { + data.pages = null; + } - function getCategory(params) { - return exports._internal.getCategory(params) - .then(function(hit) { - var res = hit._source; - res.id = hit._id; - return res; - }); + function onWalletLoad(data, deferred) { + deferred = deferred || $q.defer(); + if (!data || !data.pubkey || !data.keypair) { + deferred.resolve(); + return deferred.promise; } - function readRecordFromHit(hit, categories) { - if (!hit) return; - var record = hit._source; - if (record.category && record.category.id) { - record.category = categories[record.category.id]; - } - if (hit.highlight) { - if (hit.highlight.title) { - record.title = hit.highlight.title[0]; - } - if (hit.highlight.description) { - record.description = hit.highlight.description[0]; + console.debug('[ES] [registry] Loading pages count...'); + + // Load subscriptions count + that.raw.count({pubkey: data.pubkey}) + .then(function(res) { + data.pages = data.pages || {}; + data.pages.count = res && res.hits && res.hits.total; + console.debug('[ES] [registry] Loaded pages count (' + data.pages.count + ')'); + deferred.resolve(data); + }) + .catch(function(err) { + console.error('[ES] [registry] Error while counting page: ' + (err.message ? err.message : err)); + deferred.resolve(data); + }); + + return deferred.promise; + } + + function getCategories() { + if (that.raw.categories && that.raw.categories.length) { + var deferred = $q.defer(); + deferred.resolve(that.raw.categories); + return deferred.promise; + } + return that.raw.category.all() + .then(function(res) { + if (res.hits.total === 0) { + that.raw.categories = []; } - if (hit.highlight.location) { - record.location = hit.highlight.location[0]; + 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; + }); + that.raw.categories = categories; } - } + return that.raw.categories; + }); + } - // thumbnail - record.avatar = esHttp.image.fromHit(hit, 'avatar'); + function getCategory(params) { + return that.raw.category.get(params) + .then(function(hit) { + var res = hit._source; + res.id = hit._id; + return res; + }); + } - // 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)); - }, []); + function readRecordFromHit(hit, categories) { + if (!hit) return; + var record = hit._source; + if (record.category && record.category.id) { + record.category = categories[record.category.id]; + } + 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]; } - - return record; } - exports._internal.searchText = esHttp.get('/page/record/_search?q=:search'); - exports._internal.search = esHttp.post('/page/record/_search'); - exports._internal.get = esHttp.get('/page/record/:id'); - exports._internal.getCommons = esHttp.get('/page/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 : {} - } - }; - - return $q.all([ - // load categories - exports.category.all(), - // Do search - exports._internal.search(request) - ]) - .then(function(res) { - var categories = res[0]; - res = res[1]; - - if (!res || !res.hits || !res.hits.total) { - return []; - } - return res.hits.hits.reduce(function(result, hit) { - var record = readRecordFromHit(hit, categories); - record.id = hit._id; - return result.concat(record); - }, []); - }); + // avatar + record.avatar = esHttp.image.fromHit(hit, 'avatar'); + + // 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)); + }, []); } - function loadData(id, options) { - options = options || {}; - options.raw = angular.isDefined(options.raw) ? options.raw : false; - options.fecthPictures = angular.isDefined(options.fetchPictures) ? options.fetchPictures : options.raw; + return record; + } + - return $q.all([ + 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 : {} + } + }; + return $q.all([ // load categories - exports.category.all(), - - // Do get source - options.fecthPictures ? - exports._internal.get({id: id}) : - exports._internal.getCommons({id: id}) + that.raw.category.all(), + // Do search + that.raw.search(request) ]) .then(function(res) { var categories = res[0]; - var hit = res[1]; - var record = readRecordFromHit(hit, categories); + res = res[1]; - // parse description as Html - if (!options.raw) { - record.description = esHttp.util.parseAsHtml(record.description); + if (!res || !res.hits || !res.hits.total) { + return []; } - - // Load issuer (avatar, name, uid, etc.) - return csWot.extend({pubkey: record.issuer}) - .then(function(issuer) { - return { - id: hit._id, - issuer: issuer, - record: record - }; - }); + return res.hits.hits.reduce(function(result, hit) { + var record = readRecordFromHit(hit, categories); + record.id = hit._id; + return result.concat(record); + }, []); }); - } + } + + function loadData(id, options) { + options = options || {}; + options.raw = angular.isDefined(options.raw) ? options.raw : false; + options.fecthPictures = angular.isDefined(options.fetchPictures) ? options.fetchPictures : options.raw; + + return $q.all([ + + // load categories + that.raw.category.all(), - exports.category = { - all: getCategories, - get: getCategory - }; - exports.record = { - search: search, - load: loadData, - add: esHttp.record.post('/page/record', {tagFields: ['title', 'description'], creationTime: true}), - update: esHttp.record.post('/page/record/:id/_update', {tagFields: ['title', 'description']}), - remove: esHttp.record.remove('page', 'record'), - fields: { - commons: fields.commons - }, - picture: { - all: esHttp.get('/page/record/:id?_source=pictures') - }, - comment: esComment.instance('page') - }; - exports.currency = { - all: esHttp.get('/currency/record/_search?_source=currencyName,peers.host,peers.port'), - get: esHttp.get('/currency/record/:id/_source') - }; - return exports; + // Do get source + options.fecthPictures ? + that.raw.get({id: id}) : + that.raw.getCommons({id: id}) + ]) + .then(function(res) { + var categories = res[0]; + var hit = res[1]; + var record = readRecordFromHit(hit, categories); + + // parse description as Html + if (!options.raw) { + record.description = esHttp.util.parseAsHtml(record.description); + } + + // Load issuer (avatar, name, uid, etc.) + return csWot.extend({pubkey: record.issuer}) + .then(function(issuer) { + return { + id: hit._id, + issuer: issuer, + record: record + }; + }); + }); + } + + function removeListeners() { + _.forEach(listeners, function(remove){ + remove(); + }); + listeners = []; + } + + function addListeners() { + // Extend + listeners = [ + csWallet.api.data.on.load($rootScope, onWalletLoad, this), + csWallet.api.data.on.init($rootScope, onWalletReset, this), + csWallet.api.data.on.reset($rootScope, onWalletReset, this) + ]; } - return EsRegistry(); + function refreshState() { + var enable = esHttp.alive; + if (!enable && listeners && listeners.length > 0) { + console.debug("[ES] [subscription] Disable"); + removeListeners(); + if (csWallet.isLogin()) { + return onWalletReset(csWallet.data); + } + } + else if (enable && (!listeners || listeners.length === 0)) { + console.debug("[ES] [subscription] Enable"); + addListeners(); + if (csWallet.isLogin()) { + return onWalletLoad(csWallet.data); + } + } + } + + // Default actions + csPlatform.ready().then(function() { + esHttp.api.node.on.start($rootScope, refreshState, this); + esHttp.api.node.on.stop($rootScope, refreshState, this); + return refreshState(); + }); + + that.category = { + all: getCategories, + get: getCategory + }; + that.record = { + search: search, + load: loadData, + add: esHttp.record.post('/page/record', {tagFields: ['title', 'description'], creationTime: true}), + update: esHttp.record.post('/page/record/:id/_update', {tagFields: ['title', 'description']}), + remove: esHttp.record.remove('page', 'record'), + fields: { + commons: fields.commons + }, + picture: { + all: esHttp.get('/page/record/:id?_source=pictures') + }, + comment: esComment.instance('page') + }; + that.currency = { + all: esHttp.get('/currency/record/_search?_source=currencyName,peers.host,peers.port'), + get: esHttp.get('/currency/record/:id/_source') + }; + return that; }) ; diff --git a/www/plugins/es/js/services/subscription-services.js b/www/plugins/es/js/services/subscription-services.js index 6cc7699062d0f6eb2241993be65e5f7a40db1b36..b18115b36d7e6203a646d4276bab85021388e709 100644 --- a/www/plugins/es/js/services/subscription-services.js +++ b/www/plugins/es/js/services/subscription-services.js @@ -34,7 +34,7 @@ angular.module('cesium.es.subscription.services', ['cesium.platform', 'cesium.es data.subscriptions = null; } - function onWalletLogin(data, deferred) { + function onWalletLoad(data, deferred) { deferred = deferred || $q.defer(); if (!data || !data.pubkey || !data.keypair) { deferred.resolve(); @@ -52,7 +52,7 @@ angular.module('cesium.es.subscription.services', ['cesium.platform', 'cesium.es deferred.resolve(data); }) .catch(function(err) { - console.error('Error while counting subscription: ' + (err.message ? err.message : err)); + console.error('[ES] [subscription] Error while counting subscription: ' + (err.message ? err.message : err)); deferred.resolve(data); }); @@ -192,7 +192,7 @@ angular.module('cesium.es.subscription.services', ['cesium.platform', 'cesium.es function addListeners() { // Extend listeners = [ - csWallet.api.data.on.login($rootScope, onWalletLogin, this), + csWallet.api.data.on.load($rootScope, onWalletLoad, this), csWallet.api.data.on.init($rootScope, onWalletReset, this), csWallet.api.data.on.reset($rootScope, onWalletReset, this) ]; @@ -211,7 +211,7 @@ angular.module('cesium.es.subscription.services', ['cesium.platform', 'cesium.es console.debug("[ES] [subscription] Enable"); addListeners(); if (csWallet.isLogin()) { - return onWalletLogin(csWallet.data); + return onWalletLoad(csWallet.data); } } } diff --git a/www/plugins/es/templates/common/edit_position.html b/www/plugins/es/templates/common/edit_position.html index 1d12151d26fc481dd82cc37b5232961badc78f60..50598dc78b6873d36bfcc2d82a0f1fd78b369c13 100644 --- a/www/plugins/es/templates/common/edit_position.html +++ b/www/plugins/es/templates/common/edit_position.html @@ -22,7 +22,8 @@ <input type="hidden" name="geoPoint" ng-model="formData.geoPoint" - geo-point-required> + required-if="formPosition.enable" + geo-point> <div class="form-errors" ng-show="form.$submitted && form.geoPoint.$error" ng-messages="form.geoPoint.$error"> @@ -30,6 +31,10 @@ <span translate="COMMON.ERROR.REQUIRED_FOR_LOCATION" ng-if="!formData.city"></span> <span translate="COMMON.ERROR.INVALID_FOR_LOCATION" ng-if="formData.city"></span> </div> + <div class="form-error" ng-message="geoPoint"> + <span translate="COMMON.ERROR.REQUIRED_FOR_LOCATION" ng-if="!formData.city"></span> + <span translate="COMMON.ERROR.INVALID_FOR_LOCATION" ng-if="formData.city"></span> + </div> </div> @@ -39,12 +44,12 @@ <div class="col no-padding"> <!-- appear on map ? --> - <ion-checkbox ng-model="formData.enableGeoPoint" + <ion-checkbox ng-model="formPosition.enable" ng-change="onUseGeopointChanged()" class="item item-border-large done in"> <div class="item-content"> <span translate>PROFILE.USE_GEO_POINT</span> - <h4 class="gray" ng-if="loadingPosition"> + <h4 class="gray" ng-if="formPosition.loading"> <ion-spinner class="icon ion-spinner-small" icon="android"></ion-spinner> {{'PROFILE.LOADING_LOCATION'|translate}} </h4> @@ -57,7 +62,7 @@ <a class="button button-stable button-small-padding" title="{{'PROFILE.BTN_GEOLOC_ADDRESS'|translate}}" - ng-disabled="!formData.enableGeoPoint" + ng-disabled="!formPosition.enable" ng-click="openSearchLocationModal()"> <i class=" icon ion-home" style="left: 15px;"></i> <b class=" icon-secondary ion-search" style="top: -9px; left:32px; font-size: 18px;"></b> diff --git a/www/plugins/es/templates/menu_extend.html b/www/plugins/es/templates/menu_extend.html index fa320701c2df98ccc15418873cc7296858c17c07..68fc8e0a1f224db029e024b4aa1a6e7a00cafff7 100644 --- a/www/plugins/es/templates/menu_extend.html +++ b/www/plugins/es/templates/menu_extend.html @@ -6,7 +6,7 @@ <!-- invitation event --> <button class="button button-clear icon ion-person-stalker" - ng-if="login && $root.walletData.isMember" + ng-if="login" active-link="gray" active-link-path-prefix="#/app/invitations" ng-click="showInvitationsPopover($event)"> diff --git a/www/plugins/es/templates/registry/lookup.html b/www/plugins/es/templates/registry/lookup.html index e445676aca8df2b002f1969f8681f15537d4b796..4523c84a9bb34808864338aa97d1f9148021ff28 100644 --- a/www/plugins/es/templates/registry/lookup.html +++ b/www/plugins/es/templates/registry/lookup.html @@ -76,6 +76,6 @@ <button id="fab-add-registry-record" class="button button-fab button-fab-bottom-right button-assertive icon ion-plus hidden-md hidden-lg spin" - ng-click="showNewRecordModal()"> + ng-click="showNewPageModal()"> </button> </ion-view> diff --git a/www/plugins/es/templates/registry/lookup_item.html b/www/plugins/es/templates/registry/lookup_item.html index bf34a2539bb2304881b7dc4c0e5e7c8f2c380d8c..736ff4afad4f4c8568bfc814698d38acef0ec7b8 100644 --- a/www/plugins/es/templates/registry/lookup_item.html +++ b/www/plugins/es/templates/registry/lookup_item.html @@ -1,8 +1,8 @@ <div class="row row-record "> - <div class="col item-text-wrap item-thumbnail-left-padding" - ng-class="{'item-thumbnail-left': item.thumbnail || item.type}"> - <i class="item-image icon cion-page-{{::item.type}}" ng-if="!item.thumbnail"></i> - <i class="item-image avatar" style="background-image: url({{::item.thumbnail.src}})" ng-if="item.thumbnail"></i> + <div class="col item-text-wrap item-avatar-left-padding" + ng-class="{'item-avatar': item.avatar || item.type}"> + <i class="item-image icon cion-page-{{::item.type}}" ng-if="!item.avatar"></i> + <i class="item-image avatar" style="background-image: url({{::item.avatar.src}})" ng-if="item.avatar"></i> <h2 ng-bind-html="item.title"></h2> <h4 class="gray"> <i class="icon ion-location" ng-if="item.city"></i> diff --git a/www/plugins/es/templates/registry/lookup_lg.html b/www/plugins/es/templates/registry/lookup_lg.html index 0d1e8f757c9d1b47530c235df2e002bb527b364b..54c2676849bd5680fa22c7b68fbfd0126d745f20 100644 --- a/www/plugins/es/templates/registry/lookup_lg.html +++ b/www/plugins/es/templates/registry/lookup_lg.html @@ -7,7 +7,7 @@ <ion-content class="lookupForm padding no-padding-xs"> <button class="button button-small button-positive button-clear ink pull-right padding-right hidden-sm hidden-xs" - ng-click="showNewRecordModal()"> + ng-click="showNewPageModal()"> <i class="icon ion-plus"></i> {{'REGISTRY.BTN_NEW' | translate}} </button> @@ -83,6 +83,6 @@ <button id="fab-add-registry-record" class="button button-fab button-fab-bottom-right button-assertive icon ion-plus hidden-md hidden-lg spin" - ng-click="showNewRecordModal()"> + ng-click="showNewPageModal()"> </button> </ion-view> diff --git a/www/plugins/es/templates/registry/view_wallet_pages.html b/www/plugins/es/templates/registry/view_wallet_pages.html new file mode 100644 index 0000000000000000000000000000000000000000..b726ecdc163ce406722c372cf5926d3b888d379b --- /dev/null +++ b/www/plugins/es/templates/registry/view_wallet_pages.html @@ -0,0 +1,50 @@ +<ion-view left-buttons="leftButtons" + class="view-notification"> + <ion-nav-title> + {{'REGISTRY.MY_PAGES' | translate}} + </ion-nav-title> + + <ion-nav-buttons side="secondary"> + + <button class="button button-icon button-clear icon ion-loop visible-xs visible-sm" ng-click="load()"> + </button> + + <button class="button button-icon button-clear visible-xs visible-sm" + ng-click="showActionsPopover($event)"> + <i class="icon ion-android-more-vertical"></i> + </button> + </ion-nav-buttons> + + <ion-content class="padding no-padding-xs" scroll="true"> + + <!-- Buttons bar --> + <div class="hidden-xs hidden-sm padding text-center"> + + <button class="button button-raised icon-left ion-plus ink" + ng-click="showNewPageModal()"> + {{'REGISTRY.BTN_NEW' | translate}} + </button> + </div> + + <div class="center padding" ng-if="search.loading"> + <ion-spinner icon="android"></ion-spinner> + </div> + + <div class="center padding gray" ng-if="!search.loading && !search.results.length" translate> + REGISTRY.NO_PAGE + </div> + + <div class="list {{::motion.ionListClass}}"> + + <a ng-repeat="item in search.results" + class="item ink padding-xs" + ui-sref="app.view_page({id: item.id, title: item.urlTitle})"> + + <ng-include src="'plugins/es/templates/registry/lookup_item.html'"></ng-include> + </a> + + </div> + + </ion-content> + +</ion-view> diff --git a/www/plugins/es/templates/wallet/view_wallet_extend.html b/www/plugins/es/templates/wallet/view_wallet_extend.html index fe17b2cc875af1a10569307de652c68d06886936..4e47440583a354893ae8edb9982d7f26f53467ff 100644 --- a/www/plugins/es/templates/wallet/view_wallet_extend.html +++ b/www/plugins/es/templates/wallet/view_wallet_extend.html @@ -61,4 +61,42 @@ <i class="gray icon ion-ios-arrow-right"></i> </a> </div> + + <!-- page --> + <div class="item item-divider item-divider-top-border"> + <span> + {{'REGISTRY.WALLET.REGISTRY_DIVIDER' | translate}} + <i style="font-size: 12pt; cursor: pointer;" + ng-click="showPagesHelp=!showPagesHelp" + class="icon positive ion-ios-help-outline" + title="{{'REGISTRY.WALLET.REGISTRY_HELP' | translate}}"></i> + <span> + + <a class="badge button button-text button-small button-small-padding " + ng-if="!formData.pages.count" + ng-click="showNewPageModal()"> + <i class="icon ion-plus"></i> + <span translate>REGISTRY.BTN_NEW</span> + </a> + </div> + + <div class="item item-text-wrap positive item-small-height" ng-show="showPagesHelp"> + <small translate>REGISTRY.WALLET.REGISTRY_HELP</small> + </div> + + <div class="double-padding-x padding-bottom"> + + <div ng-if="!formData.pages.count" + class="item gray" translate>REGISTRY.NO_PAGE</div> + + <a class="item item-icon-left item-text-wrap item-icon-right ink" + ng-if="formData.pages.count" + ui-sref="app.wallet_pages"> + <i class="icon ion-social-buffer"></i> + <span translate>REGISTRY.MY_PAGES</span> + <span class="badge badge-positive">{{formData.pages.count}}</span> + + <i class="gray icon ion-ios-arrow-right"></i> + </a> + </div> </ng-if> diff --git a/www/plugins/es/templates/wot/lookup_item_page.html b/www/plugins/es/templates/wot/lookup_item_page.html index 6b1a069cd367d7eede68814243e160594a12a86a..32003884df5db66329f56bbc705ab55f78be8edb 100644 --- a/www/plugins/es/templates/wot/lookup_item_page.html +++ b/www/plugins/es/templates/wot/lookup_item_page.html @@ -1,4 +1,4 @@ -<i ng-if="::!item.avatar" class="item-image icon ion-person"></i> +<i ng-if="::!item.avatar" class="item-image icon cion-page-{{item.type}}"></i> <i ng-if="::item.avatar" class="item-image avatar" style="background-image: url({{::item.avatar.src}})"></i> <h2 ng-bind-html=":rebind:item.name"></h2> diff --git a/www/templates/wot/lookup_form.html b/www/templates/wot/lookup_form.html index 960dd2cb3849f0503af85a396714207d2b8f3f89..48245b4397b9b79473fd63ecc126bda95584612a 100644 --- a/www/templates/wot/lookup_form.html +++ b/www/templates/wot/lookup_form.html @@ -40,16 +40,18 @@ <div class="padding-top padding-xs" style="display: block; height: 60px;" ng-class="::{'hidden-xs': !showResultLabel}"> <div class="pull-left" ng-if="!search.loading && showResultLabel"> - <h4 ng-if="search.type=='newcomers'" translate> - WOT.LOOKUP.NEWCOMERS + <ng-if ng-if="search.type=='newcomers'"> + <h4 translate>WOT.LOOKUP.NEWCOMERS</h4> + <span class="gray no-padding" ng-if="search.total">{{'WOT.LOOKUP.NEWCOMERS_COUNT'|translate:{count: search.total} }}</span> + </ng-if> + <ng-if ng-if="search.type=='pending'"> + <h4 translate>WOT.LOOKUP.PENDING</h4> + <span class="gray no-padding" ng-if="search.total">{{'WOT.LOOKUP.PENDING_COUNT'|translate:{count: search.total} }}</span> + </ng-if> + <h4 ng-if="search.type=='text'"> + <span translate>COMMON.RESULTS_LIST</span> + <small class="gray" ng-if="search.total">({{search.total}})</small> </h4> - <h4 ng-if="search.type=='pending'" translate> - WOT.LOOKUP.PENDING - </h4> - <h4 ng-if="search.type=='text'" translate> - COMMON.RESULTS_LIST - </h4> - <h5 ng-if="search.total" class="dark">{{'COMMON.RESULTS_COUNT'|translate:{count: search.total} }}</h5> </div> <div class="pull-right hidden-xs hidden-sm">