tabletop-companion/app/controllers/character_sheet_features_co...

29 lines
809 B
Ruby

# frozen_string_literal: true
class CharacterSheetFeaturesController < ApplicationController
before_action :set_character_sheet_feature
before_action :set_character
def reorder_down
@character_sheet_feature.move(to: @character_sheet_feature.order_index - 1)
@editable = true
render "character_sheet_sections/character_sheet_section"
end
def reorder_up
@character_sheet_feature.move(to: @character_sheet_feature.order_index + 1)
@editable = true
render "character_sheet_sections/character_sheet_section"
end
private
def set_character
@character = @character_sheet_feature.featurable.character
end
def set_character_sheet_feature
@character_sheet_feature = Current.user.character_sheet_features.find_by(featurable_id: params[:id])
end
end