Skip to content
This repository was archived by the owner on Jun 27, 2018. It is now read-only.

[RFR] Introducing dashboard and collections#14

Merged
fzaninotto merged 3 commits intomasterfrom
dashboard
Jun 17, 2015
Merged

[RFR] Introducing dashboard and collections#14
fzaninotto merged 3 commits intomasterfrom
dashboard

Conversation

@fzaninotto
Copy link
Copy Markdown
Member

To let developers customize the dashboard to their will, we must decouple:

  • the collections that must be fetched for the dashboard
  • the rendering to be done with these collections.

the dashboardView() logic doesn't allow that, so I propose this new syntax, quite similar to that of the new menu() configuration:

admin.dashboard(nga.dashboard()
    .addCollection('posts', nga.collection(posts)
      .only({ published: true})
      .perPage(5) // limit the panel to the 5 latest posts
      .fields([
         nga.field('title').isDetailLink(true).map(truncate)
      ])
      .order()
     )
    .addCollection('tags', nga.collection(tags)
    .addCollection('comments', nga.collection(comments)
       .perPage(10)
       .fields([
           nga.field('id'),
           nga.field('name'),
           nga.field('published', 'boolean').label('Is published ?')
       ])
    )
   .template('....')
);

Changes to ng-admin are yet to be pushed, but this PR is BC.

@fzaninotto
Copy link
Copy Markdown
Member Author

Back to WIP, it seems to break somewhere.

@fzaninotto fzaninotto changed the title [RFR] Introducing dashboard and collections [WIP] Introducing dashboard and collections Jun 15, 2015
@fzaninotto
Copy link
Copy Markdown
Member Author

Back to RFR

@fzaninotto fzaninotto changed the title [WIP] Introducing dashboard and collections [RFR] Introducing dashboard and collections Jun 15, 2015
fzaninotto added a commit that referenced this pull request Jun 17, 2015
[RFR] Introducing dashboard and collections
@fzaninotto fzaninotto merged commit 19966e5 into master Jun 17, 2015
@fzaninotto fzaninotto deleted the dashboard branch June 17, 2015 16:06
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant