Skip to content

Fix issue 75,71 added content toolbar everywhere and media editor and media section (C039_geostory)#4107

Merged
MV88 merged 37 commits intogeosolutions-it:C039_geostoryfrom
MV88:75_background_toolbar
Sep 5, 2019
Merged

Fix issue 75,71 added content toolbar everywhere and media editor and media section (C039_geostory)#4107
MV88 merged 37 commits intogeosolutions-it:C039_geostoryfrom
MV88:75_background_toolbar

Conversation

@MV88
Copy link
Copy Markdown
Contributor

@MV88 MV88 commented Aug 26, 2019

Description

This pr adds the toolbar to the Background and every other content:

  • edit (for media only)
  • size
  • align
  • fit
  • theme

it also adds the possibility to add a Media Section

Issues

Please check if the PR fulfills these requirements

What kind of change does this PR introduce? (check one with "x", remove the others)

  • Feature

What is the current behavior? (You can also link to an open issue here)
Background content has no toolbar

What is the new behavior?
it has

Does this PR introduce a breaking change? (check one with "x", remove the other)

  • Yes, and I documented them in migration notes
  • No

If this PR contains a breaking change, please describe the impact and migration path for existing applications: ...

Other information:

@MV88 MV88 requested a review from allyoucanmap August 26, 2019 10:18
@MV88 MV88 self-assigned this Aug 26, 2019
@MV88 MV88 changed the title Fix Background content toolbar (C039_geostory) Fix issue 75 Background content toolbar (C039_geostory) Aug 26, 2019
},
contentId: contextIndex && contextIndex.id,
sectionId: id
};
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should not remove the backgroundId prop because it used in the stream for immersive layout to select the current background in view.
It seems also getContentIndex returns a content object instead of an index so I propose to change it to getContentInView.

example

({ id, backgroundId, contents = [] }) => {
    const contentInView = getContentInView(contents, backgroundId) || {};
    return {
        background: get(contentInView, 'background') || { type: 'none' },
        contentId: contentInView && contentInView.id,
        sectionId: id
    };
}

backgroundProp,
withHandlers({
updateBackground: ({ sectionId, backgroundId, update = () => { } }) => (path, ...args) => update(`sections[{id: ${sectionId}}].contents[{id: ${backgroundId}}].background.` + path, ...args)
updateBackground: ({ sectionId, contentId, update = () => { } }) => (path, ...args) => update(`sections[{"id": "${sectionId}"}].contents[{"id": "${contentId}"}].background.` + path, ...args)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems your changes are correct but I wondering why the updateBackground was there even if it was not used before.
I propose to merge the handler with backgroundProp to create a single function to apply to sections that do not need stream to update background in view.

* @prop {string} size one of 'full', 'large', 'medium' or 'small'
* @prop {string} fit one of 'cover' or 'fit'
*/
export const getClassNameFromProps = ({ theme = 'bright', align = 'center', size = 'large', fit = 'cover' }) => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can remove fit from here

@MV88 MV88 added the GeoStory label Aug 27, 2019
@coveralls
Copy link
Copy Markdown

coveralls commented Aug 29, 2019

Coverage Status

Coverage increased (+0.05%) to 82.423% when pulling 2b87439 on MV88:75_background_toolbar into da195e2 on geosolutions-it:C039_geostory.

MV88 added 2 commits August 30, 2019 12:11
* also restructured the sample story for new layout of paragraph
* adding media toolbar on every Image
/* mixin for align*/
.align-center { margin-left: auto; margin-right: auto; }
.align-left { margin-left: 0; margin-right: auto; }
.align-right { margin-left: auto; margin-right: 0; }
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should add a specific prefix to avoid styles overrides around MapStore.
example
@ms-size-full: 100%; ->@ms-story-size-full:
...
.align-center -> .ms-story-align-center
...

add('sections', id, SectionTypes.IMMERSIVE);
}
}]}/>}
}/*,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you are going to override this change in the next PR. If you don't please remove this commented code. Otherwise leave

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes it has changed in the meanwhile :)

action$.ofType(EDIT_MEDIA)
.switchMap(({path, owner}) => {
const state = store.getState();
const resourceId = get(state, getEffectivePath(`geostory.currentStory.${path}.resourceId`, state), "");
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe is a good idea if

path => state => get(state, getEffectivePath(`geostory.currentStory.${path}`, state));

this is a selectorCreator and you use it this way.

const resourceId = pathSelectorCreator(`${path}.resourceId`)(state) || "" // <-- Are you sure that a default like "" is ok?

@MV88 MV88 changed the title Fix issue 75 Background content toolbar (C039_geostory) Fix issue 75,71 added content toolbar everywhere and media editor and media section (C039_geostory) Sep 3, 2019
@MV88 MV88 merged commit b4f39b7 into geosolutions-it:C039_geostory Sep 5, 2019
offtherailz pushed a commit that referenced this pull request Sep 6, 2019
* Geostory scheleton (#4014)

* Geostory sections (#4029)

Add base structure for geostory scroll handlers and background setup (base support for immersive or cover backgrounds) .

* Geostory base text editing and content wrapper (#4033)

* Fix #9 Contents - Image (#4038)

* Geostory scroll immersive (#4044)

* Fix #69 Builder - Section Editor - Section selector - Title (#4063)

* Geostory add Section (#4078)

* Fix random failure of getFeatureInfoOnFeatureInfoClick WMS test (#4091) (#4099)

* Fix issue 78 Load story configuration (C039_geostory) (#4096)

* Fix issue 78 Load story configuration

* removed unneeded action in epic stream
* removed unneeded comment
* skip failing test

* Fix issue 62 Media Editor - Image  (C039_geostory) (#4101)

* First version of media editor (missing tests)
* Adding tests and documentation
* adding modify logic for media image with tests
* mediaEditor closed by default
* update node version to 8.6.0 in .travis.yml
* skip failing test for the moment

* Geostory - Normal editor - Title  (C039_geostory) (#4102)

* Fix issue 75,71 added content toolbar everywhere and media editor and media section (C039_geostory) (#4107)

* Fix Background content toolbar (C039_geostory)

* it contains also tests

* added editing for media and correct update of resource id

* also restructured the sample story for new layout of paragraph
* adding media toolbar on every Image

* missed one test in prevois commit

* Adding Media Section for GeoStory

* issue 71

* add some styles for immersive layout

* Removed section typemedia

* Fixed missing parts of SectionTemplate removals

* Fixed styles and minor changes

* fix add button position in geostory column content

* Fix media section toolbar as paragraph

* removed .only in tests

* Add column and immersive tests

* revert error commit

* revert error commit

* Fixed immersive tests

* Fixed column test

* Add remove button for images and immersive background

* Fixed remove buttons

* improve style of cascade layout

* Fixed array remove

* * removed path geostory
* image placeholder

* fix tests

* Add default resources for newgeostory

fix edit for empty background

* fix scrollbar in media editor

* Add remove to text. Add recursive conainer removal

* add tests for column and actions and content toolbars

* resotred tests.webpack.js changes committed in error

* removed temp comment

* update toolbar position and patterns

* fix failing epic test

* fix edit media for media inside immersive columns

* Add auto scroll for new content

* fix lint error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants