Skip to content

Commit

Permalink
initial implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
gautamsi committed Feb 24, 2020
1 parent eeae353 commit 7f7735e
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 6 deletions.
1 change: 1 addition & 0 deletions packages/app-admin-ui/client/classes/List.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export default class List {
constructor(config, adminMeta, views, listHooks = {}) {
this.config = config;
this.adminMeta = adminMeta;
this.hooks = listHooks;

// TODO: undo this
Object.assign(this, config);
Expand Down
14 changes: 9 additions & 5 deletions packages/app-admin-ui/client/pages/Item/ItemTitle.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,15 @@ export let ItemTitle = memo(function ItemTitle({ titleText, adminPath }) {
{itemHeaderActions ? (
itemHeaderActions({ ItemId, AddNewItem })
) : (
<div>
<ItemId />
<AddNewItem />
</div>
)}
<div>
<ItemId />
<AddNewItem />
</div>
)}
{(list.hooks.components &&
list.hooks.components.ItemTitle &&
list.hooks.components.ItemTitle.map(TitleComponent => <TitleComponent {...{ ItemId, AddNewItem, list }} />)) ||
null}
</FlexGroup>
</HeaderInset>
);
Expand Down
8 changes: 7 additions & 1 deletion packages/app-admin-ui/client/pages/Item/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,13 @@ const ItemDetails = withRouter(
return (
<Fragment>
{itemHasChanged && <PreventNavigation />}
<ItemTitle id={item.id} list={list} adminPath={adminPath} titleText={savedData._label_} />
<ItemTitle
item={item}
id={item.id}
list={list}
adminPath={adminPath}
titleText={savedData._label_}
/>
<Card css={{ marginBottom: '3em', paddingBottom: 0 }}>
<Form>
<AutocompleteCaptor />
Expand Down
1 change: 1 addition & 0 deletions packages/app-admin-ui/client/providers/AdminMeta.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ function readAdminMeta() {
let hooks = {};
if (typeof hookView === 'function') {
[hooks] = readViews([hookView]);
adminMeta.hooks = hooks;
}
if (!hasInitialisedLists) {
let viewsToLoad = new Set();
Expand Down
3 changes: 3 additions & 0 deletions packages/field-views-loader/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ module.exports = function() {
[listPath]: { // e.g "User"
...
access: { create, read, update, delete, auth },
components: {
////....
},
views: {
[fieldPath]: { // e.g 'email'
Controller: 'absolute/path/to/controller',
Expand Down

0 comments on commit 7f7735e

Please sign in to comment.