Skip to content

Commit

Permalink
Merge pull request #92 from tomaszrondio/master
Browse files Browse the repository at this point in the history
featured image in preview, route slug editable, UI improvements
  • Loading branch information
takeit authored Jan 22, 2019
2 parents 1994d0a + f16cb20 commit 05c2ab3
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 11 deletions.
3 changes: 1 addition & 2 deletions client/controllers/WebPublisherContentListsController.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,9 @@ export function WebPublisherContentListsController($scope, publisher, publisherH
* @description Sets the active view name to the given value
*/
getThumbnail(article) {
return publisherHelpers.getThumbnail(article);
return publisherHelpers.getRenditionUrl(article, 'thumbnail');
}


/**
* @ngdoc method
* @name WebPublisherContentListsController#changeTab
Expand Down
14 changes: 12 additions & 2 deletions client/controllers/WebPublisherOutputController.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
* @requires https://docs.angularjs.org/api/ng/type/$rootScope.Scope $scope
* @description WebPublisherOutputController holds a set of functions used for web publisher monitoring
*/
WebPublisherOutputController.$inject = ['$scope', '$sce', 'modal', 'publisher', 'authoringWorkspace', '$window', 'notify', '$interval', 'config'];
export function WebPublisherOutputController($scope, $sce, modal, publisher, authoringWorkspace, $window, notify, $interval, config) {
WebPublisherOutputController.$inject = ['$scope', '$sce', 'modal', 'publisher', 'publisherHelpers', 'authoringWorkspace', '$window', 'notify', '$interval', 'config'];
export function WebPublisherOutputController($scope, $sce, modal, publisher, publisherHelpers, authoringWorkspace, $window, notify, $interval, config) {
class WebPublisherOutput {
constructor() {
this.filterButtonAllActive = true;
Expand Down Expand Up @@ -189,6 +189,16 @@ export function WebPublisherOutputController($scope, $sce, modal, publisher, aut
if (!this.publishOpen) this.selectedArticle = null;
}

/**
* @ngdoc method
* @name WebPublisherOutputController#getThumbnail
* @param {Object} article - article content object
* @description Sets the active view name to the given value
*/
getViewImage(article) {
return publisherHelpers.getRenditionUrl(article, 'viewImage');
}

/**
* @ngdoc method
* @name WebPublisherOutputController#countPageViews
Expand Down
13 changes: 10 additions & 3 deletions client/directives/groupArticle/view.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,18 @@
</div>
</div>
<div class="sd-list-item__action-menu sd-list-item__action-menu--direction-row">
<button class="icn-btn" ng-if="rootType === 'incoming'" ng-click="webPublisherOutput.removeArticle(i); $event.stopPropagation();"><i class="icon-trash"></i></button>
<button class="icn-btn" ng-click="webPublisherOutput.correctArticle(i); $event.stopPropagation();"><i class="icon-pencil"></i></button>
<button class="icn-btn" ng-click="webPublisherOutput.openPublish(i, 'publish'); $event.stopPropagation();"><i class="icon-expand-thin"></i></button>
<button sd-tooltip="Remove" class="icn-btn" ng-if="rootType === 'incoming'" ng-click="webPublisherOutput.removeArticle(i); $event.stopPropagation();"><i class="icon-trash"></i></button>
<button sd-tooltip="Correct" class="icn-btn" ng-click="webPublisherOutput.correctArticle(i); $event.stopPropagation();"><i class="icon-pencil"></i></button>
<button sd-tooltip="Publish" class="icn-btn" ng-click="webPublisherOutput.openPublish(i, 'publish'); $event.stopPropagation();"><i class="icon-expand-thin"></i></button>
</div>
</div>

<div ng-if="loadingArticles" class="item-group__loading" style="margin-left: auto; margin-right: auto; line-height: 38px; height: 38px; text-align: center;"></div>
</div>

<div class="panel-info" ng-if="!loadingArticles && !articlesList.length">
<div class="panel-info__icon">
<i class="big-icon--text"></i>
</div>
<h3 class="panel-info__heading">No {{rootType}} articles.</h3>
</div>
9 changes: 5 additions & 4 deletions client/services/PublisherHelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,16 @@ export function PublisherHelpersFactory() {

/**
* @ngdoc method
* @name PublisherHelpers#getThumbnail
* @name PublisherHelpers#getRenditionUrl
* @param {Object} article
* @param {String} type
* @returns {String}
* @description Returns template url dependent on type
* @description Returns image rendition url
*/
getThumbnail(article) {
getRenditionUrl(article, type = 'thumbnail') {
let base = article.tenant.subdomain ? '//' + article.tenant.subdomain + '.' + article.tenant.domainName : '//' + article.tenant.domainName;
let mediaEl = article.media.find(el => el.id === article.featureMedia.id);
let rendition = mediaEl.renditions.find(el => el.name === 'thumbnail');
let rendition = mediaEl.renditions.find(el => el.name === type);

return base + '/media/' + rendition.image.assetId + '.' + rendition.image.fileExtension;
};
Expand Down
3 changes: 3 additions & 0 deletions client/views/output/preview-pane.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ <h3 class="side-panel__heading">Item preview</h3>

<div class="side-panel__content-block">
<h3 class="side-panel__content-block-heading">{{webPublisherOutput.selectedArticle.headline}}</h3>
<img ng-if="webPublisherOutput.selectedArticle.articles[0].featureMedia && webPublisherOutput.selectedArticle.articles[0].featureMedia.image"
ng-src="{{webPublisherOutput.getViewImage(webPublisherOutput.selectedArticle.articles[0])}}"
style="max-width:100%">
<div class="side-panel__content-block-text" ng-bind-html="webPublisherOutput.bodyHtml"></div>
</div>
</div>
Expand Down
5 changes: 5 additions & 0 deletions client/views/settings/website-management/manage-routes.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ <h3 class="side-panel__heading" ng-if="!webPublisherSettings.isObjEmpty(webPubli
<label for="routeName" translate>name</label>
<input type="text" class="line-input" id="routeName" ng-model="newRoute.name" required>
</div>
<div class="item" ng-class="{'sd-line-input sd-line-input--invalid': newRoute.id}">
<label for="routeSlug" translate>slug</label>
<input type="text" class="line-input" id="routeSlug" ng-model="newRoute.slug">
<div ng-if="newRoute.id" class="sd-line-input__message">Beware than changing slug will affect article urls and may cause SEO issues.</div>
</div>
<div class="item">
<label for="routeType" translate>type</label>
<select class="dropdown__toggle line-input" id="routeType" ng-model="newRoute.type" required>
Expand Down

0 comments on commit 05c2ab3

Please sign in to comment.