custom fields: Don't ask org admin to enter "value" for choice.

When org admin add choice type of custom profile fields, set
numeric ID for choices instead of asking "value" from org admin.
This commit is contained in:
Yashashvi Dave 2018-05-10 18:13:51 +05:30 committed by Tim Abbott
parent ece6b68e4c
commit d66d2445b4
3 changed files with 5 additions and 5 deletions

View File

@ -27,11 +27,13 @@ function delete_profile_field(e) {
function read_field_data_from_form(selector) { function read_field_data_from_form(selector) {
var field_data = {}; var field_data = {};
var i = 0;
selector.each(function (ind, row) { selector.each(function (ind, row) {
var value = row.children[0].value; var value = i;
var text = row.children[1].value; var text = row.children[0].value;
var order = row.children[2].value; var order = row.children[1].value;
field_data[value] = {text: text, order: order}; field_data[value] = {text: text, order: order};
i += 1;
}); });
return field_data; return field_data;
} }

View File

@ -42,7 +42,6 @@
<label for="profile_field_choices_edit">{{t "Field choices" }}</label> <label for="profile_field_choices_edit">{{t "Field choices" }}</label>
<div class="profile-field-choices" name="profile_field_choices_edit"> <div class="profile-field-choices" name="profile_field_choices_edit">
<div class='choices-header'> <div class='choices-header'>
<div class='choice-field'>Value</div>
<div class='choice-field'>Text</div> <div class='choice-field'>Text</div>
<div class='choice-field'>Order</div> <div class='choice-field'>Order</div>
</div> </div>

View File

@ -1,5 +1,4 @@
<div class='choice-row'> <div class='choice-row'>
<input type='text' data-toggle='tooltip' title='{{t "Value" }}' placeholder='{{t "Value" }}' value="{{ value }}" />
<input type='text' data-toggle='tooltip' title='{{t "Text" }}' placeholder='{{t "Text" }}' value="{{ text }}" /> <input type='text' data-toggle='tooltip' title='{{t "Text" }}' placeholder='{{t "Text" }}' value="{{ text }}" />
<input type='text' data-toggle='tooltip' title='{{t "Order" }}' placeholder='{{t "Order" }}' value="{{ order }}" /> <input type='text' data-toggle='tooltip' title='{{t "Order" }}' placeholder='{{t "Order" }}' value="{{ order }}" />
{{#if add_delete_button }} {{#if add_delete_button }}