Skip to content

Commit

Permalink
Fixed text overflow
Browse files Browse the repository at this point in the history
Text overflow fixed adding new css class to span containing text.
  • Loading branch information
Reenuay committed Nov 27, 2016
1 parent 2a68587 commit 4715f80
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
8 changes: 6 additions & 2 deletions app/main/categories/categories.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,19 +67,22 @@

//edits categorie
$scope.categories.edit = function (index) {
//selector function
var f = function () {
//select current
//use index passed by user input to select list item and make selected item editing
$scope.categories.list[index].editing = true;
//write index
$scope.categories.selected = index;
};
//if there is selected one deselect it

//if there is selected one, deselect it, cancel its changes and select new by index
if ($scope.categories.selected !== undefined) {
$scope.categories.list[$scope.categories.selected].editing = false;
$scope.categories.cancel().$loaded()
.then(f)
.catch(error);
} else {
//else just select new by index
f();
}
};
Expand All @@ -94,6 +97,7 @@
$scope.categories.save = function (index) {
//deselect item
$scope.categories.selected = undefined;
//delete editing property because database will not accept it
delete $scope.categories.list[index].editing;
//save it
$scope.categories.list.$save(index)
Expand Down
2 changes: 1 addition & 1 deletion app/main/categories/categories.template.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ <h3>Categories <span class="glyphicon glyphicon-tag glyphicon-size-sm"></span></
<!-- repeating list items -->
<a class="list-group-item" ng-repeat="categorie in filtered = (categories.list | filter:{name:categories.search}) track by $index" ng-if="categories.list.length > 0">
<span class="{{categorie.icon}}" style="color: {{categorie.color}}" ng-if="!categorie.editing"></span>
<span ng-bind="categorie.name" ng-if="!categorie.editing"></span>
<span ng-bind="categorie.name" ng-if="!categorie.editing" class="hide-text"></span>
<span class="badge" role="button" ng-click="categories.remove(categorie)" ng-if="!categorie.editing">
<span class="glyphicon glyphicon-remove" ></span>
</span>
Expand Down
7 changes: 7 additions & 0 deletions css/block.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,10 @@
.navbar-brand {
padding: 5px 15px;
}

.hide-text {
display: inline-block;
text-overflow: ellipsis;
overflow: hidden;
max-width: 60%;
}

0 comments on commit 4715f80

Please sign in to comment.