From bb5c36d65fb2c412b3bdfbdcbd27e5fe0c12b8f3 Mon Sep 17 00:00:00 2001 From: Andrew Brown Date: Tue, 22 Jan 2013 18:52:02 -0600 Subject: [PATCH] intro box for adding magic --- app/views/magic/_form.html.erb | 3 +-- app/views/magic/index.html.erb | 17 ++++++++++++++--- config/routes.rb | 1 + 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/app/views/magic/_form.html.erb b/app/views/magic/_form.html.erb index 96386371..fa4581f7 100644 --- a/app/views/magic/_form.html.erb +++ b/app/views/magic/_form.html.erb @@ -9,8 +9,7 @@
<%= f.label :type_of_magic, :class => 'control-label' %>
- <%= f.text_field :type_of, :class => 'text_field' %> -
Spell, Ability, Enchantment, etc
+ <%= f.text_field :type_of, :class => 'text_field', :value => (params[:type_of] || "").capitalize %>
diff --git a/app/views/magic/index.html.erb b/app/views/magic/index.html.erb index 241c2192..08dd723f 100644 --- a/app/views/magic/index.html.erb +++ b/app/views/magic/index.html.erb @@ -29,6 +29,17 @@ -<%= link_to t('.new', :default => t("helpers.links.new")), - magic_create_path, - :class => 'btn btn-primary' %> +
+

Planning magic

+

+ Magic, the most wonderous thing! How does it work? +

+ + <%= link_to 'New magic', magic_create_path, :class => 'btn btn-primary' %> + + <%= link_to 'New spell', magic_create_type_path(:spell), :class => 'btn' %> + <%= link_to 'New enchantment', magic_create_type_path(:enchantment), :class => 'btn' %> + <%= link_to 'New curse', magic_create_type_path(:curse), :class => 'btn' %> + <%= link_to 'New potion', magic_create_type_path(:potion), :class => 'btn' %> +
+ diff --git a/config/routes.rb b/config/routes.rb index b18553e9..1690b867 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -70,6 +70,7 @@ PlanCharacters::Application.routes.draw do get '/magic/from/:universe', :to => 'magic#index', :as => :magic_by_universe get '/magic/new', :to => 'magic#new', :as => :magic_create post '/magic/new', :to => 'magic#create', :as => :magic_create_process + get '/magic/new/:type_of', :to => 'magic#new', :as => :magic_create_type get '/magic/:id', :to => 'magic#show', :as => :magic get '/magic/:id/edit', :to => 'magic#edit', :as => :magic_edit put '/magic/:id', :to => 'magic#update', :as => :magic_edit_process