Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.

Commit 272e98a

Browse files
author
Nick Litwin
committed
More updates
1 parent 9823ed5 commit 272e98a

37 files changed

+652
-627
lines changed

app/community/community.routes.js

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,27 @@
1+
import angular from 'angular'
2+
13
(function() {
2-
'use strict';
4+
'use strict'
35

46
angular.module('tc.community').config([
57
'$stateProvider',
6-
'$urlRouterProvider',
7-
'$locationProvider',
88
routes
9-
]);
9+
])
1010

11-
function routes($stateProvider, $urlRouterProvider, $locationProvider) {
12-
$locationProvider.html5Mode(true);
11+
function routes($stateProvider) {
1312
var states = {
1413
'community': {
1514
parent: 'root',
1615
url: '/community/',
1716
abstract: true,
1817
data: {
19-
authRequired: false,
18+
authRequired: false
2019
}
2120
},
2221
'community.members': {
2322
parent: 'root',
2423
url: '/community/members/',
25-
templateUrl: 'community/members.html',
24+
template: require('./members')(),
2625
controller: 'MembersController',
2726
controllerAs: 'ctrl',
2827
data: {
@@ -34,17 +33,17 @@
3433
'community.statistics': {
3534
parent: 'root',
3635
url: '/community/statistics/',
37-
templateUrl: 'community/statistics.html',
36+
template: require('./statistics')(),
3837
controller: 'StatisticsController',
3938
controllerAs: 'ctrl',
4039
data: {
4140
title: 'Community Statistics'
4241
}
4342
}
44-
};
43+
}
4544

4645
angular.forEach(states, function(state, name) {
47-
$stateProvider.state(name, state);
48-
});
49-
};
50-
})();
46+
$stateProvider.state(name, state)
47+
})
48+
}
49+
})()
Lines changed: 25 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,53 @@
1+
import angular from 'angular'
12

23
(function() {
3-
'use strict';
4+
'use strict'
45

5-
angular.module('tcUIComponents').directive('badgeTooltip', badgeTooltip);
6+
angular.module('tcUIComponents').directive('badgeTooltip', badgeTooltip)
67

7-
/**
8-
* Add a badge tooltip.
9-
*/
108
function badgeTooltip() {
119
return {
1210
restrict: 'A',
13-
templateUrl: 'directives/badges/badge-tooltip.html',
11+
template: require('./badge-tooltip')(),
1412
scope: {
1513
badge: '='
1614
},
1715
link : function(scope, element, attr) {
18-
scope.hide = true;
19-
return new TcBadgeTooltipDirective(scope, element, attr);
16+
scope.hide = true
17+
return new TcBadgeTooltipDirective(scope, element, attr)
2018
}
2119
}
2220
}
2321

24-
/**
25-
* The link function of directive tc-badge-tooltip
26-
*/
22+
// The link function of directive tc-badge-tooltip
2723
var TcBadgeTooltipDirective = function (scope, element, attr) {
2824

29-
var tooltipElement = element.children(0);
25+
var tooltipElement = element.children(0)
3026
if (!tooltipElement.hasClass('tooltip')) {
31-
return;
27+
return
3228
}
33-
var tooltipHtml = tooltipElement[0];
34-
35-
var tooltipFn = this;
29+
var tooltipHtml = tooltipElement[0]
3630

3731
element.on('mouseenter', function() {
38-
tooltipElement.css('z-index', '-2000');
39-
scope.hide = false;
32+
tooltipElement.css('z-index', '-2000')
33+
scope.hide = false
4034
// apply scope to display the tooltip element at z-index -2000
4135
// otherwise we won't get the height of the element
42-
scope.$apply();
36+
scope.$apply()
4337

44-
var ht = tooltipHtml.offsetHeight;
45-
var wt = tooltipHtml.offsetWidth - element[0].offsetWidth;
46-
var top = element[0].offsetTop - ht - 10;
47-
var lt = element[0].offsetLeft - wt / 2;
38+
var ht = tooltipHtml.offsetHeight
39+
var wt = tooltipHtml.offsetWidth - element[0].offsetWidth
40+
var top = element[0].offsetTop - ht - 10
41+
var lt = element[0].offsetLeft - wt / 2
4842

49-
tooltipElement.css("left", lt + 'px');
50-
tooltipElement.css("top", top + 'px');
51-
tooltipElement.css('z-index', '2000');
52-
});
43+
tooltipElement.css('left', lt + 'px')
44+
tooltipElement.css('top', top + 'px')
45+
tooltipElement.css('z-index', '2000')
46+
})
5347

5448
element.on('mouseleave', function(){
55-
scope.hide = true;
56-
scope.$apply();
57-
});
49+
scope.hide = true
50+
scope.$apply()
51+
})
5852
}
59-
})();
53+
})()

app/directives/challenge-tile/challenge-tile.directive.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ import angular from 'angular'
33
(function() {
44
'use strict'
55

6-
angular.module('tcUIComponents')
7-
.directive('challengeTile', challengeTile)
6+
angular.module('tcUIComponents').directive('challengeTile', challengeTile)
87

98
function challengeTile() {
109
return {
@@ -29,7 +28,8 @@ import angular from 'angular'
2928

3029
function openLightbox() {
3130
ngDialog.open({
32-
template: 'directives/challenge-tile/design-lightbox/design-lightbox.html',
31+
plain: true,
32+
template: require('./design-lightbox/design-lightbox')(),
3333
className: 'ngdialog-theme-default',
3434
scope: $scope
3535
})
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
.lightbox-container
2-
img(ng-src="http://studio.{{DOMAIN}}/studio.jpg?module=DownloadSubmission&sbmid={{challenge.thumbnailId}}&sbt=full", fallback-src=require("../../../assets/images/ico-picture.svg"))
2+
img(ng-src="http://studio.{{DOMAIN}}/studio.jpg?module=DownloadSubmission&sbmid={{challenge.thumbnailId}}&sbt=full", fallback-src=require("../../../../assets/images/ico-picture.svg"))

app/directives/external-account/external-links-data.directive.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,9 @@ import angular from 'angular'
4646
return
4747
}
4848
$scope.deletionDialog = ngDialog.open({
49+
plain: true,
4950
className: 'ngdialog-theme-default tc-dialog',
50-
template: 'directives/external-account/external-link-deletion-confirm.html',
51+
template: require('./external-link-deletion-confirm')(),
5152
controller: 'ExternalLinkDeletionController',
5253
controllerAs: 'vm',
5354
resolve: {
Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
1+
import angular from 'angular'
2+
13
(function() {
2-
'use strict';
4+
'use strict'
35

4-
angular.module('tcUIComponents').directive('onoffSwitch', onoffSwitch);
6+
angular.module('tcUIComponents').directive('onoffSwitch', onoffSwitch)
57

68
function onoffSwitch() {
79
return {
810
restrict: 'E',
9-
templateUrl: 'directives/onoffswitch/onoffswitch.directive.html',
11+
template: require('./onoffswitch')(),
1012
scope: {
1113
model: '=',
1214
uniqueId: '='
13-
},
14-
link: function(scope, element, attrs) {
15-
1615
}
17-
};
16+
}
1817
}
19-
})();
18+
})()
Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,28 @@
1+
import angular from 'angular'
2+
13
(function() {
2-
'use strict';
4+
'use strict'
35

4-
angular.module('tcUIComponents').directive('progressBar', progressBar);
6+
angular.module('tcUIComponents').directive('progressBar', progressBar)
57

6-
progressBar.$inject = ['$timeout', '$parse'];
8+
progressBar.$inject = ['$parse']
79

8-
function progressBar($timeout, $parse) {
10+
function progressBar($parse) {
911
return {
1012
restrict: 'E',
11-
templateUrl: 'directives/progress-bar/progress-bar.directive.html',
13+
template: require('./progress-bar')(),
1214
link: function(scope, element, attr) {
13-
var model = $parse(attr.completed);
14-
var msg = attr.message;
15-
var progress = angular.element(element[0].querySelector('.progress-bar__bar--completed'));
15+
var model = $parse(attr.completed)
16+
var msg = attr.message
17+
var progress = angular.element(element[0].querySelector('.progress-bar__bar--completed'))
1618

1719
scope.$watch(model, function(newValue, oldValue) {
18-
scope.completed = Math.round(newValue);
19-
// console.log("Updating progress bar with " + scope.completed);
20-
scope.message = msg;
20+
scope.completed = Math.round(newValue)
21+
// console.log("Updating progress bar with " + scope.completed)
22+
scope.message = msg
2123
progress.css('width', scope.completed + '%')
22-
});
23-
},
24-
controller: ['$scope', function($scope) {
25-
26-
}]
27-
};
24+
})
25+
}
26+
}
2827
}
29-
})();
28+
})()
Lines changed: 29 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
1+
import angular from 'angular'
2+
import _ from 'lodash'
3+
14
(function() {
2-
'use strict';
5+
'use strict'
36

4-
angular.module('tcUIComponents').directive('tcFileInput', tcFileInput);
7+
angular.module('tcUIComponents').directive('tcFileInput', tcFileInput)
58

69
function tcFileInput() {
710
return {
811
restrict: 'E',
912
require: '^form',
10-
templateUrl: 'directives/tc-file-input/tc-file-input.html',
13+
template: require('./tc-file-input')(),
1114
scope: {
1215
labelText: '@',
1316
fieldId: '@',
@@ -20,63 +23,63 @@
2023
ngModel: '='
2124
},
2225
link: function(scope, element, attrs, formController) {
23-
scope.selectFile = selectFile;
24-
var fileTypes = scope.fileType.split(',');
26+
scope.selectFile = selectFile
27+
var fileTypes = scope.fileType.split(',')
2528

2629
// fieldId is not set on element at this point, so grabbing with class .none
2730
// which exists on the element right away
28-
var fileInput = $(element[0]).find('.none');
29-
var fileNameInput = $(element[0]).find('input[type=text]');
31+
var fileInput = $(element[0]).find('.none')
32+
var fileNameInput = $(element[0]).find('input[type=text]')
3033

3134
fileInput.bind('change', function(event) {
32-
var file = event.target.files[0];
35+
var file = event.target.files[0]
3336

3437
// About 1 in 20 times, the file is undefined (must be race condition)
3538
// Return early in this case so no errors are thrown
3639
if (!file) {
37-
return;
40+
return
3841
}
3942

40-
var fileSize = file.size;
41-
var isAllowedFileSize = fileSize < '500000000';
43+
var fileSize = file.size
44+
var isAllowedFileSize = fileSize < '500000000'
4245

43-
var selectedFileType = file.type.slice(file.type.lastIndexOf('/') + 1);
44-
var isAllowedFileFormat = _.some(fileTypes, _.matches(selectedFileType));
46+
var selectedFileType = file.type.slice(file.type.lastIndexOf('/') + 1)
47+
var isAllowedFileFormat = _.some(fileTypes, _.matches(selectedFileType))
4548

4649
scope.$apply(function(){
4750
// Set the file name as the value of the disabled input
48-
fileNameInput[0].value = file.name;
49-
var clickedFileInput = formController[attrs.fieldId];
51+
fileNameInput[0].value = file.name
52+
var clickedFileInput = formController[attrs.fieldId]
5053

5154
if (!isAllowedFileFormat) {
5255
// Manually setting is required since Angular doesn't support file inputs
53-
clickedFileInput.$setTouched();
54-
clickedFileInput.$setValidity('required', false);
56+
clickedFileInput.$setTouched()
57+
clickedFileInput.$setValidity('required', false)
5558

5659
} else {
57-
clickedFileInput.$setValidity('required', true);
60+
clickedFileInput.$setValidity('required', true)
5861
}
5962

6063
if (!isAllowedFileSize) {
6164
// Manually setting is required since Angular doesn't support file inputs
62-
clickedFileInput.$setTouched();
63-
clickedFileInput.$setValidity('filesize', false);
65+
clickedFileInput.$setTouched()
66+
clickedFileInput.$setValidity('filesize', false)
6467

6568
} else {
66-
clickedFileInput.$setValidity('filesize', true);
69+
clickedFileInput.$setValidity('filesize', true)
6770
}
6871

6972
if (isAllowedFileFormat && isAllowedFileSize) {
7073
// Pass file object up through callback into controller
71-
scope.setFileReference({file: file, fieldId: scope.fieldId});
74+
scope.setFileReference({file: file, fieldId: scope.fieldId})
7275
}
73-
});
74-
});
76+
})
77+
})
7578

7679
function selectFile() {
77-
fileInput.click();
80+
fileInput.click()
7881
}
7982
}
8083
}
8184
}
82-
})();
85+
})()

0 commit comments

Comments
 (0)