admin: Handle more info in challenge.json
This commit is contained in:
parent
4c84038b28
commit
f65375b01f
2 changed files with 61 additions and 5 deletions
|
@ -269,6 +269,49 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label for="main_logo" class="col-sm-3 col-form-label col-form-label-sm">Logo principal</label>
|
||||
<div class="col-sm-9">
|
||||
<div ng-repeat="(i, v) in challenge.main_logo track by $index" class="input-group">
|
||||
<input type="text" class="form-control form-control-sm" id="main_logo" ng-model="challenge.main_logo[i]">
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-sm btn-outline-success" type="button" ng-if="$last" ng-click="challenge.main_logo.push('')">
|
||||
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span>
|
||||
</button>
|
||||
<button class="btn btn-sm btn-outline-danger" type="button" ng-click="challenge.main_logo.splice($index, 1)">
|
||||
<span class="glyphicon glyphicon-trash" aria-hidden="true"></span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label for="challengeParentLink" class="col-sm-3 col-form-label col-form-label-sm">Lien site parent</label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" class="form-control form-control-sm" id="challengeParentLink" ng-model="challenge.main_link">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label for="partner_0_alt" class="col-sm-3 col-form-label col-form-label-sm">Partenaires</label>
|
||||
<div class="col-sm-9">
|
||||
<div ng-repeat="(i, v) in challenge.partners track by $index" class="d-flex justify-content-between">
|
||||
<input type="text" class="form-control form-control-sm" id="partner_{{$index}}_alt" ng-model="challenge.partners[i].alt" placeholder="Titre">
|
||||
<input type="text" class="form-control form-control-sm" id="partner_{{$index}}_img" ng-model="challenge.partners[i].img" placeholder="Lien image">
|
||||
<input type="text" class="form-control form-control-sm" id="partner_{{$index}}_href" ng-model="challenge.partners[i].href" placeholder="Lien site">
|
||||
<div class="d-flex">
|
||||
<button class="btn btn-sm btn-outline-success" type="button" ng-if="$last" ng-click="challenge.partners.push({})">
|
||||
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span>
|
||||
</button>
|
||||
<button class="btn btn-sm btn-outline-danger" type="button" ng-click="challenge.partners.splice($index, 1)">
|
||||
<span class="glyphicon glyphicon-trash" aria-hidden="true"></span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
|
|
@ -9,25 +9,38 @@ import (
|
|||
// ChallengeFile is the expected name of the file containing the challenge infos.
|
||||
const ChallengeFile = "challenge.json"
|
||||
|
||||
type ChallengePartner struct {
|
||||
Src string `json:"img"`
|
||||
Alt string `json:"alt,omitempty"`
|
||||
Href string `json:"href,omitempty"`
|
||||
}
|
||||
|
||||
// ChallengeInfo stores common descriptions and informations about the challenge.
|
||||
type ChallengeInfo struct {
|
||||
// Title is the displayed name of the challenge.
|
||||
Title string `json:"title"`
|
||||
// SubTitle is appended to the title.
|
||||
SubTitle string `json:"subtitle"`
|
||||
SubTitle string `json:"subtitle,omitempty"`
|
||||
// Authors is the group name of people making the challenge.
|
||||
Authors string `json:"authors"`
|
||||
// ExpectedDuration is the duration (in minutes) suggested when stating the challenge.
|
||||
ExpectedDuration uint `json:"duration"`
|
||||
// VideoLink is the link to explaination videos when the challenge is over.
|
||||
VideosLink string `json:"videoslink"`
|
||||
VideosLink string `json:"videoslink,omitempty"`
|
||||
|
||||
// Description gives an overview of the challenge.
|
||||
Description string `json:"description"`
|
||||
Description string `json:"description,omitempty"`
|
||||
// Rules tell the player some help.
|
||||
Rules string `json:"rules"`
|
||||
Rules string `json:"rules,omitempty"`
|
||||
// YourMission is a small introduction to understand the goals.
|
||||
YourMission string `json:"your_mission"`
|
||||
YourMission string `json:"your_mission,omitempty"`
|
||||
|
||||
// MainLogo stores path to logos displayed in the header.
|
||||
MainLogo []string `json:"main_logo,omitempty"`
|
||||
// MainLink stores link to the parent website.
|
||||
MainLink string `json:"main_link,omitempty"`
|
||||
// Partners holds the challenge partners list.
|
||||
Partners []ChallengePartner `json:"partners,omitempty"`
|
||||
}
|
||||
|
||||
// ReadChallenge parses the file at the given location.
|
||||
|
|
Reference in a new issue