Skip to content

Commit

Permalink
Merge pull request #1573 from ushahidi/revert-1548-remove-warning-ids…
Browse files Browse the repository at this point in the history
…-console

Revert "added isEmbed and small markup change in post-toolbar" as it fails QA.
  • Loading branch information
AmTryingMyBest authored Oct 16, 2020
2 parents 805dade + 814543e commit 9c5ee5f
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 27 deletions.
9 changes: 2 additions & 7 deletions app/main/posts/views/post-toolbar.directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ function PostToolbarDirective() {
};
}

PostToolbarController.$inject = ['$scope', '$rootScope', 'Notify', 'PostLockService', '$state', '$window', 'LoadingProgress'];
function PostToolbarController($scope, $rootScope, Notify, PostLockService, $state, $window, LoadingProgress) {
PostToolbarController.$inject = ['$scope', '$rootScope', 'Notify', 'PostLockService', '$state', 'LoadingProgress'];
function PostToolbarController($scope, $rootScope, Notify, PostLockService, $state, LoadingProgress) {
$scope.setEditMode = setEditMode;
$scope.savePost = savePost;
$scope.hasPermission = $rootScope.hasPermission('Manage Posts');
Expand All @@ -27,7 +27,6 @@ function PostToolbarController($scope, $rootScope, Notify, PostLockService, $sta
$scope.hideOtherActions = hideOtherActions;
$scope.showOtherActions = showOtherActions;
$scope.filtersActive = false;
$scope.isEmbed = isEmbed;


function editEnabled() {
Expand Down Expand Up @@ -63,8 +62,4 @@ function PostToolbarController($scope, $rootScope, Notify, PostLockService, $sta
function showOtherActions() {
$scope.filtersActive = false;
}

function isEmbed() {
return $window.self !== $window.top
}
}
49 changes: 29 additions & 20 deletions app/main/posts/views/post-toolbar.html
Original file line number Diff line number Diff line change
@@ -1,31 +1,40 @@
<div class="toolbar">
<!-- toolbar -->

<!-- floating action button -->
<add-post-button></add-post-button>

<div ng-class="{ 'hide-until-medium': isEmbed() }">
<!-- toolbar -->
<filter-posts filters="filters" stats="stats" on-open="hideOtherActions()" on-close="showOtherActions()">
</filter-posts>
<filter-posts filters="filters" stats="stats" embed-only="false" on-open="hideOtherActions()" on-close="showOtherActions()"></filter-posts>

<div class="button-group" ng-hide="filtersActive">
<div ng-if="!editMode()">
<post-share filters="filters" button="true"></post-share>
<button ng-if="editEnabled()" class="button button-alpha" ng-click="setEditMode()"
translate>app.edit</button>
</div>
<div class="button-group" embed-only="false" ng-hide="filtersActive">
<div ng-if="!editMode()">
<post-share filters="filters" button="true"></post-share>
<button ng-if="editEnabled()" class="button button-alpha" ng-click="setEditMode()" translate>app.edit</button>
</div>

<div ng-if="editMode()">
<button ng-if="hasPermission" class="button" ng-click="cancel()" translate>app.cancel</button>
<button ng-if="hasPermission && !isSaving()" ng-click="savePost()" class=" button button-alpha"
translate>app.save</button>
<loading-dots ng-if="isSaving() && !isEmbed()" button-class="'button-alpha'" disabled=true
label="'app.saving'"></loading-dots>
</div>
<div ng-if="editMode()">
<button ng-if="hasPermission" class="button" ng-click="cancel()" translate>app.cancel</button>
<button ng-if="hasPermission && !isSaving()" ng-click="savePost()" class=" button button-alpha" translate>app.save</button>
<loading-dots button-class="'button-alpha'" disabled=true label="'app.saving'" ng-if="isSaving()"></loading-dots>
</div>
</div>

<div embed-only="true" class="hide-until-medium">
<filter-posts filters="filters" stats="stats" on-open="hideOtherActions()" on-close="showOtherActions()"></filter-posts>
<div class="button-group">
<div ng-hide="filtersActive">
<div ng-if="!editMode()">
<post-share filters="filters" button="true"></post-share>
<button ng-if="editEnabled()" class="button button-alpha" ng-click="setEditMode()" translate>app.edit</button>
</div>

<loading-dots ng-if="isSaving() && isEmbed()" button-class="'button-alpha'" disabled=true label="'app.saving'">
</loading-dots>
<div ng-if="editMode()">
<button ng-if="hasPermission" class="button" ng-click="cancel()" translate>app.cancel</button>
<button ng-if="hasPermission && !isSaving()" ng-click="savePost()" class=" button button-alpha" translate>app.save</button>
</div>
</div>
</div>
<loading-dots button-class="'button-alpha'" disabled=true label="'app.saving'" ng-if="isSaving()"></loading-dots>
</div>

<!-- toolbar -->
Expand All @@ -34,4 +43,4 @@
..
</span>
</div>
</div>
</div>

0 comments on commit 9c5ee5f

Please sign in to comment.