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

Commit 062b6b9

Browse files
committed
Merge pull request #794 from appirio-tech/qa-integration
Moving MoM, email settings, and submissions update to prod
2 parents 5cb8068 + 261d43b commit 062b6b9

21 files changed

+470
-223
lines changed

app/community/members.controller.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import angular from 'angular'
1212
ctrl.notSearch = true
1313
ctrl.showing = 'list'
1414
ctrl.domain = CONSTANTS.domain
15-
ctrl.currentMonth = 'March 2016'
15+
ctrl.currentMonth = 'April 2016'
1616
ctrl.memberLeaderboard = []
1717
ctrl.copilots = []
1818
CommunityDataService.getMembersData()

app/community/members.jade

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@
1313
.platform-stats-container
1414
.stat
1515
p.statVal {{ctrl.platformStats.memberCount | number : 0}}
16-
p.statLabel ACTIVE MEMBER
16+
p.statLabel ACTIVE MEMBERS
1717
.stat
1818
p.statVal {{ctrl.platformStats.activeMembersCount | number : 0}}
1919
p.statLabel COMPETING TODAY
2020
.stat
2121
p.statVal {{ctrl.platformStats.prizePurse | currency:undefined:0}}
22-
p.statLabel AVAILABLE PRIZE
22+
p.statLabel AVAILABLE PRIZES
2323
.stat
2424
p.statVal {{ctrl.platformStats.activeContestsCount | number : 0}}
2525
p.statLabel ACTIVE CHALLENGES

app/directives/tc-form-stockart/tc-form-stockart.directive.js

Lines changed: 2 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,7 @@ import _ from 'lodash'
2121
controller: ['$scope', function($scope) {
2222
var stockartId = 0
2323
var emptyStockart = {
24-
description: '',
25-
sourceUrl: '',
26-
fileNumber: '',
27-
isPhotoDescriptionRequired: false,
28-
isPhotoURLRequired: false,
29-
isFileNumberRequired: false
24+
sourceUrl: ''
3025
}
3126

3227
// Initialize stockart form data
@@ -45,9 +40,7 @@ import _ from 'lodash'
4540
// If only one stockart fieldset is there, just reset the values
4641
// so that ng-repeat doesn't refresh and there is no UI flickering
4742
if (Object.keys($scope.formStockarts).length === 1) {
48-
$scope.submissionForm['photoDescription' + index].$setPristine()
4943
$scope.submissionForm['photoURL' + index].$setPristine()
50-
$scope.submissionForm['fileNumber' + index].$setPristine()
5144
$scope.formStockarts[index] = angular.copy(emptyStockart)
5245

5346
} else {
@@ -57,36 +50,9 @@ import _ from 'lodash'
5750

5851
$scope.isButtonDisabled = function() {
5952
return _.some($scope.formStockarts, function(stockart) {
60-
return !stockart.description || !stockart.sourceUrl || !stockart.fileNumber
53+
return !stockart.sourceUrl
6154
})
6255
}
63-
64-
$scope.showMandatoryMessage = function(inputValue, inputName) {
65-
var id = inputName.slice(-1)
66-
67-
var stockartSection = $scope.formStockarts[id]
68-
69-
var stockartDescription = stockartSection.description
70-
var stockartSourceUrl = stockartSection.sourceUrl
71-
var stockartFileNumber = stockartSection.fileNumber
72-
73-
if (!stockartDescription && !stockartSourceUrl && !stockartFileNumber) {
74-
// All fields empty so required should be false
75-
stockartSection.isPhotoDescriptionRequired = false
76-
stockartSection.isPhotoURLRequired = false
77-
stockartSection.isFileNumberRequired = false
78-
} else if (stockartDescription && stockartSourceUrl && stockartFileNumber) {
79-
// All fields filled out, so required should be false
80-
stockartSection.isPhotoDescriptionRequired = false
81-
stockartSection.isPhotoURLRequired = false
82-
stockartSection.isFileNumberRequired = false
83-
} else {
84-
// Fields are not completely filled out or completely blank so setting required to true
85-
stockartSection.isPhotoDescriptionRequired = true
86-
stockartSection.isPhotoURLRequired = true
87-
stockartSection.isFileNumberRequired = true
88-
}
89-
}
9056
}]
9157
}
9258
}
Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,17 @@
11
.fieldset(ng-repeat="(stockartId, stockart) in formStockarts")
22
button.clean.remove-section(type="button", ng-click="deleteStockartFieldset(stockartId)")
33

4-
tc-input.fieldset__input(
5-
label-text="Photo Description",
6-
asterisk-text="Field can't be empty",
7-
show-asterisk-text="true",
8-
placeholder="A picture of a girl",
9-
input-value="stockart.description",
10-
input-name="photoDescription{{stockartId}}",
11-
input-required="formStockarts[stockartId].isPhotoDescriptionRequired",
12-
maxlength="100",
13-
on-input-change="showMandatoryMessage(inputValue, inputName)"
14-
)
15-
164
tc-input.fieldset__input(
175
label-text="Photo URL",
18-
asterisk-text="Field can't be empty",
19-
show-asterisk-text="true",
206
placeholder="www.istockphoto.com",
217
input-value="stockart.sourceUrl",
228
input-name="photoURL{{stockartId}}",
239
input-required="formStockarts[stockartId].isPhotoURLRequired",
2410
input-pattern="urlRegEx",
25-
maxlength="250",
26-
on-input-change="showMandatoryMessage(inputValue, inputName)"
11+
maxlength="250"
2712
)
2813

2914
.tc-error-messages(ng-show="submissionForm['photoURL' + stockartId].$dirty && submissionForm['photoURL' + stockartId].$invalid && submissionForm['photoURL' + stockartId].$error.pattern")
3015
p Please enter a valid url.
3116

32-
tc-input.fieldset__input(
33-
label-text="File Number",
34-
asterisk-text="Field can't be empty",
35-
show-asterisk-text="true",
36-
placeholder="u2434312",
37-
input-value="stockart.fileNumber",
38-
input-name="fileNumber{{stockartId}}",
39-
input-required="formStockarts[stockartId].isFileNumberRequired",
40-
maxlength="50",
41-
on-input-change="showMandatoryMessage(inputValue, inputName)"
42-
)
43-
4417
button.fieldset__button.tc-btn.tc-btn-s(type="button", ng-click="createAdditionalStockartFieldset()", ng-disabled="isButtonDisabled()") + Add Stock Photo

app/directives/tc-form-stockart/tc-form-stockart.spec.js

Lines changed: 9 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,7 @@ describe('Topcoder Form Stockart Directive', function() {
2929
var initialStockart = isolateScope.formStockarts[0]
3030

3131
expect(initialStockart.id).to.equal(0)
32-
expect(initialStockart.description).to.equal('')
3332
expect(initialStockart.sourceUrl).to.equal('')
34-
expect(initialStockart.fileNumber).to.equal('')
35-
expect(initialStockart.isPhotoDescriptionRequired).to.equal(false)
36-
expect(initialStockart.isPhotoURLRequired).to.equal(false)
37-
expect(initialStockart.isFileNumberRequired).to.equal(false)
3833
})
3934

4035
it('a regular expression', function() {
@@ -79,21 +74,21 @@ describe('Topcoder Form Stockart Directive', function() {
7974
it('resets the stockart fieldset when it\'s the only one', function() {
8075
var stockart = isolateScope.formStockarts[0]
8176

82-
expect(stockart.description).to.equal('')
77+
expect(stockart.sourceUrl).to.equal('')
8378

84-
stockart.description = 'a funny cat picture'
79+
stockart.sourceUrl = 'www.myURL.com'
8580
scope.$digest()
8681

87-
expect(stockart.description).to.equal('a funny cat picture')
82+
expect(stockart.sourceUrl).to.equal('www.myURL.com')
8883

8984
isolateScope.deleteStockartFieldset(0)
9085
scope.$digest()
9186

92-
expect(isolateScope.formStockarts[0].description).to.equal('')
87+
expect(isolateScope.formStockarts[0].sourceUrl).to.equal('')
9388
})
9489
})
9590

96-
describe('isButtonDisabled', function() {
91+
describe.only('isButtonDisabled', function() {
9792
var button
9893

9994
beforeEach(function() {
@@ -108,37 +103,20 @@ describe('Topcoder Form Stockart Directive', function() {
108103
expect(button.disabled).to.be.true
109104
})
110105

111-
it('disables the button when 1 field is filled out', function() {
112-
isolateScope.formStockarts[0].description = 'test description'
113-
scope.$digest()
114-
115-
expect(button.disabled).to.be.true
116-
})
117-
118-
it('disables the button when 2 fields are filled out', function() {
119-
isolateScope.formStockarts[0].description = 'test description'
120-
isolateScope.formStockarts[0].sourceUrl = 'url'
121-
scope.$digest()
122-
106+
it('enables the button when the url field is filled out', function() {
123107
expect(button.disabled).to.be.true
124-
})
125108

126-
it('enables the button when all fields are filled out', function() {
127-
isolateScope.formStockarts[0].description = 'test description'
128109
isolateScope.formStockarts[0].sourceUrl = 'url'
129-
isolateScope.formStockarts[0].fileNumber = '123'
130110
scope.$digest()
131111

132112
expect(button.disabled).to.be.false
133113
})
134114

135-
it('disables the button when any field in any fieldset is empty', function() {
115+
it('disables the button when any url field in any fieldset is empty', function() {
136116
expect(button.disabled).to.be.true
137117

138118
// Fill out first fieldset
139-
isolateScope.formStockarts[0].description = 'test description'
140119
isolateScope.formStockarts[0].sourceUrl = 'url.com'
141-
isolateScope.formStockarts[0].fileNumber = '123'
142120
scope.$digest()
143121

144122
expect(button.disabled).to.be.false
@@ -149,81 +127,16 @@ describe('Topcoder Form Stockart Directive', function() {
149127
expect(button.disabled).to.be.true
150128

151129
// Fill out second fieldset
152-
isolateScope.formStockarts[1].description = 'test description2'
153130
isolateScope.formStockarts[1].sourceUrl = 'url2.com'
154-
isolateScope.formStockarts[1].fileNumber = '1232'
155131
scope.$digest()
156132

157133
expect(button.disabled).to.be.false
158134

159-
// Empty a field in the first fieldset
160-
isolateScope.formStockarts[0].fileNumber = ''
135+
// Empty the field in the first fieldset
136+
isolateScope.formStockarts[0].sourceUrl = ''
161137
scope.$digest()
162138

163139
expect(button.disabled).to.be.true
164140
})
165141
})
166-
167-
describe('showMandatoryMessage', function() {
168-
describe('sets the stockart required properties to false when all fields are', function() {
169-
var stockart
170-
171-
beforeEach(function() {
172-
stockart = isolateScope.formStockarts[0]
173-
stockart.description = 'test description'
174-
stockart.sourceUrl = 'url.com'
175-
stockart.fileNumber = '123'
176-
scope.$digest()
177-
})
178-
179-
afterEach(function() {
180-
stockart = undefined
181-
})
182-
183-
it('filled out', function() {
184-
expect(stockart.isPhotoDescriptionRequired).to.be.false
185-
expect(stockart.isPhotoURLRequired).to.be.false
186-
expect(stockart.isFileNumberRequired).to.be.false
187-
})
188-
189-
it('empty', function() {
190-
// Reset stockart fields
191-
stockart.description = ''
192-
stockart.sourceUrl = ''
193-
stockart.fileNumber = ''
194-
scope.$digest()
195-
196-
expect(stockart.isPhotoDescriptionRequired).to.be.false
197-
expect(stockart.isPhotoURLRequired).to.be.false
198-
expect(stockart.isFileNumberRequired).to.be.false
199-
})
200-
})
201-
202-
203-
describe('sets the stockart required properties to false when all fields are', function() {
204-
var stockart
205-
206-
beforeEach(function() {
207-
stockart = isolateScope.formStockarts[0]
208-
stockart.description = 'test description'
209-
stockart.sourceUrl = 'url.com'
210-
stockart.fileNumber = '123'
211-
scope.$digest()
212-
})
213-
214-
afterEach(function() {
215-
stockart = undefined
216-
})
217-
218-
it('sets the stockart required properties to true if any field is blank', function() {
219-
// Reset stockart fields
220-
stockart.description = ''
221-
scope.$digest()
222-
223-
expect(stockart.isPhotoDescriptionRequired).to.be.true
224-
expect(stockart.isPhotoURLRequired).to.be.true
225-
expect(stockart.isFileNumberRequired).to.be.true
226-
})
227-
})
228-
})
229142
})

app/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ require('../assets/css/sitemap/sitemap.scss')
6363
require('../assets/css/settings/update-password.scss')
6464
require('../assets/css/settings/settings.scss')
6565
require('../assets/css/settings/preferences.scss')
66+
require('../assets/css/settings/email.scss')
6667
require('../assets/css/settings/edit-profile.scss')
6768
require('../assets/css/settings/account-info.scss')
6869
require('../assets/css/profile/subtrack.scss')

app/services/api.service.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ import _ from 'lodash'
7474
case 'SUBMISSIONS':
7575
case 'USER':
7676
return _getRestangularV3(CONSTANTS.AUTH_API_URL)
77+
case 'MAILCHIMP':
78+
return _getRestangularV3(CONSTANTS.INTERNAL_API_URL)
7779
default:
7880
return _getRestangularV3()
7981
}
@@ -93,6 +95,10 @@ import _ from 'lodash'
9395
})
9496
.setDefaultHeaders({ 'Content-Type': 'application/json' })
9597
.addRequestInterceptor(function(element, operation, what, url) {
98+
// for mailchimp api, don't add param field in the body
99+
if (url.indexOf('mailchimp') > -1) {
100+
return element
101+
}
96102
if (url.indexOf('members') > -1 || (operation.toLowerCase() === 'post' && url.indexOf('profiles') > -1)) {
97103
return {
98104
param: element

app/services/communityData.service.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,29 +21,29 @@ import angular from 'angular'
2121
var data = {
2222
'memberLeaderboard': [
2323
{
24-
'avatar': '//www.topcoder.com/wp-content/uploads/2015/05/universo_march2016.png',
25-
'name': 'universo',
24+
'avatar': '//www.topcoder.com/wp-content/uploads/2015/05/toxicpixel_apr2016.png',
25+
'name': 'ToxicPixel',
2626
'contestType': 'Design',
27-
'description': 'Won $4,500 in design challenges',
27+
'description': 'Won $4,200 with top prizes in LUX and Idea Gen!',
2828
'class': 'design'
2929
}, {
30-
'avatar': '//www.topcoder.com/wp-content/uploads/2015/05/sdgun_march2016.png',
31-
'name': 'sdgun',
30+
'avatar': '//www.topcoder.com/wp-content/uploads/2015/05/monicamuranyi_apr2016.png',
31+
'name': 'MonicaMuranyi',
3232
'contestType': 'Development',
33-
'description': 'Nine wins for $2,076',
33+
'description': 'Won $8,300 across 12 competitions',
3434
'class': 'develop'
3535
}, {
36-
'avatar': '//www.topcoder.com/wp-content/uploads/2015/05/BSBandme_march2016.png',
37-
'name': 'BSBandme',
36+
'avatar': '//www.topcoder.com/wp-content/uploads/2015/05/sugina_apr2016.png',
37+
'name': 'Sugina',
3838
'contestType': 'Data Science',
39-
'description': 'Gained 285 rating points within all 3 January SRMs',
39+
'description': 'Total increase of 175 points, with a jump from Div 2 to Div 1',
4040
'class': 'data-science'
4141
}, {
42-
'avatar': '//www.topcoder.com/wp-content/uploads/2015/05/johan_92_march2016.png',
43-
'name': 'johan_92',
44-
'contestType': 'Design Rookie',
45-
'description': 'Joined end of December and has had 4 1st place wins!',
46-
'class': 'design'
42+
'avatar': '//www.topcoder.com/wp-content/uploads/2015/05/tritias_apr2016.png',
43+
'name': 'TiTrias',
44+
'contestType': 'Development Rookie',
45+
'description': 'Won first challenge within a month of joining!',
46+
'class': 'develop'
4747
}
4848
],
4949
'copilots': [{

0 commit comments

Comments
 (0)