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

update #2

Merged
merged 95 commits into from
Aug 4, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
95 commits
Select commit Hold shift + click to select a range
79a396f
Adding ?basic dataset support to item/get API
JedWatson Jul 8, 2015
5f6c456
Simplifying data structure returned by item/get API
JedWatson Jul 8, 2015
c378f10
Using new item/get API in Select2 Relationship fields
JedWatson Jul 8, 2015
dd027fe
Using new item/get API in Relationship Field Class
JedWatson Jul 8, 2015
119dc11
Removing old list/get API endpoint
JedWatson Jul 8, 2015
2a6f18f
Fix for #1280, href was not added to the paths #700
Jul 8, 2015
d47fe97
Now really fix for #1280
Jul 8, 2015
f39d5b8
aligned formatting
Jul 8, 2015
39c3432
Updated TinyMCE Icons (& .ie7) to correct value for BlockQuote button…
jeffreypriebe Jul 9, 2015
73ab5db
Merge pull request #1519 from jeffreypriebe/tinymce-blockquote-icon
JedWatson Jul 10, 2015
f07c7f0
#1433 - Added faint grey border on color picker field
Jul 13, 2015
c245214
Merge pull request #1516 from tylkomat/master
JedWatson Jul 13, 2015
6601dfa
Update README.md
Jul 13, 2015
60d10e0
Merge pull request #1523 from netmml/patch-1
JedWatson Jul 14, 2015
f347bc9
Update README.md
JedWatson Jul 14, 2015
668ce63
Added check for duplicate _revisions models.
jeffreypriebe Jul 14, 2015
aa778dc
Using getters for field types, speeds up init and fixes #1534
JedWatson Jul 17, 2015
bff5c6c
Disabling infix operator spacing, seems to be returning false positives
JedWatson Jul 17, 2015
6a4bd75
Handling err in item view
JedWatson Jul 17, 2015
bad9dc5
Formatting cleanup
JedWatson Jul 17, 2015
3908f87
Fixes #1440
jacargentina Jul 18, 2015
a67af48
Merge pull request #1536 from jacargentina/patch-1
JedWatson Jul 18, 2015
97e5b2d
Rolling back pro tip, I think it's better to have issues + PRs separate
JedWatson Jul 18, 2015
ddc0693
Merge pull request #1526 from jeffreypriebe/history-skip-inherited-ch…
JedWatson Jul 18, 2015
080cc9b
Limiting Travis badge to the master branch, fixes #1535
JedWatson Jul 18, 2015
86b9084
Cleanup
JedWatson Jul 18, 2015
2398968
New addFilterToQuery method for text fields
JedWatson Jul 18, 2015
f38d276
Text-like fields inherit filtering from TextType
JedWatson Jul 18, 2015
751c829
Exposing field.hasFilterMethod in Field options
JedWatson Jul 18, 2015
b51a757
addFilterToQuery method for Boolean fields
JedWatson Jul 18, 2015
35b58b2
Use server api key instead of browser api key to enable geocoding. Ad…
stfnsr Jul 18, 2015
ed86502
Add Maps API Key to querystring if available
stfnsr Jul 18, 2015
da0c4d5
Cleanup
JedWatson Jul 19, 2015
ec2e1f7
New addFilterToQuery method for Date Type
JedWatson Jul 19, 2015
079c16a
Datetime Type inherits from Date Type
JedWatson Jul 19, 2015
2d8bf6f
Merge pull request #1537 from stosorio/master
JedWatson Jul 20, 2015
169cbff
Adding Numeric filter, ref #1539
JedWatson Jul 20, 2015
a89741c
NumberType should not null values when updateItem value is undefined
JedWatson Jul 20, 2015
e8e5df7
Fixing reference to FieldType
JedWatson Jul 20, 2015
61e8204
Tests were incorrect; fixing to match the correct implementation
JedWatson Jul 20, 2015
64edea6
Fixing another Number type issue: blank strings should not be valid w…
JedWatson Jul 20, 2015
a7dc09e
MoneyType inherits from NumberType, ref #1539
JedWatson Jul 20, 2015
ca6b931
Fixing method ordering in Field Types
JedWatson Jul 20, 2015
c45b5ee
Escape special characters in email before creating a RegExp for case-…
Jul 20, 2015
87e534a
Add anchors to regex used for email lookup
Jul 20, 2015
484c603
Update to use escapeRegExp
Jul 21, 2015
7edf6cd
Cleaning up Select field type
JedWatson Jul 21, 2015
e8355f2
Adding select.prototype.addFilterToQuery
JedWatson Jul 21, 2015
cee1ea2
Cleaning up Relationship field type
JedWatson Jul 21, 2015
0f03b34
Adding relationship.prototype.addFilterToQuery
JedWatson Jul 21, 2015
71e5298
Cleaning up Code Field Type and inheriting from TextType
JedWatson Jul 21, 2015
c764765
Fixing mixed spaces and tabs in NumberType
JedWatson Jul 21, 2015
8b2a6ed
Fixing missing filter in SelectType
JedWatson Jul 21, 2015
2f0d123
Fixing linter errors
JedWatson Jul 21, 2015
46c6540
Merge pull request #1542 from alobodig/master
JedWatson Jul 21, 2015
acbe81e
Restoring language property in Code field (oops!)
JedWatson Jul 21, 2015
c4da7ac
Cleaning up list.js
JedWatson Jul 22, 2015
c5c99bc
Splitting out getData and getOptions from list.js
JedWatson Jul 22, 2015
f93d923
Cleaning up PasswordType
JedWatson Jul 23, 2015
6dd37f7
Adding password.prototype.addFilterToQuery
JedWatson Jul 23, 2015
941f5b2
Cleaning up Name field type
JedWatson Jul 23, 2015
34d1280
Fixing syntax error
JedWatson Jul 23, 2015
daa0164
Fix error when trying to use 'file limit' configuration
jacargentina Jul 28, 2015
6c0a70f
Merge pull request #1557 from jacargentina/patch-2
JedWatson Jul 29, 2015
c541f7d
Load CodeMirror only in the item form if and only if a code field is …
Jul 30, 2015
914a500
Merge pull request #1562 from webteckie/cmlite
JedWatson Jul 31, 2015
c66d584
Updating dependencies
JedWatson Jul 31, 2015
a04bc1f
Rolling back multer version for compatibility, ref #1563
JedWatson Jul 31, 2015
9f9359e
Updating packages build
JedWatson Jul 31, 2015
5cf1e9c
Extracting getPages and paginate from core/list into separate files
JedWatson Aug 1, 2015
921b9ff
Removing extraneous debug statements
JedWatson Aug 1, 2015
3bb94f8
Breaking out list.getUniqueValue into its own file
JedWatson Aug 1, 2015
3ed47d2
Breaking out list.updateAll into its own file
JedWatson Aug 1, 2015
52803c7
Implementing simple GET keystone/api/:list route for #1544
JedWatson Aug 1, 2015
e2cc2c2
Implementing list-to-array package for converting various strings to …
JedWatson Aug 1, 2015
b60ff08
Implementing select query parameter for api/:list/get endpoint
JedWatson Aug 1, 2015
96ca9f9
Implementing sort functionality for api/:list/get endpoint
JedWatson Aug 1, 2015
ea966ea
Returning query from all addFilterToQuery methods
JedWatson Aug 1, 2015
f00a171
New List.addFiltersToQuery method
JedWatson Aug 1, 2015
0f73c7b
Implementing filtering in api/:list/get endpoint
JedWatson Aug 1, 2015
d12705c
Cleanup
JedWatson Aug 1, 2015
ad2c0c0
Fixing filters type detection in api/:list/get endpoint
JedWatson Aug 1, 2015
57b6b25
Adding eslint ignore for empty catch block
JedWatson Aug 1, 2015
8e12048
Adding sortContext to list.getOptions & sorting properties
JedWatson Aug 1, 2015
33d1ac9
Breaking out list.isReserved into its own file, deprecating List.rese…
JedWatson Aug 3, 2015
de0006c
Breaking out list.expandColumns and list.selectColumns
JedWatson Aug 3, 2015
4c83666
Updating changelog
JedWatson Aug 3, 2015
76e5232
v0.3.13
JedWatson Aug 3, 2015
d90a6f7
Fixing typo in changelog. It's August already!
JedWatson Aug 3, 2015
76badd6
Should be each, not map
JedWatson Aug 4, 2015
2fcb1a5
Splitting out and optimising List.prototype.relationship
JedWatson Aug 4, 2015
765a088
Splitting out List.prototype.underscoreMethod, list.prototype.getDocu…
JedWatson Aug 4, 2015
a423702
Splitting out and simplifying List.prototype.set/get
JedWatson Aug 4, 2015
9ffa474
utils => keystone-utils
JedWatson Aug 4, 2015
ebe2374
Splitting out and optimising List.prototype.register
JedWatson Aug 4, 2015
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
1 change: 1 addition & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"react/self-closing-comp": 1,
"react/wrap-multilines": 1,
"semi": 2,
"space-infix-ops": 0,
"strict": 0,
"yoda": 0
},
Expand Down
12 changes: 1 addition & 11 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,13 @@ early and is a good way to discuss what you're planning to do.
* If you open an issue and are interested in working on a fix, please let us
know. We'll help you get started, rather than adding it to the queue.
* Make sure you do not add regressions by running `npm test`. Please also
[follow our established coding conventions](https://github.com/keystonejs/keystone/wiki/Coding-Standards)
[follow our established coding conventions](https://github.com/keystonejs/keystone/wiki/Coding-Standards)
(with regards to formatting, etc)
* You can also run `npm run lint` and `npm run style` - our linter is a WIP
but please ensure there are not more violations than before your changes.
* All new features and changes need documentation. They live over at the [Keystone-site](https://github.com/keystonejs/keystonejs-site) repo.
* We have three translations so far,
please read our [Documentation Translation Guidelines](https://github.com/keystonejs/keystone/wiki/Documentation-Translation-Guidelines).
* **PRO TIP**: If you've opened an issue and have come up with a solution
yourself, we prefer you to convert the already existing issue into a PR instead
of opening a new one. This can be done with the [hub command line tool](https://github.com/github/hub)

Example:
```sh
# convert issue 1239 into a pull-request sending all commits from `fix_hooks` branch in creynders'
# keystone fork to the `master` branch of the official repo
hub pull-request -i 1239 -b keystonejs/keystone:master -h creynders/keystone:fix_hooks
```

If you are working on the React Admin UI, you'll also need to know this:

Expand Down
14 changes: 14 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,20 @@

KeystoneJS is maintained by [@JedWatson](https://github.com/JedWatson) and an amazing team of contributors. All contributions are given credit here except for Jed's.

## v0.3.13 / 2015-08-03

* improved; major speed increase for initialisation
* improved; codemirror is now only loaded as required, thanks [Carlos Colon](https://github.com/webteckie)
* fixed; correctly handling blank values in the DateInput component
* changed; switched to babyparse for CSV generation
* fixed; docs links now point to keystone site
* fixed; add Maps API key to request, allow override per model, check for server instead of browser key, thanks [stosorio](https://github.com/stosorio)
* fixed; added check for duplicate `_revisions` models, thanks [Jeffrey](https://github.com/jeffreypriebe)
* fixed; localFile .format property ignored by Admin U, thanks [Javier Castro](https://github.com/jacargentina)
* fixed; href working correctly on LocalFiles Type, thanks [Matthias Tylkowski](https://github.com/tylkomat)
* added; several new API endpoints for the Admin UI in preparation of the 0.4 release


## v0.3.12 / 2015-06-26

* fixed; `height` option for TextArea fields was not respected in the Admin UI, thanks [Eóin Martin](https://github.com/SlashmanX)
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
![KeystoneJS](http://keystonejs.com/images/logo.svg)
===================================

![Build Status](https://travis-ci.org/keystonejs/keystone.svg)
[![Build Status](https://travis-ci.org/keystonejs/keystone.svg?branch=master)](https://travis-ci.org/keystonejs/keystone)

[KeystoneJS](http://keystonejs.com) is a powerful Node.js content management system and web app framework built on [express](http://expressjs.com) and [mongoose](http://mongoosejs.com) that makes it easy to create sophisticated web sites and apps, and gives you a beautiful, auto-generated Admin UI.
[KeystoneJS](http://keystonejs.com) is a powerful Node.js content management system and web app framework built on [express](http://expressjs.com) and [mongoose](http://mongoosejs.com). Keystone makes it easy to create sophisticated web sites and apps, and comes with a beautiful auto-generated Admin UI.

Check out [keystonejs.com](http://keystonejs.com) for documentation and guides.

Expand Down Expand Up @@ -130,7 +130,7 @@ To understand how these settings are used, and how the Express application is in
Keystone builds on the basic data types provided by mongo and allows you to easily add rich,
functional fields to your application's models.

You get helper methods on your models for dealing with each field type easily (such as
You get helper methods on your models for dealing with each field type easily (such as
formatting a date or number, resizing an image, getting an array of the available options
for a select field, or using Google's Places API to improve addresses) as well as a beautiful,
responsive admin UI to edit your data with.
Expand Down
11 changes: 7 additions & 4 deletions admin/api/item/get.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ module.exports = function(req, res) {

var query = req.list.model.findById(req.params.id);

var fields = req.query.fields;
if (req.query.basic !== undefined) {
fields = false;
}

if (req.list.tracking && req.list.tracking.createdBy) {
query.populate(req.list.tracking.createdBy);
}
Expand All @@ -19,7 +24,6 @@ module.exports = function(req, res) {
if (err) return res.status(500).json({ err: 'database error', detail: err });
if (!item) return res.status(404).json({ err: 'not found', id: req.params.id });


var tasks = [];
var drilldown;
var relationships;
Expand Down Expand Up @@ -147,11 +151,10 @@ module.exports = function(req, res) {
detail: err
});
}
res.json({
data: req.list.getData(item, req.query.fields),
res.json(_.assign(req.list.getData(item, fields), {
drilldown: drilldown,
relationships: relationships
});
}));
});
});
};
20 changes: 0 additions & 20 deletions admin/api/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,26 +74,6 @@ exports = module.exports = function(req, res) {

break;

case 'get':

req.list.model.findById(req.query.id).exec(function(err, item) {

if (err) return sendError('database error', err);
if (!item) return sendResponse({ name: req.query.id, id: req.query.id });

switch (req.query.dataset) {
case 'simple':
return sendResponse({
name: req.list.getDocumentName(item, false),
id: item.id
});
default:
return sendResponse(item);
}
});

break;

case 'order':

if (!keystone.security.csrf.validate(req)) {
Expand Down
33 changes: 33 additions & 0 deletions admin/api/list/get.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
var async = require('async');

module.exports = function(req, res) {
var filters = req.query.filters;
if (filters && typeof filters === 'string') {
try { filters = JSON.parse(req.query.filters); }
catch(e) { } // eslint-disable-line no-empty
}
if (typeof filters === 'object') {
filters = req.list.addFiltersToQuery(filters);
}
var query = req.list.model.find(filters);
async.series({
count: function(next) {
query.count(next);
},
items: function(next) {
query.find();
query.limit(Number(req.query.limit) || 100);
query.skip(Number(req.query.skip) || 0);
query.sort(req.query.sort || req.list.defaultSort);
query.exec(next);
}
}, function(err, results) {
if (err) return res.apiError('database error', err);
return res.json({
results: results.items.map(function (item) {
return req.list.getData(item, req.query.select);
}),
count: results.count
});
});
};
6 changes: 1 addition & 5 deletions admin/public/js/common/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,7 @@ jQuery(function($) {
};

$.each(ids, function() {
$.ajax('/keystone/api/' + refPath + '/get', {
data: {
id: this,
dataset: 'simple'
},
$.ajax('/keystone/api/' + refPath + '/' + this + '?simple', {
dataType: 'json'
}).done(loaded);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
.mce-i-numlist { -ie7-icon: "\e00b"; }
.mce-i-indent { -ie7-icon: "\e00c"; }
.mce-i-outdent { -ie7-icon: "\e00d"; }
.mce-i-blockquote { -ie7-icon: "\e00e"; }
.mce-i-blockquote { -ie7-icon: "\e801"; }
.mce-i-undo { -ie7-icon: "\e00f"; }
.mce-i-redo { -ie7-icon: "\e010"; }
.mce-i-link { -ie7-icon: "\e011"; }
Expand Down
6 changes: 4 additions & 2 deletions admin/public/js/lib/tinymce/skins/keystone/less/Icons.less
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@
.mce-i-indent { &:before { content: '\e83f'; } }
.mce-i-outdent { &:before { content: '\e840'; } }

.mce-i-blockquote { &:before { content: '\e801'; } }

.mce-i-bullist { &:before { content: '\e83e'; } }
.mce-i-numlist { &:before { content: '\e83d'; } }

Expand Down Expand Up @@ -74,7 +76,7 @@
.mce-i-numlist:before { content: "\e00b"; }
.mce-i-indent:before { content: "\e00c"; }
.mce-i-outdent:before { content: "\e00d"; }
.mce-i-blockquote:before { content: "\e00e"; }
.mce-i-blockquote:before { content: "\e801"; }
.mce-i-undo:before { content: "\e00f"; }
.mce-i-redo:before { content: "\e010"; }
.mce-i-link:before { content: "\e011"; }
Expand Down Expand Up @@ -188,7 +190,7 @@ i.mce-i-backcolor { text-shadow: none; background: @colorbtn-backcolo
.mce-i-numlist:before { content: "\e00b"; }
.mce-i-indent:before { content: "\e00c"; }
.mce-i-outdent:before { content: "\e00d"; }
.mce-i-blockquote:before { content: "\e00e"; }
.mce-i-blockquote:before { content: "\e801"; }
.mce-i-undo:before { content: "\e00f"; }
.mce-i-redo:before { content: "\e010"; }
.mce-i-link:before { content: "\e011"; }
Expand Down
2 changes: 1 addition & 1 deletion admin/public/js/lib/tinymce/skins/keystone/skin.min.css

Large diffs are not rendered by default.

19 changes: 10 additions & 9 deletions admin/public/js/packages.js

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions admin/public/styles/keystone/forms.less
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,9 @@ label.checkbox {
background: transparent;
border-radius: @input-border-radius;
}
.CodeMirror-linenumber{
margin-left:-30px;
}
}

// Related Items
Expand Down
11 changes: 8 additions & 3 deletions admin/routes/views/item.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
var keystone = require('../../../'),
_ = require('underscore'),
async = require('async');
var keystone = require('../../../');
var _ = require('underscore');
var async = require('async');

exports = module.exports = function(req, res) {

var itemQuery = req.list.model.findById(req.params.item).select();

itemQuery.exec(function(err, item) {

if (err) {
req.flash('error', 'A database error occurred.');
return res.redirect('/keystone/' + req.list.path);
}

if (!item) {
req.flash('error', 'Item ' + req.params.item + ' could not be found.');
return res.redirect('/keystone/' + req.list.path);
Expand Down
4 changes: 2 additions & 2 deletions admin/src/components/ItemViewHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ var Header = React.createClass({

renderDrilldownItems: function() {

var list = this.props.list,
items = this.props.drilldown.items;
var list = this.props.list;
var items = this.props.data.drilldown ? this.props.data.drilldown.items : [];

var els = items.map(function(dd) {

Expand Down
22 changes: 12 additions & 10 deletions admin/src/views/item.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,28 @@ var View = React.createClass({
return {
createIsVisible: false,
list: Keystone.list,
itemData: null,
itemDrilldown: null
itemData: null
};
},

componentDidMount: function() {
this.loadItemData();
},

loadItemData: function() {
request.get('/keystone/api/' + Keystone.list.path + '/' + this.props.itemId + '?drilldown=true')
.set('Accept', 'application/json')
.end(function(err, res) {//eslint-disable-line no-unused-vars, handle-callback-err
if (!res.ok) {
.end((err, res) => {
if (err || !res.ok) {
// TODO: nicer error handling
console.log('Error loading item data:', res.text);
console.log('Error loading item data:', res ? res.text : err);
alert('Error loading data (details logged to console)');
return;
}
this.setState({//eslint-disable-line react/no-did-mount-set-state
itemData: res.body.data,
itemDrilldown: res.body.drilldown
this.setState({
itemData: res.body
});
}.bind(this));
});
},

toggleCreate: function(visible) {
Expand All @@ -51,7 +53,7 @@ var View = React.createClass({
return (
<div>
{this.renderCreateForm()}
<Header list={this.state.list} data={this.state.itemData} drilldown={this.state.itemDrilldown} toggleCreate={this.toggleCreate} />
<Header list={this.state.list} data={this.state.itemData} toggleCreate={this.toggleCreate} />
<EditForm list={this.state.list} data={this.state.itemData} />
</div>
);
Expand Down
Loading