-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
team create and team edit vm updated
- Loading branch information
1 parent
1e2a10c
commit af49d7e
Showing
3 changed files
with
36 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
var inject = require('../../lib/inject.js'); | ||
|
||
//inject our JS resource | ||
inject('teams/create.js'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* global teamViewModel, $ */ | ||
//edit and create page. | ||
// background js fiddles with create page to expose same viewmodel as OutageDisplayType | ||
|
||
|
||
//replace window title with team name if set | ||
var callsign = teamViewModel.callsign.peek(); | ||
if (typeof callsign !== 'undefined' && callsign !== null) { | ||
document.title = callsign; | ||
} | ||
|
||
//when team members change | ||
teamViewModel.members.subscribe(function() { | ||
// auto set the first team member as TL | ||
var lead = false | ||
$.each(teamViewModel.members.peek(), function(k, v) { | ||
if (v.TeamLeader.peek()) { | ||
lead = true | ||
} | ||
}) | ||
if (!lead && teamViewModel.members.peek().length) { //we have no leader | ||
console.log("setting team leader to first member in team") | ||
teamViewModel.setTeamLeader(teamViewModel.members.peek()[0]) | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters