Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
KristjanLiiva committed May 20, 2015
2 parents ad7dc37 + 9e3cec4 commit 79ae204
Show file tree
Hide file tree
Showing 10 changed files with 308 additions and 271 deletions.
6 changes: 6 additions & 0 deletions app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
<link rel="import" href="bower_components/paper-fab/paper-fab.html">
<link rel="import" href="bower_components/paper-radio-group/paper-radio-group.html">
<link rel="import" href="bower_components/paper-input/paper-autogrow-textarea.html">
<link rel="import" href="bower_components/paper-shadow/paper-shadow.html">

<link rel="import" href="my-components/paper-dropdown-menu-ex.html">
<link rel="import" href="my-components/my-user.html">
Expand All @@ -66,6 +67,11 @@
<!-- Add your site or application content here -->
<div class="container" ng-view></div>

<!--Feedback toast-->
<paper-toast role="alert" id="feedbackToast">
<div ng-bind="'HIDE' | translate" style="color: #ffff00;"></div>
</paper-toast>

<!-- Google Analytics: change UA-XXXXX-X to be your site's ID -->
<!--<script>-->
<!--(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){-->
Expand Down
4 changes: 3 additions & 1 deletion app/scripts/config/oauthConfig.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

angular.module('requirementsBazaarWebFrontendApp')
.constant( 'oauthConfig', {
'SITE' : 'https://api.learning-layers.eu/o/oauth2',
Expand All @@ -6,7 +8,7 @@ angular.module('requirementsBazaarWebFrontendApp')
'REDIRECT_URI' : location.origin+location.pathname,
'PROFILE_URI' : 'https://api.learning-layers.eu/o/oauth2/userinfo',
'SCOPE' : 'public',
'TEMPLATE' : location.origin+location.pathname + "my-components/sign-in-button.html"
'TEMPLATE' : location.origin+location.pathname + 'my-components/sign-in-button.html'
})

// Make the oauth config available in the HTML
Expand Down
33 changes: 31 additions & 2 deletions app/scripts/controllers/requirement.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,37 @@ angular.module('requirementsBazaarWebFrontendApp')

$scope.attachments = [];
$scope.showRequirement = false;
$scope.showContributors = false;
$scope.showContributors = true;

$scope.dirtyReq = null;
$scope.isDirtyReq = false;

$scope.reqCreator = 'NaN';

// Used to show user who created the requirement
(function(){
reqBazService.getUser($scope.req.creatorId)
.success(function (user) {
if(user !== undefined){
$scope.reqCreator = user.userName;
}else{
$scope.reqCreator = 'Unknown';
console.log('user not loaded');
}
})
.error(function () {
$scope.reqCreator = 'Unknown';
console.log('user not loaded');
});
})();

// Determine whether contributors should be shown right away
(function(){
// device detection taken from Stackoverflow
if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|ipad|iris|kindle|Android|Silk|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(navigator.userAgent)
|| /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(navigator.userAgent.substr(0,4))) $scope.showContributors = false;
})();


/*
* Currently only images, videos and pdfs are accepted as attachments
Expand Down Expand Up @@ -125,9 +151,12 @@ angular.module('requirementsBazaarWebFrontendApp')
if($scope.showRequirement === false){
$scope.setSelectedReqId(req.id,index);
}
$scope.showContributors = !$scope.showContributors;
$scope.showContributors = true;
};

$scope.hideContrib = function(){
$scope.showContributors = false;
};

/*
* Toggles the visibility of a requirements
Expand Down
2 changes: 1 addition & 1 deletion app/scripts/directives/fallbackSrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ angular.module('requirementsBazaarWebFrontendApp')
var fallbackSrc = {
link: function postLink(scope, iElement, iAttrs) {
iElement.bind('error', function() {
angular.element(this).attr("src", iAttrs.fallbackSrc);
angular.element(this).attr('src', iAttrs.fallbackSrc);
});
}
};
Expand Down
19 changes: 12 additions & 7 deletions app/scripts/directives/infiniteScroll.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
app.directive('infiniteScroll', [
'use strict';

angular.module('requirementsBazaarWebFrontendApp')
.directive('infiniteScroll', [
'$rootScope', '$window', '$timeout', function($rootScope, $window, $timeout) {
return {
link: function(scope, elem, attrs) {
var checkWhenEnabled, handler, scrollDistance, scrollEnabled;
$window = angular.element($window);
scrollDistance = 0;
if (attrs.infiniteScrollDistance != null) {
if (attrs.infiniteScrollDistance !== null) {
scope.$watch(attrs.infiniteScrollDistance, function(value) {
return scrollDistance = parseInt(value, 10);
scrollDistance = parseInt(value, 10);
return scrollDistance;
});
}
scrollEnabled = true;
checkWhenEnabled = false;
if (attrs.infiniteScrollDisabled != null) {
if (attrs.infiniteScrollDisabled !== null) {
scope.$watch(attrs.infiniteScrollDisabled, function(value) {
scrollEnabled = !value;
if (scrollEnabled && checkWhenEnabled) {
Expand All @@ -21,8 +25,8 @@ app.directive('infiniteScroll', [
}
});
}
$rootScope.$on('refreshStart', function(event, parameters){
elem.animate({ scrollTop: "0" });
$rootScope.$on('refreshStart', function(){
elem.animate({ scrollTop: '0' });
});
handler = function() {
var container, shouldScroll;
Expand All @@ -35,7 +39,8 @@ app.directive('infiniteScroll', [
return scope.$apply(attrs.infiniteScroll);
}
} else if (shouldScroll) {
return checkWhenEnabled = true;
checkWhenEnabled = true;
return checkWhenEnabled;
}
};
elem.on('scroll', handler);
Expand Down
10 changes: 7 additions & 3 deletions app/scripts/i18n/i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@ angular.module('requirementsBazaarWebFrontendApp').config(function ($translatePr
LOGIN: 'Login',
SEARCH_REQUIREMENTS: 'search requirements',
FILTER_COMPONENTS: 'filter components',
FILTER_PROJECTS: 'filter projects',
COMPONENT_LEAD: 'Component lead:',
COMMENT_PLACEHOLDER: 'Leave a comment',
SHOW_CONTRIBUTORS: 'Show contributors',
HIDE_CONTRIBUTORS: 'Hide contributors',
FOLLOWERS: 'Followers',
DEVELOPERS: 'Developers',
CREATED_BY: 'Created by',
Expand All @@ -26,7 +28,7 @@ angular.module('requirementsBazaarWebFrontendApp').config(function ($translatePr
CREATE_PROJ: 'Create a project',
CREATE_COMP: 'Create a component',
CREATE_REQ: 'Create a requirement',
TITLE: 'Title',
TITLE: 'Title - 50 characters',
DESC: 'Description',
ACCEPT: 'Accept',
DECLINE: 'Decline',
Expand Down Expand Up @@ -110,10 +112,12 @@ angular.module('requirementsBazaarWebFrontendApp').config(function ($translatePr
SUBMIT:'Kommentar senden',
LOGIN: 'Anmelden',
SEARCH_REQUIREMENTS: 'suche nach Requirements',
FILTER_COMPONENTS: 'filter components',
FILTER_COMPONENTS: 'suche Komponente',
FILTER_PROJECTS: 'suche Projekte',
COMPONENT_LEAD: 'Komponent Leiter:',
COMMENT_PLACEHOLDER: 'Ihr Beitrag',
SHOW_CONTRIBUTORS: 'Zeige Beiträger',
HIDE_CONTRIBUTORS: 'Beiträger verstecken',
FOLLOWERS: 'Folger',
DEVELOPERS: 'Entwickler',
CREATED_BY: 'Erschaffer',
Expand All @@ -123,7 +127,7 @@ angular.module('requirementsBazaarWebFrontendApp').config(function ($translatePr
CREATE_PROJ: 'Neues Projekt',
CREATE_COMP: 'Neues Komponent',
CREATE_REQ: 'Neues Requirement',
TITLE: 'Titel',
TITLE: 'Titel - maximal 50 Zeichen',
DESC: 'Beschreibung',
ACCEPT: 'Akzeptieren',
DECLINE: 'Ablehnen',
Expand Down
Loading

0 comments on commit 79ae204

Please sign in to comment.