Skip to content

Commit

Permalink
Merge branch 'master' into gautamsi/tinymce
Browse files Browse the repository at this point in the history
  • Loading branch information
JedWatson committed Feb 26, 2019
2 parents eceade9 + ae15171 commit 96ef340
Show file tree
Hide file tree
Showing 40 changed files with 469 additions and 288 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ We've been working on a major update to KeystoneJS. Keystone 4 is a complete reb

Improvements include:

* The Admin UI has been re-written as a single page app using React.js, Redux, and Elemental UI
* The Admin UI has been re-written as a single page app using [React.js](https://reactjs.org), [Redux](https://redux.js.org/), and [Elemental UI](http://elemental-ui.com/)
* An updated API for Lists and Fields
* Better support for using Keystone without Express, or with your own express instance
* Core functionality has been refactored and we're breaking Keystone up into separate npm packages
Expand Down Expand Up @@ -58,7 +58,7 @@ $ yo keystone

Answer the questions, and the generator will create a new project based on the options you select, and install the required packages from **npm**.

Alternatively, to include Keystone in an existing project or start from scratch (without Yeoman), specify `keystone: "4.0.0-rc.1"` in the `dependencies` array of your `package.json` file, and run `npm install` from your terminal.
Alternatively, to include Keystone in an existing project or start from scratch (without Yeoman), specify `keystone: "4.0.0"` in the `dependencies` array of your `package.json` file, and run `npm install` from your terminal.

Then read through the [Documentation](https://keystonejs.com/documentation) and the [Example Projects](http://v3.keystonejs.com/examples) to understand how to use it.

Expand Down
1 change: 0 additions & 1 deletion admin/client/App/elemental/FormInput/noedit.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ const classes = {
borderWidth: theme.input.border.width,
color: theme.color.gray80,
display: 'inline-block',
height: theme.input.height,
lineHeight: theme.input.lineHeight,
padding: `0 ${theme.input.paddingHorizontal}`,
transition: 'border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s',
Expand Down
2 changes: 1 addition & 1 deletion admin/client/App/screens/Item/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ export function deleteItem (id, router) {
}
// TODO Proper error handling
if (err) {
alert('Error deleting item, please try again!');
alert(err.error || 'Error deleting item, please try again!');
} else {
dispatch(loadItems());
}
Expand Down
3 changes: 2 additions & 1 deletion admin/client/App/screens/List/components/ListManagement.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ function ListManagement ({
glyph="trashcan"
onClick={handleDelete}
position="left"
variant="link">
variant="link"
alt="delete">
Delete
</GlyphButton>
</Section>
Expand Down
3 changes: 2 additions & 1 deletion admin/server/api/list/delete.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ module.exports = function (req, res) {
deletedIds.push(item.id);
next();
});
}, function () {
}, function (err) {
if (err) return res.apiError(err);
return res.json({
success: true,
ids: deletedIds,
Expand Down
8 changes: 8 additions & 0 deletions admin/server/api/s3.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ module.exports = {
var file = req.files.file;
var path = s3Config.s3path ? s3Config.s3path + '/' : '';

if (!file.name) {
var extension;
if (file.originalname) {
extension = file.originalname.match(/.*(\..*)/);
}
file.name = file.filename + (extension ? extension[1] : '');
}

var headers = Types.S3File.prototype.generateHeaders.call({ s3config: s3Config, options: {} }, null, file);

var s3Client = knox.createClient(s3Config);
Expand Down
46 changes: 25 additions & 21 deletions docs/Getting Started/Setting-Up/part-1.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,42 @@

## Introduction

If you want to jump right in to a working Keystone codebase, check out our [quick start guide](/getting-started/yo-generator), which walks you through using our generator to get a Keystone codebase up and running quickly. This tutorial will walk you through setting up a project, looking at what the core parts of Keystone are and how to set them up.
If you want to jump right in to a working Keystone codebase, check out the [Quick Start](/getting-started/yo-generator) guide which walks you through using our generator to get a Keystone codebase up and running quickly.

This guide assumes you are familiar with using npm to install packages, and javascript as a language.
This Setting Up tutorial will walk you through setting up a project from scratch, including introducing and configuring the core parts of Keystone.

We're going to be tackling this in three parts.
This guide assumes you are familiar with [using `npm`](https://docs.npmjs.com/getting-started/what-is-npm) to install packages and JavaScript as a programming language.

Part 1 (this one here) will focus on installation and setting up our `keystone.js` file, which launch our app.
We're going to be tackling setting up from scratch in four parts:

[Part 2](/getting-started/setting-up/part-2) will detail building Keystone models and setting up your database.
- **Part 1: Initial Setup** (the page you are reading) starts with installation and setting up a `keystone.js` file to launch your application.

[Part 3](/getting-started/setting-up/part-3) will go through setting up routes with Keystone to serve both database information as well as website pages.
- [Part 2: Data Model Setup](/getting-started/setting-up/part-2) walks you through building your first data model.

[Part 4](/getting-started/setting-up/part-4) will get a us a `POST` endpoint which we can use to post data to.
- [Part 3: Routing](/getting-started/setting-up/part-3) introduces setting up routes with Keystone to serve website pages.

Before we start, make sure you have [node](nodejs.org) and [mongo](https://www.mongodb.com/download-center?jmp=nav#community) installed.
- [Part 4: Adding data from a form](/getting-started/setting-up/part-4) demonstrates how to create a `POST` endpoint for submitting data.

Before getting started, make sure you have [Node.js](nodejs.org) and [MongoDB](https://www.mongodb.com/download-center?jmp=nav#community) installed.

## Installation
Start by creating a new directory and then from within it run `npm init`. This will set us up with a `package.json` for you with the ability to set up some default options.

Start by creating a new directory and then from within it run `npm init`. Follow the prompts to create a default `package.json`.

Next, install Keystone with `npm install --save keystone`.

At this point, we should have a `node_modules` directory and Keystone should have been added to the `package.json`.
At this point, you should have a `node_modules` directory and Keystone should have been added to the `package.json`.

## Initial Setup

Create a new file, `keystone.js` and we're ready to start configuring Keystone.
Create a new file, `keystone.js`, and you'll be ready to start configuring Keystone.

Your `keystone.js` file is the launch file for Keystone, which will connect Keystone to your database, start the database connection, and start your server running. This is where we will be adding configuration options to Keystone as well, which allow us to change how Keystone is running.
`keystone.js` file is the launch file for Keystone: it defines general configuration options, initialises Keystone, and starts your application server.

The minimum file we need to start Keystone running is:

```javascript
var keystone = require('Keystone');
var keystone = require('keystone');

keystone.init({
'cookie secret': 'secure string goes here',
Expand All @@ -43,29 +46,30 @@ keystone.init({
keystone.start();
```

First we require Keystone, then we run `keystone.init()`. This function sets up Keystone's initial starting values. Here we are only providing it a cookie secret, however as we build up our application we are going to come back and add more options here. If you want to check out the full list of options, you can find them [here](/documentation/configuration).
Your `keystone.js` needs to require `keystone` and then run the `keystone.init()` function to set up Keystone's initial values.

A `cookie secret` is the only option that is technically required to launch Keystone, however we'll be fleshing this out as we complete our setup.
In this example we are only providing a `cookie secret`. Technically this is the only non-default option that is required to launch Keystone, however as you complete this tutorial you will be adding more options.

Finally, we call `keystone.start()`, which kicks off our Keystone app.
Finally, we call `keystone.start()`, which kicks off the Keystone app.

We can now check this runs. Run `node keystone.js` and you should be greeted with:
You can now check this runs. Run `node keystone.js` and you should be greeted with:

```sh
------------------------------------------------
KeystoneJS Started:
KeystoneJS v4.0.0 started:
Keystone is ready on http://0.0.0.0:3000
------------------------------------------------
```

You should get a 404 page. That's ok! That will be resolved in [part 3](/getting-started/setting-up/part-3) of this guide. In [Part 2](/getting-started/setting-up/part-2) we are going to focus on getting the database connected, and the admin UI up and running. You can do these two in either order.
You should get a 404 page. That's expected since there are no pages set up yet.

## Next Steps
Check out [part 2](/getting-started/setting-up/part-2) of this guide, which walks you through setting up your database, or if you want to read more about any of the parts we set up, you can check out these links:

This tutorial continues in [Part 2: Data Model Setup](/getting-started/setting-up/part-2), which walks you through setting up your first data model.


## Learn more about:

- [keystone.init](/api/methods/init)
- [keystone.start](/api/methods/start)
- [keystone setup configuration](/documentation/configuration)
- [Keystone Setup Options](/documentation/configuration)
Loading

0 comments on commit 96ef340

Please sign in to comment.