Skip to content

Commit

Permalink
team create and team edit vm updated
Browse files Browse the repository at this point in the history
  • Loading branch information
OSPFNeighbour committed Dec 20, 2023
1 parent 1e2a10c commit af49d7e
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/contentscripts/teams/create.js
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');
25 changes: 25 additions & 0 deletions src/injectscripts/teams/create.js
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])
}
})
9 changes: 7 additions & 2 deletions static/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,18 @@
},
{
"matches": [
"https://*.ses.nsw.gov.au/Teams/Create",
"https://*.ses.nsw.gov.au/Teams/Create/",
"https://*.ses.nsw.gov.au/Teams/*/Edit",
"https://*.ses.nsw.gov.au/Teams/*/Edit/"
],
"js": ["contentscripts/teams/edit.js"]
},
{
"matches": [
"https://*.ses.nsw.gov.au/Teams/Create",
"https://*.ses.nsw.gov.au/Teams/Create/"
],
"js": ["contentscripts/teams/create.js"]
},
{
"matches": [
"https://*.ses.nsw.gov.au/Teams/*/Jobs",
Expand Down

0 comments on commit af49d7e

Please sign in to comment.