|
|
|
@ -164,7 +164,7 @@ func Profile(ctx *context.Context) {
|
|
|
|
|
content string |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
content, renderErr = GetRenderedTextField(ctx, ctxUser, "Description") |
|
|
|
|
content, renderErr = GetRenderedTextFieldByName(ctx, ctxUser, "Description") |
|
|
|
|
if renderErr == nil { |
|
|
|
|
ctx.Data["RenderedDescription"] = content |
|
|
|
|
} else { |
|
|
|
@ -172,7 +172,7 @@ func Profile(ctx *context.Context) {
|
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
content, renderErr = GetRenderedTextField(ctx, ctxUser, "Competences") |
|
|
|
|
content, renderErr = GetRenderedTextFieldByName(ctx, ctxUser, "Competences") |
|
|
|
|
if renderErr == nil { |
|
|
|
|
ctx.Data["RenderedCompetences"] = content |
|
|
|
|
} else { |
|
|
|
@ -180,7 +180,7 @@ func Profile(ctx *context.Context) {
|
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
content, renderErr = GetRenderedTextField(ctx, ctxUser, "Resources") |
|
|
|
|
content, renderErr = GetRenderedTextFieldByName(ctx, ctxUser, "Resources") |
|
|
|
|
if renderErr == nil { |
|
|
|
|
ctx.Data["RenderedResources"] = content |
|
|
|
|
} else { |
|
|
|
@ -188,7 +188,7 @@ func Profile(ctx *context.Context) {
|
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
content, renderErr = GetRenderedTextField(ctx, ctxUser, "Interests") |
|
|
|
|
content, renderErr = GetRenderedTextFieldByName(ctx, ctxUser, "Interests") |
|
|
|
|
if renderErr == nil { |
|
|
|
|
ctx.Data["RenderedInterests"] = content |
|
|
|
|
} else { |
|
|
|
@ -402,16 +402,24 @@ func Action(ctx *context.Context) {
|
|
|
|
|
ctx.RedirectToFirst(ctx.FormString("redirect_to"), u.HomeLink()) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func getTextField(obj interface{}, fieldName string) string { |
|
|
|
|
func GetTextField(obj interface{}, fieldName string) string { |
|
|
|
|
reflectedObj := reflect.ValueOf(obj) |
|
|
|
|
dynamicField := reflect.Indirect(reflectedObj).FieldByName(fieldName) |
|
|
|
|
return dynamicField.String() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func GetRenderedTextField(ctx *context.Context, obj interface{}, fieldName string) (string, error) { |
|
|
|
|
func GetRenderedTextFieldByName(ctx *context.Context, obj interface{}, fieldName string) (string, error) { |
|
|
|
|
var err error = nil |
|
|
|
|
var content string |
|
|
|
|
fieldVal := getTextField(obj, fieldName) |
|
|
|
|
fieldVal := GetTextField(obj, fieldName) |
|
|
|
|
content, err = GetRenderedTextFieldByValue(ctx, obj, fieldVal) |
|
|
|
|
return content, err |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func GetRenderedTextFieldByValue(ctx *context.Context, obj interface{}, fieldVal string) (string, error) { |
|
|
|
|
var content string |
|
|
|
|
var err error |
|
|
|
|
|
|
|
|
|
if len(fieldVal) != 0 { |
|
|
|
|
content, err = markdown.RenderString(&markup.RenderContext{ |
|
|
|
|
URLPrefix: ctx.Repo.RepoLink, |
|
|
|
|