Skip to content

Commit

Permalink
Merge pull request #58 from rwth-acis/release-1.4.2
Browse files Browse the repository at this point in the history
Release 1.4.2
  • Loading branch information
istvank authored May 9, 2017
2 parents 81abbca + 7e5fbf9 commit 6986ed1
Show file tree
Hide file tree
Showing 13 changed files with 1,587 additions and 942 deletions.
5 changes: 3 additions & 2 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "requirements-bazaar-web-frontend",
"version": "1.4.1",
"version": "1.4.2",
"authors": [
"István Koren",
"Albi Sema",
Expand Down Expand Up @@ -54,7 +54,8 @@
"iron-media-query": "PolymerElements/iron-media-query#^1.0.8",
"iron-list": "PolymerElements/iron-list#^1.4.0",
"paper-dropdown-menu": "PolymerElements/paper-dropdown-menu#^1.5.0",
"paper-listbox": "PolymerElements/paper-listbox#^1.1.2"
"paper-listbox": "PolymerElements/paper-listbox#^1.1.2",
"iron-scroll-threshold": "PolymerElements/iron-scroll-threshold#^1.0.3"
},
"devDependencies": {
"web-component-tester": "^4.0.0"
Expand Down
100 changes: 49 additions & 51 deletions elements/comments-list/comments-list.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,9 @@
margin-left: 40px;
}

paper-progress {
--paper-progress-active-color: #FF5252;
width: 100%;
z-index: 1;
.actions {
font-size: 12px;
color: #90949c;
}

paper-toast {
Expand All @@ -71,25 +70,16 @@

<!-- XHR for loading comments: -->

<iron-ajax id="commentsLoader"
<iron-ajax id="commentsRequest"
loading="{{loading}}"
url="{{resourceURL}}"
last-response="{{comments}}"
params='{"page":"0", "per_page":"150"}'></iron-ajax>

<!-- XHR for deleting comments: -->

<iron-ajax id="deleteCommentRequest"
handle-as="json"
content-type="application/json"
method="DELETE"
headers="[[authHeader]]"
on-response="_handleDeleteCommentResponse"
on-error="errorHandler"></iron-ajax>

<!-- XHR for posting comments: -->

<iron-ajax id="postCommentRequest"
loading="{{loading}}"
handle-as="json"
content-type="application/json"
method="POST"
Expand All @@ -99,17 +89,12 @@
last-response="{{postResponse}}"
on-error="errorHandler"></iron-ajax>

<!-- Progress bar while doing requests: -->
<!-- Show this when no comments are there after loading -->
<div class="noComments" hidden$="[[_computeNoCommentsHidden(comments)]]">[[localize('noComments')]]</div>

<paper-progress indeterminate hidden$="{{!loading}}"></paper-progress>
<!-- Comments -->

<!-- Show this when no comments are there after loading: -->

<div class="noComments" hidden$="[[!noComments]]">[[localize('noComments')]]</div>

<!-- Comments: -->

<template is="dom-repeat" items="{{comments}}">
<template is="dom-repeat" items="{{comments}}" on-dom-change="_handleCommentsDomChange">

<!-- Compute the styling classes, add attribute "reply" when it is a reply. -->
<div class$="[[_computeCommentClasses(item)]]" attr="{{item.Id}}">
Expand All @@ -127,18 +112,6 @@

</template>

<!-- Dialog for deleting a comment: -->

<paper-dialog id="deleteDialog" modal on-iron-overlay-closed="_handleDeleteDialogClosed" entry-animation="fade-in-animation"
exit-animation="fade-out-animation">
<h2>[[localize('delCommTitle')]]?</h2>
<p>[[localize('delCommDesc')]]</p>
<div class="buttons">
<paper-button dialog-dismiss>[[localize('cancel')]]</paper-button>
<paper-button dialog-confirm autofocus>[[localize('delete')]]</paper-button>
</div>
</paper-dialog>

<!-- Toast for app notifications: -->

<paper-toast id="toast"></paper-toast>
Expand Down Expand Up @@ -169,13 +142,13 @@ <h2>[[localize('delCommTitle')]]?</h2>
type: Array,
notify: true
},
/** True when the iron-ajax request is on load */
/**
* Whether any loading operation is currently active.
*/
loading: {
type: Boolean,
observer: '_computeNoComments'
notify: true
},
/** True when loading is false and comments are empty */
noComments: Boolean,
/**
* The ID of the comment to be deleted.
*/
Expand Down Expand Up @@ -212,17 +185,16 @@ <h2>[[localize('delCommTitle')]]?</h2>
},

/**
* Updates the property noComments whenever loading property changes. It checks if there are still no comments even after the
* request has finished loading.
* Calculates whether the "no comments" div is shown or not.
*/
_computeNoComments: function() {
_computeNoCommentsHidden: function(comments) {
if (this.comments !== undefined) {
if ((this.comments.length === 0) && (!this.loading)) {
this.noComments = true;
return;
if (this.comments.length === 0) {
return false;
}
}
this.noComments = false;

return true;
},

/**
Expand Down Expand Up @@ -255,7 +227,10 @@ <h2>[[localize('delCommTitle')]]?</h2>
}
//clear the paper-input and hide it
e.currentTarget.value = '';
e.currentTarget.style.display = "none";
e.currentTarget.hidden = true;

// notify container to resize
this.fire('iron-signal', {name: 'resize'});
}
},

Expand Down Expand Up @@ -294,7 +269,7 @@ <h2>[[localize('delCommTitle')]]?</h2>
* Generates request for loading comments.
*/
refresh: function() {
this.$.commentsLoader.generateRequest();
this.$.commentsRequest.generateRequest();
},

/**
Expand Down Expand Up @@ -358,6 +333,9 @@ <h2>[[localize('delCommTitle')]]?</h2>
replyInput.hidden = false;
replyInput.focus();

// notify container to resize
this.fire('iron-signal', {name: 'resize'});

e.preventDefault();
},

Expand All @@ -367,8 +345,17 @@ <h2>[[localize('delCommTitle')]]?</h2>
* @property e
*/
_handleDeleteTap: function(e) {
this._currentDeleteId = e.model.item.Id
this.$.deleteDialog.open();
var data = {};
data.comment = e.model.item;
data.onDelete = function() {
// delete the comment from the model
for (var i = 0; i<this.comments.length; i++) {
if (this.comments[i].Id === data.comment.Id) {
this.splice('comments', i, 1);
}
}
}.bind(this);
this.fire('iron-signal', {name: 'delete-comment', data: data});
},

/**
Expand Down Expand Up @@ -398,6 +385,17 @@ <h2>[[localize('delCommTitle')]]?</h2>
}
return txt;
}
},

/**
* Event handler for adding new comments to the DOM. Needs to fire a resize event so that the iron-list can
* resize appropriately.
*
* @param e
* @private
*/
_handleCommentsDomChange: function(e) {
this.fire('iron-signal', {name: 'resize'});
}

});
Expand Down
4 changes: 3 additions & 1 deletion elements/file-gallery/file-gallery.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
</template>

<!-- show images in the list view -->
<iron-collapse id="imageCollapse">
<iron-collapse id="imageCollapse" no-animation>
<img id="expandedImage">
</iron-collapse>

Expand Down Expand Up @@ -85,6 +85,8 @@ <h2 id="imgTitle"></h2>
this.$.expandedImage.src = imageUrl;
this.$.imageCollapse.show();
}

this.fire('iron-signal', {name: 'resize'});
},

/**
Expand Down
Loading

0 comments on commit 6986ed1

Please sign in to comment.