Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

corrected FileSystem adapter file mime lookup call #4224

Open
wants to merge 59 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
05ddb7c
List field type WIP
JedWatson Aug 4, 2016
6828e12
Merge branch 'master' into nested-lists
JedWatson Aug 4, 2016
3708c51
Passing nested schema through when creating nested fields
JedWatson Aug 4, 2016
eb1ba3e
Merge branch 'master' into nested-lists
JedWatson Aug 5, 2016
69dd5e9
Adding List field react components & tweaking type
JedWatson Aug 5, 2016
538abb7
Implementing repeating editors for items in List fields
JedWatson Aug 5, 2016
e8cc5fc
Merge branch 'master' into nested-lists
JedWatson Aug 5, 2016
2347e86
Fixing editing issues with nested fields
JedWatson Aug 5, 2016
8519e28
Implementing new inputNamePrefix prop
JedWatson Aug 5, 2016
35d479f
Nested values are always valid for now
JedWatson Aug 5, 2016
1b8ae16
Merge branch 'master' into nested-lists
JedWatson Aug 22, 2016
4dd630b
List Type: adding recursive getData method, thanks @wmertens
JedWatson Aug 22, 2016
83e5520
List Type: Correctly updating nested items with field.updateItem
JedWatson Aug 22, 2016
4cdec8e
List Type: Correctly including each item's id property
JedWatson Aug 22, 2016
e7989af
ListField: Make better use of ES2016
wmertens Aug 24, 2016
46fea9b
ListType: update: base off the previous value
wmertens Aug 25, 2016
9b4110e
ListType: fix file uploads
wmertens Aug 25, 2016
d6573fa
Merge pull request #3403 from keystonejs/nested-lists-add
JedWatson Aug 30, 2016
881528b
Merge branch 'master' into nested-lists
JedWatson Aug 30, 2016
a839958
updateItem for nested fields called with arguments based on function …
Noviny Sep 4, 2016
5829fbe
Fixing initial id
JedWatson Sep 5, 2016
2bc5042
Capitalized 'remove'
brianjd Nov 3, 2016
e76a87c
Merge pull request #3668 from brianjd/nested-lists
JedWatson Nov 11, 2016
6e28988
Adds className and visual offset for list field for better UX.
jeremyzahner Dec 9, 2016
35917bc
Merge remote-tracking branch 'upstream/master' into nested-lists
brianjd Dec 17, 2016
1444942
Merge remote-tracking branch 'jshmrtn/nested-lists' into nested-lists…
brianjd Dec 17, 2016
f85c3cf
Renamed ambiguous class
brianjd Dec 17, 2016
d29f2e8
Added indentation and box shadow to visually separate nested list
brianjd Dec 17, 2016
b61a9e6
Moved List Field formatting to proper location
brianjd Dec 17, 2016
5716ed3
Removed original style
brianjd Dec 18, 2016
01edecf
Merge branch 'master' into nested-lists
JedWatson Dec 20, 2016
5d75f9d
Merge remote-tracking branch 'upstream/nested-lists' into nested-list…
brianjd Dec 22, 2016
b60297a
Converted to Aphrodite
brianjd Dec 28, 2016
b5187f4
Merge pull request #3810 from brianjd/nested-lists-formatting
JedWatson Jan 10, 2017
a54485c
corrected FileSystem adapter file mime lookup call
UnGast Apr 19, 2017
36e6255
Restore/repair S3 image uploading in tinymce
Tathanen Mar 8, 2018
f997256
Merge pull request #2 from Tathanen/master
Tathanen Mar 15, 2018
b5bf046
Check for presence of file value before comparison
Tathanen Mar 16, 2018
811a794
Fix for 21-item lists
Tathanen Mar 16, 2018
013ff6c
Nested list admin styles
Tathanen Mar 20, 2018
f772572
Iffy fix for issue with removing list items
Tathanen Mar 20, 2018
0e4dd88
Merge pull request #3 from keystonejs/master
Tathanen May 9, 2018
35b1bee
Use custom root for S3 paths
Tathanen May 9, 2018
b39b33d
Merge pull request #4 from Tathanen/master
Tathanen May 9, 2018
5f2a9cf
Merge pull request #5 from keystonejs/master
Tathanen Jul 23, 2018
0c5e394
Merge pull request #6 from Tathanen/master
Tathanen Jul 23, 2018
7a9f99e
Merge pull request #7 from keystonejs/master
Tathanen Oct 7, 2018
9293abe
Merge pull request #8 from Tathanen/master
Tathanen Oct 7, 2018
3471f69
Merge branch 'master' of https://github.com/keystonejs/keystone
Tathanen Dec 12, 2018
35baf5a
Build S3 upload name when not present
Tathanen Dec 12, 2018
a3028ee
Merge branch 'master' into nested-lists-modern
Tathanen Dec 12, 2018
3408837
Merge branch 'master' into master
autoboxer Dec 19, 2018
c94614b
v4.0.1
UnGast Dec 25, 2018
8ce4953
Merge branch 'nested-lists'
UnGast Dec 25, 2018
e47c618
Merge branch 'master' of https://github.com/UnGast/keystone
UnGast Dec 25, 2018
0bbaad5
make autocreate lists work with all creation buttons (home, lists, it…
UnGast Dec 29, 2018
dcd1ce1
add objectid type. incomplete
UnGast Jan 4, 2019
88c584a
external link in home lists screen, update external link admin ui doc
UnGast Jan 4, 2019
10e1a1f
v4.0.3
UnGast Jan 4, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 43 additions & 6 deletions admin/client/App/screens/Home/components/ListTile.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from 'react';
import { Link } from 'react-router';
import { GlyphButton } from '../../../elemental';

/**
* Displays information about a list and lets you create a new one.
Expand All @@ -12,6 +13,47 @@ var ListTile = React.createClass({
label: React.PropTypes.string,
path: React.PropTypes.string,
spinner: React.PropTypes.object,
list: React.PropTypes.object
},
contextTypes: {
router: React.PropTypes.object.isRequired,
},
// directly copied from admin/client/App/screens/List/index.js
createAutocreate () {
const list = this.props.list;
list.createItem(null, (err, data) => {
if (err) {
// TODO Proper error handling
alert('Something went wrong, please try again!');
console.log(err);
} else {
this.context.router.push(`${Keystone.adminPath}/${list.path}/${data.id}`);
}
});
},
renderCreateButton () {
const { nocreate, autocreate, singular } = this.props.list;

if (nocreate) return null;

if (autocreate) {
return (
<Link
className="dashboard-group__list-create octicon octicon-plus"
title="Create"
tabIndex="-1"
onClick={this.createAutocreate} />
)
} else {
return (
<Link
to={this.props.href + '?create'}
className="dashboard-group__list-create octicon octicon-plus"
title="Create"
tabIndex="-1"
/>
);
}
},
render () {
var opts = {
Expand All @@ -27,12 +69,7 @@ var ListTile = React.createClass({
{/* If we want to create a new list, we append ?create, which opens the
create form on the new page! */}
{(!this.props.hideCreateButton) && (
<Link
to={this.props.href + '?create'}
className="dashboard-group__list-create octicon octicon-plus"
title="Create"
tabIndex="-1"
/>
this.renderCreateButton()
)}
</span>
</div>
Expand Down
6 changes: 6 additions & 0 deletions admin/client/App/screens/Home/components/Lists.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ export class Lists extends React.Component {
return (
<div className="dashboard-group__lists">
{_.map(this.props.lists, (list, key) => {
// then it's not a list, but an external link, so render it like that
if (typeof list === 'object' && list.external) {
const externalLink = list
return <a href={externalLink.path}>{ externalLink.label }</a>
}
// If an object is passed in the key is the index,
// if an array is passed in the key is at list.key
const listKey = list.key || key;
Expand All @@ -18,6 +23,7 @@ export class Lists extends React.Component {
const isNoCreate = listData ? listData.nocreate : false;
return (
<ListTile
list={listData}
key={list.path}
path={list.path}
label={list.label}
Expand Down
21 changes: 20 additions & 1 deletion admin/client/App/screens/Item/components/EditFormHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ export const EditFormHeader = React.createClass({
list: React.PropTypes.object,
toggleCreate: React.PropTypes.func,
},
contextTypes: {
router: React.PropTypes.object.isRequired,
},
getInitialState () {
return {
searchString: '',
Expand Down Expand Up @@ -130,17 +133,33 @@ export const EditFormHeader = React.createClass({
</ToolbarSection>
);
},
// directly copied from admin/client/App/screens/List/index.js
createAutocreate () {
const list = this.props.list;
list.createItem(null, (err, data) => {
if (err) {
// TODO Proper error handling
alert('Something went wrong, please try again!');
console.log(err);
} else {
this.context.router.push(`${Keystone.adminPath}/${list.path}/${data.id}`);
}
});
},
renderCreateButton () {
const { nocreate, autocreate, singular } = this.props.list;

if (nocreate) return null;

let props = {};

if (autocreate) {
props.href = '?new' + Keystone.csrf.query;
props.onClick = () => { this.createAutocreate() };
//props.href = '?new' + Keystone.csrf.query;
} else {
props.onClick = () => { this.toggleCreate(true); };
}

return (
<GlyphButton data-e2e-item-create-button="true" color="success" glyph="plus" position="left" {...props}>
<ResponsiveText hiddenXS={`New ${singular}`} visibleXS="Create" />
Expand Down
3 changes: 0 additions & 3 deletions admin/public/styles/keystone/field-types.less
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
// Field Types
// ==============================




// Code
// ------------------------------

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
10 changes: 6 additions & 4 deletions docs/documentation/Configuration/AdminUI-Options.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,12 @@ You need to supply an object containing the labels of the menu items as keys and

You can also use an array of model paths as values. This allows to create a second level menu which will appear when you click on the first level menu item (see the `posts` key in the example below).

If you need to add an external link to the menu, you can use an object to provide the following information (see the `externalLink` key in the example below):
If you need to add an external link to the menu, you can use an object wrapped in an array to provide the following information (see the `externalLink` key in the example below):

- `label`: the actual label of the menu item
- `key`: a key used internally
- `path`: the url to point to
- `external`: always true, currently required

**Example of navigation bar**

Expand All @@ -77,10 +78,11 @@ keystone.set('nav', {
'galleries': 'galleries',
'enquiries': 'enquiries',
'users': 'users',
'externalLink': {
'externalLink': [{
label: 'Keystone',
key: 'keystone',
path: 'http://keystonejs.com/'
}
path: 'http://keystonejs.com/',
external: true
}]
});
```
10 changes: 7 additions & 3 deletions fields/types/Type.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ function Field (list, path, options) {
this.label = options.label || utils.keyToLabel(this.path);
this.typeDescription = options.typeDescription || this.typeDescription || this.type;

this.list.automap(this);
if (!options._isNested) {
this.list.automap(this);
}

// Warn on required fields that aren't initial
if (this.options.required
Expand All @@ -79,10 +81,12 @@ function Field (list, path, options) {
}

// Add the field to the schema
this.addToSchema(this.list.schema);
this.addToSchema(options._isNested ? options._nestedSchema : this.list.schema);

// Add pre-save handler to the list if this field watches others
if (this.options.watch) {
if (options._isNested && this.options.watch) {
throw new Error('Nested fields do not support the `watch` option.');
} else if (this.options.watch) {
this.list.schema.pre('save', this.getPreSaveWatcher());
}

Expand Down
5 changes: 4 additions & 1 deletion fields/types/file/FileField.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,10 @@ module.exports = Field.create({
},
componentWillUpdate (nextProps) {
// Show the new filename when it's finished uploading
if (this.props.value.filename !== nextProps.value.filename) {
const oldFilename = this.props.value && this.props.value.filename;
const newFilename = nextProps.value && nextProps.value.filename;

if (newFilename !== oldFilename) {
this.setState(buildInitialState(nextProps));
}
},
Expand Down
32 changes: 32 additions & 0 deletions fields/types/list/ListColumn.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import React from 'react';
import ItemsTableCell from '../../components/ItemsTableCell';
import ItemsTableValue from '../../components/ItemsTableValue';
import { plural } from '../../../admin/client/utils/string';

var ListColumn = React.createClass({
displayName: 'ListColumn',
propTypes: {
col: React.PropTypes.object,
data: React.PropTypes.object,
},
getValue () {
var value = this.props.data.fields[this.props.col.path];
if (Array.isArray(value)) {
return plural(value.length, '* Value', '* Values');
} else {
return '';
}
},
render () {
const value = this.getValue();
return (
<ItemsTableCell>
<ItemsTableValue padded interior field={this.props.col.type}>
{value}
</ItemsTableValue>
</ItemsTableCell>
);
},
});

module.exports = ListColumn;
Loading