From 8fe262652e6cf03f40981ef30587100cd37892cb Mon Sep 17 00:00:00 2001 From: ulferts Date: Thu, 5 Sep 2019 13:23:32 +0200 Subject: [PATCH] intregrate newly created help into help mode --- frontend/src/app/modules/grids/grid/add-widget.service.ts | 2 +- frontend/src/app/modules/grids/grid/area.service.ts | 4 +++- frontend/src/app/modules/my-page/my-page.component.html | 5 ----- modules/grids/spec/support/pages/grid.rb | 4 ++-- 4 files changed, 6 insertions(+), 9 deletions(-) delete mode 100644 frontend/src/app/modules/my-page/my-page.component.html diff --git a/frontend/src/app/modules/grids/grid/add-widget.service.ts b/frontend/src/app/modules/grids/grid/add-widget.service.ts index 0f3007d699..3759538410 100644 --- a/frontend/src/app/modules/grids/grid/add-widget.service.ts +++ b/frontend/src/app/modules/grids/grid/add-widget.service.ts @@ -30,7 +30,7 @@ export class GridAddWidgetService { public isAddable(area:GridArea) { return !this.drag.currentlyDragging && !this.resize.currentlyResizing && - (this.layout.mousedOverArea === area || this.layout.isSingleCell || this.layout.isNewlyCreated || this.layout.inHelpMode) && + (this.layout.mousedOverArea === area || this.layout.isSingleCell || this.layout.inHelpMode) && this.isAllowed; } diff --git a/frontend/src/app/modules/grids/grid/area.service.ts b/frontend/src/app/modules/grids/grid/area.service.ts index 32a5b21caf..7a44f88720 100644 --- a/frontend/src/app/modules/grids/grid/area.service.ts +++ b/frontend/src/app/modules/grids/grid/area.service.ts @@ -33,6 +33,8 @@ export class GridAreaService { this.numRows = this.resource.rowCount; this.numColumns = this.resource.columnCount; + this.helpMode = this.isNewlyCreated; + this.buildAreas(true); } @@ -113,7 +115,7 @@ export class GridAreaService { return this.numRows === 1 && this.numColumns === 1 && this.widgetResources.length === 0; } - public get isNewlyCreated() { + private get isNewlyCreated() { return moment(moment.utc()).diff(moment(this.resource.createdAt), 'seconds') < 20; } diff --git a/frontend/src/app/modules/my-page/my-page.component.html b/frontend/src/app/modules/my-page/my-page.component.html deleted file mode 100644 index 347d10a780..0000000000 --- a/frontend/src/app/modules/my-page/my-page.component.html +++ /dev/null @@ -1,5 +0,0 @@ -

- - - - diff --git a/modules/grids/spec/support/pages/grid.rb b/modules/grids/spec/support/pages/grid.rb index 830ae1d20b..c84020b12d 100644 --- a/modules/grids/spec/support/pages/grid.rb +++ b/modules/grids/spec/support/pages/grid.rb @@ -33,7 +33,7 @@ module Pages def add_widget(row_number, column_number, location, name) within_add_widget_modal(row_number, column_number, location) do expect(page) - .to have_content(I18n.t('js.grid.add_modal.choose_widget')) + .to have_content(I18n.t('js.grid.add_widget')) page.find('.grid--addable-widget', text: Regexp.new("^#{name}$")).click end @@ -83,7 +83,7 @@ module Pages def expect_specific_widget_unaddable(row_number, column_number, location, name) within_add_widget_modal(row_number, column_number, location) do expect(page) - .to have_content(I18n.t('js.grid.add_modal.choose_widget')) + .to have_content(I18n.t('js.grid.add_widget')) expect(page) .not_to have_selector('.grid--addable-widget', text: Regexp.new("^#{name}$"))