Skip to content
Snippets Groups Projects
Commit 8673786d authored by Benoit Lavenier's avatar Benoit Lavenier
Browse files

ES profile: avoid to long name - fix #308

parent 4add45b4
No related branches found
No related tags found
No related merge requests found
...@@ -342,7 +342,11 @@ angular.module('cesium.es.user.services', ['cesium.services', 'cesium.es.http.se ...@@ -342,7 +342,11 @@ angular.module('cesium.es.user.services', ['cesium.services', 'cesium.es.http.se
var avatar = esHttp.image.fromHit(host, port, hit, 'avatar'); var avatar = esHttp.image.fromHit(host, port, hit, 'avatar');
_.forEach(values, function(data) { _.forEach(values, function(data) {
// name (basic or highlighted) // name (basic or highlighted)
data.name=hit._source.title; data.name = hit._source.title;
// Avoid too long name (workaround for #308)
if (data.name && data.name.length > 30) {
data.name = data.name.substr(0, 27) + '...';
}
if (hit.highlight) { if (hit.highlight) {
if (hit.highlight.title) { if (hit.highlight.title) {
data.name = hit.highlight.title[0]; data.name = hit.highlight.title[0];
...@@ -387,6 +391,10 @@ angular.module('cesium.es.user.services', ['cesium.services', 'cesium.es.http.se ...@@ -387,6 +391,10 @@ angular.module('cesium.es.user.services', ['cesium.services', 'cesium.es.http.se
.then(function(profile) { .then(function(profile) {
if (profile) { if (profile) {
data.name = profile.name; data.name = profile.name;
// Avoid too long name (workaround for #308)
if (data.name && data.name.length > 30) {
data.name = data.name.substr(0, 27) + '...';
}
data.avatar = profile.avatar; data.avatar = profile.avatar;
data.profile = profile.source; data.profile = profile.source;
......
...@@ -64,6 +64,7 @@ ...@@ -64,6 +64,7 @@
id="profile-name" id="profile-name"
ng-model="formData.title" ng-model="formData.title"
ng-model-options="{ debounce: 350 }" ng-model-options="{ debounce: 350 }"
ng-maxlength="30"
required> required>
</ion-item> </ion-item>
<div class="form-errors" <div class="form-errors"
...@@ -72,6 +73,9 @@ ...@@ -72,6 +73,9 @@
<div class="form-error" ng-message="required"> <div class="form-error" ng-message="required">
<span translate="ERROR.FIELD_REQUIRED"></span> <span translate="ERROR.FIELD_REQUIRED"></span>
</div> </div>
<div class="form-error" ng-message="maxlength">
<span translate="ERROR.FIELD_TOO_LONG_WITH_LENGTH" translate-values="{maxLength: 30}"></span>
</div>
</div> </div>
<!-- description --> <!-- description -->
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment