Class: Binda::BoardsController
Instance Method Summary
collapse
#bytes_to_megabytes, #fieldable_params, #nested_fieldable_params, #return_audio_details, #return_image_details, #return_svg_details, #return_video_details, #upload_details, #upload_params
#after_sign_in_path_for, #after_sign_out_path_for, #set_locale
Instance Method Details
#dashboard ⇒ Object
41
42
43
44
45
46
|
# File 'app/controllers/binda/boards_controller.rb', line 41
def dashboard
@structure = Structure.friendly.find('dashboard')
@board = Board.friendly.find('dashboard')
@instance = @board
render action: :edit
end
|
#destroy ⇒ Object
25
26
27
28
|
# File 'app/controllers/binda/boards_controller.rb', line 25
def destroy
@board.destroy
redirect_to root_url, notice: 'Setting was successfully destroyed.'
end
|
#edit ⇒ Object
14
15
|
# File 'app/controllers/binda/boards_controller.rb', line 14
def edit
end
|
#new_repeater ⇒ Object
30
31
32
33
34
|
# File 'app/controllers/binda/boards_controller.rb', line 30
def new_repeater
@repeater_setting = FieldSetting.find(params[:repeater_setting_id])
@repeater = @instance.repeaters.create(field_setting: @repeater_setting)
render 'binda/fieldable/_form_item_new_repeater', layout: false
end
|
#show ⇒ Object
10
11
12
|
# File 'app/controllers/binda/boards_controller.rb', line 10
def show
redirect_to action: :edit
end
|
#sort_repeaters ⇒ Object
36
37
38
39
|
# File 'app/controllers/binda/boards_controller.rb', line 36
def sort_repeaters
sort_repeaters_by(params["form--list-item"])
render json: { id: "##{params[:id]}" }, status: 200
end
|
#update ⇒ Object
17
18
19
20
21
22
23
|
# File 'app/controllers/binda/boards_controller.rb', line 17
def update
if @board.update(board_params)
redirect_to structure_board_path(@structure.slug, @board.slug), notice: 'Setting was successfully updated.'
else
render :edit, flash: { alert: @board.errors }
end
end
|
#upload ⇒ Object
48
49
50
51
52
53
54
55
56
57
|
# File 'app/controllers/binda/boards_controller.rb', line 48
def upload
if @board.update(upload_params(:board))
respond_to do |format|
format.json { render json: upload_details }
end
else
logger.debug("The upload process has failed. #{ @board.errors }")
head :bad_request
end
end
|