code stringlengths 24 2.07M | docstring stringlengths 25 85.3k | func_name stringlengths 1 92 | language stringclasses 1
value | repo stringlengths 5 64 | path stringlengths 4 172 | url stringlengths 44 218 | license stringclasses 7
values |
|---|---|---|---|---|---|---|---|
onClick = (evt) => {
// If it's the currently active navigation item and we're not on the item view,
// clear the query params on click
if (isActive && !this.props.itemId) {
evt.preventDefault();
this.props.dispatch(
setActiveList(this.props.currentList, this.props.currentListKey)
);
... | The secondary navigation links to inidvidual lists of a section | onClick | javascript | keystonejs/keystone-classic | admin/client/App/components/Navigation/Secondary/index.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/components/Navigation/Secondary/index.js | MIT |
render () {
if (!this.state.navIsVisible) return null;
return (
<nav className="secondary-navbar">
<Container clearFloatingChildren>
{this.renderNavigation(this.props.lists)}
</Container>
</nav>
);
} | The secondary navigation links to inidvidual lists of a section | render | javascript | keystonejs/keystone-classic | admin/client/App/components/Navigation/Secondary/index.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/components/Navigation/Secondary/index.js | MIT |
render () {
return (
<li className={this.props.className} data-list-path={this.props.path}>
<Link
to={this.props.href}
onClick={this.props.onClick}
title={this.props.title}
tabIndex="-1"
>
{this.props.children}
</Link>
</li>
);
} | A navigation item of the secondary navigation | render | javascript | keystonejs/keystone-classic | admin/client/App/components/Navigation/Secondary/NavItem.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/components/Navigation/Secondary/NavItem.js | MIT |
function filtersParser (filters, currentList) {
if (typeof filters === 'string') {
try {
filters = JSON.parse(filters);
} catch (e) {
console.warn('Invalid filters provided', filters);
filters = void 0;
}
}
if (!filters) return [];
const assembledFilters = filters.map(filter => {
const path = fil... | Returns an array of expanded filter objects,
given (a string representation | an array of filters) and a currentList object.
@param { String|Array } Either a string representation of an array of filter objects, or an array of filter objects.
@param { Object } the current instantiation of the List prototype used for th... | filtersParser | javascript | keystonejs/keystone-classic | admin/client/App/parsers/filters.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/parsers/filters.js | MIT |
function filterParser ({ path, value }, activeFilters, currentList) {
if (!activeFilters || !isArray(activeFilters)) {
throw new Error('activeFilters must be an array');
}
if (!currentList) {
throw new Error('No currentList selected');
}
if (!isObject(currentList) || isArray(currentList)) {
throw new Error(... | Returns an array of expanded filter objects,
given (a string representation | an array of filters) and a currentList object.
@param { Object } Filter object containing the following key value pairs {path} and {value}.
@param { Array } of { Objects } an array of the currently active filters.
@param { Object } the curr... | filterParser | javascript | keystonejs/keystone-classic | admin/client/App/parsers/filters.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/parsers/filters.js | MIT |
function createFilterObject (path, value, currentListFields) {
if (!currentListFields || !isPlainObject(currentListFields)) {
console.warn('currentListFields must be a plain object', currentListFields);
return;
}
const field = currentListFields[path];
if (!field) {
console.warn('Invalid Filter path specifie... | Returns a filter object
given a path, a value, and the fields within an instance of the List prototype.
@param { String } filter path
@param { Object } of filter values.
@param { Object } of fields from the current instance of the List prototype.
@return { Object } a filter comprised of the:filters.js
- corresponding... | createFilterObject | javascript | keystonejs/keystone-classic | admin/client/App/parsers/filters.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/parsers/filters.js | MIT |
function columnsParser (columns, currentList) {
if (!currentList) {
throw new Error('No currentList selected');
}
if (!columns || columns.length === 0) {
return currentList.expandColumns(currentList.defaultColumns);
}
return currentList.expandColumns(columns);
} | Returns an array of expanded columns object, given a list of columns and currentList object.
@param { String } columns, a string representation of a list of columns.
@param { Object } the current instantiation of the List prototype used for the <List/> scene
@return { Array } of { Objects } as an expanded representati... | columnsParser | javascript | keystonejs/keystone-classic | admin/client/App/parsers/index.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/parsers/index.js | MIT |
function sortParser (path, currentList) {
if (!currentList) {
throw new Error('No currentList selected');
}
if (!path) return currentList.expandSort(currentList.defaultSort);
return currentList.expandSort(path);
} | Returns an expanded sort object, given a sort path and currentList object.
@param { String } path, a string representation of a list of columns.
@param { Object } the current instantiation of the List prototype used for the <List/> scene
@return { Object } an expanded representation of the sort path passed in. | sortParser | javascript | keystonejs/keystone-classic | admin/client/App/parsers/index.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/parsers/index.js | MIT |
function * debouncedSearch () {
const searchString = yield select((state) => state.active.search);
if (searchString) {
yield delay(500);
}
yield call(updateParams);
} | Debounce the search loading new items by 500ms | debouncedSearch | javascript | keystonejs/keystone-classic | admin/client/App/sagas/index.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/sagas/index.js | MIT |
function * setActiveColumnsSaga () {
while (true) {
const { columns } = yield take(actions.SELECT_ACTIVE_COLUMNS);
const { currentList } = yield select(state => state.lists);
const newColumns = yield call(columnsParser, columns, currentList);
yield put({ type: actions.SET_ACTIVE_COLUMNS, columns: newColumns })... | Debounce the search loading new items by 500ms | setActiveColumnsSaga | javascript | keystonejs/keystone-classic | admin/client/App/sagas/index.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/sagas/index.js | MIT |
function * setActiveSortSaga () {
while (true) {
const { path } = yield take(actions.SELECT_ACTIVE_SORT);
const { currentList } = yield select(state => state.lists);
const sort = yield call(sortParser, path, currentList);
yield put({ type: actions.SET_ACTIVE_SORT, sort });
}
} | Debounce the search loading new items by 500ms | setActiveSortSaga | javascript | keystonejs/keystone-classic | admin/client/App/sagas/index.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/sagas/index.js | MIT |
function * setActiveFilterSaga () {
while (true) {
const { filter } = yield take(actions.SELECT_FILTER);
const { currentList } = yield select(state => state.lists);
const activeFilters = yield select(state => state.active.filters);
const updatedFilter = yield call(filterParser, filter, activeFilters, currentLi... | Debounce the search loading new items by 500ms | setActiveFilterSaga | javascript | keystonejs/keystone-classic | admin/client/App/sagas/index.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/sagas/index.js | MIT |
function * rootSaga () {
yield fork(takeLatest, actions.SET_ACTIVE_SEARCH, debouncedSearch);
yield fork(takeLatest, actions.SET_ACTIVE_LIST, evalQueryParams);
// If one of the other active properties changes, update the query params and load the new items
yield fork(setActiveSortSaga);
yield fork(setActiveColumnsS... | Debounce the search loading new items by 500ms | rootSaga | javascript | keystonejs/keystone-classic | admin/client/App/sagas/index.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/sagas/index.js | MIT |
function * updateParams () {
// Select all the things
const activeState = yield select((state) => state.active);
const currentList = yield select((state) => state.lists.currentList);
const location = yield select((state) => state.routing.locationBeforeTransitions);
const { index } = yield select((state) => state.l... | Update the query params based on the current state | updateParams | javascript | keystonejs/keystone-classic | admin/client/App/sagas/queryParamsSagas.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/sagas/queryParamsSagas.js | MIT |
function * evalQueryParams () {
const { pathname, query } = yield select(state => state.routing.locationBeforeTransitions);
const { cachedQuery } = yield select(state => state.active);
const { currentList } = yield select(state => state.lists);
if (pathname !== `${Keystone.adminPath}/${currentList.id}`) return;
... | Update the query params based on the current state | evalQueryParams | javascript | keystonejs/keystone-classic | admin/client/App/sagas/queryParamsSagas.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/sagas/queryParamsSagas.js | MIT |
function parseQueryParams (query, currentList) {
const columns = columnsParser(query.columns, currentList);
const sort = sortParser(query.sort, currentList);
const filters = filtersParser(query.filters, currentList);
const currentPage = query.page || 1;
const search = query.search || '';
return {
columns,
so... | Update the query params based on the current state | parseQueryParams | javascript | keystonejs/keystone-classic | admin/client/App/sagas/queryParamsSagas.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/sagas/queryParamsSagas.js | MIT |
function loadCounts () {
return (dispatch) => {
dispatch({
type: LOAD_COUNTS,
});
xhr({
url: `${Keystone.adminPath}/api/counts`,
}, (err, resp, body) => {
if (err) {
dispatch(countsLoadingError(err));
return;
}
try {
body = JSON.parse(body);
if (body.counts) {
dispatch(count... | Load the counts of all lists | loadCounts | javascript | keystonejs/keystone-classic | admin/client/App/screens/Home/actions.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/screens/Home/actions.js | MIT |
function countsLoaded (counts) {
return {
type: COUNTS_LOADING_SUCCESS,
counts,
};
} | Dispatched when the counts were loaded
@param {Object} counts The counts object as returned by the API | countsLoaded | javascript | keystonejs/keystone-classic | admin/client/App/screens/Home/actions.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/screens/Home/actions.js | MIT |
function countsLoadingError (error) {
return (dispatch, getState) => {
dispatch({
type: COUNTS_LOADING_ERROR,
error,
});
setTimeout(() => {
dispatch(loadCounts());
}, NETWORK_ERROR_RETRY_DELAY);
};
} | Dispatched when unsuccessfully trying to load the counts, will redispatch
loadCounts after NETWORK_ERROR_RETRY_DELAY until we get counts back
@param {object} error The error | countsLoadingError | javascript | keystonejs/keystone-classic | admin/client/App/screens/Home/actions.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/screens/Home/actions.js | MIT |
getInitialState () {
return {
modalIsOpen: true,
};
} | The Home view is the view one sees at /keystone. It shows a list of all lists,
grouped by their section. | getInitialState | javascript | keystonejs/keystone-classic | admin/client/App/screens/Home/index.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/screens/Home/index.js | MIT |
getSpinner () {
if (this.props.counts && Object.keys(this.props.counts).length === 0
&& (this.props.error || this.props.loading)) {
return (
<Spinner />
);
}
return null;
} | The Home view is the view one sees at /keystone. It shows a list of all lists,
grouped by their section. | getSpinner | javascript | keystonejs/keystone-classic | admin/client/App/screens/Home/index.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/screens/Home/index.js | MIT |
render () {
const spinner = this.getSpinner();
return (
<Container data-screen-id="home">
<div className="dashboard-header">
<div className="dashboard-heading">{Keystone.brand}</div>
</div>
<div className="dashboard-groups">
{(this.props.error) && (
<AlertMessages
alerts={{ err... | The Home view is the view one sees at /keystone. It shows a list of all lists,
grouped by their section. | render | javascript | keystonejs/keystone-classic | admin/client/App/screens/Home/index.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/screens/Home/index.js | MIT |
render () {
var opts = {
'data-list-path': this.props.path,
};
return (
<div className="dashboard-group__list" {...opts}>
<span className="dashboard-group__list-inner">
<Link to={this.props.href} className="dashboard-group__list-tile">
<div className="dashboard-group__list-label">{this.props.... | Displays information about a list and lets you create a new one. | render | javascript | keystonejs/keystone-classic | admin/client/App/screens/Home/components/ListTile.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/screens/Home/components/ListTile.js | MIT |
function getRelatedIconClass (string) {
const icons = [
{ icon: 'book', sections: ['books', 'posts', 'blog', 'blog-posts', 'stories', 'news-stories', 'content'] },
{ icon: 'briefcase', sections: ['businesses', 'companies', 'listings', 'organizations', 'partners'] },
{ icon: 'calendar', sections: ['events', 'date... | Gets a related icon for a string, returned as a classname to be applied to a span. If no related
icon is found, returns a classname for a dot icon
@param [String] string
@return [String] The classname of the icon | getRelatedIconClass | javascript | keystonejs/keystone-classic | admin/client/App/screens/Home/utils/getRelatedIconClass.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/screens/Home/utils/getRelatedIconClass.js | MIT |
function selectItem (itemId) {
return {
type: SELECT_ITEM,
id: itemId,
};
} | Select an item
@param {String} itemId The item ID | selectItem | javascript | keystonejs/keystone-classic | admin/client/App/screens/Item/actions.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/screens/Item/actions.js | MIT |
function loadItemData () {
return (dispatch, getState) => {
// Hold on to the id of the item we currently want to load.
// Dispatch this reference to our redux store to hold on to as a 'loadingRef'.
const currentItemID = getState().item.id;
dispatch({
type: LOAD_DATA,
});
const state = getState();
con... | Load the item data of the current item | loadItemData | javascript | keystonejs/keystone-classic | admin/client/App/screens/Item/actions.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/screens/Item/actions.js | MIT |
function loadRelationshipItemData ({ columns, refList, relationship, relatedItemId }) {
return (dispatch, getState) => {
refList.loadItems({
columns: columns,
filters: [{
field: refList.fields[relationship.refPath],
value: { value: relatedItemId },
}],
}, (err, items) => {
// // TODO: indicate ... | Load the item data of the current item | loadRelationshipItemData | javascript | keystonejs/keystone-classic | admin/client/App/screens/Item/actions.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/screens/Item/actions.js | MIT |
function dataLoaded (data) {
return {
type: DATA_LOADING_SUCCESS,
loadingRef: null,
data,
};
} | Called when data of the current item is loaded
@param {Object} data The item data | dataLoaded | javascript | keystonejs/keystone-classic | admin/client/App/screens/Item/actions.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/screens/Item/actions.js | MIT |
function relationshipDataLoaded (path, data) {
return {
type: LOAD_RELATIONSHIP_DATA,
relationshipPath: path,
data,
};
} | Called when data of the current item is loaded
@param {Object} data The item data | relationshipDataLoaded | javascript | keystonejs/keystone-classic | admin/client/App/screens/Item/actions.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/screens/Item/actions.js | MIT |
function dataLoadingError (err) {
return {
type: DATA_LOADING_ERROR,
loadingRef: null,
error: err,
};
} | Called when there was an error during the loading of the current item data,
will retry loading the data ever NETWORK_ERROR_RETRY_DELAY milliseconds
@param {Object} error The error | dataLoadingError | javascript | keystonejs/keystone-classic | admin/client/App/screens/Item/actions.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/screens/Item/actions.js | MIT |
function deleteItem (id, router) {
return (dispatch, getState) => {
const state = getState();
const list = state.lists.currentList;
list.deleteItem(id, (err) => {
// If a router is passed, redirect to the current list path,
// otherwise stay where we are
if (router) {
let redirectUrl = `${Keystone.a... | Deletes an item and optionally redirects to the current list URL
@param {String} id The ID of the item we want to delete
@param {Object} router A react-router router object. If this is passed, we
redirect to Keystone.adminPath/currentList.path! | deleteItem | javascript | keystonejs/keystone-classic | admin/client/App/screens/Item/actions.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/screens/Item/actions.js | MIT |
function reorderItems ({ columns, refList, relationship, relatedItemId, item, prevSortOrder, newSortOrder }) {
return (dispatch, getState) => {
// Send the item, previous sortOrder and the new sortOrder
// we should get the proper list and new page results in return
refList.reorderItems(
item,
prevSortOrde... | Deletes an item and optionally redirects to the current list URL
@param {String} id The ID of the item we want to delete
@param {Object} router A react-router router object. If this is passed, we
redirect to Keystone.adminPath/currentList.path! | reorderItems | javascript | keystonejs/keystone-classic | admin/client/App/screens/Item/actions.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/screens/Item/actions.js | MIT |
function moveItem ({ prevIndex, newIndex, relationshipPath, newSortOrder }) {
return {
type: DRAG_MOVE_ITEM,
prevIndex,
newIndex,
relationshipPath,
newSortOrder,
};
} | Deletes an item and optionally redirects to the current list URL
@param {String} id The ID of the item we want to delete
@param {Object} router A react-router router object. If this is passed, we
redirect to Keystone.adminPath/currentList.path! | moveItem | javascript | keystonejs/keystone-classic | admin/client/App/screens/Item/actions.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/screens/Item/actions.js | MIT |
function resetItems () {
return {
type: DRAG_RESET_ITEMS,
};
} | Deletes an item and optionally redirects to the current list URL
@param {String} id The ID of the item we want to delete
@param {Object} router A react-router router object. If this is passed, we
redirect to Keystone.adminPath/currentList.path! | resetItems | javascript | keystonejs/keystone-classic | admin/client/App/screens/Item/actions.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/screens/Item/actions.js | MIT |
getInitialState () {
return {
createIsOpen: false,
};
} | Item View
This is the item view, it is rendered when users visit a page of a specific
item. This mainly renders the form to edit the item content in. | getInitialState | javascript | keystonejs/keystone-classic | admin/client/App/screens/Item/index.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/screens/Item/index.js | MIT |
componentDidMount () {
// When we directly navigate to an item without coming from another client
// side routed page before, we need to select the list before initializing the item
// We also need to update when the list id has changed
if (!this.props.currentList || this.props.currentList.id !== this.props.par... | Item View
This is the item view, it is rendered when users visit a page of a specific
item. This mainly renders the form to edit the item content in. | componentDidMount | javascript | keystonejs/keystone-classic | admin/client/App/screens/Item/index.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/screens/Item/index.js | MIT |
componentWillReceiveProps (nextProps) {
// We've opened a new item from the client side routing, so initialize
// again with the new item id
if (nextProps.params.itemId !== this.props.params.itemId) {
this.props.dispatch(selectList(nextProps.params.listId));
this.initializeItem(nextProps.params.itemId);
}... | Item View
This is the item view, it is rendered when users visit a page of a specific
item. This mainly renders the form to edit the item content in. | componentWillReceiveProps | javascript | keystonejs/keystone-classic | admin/client/App/screens/Item/index.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/screens/Item/index.js | MIT |
initializeItem (itemId) {
this.props.dispatch(selectItem(itemId));
this.props.dispatch(loadItemData());
} | Item View
This is the item view, it is rendered when users visit a page of a specific
item. This mainly renders the form to edit the item content in. | initializeItem | javascript | keystonejs/keystone-classic | admin/client/App/screens/Item/index.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/screens/Item/index.js | MIT |
onCreate (item) {
// Hide the create form
this.toggleCreateModal(false);
// Redirect to newly created item path
const list = this.props.currentList;
this.context.router.push(`${Keystone.adminPath}/${list.path}/${item.id}`);
} | Item View
This is the item view, it is rendered when users visit a page of a specific
item. This mainly renders the form to edit the item content in. | onCreate | javascript | keystonejs/keystone-classic | admin/client/App/screens/Item/index.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/screens/Item/index.js | MIT |
toggleCreateModal (visible) {
this.setState({
createIsOpen: visible,
});
} | Item View
This is the item view, it is rendered when users visit a page of a specific
item. This mainly renders the form to edit the item content in. | toggleCreateModal | javascript | keystonejs/keystone-classic | admin/client/App/screens/Item/index.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/screens/Item/index.js | MIT |
renderRelationships () {
const { relationships } = this.props.currentList;
const keys = Object.keys(relationships);
if (!keys.length) return;
return (
<div className="Relationships">
<Container>
<h2>Relationships</h2>
{keys.map(key => {
const relationship = relationships[key];
const... | Item View
This is the item view, it is rendered when users visit a page of a specific
item. This mainly renders the form to edit the item content in. | renderRelationships | javascript | keystonejs/keystone-classic | admin/client/App/screens/Item/index.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/screens/Item/index.js | MIT |
handleError (error) {
const detail = error.detail;
if (detail) {
// Item not found
if (detail.name === 'CastError'
&& detail.path === '_id') {
return (
<Container>
<Alert color="danger" style={{ marginTop: '2em' }}>
No item matching id "{this.props.routeParams.itemId}".
... | Item View
This is the item view, it is rendered when users visit a page of a specific
item. This mainly renders the form to edit the item content in. | handleError | javascript | keystonejs/keystone-classic | admin/client/App/screens/Item/index.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/screens/Item/index.js | MIT |
render () {
// If we don't have any data yet, show the loading indicator
if (!this.props.ready) {
return (
<Center height="50vh" data-screen-id="item">
<Spinner />
</Center>
);
}
// When we have the data, render the item view with it
return (
<div data-screen-id="item">
{(this.props... | Item View
This is the item view, it is rendered when users visit a page of a specific
item. This mainly renders the form to edit the item content in. | render | javascript | keystonejs/keystone-classic | admin/client/App/screens/Item/index.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/screens/Item/index.js | MIT |
function item (state = initialState, action) {
switch (action.type) {
case SELECT_ITEM:
return assign({}, state, {
ready: false,
id: action.id,
data: null,
});
case LOAD_DATA:
return assign({}, state, {
loading: true,
});
case DATA_LOADING_SUCCESS:
Keystone.item = action.data; // F... | Item reducer, handles the item data and loading | item | javascript | keystonejs/keystone-classic | admin/client/App/screens/Item/reducer.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/screens/Item/reducer.js | MIT |
function dragProps (connect, monitor) {
return {
connectDragSource: connect.dragSource(),
isDragging: monitor.isDragging(),
connectDragPreview: connect.dragPreview(),
};
} | Specifies the props to inject into your component. | dragProps | javascript | keystonejs/keystone-classic | admin/client/App/screens/Item/components/RelatedItemsList/RelatedItemsListRow.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/screens/Item/components/RelatedItemsList/RelatedItemsListRow.js | MIT |
function dropProps (connect) {
return {
connectDropTarget: connect.dropTarget(),
};
} | Specifies the props to inject into your component. | dropProps | javascript | keystonejs/keystone-classic | admin/client/App/screens/Item/components/RelatedItemsList/RelatedItemsListRow.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/screens/Item/components/RelatedItemsList/RelatedItemsListRow.js | MIT |
getInitialState () {
return {
confirmationDialog: {
isOpen: false,
},
checkedItems: {},
constrainTableWidth: true,
manageMode: false,
showCreateForm: false,
showUpdateForm: false,
};
} | The list view is a paginated table of all items in the list. It can show a
variety of information about the individual items in columns. | getInitialState | javascript | keystonejs/keystone-classic | admin/client/App/screens/List/index.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/screens/List/index.js | MIT |
componentWillMount () {
// When we directly navigate to a list without coming from another client
// side routed page before, we need to initialize the list and parse
// possibly specified query parameters
this.props.dispatch(selectList(this.props.params.listId));
const isNoCreate = this.props.lists.data[th... | The list view is a paginated table of all items in the list. It can show a
variety of information about the individual items in columns. | componentWillMount | javascript | keystonejs/keystone-classic | admin/client/App/screens/List/index.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/screens/List/index.js | MIT |
componentWillReceiveProps (nextProps) {
// We've opened a new list from the client side routing, so initialize
// again with the new list id
const isReady = this.props.lists.ready && nextProps.lists.ready;
if (isReady && checkForQueryChange(nextProps, this.props)) {
this.props.dispatch(selectList(nextProps.p... | The list view is a paginated table of all items in the list. It can show a
variety of information about the individual items in columns. | componentWillReceiveProps | javascript | keystonejs/keystone-classic | admin/client/App/screens/List/index.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/screens/List/index.js | MIT |
onCreate (item) {
// Hide the create form
this.toggleCreateModal(false);
// Redirect to newly created item path
const list = this.props.currentList;
this.context.router.push(`${Keystone.adminPath}/${list.path}/${item.id}`);
} | The list view is a paginated table of all items in the list. It can show a
variety of information about the individual items in columns. | onCreate | javascript | keystonejs/keystone-classic | admin/client/App/screens/List/index.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/screens/List/index.js | MIT |
createAutocreate () {
const list = this.props.currentList;
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}`);
... | The list view is a paginated table of all items in the list. It can show a
variety of information about the individual items in columns. | createAutocreate | javascript | keystonejs/keystone-classic | admin/client/App/screens/List/index.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/screens/List/index.js | MIT |
handleSearchClear () {
this.props.dispatch(setActiveSearch(''));
// TODO re-implement focus when ready
// findDOMNode(this.refs.listSearchInput).focus();
} | The list view is a paginated table of all items in the list. It can show a
variety of information about the individual items in columns. | handleSearchClear | javascript | keystonejs/keystone-classic | admin/client/App/screens/List/index.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/screens/List/index.js | MIT |
handleSearchKey (e) {
// clear on esc
if (e.which === ESC_KEY_CODE) {
this.handleSearchClear();
}
} | The list view is a paginated table of all items in the list. It can show a
variety of information about the individual items in columns. | handleSearchKey | javascript | keystonejs/keystone-classic | admin/client/App/screens/List/index.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/screens/List/index.js | MIT |
handlePageSelect (i) {
// If the current page index is the same as the index we are intending to pass to redux, bail out.
if (i === this.props.lists.page.index) return;
return this.props.dispatch(setCurrentPage(i));
} | The list view is a paginated table of all items in the list. It can show a
variety of information about the individual items in columns. | handlePageSelect | javascript | keystonejs/keystone-classic | admin/client/App/screens/List/index.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/screens/List/index.js | MIT |
toggleManageMode (filter = !this.state.manageMode) {
this.setState({
manageMode: filter,
checkedItems: {},
});
} | The list view is a paginated table of all items in the list. It can show a
variety of information about the individual items in columns. | toggleManageMode | javascript | keystonejs/keystone-classic | admin/client/App/screens/List/index.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/screens/List/index.js | MIT |
toggleUpdateModal (filter = !this.state.showUpdateForm) {
this.setState({
showUpdateForm: filter,
});
} | The list view is a paginated table of all items in the list. It can show a
variety of information about the individual items in columns. | toggleUpdateModal | javascript | keystonejs/keystone-classic | admin/client/App/screens/List/index.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/screens/List/index.js | MIT |
massUpdate () {
// TODO: Implement update multi-item
console.log('Update ALL the things!');
} | The list view is a paginated table of all items in the list. It can show a
variety of information about the individual items in columns. | massUpdate | javascript | keystonejs/keystone-classic | admin/client/App/screens/List/index.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/screens/List/index.js | MIT |
massDelete () {
const { checkedItems } = this.state;
const list = this.props.currentList;
const itemCount = pluralize(checkedItems, ('* ' + list.singular.toLowerCase()), ('* ' + list.plural.toLowerCase()));
const itemIds = Object.keys(checkedItems);
this.setState({
confirmationDialog: {
isOpen: true,
... | The list view is a paginated table of all items in the list. It can show a
variety of information about the individual items in columns. | massDelete | javascript | keystonejs/keystone-classic | admin/client/App/screens/List/index.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/screens/List/index.js | MIT |
handleManagementSelect (selection) {
if (selection === 'all') this.checkAllItems();
if (selection === 'none') this.uncheckAllTableItems();
if (selection === 'visible') this.checkAllTableItems();
return false;
} | The list view is a paginated table of all items in the list. It can show a
variety of information about the individual items in columns. | handleManagementSelect | javascript | keystonejs/keystone-classic | admin/client/App/screens/List/index.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/screens/List/index.js | MIT |
renderConfirmationDialog () {
const props = this.state.confirmationDialog;
return (
<ConfirmationDialog
confirmationLabel={props.label}
isOpen={props.isOpen}
onCancel={this.removeConfirmationDialog}
onConfirmation={props.onConfirmation}
>
{props.body}
</ConfirmationDialog>
);
} | The list view is a paginated table of all items in the list. It can show a
variety of information about the individual items in columns. | renderConfirmationDialog | javascript | keystonejs/keystone-classic | admin/client/App/screens/List/index.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/screens/List/index.js | MIT |
renderManagement () {
const { checkedItems, manageMode, selectAllItemsLoading } = this.state;
const { currentList } = this.props;
return (
<ListManagement
checkedItemCount={Object.keys(checkedItems).length}
handleDelete={this.massDelete}
handleSelect={this.handleManagementSelect}
handleToggle=... | The list view is a paginated table of all items in the list. It can show a
variety of information about the individual items in columns. | renderManagement | javascript | keystonejs/keystone-classic | admin/client/App/screens/List/index.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/screens/List/index.js | MIT |
renderPagination () {
const items = this.props.items;
if (this.state.manageMode || !items.count) return;
const list = this.props.currentList;
const currentPage = this.props.lists.page.index;
const pageSize = this.props.lists.page.size;
return (
<Pagination
currentPage={currentPage}
onPageSelect... | The list view is a paginated table of all items in the list. It can show a
variety of information about the individual items in columns. | renderPagination | javascript | keystonejs/keystone-classic | admin/client/App/screens/List/index.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/screens/List/index.js | MIT |
renderHeader () {
const items = this.props.items;
const { autocreate, nocreate, plural, singular } = this.props.currentList;
return (
<Container style={{ paddingTop: '2em' }}>
<ListHeaderTitle
activeSort={this.props.active.sort}
availableColumns={this.props.currentList.columns}
handleSortSe... | The list view is a paginated table of all items in the list. It can show a
variety of information about the individual items in columns. | renderHeader | javascript | keystonejs/keystone-classic | admin/client/App/screens/List/index.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/screens/List/index.js | MIT |
checkTableItem (item, e) {
e.preventDefault();
const newCheckedItems = { ...this.state.checkedItems };
const itemId = item.id;
if (this.state.checkedItems[itemId]) {
delete newCheckedItems[itemId];
} else {
newCheckedItems[itemId] = true;
}
this.setState({
checkedItems: newCheckedItems,
});
} | The list view is a paginated table of all items in the list. It can show a
variety of information about the individual items in columns. | checkTableItem | javascript | keystonejs/keystone-classic | admin/client/App/screens/List/index.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/screens/List/index.js | MIT |
checkAllTableItems () {
const checkedItems = {};
this.props.items.results.forEach(item => {
checkedItems[item.id] = true;
});
this.setState({
checkedItems: checkedItems,
});
} | The list view is a paginated table of all items in the list. It can show a
variety of information about the individual items in columns. | checkAllTableItems | javascript | keystonejs/keystone-classic | admin/client/App/screens/List/index.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/screens/List/index.js | MIT |
checkAllItems () {
const checkedItems = { ...this.state.checkedItems };
// Just in case this API call takes a long time, we'll update the select all button with
// a spinner.
this.setState({ selectAllItemsLoading: true });
var self = this;
this.props.currentList.loadItems({ expandRelationshipFilters: false,... | The list view is a paginated table of all items in the list. It can show a
variety of information about the individual items in columns. | checkAllItems | javascript | keystonejs/keystone-classic | admin/client/App/screens/List/index.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/screens/List/index.js | MIT |
uncheckAllTableItems () {
this.setState({
checkedItems: {},
});
} | The list view is a paginated table of all items in the list. It can show a
variety of information about the individual items in columns. | uncheckAllTableItems | javascript | keystonejs/keystone-classic | admin/client/App/screens/List/index.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/screens/List/index.js | MIT |
deleteTableItem (item, e) {
if (e.altKey) {
this.props.dispatch(deleteItem(item.id));
return;
}
e.preventDefault();
this.setState({
confirmationDialog: {
isOpen: true,
label: 'Delete',
body: (
<div>
Are you sure you want to delete <strong>{item.name}</strong>?
<br />
... | The list view is a paginated table of all items in the list. It can show a
variety of information about the individual items in columns. | deleteTableItem | javascript | keystonejs/keystone-classic | admin/client/App/screens/List/index.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/screens/List/index.js | MIT |
removeConfirmationDialog () {
this.setState({
confirmationDialog: {
isOpen: false,
},
});
} | The list view is a paginated table of all items in the list. It can show a
variety of information about the individual items in columns. | removeConfirmationDialog | javascript | keystonejs/keystone-classic | admin/client/App/screens/List/index.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/screens/List/index.js | MIT |
toggleTableWidth () {
this.setState({
constrainTableWidth: !this.state.constrainTableWidth,
});
} | The list view is a paginated table of all items in the list. It can show a
variety of information about the individual items in columns. | toggleTableWidth | javascript | keystonejs/keystone-classic | admin/client/App/screens/List/index.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/screens/List/index.js | MIT |
handleSortSelect (path, inverted) {
if (inverted) path = '-' + path;
this.props.dispatch(setActiveSort(path));
} | The list view is a paginated table of all items in the list. It can show a
variety of information about the individual items in columns. | handleSortSelect | javascript | keystonejs/keystone-classic | admin/client/App/screens/List/index.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/screens/List/index.js | MIT |
toggleCreateModal (visible) {
this.setState({
showCreateForm: visible,
});
} | The list view is a paginated table of all items in the list. It can show a
variety of information about the individual items in columns. | toggleCreateModal | javascript | keystonejs/keystone-classic | admin/client/App/screens/List/index.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/screens/List/index.js | MIT |
showBlankState () {
return !this.props.loading
&& !this.props.items.results.length
&& !this.props.active.search
&& !this.props.active.filters.length;
} | The list view is a paginated table of all items in the list. It can show a
variety of information about the individual items in columns. | showBlankState | javascript | keystonejs/keystone-classic | admin/client/App/screens/List/index.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/screens/List/index.js | MIT |
renderBlankState () {
const { currentList } = this.props;
if (!this.showBlankState()) return null;
// create and nav directly to the item view, or open the create modal
const onClick = currentList.autocreate
? this.createAutocreate
: this.openCreateModal;
// display the button if create allowed
con... | The list view is a paginated table of all items in the list. It can show a
variety of information about the individual items in columns. | renderBlankState | javascript | keystonejs/keystone-classic | admin/client/App/screens/List/index.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/screens/List/index.js | MIT |
renderActiveState () {
if (this.showBlankState()) return null;
const containerStyle = {
transition: 'max-width 160ms ease-out',
msTransition: 'max-width 160ms ease-out',
MozTransition: 'max-width 160ms ease-out',
WebkitTransition: 'max-width 160ms ease-out',
};
if (!this.state.constrainTableWidth) ... | The list view is a paginated table of all items in the list. It can show a
variety of information about the individual items in columns. | renderActiveState | javascript | keystonejs/keystone-classic | admin/client/App/screens/List/index.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/screens/List/index.js | MIT |
renderNoSearchResults () {
if (this.props.items.results.length) return null;
let matching = this.props.active.search;
if (this.props.active.filters.length) {
matching += (matching ? ' and ' : '') + pluralize(this.props.active.filters.length, '* filter', '* filters');
}
matching = matching ? ' found matchin... | The list view is a paginated table of all items in the list. It can show a
variety of information about the individual items in columns. | renderNoSearchResults | javascript | keystonejs/keystone-classic | admin/client/App/screens/List/index.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/screens/List/index.js | MIT |
render () {
if (!this.props.ready) {
return (
<Center height="50vh" data-screen-id="list">
<Spinner />
</Center>
);
}
return (
<div data-screen-id="list">
{this.renderBlankState()}
{this.renderActiveState()}
<CreateForm
err={Keystone.createFormErrors}
isOpen={this.state... | The list view is a paginated table of all items in the list. It can show a
variety of information about the individual items in columns. | render | javascript | keystonejs/keystone-classic | admin/client/App/screens/List/index.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/screens/List/index.js | MIT |
function selectList (id) {
return (dispatch, getState) => {
dispatch({
type: SELECT_LIST,
id,
});
dispatch(setActiveList(getState().lists.data[id], id));
};
} | Select a list, and set it as the active list. Called whenever the main
List component mounts or the list changes.
@param {String} id The list ID, passed via this.props.params.listId | selectList | javascript | keystonejs/keystone-classic | admin/client/App/screens/List/actions/index.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/screens/List/actions/index.js | MIT |
function loadInitialItems () {
return {
type: INITIAL_LIST_LOAD,
};
} | Select a list, and set it as the active list. Called whenever the main
List component mounts or the list changes.
@param {String} id The list ID, passed via this.props.params.listId | loadInitialItems | javascript | keystonejs/keystone-classic | admin/client/App/screens/List/actions/index.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/screens/List/actions/index.js | MIT |
function setCurrentPage (index) {
return {
type: SET_CURRENT_PAGE,
index: parseInt(index),
};
} | Set the current page
@param {Number} index The page number we want to be on | setCurrentPage | javascript | keystonejs/keystone-classic | admin/client/App/screens/List/actions/index.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/screens/List/actions/index.js | MIT |
function itemLoadingError () {
return (dispatch) => {
dispatch({
type: ITEM_LOADING_ERROR,
err: 'Network request failed',
});
setTimeout(() => {
dispatch(loadItems());
}, NETWORK_ERROR_RETRY_DELAY);
};
} | Dispatched when unsuccessfully trying to load the items, will redispatch
loadItems after NETWORK_ERROR_RETRY_DELAY milliseconds until we get items back | itemLoadingError | javascript | keystonejs/keystone-classic | admin/client/App/screens/List/actions/items.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/screens/List/actions/items.js | MIT |
function deleteItems (ids) {
return (dispatch, getState) => {
const list = getState().lists.currentList;
list.deleteItems(ids, (err, data) => {
// TODO ERROR HANDLING
dispatch(loadItems());
});
};
} | Dispatched when unsuccessfully trying to load the items, will redispatch
loadItems after NETWORK_ERROR_RETRY_DELAY milliseconds until we get items back | deleteItems | javascript | keystonejs/keystone-classic | admin/client/App/screens/List/actions/items.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/screens/List/actions/items.js | MIT |
renderPageDrops () {
const { items, currentPage, pageSize } = this.props;
const totalPages = Math.ceil(items.count / pageSize);
const style = { display: totalPages > 1 ? null : 'none' };
const pages = [];
for (let i = 0; i < totalPages; i++) {
const page = i + 1;
const pageItems = '' + (page * pageSiz... | THIS IS ORPHANED AND ISN'T RENDERED AT THE MOMENT
THIS WAS DONE TO FINISH THE REDUX INTEGRATION, WILL REWRITE SOON
- @mxstbr | renderPageDrops | javascript | keystonejs/keystone-classic | admin/client/App/screens/List/components/ItemsTable/ItemsTableDragDropZone.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/screens/List/components/ItemsTable/ItemsTableDragDropZone.js | MIT |
render () {
return this.renderPageDrops();
} | THIS IS ORPHANED AND ISN'T RENDERED AT THE MOMENT
THIS WAS DONE TO FINISH THE REDUX INTEGRATION, WILL REWRITE SOON
- @mxstbr | render | javascript | keystonejs/keystone-classic | admin/client/App/screens/List/components/ItemsTable/ItemsTableDragDropZone.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/screens/List/components/ItemsTable/ItemsTableDragDropZone.js | MIT |
componentDidUpdate () {
if (timeoutID && !this.props.isOver) {
clearTimeout(timeoutID);
timeoutID = false;
}
} | THIS IS ORPHANED AND ISN'T RENDERED AT THE MOMENT
THIS WAS DONE TO FINISH THE REDUX INTEGRATION, WILL REWRITE SOON
- @mxstbr | componentDidUpdate | javascript | keystonejs/keystone-classic | admin/client/App/screens/List/components/ItemsTable/ItemsTableDragDropZoneTarget.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/screens/List/components/ItemsTable/ItemsTableDragDropZoneTarget.js | MIT |
render () {
const { pageItems, page, isOver, dispatch } = this.props;
let { className } = this.props;
if (isOver) {
className += (page === this.props.currentPage) ? ' is-available ' : ' is-waiting ';
}
return this.props.connectDropTarget(
<div
className={className}
onClick={(e) => {
dispatc... | THIS IS ORPHANED AND ISN'T RENDERED AT THE MOMENT
THIS WAS DONE TO FINISH THE REDUX INTEGRATION, WILL REWRITE SOON
- @mxstbr | render | javascript | keystonejs/keystone-classic | admin/client/App/screens/List/components/ItemsTable/ItemsTableDragDropZoneTarget.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/screens/List/components/ItemsTable/ItemsTableDragDropZoneTarget.js | MIT |
function dropProps (connect, monitor) {
return {
connectDropTarget: connect.dropTarget(),
isOver: monitor.isOver(),
};
} | Specifies the props to inject into your component. | dropProps | javascript | keystonejs/keystone-classic | admin/client/App/screens/List/components/ItemsTable/ItemsTableDragDropZoneTarget.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/screens/List/components/ItemsTable/ItemsTableDragDropZoneTarget.js | MIT |
function dragProps (connect, monitor) {
return {
connectDragSource: connect.dragSource(),
isDragging: monitor.isDragging(),
connectDragPreview: connect.dragPreview(),
};
} | Specifies the props to inject into your component. | dragProps | javascript | keystonejs/keystone-classic | admin/client/App/screens/List/components/ItemsTable/ItemsTableRow.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/screens/List/components/ItemsTable/ItemsTableRow.js | MIT |
function dropProps (connect) {
return {
connectDropTarget: connect.dropTarget(),
};
} | Specifies the props to inject into your component. | dropProps | javascript | keystonejs/keystone-classic | admin/client/App/screens/List/components/ItemsTable/ItemsTableRow.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/screens/List/components/ItemsTable/ItemsTableRow.js | MIT |
getDefaultProps () {
return {
alerts: {},
};
} | This renders alerts for API success and error responses.
Error format: {
error: 'validation errors' // The unique error type identifier
detail: { ... } // Optional details specific to that error type
}
Success format: {
success: 'item updated', // The unique success type identifier
details: { ... ... | getDefaultProps | javascript | keystonejs/keystone-classic | admin/client/App/shared/AlertMessages.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/shared/AlertMessages.js | MIT |
renderValidationErrors () {
let errors = this.props.alerts.error.detail;
if (errors.name === 'ValidationError') {
errors = errors.errors;
}
let errorCount = Object.keys(errors).length;
let alertContent;
let messages = Object.keys(errors).map((path) => {
if (errorCount > 1) {
return (
<li key=... | This renders alerts for API success and error responses.
Error format: {
error: 'validation errors' // The unique error type identifier
detail: { ... } // Optional details specific to that error type
}
Success format: {
success: 'item updated', // The unique success type identifier
details: { ... ... | renderValidationErrors | javascript | keystonejs/keystone-classic | admin/client/App/shared/AlertMessages.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/shared/AlertMessages.js | MIT |
render () {
let { error, success } = this.props.alerts;
if (error) {
// Render error alerts
switch (error.error) {
case 'validation errors':
return this.renderValidationErrors();
case 'error':
if (error.detail.name === 'ValidationError') {
return this.renderValidationErrors();
} ... | This renders alerts for API success and error responses.
Error format: {
error: 'validation errors' // The unique error type identifier
detail: { ... } // Optional details specific to that error type
}
Success format: {
success: 'item updated', // The unique success type identifier
details: { ... ... | render | javascript | keystonejs/keystone-classic | admin/client/App/shared/AlertMessages.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/shared/AlertMessages.js | MIT |
getDefaultProps () {
return {
err: null,
isOpen: false,
};
} | The form that's visible when "Create <ItemName>" is clicked on either the
List screen or the Item screen | getDefaultProps | javascript | keystonejs/keystone-classic | admin/client/App/shared/CreateForm.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/shared/CreateForm.js | MIT |
getInitialState () {
// Set the field values to their default values when first rendering the
// form. (If they have a default value, that is)
var values = {};
Object.keys(this.props.list.fields).forEach(key => {
var field = this.props.list.fields[key];
var FieldComponent = Fields[field.type];
values[f... | The form that's visible when "Create <ItemName>" is clicked on either the
List screen or the Item screen | getInitialState | javascript | keystonejs/keystone-classic | admin/client/App/shared/CreateForm.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/shared/CreateForm.js | MIT |
componentDidMount () {
document.body.addEventListener('keyup', this.handleKeyPress, false);
} | The form that's visible when "Create <ItemName>" is clicked on either the
List screen or the Item screen | componentDidMount | javascript | keystonejs/keystone-classic | admin/client/App/shared/CreateForm.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/shared/CreateForm.js | MIT |
componentWillUnmount () {
document.body.removeEventListener('keyup', this.handleKeyPress, false);
} | The form that's visible when "Create <ItemName>" is clicked on either the
List screen or the Item screen | componentWillUnmount | javascript | keystonejs/keystone-classic | admin/client/App/shared/CreateForm.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/shared/CreateForm.js | MIT |
handleKeyPress (evt) {
if (vkey[evt.keyCode] === '<escape>') {
this.props.onCancel();
}
} | The form that's visible when "Create <ItemName>" is clicked on either the
List screen or the Item screen | handleKeyPress | javascript | keystonejs/keystone-classic | admin/client/App/shared/CreateForm.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/shared/CreateForm.js | MIT |
handleChange (event) {
var values = assign({}, this.state.values);
values[event.path] = event.value;
this.setState({
values: values,
});
} | The form that's visible when "Create <ItemName>" is clicked on either the
List screen or the Item screen | handleChange | javascript | keystonejs/keystone-classic | admin/client/App/shared/CreateForm.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/shared/CreateForm.js | MIT |
getFieldProps (field) {
var props = assign({}, field);
props.value = this.state.values[field.path];
props.values = this.state.values;
props.onChange = this.handleChange;
props.mode = 'create';
props.key = field.path;
return props;
} | The form that's visible when "Create <ItemName>" is clicked on either the
List screen or the Item screen | getFieldProps | javascript | keystonejs/keystone-classic | admin/client/App/shared/CreateForm.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/shared/CreateForm.js | MIT |
submitForm (event) {
event.preventDefault();
const createForm = event.target;
const formData = new FormData(createForm);
this.props.list.createItem(formData, (err, data) => {
if (data) {
if (this.props.onCreate) {
this.props.onCreate(data);
} else {
// Clear form
this.setState({
... | The form that's visible when "Create <ItemName>" is clicked on either the
List screen or the Item screen | submitForm | javascript | keystonejs/keystone-classic | admin/client/App/shared/CreateForm.js | https://github.com/keystonejs/keystone-classic/blob/master/admin/client/App/shared/CreateForm.js | MIT |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.