Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filtering panel: wrap and truncate long values to display #163

Merged
merged 1 commit into from
Mar 31, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/app/panels/filtering/module.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
.filter-panel-filter ul {
margin-bottom: 3px;
}
.filter-values {
word-wrap: break-word;
overflow-x: hidden;
}
.filter-must {
border-bottom: #7EB26D 3px solid;
}
Expand Down Expand Up @@ -59,9 +63,9 @@

</div>

<div ng-hide="filterSrv.list[id].editing && isEditable(filterSrv.list[id])">
<div ng-hide="filterSrv.list[id].editing && isEditable(filterSrv.list[id])" class="filter-values">
<ul class="unstyled">
<li ng-repeat="(key,value) in filterSrv.list[id]" ng-show="show_key(key)"><strong>{{key}}</strong> : {{value}}</li>
<li ng-repeat="(key,value) in filterSrv.list[id]" ng-show="show_key(key)"><strong>{{key}}</strong> : {{value | truncate}}</li>
</ul>
</div>
<div ng-show="filterSrv.list[id].editing && isEditable(filterSrv.list[id])">
Expand Down
11 changes: 10 additions & 1 deletion src/app/panels/filtering/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,15 @@ function (angular, app, _) {
return true;
}
};
});

module.filter('truncate', function() {
return function(text, length) {
length = length || 200;
if (!_.isUndefined(text) && !_.isNull(text) && text.toString().length > 0) {
return text.length > length ? text.substr(0,length)+'...' : text;
}
return '';
};
});
});
});