Skip to content

Commit

Permalink
Add beta label to new container layouts and enable flexible container…
Browse files Browse the repository at this point in the history
…s in production (#1683)
  • Loading branch information
cemms1 authored Oct 9, 2024
1 parent 7eb334d commit cb2609a
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 26 deletions.
8 changes: 8 additions & 0 deletions public/src/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -2017,6 +2017,14 @@ ol.search_list > li::before {
flex-wrap: wrap;
}

.cnf-form .beta-warning-text {
color: #f68d12;
background: #fffaed;
padding: 0 2px;
border: 1px solid;
border-radius: 4px;
}

.cnf-form .type-option-chosen {
color: #2ea3eb;
position: absolute;
Expand Down
40 changes: 32 additions & 8 deletions public/src/js/constants/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,26 @@ export default {
'big'
]
},
{ name: 'nav/list' },
{ name: 'nav/media-list' },
{ name: 'news/most-popular' },
{ name: 'breaking-news/not-for-other-fronts', groups: ['minor', 'major'] },
{ name: 'fixed/showcase' },
{ name: 'scrollable/highlights' }
{ 'name': 'nav/list' },
{ 'name': 'nav/media-list' },
{ 'name': 'news/most-popular' },
{ 'name': 'breaking-news/not-for-other-fronts', groups: ['minor', 'major'] },
{ 'name': 'fixed/showcase' },
{ 'name': 'scrollable/highlights' },
{
'name': 'flexible/general',
'groups': [
'standard',
'splash'
]
},
{
'name': 'flexible/special',
'groups': [
'standard',
'snap'
]
}
],

emailTypes: [
Expand Down Expand Up @@ -237,7 +251,6 @@ export default {
configCollection: 'config-collection'
},


frontendApiBase: '/frontend',

reauthPath: '/login/status',
Expand Down Expand Up @@ -267,5 +280,16 @@ export default {
any: 'Any'
},

userVisibilities: ['all', 'subscriber', 'non-subscriber']
userVisibilities: ['all', 'subscriber', 'non-subscriber'],

betaCollectionTypes: [
'flexible/special',
'flexible/general',
'scrollable/highlights',
'scrollable/small',
'scrollable/medium',
'scrollable/feature',
'static/medium/4',
'static/feature/2'
]
};
11 changes: 10 additions & 1 deletion public/src/js/models/config/collection.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export default class ConfigCollection extends DropTarget {
this.containerThumbnail = ko.pureComputed(() => {
var containerId = this.meta.type();

if (/^(fixed|dynamic)\//.test(containerId)) {
if (/^(fixed|dynamic|flexible|scrollable|static)\//.test(containerId)) {
return '/thumbnails/' + containerId + '.svg';
} else {
return null;
Expand All @@ -87,8 +87,13 @@ export default class ConfigCollection extends DropTarget {
this.typePicker = this._typePicker.bind(this);

this.thisIsPlatformSpecificCollection = isPlatformSpecificCollection(this.meta.platform());

this.thisIsBetaCollection = ko.pureComputed(() => {
return isBetaCollection(this.meta.type());
});
}


getPlatform() {
switch (this.meta.platform()) {
case vars.CONST.platforms.app: return 'app only';
Expand Down Expand Up @@ -182,3 +187,7 @@ function findParents (collectionId) {
.filter(Boolean)
.value();
}

function isBetaCollection (collectionId) {
return vars.CONST.betaCollectionTypes.includes(collectionId);
}
16 changes: 1 addition & 15 deletions public/src/js/modules/vars.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,9 @@ export function init (res) {
CONST.types.push({ 'name': 'all-items/not-for-production' });
}
// These containers are under development and are not yet ready for production.
// They will need to be added to the types list in default.js when ready.
// They will need to be added to the types list in ../constants/default.js when ready.
if (res.defaults.env.toLowerCase() !== 'prod') {
CONST.types.push(
{
'name': 'flexible/general',
'groups': [
'standard',
'splash'
]
},
{
'name': 'flexible/special',
'groups': [
'standard',
'snap'
]
},
{'name': 'scrollable/small'},
{'name': 'scrollable/medium'},
{'name': 'scrollable/feature'},
Expand Down
19 changes: 17 additions & 2 deletions public/src/js/widgets/columns/fronts-config.html
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,9 @@
<!-- ko if: containerThumbnail -->
<img onerror="this.style.display='none'" data-bind="attr: {src: containerThumbnail}" />
<!-- /ko -->
<!-- ko if: thisIsBetaCollection -->
<span class="beta-warning-text">Beta</span>
<!-- /ko -->
</div>

<!-- ko if: state.isOpenTypePicker -->
Expand All @@ -209,6 +212,18 @@
click: $parent.typePicker">
<div class="type-option-value" data-bind="text: $data"></div>
<img onerror="this.style.display='none'" data-bind="attr: {src: '/thumbnails/' + $data + '.svg'}" />
<!-- ko if: (
$data === 'flexible/general' ||
$data === 'flexible/special' ||
$data === 'scrollable/highlights' ||
$data === 'scrollable/small' ||
$data === 'scrollable/medium' ||
$data === 'scrollable/feature' ||
$data === 'static/medium/4' ||
$data === 'static/feature/2' )
-->
<span class="beta-warning-text">Beta</span>
<!-- /ko -->
</div>
</div>
<!-- /ko -->
Expand Down Expand Up @@ -284,8 +299,8 @@
<input type="checkbox" data-bind="
checked: meta.uneditable" />
<label for="frontsToolSettings.displayEditWarning">Display edit warning</label>
<input id="hideShowMore" type="checkbox" data-bind="checked: meta.frontsToolSettings.displayEditWarning" />
<label for="displayEditWarning">Display edit warning</label>
<input id="displayEditWarning" type="checkbox" data-bind="checked: meta.frontsToolSettings.displayEditWarning" />
<!-- ko if: meta.type() === 'scrollable/small' -->
<label for="suppressImages">Suppress images</label>
Expand Down

0 comments on commit cb2609a

Please sign in to comment.