Merge branch 'master' into master

This commit is contained in:
cesare grigoletto 2018-04-16 08:53:00 +02:00 committed by GitHub
commit ea284ae96e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 287 additions and 43 deletions

View File

@ -139,14 +139,14 @@ In order to do so, you'll need to allow access to other users (identified as 'Gu
To retrieve the list of products, use the `GET /your-content-type` route.
Generated APIs provide a handy way to filter and order queries. In that way, ordering products by price is as easy as `GET http://localhost:1337/product?_order=price:asc`. For more informations, read the [filters documentation](../guides/filters.md)
Generated APIs provide a handy way to filter and order queries. In that way, ordering products by price is as easy as `GET http://localhost:1337/product?_sort=price:asc`. For more informations, read the [filters documentation](../guides/filters.md)
Here is an example using jQuery.
```js
$.ajax({
type: 'GET',
url: 'http://localhost:1337/product?_order=price:asc', // Order by price.
url: 'http://localhost:1337/product?_sort=price:asc', // Order by price.
done: function(products) {
console.log('Well done, here is the list of products: ', products);
},

View File

@ -185,7 +185,7 @@ export default FooPage;
***
## Input
## InputsIndex
Strapi provides a built-in input library which includes :
- All kind of inputs
@ -193,7 +193,6 @@ Strapi provides a built-in input library which includes :
- Error highlight
- i18n
> This component is likely to be deprecated in favor of InputsWithIndex
### Usage
@ -202,6 +201,7 @@ Strapi provides a built-in input library which includes :
| `addon` | string | no | Allows to add a string addon in your input, based on [Bootstrap](https://v4-alpha.getbootstrap.com/components/input-group/#basic-example). Ex: `<Input {...this.props} addon="@" />` |
| `addRequiredInputDesign` | bool | no | Allows to add an asterix on the input. Ex: `<Input {...this.props} addRequiredInputDesign />` |
| `customBootstrapClass` | string | no | Allows to override the input bootstrap col system. Ex: `<Input {...this.props} customBootstrapClass="col-md-6 offset-md-6 pull-md-6" />` |
| customInputs | Object | no | Allows to add a new input type |
| `deactivateErrorHighlight` | bool | no | Prevents from displaying error highlight in the input: Ex: `<Input {...this.props} deactivateErrorHighlight />` |
| `didCheckErrors` | bool | no | Use this props to display errors after submitting a form. Ex: `<Input {...this.props} didCheckErrors={this.state.error} />` |
| `disabled` | bool | no | Disable the input. Ex: `<Input {...this.props} disabled />` |
@ -228,7 +228,15 @@ Strapi provides a built-in input library which includes :
import React from 'react';
// Make sure you don't have a component called Input inside your ./components folder
// It will import the one in your components folder instead.
import Input from 'components/Input';
import Input from 'components/InputsIndex';
const CustomInput = (props) => {
return (
<div>
Some custom input
</div>
);
}
class FooPage extends React.Component {
constructor(props) {
@ -256,17 +264,32 @@ class FooPage extends React.Component {
}
render() {
const inputs = [
{
label: 'This is a string input',
name: 'foo',
type: 'string',
validations: { required: true },
value: this.state.data.foo,
},
{
label: 'This is a custom input',
name: 'custom',
type: 'newType',
validations: {},
value: '',
}
]
return (
<div className={styles.fooPage}>
<Input
type="string"
value={this.state.data.foo}
label="This is a string input"
name="foo"
onChange={this.handleChange}
validations={{ required: true }}
didCheckErrors={this.state.error}
/>
{inputs.map(input => (
<Input
key={input.name}
didCheckErrors={this.state.error}
onChange={this.handleChange}
{...input}
/>
))}
</div>
);
}

View File

@ -6,6 +6,7 @@
import React from 'react';
import { defineMessages, FormattedMessage } from 'react-intl';
import { PropTypes } from 'prop-types';
import LocaleToggle from 'containers/LocaleToggle';
@ -13,15 +14,19 @@ import styles from './styles.scss';
import messages from './messages.json';
defineMessages(messages);
class LeftMenuFooter extends React.Component { // eslint-disable-line react/prefer-stateless-function
render() {
return (
<div className={styles.leftMenuFooter}>
<FormattedMessage {...messages.poweredBy} /> <a href="http://strapi.io" target="_blank">Strapi</a>
<LocaleToggle />
</div>
);
}
function LeftMenuFooter({ version }) { // eslint-disable-line react/prefer-stateless-function
return (
<div className={styles.leftMenuFooter}>
<FormattedMessage {...messages.poweredBy} />
<a href="http://strapi.io" target="_blank"> Strapi</a>
<span>&nbsp;(v{version})</span>
<LocaleToggle />
</div>
);
}
LeftMenuFooter.propTypes = {
version: PropTypes.string.isRequired,
};
export default LeftMenuFooter;

View File

@ -8,6 +8,7 @@ import {
GET_GA_STATUS_SUCCEEDED,
GET_LAYOUT,
GET_LAYOUT_SUCCEEDED,
GET_STRAPI_VERSION_SUCCEEDED,
} from './constants';
export function getGaStatus() {
@ -35,3 +36,10 @@ export function getLayoutSucceeded(layout) {
layout,
};
}
export function getStrapiVersionSucceeded(strapiVersion) {
return {
type: GET_STRAPI_VERSION_SUCCEEDED,
strapiVersion,
};
}

View File

@ -8,3 +8,4 @@ export const GET_GA_STATUS = 'app/Admin/GET_GA_STATUS';
export const GET_GA_STATUS_SUCCEEDED = 'app/Admin/GET_GA_STATUS_SUCCEEDED';
export const GET_LAYOUT = 'app/Admin/GET_LAYOUT';
export const GET_LAYOUT_SUCCEEDED = 'app/Admin/GET_LAYOUT_SUCCEEDED';
export const GET_STRAPI_VERSION_SUCCEEDED = 'app/Admin/GET_STRAPI_VERSION_SUCCEEDED';

View File

@ -137,13 +137,19 @@ export class AdminPage extends React.Component { // eslint-disable-line react/pr
showLeftMenu = () => !includes(this.props.location.pathname, 'users-permissions/auth/');
render() {
const leftMenu = this.showLeftMenu() ? <LeftMenu plugins={this.props.plugins} layout={this.props.adminPage.layout} /> : '';
const { adminPage } = this.props;
const header = this.showLeftMenu() ? <Header /> : '';
const style = this.showLeftMenu() ? {} : { width: '100%' };
return (
<div className={styles.adminPage}>
{leftMenu}
{this.showLeftMenu() && (
<LeftMenu
plugins={this.props.plugins}
layout={adminPage.layout}
version={adminPage.strapiVersion}
/>
)}
{ auth.getToken() && this.props.hasUserPlugin && this.isUrlProtected(this.props) ? (
<Logout />
) : ''}

View File

@ -6,11 +6,16 @@
import { fromJS, Map } from 'immutable';
import { GET_GA_STATUS_SUCCEEDED, GET_LAYOUT_SUCCEEDED } from './constants';
import {
GET_GA_STATUS_SUCCEEDED,
GET_LAYOUT_SUCCEEDED,
GET_STRAPI_VERSION_SUCCEEDED,
} from './constants';
const initialState = fromJS({
allowGa: true,
layout: Map({}),
strapiVersion: '3',
});
function adminPageReducer(state = initialState, action) {
@ -19,6 +24,8 @@ function adminPageReducer(state = initialState, action) {
return state.update('allowGa', () => action.allowGa);
case GET_LAYOUT_SUCCEEDED:
return state.update('layout', () => Map(action.layout));
case GET_STRAPI_VERSION_SUCCEEDED:
return state.update('strapiVersion', () => action.strapiVersion);
default:
return state;
}

View File

@ -1,13 +1,23 @@
import { take } from 'lodash';
import { fork, call, put, takeLatest } from 'redux-saga/effects';
import request from 'utils/request';
import { getGaStatusSucceeded, getLayoutSucceeded } from './actions';
import {
getGaStatusSucceeded,
getLayoutSucceeded,
getStrapiVersionSucceeded,
} from './actions';
import { GET_GA_STATUS, GET_LAYOUT } from './constants';
function* getGaStatus() {
try {
const response = yield call(request, '/admin/gaConfig', { method: 'GET' });
yield put(getGaStatusSucceeded(response.allowGa));
const [allowGa, strapiVersion] = yield [
call(request, '/admin/gaConfig', { method: 'GET' }),
call(request, '/admin/strapiVersion', { method: 'GET' }),
];
yield put(getGaStatusSucceeded(allowGa));
const version = take(`${strapiVersion.strapiVersion.split('.')[0]}${strapiVersion.strapiVersion.split('alpha')[1]}`, 4).join('');
yield put(getStrapiVersionSucceeded(version));
} catch(err) {
strapi.notification.error('notification.error');
}

View File

@ -141,7 +141,7 @@ export class HomePage extends React.PureComponent {
{FIRST_BLOCK.map((value, key) => (
<Sub key={key} {...value} underline={key === 0} bordered={key === 0} />
))}
<a href="https://strapi.io/getting-started" target="_blank">
<a href="https://strapi.io/documentation/getting-started/quick-start.html" target="_blank">
<Button className={styles.homePageTutorialButton} primary>
<FormattedMessage id="app.components.HomePage.button.quickStart" />
</Button>

View File

@ -18,16 +18,21 @@ export class LeftMenu extends React.Component { // eslint-disable-line react/pre
render() {
return (
<div className={styles.leftMenu}>
<LeftMenuHeader></LeftMenuHeader>
<LeftMenuLinkContainer {...this.props}></LeftMenuLinkContainer>
<LeftMenuFooter plugins={this.props.plugins}></LeftMenuFooter>
<LeftMenuHeader />
<LeftMenuLinkContainer {...this.props} />
<LeftMenuFooter plugins={this.props.plugins} version={this.props.version} />
</div>
);
}
}
LeftMenu.defaultProps = {
version: '3',
};
LeftMenu.propTypes = {
plugins: PropTypes.object.isRequired,
version: PropTypes.string,
};
function mapDispatchToProps(dispatch) {

View File

@ -0,0 +1,160 @@
{
"app.components.Button.save": "Сохранить",
"app.components.Button.cancel": "Отменить",
"app.components.ComingSoonPage.comingSoon": "Скоро",
"app.components.ComingSoonPage.featuresNotAvailable": "Этот функционал все еще находится в стадии активной разработки.",
"app.components.DownloadInfo.download": "Выполняется загрузка...",
"app.components.DownloadInfo.text": "Это может занять около минуты. Спасибо за ваше терпение.",
"app.components.HomePage.welcome": "Добро пожаловать!",
"app.components.HomePage.cta": "ПОДТВЕРДИТЬ",
"app.components.HomePage.community": "Найти сообщество в интернете",
"app.components.HomePage.newsLetter": "Подпишитесь на рассылку, чтобы быть в курсе новостей о Strapi",
"app.components.HomePage.community.content": "Обсудите с членами команды и разработчиками в разных каналах",
"app.components.HomePage.create": "Создайте ваш первый Тип Контента",
"app.components.HomePage.welcomeBlock.content": "Мы рады, что вы вступили в сообщество. Нам необходима обратная связь для развития проекта, поэтому не стесняйтесь писать нам\u0020",
"app.components.HomePage.welcomeBlock.content.issues": "проблема.",
"app.components.HomePage.welcomeBlock.content.raise": "\u0020или поднять\u0020",
"app.components.HomePage.createBlock.content.first": "\u0020",
"app.components.HomePage.createBlock.content.second": "\u0020плагин поможет вам создать структуру ваших данных. Если вы новичок, мы настоятельно рекомендуем вам следить за нашими\u0020",
"app.components.HomePage.createBlock.content.tutorial": "\u0020руководство.",
"app.components.HomePage.button.quickStart": "ОЗНАКОМТЕСЬ С РУКОВОДСТВОМ ПО БЫСТРОМУ СТАРТУ",
"app.components.HomePage.support": "ПОДДЕРЖИТЕ НАС",
"app.components.HomePage.support.content": "Купите футболку (25€), это поможет нам продолжать работу над проектом, чтобы предоставить вам наилучшее из возможных решений!",
"app.components.HomePage.support.link": "ЗАКАЗАТЬ НАШУ ФУТБОЛКУ СЕЙЧАС",
"app.components.BlockLink.documentation": "Прочитать документацию",
"app.components.BlockLink.documentation.content": "Ознакомтесь с концепциями, документацией и обучающими материалами.",
"app.components.BlockLink.code": "Примеры кода",
"app.components.BlockLink.code.content": "Обучайтесь на реальных проектах разработанных в сообществе.",
"app.components.InputFile.newFile": "Добавить новый файл",
"app.components.InputFileDetails.open": "Открыть в новой вкладке",
"app.components.InputFileDetails.remove": "Удалить этот файл",
"app.components.InputFileDetails.originalName": "Первоначальное название:",
"app.components.InputFileDetails.size": "Размер:",
"app.components.ImgPreview.hint": "Перетащите файл в эту область или {browse} для загрузки файла",
"app.components.ImgPreview.hint.browse": "просмотреть",
"app.components.InstallPluginPage.helmet": "Магазин - Плагины",
"app.components.InstallPluginPage.title": "Магазин - Плагины",
"app.components.InstallPluginPage.description": "Расширяйте ваше приложение без усилий.",
"app.components.InstallPluginPage.plugin.support-us.description": "Поддержите нас купив футболку Strapi. Это поможет нам продолжать работу над проектом, чтобы предоставить вам наилучшее из возможных решений!",
"app.components.InstallPluginPage.InputSearch.label": " ",
"app.components.InstallPluginPage.InputSearch.placeholder": "Искать плагин... (ex: authentication)",
"app.components.InstallPluginPopup.downloads": "скачать",
"app.components.InstallPluginPopup.navLink.description": "Описание",
"app.components.InstallPluginPopup.navLink.screenshots": "Скриншоты",
"app.components.InstallPluginPopup.navLink.avis": "avis",
"app.components.InstallPluginPopup.navLink.faq": "faq",
"app.components.InstallPluginPopup.navLink.changelog": "журнал изменений",
"app.components.InstallPluginPopup.noDescription": "Нет описания",
"app.components.LeftMenuFooter.poweredBy": "С гордостью предоставлено",
"app.components.LeftMenuLinkContainer.configuration": "Настройки",
"app.components.LeftMenuLinkContainer.general": "Общие",
"app.components.LeftMenuLinkContainer.installNewPlugin": "Магазин",
"app.components.LeftMenuLinkContainer.listPlugins": "Плагины",
"app.components.LeftMenuLinkContainer.noPluginsInstalled": "Нет установленых плагинов",
"app.components.LeftMenuLinkContainer.plugins": "Плагины",
"app.components.ListPluginsPage.helmet.title": "Список плагинов",
"app.components.ListPluginsPage.title": "Плагины",
"app.components.ListPluginsPage.description": "Список установленых плагинов.",
"app.components.listPluginsPage.deletePlugin.error": "Возникла ошибка при установке плагина",
"app.components.listPlugins.title.singular": "{number} плагин установлен",
"app.components.listPlugins.title.plural": "{number} плагинов установленно",
"app.components.listPlugins.title.none": "Нет установленых плагинов",
"app.components.listPlugins.button": "Добавить новый плагин",
"app.components.NotFoundPage.description": "Не найдено",
"app.components.NotFoundPage.back": "Вернуться на главную",
"app.components.Official": "Официальный",
"app.components.PluginCard.compatible": "Совместимо с вашим приложением",
"app.components.PluginCard.compatibleCommunity": "Совместимо с сообществом",
"app.components.PluginCard.Button.label.download": "Скачать",
"app.components.PluginCard.Button.label.install": "Уже становленно",
"app.components.PluginCard.Button.label.support": "Поддержать нас",
"app.components.PluginCard.price.free": "Бесплатно",
"app.components.PluginCard.more-details": "Больше деталей",
"app.utils.placeholder.defaultMessage": "\u0020",
"app.utils.SelectOption.defaultMessage": "\u0020",
"app.utils.defaultMessage": "\u0020",
"components.AutoReloadBlocker.header": "Функционал перезапуска необходим для этого плагина.",
"components.AutoReloadBlocker.description": "Откройте соответствующий файл и активируйте функционал.",
"components.ErrorBoundary.title": "Что-то пошло не так...",
"components.OverlayBlocker.title": "Ожидание перезапуска...",
"components.OverlayBlocker.description": "Вы воспользовались функционалом который требует перезапуска сервера. Пожалуста подождете пока подниметься сервер.",
"components.PageFooter.select": "записей на странице",
"components.ProductionBlocker.header": "Этот плагин доступен только на стадии разработки.",
"components.ProductionBlocker.description": "Для безопасности мы должны заблокировать его для других вариантов.",
"components.popUpWarning.button.cancel": "Отменить",
"components.popUpWarning.button.confirm": "Подтвердить",
"components.popUpWarning.title": "Пожалуйста подтвердите",
"components.popUpWarning.message": "Вы уверены, что хотите удалить это?",
"components.Input.error.validation.email": "Это не адрес электронной почты",
"components.Input.error.validation.required": "Необходимое поле для заполнение.",
"components.Input.error.validation.regex": "Не соответствует регулярному выражению.",
"components.Input.error.validation.max": "Слишком большое.",
"components.Input.error.validation.min": "Слишком маленькое.",
"components.Input.error.validation.maxLength": "Слишком длинное.",
"components.Input.error.validation.minLength": "Слишком короткое.",
"components.Input.error.contentTypeName.taken": "Это имя уже существует",
"components.Input.error.attribute.taken": "Поле имени уже существует",
"components.Input.error.attribute.key.taken": "Это значение уже существует",
"components.Input.error.attribute.sameKeyAndName": "Не может быть одинаковым",
"components.Input.error.validation.minSupMax": "Не может быть выше",
"components.Input.error.custom-error": "{errorMessage} ",
"components.ListRow.empty": "Нет данных для отображения.",
"components.Wysiwyg.collapse": "Свернуть",
"components.Wysiwyg.selectOptions.title": "Добавить заголовок",
"components.Wysiwyg.selectOptions.H1": "Заголовок H1",
"components.Wysiwyg.selectOptions.H2": "Заголовок H2",
"components.Wysiwyg.selectOptions.H3": "Заголовок H3",
"components.Wysiwyg.selectOptions.H4": "Заголовок H4",
"components.Wysiwyg.selectOptions.H5": "Заголовок H5",
"components.Wysiwyg.selectOptions.H6": "Заголовок H6",
"components.Wysiwyg.ToggleMode.markdown": "Переключить в режим markdown",
"components.Wysiwyg.ToggleMode.preview": "Переключить в режим предпросмотра",
"components.WysiwygBottomControls.charactersIndicators": "букв",
"components.WysiwygBottomControls.uploadFiles": "Перетащите файлы в эту область, добавляйте из буфер обмена или {browse}.",
"components.WysiwygBottomControls.uploadFiles.browse": "выделите их",
"components.WysiwygBottomControls.fullscreen": "Развернуть",
"HomePage.notification.newsLetter.success": "Успешная подписка на рассылку новостей",
"notification.error": "Произошла ошибка",
"notification.error.layout": "Не удалось получить макет",
"Users & Permissions": "Пользователи & Доступы",
"Content Manager": "Редактор контента",
"Content Type Builder": "Конструктор Типов Контента",
"Settings Manager": "Менеджер Настроек",
"Email": "Email",
"Password": "Пароль",
"Username": "Имя пользователя",
"Provider": "Провайдер",
"ResetPasswordToken": "Сбросить токен пароля",
"Role": "Роль",
"New entry": "Новая запись",
"request.error.model.unknow": "Модель данных не существует",
"Users": "Пользователи",
"Analytics": "Аналитика"
}

View File

@ -20,6 +20,12 @@
"handler": "Admin.getGaConfig",
"policies": []
},
{
"method": "GET",
"path": "/strapiVersion",
"handler": "Admin.getStrapiVersion",
"policies": []
},
{
"method": "GET",
"path": "/layout",

View File

@ -17,6 +17,15 @@ module.exports = {
}
},
getStrapiVersion: async ctx => {
try {
const strapiVersion = _.get(strapi.config, 'info.strapi', null);
return ctx.send({ strapiVersion });
} catch(err) {
return ctx.badRequest(null, [{ messages: [{ id: 'The version is not available' }] }]);
}
},
getGaConfig: async ctx => {
try {
const allowGa = _.get(strapi.config, 'info.customs.allowGa', true);

View File

@ -48,4 +48,4 @@
"npm": ">= 3.0.0"
},
"license": "MIT"
}
}

View File

@ -6,7 +6,7 @@
/* eslint-disable react/require-default-props */
import React from 'react';
import PropTypes from 'prop-types';
import { isEmpty } from 'lodash';
import { isEmpty, merge } from 'lodash';
import Loadable from 'react-loadable';
// Design
import InputAddonWithErrors from 'components/InputAddonWithErrors';
@ -65,6 +65,8 @@ function InputsIndex(props) {
inputValue = props.value || '';
}
merge(inputs, props.customInputs);
const Input = inputs[type] ? inputs[type] : DefaultInputError;
return <Input {...props} value={inputValue} />;
@ -76,6 +78,7 @@ DefaultInputError.propTypes = {
InputsIndex.defaultProps = {
addon: false,
customInputs: {},
};
InputsIndex.propTypes = {
@ -83,6 +86,7 @@ InputsIndex.propTypes = {
PropTypes.bool,
PropTypes.string,
]),
customInputs: PropTypes.object,
type: PropTypes.string.isRequired,
value: PropTypes.any,
};

View File

@ -32,6 +32,14 @@
"policies": []
}
},
{
"method": "GET",
"path": "/files/count",
"handler": "Upload.count",
"config": {
"policies": []
}
},
{
"method": "GET",
"path": "/files",
@ -48,14 +56,6 @@
"policies": []
}
},
{
"method": "GET",
"path": "/files/count",
"handler": "Upload.count",
"config": {
"policies": []
}
},
{
"method": "GET",
"path": "/search/:id",