Skip to content

Commit

Permalink
Subject matter expert review (SDFID-513) (#2733)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomaskikutis authored Jan 15, 2019
1 parent acdb0fa commit bbb69c6
Show file tree
Hide file tree
Showing 32 changed files with 568 additions and 455 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,9 @@ export function AuthoringDirective(superdesk, superdeskFlags, authoringWorkspace
*/
$scope.close = function() {
_closing = true;
authoring.close($scope.item, $scope.origItem, $scope.save_enabled()).then(() => {

// returned promise used by superdesk-fi
return authoring.close($scope.item, $scope.origItem, $scope.save_enabled()).then(() => {
authoringWorkspace.close(true);
});
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,14 @@
*
* @description Generates authoring subnav bar
*/
AuthoringTopbarDirective.$inject = ['TranslationService', 'privileges'];
export function AuthoringTopbarDirective(TranslationService, privileges) {
AuthoringTopbarDirective.$inject = ['TranslationService', 'privileges', 'authoringWorkspace'];
export function AuthoringTopbarDirective(TranslationService, privileges, authoringWorkspace) {
return {
templateUrl: 'scripts/apps/authoring/views/authoring-topbar.html',
link: function(scope) {
scope.additionalButtons = authoringWorkspace.authoringTopBarAdditionalButtons;
scope.buttonsToHide = authoringWorkspace.authoringTopBarButtonsToHide;

scope.saveDisabled = false;

scope.userHasPrivileges = privileges.userHasPrivileges;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,24 @@ export function AuthoringWorkspaceService($location, superdeskFlags, authoring,
this.action = null;
this.state = null;

// Array<() => Promise<boolean>>
let widgetVisibilityCheckerFuntions = [];

this.addWidgetVisibilityCheckerFunction = (fn) => {
widgetVisibilityCheckerFuntions.push(fn);
};

this.removeWidgetVisibilityCheckerFunction = (fn) => {
widgetVisibilityCheckerFuntions = widgetVisibilityCheckerFuntions.filter((f) => f !== fn);
};

this.isWidgetVisible = (widget) => new Promise((resolve) => {
Promise.all(widgetVisibilityCheckerFuntions.map((fn) => fn(widget)))
.then((res) => {
resolve(resolve(res.every((i) => i === true)));
});
});

var self = this;

/**
Expand All @@ -48,6 +66,10 @@ export function AuthoringWorkspaceService($location, superdeskFlags, authoring,
}
};

// plugin support
this.authoringTopBarAdditionalButtons = {},
this.authoringTopBarButtonsToHide = {};

/**
* Open an item in readonly mode without locking it
*
Expand Down
16 changes: 5 additions & 11 deletions scripts/apps/authoring/styles/authoring.scss
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@
right: 0;
left: 0;
box-sizing: border-box;

.sd-widget.versions .article-versions {
bottom: 0;
}
}

.page-content-container {
Expand Down Expand Up @@ -157,12 +153,16 @@
.page-content-container {
position: absolute;
top:0;
bottom: 0;
left: $tablist-width + $article-tabpane-padding;
right: $tablist-width + $article-tabpane-padding;
bottom: 30px;
overflow-y: auto;
}

.workqueue .page-content-container {
bottom: 30px;
}


// Medium editor
// -------------------------------------------------
Expand Down Expand Up @@ -324,12 +324,6 @@
}
}

.scratchpad-open {
.opened-articles {
bottom: $scratchpad-closed + $scratchpad-content-height;
}
}



// Article dashboard
Expand Down
2 changes: 1 addition & 1 deletion scripts/apps/authoring/versioning/versions/versions.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
position: absolute;
left: 0; top:50px; right: 0;
overflow: auto;
bottom: $authoring-opened-articles + $scratchpad-closed;
bottom: 0;

.versions-list {
padding: 12px;
Expand Down
8 changes: 5 additions & 3 deletions scripts/apps/authoring/views/authoring-topbar.html
Original file line number Diff line number Diff line change
Expand Up @@ -160,18 +160,20 @@
ng-if="action === 'correct' || action === 'kill'"
ng-click="close()"
translate>Cancel</button>

<button ng-repeat="(_, btn) in additionalButtons" ng-class="btn.class" ng-click="btn.onClick(item)">{{btn.label}}</button>
</div>

<div class="subnav__button-stack subnav__button-stack--square-buttons">
<button class="navbtn strict"
ng-if="!isLocked() && _editable"
ng-if="!isLocked() && _editable && buttonsToHide['article-edit--topbar--minimize'] !== true"
title="{{ :: 'Minimize' | translate }}"
ng-click="minimize()">
<i class="big-icon--minimize"></i>
</button>

<div id="authoring-extra-dropdown"
ng-if="item._type !== 'legal_archive' && item._type !== 'archived' && !highlight && item.state !== 'spiked'"
ng-if="item._type !== 'legal_archive' && item._type !== 'archived' && !highlight && item.state !== 'spiked' && buttonsToHide['article-edit--topbar--actions'] !== true"
class="dropdown pull-left strict" dropdown>
<button id="more-actions" class="navbtn dropdown__toggle" title="{{ :: 'More actions' | translate }}" dropdown__toggle>
<i class="icon-dots-vertical"></i>
Expand Down Expand Up @@ -296,7 +298,7 @@
</div>

<button id="send-to-btn" ng-show="_editable"
ng-if="action !== 'correct' && action !== 'kill'"
ng-if="action !== 'correct' && action !== 'kill' && buttonsToHide['article-edit--topbar--sendto-publish'] !== true"
class="navbtn navbtn--highlighted" sd-tooltip="{{ :: 'Send to / Publish' | translate }}" flow="left"
ng-click="views.send = !views.send"
ng-class="{'active': views.send}">
Expand Down
6 changes: 5 additions & 1 deletion scripts/apps/authoring/widgets/widgets-article.scss
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@
}
}

.workqueue .widget-wrapper .right-tabpane {
bottom: 30px;
}

.tabpane {
.sd-widget {
width: auto; height: auto;
Expand Down Expand Up @@ -66,7 +70,7 @@
border-top:1px solid #e0e0e0;
margin-top: 0;
overflow: auto;
bottom: 30px;
bottom: 0;
fieldset {
padding: 10px;
&.fieldset--no-padding {
Expand Down
24 changes: 19 additions & 5 deletions scripts/apps/authoring/widgets/widgets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ function AuthoringWidgetsProvider() {
};
}

WidgetsManagerCtrl.$inject = ['$scope', '$routeParams', 'authoringWidgets', 'archiveService',
WidgetsManagerCtrl.$inject = ['$scope', '$routeParams', 'authoringWidgets', 'archiveService', 'authoringWorkspace',
'keyboardManager', '$location', 'desks', 'lock', 'content', 'config', 'lodash', 'privileges', '$injector'];
function WidgetsManagerCtrl($scope, $routeParams, authoringWidgets, archiveService,
function WidgetsManagerCtrl($scope, $routeParams, authoringWidgets, archiveService, authoringWorkspace,
keyboardManager, $location, desks, lock, content, config, _, privileges, $injector) {
$scope.active = null;

Expand Down Expand Up @@ -51,9 +51,23 @@ function WidgetsManagerCtrl($scope, $routeParams, authoringWidgets, archiveServi

content.getType(item.profile).then((type) => {
const promises = widgets.map(
(widget) => typeof widget.isWidgetVisible === 'function'
? $injector.invoke(widget.isWidgetVisible(item))
: Promise.resolve(true),
(widget) => new Promise((resolve) => {
Promise.all([
// checking static superdesk config
typeof widget.isWidgetVisible === 'function'
? $injector.invoke(widget.isWidgetVisible(item))
: Promise.resolve(true),

// checking result from plugins
authoringWorkspace.isWidgetVisible(widget),
])
.then((res) => {
resolve(res.every((i) => i === true));
})
.catch(() => {
resolve(false);
});
}),
);

Promise.all(promises).then((result) => {
Expand Down
2 changes: 1 addition & 1 deletion scripts/apps/dashboard/styles/widgets.scss
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@
background: $sd-background;
}
.ingest-list {
padding: 12px 12px $scratchpad-closed + $authoring-opened-articles;
padding: 12px 12px $authoring-opened-articles;
> li {
.item-block {
border-color: #dedede;
Expand Down
10 changes: 0 additions & 10 deletions scripts/apps/monitoring/controllers/MonitoringController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,6 @@ import _ from 'lodash';
/**
* @ngdoc controller
* @module superdesk.apps.monitoring
* @name MonitoringController
*
* @requires $rootscope
* @requires $location
* @requires desks
* @requires config
* @requires superdeskFlags
* @requires search
*
* @description MonitoringController is responsible for providing functionalities in monitoring view of the application
*/
MonitoringController.$inject = ['$rootScope', '$scope', '$location', 'desks', 'config', 'superdeskFlags',
'search', '$filter', 'preferencesService', '$q'];
Expand Down
1 change: 0 additions & 1 deletion scripts/apps/monitoring/controllers/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
export {MonitoringController} from './MonitoringController';
export {AggregateCtrl} from './AggregateCtrl';
Loading

0 comments on commit bbb69c6

Please sign in to comment.