dashboard: can customize main image background
This commit is contained in:
parent
37dde01444
commit
20dc1f65dc
8 changed files with 29 additions and 4 deletions
|
|
@ -157,7 +157,7 @@ func saveChallengeInfo(c *gin.Context) {
|
|||
// Ignore the error, try to continue
|
||||
}
|
||||
|
||||
err = sync.ImportChallengeInfo(info)
|
||||
err = sync.ImportChallengeInfo(info, DashboardDir)
|
||||
if err != nil {
|
||||
log.Println("Unable to ImportChallengeInfo:", err.Error())
|
||||
c.AbortWithStatusJSON(http.StatusBadRequest, gin.H{"errmsg": fmt.Sprintf("Something goes wrong when trying to import related files: %s", err.Error())})
|
||||
|
|
|
|||
|
|
@ -350,6 +350,13 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label for="dashboard_back" class="col-sm-3 col-form-label col-form-label-sm">Fond dashboard</label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" class="form-control form-control-sm" id="dashboard_back" ng-model="challenge.dashboard_back">
|
||||
</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">
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import (
|
|||
)
|
||||
|
||||
// ImportChallengeInfo imports images defined in the challengeinfo.
|
||||
func ImportChallengeInfo(ci *settings.ChallengeInfo) (err error) {
|
||||
func ImportChallengeInfo(ci *settings.ChallengeInfo, dashboardDir string) (err error) {
|
||||
if len(ci.MainLogo) > 0 {
|
||||
for i, logo := range ci.MainLogo {
|
||||
dest := path.Join(fic.FilesDir, "logo", path.Base(logo))
|
||||
|
|
@ -22,6 +22,14 @@ func ImportChallengeInfo(ci *settings.ChallengeInfo) (err error) {
|
|||
}
|
||||
}
|
||||
|
||||
if len(ci.DashboardBackground) > 0 {
|
||||
dest := path.Join(dashboardDir, path.Base(ci.DashboardBackground))
|
||||
err = importFile(GlobalImporter, ci.DashboardBackground, dest)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if len(ci.Partners) > 0 {
|
||||
for i, partner := range ci.Partners {
|
||||
dest := path.Join(fic.FilesDir, "partner", path.Base(partner.Src))
|
||||
|
|
|
|||
Reference in a new issue