Added Quantity ordering
Some table columns made unwrappable
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
class QuantitiesController < ApplicationController
|
||||
before_action :find_project_by_project_id, only: [:index, :create]
|
||||
before_action :find_quantity, only: [:destroy, :toggle]
|
||||
before_action :find_quantity, only: [:destroy, :toggle, :up, :down, :left, :right]
|
||||
before_action :authorize
|
||||
|
||||
def index
|
||||
@@ -31,6 +31,26 @@ class QuantitiesController < ApplicationController
|
||||
redirect_to project_quantities_url(@project)
|
||||
end
|
||||
|
||||
def up
|
||||
@quantity.move_left if @quantity.left_sibling.present?
|
||||
redirect_to project_quantities_url(@project)
|
||||
end
|
||||
|
||||
def down
|
||||
@quantity.move_right if @quantity.right_sibling.present?
|
||||
redirect_to project_quantities_url(@project)
|
||||
end
|
||||
|
||||
def left
|
||||
@quantity.move_to_right_of(@quantity.parent) if @quantity.parent.present?
|
||||
redirect_to project_quantities_url(@project)
|
||||
end
|
||||
|
||||
def right
|
||||
@quantity.move_to_child_of(@quantity.left_sibling) if @quantity.left_sibling.present?
|
||||
redirect_to project_quantities_url(@project)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def quantity_params
|
||||
|
||||
Reference in New Issue
Block a user