How to use the superdesk-core/scripts/apps/workspace/content/constants.GET_LABEL_MAP function in superdesk-core

To help you get started, we’ve selected a few superdesk-core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github superdesk / superdesk-planning / client / controllers / AddToPlanningController.js View on Github external
.then((newsItem) => {
                const errMessages = [];
                const profile = planningProfile(this.store.getState());
                const schema = get(profile, 'schema') || DEFAULT_PLANNING_SCHEMA;
                const requiredError = (field) => this.gettext('[{{ field }}] is a required field')
                    .replace('{{ field }}', field);
                const labels = GET_LABEL_MAP(this.gettext);

                if (get(newsItem, 'assignment_id')) {
                    errMessages.push(this.gettext('Item already linked to a Planning item'));
                }

                Object.keys(schema)
                    .filter((field) => DEFAULT_SCHEMA.hasOwnProperty(field)) // filter out planning only fields
                    .filter((field) => get(schema[field], 'required') &&
                        isEmpty(get(newsItem, field)) &&
                        !isNumber(get(newsItem, field)))
                    .forEach((field) => {
                        errMessages.push(requiredError(labels[field] || field));
                    });

                if (errMessages.length) {
                    errMessages.forEach((err) => {

superdesk-core

![CI](https://github.com/superdesk/superdesk-client-core/workflows/CI/badge.svg) [![Code Climate](https://codeclimate.com/github/superdesk/superdesk-client-core/badges/gpa.svg)](https://codeclimate.com/github/superdesk/superdesk-client-core)

AGPL-3.0
Latest version published 3 years ago

Package Health Score

55 / 100
Full package analysis

Similar packages