Class: CharacterStatesController

Inherits:
ApplicationController show all
Includes:
DataControllerConfiguration::ProjectDataControllerConfiguration
Defined in:
app/controllers/character_states_controller.rb

Instance Attribute Summary

Attributes inherited from ApplicationController

#is_data_controller, #is_task_controller, #meta_data, #meta_description, #meta_keywords, #meta_title, #page_title, #site_name

Instance Method Summary (collapse)

Methods included from DataControllerConfiguration::ProjectDataControllerConfiguration

#polymorphic_filter_params

Methods inherited from ApplicationController

#clear_project_and_user_variables, #digest_cookie, #digested_cookie_exists?, #disable_turbolinks, #intercept_api, #invalid_object, #is_data_controller?, #is_task_controller?, #log_user_recent_route, #notice_user, #project_matches, #record_not_found, #set_project_and_user_variables, #set_project_from_params, #token_authenticate

Methods included from ProjectsHelper

#project_link, #project_tag, #projects_list, #projects_search_form

Instance Method Details

- (Object) annotations

GET /character_states/annotations.json



72
73
74
75
# File 'app/controllers/character_states_controller.rb', line 72

def annotations
  @object = @character_state
  render '/shared/data/all/annotations'
end

- (Object) character_state_params (private)



82
83
84
# File 'app/controllers/character_states_controller.rb', line 82

def character_state_params
  params.require(:character_state).permit(:name, :label, :descriptor_id, :position, :project_id, :updated_by_id, :created_by_id)
end

- (Object) create

POST /character_states POST /character_states.json



29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'app/controllers/character_states_controller.rb', line 29

def create
  @character_state = CharacterState.new(character_state_params)

  respond_to do |format|
    if @character_state.save
      format.html { redirect_to @character_state, notice: 'Character state was successfully created.' }
      format.json { render :show, status: :created, location: @character_state }
    else
      format.html { render :new }
      format.json { render json: @character_state.errors, status: :unprocessable_entity }
    end
  end
end

- (Object) destroy

DELETE /character_states/1 DELETE /character_states/1.json



59
60
61
62
63
64
65
# File 'app/controllers/character_states_controller.rb', line 59

def destroy
  @character_state.destroy
  respond_to do |format|
    format.html { redirect_to character_states_url, notice: 'Character state was successfully destroyed.' }
    format.json { head :no_content }
  end
end

- (Object) edit

GET /character_states/1/edit



24
25
# File 'app/controllers/character_states_controller.rb', line 24

def edit
end

- (Object) index

GET /character_states GET /character_states.json



8
9
10
11
# File 'app/controllers/character_states_controller.rb', line 8

def index
  @recent_objects = CharacterState.recent_from_project_id(sessions_current_project_id).order(updated_at: :desc).limit(10)
  render '/shared/data/all/index'
end

- (Object) list



67
68
69
# File 'app/controllers/character_states_controller.rb', line 67

def list
  @character_states = CharacterState.with_project_id(sessions_current_project_id).page(params[:page])
end

- (Object) new

GET /character_states/new



19
20
21
# File 'app/controllers/character_states_controller.rb', line 19

def new
  @character_state = CharacterState.new
end

- (Object) set_character_state (private)



78
79
80
# File 'app/controllers/character_states_controller.rb', line 78

def set_character_state
  @character_state = CharacterState.find(params[:id])
end

- (Object) show

GET /character_states/1 GET /character_states/1.json



15
16
# File 'app/controllers/character_states_controller.rb', line 15

def show
end

- (Object) update

PATCH/PUT /character_states/1 PATCH/PUT /character_states/1.json



45
46
47
48
49
50
51
52
53
54
55
# File 'app/controllers/character_states_controller.rb', line 45

def update
  respond_to do |format|
    if @character_state.update(character_state_params)
      format.html { redirect_to @character_state, notice: 'Character state was successfully updated.' }
      format.json { render :show, status: :ok, location: @character_state }
    else
      format.html { render :edit }
      format.json { render json: @character_state.errors, status: :unprocessable_entity }
    end
  end
end