Skip to content

Commit

Permalink
fix(thumbnails): fix removing local links
Browse files Browse the repository at this point in the history
  • Loading branch information
johannesjo committed Mar 9, 2018
1 parent 8b7376f commit bc3102e
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 7 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 13 additions & 2 deletions app-src/scripts/task-local-links/_task-local-links-cp.scss
@@ -1,8 +1,15 @@
task-local-links {
ul {
display: flex;
flex-direction: row;
flex-wrap: wrap;
}

li {
display: flex;
flex-wrap: wrap;
flex-direction: row;
width: 100%;
}

.md-button.md-icon-button {
Expand All @@ -17,12 +24,16 @@ task-local-links {
}

li.thumbnail-box {
max-width: 32%;
// width: calc(98% / 3);
width: 32.666666666%;
display: block;
float: left;
margin-bottom: 10px;
margin-right: 1%;

&:nth-of-type(3n) {
margin-right: 0;
}

img {
max-width: 100%;
height: auto;
Expand Down
4 changes: 2 additions & 2 deletions app-src/scripts/task-local-links/task-local-links-cp.html
Expand Up @@ -8,7 +8,7 @@

<div class="status-line">
<md-button class="md-icon-button md-raised md-warn trash-button"
ng-click="$ctrl.removeLink($index)"
ng-click="$ctrl.removeLink(link)"
aria-label="remove link">
<ng-md-icon icon="delete_forever"
size="22"></ng-md-icon>
Expand Down Expand Up @@ -59,7 +59,7 @@
</a>

<md-button class="md-icon-button md-raised md-warn trash-button"
ng-click="$ctrl.removeLink($index)"
ng-click="$ctrl.removeLink(link)"
aria-label="remove link">
<ng-md-icon icon="delete_forever"
size="22"></ng-md-icon>
Expand Down
7 changes: 5 additions & 2 deletions app-src/scripts/task-local-links/task-local-links-cp.js
Expand Up @@ -13,8 +13,11 @@
constructor() {
}

removeLink($index) {
this.localLinks.splice($index, 1);
removeLink(link) {
const itemIndex = this.localLinks.findIndex(item => (item === link));
console.log(itemIndex);

this.localLinks.splice(itemIndex, 1);
}
}

Expand Down

0 comments on commit bc3102e

Please sign in to comment.