diff --git a/www/js/controllers/wallet-controllers.js b/www/js/controllers/wallet-controllers.js index 95a270c5fed158b1acf98f27282699f3c9094d4b..af7df44701b6346cf8d6298e7803c00146729531 100644 --- a/www/js/controllers/wallet-controllers.js +++ b/www/js/controllers/wallet-controllers.js @@ -516,6 +516,12 @@ function WalletController($scope, $rootScope, $q, $ionicPopup, $timeout, $state, var title = $scope.formData.name || $scope.formData.uid || $scope.formData.pubkey; // Use shareBasePath (fix #530) or rootPath (fix #390) var url = (csConfig.shareBaseUrl || $rootScope.rootPath) + $state.href('app.wot_identity', {pubkey: $scope.formData.pubkey, uid: $scope.formData.name || $scope.formData.uid}); + + // Override default position, is small screen - fix #545 + if (UIUtils.screen.isSmall()) { + event = angular.element(document.querySelector('#wallet-share-anchor')) || event; + } + UIUtils.popover.share(event, { bindings: { url: url, diff --git a/www/js/controllers/wot-controllers.js b/www/js/controllers/wot-controllers.js index 70a09f523729bc41ab551823903f49394cc90e66..6b6e2080832b5cf9eea815fba1ff7fb63be805fe 100644 --- a/www/js/controllers/wot-controllers.js +++ b/www/js/controllers/wot-controllers.js @@ -864,6 +864,10 @@ function WotIdentityAbstractController($scope, $rootScope, $state, $translate, $ var title = $scope.formData.name || $scope.formData.uid || $scope.formData.pubkey; // Use shareBasePath (fix #530) or rootPath (fix #390) var url = (csConfig.shareBaseUrl || $rootScope.rootPath) + $state.href('app.wot_identity', {pubkey: $scope.formData.pubkey, uid: $scope.formData.uid}); + // Override default position, is small screen - fix #545 + if (UIUtils.screen.isSmall()) { + event = angular.element(document.querySelector('#wot-share-anchor-'+$scope.formData.pubkey)) || event; + } UIUtils.popover.share(event, { bindings: { url: url, diff --git a/www/plugins/es/i18n/locale-fr-FR.json b/www/plugins/es/i18n/locale-fr-FR.json index fce9f3149f85927d681a12d5dd2c6ebcef854a52..b45b197c02da2629eb910c2b269cb65a145ed564 100644 --- a/www/plugins/es/i18n/locale-fr-FR.json +++ b/www/plugins/es/i18n/locale-fr-FR.json @@ -230,6 +230,10 @@ "MANAGED": "Groupe administré" } }, + "VIEW": { + "POPOVER_SHARE_TITLE": "{{title}}", + "MENU_TITLE": "Options" + }, "EDIT": { "TITLE": "Groupe", "TITLE_NEW": "Nouveau groupe", diff --git a/www/plugins/es/js/controllers/group-controllers.js b/www/plugins/es/js/controllers/group-controllers.js index 4d7c05a52b543f8a1f25183c8b70e2e396ff6c03..ccad5315350a51208fa85506182c18e0f27cba32 100644 --- a/www/plugins/es/js/controllers/group-controllers.js +++ b/www/plugins/es/js/controllers/group-controllers.js @@ -178,7 +178,7 @@ function ESGroupListController($scope, UIUtils, $state, csWallet, esGroup, Modal } -function ESGroupViewController($scope, $state, UIUtils, esGroup, csWallet) { +function ESGroupViewController($scope, $state, $ionicPopover, UIUtils, csConfig, esGroup, csWallet) { 'ngInject'; $scope.formData = {}; @@ -229,6 +229,53 @@ function ESGroupViewController($scope, $state, UIUtils, esGroup, csWallet) { UIUtils.loading.show(); $state.go('app.edit_group', {id: $scope.id}); }; + + /* -- modals & popover -- */ + + $scope.showActionsPopover = function(event) { + if (!$scope.actionsPopover) { + $ionicPopover.fromTemplateUrl('plugins/es/templates/group/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; + // Use shareBasePath (fix #530) or rootPath (fix #390) + var url = (csConfig.shareBaseUrl || $rootScope.rootPath) + $state.href('app.view_group', {id: $scope.id}); + // Override default position, is small screen - fix #545 + if (UIUtils.screen.isSmall()) { + event = angular.element(document.querySelector('#group-share-anchor-'+$scope.id)) || event; + } + UIUtils.popover.share(event, { + bindings: { + url: url, + titleKey: 'GROUP.VIEW.POPOVER_SHARE_TITLE', + titleValues: {title: title}, + time: $scope.formData.time, + postMessage: title + } + }); + }; } function ESGroupEditController($scope, esGroup, UIUtils, $state, $q, Device, diff --git a/www/plugins/es/js/controllers/registry-controllers.js b/www/plugins/es/js/controllers/registry-controllers.js index b8be2f54753838218147e5807bfdf3417d3e499e..82f858b32cddfdbd775d32ec7754a49072810da9 100644 --- a/www/plugins/es/js/controllers/registry-controllers.js +++ b/www/plugins/es/js/controllers/registry-controllers.js @@ -525,6 +525,10 @@ function ESRegistryRecordViewController($scope, $state, $q, $timeout, $ionicPopo var title = $scope.formData.title; // Use shareBasePath (fix #530) or rootPath (fix #390) var url = (csConfig.shareBaseUrl || $rootScope.rootPath) + $state.href('app.registry_view_record', {title: title, id: $scope.id}); + // Override default position, is small screen - fix #545 + if (UIUtils.screen.isSmall()) { + event = angular.element(document.querySelector('#registry-share-anchor-'+$scope.id)) || event; + } UIUtils.popover.share(event, { bindings: { url: url, diff --git a/www/plugins/es/templates/group/view_popover_actions.html b/www/plugins/es/templates/group/view_popover_actions.html new file mode 100644 index 0000000000000000000000000000000000000000..060f0494dfffd18f30b1aeb356ecd705f587e114 --- /dev/null +++ b/www/plugins/es/templates/group/view_popover_actions.html @@ -0,0 +1,22 @@ +<ion-popover-view class="fit has-header"> + <ion-header-bar> + <h1 class="title" translate>GROUP.VIEW.MENU_TITLE</h1> + </ion-header-bar> + <ion-content scroll="false"> + <div class="list item-text-wrap"> + + <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/group/view_record.html b/www/plugins/es/templates/group/view_record.html index 0a2dbdfb6e2826c17600eb301fa7bd2b18f5a570..c48b694e6176e6e2f827c1c88ce7e8ab9825188f 100644 --- a/www/plugins/es/templates/group/view_record.html +++ b/www/plugins/es/templates/group/view_record.html @@ -67,6 +67,7 @@ </div> <!-- Buttons bar--> + <a id="group-share-anchor-{{id}}"></a> <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)"> diff --git a/www/plugins/es/templates/registry/view_record.html b/www/plugins/es/templates/registry/view_record.html index 38e9ff83c710ac2f81a2eab9a204ec39bb4490f8..cce4a49ae88929b2423c663f1b8a34562310e427 100644 --- a/www/plugins/es/templates/registry/view_record.html +++ b/www/plugins/es/templates/registry/view_record.html @@ -67,6 +67,7 @@ </div> <!-- Buttons bar--> + <a id="registry-share-anchor-{{id}}"></a> <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)"> diff --git a/www/templates/wallet/view_wallet.html b/www/templates/wallet/view_wallet.html index dc041bd486fd6d26706cee9aeef1e8f0de13ee07..203f18c463d063546376ce8aa624cd6f8e55b0b1 100644 --- a/www/templates/wallet/view_wallet.html +++ b/www/templates/wallet/view_wallet.html @@ -47,6 +47,7 @@ ng-click="toggleQRCode = !toggleQRCode"></div> <!-- Buttons bar--> + <a id="wallet-share-anchor"></a> <div class="hidden-xs hidden-sm padding text-center" ng-if="!loading"> <button class="button button-stable button-small-padding icon ion-android-share-alt ink" diff --git a/www/templates/wot/view_identity.html b/www/templates/wot/view_identity.html index 49b197598761f846155d28c6c4cd1adc55671608..221940428a906c30253f7e271b11f5712bd81627 100644 --- a/www/templates/wot/view_identity.html +++ b/www/templates/wot/view_identity.html @@ -34,6 +34,7 @@ </div> <!-- button bar--> + <a id="wot-share-anchor-{{::formData.pubkey}}"></a> <div class="hidden-xs hidden-sm padding text-center"> <button class="button button-stable button-small-padding icon ion-android-share-alt ink" ng-click="showSharePopover($event)"