From de72e2f8d2793ddf75bf3775aff28b15ac7578aa Mon Sep 17 00:00:00 2001 From: Tomas Kikutis Date: Sat, 18 Jan 2020 14:47:25 +0100 Subject: [PATCH] Create items and add as related immediatelly (#3256) --- .eslintignore | 3 +- package.json | 2 +- scripts/apps/authoring/styles/themes.scss | 6 +- .../apps/authoring/views/article-edit.html | 13 +- .../authoring/views/authoring-header.html | 6 +- .../authoring/views/authoring-topbar.html | 17 ++- scripts/apps/authoring/views/authoring.html | 2 +- scripts/apps/authoring/views/dashboard.html | 10 -- .../highlights/services/HighlightsService.ts | 2 +- .../monitoring/views/monitoring-view.html | 12 +- .../packaging/services/PackagesService.ts | 4 +- .../directives/RelatedItemsDirective.ts | 10 ++ .../apps/relations/views/related-items.html | 21 ++- .../apps/templates/views/create-template.html | 10 +- .../apps/templates/views/template-list.html | 2 +- .../directives/ContentCreateDirective.ts | 127 +++++++++++------- .../content/services/ContentService.ts | 28 ++-- .../workspace/content/tests/content.spec.ts | 39 +----- .../content/views/sd-content-create.html | 27 ++-- scripts/core/helpers/typescript-helpers.ts | 4 + .../superdesk-interfaces/ContentTemplate.ts | 12 ++ spec/helpers/authoring.ts | 28 +++- spec/monitoring_spec.ts | 32 +++++ spec/templates_spec.ts | 2 +- 24 files changed, 257 insertions(+), 162 deletions(-) delete mode 100644 scripts/apps/authoring/views/dashboard.html create mode 100644 scripts/superdesk-interfaces/ContentTemplate.ts diff --git a/.eslintignore b/.eslintignore index f238ad411f..2dd79c50c5 100644 --- a/.eslintignore +++ b/.eslintignore @@ -5,4 +5,5 @@ language-mapping-list.js scripts/extensions/*/node_modules scripts/extensions/**/dist end-to-end-testing-helpers/dist -end-to-end-testing-helpers/node_modules \ No newline at end of file +end-to-end-testing-helpers/node_modules +spec/**/*.js \ No newline at end of file diff --git a/package.json b/package.json index 03a49d9839..248b2a1548 100644 --- a/package.json +++ b/package.json @@ -156,7 +156,7 @@ "debug-unit-tests": "karma start karma.conf.js --browsers=Chrome", "unit": "grunt unit", "build": "grunt build", - "lint": "tsc -p scripts --noEmit && tslint -c tslint.json './**/*.{ts,tsx}' && eslint --parser=@typescript-eslint/parser --ext .js --ext .jsx --ext .ts --ext .tsx scripts tasks *.js", + "lint": "tsc -p scripts --noEmit && tslint -c tslint.json './**/*.{ts,tsx}' && eslint --parser=@typescript-eslint/parser --ext .js --ext .jsx --ext .ts --ext .tsx scripts spec tasks *.js", "lint-fix": "tsc -p scripts --noEmit && tslint --fix -c tslint.json 'scripts/**/*.{ts,tsx}' && eslint --fix --parser=@typescript-eslint/parser --ext .js --ext .jsx --ext .ts --ext .tsx scripts spec tasks *.js", "start-test-server": "cd test-server && python3 -m venv env && . env/bin/activate && pip install -Ur requirements.txt && honcho start", "protractor": "protractor protractor.conf.js", diff --git a/scripts/apps/authoring/styles/themes.scss b/scripts/apps/authoring/styles/themes.scss index 469629c6e7..8c2356477c 100644 --- a/scripts/apps/authoring/styles/themes.scss +++ b/scripts/apps/authoring/styles/themes.scss @@ -311,7 +311,11 @@ body, html { } } } - + .field__label--with-actions { + display: flex; + .field__label { margin-right: auto; } + } + .main-article__fieldset { display: flex; flex-direction: row; diff --git a/scripts/apps/authoring/views/article-edit.html b/scripts/apps/authoring/views/article-edit.html index c60586cd22..fcf4ff7a1e 100644 --- a/scripts/apps/authoring/views/article-edit.html +++ b/scripts/apps/authoring/views/article-edit.html @@ -679,7 +679,6 @@ sd-validation-error="error[field._id]" order="{{editor[field._id].order}}" data-required="schema[field._id].required"> -
-
+
+ + +
+
{{field.helper_text}}
diff --git a/scripts/apps/authoring/views/authoring-header.html b/scripts/apps/authoring/views/authoring-header.html index f8d3197f3e..27744bf838 100644 --- a/scripts/apps/authoring/views/authoring-header.html +++ b/scripts/apps/authoring/views/authoring-header.html @@ -96,6 +96,7 @@ ng-disabled="!_editable" ng-trim="false" tabindex="{{editor.slugline.order}}" + data-test-id="field-slugline" > - + tabindex="{{editor.ednote.order}}" + data-test-id="field-editors-note" + >
diff --git a/scripts/apps/authoring/views/authoring-topbar.html b/scripts/apps/authoring/views/authoring-topbar.html index cb0ac4303f..27605d43ca 100644 --- a/scripts/apps/authoring/views/authoring-topbar.html +++ b/scripts/apps/authoring/views/authoring-topbar.html @@ -141,7 +141,8 @@ ng-if="action !== 'correct' && action !== 'kill'" title="{{ :: 'Close' | translate }}" sd-hotkey="ctrl+shift+e" - sd-hotkey-options="{global: true}"> + sd-hotkey-options="{global: true}" + data-test-id="close"> Close @@ -152,7 +153,9 @@ ng-disabled="!save_enabled() || saveDisabled" sd-hotkey="ctrl+shift+s" sd-hotkey-options="{global: true}" - translate>Save + translate + data-test-id="save" + >Save - - diff --git a/scripts/apps/highlights/services/HighlightsService.ts b/scripts/apps/highlights/services/HighlightsService.ts index 3245c7fe37..a48791920a 100644 --- a/scripts/apps/highlights/services/HighlightsService.ts +++ b/scripts/apps/highlights/services/HighlightsService.ts @@ -115,7 +115,7 @@ export function HighlightsService(api, $q, $cacheFactory, packages, privileges) pkgDefaults.task = highlight.task; } - return packages.createEmptyPackage(pkgDefaults, group); + return packages.createEmptyPackage(pkgDefaults, false, group); }; /** diff --git a/scripts/apps/monitoring/views/monitoring-view.html b/scripts/apps/monitoring/views/monitoring-view.html index c6330acaca..f4d0ad995d 100644 --- a/scripts/apps/monitoring/views/monitoring-view.html +++ b/scripts/apps/monitoring/views/monitoring-view.html @@ -96,8 +96,16 @@