Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom blocks tab #4516

Merged
merged 2 commits into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ export function VocabularyConfigController($scope: IScope, $route, $routeParams,
$scope.matchFieldTypeToTab = (tab, fieldType) =>
tab === 'vocabularies' && !fieldType || fieldType &&
(tab === 'text-fields' && fieldType === 'text' ||
tab === 'custom-editor-blocks' && fieldType === 'editor-block' ||
tab === 'date-fields' && fieldType === 'date' ||
tab === 'urls-fields' && fieldType === 'urls' ||
tab === 'related-content-fields' && getMediaTypeKeys().includes(fieldType) ||
Expand All @@ -122,7 +123,7 @@ export function VocabularyConfigController($scope: IScope, $route, $routeParams,
*/
$scope.reloadList = () => {
$scope.loading = true;
vocabularies.getVocabularies().then((_vocabularies: Array<IVocabulary>) => {
vocabularies.getVocabularies({noCache: true}).then((_vocabularies: Array<IVocabulary>) => {
$scope.tags = getTags(_vocabularies);
$scope.vocabularies = _vocabularies;
$scope.loading = false;
Expand Down
5 changes: 3 additions & 2 deletions scripts/apps/vocabularies/services/VocabularyService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,11 @@ export function VocabularyService(api, $q, $filter, $rootScope) {
* @name VocabularyService#getVocabularies
* @public
* @description Returns the manageable vocabularies.
* @param {String} noCache if true, fetch new vocabularies values again
* @return {Promise} {Object} vocabularies
*/
this.getVocabularies = function() {
if (_.isNil(self.vocabularies)) {
this.getVocabularies = function(config: {noCache?: boolean}) {
if (_.isNil(self.vocabularies) || config?.noCache) {
return api.getAll('vocabularies', {where: {type: 'manageable'}}).then(
(result) => {
result._items = $filter('sortByName')(result._items, 'display_name');
Expand Down
7 changes: 5 additions & 2 deletions scripts/apps/vocabularies/views/settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ <h2 class="sd-page__page-heading" translate>Metadata management</h2>
<span translate>Upload Config</span>
</button>
</div>

<div class="sd-page__header sd-page__header--white">
<ul class="nav nav-tabs">
<li ng-class="{active: tab === 'vocabularies'}">
Expand All @@ -18,6 +18,9 @@ <h2 class="sd-page__page-heading" translate>Metadata management</h2>
<li ng-class="{active: tab === 'text-fields'}">
<button ng-click="tab = 'text-fields'" translate>Custom text fields</button>
</li>
<li ng-class="{active: tab === 'custom-editor-blocks'}">
<button ng-click="tab = 'custom-editor-blocks'" translate>Custom blocks</button>
</li>
<li ng-class="{active: tab === 'date-fields'}">
<button ng-click="tab = 'date-fields'" translate>Custom date fields</button>
</li>
Expand All @@ -35,7 +38,7 @@ <h2 class="sd-page__page-heading" translate>Metadata management</h2>
</li>
</ul>
</div>

<div class="sd-page__flex-helper" sd-vocabulary-config data-tab="tab"></div>
</div>
</sd-settings-view>
5 changes: 5 additions & 0 deletions scripts/apps/vocabularies/views/vocabulary-config.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
<i class="icon-plus-sign icon--white"></i>
<span translate>Add New</span>
</button>
<button class="btn btn--primary"
ng-click="createCustomField('editor-block')" ng-if="tab === 'custom-editor-blocks'">
<i class="icon-plus-sign icon--white"></i>
<span translate>Add New</span>
</button>

<button class="btn btn--primary"
ng-click="createCustomField('media')" ng-if="tab === 'related-content-fields'">
Expand Down
Loading