Last active
April 16, 2019 00:55
-
-
Save lcharette/41a950ac6d39f56f62de81c245f6aafb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% for field in user.profileFields %} | |
<div class="row"> | |
<div class="alert alert-info"> | |
{{ translate('USER.PROFILE.' ~ field.slug|upper) }} | |
</div> | |
</div> | |
{% endfor %} | |
</div> | |
<div class="col-xs-6"> | |
{% for field in user.profileFields %} | |
<div class="row"> | |
<div class="alert {% if fields.value == 'yes' %}alert-success{% elseif fields.value starts with 'yes' %}alert-warning{% elseif fields.value == 'no' %} alert-danger{% else %}alert-info{% endif %}"> | |
{{ fields.value }} | |
</div> | |
</div> | |
{% endfor %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ... | |
$user = User::with('profileFields')->get(); | |
return $this->ci->view->render($response, 'foo.html.twig', [ | |
'user' => $user | |
]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
return [ | |
'USER' => [ | |
'PROFILE' => [ | |
'LOCATION' => 'User location', | |
'GENDER' => 'User gender', | |
'OCCUPATION' => 'User occupation', | |
] | |
] | |
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"location" : { | |
"validators" : { | |
"length" : { | |
"label" : "USER.PROFILE.LOCATION", | |
"min" : 1, | |
"max" : 255, | |
"message" : "VALIDATE.LENGTH_RANGE" | |
} | |
}, | |
"form": { | |
"type": "text", | |
"label": "LOCATION", | |
"icon": "fa-globe" | |
} | |
}, | |
"occupation" : { | |
"validators" : { | |
"length" : { | |
"label" : "USER.PROFILE.OCCUPATION", | |
"min" : 1, | |
"max" : 255, | |
"message" : "VALIDATE.LENGTH_RANGE" | |
} | |
}, | |
"form": { | |
"type": "textarea", | |
"label": "OCCUPATION", | |
"icon": "fa-briefcase" | |
} | |
}, | |
"gender" : { | |
"validators" : {}, | |
"form": { | |
"type": "select", | |
"label": "USER.PROFILE.GENDER", | |
"icon": "fa-transgender", | |
"options" : { | |
"1" : "GENDER.MALE", | |
"2" : "GENDER.FEMALE", | |
"3" : "GENDER.NEUTRAL" | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment