2017-07-26 08:02:16 +09:00
|
|
|
/*
|
|
|
|
|
|
|
|
A component to configure the "new pic" form.
|
|
|
|
|
|
|
|
We're using Pics.options.mutations.new.check (defined in modules/pics/mutations.js)
|
|
|
|
to check if the user has the proper permissions to actually insert a new picture.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
import React from 'react';
|
|
|
|
import { Components, registerComponent, withCurrentUser, getFragment } from 'meteor/vulcan:core';
|
|
|
|
|
|
|
|
import Pics from '../../modules/pics/collection.js';
|
|
|
|
|
|
|
|
const PicsNewForm = ({currentUser, closeModal}) =>
|
|
|
|
|
|
|
|
<div>
|
|
|
|
|
|
|
|
{Pics.options.mutations.new.check(currentUser) ?
|
|
|
|
<Components.SmartForm
|
|
|
|
collection={Pics}
|
|
|
|
mutationFragment={getFragment('PicsItemFragment')}
|
|
|
|
successCallback={closeModal}
|
|
|
|
/> :
|
|
|
|
null
|
|
|
|
}
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
2017-10-06 08:49:36 +09:00
|
|
|
registerComponent('PicsNewForm', PicsNewForm);
|