Skip to content
Snippets Groups Projects
Commit 00bea7eb authored by Benoit Lavenier's avatar Benoit Lavenier
Browse files

[fix] change position of share popover, is small screen - fix #545

parent d0443201
No related branches found
No related tags found
No related merge requests found
...@@ -516,6 +516,12 @@ function WalletController($scope, $rootScope, $q, $ionicPopup, $timeout, $state, ...@@ -516,6 +516,12 @@ function WalletController($scope, $rootScope, $q, $ionicPopup, $timeout, $state,
var title = $scope.formData.name || $scope.formData.uid || $scope.formData.pubkey; var title = $scope.formData.name || $scope.formData.uid || $scope.formData.pubkey;
// Use shareBasePath (fix #530) or rootPath (fix #390) // 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}); 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, { UIUtils.popover.share(event, {
bindings: { bindings: {
url: url, url: url,
......
...@@ -864,6 +864,10 @@ function WotIdentityAbstractController($scope, $rootScope, $state, $translate, $ ...@@ -864,6 +864,10 @@ function WotIdentityAbstractController($scope, $rootScope, $state, $translate, $
var title = $scope.formData.name || $scope.formData.uid || $scope.formData.pubkey; var title = $scope.formData.name || $scope.formData.uid || $scope.formData.pubkey;
// Use shareBasePath (fix #530) or rootPath (fix #390) // 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}); 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, { UIUtils.popover.share(event, {
bindings: { bindings: {
url: url, url: url,
......
...@@ -230,6 +230,10 @@ ...@@ -230,6 +230,10 @@
"MANAGED": "Groupe administré" "MANAGED": "Groupe administré"
} }
}, },
"VIEW": {
"POPOVER_SHARE_TITLE": "{{title}}",
"MENU_TITLE": "Options"
},
"EDIT": { "EDIT": {
"TITLE": "Groupe", "TITLE": "Groupe",
"TITLE_NEW": "Nouveau groupe", "TITLE_NEW": "Nouveau groupe",
......
...@@ -178,7 +178,7 @@ function ESGroupListController($scope, UIUtils, $state, csWallet, esGroup, Modal ...@@ -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'; 'ngInject';
$scope.formData = {}; $scope.formData = {};
...@@ -229,6 +229,53 @@ function ESGroupViewController($scope, $state, UIUtils, esGroup, csWallet) { ...@@ -229,6 +229,53 @@ function ESGroupViewController($scope, $state, UIUtils, esGroup, csWallet) {
UIUtils.loading.show(); UIUtils.loading.show();
$state.go('app.edit_group', {id: $scope.id}); $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, function ESGroupEditController($scope, esGroup, UIUtils, $state, $q, Device,
......
...@@ -525,6 +525,10 @@ function ESRegistryRecordViewController($scope, $state, $q, $timeout, $ionicPopo ...@@ -525,6 +525,10 @@ function ESRegistryRecordViewController($scope, $state, $q, $timeout, $ionicPopo
var title = $scope.formData.title; var title = $scope.formData.title;
// Use shareBasePath (fix #530) or rootPath (fix #390) // 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}); 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, { UIUtils.popover.share(event, {
bindings: { bindings: {
url: url, url: url,
......
<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>
...@@ -67,6 +67,7 @@ ...@@ -67,6 +67,7 @@
</div> </div>
<!-- Buttons bar--> <!-- Buttons bar-->
<a id="group-share-anchor-{{id}}"></a>
<div class="item large-button-bar hidden-xs hidden-sm"> <div class="item large-button-bar hidden-xs hidden-sm">
<button class="button button-stable button-small-padding icon ion-android-share-alt" <button class="button button-stable button-small-padding icon ion-android-share-alt"
ng-click="showSharePopover($event)"> ng-click="showSharePopover($event)">
......
...@@ -67,6 +67,7 @@ ...@@ -67,6 +67,7 @@
</div> </div>
<!-- Buttons bar--> <!-- Buttons bar-->
<a id="registry-share-anchor-{{id}}"></a>
<div class="item large-button-bar hidden-xs hidden-sm"> <div class="item large-button-bar hidden-xs hidden-sm">
<button class="button button-stable button-small-padding icon ion-android-share-alt" <button class="button button-stable button-small-padding icon ion-android-share-alt"
ng-click="showSharePopover($event)"> ng-click="showSharePopover($event)">
......
...@@ -47,6 +47,7 @@ ...@@ -47,6 +47,7 @@
ng-click="toggleQRCode = !toggleQRCode"></div> ng-click="toggleQRCode = !toggleQRCode"></div>
<!-- Buttons bar--> <!-- Buttons bar-->
<a id="wallet-share-anchor"></a>
<div class="hidden-xs hidden-sm padding text-center" ng-if="!loading"> <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" <button class="button button-stable button-small-padding icon ion-android-share-alt ink"
......
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
</div> </div>
<!-- button bar--> <!-- button bar-->
<a id="wot-share-anchor-{{::formData.pubkey}}"></a>
<div class="hidden-xs hidden-sm padding text-center"> <div class="hidden-xs hidden-sm padding text-center">
<button class="button button-stable button-small-padding icon ion-android-share-alt ink" <button class="button button-stable button-small-padding icon ion-android-share-alt ink"
ng-click="showSharePopover($event)" ng-click="showSharePopover($event)"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment