Show character sheet on table
This commit is contained in:
parent
2aef1b532c
commit
d8a27f8e41
|
@ -7,6 +7,11 @@ class CharacterSheetSectionsController < ApplicationController
|
|||
def index
|
||||
@sections = @character.character_sheet_sections.top_level
|
||||
@editable = ActiveModel::Type::Boolean.new.cast(params[:editable])
|
||||
if params[:table_id].present?
|
||||
@table = Current.user.tables.find(params[:table_id])
|
||||
@characters = Current.user.characters.where(table: @table)
|
||||
render layout: "table"
|
||||
end
|
||||
end
|
||||
|
||||
def new
|
||||
|
|
|
@ -22,11 +22,6 @@ class CharactersController < ApplicationController
|
|||
end
|
||||
|
||||
def show
|
||||
if params[:table_id].present?
|
||||
@table = Current.user.tables.find(params[:table_id])
|
||||
@characters = Current.user.characters.where(table: @table)
|
||||
render layout: "table"
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
<h2><%= @character.name %></h2>
|
||||
|
||||
<% if @editable %>
|
||||
<%= link_to t(".stop_editing"), character_character_sheet_sections_path(editable: false) %>
|
||||
<%= link_to t(".stop_editing"), url_for(editable: false) %>
|
||||
<% else %>
|
||||
<%= link_to t(".edit"), character_character_sheet_sections_path(editable: true) %>
|
||||
<%= link_to t(".edit"), url_for(editable: true) %>
|
||||
<% end %>
|
||||
|
||||
<div id="character_sheet">
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<ul>
|
||||
<li><%= link_to t(".overview"), @table %></li>
|
||||
<% @characters.each do |character| %>
|
||||
<li><%= link_to character.name, table_character_path(@table, character) %></li>
|
||||
<li><%= link_to character.name, table_character_character_sheet_sections_path(@table, character) %></li>
|
||||
<% end %>
|
||||
<li><%= link_to t(".events"), table_events_path(@table) %></li>
|
||||
</ul>
|
||||
|
|
|
@ -26,7 +26,9 @@ Rails.application.routes.draw do
|
|||
resources :stats, only: [ :update, :destroy ]
|
||||
resources :table_invites, only: [ :index, :edit, :update ]
|
||||
resources :tables do
|
||||
resources :characters, only: [ :show ]
|
||||
resources :characters, only: [] do
|
||||
resources :character_sheet_sections, only: [ :index ]
|
||||
end
|
||||
resources :events, only: [ :index ]
|
||||
resources :table_invites, only: [ :new, :create ]
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue