[phase-4]add new form
This commit is contained in:
parent
fe7395a659
commit
a89d77b4f6
@ -6,9 +6,9 @@ class GlossaryTermsController < ApplicationController
|
|||||||
@glossary_terms = GlossaryTerm.all
|
@glossary_terms = GlossaryTerm.all
|
||||||
end
|
end
|
||||||
|
|
||||||
# def show
|
def new
|
||||||
|
@term = GlossaryTerm.new
|
||||||
# end
|
end
|
||||||
|
|
||||||
# Find the term whose id is the :id parameter
|
# Find the term whose id is the :id parameter
|
||||||
def find_term_from_id
|
def find_term_from_id
|
||||||
|
4
app/views/glossary_terms/_form.html.erb
Normal file
4
app/views/glossary_terms/_form.html.erb
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
<div class="box tabular">
|
||||||
|
<p><%= form.text_field :name, size: 80, required: true %></p>
|
||||||
|
<p><%= form.text_area :description, size: "80x10", required: false %></p>
|
||||||
|
</div>
|
7
app/views/glossary_terms/new.html.erb
Normal file
7
app/views/glossary_terms/new.html.erb
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<h2><%=l :label_glossary_term_new %></h2>
|
||||||
|
|
||||||
|
<%= labelled_form_for :glossary_term, @term,
|
||||||
|
url: glossary_terms_path do |f| %>
|
||||||
|
<%= render partial: 'glossary_terms/form', locals: {form: f} %>
|
||||||
|
<%= f.submit l(:button_create) %>
|
||||||
|
<% end %>
|
@ -2,3 +2,4 @@
|
|||||||
en:
|
en:
|
||||||
label_glossary_terms: "Glossary terms"
|
label_glossary_terms: "Glossary terms"
|
||||||
label_glossary_term: "Glossary term"
|
label_glossary_term: "Glossary term"
|
||||||
|
label_glossary_term_new: "New glossary term"
|
@ -1,4 +1,4 @@
|
|||||||
ja:
|
ja:
|
||||||
label_glossary_terms: "用語集"
|
label_glossary_terms: "用語集"
|
||||||
label_glossary_term: "用語"
|
label_glossary_term: "用語"
|
||||||
|
label_glossary_term_new: "用語の作成"
|
@ -2,5 +2,5 @@
|
|||||||
# See: http://guides.rubyonrails.org/routing.html
|
# See: http://guides.rubyonrails.org/routing.html
|
||||||
|
|
||||||
Rails.application.routes.draw do
|
Rails.application.routes.draw do
|
||||||
resources :glossary_terms, only: [:index, :show]
|
resources :glossary_terms, only: [:index, :show, :new, :create]
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user