List result tweaks

- Added truncation filter.
- Truncated story description.
- Hide created/updated dates on list and story when very small.
- Project without 'updated' date shows 'not updated'
- long continuous strings pasted into descriptions now are
  forcefully wrapped.

Change-Id: I84be21e88f6e0a32e04fcad76160c3c706c796f6
This commit is contained in:
Michael Krotscheck
2014-09-26 09:19:25 -07:00
parent 3b38cd4449
commit 73fc59f8f0
5 changed files with 52 additions and 16 deletions

View File

@@ -94,7 +94,7 @@
</i>
</a>
</th>
<th>
<th class="hidden-xs">
<a ng-click="toggleFilter('created_at')">
Created
<i class="fa fa-caret-down"
@@ -105,7 +105,7 @@
</i>
</a>
</th>
<th>
<th class="hidden-xs">
<a ng-click="toggleFilter('updated_at')">
Updated
<i class="fa fa-caret-down"

View File

@@ -1,17 +1,23 @@
<td>
<a href="#!/project/{{project.id}}">
{{project.name}}
{{project.name | truncate: 97}}
</a>
<br/>
<span class="text-muted">
{{project.description}}
{{project.description | truncate: 97}}
</span>
</td>
<td>
<td class="hidden-xs">
<span time-moment eventdate="project.created_at">
</span>
</td>
<td>
<span time-moment eventdate="project.updated_at">
<td class="hidden-xs">
<span time-moment
ng-if="project.updated_at"
eventdate="project.updated_at">
</span>
<em ng-if="!project.updated_at"
class="text-muted">
Not updated
</em>
</td>

View File

@@ -1,20 +1,20 @@
<td>
<td class="col-xs-7" style="word-break: break-word">
<a href="#!/story/{{story.id}}">
{{story.id}}: {{story.title}}
{{story.id}}: {{story.title | truncate: 97}}
</a>
<br />
<br/>
<span class="text-muted">
{{story.description}}
{{story.description | truncate: 97}}
</span>
</td>
<td>
<td class="col-sm-2 hidden-xs">
<span time-moment eventdate="story.created_at">
</span>
</td>
<td>
<td class="col-sm-2 hidden-xs">
<span time-moment eventdate="story.updated_at">
</span>
</td>
<td class="text-right">
<td class="text-right col-xs-1">
<story-status-label story="story"/>
</td>

View File

@@ -91,7 +91,7 @@
</i>
</a>
</th>
<th>
<th class="hidden-xs">
<a ng-click="toggleFilter('created_at')">
Created
<i class="fa fa-caret-down"
@@ -102,7 +102,7 @@
</i>
</a>
</th>
<th>
<th class="hidden-xs">
<a ng-click="toggleFilter('updated_at')">
Updated
<i class="fa fa-caret-down"

View File

@@ -0,0 +1,30 @@
/*
* Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License. You may obtain
* a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*/
/**
* A truncation filter.
*/
angular.module('sb.util').filter('truncate',
function () {
'use strict';
return function (value, length) {
if (value && value.length > length) {
value = value.substr(0, length - 3) + '...';
}
return value;
};
});