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

Moving MoM, email settings, and submissions update to prod #794

Merged
merged 33 commits into from
May 5, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
fe4f84e
Remove stockart description and file number fields
Apr 21, 2016
41b847e
AS#118090147171048, Mail chimp Integration
May 2, 2016
a2ce169
AS#118090147171048, Mail chimp Integration
May 3, 2016
85b1be3
AS#118090147171048, Mail chimp Integration
May 3, 2016
506b888
AS#118090147171048, Mail chimp Integration
May 3, 2016
3771459
AS#118090147171048, Mail chimp Integration
May 3, 2016
1813463
April members of the month
May 3, 2016
780301d
Merge pull request #785 from appirio-tech/april-mom
nlitwin May 3, 2016
817b69b
Fix plural
May 3, 2016
857ab1e
Merge commit '817b69b2ed1103987d04480433525e4d4575713c' into HEAD
May 3, 2016
4b145c7
AS#118090147171050, Email settings tab UI
May 4, 2016
aca36b2
AS#118090147171050, Email settings tab UI
May 4, 2016
64bb8f4
AS#118090147171050, Email settings tab UI
May 4, 2016
4a74ae9
AS#118090147171048, Mail chimp Integration
May 4, 2016
bcc679b
Merge pull request #786 from appirio-tech/feature/mailchimp
May 4, 2016
1a79c7a
Merge pull request #787 from appirio-tech/dev
May 4, 2016
b0b68c7
AS#118090147171050, Email settings tab UI
May 4, 2016
4d61757
Merge pull request #788 from appirio-tech/feature/mailchimp
May 4, 2016
945e34d
Merge pull request #789 from appirio-tech/dev
May 4, 2016
00d64f2
Experiment with different cache setting
May 4, 2016
7aa493d
Merge branch 'dev' of https://github.com/appirio-tech/topcoder-app in…
May 4, 2016
6a5148a
Revert test
May 4, 2016
1b7de03
Merge commit '6a5148aa73798d63d6de3b83659b3a4212904410' into HEAD
May 4, 2016
e3047be
AS#121262308049576, Copy changes
May 5, 2016
7fb6f5d
AS#121262308049576, Copy changes
May 5, 2016
f1409d8
AS#121262308049598, Change newsletter default
May 5, 2016
c44091a
AS#121262308049584, Reorder newsletter options and add "General Newsl…
May 5, 2016
a1c4fdb
Merge pull request #790 from appirio-tech/feature/mailchimp
May 5, 2016
4db34ca
Merge pull request #791 from appirio-tech/dev
May 5, 2016
665af8a
adding host to npm start
mdesiderio May 5, 2016
212110a
Merge branch 'dev' of github.com:appirio-tech/topcoder-app into dev
mdesiderio May 5, 2016
d414b45
Merge pull request #792 from appirio-tech/stockart-field-update
nlitwin May 5, 2016
261d43b
Merge pull request #793 from appirio-tech/dev
nlitwin May 5, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/community/members.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import angular from 'angular'
ctrl.notSearch = true
ctrl.showing = 'list'
ctrl.domain = CONSTANTS.domain
ctrl.currentMonth = 'March 2016'
ctrl.currentMonth = 'April 2016'
ctrl.memberLeaderboard = []
ctrl.copilots = []
CommunityDataService.getMembersData()
Expand Down
4 changes: 2 additions & 2 deletions app/community/members.jade
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
.platform-stats-container
.stat
p.statVal {{ctrl.platformStats.memberCount | number : 0}}
p.statLabel ACTIVE MEMBER
p.statLabel ACTIVE MEMBERS
.stat
p.statVal {{ctrl.platformStats.activeMembersCount | number : 0}}
p.statLabel COMPETING TODAY
.stat
p.statVal {{ctrl.platformStats.prizePurse | currency:undefined:0}}
p.statLabel AVAILABLE PRIZE
p.statLabel AVAILABLE PRIZES
.stat
p.statVal {{ctrl.platformStats.activeContestsCount | number : 0}}
p.statLabel ACTIVE CHALLENGES
Expand Down
38 changes: 2 additions & 36 deletions app/directives/tc-form-stockart/tc-form-stockart.directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,7 @@ import _ from 'lodash'
controller: ['$scope', function($scope) {
var stockartId = 0
var emptyStockart = {
description: '',
sourceUrl: '',
fileNumber: '',
isPhotoDescriptionRequired: false,
isPhotoURLRequired: false,
isFileNumberRequired: false
sourceUrl: ''
}

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

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

$scope.isButtonDisabled = function() {
return _.some($scope.formStockarts, function(stockart) {
return !stockart.description || !stockart.sourceUrl || !stockart.fileNumber
return !stockart.sourceUrl
})
}

$scope.showMandatoryMessage = function(inputValue, inputName) {
var id = inputName.slice(-1)

var stockartSection = $scope.formStockarts[id]

var stockartDescription = stockartSection.description
var stockartSourceUrl = stockartSection.sourceUrl
var stockartFileNumber = stockartSection.fileNumber

if (!stockartDescription && !stockartSourceUrl && !stockartFileNumber) {
// All fields empty so required should be false
stockartSection.isPhotoDescriptionRequired = false
stockartSection.isPhotoURLRequired = false
stockartSection.isFileNumberRequired = false
} else if (stockartDescription && stockartSourceUrl && stockartFileNumber) {
// All fields filled out, so required should be false
stockartSection.isPhotoDescriptionRequired = false
stockartSection.isPhotoURLRequired = false
stockartSection.isFileNumberRequired = false
} else {
// Fields are not completely filled out or completely blank so setting required to true
stockartSection.isPhotoDescriptionRequired = true
stockartSection.isPhotoURLRequired = true
stockartSection.isFileNumberRequired = true
}
}
}]
}
}
Expand Down
29 changes: 1 addition & 28 deletions app/directives/tc-form-stockart/tc-form-stockart.jade
Original file line number Diff line number Diff line change
@@ -1,44 +1,17 @@
.fieldset(ng-repeat="(stockartId, stockart) in formStockarts")
button.clean.remove-section(type="button", ng-click="deleteStockartFieldset(stockartId)")

tc-input.fieldset__input(
label-text="Photo Description",
asterisk-text="Field can't be empty",
show-asterisk-text="true",
placeholder="A picture of a girl",
input-value="stockart.description",
input-name="photoDescription{{stockartId}}",
input-required="formStockarts[stockartId].isPhotoDescriptionRequired",
maxlength="100",
on-input-change="showMandatoryMessage(inputValue, inputName)"
)

tc-input.fieldset__input(
label-text="Photo URL",
asterisk-text="Field can't be empty",
show-asterisk-text="true",
placeholder="www.istockphoto.com",
input-value="stockart.sourceUrl",
input-name="photoURL{{stockartId}}",
input-required="formStockarts[stockartId].isPhotoURLRequired",
input-pattern="urlRegEx",
maxlength="250",
on-input-change="showMandatoryMessage(inputValue, inputName)"
maxlength="250"
)

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

tc-input.fieldset__input(
label-text="File Number",
asterisk-text="Field can't be empty",
show-asterisk-text="true",
placeholder="u2434312",
input-value="stockart.fileNumber",
input-name="fileNumber{{stockartId}}",
input-required="formStockarts[stockartId].isFileNumberRequired",
maxlength="50",
on-input-change="showMandatoryMessage(inputValue, inputName)"
)

button.fieldset__button.tc-btn.tc-btn-s(type="button", ng-click="createAdditionalStockartFieldset()", ng-disabled="isButtonDisabled()") + Add Stock Photo
105 changes: 9 additions & 96 deletions app/directives/tc-form-stockart/tc-form-stockart.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,7 @@ describe('Topcoder Form Stockart Directive', function() {
var initialStockart = isolateScope.formStockarts[0]

expect(initialStockart.id).to.equal(0)
expect(initialStockart.description).to.equal('')
expect(initialStockart.sourceUrl).to.equal('')
expect(initialStockart.fileNumber).to.equal('')
expect(initialStockart.isPhotoDescriptionRequired).to.equal(false)
expect(initialStockart.isPhotoURLRequired).to.equal(false)
expect(initialStockart.isFileNumberRequired).to.equal(false)
})

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

expect(stockart.description).to.equal('')
expect(stockart.sourceUrl).to.equal('')

stockart.description = 'a funny cat picture'
stockart.sourceUrl = 'www.myURL.com'
scope.$digest()

expect(stockart.description).to.equal('a funny cat picture')
expect(stockart.sourceUrl).to.equal('www.myURL.com')

isolateScope.deleteStockartFieldset(0)
scope.$digest()

expect(isolateScope.formStockarts[0].description).to.equal('')
expect(isolateScope.formStockarts[0].sourceUrl).to.equal('')
})
})

describe('isButtonDisabled', function() {
describe.only('isButtonDisabled', function() {
var button

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

it('disables the button when 1 field is filled out', function() {
isolateScope.formStockarts[0].description = 'test description'
scope.$digest()

expect(button.disabled).to.be.true
})

it('disables the button when 2 fields are filled out', function() {
isolateScope.formStockarts[0].description = 'test description'
isolateScope.formStockarts[0].sourceUrl = 'url'
scope.$digest()

it('enables the button when the url field is filled out', function() {
expect(button.disabled).to.be.true
})

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

expect(button.disabled).to.be.false
})

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

// Fill out first fieldset
isolateScope.formStockarts[0].description = 'test description'
isolateScope.formStockarts[0].sourceUrl = 'url.com'
isolateScope.formStockarts[0].fileNumber = '123'
scope.$digest()

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

// Fill out second fieldset
isolateScope.formStockarts[1].description = 'test description2'
isolateScope.formStockarts[1].sourceUrl = 'url2.com'
isolateScope.formStockarts[1].fileNumber = '1232'
scope.$digest()

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

// Empty a field in the first fieldset
isolateScope.formStockarts[0].fileNumber = ''
// Empty the field in the first fieldset
isolateScope.formStockarts[0].sourceUrl = ''
scope.$digest()

expect(button.disabled).to.be.true
})
})

describe('showMandatoryMessage', function() {
describe('sets the stockart required properties to false when all fields are', function() {
var stockart

beforeEach(function() {
stockart = isolateScope.formStockarts[0]
stockart.description = 'test description'
stockart.sourceUrl = 'url.com'
stockart.fileNumber = '123'
scope.$digest()
})

afterEach(function() {
stockart = undefined
})

it('filled out', function() {
expect(stockart.isPhotoDescriptionRequired).to.be.false
expect(stockart.isPhotoURLRequired).to.be.false
expect(stockart.isFileNumberRequired).to.be.false
})

it('empty', function() {
// Reset stockart fields
stockart.description = ''
stockart.sourceUrl = ''
stockart.fileNumber = ''
scope.$digest()

expect(stockart.isPhotoDescriptionRequired).to.be.false
expect(stockart.isPhotoURLRequired).to.be.false
expect(stockart.isFileNumberRequired).to.be.false
})
})


describe('sets the stockart required properties to false when all fields are', function() {
var stockart

beforeEach(function() {
stockart = isolateScope.formStockarts[0]
stockart.description = 'test description'
stockart.sourceUrl = 'url.com'
stockart.fileNumber = '123'
scope.$digest()
})

afterEach(function() {
stockart = undefined
})

it('sets the stockart required properties to true if any field is blank', function() {
// Reset stockart fields
stockart.description = ''
scope.$digest()

expect(stockart.isPhotoDescriptionRequired).to.be.true
expect(stockart.isPhotoURLRequired).to.be.true
expect(stockart.isFileNumberRequired).to.be.true
})
})
})
})
1 change: 1 addition & 0 deletions app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ require('../assets/css/sitemap/sitemap.scss')
require('../assets/css/settings/update-password.scss')
require('../assets/css/settings/settings.scss')
require('../assets/css/settings/preferences.scss')
require('../assets/css/settings/email.scss')
require('../assets/css/settings/edit-profile.scss')
require('../assets/css/settings/account-info.scss')
require('../assets/css/profile/subtrack.scss')
Expand Down
6 changes: 6 additions & 0 deletions app/services/api.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ import _ from 'lodash'
case 'SUBMISSIONS':
case 'USER':
return _getRestangularV3(CONSTANTS.AUTH_API_URL)
case 'MAILCHIMP':
return _getRestangularV3(CONSTANTS.INTERNAL_API_URL)
default:
return _getRestangularV3()
}
Expand All @@ -93,6 +95,10 @@ import _ from 'lodash'
})
.setDefaultHeaders({ 'Content-Type': 'application/json' })
.addRequestInterceptor(function(element, operation, what, url) {
// for mailchimp api, don't add param field in the body
if (url.indexOf('mailchimp') > -1) {
return element
}
if (url.indexOf('members') > -1 || (operation.toLowerCase() === 'post' && url.indexOf('profiles') > -1)) {
return {
param: element
Expand Down
28 changes: 14 additions & 14 deletions app/services/communityData.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,29 +21,29 @@ import angular from 'angular'
var data = {
'memberLeaderboard': [
{
'avatar': '//www.topcoder.com/wp-content/uploads/2015/05/universo_march2016.png',
'name': 'universo',
'avatar': '//www.topcoder.com/wp-content/uploads/2015/05/toxicpixel_apr2016.png',
'name': 'ToxicPixel',
'contestType': 'Design',
'description': 'Won $4,500 in design challenges',
'description': 'Won $4,200 with top prizes in LUX and Idea Gen!',
'class': 'design'
}, {
'avatar': '//www.topcoder.com/wp-content/uploads/2015/05/sdgun_march2016.png',
'name': 'sdgun',
'avatar': '//www.topcoder.com/wp-content/uploads/2015/05/monicamuranyi_apr2016.png',
'name': 'MonicaMuranyi',
'contestType': 'Development',
'description': 'Nine wins for $2,076',
'description': 'Won $8,300 across 12 competitions',
'class': 'develop'
}, {
'avatar': '//www.topcoder.com/wp-content/uploads/2015/05/BSBandme_march2016.png',
'name': 'BSBandme',
'avatar': '//www.topcoder.com/wp-content/uploads/2015/05/sugina_apr2016.png',
'name': 'Sugina',
'contestType': 'Data Science',
'description': 'Gained 285 rating points within all 3 January SRMs',
'description': 'Total increase of 175 points, with a jump from Div 2 to Div 1',
'class': 'data-science'
}, {
'avatar': '//www.topcoder.com/wp-content/uploads/2015/05/johan_92_march2016.png',
'name': 'johan_92',
'contestType': 'Design Rookie',
'description': 'Joined end of December and has had 4 1st place wins!',
'class': 'design'
'avatar': '//www.topcoder.com/wp-content/uploads/2015/05/tritias_apr2016.png',
'name': 'TiTrias',
'contestType': 'Development Rookie',
'description': 'Won first challenge within a month of joining!',
'class': 'develop'
}
],
'copilots': [{
Expand Down
Loading