Skip to content

Commit

Permalink
Merge pull request #13 from rwth-acis/reqbaz-dev
Browse files Browse the repository at this point in the history
Reqbaz dev Merge
  • Loading branch information
Albi Sema authored Aug 4, 2016
2 parents 1f6ebc8 + 3d20e52 commit e8ceeb2
Show file tree
Hide file tree
Showing 2,849 changed files with 3,240 additions and 351,930 deletions.
Binary file modified .DS_Store
Binary file not shown.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ bower_components
.idea/workspace.xml
.idea/tasks.xml
.idea/dictionaries
components
Binary file modified app/.DS_Store
Binary file not shown.
Binary file modified app/elements/.DS_Store
Binary file not shown.
30 changes: 26 additions & 4 deletions app/elements/comments-list/comments-list.html
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ <h2><i18n-msg msgid="delCommTitle"></i18n-msg>?</h2>
<div class="comment layout horizontal">
<div class="profileImage" style$="[[getProfileStyle(item.creator.profileImage)]]"></div>
<div class="layout vertical flex">
<div>[[item.message]]</div>
<div inner-h-t-m-l="{{validateUrl(item.message)}}"></div>
<div class="info helper">
<time is="relative-time" datetime$="[[item.creationTime]]"></time> <i18n-msg msgid="by"></i18n-msg> <req-user user-id="[[item.creatorId]]" normal-view></req-user>
<time is="relative-time" datetime$="[[item.creationTime]]"></time> <i18n-msg msgid="by"></i18n-msg> <req-user user="[[item.creator]]" normal-view></req-user>
</div>
</div>
<template is="dom-if" if="{{isCreator(item.creatorId)}}">
Expand Down Expand Up @@ -133,8 +133,8 @@ <h2><i18n-msg msgid="delCommTitle"></i18n-msg>?</h2>
deleteComment: function(e) {
if (e.detail.confirmed) {
var request = this.$.postDeleteComment;
request.url = app.baseHref + "/requirements/" + this.elem.id;
request.params = app.header;
request.url = app.baseHref + "/comments/" + this.elem.id;
request.headers = app.header;
request.generateRequest();
this.elem.parentNode.style.display = 'none';
}
Expand All @@ -147,6 +147,28 @@ <h2><i18n-msg msgid="delCommTitle"></i18n-msg>?</h2>
}
}
return false;
},

validateUrl: function(requirementDesc) {
var str = requirementDesc;
var expression = /\(?(?:(http|https|ftp):\/\/)?(?:((?:[^\W\s]|\.|-|[:]{1})+)@{1})?((?:www.)?(?:[^\W\s]|\.|-)+[\.][^\W\s]{2,4}|localhost(?=\/)|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})(?::(\d*))?([\/]?[^\s\?]*[\/]{1})*(?:\/?([^\s\n\?\[\]\{\}\#]*(?:(?=\.)){1}|[^\s\n\?\[\]\{\}\.\#]*)?([\.]{1}[^\s\?\#]*)?)?(?:\?{1}([^\s\n\#\[\]]*))?([\#][^\s\n]*)?\)?/gi;
var regex = new RegExp(expression);

if(!str.match(regex)) {
return str;
} else {
var txt = str;
for (var i = 0; i < str.match(regex).length; i++){
var replacement;
if (str.match(regex)[i].startsWith("http")){
replacement = "<a href='" + str.match(regex)[i] + "' target='_blank' class='highlight'>"+ str.match(regex)[i] +"</a>"
} else {
replacement = "<a href='http://" + str.match(regex)[i] + "' target='_blank' class='highlight'>"+ str.match(regex)[i] +"</a>"
}
txt = txt.replace(str.match(regex)[i], replacement);
}
return txt;
}
}
});
})();
Expand Down
13 changes: 13 additions & 0 deletions app/elements/elements.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@
<link rel="import" href="../components/iron-icons/iron-icons.html">
<link rel="import" href="../components/iron-pages/iron-pages.html">
<link rel="import" href="../components/iron-selector/iron-selector.html">
<link rel="import" href="../components/iron-form/iron-form.html">

<link rel="import" href="../components/iron-ajax/iron-ajax.html">
<link rel="import" href="../components/iron-icons/social-icons.html">
<link rel="import" href="../components/iron-collapse/iron-collapse.html">
<link rel="import" href="../components/iron-image/iron-image.html">

<!-- Paper elements -->
<link rel="import" href="../components/paper-drawer-panel/paper-drawer-panel.html">
Expand All @@ -28,6 +30,7 @@
<link rel="import" href="../components/paper-styles/paper-styles-classes.html">
<link rel="import" href="../components/paper-toast/paper-toast.html">
<link rel="import" href="../components/paper-toolbar/paper-toolbar.html">
<link rel="import" href="../components/paper-slider/paper-slider.html">

<link rel="import" href="../components/paper-card/paper-card.html">
<link rel="import" href="../components/paper-fab/paper-fab.html">
Expand All @@ -40,9 +43,14 @@
<link rel="import" href="../components/paper-item/paper-icon-item.html">
<link rel="import" href="../components/paper-tooltip/paper-tooltip.html">
<link rel="import" href="../components/paper-toggle-button/paper-toggle-button.html">
<link rel="import" href="../components/paper-radio-group/paper-radio-group.html">
<link rel="import" href="../components/paper-progress/paper-progress.html">
<link rel="import" href="../components/paper-spinner/paper-spinner.html">
<link rel="import" href="../components/paper-tabs/paper-tab.html">
<link rel="import" href="../components/paper-tabs/paper-tabs.html">
<link rel="import" href="../components/paper-checkbox/paper-checkbox.html">
<link rel="import" href="../components/i18n-msg/i18n-msg.html">
<link rel="import" href="../components/requirements-grid/requirements-grid.html">

<!-- Neon elements -->
<link rel="import" href="../components/neon-animation/animations/fade-in-animation.html">
Expand All @@ -68,5 +76,10 @@
<link rel="import" href="comments-list/comments-list.html">
<link rel="import" href="bread-crumb/bread-crumb.html">
<link rel="import" href="req-user/req-user.html">
<link rel="import" href="file-gallery/file-gallery.html">
<link rel="import" href="vaadin-upload/vaadin-upload.html">
<link rel="import" href="../components/openidconnect-signin/openidconnect-signin.html">
<link rel="import" href="../components/activity-tracker/activity-tracker.html">
<link rel="import" href="../components/emoji-selector/emoji-selector.html">
<link rel="import" href="../components/masonry-layout/masonry-layout.html">
<link rel="import" href="../components/iron-autogrow-textarea/iron-autogrow-textarea.html">
Binary file added app/elements/file-gallery/.DS_Store
Binary file not shown.
74 changes: 74 additions & 0 deletions app/elements/file-gallery/file-gallery.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<link rel="import" href="../../components/polymer/polymer.html">

<dom-module id="file-gallery">
<template>
<style is="custom-style">
#expandedImg {
width: 100%;
}
</style>

<div>
<template is="dom-repeat" items="{{attachments}}">
<img style="width:50px; height:50px;" src="[[item.fileUrl]]" on-tap="toggle">
</template>
</div>

<template is="dom-if" if="{{!grid}}">
<iron-collapse id="collapseImg">
<img id="expandedImg" on-tap="toggle">
</iron-collapse>
</template>

<template is="dom-if" if="{{grid}}">
<paper-dialog id="imgPopup">
<paper-dialog-scrollable>
<img id="popupImg">
</paper-dialog-scrollable>
</paper-dialog>
</template>

</template>

<script>
(function () {
// 'use strict';

Polymer({
is: 'file-gallery',
properties: {
attachments: {
type: Array,
notify: true
},
grid: {
type: Boolean,
value: false,
notify: true
}
},

toggle: function(e){
if (this.grid){
document.getElementById("popupImg").src = e.currentTarget.src;
document.getElementById("imgPopup").open();
} else {
if (!document.getElementById("collapseImg").opened){
document.getElementById("expandedImg").src = e.currentTarget.src;
document.getElementById("collapseImg").show();
} else {
if (document.getElementById("expandedImg").src === e.currentTarget.src){
document.getElementById("collapseImg").toggle();
} else {
document.getElementById("expandedImg").src = e.currentTarget.src;
}
}
}
}

});
})
();
</script>

</dom-module>
34 changes: 21 additions & 13 deletions app/elements/req-user/req-user.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,11 @@

.name {
font-size: 18px;
font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, FreeSerif, serif;
font-weight: 400;
}

.username {
font-size: 12px;
font-style: italic;
padding-top: 5px;
}

Expand All @@ -51,24 +49,27 @@
</style>

<iron-ajax
auto
id="usrReq"
url="{{usersUrl}}"
last-response="{{user}}"></iron-ajax>

<template is="dom-if" if="{{normalView}}">

<span id="user">{{user.userName}}</span>

<paper-tooltip for="user" class="custom hidden-mobile" animation-delay="0" position="top">
<img src="{{user.profileImage}}" class="profileImage">
<paper-item-body two-line>
<div class="name">
<span>{{user.firstName}}</span>
<span>{{user.lastName}}</span>
</div>
<div class="username">{{user.userName}}</div>
</paper-item-body>
</paper-tooltip>
<template is="dom-if" if="{{!noPopover}}">
<paper-tooltip for="user" class="custom hidden-mobile" animation-delay="0" position="top">
<img src="{{user.profileImage}}" class="profileImage">
<paper-item-body two-line>
<div class="name">
<span>{{user.firstName}}</span>
<span>{{user.lastName}}</span>
</div>
<div class="username">{{user.userName}}</div>
</paper-item-body>
</paper-tooltip>
</template>


</template>

Expand Down Expand Up @@ -110,6 +111,10 @@
type: Object,
notify: true
},
noPopover:{
type: Boolean,
value: false
},
usersUrl: {
type: String,
computed: 'computeUsersUrl(userId)'
Expand All @@ -130,6 +135,9 @@

computeUsersUrl: function(userId){
return app.baseHref + "/users/" + userId;
},
load: function (){
this.$.usrReq.generateRequest();
}

});
Expand Down
Loading

0 comments on commit e8ceeb2

Please sign in to comment.