#1098 Hide gravatar email field if gravatar is disabled (or offline mode)

pull/197/head
Unknwon 10 years ago
parent 6f81c05dde
commit caf7618ea6
  1. 3
      modules/base/template.go
  2. 3
      modules/setting/setting.go
  3. 2
      templates/org/settings/options.tmpl
  4. 2
      templates/user/settings/profile.tmpl

@ -118,6 +118,9 @@ var TemplateFuncs template.FuncMap = map[string]interface{}{
"CdnMode": func() bool {
return setting.ProdMode && !setting.OfflineMode
},
"DisableGravatar": func() bool {
return setting.DisableGravatar
},
"LoadTimes": func(startTime time.Time) string {
return fmt.Sprint(time.Since(startTime).Nanoseconds()/1e6) + "ms"
},

@ -322,6 +322,9 @@ func NewConfigContext() {
GravatarSource = "//1.gravatar.com/avatar/"
}
DisableGravatar = sec.Key("DISABLE_GRAVATAR").MustBool()
if OfflineMode {
DisableGravatar = true
}
if err = Cfg.Section("git").MapTo(&Git); err != nil {
log.Fatal(4, "Fail to map Git settings: %v", err)

@ -46,10 +46,12 @@
<label for="location">{{.i18n.Tr "org.settings.location"}}</label>
<input class="ipt ipt-large ipt-radius {{if .Err_Location}}ipt-error{{end}}" id="location" name="location" type="text" value="{{.Org.Location}}" />
</div>
{{if not DisableGravatar}}
<div class="field">
<label for="gravatar-email">Gravatar {{.i18n.Tr "email"}}</label>
<input class="ipt ipt-large ipt-radius {{if .Err_Avatar}}ipt-error{{end}}" id="gravatar-email" name="avatar" type="text" value="{{.Org.AvatarEmail}}" />
</div>
{{end}}
<div class="field">
<span class="form-label"></span>
<button class="btn btn-green btn-large btn-radius" id="change-orgname-btn" href="#change-orgname-modal">{{.i18n.Tr "org.settings.update_settings"}}</button>

@ -46,10 +46,12 @@
<label for="location">{{.i18n.Tr "settings.location"}}</label>
<input class="ipt ipt-large ipt-radius {{if .Err_Location}}ipt-error{{end}}" id="location" name="location" type="text" value="{{.SignedUser.Location}}" />
</div>
{{if not DisableGravatar}}
<div class="field">
<label class="req" for="gravatar-email">Gravatar {{.i18n.Tr "email"}}</label>
<input class="ipt ipt-large ipt-radius {{if .Err_Avatar}}ipt-error{{end}}" id="gravatar-email" name="avatar" type="text" value="{{.SignedUser.AvatarEmail}}" />
</div>
{{end}}
<div class="field">
<label></label>
<button class="btn btn-green btn-large btn-radius" id="change-username-btn" href="#change-username-modal">{{.i18n.Tr "settings.update_profile"}}</button>

Loading…
Cancel
Save