Skip to content

Commit

Permalink
Switch to an object-based filter attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
fzaninotto committed Mar 6, 2015
1 parent e71f5b7 commit 4cd8d26
Show file tree
Hide file tree
Showing 7 changed files with 525 additions and 9 deletions.
Binary file added examples/blog/assets/fonts/FontAwesome.otf
Binary file not shown.
Binary file not shown.
520 changes: 520 additions & 0 deletions examples/blog/assets/fonts/fontawesome-webfont.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion examples/blog/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
nga.field('body').label('Comment')
]),
nga.field('', 'template').label('')
.template('<span class="pull-right"><ma-filtered-list-button entity-name="comments" filter-name="post_id" filter-value="entry.values.id" text="" size="sm"></ma-filtered-list-button></span>')
.template('<span class="pull-right"><ma-filtered-list-button entity-name="comments" filter="{ post_id: entry.values.id }" size="sm"></ma-filtered-list-button></span>')
]);

post.showView() // a showView displays one entry in full page - allows to display more data than in a a list
Expand Down
12 changes: 4 additions & 8 deletions src/javascripts/ng-admin/Crud/button/maFilteredListButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ define(function () {
* <!-- In a scope where the current entry is a post, link tio the related comments -->
* <ma-filtered-list-button
* entity-name="comments"
* filter-name="post_id"
* filter-value="entry.values.id"
* filter="{ post_id: entry.values.id }"
* text="See related comments"
* size="xs">
* </ma-filtered-list-button>')
Expand All @@ -21,24 +20,21 @@ define(function () {
*
* nga.field('', 'template')
* .label('')
* .template('<ma-filtered-list-button entity-name="comments" filter-name="post_id" filter-value="entry.values.id"></ma-filtered-list-button>')
* .template('<ma-filtered-list-button entity-name="comments" filter="{ post_id: entry.values.id }"></ma-filtered-list-button>')
*/
function maFilteredListButtonDirective($state) {
return {
restrict: 'E',
scope: {
entityName: '@',
filterName: '@',
filterValue: '&',
filter: '&',
text: '@',
size: '@'
},
link: function (scope) {
scope.buttonText = scope.text || ('See all related ' + scope.entityName);
scope.gotoList = function () {
var searchfilter = {};
searchfilter[scope.filterName] = scope.filterValue();
$state.go($state.get('list'), { 'entity': scope.entityName, 'search': searchfilter});
$state.go($state.get('list'), { 'entity': scope.entityName, 'search': scope.filter()});

};
},
Expand Down

0 comments on commit 4cd8d26

Please sign in to comment.