Skip to content

Commit f74b02e

Browse files
committed
support draggable with db columns, same as checkboxes
1 parent 128e178 commit f74b02e

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

CHANGELOG.rdoc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@
99
- Fix style for checkbox list in subform
1010
- Fix constraints (broken on 4.2.2 on some cases)
1111
- Add clear_form_column_if, works like hide_form_column_if but sends the column empty, to clear it
12-
- Add checkboxes form UI, like select form UI in collection associations but supporting DB columns (e.g. serialized)
13-
- Add list UI for select_multiple, checkboxes, select and radio. Select and radio were handled by format_column_value, but the list UI works better
12+
- Add checkboxes form UI, like select form UI in collection associations but supporting DB columns (e.g. columns using serialize)
13+
- Support draggable form UI in non-association columns, like checkboxes (e.g. columns using serialize)
14+
- Add list UI for select_multiple, dragg, checkboxes, select and radio. Select and radio were handled by format_column_value, but the list UI works better
1415

1516
= 4.2.2
1617
- Support setting form_ui_options with nil, for subforms

lib/active_scaffold/helpers/form_column_helpers.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -315,9 +315,9 @@ def form_hidden_field(column, record, scope, clear = false)
315315
def active_scaffold_column_expect_array?(column)
316316
ui_options = column.form_ui_options || column.options
317317
case column.form_ui
318-
when :select, :draggable
318+
when :select
319319
column.association&.collection? || ui_options[:multiple]
320-
when :select_multiple, :checkboxes
320+
when :select_multiple, :checkboxes, :draggable
321321
true
322322
end
323323
end
@@ -572,7 +572,7 @@ def active_scaffold_input_plural_association(column, options, ui_options: column
572572
end
573573

574574
def active_scaffold_input_draggable(column, options, ui_options: column.options)
575-
active_scaffold_input_select(column, options.merge(draggable_lists: true), ui_options: ui_options)
575+
active_scaffold_input_checkboxes(column, options.merge(draggable_lists: true), ui_options: ui_options)
576576
end
577577

578578
def active_scaffold_input_checkboxes(column, options, ui_options: column.options)

lib/active_scaffold/helpers/list_column_helpers.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ def active_scaffold_column_checkboxes(record, column, ui_options: column.options
119119
content_tag :ul, safe_join(values.map { |v| content_tag(:li, convert_value_to_label(column, v)) })
120120
end
121121
alias active_scaffold_column_select_multiple active_scaffold_column_checkboxes
122+
alias active_scaffold_column_draggable active_scaffold_column_checkboxes
122123

123124
def active_scaffold_column_select(record, column, ui_options: column.options)
124125
unless column.association

0 commit comments

Comments
 (0)