Skip to content

Commit 391863e

Browse files
committed
Adjust db/migrate and js scroll part
1 parent 30f4c9e commit 391863e

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

app/views/text_blocks/_list.html.erb

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,7 @@
3333
}
3434
});
3535
$(function() {
36-
$("table.textblocks tbody").positionedItems({
37-
scroll: false,
38-
sort: function (event, ui) {
39-
ui.helper.css({'top': ui.position.top + $(window).scrollTop() + 'px'});
40-
},
41-
});
36+
$("table.textblocks tbody").positionedItems();
4237
});
4338
<% end %>
4439
<% end %>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
class AddPositionToTextBlocks < ActiveRecord::Migration[5.2]
22
def change
33
add_column :text_blocks, :position, :integer, :default => 1
4+
# # After executing "rake redmine:plugins:migrate", execute the following on "rails console", if keeping the existing positions is important:
5+
# res = TextBlock.connection.select_all("SELECT id, name, project_id, row_number() over(PARTITION by project_id) AS position FROM #{TextBlock.table_name}")
6+
# res.rows.each{|row| TextBlock.connection.execute("UPDATE #{TextBlock.table_name} SET position=#{row[3]} WHERE id=#{row[0]}")}
47
end
58
end

0 commit comments

Comments
 (0)