diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 5d9ab64699..81a301ac52 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -1,6 +1,6 @@
# Contribute to Strapi
-👍🎉 First off, thanks for taking the time to contribute! 🎉👍
+First off, thanks for taking the time to contribute! 🎉👍
The following is a set of guidelines for contributing to Strapi and its packages.
@@ -32,40 +32,115 @@ If you send a pull request, please do it again the `master` branch. We are devel
## Setup Development Environment
To facilitate the contribution, we drastically reduce the amount of commands necessary to install the entire development environment. First of all, you need to check if you're using the recommended versions of Node.js (v8) and npm (v5).
-**Then, please follow the instructions below:**
+Then, please follow the instructions below:
-1. [Fork the repository](https://github.com/strapi/strapi) to your own GitHub account.
-2. Clone it to your computer `git clone git@github.com:strapi/strapi.git`.
-3. Run `npm run setup` at the root of the directory.
+#### 1. ▪️ Fork the repository
-> Note: If the installation failed, please remove the global packages related to Strapi. The command `npm ls strapi` will help you to find where your packages are installed globally.
+[Go to the repository](https://github.com/strapi/strapi) and fork it to your own GitHub account.
-> Note: You can run `npm run setup:build` to build the plugins' admin (the setup time will be longer).
+#### 2. 💿 Clone the repository
+```bash
+git clone git@github.com:strapi/strapi.git
+```
-The development environment has been installed. Now, you have to create a development project to live-test your updates.
+#### 3. ⏳ Installation
+
+Go to the root of the repository.
+```bash
+cd strapi
+```
-1. Go to a folder on your computer `cd /path/to/my/folder`.
-2. Create a new project `strapi new myDevelopmentProject --dev`.
-3. Start your app with `strapi start`.
+**Two setup are available... with or without the front-end builds.**
-Awesome! You are now able to make bug fixes or enhancements in the framework layer of Strapi. **To make updates in the administration panel, you need to go a little bit further.**
+Without the front-end builds, you won't be able to access to the administration panel via http://localhost:1337/admin, you'll have to run the administration separately and access it through http://localhost:4000/admin.
-4. Open a new tab or new terminal window.
-5. Go to the `my-app/admin` folder of your currently running app.
-6. Run `npm start` and go to the following url [http://localhost:4000/admin](http://localhost:4000/admin)
+
+
+Without the front-end builds (recommended)
+```bash
+npm run setup
+```
+or with the front-end builds
+```bash
+npm run setup:build
+```
+
+> ⚠️ If the installation failed, please remove the global packages related to Strapi. The command `npm ls strapi` will help you to find where your packages are installed globally.
+
+#### 4. 🏗 Create a new project
+
+You can open a new terminal window and go into any folder you want for the next steps.
+```bash
+cd /.../workspace/
+```
+
+The command to generate a project is the same, except you have to add the `--dev` argument at the end of line.
+```bash
+strapi new my-project --dev
+```
+
+#### 5. 🚀 Start the project
+
+First, you have to start the server.
+```bash
+cd ./my-project
+strapi start
+```
+
+The server (API) is available at http://localhost:1337
+
+> ⚠️ If you've followed the recommended setup, you should not be able to reach the administration panel at http://localhost:1337/admin.
+
+Then, you have to start the Webpack server to build and run the administration.
+```bash
+cd ./my-project/admin
+npm run start
+```
+
+The administration panel is available at http://localhost:4000/admin
+
+**Awesome! You are now able to contribute to Strapi.**
+
+---
## Plugin Development Setup
-To create a new plugin, you'll have to run the following commands
+To create a new plugin, you'll have to run the following commands:
-1. In your project folder `cd myDevelopmentProject && strapi generate:plugin my-plugin`.
-2. Make sure that the `strapi-helper-plugin` is linked to your plugin
- - In the folder where strapi is cloned `cd pathToStrapiRepo/strapi/packages/strapi-helper-plugin && npm link`.
- - In your project folder `cd pathToMyProject/myDevelopmentProject/plugins/my-plugin && npm link strapi-helper-plugin`.
-3. Start the server in the admin folder `cd pathToMyProject/myDevelopmentProject/admin && npm start` and go to the following url [http://localhost:4000/admin](http://localhost:4000/admin).
+#### 1. 🏗 Generate a new plugin
-***
+```bash
+cd ./my-project
+strapi generate:plugin my-plugin
+```
+
+#### 2. ✅ Verify the symlink
+
+Make you that the `strapi-helper-plugin` is linked to your project.
+
+Please run this command in the repository folder where Strapi is cloned:
+```bash
+cd /repository/strapi/packages/strapi-helper-plugin
+npm link
+```
+
+Link the `strapi-helper-plugin` node_modules in the plugin folder:
+```bash
+cd ./my-project/plugins/my-plugin
+npm link strapi-helper-plugin
+```
+
+#### 3. 🚀 Start the project
+
+```bash
+cd ./my-project/admin
+npm run start
+```
+
+The administration panel is available at http://localhost:4000/admin
+
+---
## Reporting an issue
diff --git a/README.md b/README.md
index 8d8a1610c0..6d152b0053 100755
--- a/README.md
+++ b/README.md
@@ -11,7 +11,7 @@
The most advanced open-source Content Management Framework to build powerful API with no effort.
+The most advanced open-source Content Management Framework (headless-CMS) to build powerful API with no effort.
diff --git a/packages/strapi-admin/admin/src/containers/HomePage/index.js b/packages/strapi-admin/admin/src/containers/HomePage/index.js
index 39a12cc6aa..a307417f03 100644
--- a/packages/strapi-admin/admin/src/containers/HomePage/index.js
+++ b/packages/strapi-admin/admin/src/containers/HomePage/index.js
@@ -137,7 +137,7 @@ export class HomePage extends React.PureComponent {
const data = this.showFirstBlock()
? {
className: styles.homePageTutorialButton,
- href: 'https://strapi.io/documentation/getting-started/quick-start.html',
+ href: 'https://strapi.io/documentation/getting-started/quick-start.html#create-your-first-api',
id: 'app.components.HomePage.button.quickStart',
primary: true,
}
diff --git a/packages/strapi-admin/admin/src/containers/InstallPluginPage/actions.js b/packages/strapi-admin/admin/src/containers/InstallPluginPage/actions.js
index 4de39e11f8..6f58869926 100644
--- a/packages/strapi-admin/admin/src/containers/InstallPluginPage/actions.js
+++ b/packages/strapi-admin/admin/src/containers/InstallPluginPage/actions.js
@@ -8,8 +8,10 @@ import {
DOWNLOAD_PLUGIN,
DOWNLOAD_PLUGIN_ERROR,
DOWNLOAD_PLUGIN_SUCCEEDED,
- GET_PLUGINS,
- GET_PLUGINS_SUCCEEDED,
+ GET_AVAILABLE_PLUGINS,
+ GET_AVAILABLE_PLUGINS_SUCCEEDED,
+ GET_INSTALLED_PLUGINS,
+ GET_INSTALLED_PLUGINS_SUCCEEDED,
ON_CHANGE,
} from './constants';
@@ -32,19 +34,32 @@ export function downloadPluginSucceeded() {
};
}
-export function getPlugins() {
+export function getAvailablePlugins() {
return {
- type: GET_PLUGINS,
+ type: GET_AVAILABLE_PLUGINS,
};
}
-export function getPluginsSucceeded(availablePlugins) {
+export function getAvailablePluginsSucceeded(availablePlugins) {
return {
- type: GET_PLUGINS_SUCCEEDED,
+ type: GET_AVAILABLE_PLUGINS_SUCCEEDED,
availablePlugins,
};
}
+export function getInstalledPlugins() {
+ return {
+ type: GET_INSTALLED_PLUGINS,
+ };
+}
+
+export function getInstalledPluginsSucceeded(installedPlugins) {
+ return {
+ type: GET_INSTALLED_PLUGINS_SUCCEEDED,
+ installedPlugins,
+ };
+}
+
export function onChange({ target }) {
return {
type: ON_CHANGE,
diff --git a/packages/strapi-admin/admin/src/containers/InstallPluginPage/constants.js b/packages/strapi-admin/admin/src/containers/InstallPluginPage/constants.js
index 2141383d83..06650ea0e6 100644
--- a/packages/strapi-admin/admin/src/containers/InstallPluginPage/constants.js
+++ b/packages/strapi-admin/admin/src/containers/InstallPluginPage/constants.js
@@ -7,6 +7,8 @@
export const DOWNLOAD_PLUGIN = 'StrapiAdmin/InstallPluginPage/DOWNLOAD_PLUGIN';
export const DOWNLOAD_PLUGIN_ERROR = 'StrapiAdmin/InstallPluginPage/DOWNLOAD_PLUGIN_ERROR';
export const DOWNLOAD_PLUGIN_SUCCEEDED = 'StrapiAdmin/InstallPluginPage/DOWNLOAD_PLUGIN_SUCCEEDED';
-export const GET_PLUGINS = 'StrapiAdmin/InstallPluginPage/GET_PLUGINS';
-export const GET_PLUGINS_SUCCEEDED = 'StrapiAdmin/InstallPluginPage/GET_PLUGINS_SUCCEEDED';
+export const GET_AVAILABLE_PLUGINS = 'StrapiAdmin/InstallPluginPage/GET_AVAILABLE_PLUGINS';
+export const GET_AVAILABLE_PLUGINS_SUCCEEDED = 'StrapiAdmin/InstallPluginPage/GET_AVAILABLE_PLUGINS_SUCCEEDED';
+export const GET_INSTALLED_PLUGINS = 'StrapiAdmin/InstallPluginPage/GET_INSTALLED_PLUGINS';
+export const GET_INSTALLED_PLUGINS_SUCCEEDED = 'StrapiAdmin/InstallPluginPage/GET_INSTALLED_PLUGINS_SUCCEEDED';
export const ON_CHANGE = 'StrapiAdmin/InstallPluginPage/ON_CHANGE';
diff --git a/packages/strapi-admin/admin/src/containers/InstallPluginPage/index.js b/packages/strapi-admin/admin/src/containers/InstallPluginPage/index.js
index 49634bb882..c1c4016891 100644
--- a/packages/strapi-admin/admin/src/containers/InstallPluginPage/index.js
+++ b/packages/strapi-admin/admin/src/containers/InstallPluginPage/index.js
@@ -11,7 +11,7 @@ import { Helmet } from 'react-helmet';
import { FormattedMessage } from 'react-intl';
import { bindActionCreators, compose } from 'redux';
import cn from 'classnames';
-import { get, isUndefined, map } from 'lodash';
+import { map } from 'lodash';
import {
disableGlobalOverlayBlocker,
@@ -32,7 +32,8 @@ import injectReducer from 'utils/injectReducer';
import {
downloadPlugin,
- getPlugins,
+ getAvailablePlugins,
+ getInstalledPlugins,
onChange,
} from './actions';
@@ -55,8 +56,11 @@ export class InstallPluginPage extends React.Component { // eslint-disable-line
// Don't fetch the available plugins if it has already been done
if (!this.props.didFetchPlugins) {
- this.props.getPlugins();
+ this.props.getAvailablePlugins();
}
+
+ // Get installed plugins
+ this.props.getInstalledPlugins();
}
componentWillUnmount() {
@@ -65,10 +69,10 @@ export class InstallPluginPage extends React.Component { // eslint-disable-line
}
render() {
- if (!this.props.didFetchPlugins) {
+ if (!this.props.didFetchPlugins || !this.props.didFetchInstalledPlugins) {
return
;
}
-
+
return (
@@ -112,7 +116,7 @@ export class InstallPluginPage extends React.Component { // eslint-disable-line
key={plugin.id}
plugin={plugin}
showSupportUsButton={plugin.id === 'support-us'}
- isAlreadyInstalled={!isUndefined(get(this.context.plugins.toJS(), plugin.id))}
+ isAlreadyInstalled={this.props.installedPlugins.includes(plugin.id)}
downloadPlugin={(e) => {
e.preventDefault();
e.stopPropagation();
@@ -134,19 +138,18 @@ InstallPluginPage.childContextTypes = {
downloadPlugin: PropTypes.func.isRequired,
};
-InstallPluginPage.contextTypes = {
- plugins: PropTypes.object.isRequired,
-};
-
InstallPluginPage.propTypes = {
availablePlugins: PropTypes.array.isRequired,
blockApp: PropTypes.bool.isRequired,
+ didFetchInstalledPlugins: PropTypes.bool.isRequired,
didFetchPlugins: PropTypes.bool.isRequired,
disableGlobalOverlayBlocker: PropTypes.func.isRequired,
downloadPlugin: PropTypes.func.isRequired,
enableGlobalOverlayBlocker: PropTypes.func.isRequired,
- getPlugins: PropTypes.func.isRequired,
+ getAvailablePlugins: PropTypes.func.isRequired,
+ getInstalledPlugins: PropTypes.func.isRequired,
history: PropTypes.object.isRequired,
+ installedPlugins: PropTypes.array.isRequired,
// onChange: PropTypes.func.isRequired,
// search: PropTypes.string.isRequired,
};
@@ -159,7 +162,8 @@ function mapDispatchToProps(dispatch) {
disableGlobalOverlayBlocker,
downloadPlugin,
enableGlobalOverlayBlocker,
- getPlugins,
+ getAvailablePlugins,
+ getInstalledPlugins,
onChange,
},
dispatch,
diff --git a/packages/strapi-admin/admin/src/containers/InstallPluginPage/reducer.js b/packages/strapi-admin/admin/src/containers/InstallPluginPage/reducer.js
index cc70f6f36c..2f7f007b46 100644
--- a/packages/strapi-admin/admin/src/containers/InstallPluginPage/reducer.js
+++ b/packages/strapi-admin/admin/src/containers/InstallPluginPage/reducer.js
@@ -9,14 +9,17 @@ import {
DOWNLOAD_PLUGIN,
DOWNLOAD_PLUGIN_ERROR,
DOWNLOAD_PLUGIN_SUCCEEDED,
- GET_PLUGINS_SUCCEEDED,
+ GET_AVAILABLE_PLUGINS_SUCCEEDED,
+ GET_INSTALLED_PLUGINS_SUCCEEDED,
ON_CHANGE,
} from './constants';
const initialState = fromJS({
availablePlugins: List([]),
+ installedPlugins: List([]),
blockApp: false,
didFetchPlugins: false,
+ didFetchInstalledPlugins: false,
pluginToDownload: '',
search: '',
});
@@ -35,10 +38,14 @@ function installPluginPageReducer(state = initialState, action) {
return state
.set('blockApp', false)
.set('pluginToDownload', '');
- case GET_PLUGINS_SUCCEEDED:
+ case GET_AVAILABLE_PLUGINS_SUCCEEDED:
return state
.set('didFetchPlugins', true)
.set('availablePlugins', List(action.availablePlugins));
+ case GET_INSTALLED_PLUGINS_SUCCEEDED:
+ return state
+ .set('didFetchInstalledPlugins', true)
+ .set('installedPlugins', List(action.installedPlugins));
case ON_CHANGE:
return state.updateIn(action.keys, () => action.value);
default:
diff --git a/packages/strapi-admin/admin/src/containers/InstallPluginPage/saga.js b/packages/strapi-admin/admin/src/containers/InstallPluginPage/saga.js
index ee8c18c416..0a2384a6b0 100644
--- a/packages/strapi-admin/admin/src/containers/InstallPluginPage/saga.js
+++ b/packages/strapi-admin/admin/src/containers/InstallPluginPage/saga.js
@@ -15,9 +15,10 @@ import { selectLocale } from '../LanguageProvider/selectors';
import {
downloadPluginError,
downloadPluginSucceeded,
- getPluginsSucceeded,
+ getAvailablePluginsSucceeded,
+ getInstalledPluginsSucceeded,
} from './actions';
-import { DOWNLOAD_PLUGIN, GET_PLUGINS } from './constants';
+import { DOWNLOAD_PLUGIN, GET_AVAILABLE_PLUGINS, GET_INSTALLED_PLUGINS } from './constants';
import { makeSelectPluginToDownload } from './selectors';
@@ -49,7 +50,7 @@ export function* pluginDownload() {
}
}
-export function* pluginsGet() {
+export function* getAvailablePlugins() {
try {
// Get current locale.
const locale = yield select(selectLocale());
@@ -73,20 +74,44 @@ export function* pluginsGet() {
availablePlugins = [];
}
- yield put(getPluginsSucceeded(availablePlugins));
+ yield put(getAvailablePluginsSucceeded(availablePlugins));
} catch(err) {
strapi.notification.error('notification.error');
}
}
+export function* getInstalledPlugins() {
+ try {
+ const opts = {
+ method: 'GET',
+ headers: {
+ 'Content-Type': 'application/json',
+ },
+ };
+ let installedPlugins;
+
+ try {
+ // Retrieve plugins list.
+ installedPlugins = yield call(request, '/admin/plugins', opts);
+ } catch (e) {
+ installedPlugins = [];
+ }
+
+ yield put(getInstalledPluginsSucceeded(Object.keys(installedPlugins.plugins)));
+ } catch(err) {
+ strapi.notification.error('notification.error');
+ }
+}
// Individual exports for testing
export default function* defaultSaga() {
- const loadPluginsWatcher = yield fork(takeLatest, GET_PLUGINS, pluginsGet);
+ const loadAvailablePluginsWatcher = yield fork(takeLatest, GET_AVAILABLE_PLUGINS, getAvailablePlugins);
+ const loadInstalledPluginsWatcher = yield fork(takeLatest, GET_INSTALLED_PLUGINS, getInstalledPlugins);
yield fork(takeLatest, DOWNLOAD_PLUGIN, pluginDownload);
yield take(LOCATION_CHANGE);
- yield cancel(loadPluginsWatcher);
+ yield cancel(loadAvailablePluginsWatcher);
+ yield cancel(loadInstalledPluginsWatcher);
}
diff --git a/packages/strapi-admin/admin/src/translations/de.json b/packages/strapi-admin/admin/src/translations/de.json
index dffa3c4271..e302899aba 100644
--- a/packages/strapi-admin/admin/src/translations/de.json
+++ b/packages/strapi-admin/admin/src/translations/de.json
@@ -16,12 +16,12 @@
"app.components.HomePage.welcome": "Willkommen an Bord!",
"app.components.HomePage.welcome.again": "Willkommen",
"app.components.HomePage.create": "Erstelle deinen ersten Inhaltstyp",
- "app.components.HomePage.welcomeBlock.content": "Wir freuen uns, dich als Mitglied der Community zu haben. Wir sind offen für Feedback, senden uns einfach eine direkt Nachricht an\u0020",
- "app.components.HomePage.welcomeBlock.content.issues": "Fehler",
- "app.components.HomePage.welcomeBlock.content.raise": "\u0020oder erhöhen\u0020",
+ "app.components.HomePage.welcomeBlock.content": "Wir freuen uns, dich als Mitglied der Community zu haben. Wir sind offen für Feedback, senden uns einfach eine direkt Nachricht in\u0020",
+ "app.components.HomePage.welcomeBlock.content.issues": "Ticket.",
+ "app.components.HomePage.welcomeBlock.content.raise": "\u0020oder eröffne\u0020",
"app.components.HomePage.createBlock.content.first": "Das\u0020",
- "app.components.HomePage.createBlock.content.second": "\u0020Plugin wird dir helfen, die Datenstruktur deiner Modelle zu definieren. Wenn du neu hier bist, empfehlen wir dir unsere\u0020",
- "app.components.HomePage.createBlock.content.tutorial": "\u0020Anleitung.",
+ "app.components.HomePage.createBlock.content.second": "\u0020Plugin wird dir helfen, die Datenstruktur deiner Modelle zu definieren. Wenn du neu hier bist, empfehlen wir dir unser\u0020",
+ "app.components.HomePage.createBlock.content.tutorial": "\u0020Tutorial.",
"app.components.HomePage.welcomeBlock.content.again": "Wir hoffen, dass du Fortschritte bei deinem Projekt machst.... Lese das Neueste über Strapi. Wir geben unser Bestes, um das Produkt auf der Grundlage deines Feedbacks zu verbessern.",
"app.components.HomePage.cta": "BESTÄTIGEN",
"app.components.HomePage.community": "Finde die Community im Web",
@@ -44,7 +44,7 @@
"app.components.InstallPluginPage.helmet": "Marktplatz - Plugins",
"app.components.InstallPluginPage.title": "Marktplatz - Plugins",
- "app.components.InstallPluginPage.description": "Erweitere problemlos deine App",
+ "app.components.InstallPluginPage.description": "Erweitere problemlos deine App.",
"app.components.InstallPluginPage.plugin.support-us.description": "Unterstütze uns durch den Kauf eines Strapi T-Shirts. Das erlaubt uns, weiter an dem Projekt arbeiten zu können und es so gut wie nur möglich zu gestalten!",
"app.components.InstallPluginPage.InputSearch.label": " ",
"app.components.InstallPluginPage.InputSearch.placeholder": "Suche nach einem Plugin... (z.B.: Authentifizierung)",
@@ -126,20 +126,20 @@
"components.ListRow.empty": "Es gibt keine Daten.",
- "components.Wysiwyg.collapse": "Collapse",
- "components.Wysiwyg.selectOptions.title": "Add a title",
- "components.Wysiwyg.selectOptions.H1": "Title H1",
- "components.Wysiwyg.selectOptions.H2": "Title H2",
- "components.Wysiwyg.selectOptions.H3": "Title H3",
- "components.Wysiwyg.selectOptions.H4": "Title H4",
- "components.Wysiwyg.selectOptions.H5": "Title H5",
- "components.Wysiwyg.selectOptions.H6": "Title H6",
- "components.Wysiwyg.ToggleMode.markdown": "Switch to markdown",
- "components.Wysiwyg.ToggleMode.preview": "Switch to preview",
- "components.WysiwygBottomControls.charactersIndicators": "characters",
- "components.WysiwygBottomControls.uploadFiles": "Attach files by dragging & dropping, {browse}, or pasting from the clipboard.",
- "components.WysiwygBottomControls.uploadFiles.browse": "selecting them",
- "components.WysiwygBottomControls.fullscreen": "Expand",
+ "components.Wysiwyg.collapse": "Verkleinern",
+ "components.Wysiwyg.selectOptions.title": "Füge einen Überschrift hinzu",
+ "components.Wysiwyg.selectOptions.H1": "Überschrift H1",
+ "components.Wysiwyg.selectOptions.H2": "Überschrift H2",
+ "components.Wysiwyg.selectOptions.H3": "Überschrift H3",
+ "components.Wysiwyg.selectOptions.H4": "Überschrift H4",
+ "components.Wysiwyg.selectOptions.H5": "Überschrift H5",
+ "components.Wysiwyg.selectOptions.H6": "Überschrift H6",
+ "components.Wysiwyg.ToggleMode.markdown": "Wechsel zu Markdown",
+ "components.Wysiwyg.ToggleMode.preview": "Wechsel zur Vorschau",
+ "components.WysiwygBottomControls.charactersIndicators": "Zeichen",
+ "components.WysiwygBottomControls.uploadFiles": "Ziehe eine Datei hierher, {browse} eine Datei zum hochladen aus oder füge sie aus der Zwischenablage ein.",
+ "components.WysiwygBottomControls.uploadFiles.browse": "wähle",
+ "components.WysiwygBottomControls.fullscreen": "Vergrößern",
"HomePage.notification.newsLetter.success": "Newsletter erfolgreich abonniert",
@@ -148,7 +148,7 @@
"Analytics": "Analytics",
"Auth & Permissions": "Authentifizierung & Berechtigungen",
- "Content Manager": "Content-Manager",
+ "Content Manager": "Inhalts-Manager",
"Content Type Builder": "Inhaltstyp-Manager",
"Files Upload": "Dateien hochladen",
"Settings Manager": "Einstellungs-Manager",
diff --git a/packages/strapi-generate-new/lib/after.js b/packages/strapi-generate-new/lib/after.js
index f704dc6d5e..17a8e38092 100755
--- a/packages/strapi-generate-new/lib/after.js
+++ b/packages/strapi-generate-new/lib/after.js
@@ -187,10 +187,10 @@ module.exports = (scope, cb) => {
console.log();
console.log(`👌 Your new application ${green(scope.name)} is ready at ${cyan(scope.rootPath)}.`);
console.log();
- console.log('⚡️ change directory:');
+ console.log('⚡️ Change directory:');
console.log(`$ ${green(`cd ${scope.name}`)}`);
console.log();
- console.log('⚡️ start application:');
+ console.log('⚡️ Start application:');
console.log(`$ ${green('strapi start')}`);
cb();
diff --git a/packages/strapi-generate-new/lib/before.js b/packages/strapi-generate-new/lib/before.js
index 4182643982..411063f82e 100755
--- a/packages/strapi-generate-new/lib/before.js
+++ b/packages/strapi-generate-new/lib/before.js
@@ -132,7 +132,7 @@ module.exports = (scope, cb) => {
type: 'input',
name: 'database',
message: 'Database name:',
- default: _.get(scope.database, 'database', 'strapi')
+ default: _.get(scope.database, 'database', scope.name)
},
{
when: !hasDatabaseConfig,
diff --git a/packages/strapi-helper-plugin/lib/src/components/BackHeader/styles.scss b/packages/strapi-helper-plugin/lib/src/components/BackHeader/styles.scss
index c3d3e8de52..5f7d28c846 100644
--- a/packages/strapi-helper-plugin/lib/src/components/BackHeader/styles.scss
+++ b/packages/strapi-helper-plugin/lib/src/components/BackHeader/styles.scss
@@ -4,7 +4,7 @@
height: 6rem;
width: 6.5rem;
line-height: 6rem;
- z-index: 999;
+ z-index: 1040;
text-align: center;
background-color: #FFFFFF;
color: #81848A;
diff --git a/packages/strapi-helper-plugin/lib/src/components/ImgPreview/styles.scss b/packages/strapi-helper-plugin/lib/src/components/ImgPreview/styles.scss
index 4073f1c0c9..ff676fed82 100644
--- a/packages/strapi-helper-plugin/lib/src/components/ImgPreview/styles.scss
+++ b/packages/strapi-helper-plugin/lib/src/components/ImgPreview/styles.scss
@@ -20,7 +20,7 @@
background-repeat: no-repeat !important;
white-space: nowrap;
- z-index: 1;
+ z-index: 1 !important;
> img {
position: absolute;
top: 0;
@@ -49,7 +49,7 @@
display: block;
position: absolute;
top: 37px;
- z-index: 9999;
+ z-index: 999;
padding: 12px 40px 0 40px;
line-height: 18px;
color: #fff !important;
diff --git a/packages/strapi-helper-plugin/lib/src/components/ImgPreviewRemoveIcon/styles.scss b/packages/strapi-helper-plugin/lib/src/components/ImgPreviewRemoveIcon/styles.scss
index 0a52aadf99..f035392e83 100644
--- a/packages/strapi-helper-plugin/lib/src/components/ImgPreviewRemoveIcon/styles.scss
+++ b/packages/strapi-helper-plugin/lib/src/components/ImgPreviewRemoveIcon/styles.scss
@@ -6,6 +6,6 @@
height: 20px;
color: #fff;
font-size: 11px;
- z-index: 9999;
+ z-index: 999;
cursor: pointer;
}
diff --git a/packages/strapi-hook-bookshelf/lib/index.js b/packages/strapi-hook-bookshelf/lib/index.js
index f91837dcc3..ff0d8fc8d0 100755
--- a/packages/strapi-hook-bookshelf/lib/index.js
+++ b/packages/strapi-hook-bookshelf/lib/index.js
@@ -26,9 +26,6 @@ const GLOBALS = {};
* Bookshelf hook
*/
-/* eslint-disable no-unused-vars */
-/* eslint-disable prefer-template */
-/* eslint-disable no-case-declarations */
module.exports = function(strapi) {
const hook = _.merge({
/**
@@ -79,17 +76,16 @@ module.exports = function(strapi) {
_.forEach(models, (definition, model) => {
definition.globalName = _.upperFirst(_.camelCase(definition.globalId));
- _.defaults(definition, {
- primaryKey: 'id'
- });
-
// Define local GLOBALS to expose every models in this file.
GLOBALS[definition.globalId] = {};
// Add some informations about ORM & client connection & tableName
definition.orm = 'bookshelf';
definition.client = _.get(connection.settings, 'client');
-
+ _.defaults(definition, {
+ primaryKey: 'id',
+ primaryKeyType: _.get(definition, 'options.idAttributeType', 'integer')
+ });
// Register the final model for Bookshelf.
const loadedModel = _.assign({
tableName: definition.collectionName,
@@ -287,7 +283,7 @@ module.exports = function(strapi) {
: Promise.resolve();
});
- this.on('saving', (instance, attrs) => {
+ this.on('saving', (instance, attrs, options) => { //eslint-disable-line
instance.attributes = mapper(instance.attributes);
attrs = mapper(attrs);
@@ -394,13 +390,16 @@ module.exports = function(strapi) {
case 'oneToOne':
case 'manyToOne':
case 'oneWay':
- type = definition.client === 'pg' ? 'integer' : 'int';
+ type = definition.primaryKeyType;
break;
default:
return null;
}
} else {
switch (attribute.type) {
+ case 'uuid':
+ type = definition.client === 'pg' ? 'uuid' : 'varchar(36)';
+ break;
case 'text':
type = definition.client === 'pg' ? type = 'text' : 'longtext';
break;
@@ -521,7 +520,13 @@ module.exports = function(strapi) {
if (!tableExist) {
- const columns = generateColumns(attributes, [`id ${definition.client === 'pg' ? 'SERIAL' : 'INT AUTO_INCREMENT'} NOT NULL PRIMARY KEY`]).join(',\n\r');
+ let idAttributeBuilder = [`id ${definition.client === 'pg' ? 'SERIAL' : 'INT AUTO_INCREMENT'} NOT NULL PRIMARY KEY`];
+ if (definition.primaryKeyType === 'uuid' && definition.client === 'pg') {
+ idAttributeBuilder = ['id uuid NOT NULL DEFAULT uuid_generate_v4() NOT NULL PRIMARY KEY'];
+ } else if (definition.primaryKeyType !== 'integer') {
+ idAttributeBuilder = [`id ${getType({type: definition.primaryKeyType})} NOT NULL PRIMARY KEY`];
+ }
+ const columns = generateColumns(attributes, idAttributeBuilder).join(',\n\r');
// Create table
await ORM.knex.raw(`
@@ -593,7 +598,6 @@ module.exports = function(strapi) {
const changeRequired = definition.client === 'pg'
? `ALTER COLUMN ${quote}${attribute}${quote} ${attributes[attribute].required ? 'SET' : 'DROP'} NOT NULL`
: `CHANGE ${quote}${attribute}${quote} ${quote}${attribute}${quote} ${type} ${attributes[attribute].required ? 'NOT' : ''} NULL`;
-
await ORM.knex.raw(`ALTER TABLE ${quote}${table}${quote} ${changeType}`);
await ORM.knex.raw(`ALTER TABLE ${quote}${table}${quote} ${changeRequired}`);
}
@@ -631,10 +635,10 @@ module.exports = function(strapi) {
if (morphRelations) {
const attributes = {
[`${loadedModel.tableName}_id`]: {
- type: 'integer'
+ type: definition.primaryKeyType
},
[`${morphRelations.alias}_id`]: {
- type: 'integer'
+ type: definition.primaryKeyType
},
[`${morphRelations.alias}_type`]: {
type: 'text'
@@ -661,10 +665,10 @@ module.exports = function(strapi) {
const attributes = {
[`${pluralize.singular(manyRelations.collection)}_id`]: {
- type: 'integer'
+ type: definition.primaryKeyType
},
[`${pluralize.singular(definition.globalId.toLowerCase())}_id`]: {
- type: 'integer'
+ type: definition.primaryKeyType
}
};
@@ -999,7 +1003,7 @@ module.exports = function(strapi) {
cb();
},
- getQueryParams: (value, type, key) => {
+ getQueryParams: (value, type, key) =>{
const result = {};
switch (type) {
@@ -1046,18 +1050,18 @@ module.exports = function(strapi) {
};
break;
case '_sort':
- result.key = `sort`;
+ result.key = 'sort';
result.value = {
key,
order: value.toUpperCase()
};
break;
case '_start':
- result.key = `start`;
+ result.key = 'start';
result.value = parseFloat(value);
break;
case '_limit':
- result.key = `limit`;
+ result.key = 'limit';
result.value = parseFloat(value);
break;
case '_contains':
diff --git a/packages/strapi-plugin-content-manager/admin/src/translations/de.json b/packages/strapi-plugin-content-manager/admin/src/translations/de.json
index c771c16643..48e0430f9f 100644
--- a/packages/strapi-plugin-content-manager/admin/src/translations/de.json
+++ b/packages/strapi-plugin-content-manager/admin/src/translations/de.json
@@ -1,6 +1,6 @@
{
- "plugin.description.short": "Greife blitzschnell auf alle Daten in der Datenbank zu und manipuliere sie.",
- "plugin.description.long": "Greife blitzschnell auf alle Daten in der Datenbank zu und manipuliere sie.",
+ "plugin.description.short": "Greife blitzschnell auf alle Daten in der Datenbank zu und änder sie.",
+ "plugin.description.long": "Greife blitzschnell auf alle Daten in der Datenbank zu und änder sie.",
"containers.Home.pluginHeaderTitle": "Inhalts-Manager",
"containers.Home.introduction": "Um deine Einträge zu verwalten, klicke auf den entsprechenden Link im Menü links. Dieses Plugin ist noch in aktiver Entwicklung und seine Einstellungen können nicht optimal angepasst werden.",
@@ -24,7 +24,7 @@
"containers.SettingsPage.Block.generalSettings.description": "Konfiguriere die Standardoptionen für deine Inhaltstypen.",
"containers.SettingsPage.Block.generalSettings.title" : "Allgemeines",
"containers.SettingsPage.Block.contentType.title": "Inhaltstypen",
- "containers.SettingsPage.Block.contentType.description": "Konfiguriere die spezifischen Einstellungen",
+ "containers.SettingsPage.Block.contentType.description": "Konfiguriere die spezifischen Einstellungen.",
"containers.SettingsPage.pluginHeaderDescription": "Konfigurieren Sie die Standardeinstellungen für alle Ihre Inhaltstypen.",
"components.AddFilterCTA.add": "Filter",
diff --git a/packages/strapi-plugin-content-type-builder/admin/src/containers/Form/forms.json b/packages/strapi-plugin-content-type-builder/admin/src/containers/Form/forms.json
index 13c8467ec6..af00853d4e 100644
--- a/packages/strapi-plugin-content-type-builder/admin/src/containers/Form/forms.json
+++ b/packages/strapi-plugin-content-type-builder/admin/src/containers/Form/forms.json
@@ -2,18 +2,6 @@
"contentType": {
"baseSettings": {
"items": [
- {
- "label": {
- "id": "content-type-builder.form.contentType.item.connections"
- },
- "name": "connection",
- "type": "select",
- "value": "default",
- "items": [{}],
- "validations": {
- "required": true
- }
- },
{
"label": {
"id": "content-type-builder.form.contentType.item.name"
@@ -45,6 +33,18 @@
}
}
},
+ {
+ "label": {
+ "id": "content-type-builder.form.contentType.item.connections"
+ },
+ "name": "connection",
+ "type": "select",
+ "value": "default",
+ "items": [{}],
+ "validations": {
+ "required": true
+ }
+ },
{
"label": {
"id": "content-type-builder.form.contentType.item.description"
diff --git a/packages/strapi-plugin-content-type-builder/admin/src/containers/Form/index.js b/packages/strapi-plugin-content-type-builder/admin/src/containers/Form/index.js
index c0513dfa95..390b17bf66 100644
--- a/packages/strapi-plugin-content-type-builder/admin/src/containers/Form/index.js
+++ b/packages/strapi-plugin-content-type-builder/admin/src/containers/Form/index.js
@@ -514,12 +514,9 @@ export class Form extends React.Component { // eslint-disable-line react/prefer-
}
renderModalBodyChooseAttributes = () => {
- const attributesDisplay = forms.attributesDisplay.items;
-
- // Don't display the media field if the upload plugin isn't installed
- if (!has(this.context.plugins.toJS(), 'upload')) {
- attributesDisplay.splice(8, 1);
- }
+ const attributesDisplay = has(this.context.plugins.toJS(), 'upload')
+ ? forms.attributesDisplay.items
+ : forms.attributesDisplay.items.filter(obj => obj.type !== 'media'); // Don't display the media field if the upload plugin isn't installed
return (
map(attributesDisplay, (attribute, key) => (
diff --git a/packages/strapi-plugin-graphql/services/GraphQL.js b/packages/strapi-plugin-graphql/services/GraphQL.js
index eb911fae2b..12444bf3d4 100644
--- a/packages/strapi-plugin-graphql/services/GraphQL.js
+++ b/packages/strapi-plugin-graphql/services/GraphQL.js
@@ -630,7 +630,8 @@ module.exports = {
};
if (association.type === 'model') {
- params.id = obj[association.alias];
+ const rel = obj[association.alias];
+ params.id = typeof rel === 'object' && 'id' in rel ? rel.id : rel;
} else {
// Get refering model.
const ref = association.plugin ?
diff --git a/packages/strapi-plugin-upload/admin/src/translations/de.json b/packages/strapi-plugin-upload/admin/src/translations/de.json
index e0b03b6caa..75c6e44d12 100644
--- a/packages/strapi-plugin-upload/admin/src/translations/de.json
+++ b/packages/strapi-plugin-upload/admin/src/translations/de.json
@@ -13,8 +13,8 @@
"EntriesNumber.number": "{number} Datei gefunden",
"EntriesNumber.number.plural": "{number} Dateien gefunden",
- "HomePage.title": "Hochladen",
- "HomePage.description": "Übersicht über alle hochgeladenen Dateien",
+ "HomePage.title": "Dateien hochladen",
+ "HomePage.description": "Übersicht über alle hochgeladenen Dateien.",
"HomePage.InputSearch.placeholder": "Suche nach einer Datei...",
"Li.linkCopied": "Link in die Zwischenablage kopiert",
diff --git a/packages/strapi-plugin-users-permissions/admin/src/containers/AuthPage/actions.js b/packages/strapi-plugin-users-permissions/admin/src/containers/AuthPage/actions.js
index 53d0a91bce..b9e70f52be 100644
--- a/packages/strapi-plugin-users-permissions/admin/src/containers/AuthPage/actions.js
+++ b/packages/strapi-plugin-users-permissions/admin/src/containers/AuthPage/actions.js
@@ -50,7 +50,7 @@ export function setForm(formType, email) {
data = {
identifier: '',
password: '',
- rememberMe: false,
+ rememberMe: true,
};
break;
@@ -60,7 +60,7 @@ export function setForm(formType, email) {
password: '',
confirmPassword: '',
email: '',
- news: true,
+ news: false,
};
break;
case 'register-success':
diff --git a/packages/strapi-plugin-users-permissions/admin/src/containers/AuthPage/form.json b/packages/strapi-plugin-users-permissions/admin/src/containers/AuthPage/form.json
index 075de9f189..08a23dbdc2 100644
--- a/packages/strapi-plugin-users-permissions/admin/src/containers/AuthPage/form.json
+++ b/packages/strapi-plugin-users-permissions/admin/src/containers/AuthPage/form.json
@@ -80,7 +80,7 @@
},
"name": "news",
"type": "checkbox",
- "value": true
+ "value": false
}
],
"register-success": [
diff --git a/packages/strapi-plugin-users-permissions/admin/src/translations/de.json b/packages/strapi-plugin-users-permissions/admin/src/translations/de.json
index 60ed4e4b33..4e304d04a4 100755
--- a/packages/strapi-plugin-users-permissions/admin/src/translations/de.json
+++ b/packages/strapi-plugin-users-permissions/admin/src/translations/de.json
@@ -89,8 +89,8 @@
"HeaderNav.link.providers": "Methoden",
"HeaderNav.link.roles": "Rollen",
- "HomePage.header.title": "Benutzer & Befugnisse",
- "HomePage.header.description": "Lege Rollen und deren Befugnisse fest",
+ "HomePage.header.title": "Benutzer & Berechtigungen",
+ "HomePage.header.description": "Lege Rollen und deren Berechtigungen fest.",
"InputSearch.placeholder": "Suche nach einem Benutzer",
diff --git a/packages/strapi-plugin-users-permissions/admin/src/translations/en.json b/packages/strapi-plugin-users-permissions/admin/src/translations/en.json
index dee0fad455..e2b42f95f4 100755
--- a/packages/strapi-plugin-users-permissions/admin/src/translations/en.json
+++ b/packages/strapi-plugin-users-permissions/admin/src/translations/en.json
@@ -43,8 +43,9 @@
"Auth.form.error.code.provide": "Incorrect code provided.",
"Auth.form.error.password.matching": "Passwords do not match.",
"Auth.form.error.params.provide": "Incorrect params provided.",
- "Auth.form.error.username.taken": "Username is already taken",
- "Auth.form.error.email.taken": "Email is already taken",
+ "Auth.form.error.username.taken": "Username is already taken.",
+ "Auth.form.error.email.taken": "Email is already taken.",
+ "Auth.form.error.blocked": "Your account has been blocked by the administrator.",
"Auth.form.error.ratelimit": "Too many attempts, please try again in a minute.",
"Auth.link.forgot-password": "Forgot your password?",
diff --git a/packages/strapi-plugin-users-permissions/config/policies/permissions.js b/packages/strapi-plugin-users-permissions/config/policies/permissions.js
index 11aa925a61..230e6ccc74 100644
--- a/packages/strapi-plugin-users-permissions/config/policies/permissions.js
+++ b/packages/strapi-plugin-users-permissions/config/policies/permissions.js
@@ -23,6 +23,10 @@ module.exports = async (ctx, next) => {
if (role.type === 'root') {
return await next();
}
+
+ if (ctx.state.user.blocked === true) {
+ return ctx.unauthorized(`Your account has been blocked by the administrator.`);
+ }
}
// Retrieve `public` role.
if (!role) {
diff --git a/packages/strapi-plugin-users-permissions/controllers/Auth.js b/packages/strapi-plugin-users-permissions/controllers/Auth.js
index a97a9df50d..1744e6d78e 100644
--- a/packages/strapi-plugin-users-permissions/controllers/Auth.js
+++ b/packages/strapi-plugin-users-permissions/controllers/Auth.js
@@ -52,6 +52,10 @@ module.exports = {
// Check if the user exists.
const user = await strapi.query('user', 'users-permissions').findOne(query, ['role']);
+ if (user.blocked === true) {
+ return ctx.badRequest(null, ctx.request.admin ? [{ messages: [{ id: 'Auth.form.error.blocked' }] }] : 'Your account has been blocked by the administrator.');
+ }
+
if (!user) {
return ctx.badRequest(null, ctx.request.admin ? [{ messages: [{ id: 'Auth.form.error.invalid' }] }] : 'Identifier or password invalid.');
}
diff --git a/packages/strapi-plugin-users-permissions/models/User.settings.json b/packages/strapi-plugin-users-permissions/models/User.settings.json
index da72db76e3..bc588c5255 100644
--- a/packages/strapi-plugin-users-permissions/models/User.settings.json
+++ b/packages/strapi-plugin-users-permissions/models/User.settings.json
@@ -33,6 +33,11 @@
"configurable": false,
"private": true
},
+ "blocked": {
+ "type": "boolean",
+ "default": false,
+ "configurable": false
+ },
"role": {
"model": "role",
"via": "users",