Skip to content

Commit

Permalink
Merge branch 'master' into add-missing-translations
Browse files Browse the repository at this point in the history
* master:
  change name of metadata and properties (#893)
  Move the Tile Edit wrapper one level up to the tiles engine (#895)
  Cypress create content type (#897)
  Fix file upload acceptance test (#882)
  Rework users controlpanel (#891)
  Dependencies upgrades (router, redux) (#890)
  User and groups control panel (#608)
  Add animated gifs for Volto table and toolbar to the docs.
  Do not run createContent cypress test on Guillotina.
  Use forEach instead of map in BodyClass.jsx.
  Remove unused getSpecialList and comment out unused ReferenceWidget import.
  Fail eslint check on any warnings.
  Add createContent cypress keyword.
  Fix typo in login.js acceptance test.
  Update the acceptance test readme.
  • Loading branch information
sneridagh committed Sep 27, 2019
2 parents 6f23f7d + de6e514 commit 287977b
Show file tree
Hide file tree
Showing 57 changed files with 2,391 additions and 284 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ build
.DS_Store
.idea
lighthouse-report.html
.vscode/
.#*
*~

# Python
/api/eggs/
Expand Down Expand Up @@ -54,3 +55,4 @@ cypress/screenshots

# Local environment setup
.env
.vscode
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,19 @@

### Added

- Added Users and Groups Controlpanel @nileshgulia1 @csenger @jackahl

### Changes

- Move the Tile Edit wrapper one level up to the tiles engine, so we can simplify how edit tiles are made @sneridagh
- Rename Metadata and Properties in sidebar to Document and Block @jackahl

### Internal

- fix cypress test for file Upload @jackahl
- Dependencies upgrades (router, redux) @sneridagh
- Fix docs build locally @sneridagh

## 4.0.0-alpha.3 (2019-09-22)

### Added
Expand All @@ -14,6 +25,7 @@

### Internal

- Fail eslint check on any warnings @timo
- Add i18n check on Travis @timo

## 4.0.0-alpha.2 (2019-09-19)
Expand All @@ -26,6 +38,8 @@
- Fix toolbar elements showing depending on user permissions @sneridagh
- Add some German Translations @steffenri, @jackahl

### Internal

## 4.0.0-alpha.1 (2019-09-17)

### Changes
Expand Down
8 changes: 3 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,12 @@ dist:
test:
(cd api && bin/test)

bin/pip:
virtualenv --clear --python=python3 .
bin/pip install -r requirements-docs.txt

docs-serve:
(cd docs && ../bin/mkdocs serve)

docs-build: bin/pip
docs-build:
virtualenv --clear --python=python3 .
./bin/pip install -r requirements-docs.txt
(cd docs && ../bin/mkdocs build)

start-frontend: dist
Expand Down
8 changes: 4 additions & 4 deletions cypress/integration/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,11 @@ context('Actions', () => {
{ fileContent, fileName: 'file.pdf', mimeType: 'application/pdf' },
{ subjectType: 'input' },
);
cy.get('#field-file')
.parent()
.parent()
.contains('file.pdf');
});
cy.get('#field-file')
.parent()
.parent()
.contains('file.pdf');
}
cy.get('#toolbar-save').click();
cy.visit('/contents');
Expand Down
41 changes: 41 additions & 0 deletions cypress/integration/createContent.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
if (Cypress.env('API') !== 'guillotina') {
context('createContent Acceptance Tests', () => {
beforeEach(() => {
cy.autologin();
});

it('Create document', function() {
cy.createContent('Document', 'my-page', 'My Page');
cy.visit('/my-page');
cy.get('.documentFirstHeading').should('have.text', 'My Page');
cy.url().should('eq', Cypress.config().baseUrl + '/my-page');
});
it('Create document with path', function() {
cy.createContent('Document', 'container', 'My Container');
cy.createContent('Document', 'child', 'My Child', '/container');
cy.visit('/container/child');
cy.get('.documentFirstHeading').should('have.text', 'My Child');
});
it('Create document with custom id', function() {
cy.createContent('Document', 'my-custom-id', 'My Page');
cy.visit('/my-custom-id');
cy.get('.documentFirstHeading').should('have.text', 'My Page');
});
it('Create News Item', function() {
cy.createContent('News Item', 'my-news-item', 'My News Item');
cy.visit('/my-news-item');
cy.get('.documentFirstHeading').should('have.text', 'My News Item');
});
it('Create File', function() {
cy.createContent('File', 'my-file', 'My File');
cy.visit('/my-file');
cy.get('.documentFirstHeading').should('have.text', 'My File');
cy.get('.view-wrapper a').should(
'have.attr',
'href',
'/my-file/@@download/file',
);
// cy.get('.view-wrapper a').click();
});
});
}
2 changes: 1 addition & 1 deletion cypress/integration/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ context('Actions', () => {
cy.visit('/');
cy.contains('Log in').click();
});
it('As registered user I an login', function() {
it('As registered user I can login', function() {
cy.get('#login')
.type('admin')
.should('have.value', 'admin');
Expand Down
66 changes: 66 additions & 0 deletions cypress/support/commands.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// --- AUTOLOGIN -------------------------------------------------------------
Cypress.Commands.add('autologin', () => {
let api_url;
if (Cypress.env('API') === 'guillotina') {
Expand All @@ -13,3 +14,68 @@ Cypress.Commands.add('autologin', () => {
body: { login: 'admin', password: 'secret' },
}).then(response => cy.setCookie('auth_token', response.body.token));
});

// --- CREATE CONTENT --------------------------------------------------------
Cypress.Commands.add(
'createContent',
(contentType, contentId, contentTitle, path = '') => {
let api_url;
if (Cypress.env('API') === 'guillotina') {
api_url = 'http://localhost:8081/db/container';
} else {
api_url = 'http://localhost:55001/plone';
}
if (contentType === 'File') {
cy.request({
method: 'POST',
url: `${api_url}/${path}`,
headers: {
Accept: 'application/json',
},
auth: {
user: 'admin',
pass: 'secret',
},
body: {
'@type': contentType,
id: contentId,
title: contentTitle,
file: {
data: 'dGVzdGZpbGUK',
encoding: 'base64',
filename: 'lorem.txt',
'content-type': 'text/plain',
},
},
});
}
if (contentType === 'Document' || contentType === 'News Item') {
cy.request({
method: 'POST',
url: `${api_url}/${path}`,
headers: {
Accept: 'application/json',
},
auth: {
user: 'admin',
pass: 'secret',
},
body: {
'@type': contentType,
id: contentId,
title: contentTitle,
tiles: {
'd3f1c443-583f-4e8e-a682-3bf25752a300': { '@type': 'title' },
'7624cf59-05d0-4055-8f55-5fd6597d84b0': { '@type': 'text' },
},
tiles_layout: {
items: [
'd3f1c443-583f-4e8e-a682-3bf25752a300',
'7624cf59-05d0-4055-8f55-5fd6597d84b0',
],
},
},
});
}
},
);
Binary file added docs/source/06-tiles/volto-table.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/source/06-tiles/volto-toolbar.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
36 changes: 36 additions & 0 deletions docs/source/upgrade-guide/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,17 @@ This upgrade guide lists all breaking changes in Volto and explains the

## Upgrading to Volto 4.x

First, update your `package.json` to Volto 4.x.x.

```json
"dependencies": {
"@plone/volto": "4.0.0",
...
}
```

### Tiles engine - Tiles configuration object

The tiles engine was updated and there are some important breaking changes, in case that
you've developed custom tiles. The configuration object is now unified and expresses all
the properties to model a tile. This is how a tile in the `defaultTiles` object looks
Expand Down Expand Up @@ -52,6 +63,31 @@ You should adapt and merge the configuration of your own custom tiles to match t
`defaultTiles` and `groupTilesOrder` one. You can modify the order of the groups and
create your own as well.
### Tiles engine - Simplification of the edit tiles wrapper
The edit tile wrapper boilerplate was quite big, and for bootstrap an edit tile you had to copy it from an existing tile. Now all this boilerplate has been transferred to the Tiles Engine, so bootstrapping the edit component of a tile is easier and do not require any pre-existing code.
In order to upgrade your tiles you should simplify the outter `<div>` (took as example the Title tile):
``` diff
index 65a00806..0d86899e 100644
--- a/src/components/manage/Tiles/Title/Edit.jsx
+++ b/src/components/manage/Tiles/Title/Edit.jsx
@@ -138,11 +138,7 @@ class Edit extends Component {
return <div />;
}
return (
- <div
- role="presentation"
- onClick={() => this.props.onSelectTile(this.props.tile)}
- className={cx('tile title', { selected: this.props.selected })}
- >
+ <div className={cx('tile title', { selected: this.props.selected })}>
<Editor
onChange={this.onChange}
editorState={this.state.editorState}
```
## Upgrading to Volto 3.x
Volto was upgraded to use Razzle 3.0.0 which is not a breaking change itself,
Expand Down
Loading

0 comments on commit 287977b

Please sign in to comment.