Skip to content

Commit

Permalink
'Select one' fields in single-edit mode
Browse files Browse the repository at this point in the history
The `notifyEdit` handler has been added in 2d7ba16
to correctly activate single-edition mode while clicking on the
field's rows. But that handler was preventing the click event to
reach the `<select>` element, and thus avoided showing the options
- ie, it couldn't be edited.

Removing the listener seems to fix the Select one edition, and it
doesn't seem to break the row-click for any of the existent field
types.

Fixes #875
  • Loading branch information
matiasgarciaisaia authored and Martin Verzilli committed Apr 25, 2017
1 parent 4f9a185 commit 5329629
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 7 deletions.
6 changes: 0 additions & 6 deletions app/assets/javascripts/collections/field.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -202,12 +202,6 @@ onCollections ->
window.model.initDatePicker(optionsDatePicker)
window.model.initAutocomplete()

notifyEdit: (ev) =>
# TODO: remove this eventually; this handler exists only to be installed
# as the mousedown handler for the field's row DIV. Otherwise, there are
# situations when clicking on the row doesn't activate the edition
undefined

keyPress: (field, event) =>
switch event.keyCode
when 13 then @save()
Expand Down
2 changes: 1 addition & 1 deletion app/views/collections/index/_map.haml
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@
/ko if: writeable
/- TODO: remove the mousedown handler. Otherwise, there are
/- situations when clicking on the row doesn't activate the edition
%div.site_row.writeable{ko(click: 'edit', event: {mousedown: 'notifyEdit'})}
%div.site_row.writeable{ko(click: 'edit')}
%span{ko(text: :errorMessage, validationPopover: :errorMessage), style: 'display: none;'}
%label.field-name{ko(text: "name + ':'", topPopover: "__('Field Code') + ': ' + code", css: { error: :error })}
/ko if: hasValue() && !error()
Expand Down

0 comments on commit 5329629

Please sign in to comment.