forked from unimatrix/web
Keep Company campaign agendas scoped to their election
This commit is contained in:
parent
d7b520d491
commit
48aa7c823d
1 changed files with 1 additions and 1 deletions
|
|
@ -7,7 +7,7 @@ function script(file){return new Promise((resolve,reject)=>{const node=el('scrip
|
|||
export function electionDesignStyles(){if(document.querySelector('link[data-election-design]'))return;for(const file of ['./cp-v2-election-design.css','./vendor/fullcalendar/skeleton.css','./vendor/fullcalendar/monarch.css','./vendor/fullcalendar/palette.css']){const css=el('link');css.rel='stylesheet';css.href=new URL(file,import.meta.url).href;css.dataset.electionDesign='';document.head.append(css);}}
|
||||
async function calendarLibrary(){electionDesignStyles();if(!libraryPromise)libraryPromise=script('fullcalendar.global.min.js').then(()=>script('monarch.global.min.js')).then(()=>globalThis.FullCalendar);return libraryPromise;}
|
||||
export function mountPromotionAgenda(host,{election='clan_delegate',organisationKind='clan',remindersOnly=false}={}){
|
||||
electionDesignStyles();const company=organisationKind==='company',generic=company||election==='clan-promotion',definition=ELECTION_DESIGN_TYPES[election];if(!generic&&!definition)throw Error('Choose a known election agenda.');
|
||||
electionDesignStyles();const company=organisationKind==='company',generic=election==='clan-promotion',definition=ELECTION_DESIGN_TYPES[election];if(!generic&&!definition)throw Error('Choose a known election agenda.');
|
||||
const kind=definition?.kind||'clan_delegate',start=electionDates(kind,Date.now(),1)[0],votingStart=new Date(start),campaignStart=new Date(votingStart.getTime()-7*86400000),initial=generic?new Date():new Date(campaignStart);initial.setUTCHours(0,0,0,0);
|
||||
let active=true,calendar=null,featured=true;const selected=new Map(),busyDate=new Date(initial);busyDate.setUTCHours(generic?10:Math.min(23,campaignStart.getUTCHours()+1));const occupied=busyDate.toISOString();
|
||||
const root=el('section',undefined,'promotion-agenda');root.dataset.election=generic?(company?'company-promotion':'clan-promotion'):election;const title=generic?(company?'Company Promotion Agenda':'Clan Promotion Agenda'):definition.name+' · '+(remindersOnly?'Election Calendar':'Campaign Agenda');
|
||||
|
|
|
|||
Loading…
Reference in a new issue

Staff