static: Replace an if-else block in popovers.js with a switch statement.

This commit is contained in:
Hemanth V. Alluri
2018-12-23 21:28:58 +05:30
committed by Tim Abbott
parent 43fd8e658d
commit b928bb3b26

View File

@@ -235,21 +235,24 @@ exports.show_user_profile = function (user) {
profile_field.is_user_field = false;
profile_field.is_link = field_type === field_types.URL.id;
profile_field.type = field_type;
if (field_value) {
if (field_type === field_types.DATE.id) {
profile_field.value = moment(field_value).format(localFormat);
} else if (field_type === field_types.USER.id) {
profile_field.id = field.id;
profile_field.is_user_field = true;
profile_field.value = field_value;
} else if (field_type === field_types.CHOICE.id) {
var field_choice_dict = JSON.parse(field.field_data);
profile_field.value = field_choice_dict[field_value].text;
} else {
profile_field.value = field_value;
}
profile_data.push(profile_field);
switch (field_type) {
case field_types.DATE.id:
profile_field.value = moment(field_value).format(localFormat);
break;
case field_types.USER.id:
profile_field.id = field.id;
profile_field.is_user_field = true;
profile_field.value = field_value;
break;
case field_types.CHOICE.id:
var field_choice_dict = JSON.parse(field.field_data);
profile_field.value = field_choice_dict[field_value].text;
break;
default:
profile_field.value = field_value;
break;
}
profile_data.push(profile_field);
});
var args = {