Guest User

Untitled

a guest
Feb 22nd, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. /node_modules/keystone/admin/client/App/screens/Item/index.js
  2.  
  3. {(this.props.params.listId === 'my-list-model') ? (
  4. <MyComponent>{this.props.params.listId}</MyComponent>
  5. ) : null }
  6.  
  7. import keystone from 'keystone';
  8. import { someFunction } from './myFunctions';
  9.  
  10. var MyListModel = new keystone.List('MyListModel', {
  11. map: { name: 'title' },
  12. });
  13.  
  14. MyListModel.add({
  15. title: { type: String, required: true },
  16. data: { type: Types.Code, language: 'json', watch: 'title', value: watchTitle, noedit: true },
  17. });
  18.  
  19. MyListModel.register();
  20.  
  21.  
  22. function watchTitle(callback) {
  23. if (this.title) {
  24. function cb(error, result) {
  25. if (result) {
  26. // Send result to React Component in Admin screen
  27. }
  28. callback(error, result);
  29. }
  30. someFunction(this.title, cb);
  31. } else {
  32. callback(null, '');
  33. }
  34. }
Add Comment
Please, Sign In to add comment