Class: CharacterStatesController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- CharacterStatesController
- Defined in:
- app/controllers/character_states_controller.rb
Constant Summary
Constants included from ProjectsHelper
ProjectsHelper::CLASSIFIER, ProjectsHelper::CLASSIFIER_ANNOTATION
Instance Method Summary collapse
-
#annotations ⇒ Object
TODO: remove GET /character_states/annotations.json.
- #autocomplete ⇒ Object
- #character_state_params ⇒ Object private
-
#create ⇒ Object
POST /character_states POST /character_states.json.
-
#destroy ⇒ Object
DELETE /character_states/1 DELETE /character_states/1.json.
-
#edit ⇒ Object
GET /character_states/1/edit.
-
#index ⇒ Object
GET /character_states GET /character_states.json.
- #list ⇒ Object
-
#new ⇒ Object
GET /character_states/new.
- #set_character_state ⇒ Object private
-
#show ⇒ Object
GET /character_states/1 GET /character_states/1.json.
-
#update ⇒ Object
PATCH/PUT /character_states/1 PATCH/PUT /character_states/1.json.
Methods included from DataControllerConfiguration::ProjectDataControllerConfiguration
Methods included from RedirectHelper
Methods included from RequestType
Methods included from LogRecent
Methods included from Cookies
#digest_cookie, #digested_cookie_exists?
Methods included from Whitelist
Methods included from ProjectsHelper
#cumulative_gb_per_year, #document_cumulative_gb_per_year, #document_gb_per_year, #gb_per_year, #image_cumulative_gb_per_year, #image_gb_per_year, #invalid_object, #project_classification, #project_link, #project_matches, #project_tag, #projects_list, #projects_search_form, #taxonworks_classification, #week_in_review_graphs
Methods included from Api::Intercept
Methods included from TokenAuthentication
#intercept_project, #intercept_user, #intercept_user_or_project, #project_token_authenticate, #token_authenticate
Instance Method Details
#annotations ⇒ Object
TODO: remove GET /character_states/annotations.json
90 91 92 93 |
# File 'app/controllers/character_states_controller.rb', line 90 def annotations @object = @character_state render '/shared/data/all/annotations' end |
#autocomplete ⇒ Object
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'app/controllers/character_states_controller.rb', line 67 def autocomplete @character_states = CharacterState.find_for_autocomplete(params).where(project_id: sessions_current_project_id) data = @character_states.collect do |t| label = helpers.(t) {id: t.id, label:, response_values: { params[:method] => t.id }, label_html: label } end render json: data end |
#character_state_params ⇒ Object (private)
100 101 102 |
# File 'app/controllers/character_states_controller.rb', line 100 def character_state_params params.require(:character_state).permit(:name, :key_name, :description_name, :label, :descriptor_id, :position) end |
#create ⇒ Object
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 |
#destroy ⇒ Object
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 |
#edit ⇒ Object
GET /character_states/1/edit
24 25 |
# File 'app/controllers/character_states_controller.rb', line 24 def edit end |
#index ⇒ Object
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 |
#list ⇒ Object
84 85 86 |
# File 'app/controllers/character_states_controller.rb', line 84 def list @character_states = CharacterState.with_project_id(sessions_current_project_id).page(params[:page]) end |
#new ⇒ Object
GET /character_states/new
19 20 21 |
# File 'app/controllers/character_states_controller.rb', line 19 def new @character_state = CharacterState.new end |
#set_character_state ⇒ Object (private)
96 97 98 |
# File 'app/controllers/character_states_controller.rb', line 96 def set_character_state @character_state = CharacterState.where(project_id: sessions_current_project_id).find(params[:id]) end |
#show ⇒ Object
GET /character_states/1 GET /character_states/1.json
15 16 |
# File 'app/controllers/character_states_controller.rb', line 15 def show end |
#update ⇒ Object
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 |