mirror of
https://github.com/vale981/Vulcan
synced 2025-03-06 10:01:40 -05:00
Merge branch 'devel' into connectors
This commit is contained in:
commit
6add1d7f0e
4 changed files with 22 additions and 15 deletions
|
@ -110,7 +110,7 @@ DatatableHeader Component
|
|||
*/
|
||||
const DatatableHeader = ({ collection, column }, { intl }) => {
|
||||
|
||||
const columnName = typeof column === 'string' ? column : column.name;
|
||||
const columnName = typeof column === 'string' ? column : column.label || column.name;
|
||||
|
||||
if (collection) {
|
||||
const schema = collection.simpleSchema()._schema;
|
||||
|
@ -172,14 +172,14 @@ const DatatableContents = (props) => {
|
|||
{results.map((document, index) => <Components.DatatableRow collection={collection} columns={columns} document={document} key={index} showEdit={showEdit} currentUser={currentUser}/>)}
|
||||
</tbody>
|
||||
</table>
|
||||
<div className="datatable-list-load-more">
|
||||
{hasMore ?
|
||||
isLoadingMore ?
|
||||
<Components.Loading/>
|
||||
: <Button bsStyle="primary" onClick={e => {e.preventDefault(); loadMore();}}>Load More ({count}/{totalCount})</Button>
|
||||
: null
|
||||
}
|
||||
</div>
|
||||
{hasMore &&
|
||||
<div className="datatable-list-load-more">
|
||||
{isLoadingMore ?
|
||||
<Components.Loading/> :
|
||||
<Button bsStyle="primary" onClick={e => {e.preventDefault(); loadMore();}}>Load More ({count}/{totalCount})</Button>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
@ -223,7 +223,7 @@ DatatableRow.contextTypes = {
|
|||
DatatableEditForm Component
|
||||
|
||||
*/
|
||||
const DatatableEditForm = ({ collection, document, closeModal }) =>
|
||||
const DatatableEditForm = ({ collection, document, closeModal , ...properties }) =>
|
||||
<Components.SmartForm
|
||||
collection={collection}
|
||||
documentId={document._id}
|
||||
|
@ -234,6 +234,7 @@ const DatatableEditForm = ({ collection, document, closeModal }) =>
|
|||
removeSuccessCallback={document => {
|
||||
closeModal();
|
||||
}}
|
||||
{...properties}
|
||||
/>
|
||||
registerComponent('DatatableEditForm', DatatableEditForm);
|
||||
|
||||
|
@ -242,12 +243,13 @@ registerComponent('DatatableEditForm', DatatableEditForm);
|
|||
DatatableNewForm Component
|
||||
|
||||
*/
|
||||
const DatatableNewForm = ({ collection, closeModal }) =>
|
||||
const DatatableNewForm = ({ collection, closeModal, ...properties }) =>
|
||||
<Components.SmartForm
|
||||
collection={collection}
|
||||
successCallback={document => {
|
||||
closeModal();
|
||||
}}
|
||||
{...properties}
|
||||
/>
|
||||
registerComponent('DatatableNewForm', DatatableNewForm);
|
||||
|
||||
|
|
|
@ -3,12 +3,12 @@ import React from 'react';
|
|||
import Button from 'react-bootstrap/lib/Button';
|
||||
import { FormattedMessage, intlShape } from 'meteor/vulcan:i18n';
|
||||
|
||||
const EditButton = ({ collection, document, bsStyle = 'primary' }, {intl}) =>
|
||||
const EditButton = ({ collection, document, bsStyle = 'primary', ...properties }, {intl}) =>
|
||||
<Components.ModalTrigger
|
||||
label={intl.formatMessage({id: 'datatable.edit'})}
|
||||
component={<Button bsStyle={bsStyle}><FormattedMessage id="datatable.edit" /></Button>}
|
||||
>
|
||||
<Components.DatatableEditForm collection={collection} document={document} />
|
||||
<Components.DatatableEditForm collection={collection} document={document} {...properties} />
|
||||
</Components.ModalTrigger>
|
||||
|
||||
EditButton.contextTypes = {
|
||||
|
|
|
@ -3,12 +3,12 @@ import React from 'react';
|
|||
import Button from 'react-bootstrap/lib/Button';
|
||||
import { FormattedMessage, intlShape } from 'meteor/vulcan:i18n';
|
||||
|
||||
const NewButton = ({ collection, bsStyle = 'primary' }, {intl}) =>
|
||||
const NewButton = ({ collection, bsStyle = 'primary', ...properties }, {intl}) =>
|
||||
<Components.ModalTrigger
|
||||
label={intl.formatMessage({id: 'datatable.new'})}
|
||||
component={<Button bsStyle={bsStyle}><FormattedMessage id="datatable.new" /></Button>}
|
||||
>
|
||||
<Components.DatatableNewForm collection={collection} />
|
||||
<Components.DatatableNewForm collection={collection} {...properties} />
|
||||
</Components.ModalTrigger>
|
||||
|
||||
NewButton.contextTypes = {
|
||||
|
|
|
@ -196,6 +196,11 @@ class Form extends Component {
|
|||
field.limit = fieldSchema.limit;
|
||||
}
|
||||
|
||||
// add description as help prop
|
||||
if (fieldSchema.description) {
|
||||
field.help = fieldSchema.description;
|
||||
}
|
||||
|
||||
// add placeholder
|
||||
if (fieldSchema.placeholder) {
|
||||
field.placeholder = fieldSchema.placeholder;
|
||||
|
|
Loading…
Add table
Reference in a new issue