[phase-3]add show action in minimum
This commit is contained in:
parent
1c17a44d1a
commit
cffd7877da
@ -1,6 +1,17 @@
|
|||||||
class GlossaryTermsController < ApplicationController
|
class GlossaryTermsController < ApplicationController
|
||||||
|
|
||||||
|
before_action :find_term_from_id, only: [:show]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@glossary_terms = GlossaryTerm.all
|
@glossary_terms = GlossaryTerm.all
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# def show
|
||||||
|
|
||||||
|
# end
|
||||||
|
|
||||||
|
# Find the term whose id is the :id parameter
|
||||||
|
def find_term_from_id
|
||||||
|
@term = GlossaryTerm.find(params[:id])
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
10
app/views/glossary_terms/show.html.erb
Normal file
10
app/views/glossary_terms/show.html.erb
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<h2><%=t :label_glossary_term %> #<%= @term.id %></h2>
|
||||||
|
|
||||||
|
<h3><%= @term.name %></h3>
|
||||||
|
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<th><%=t :field_description %></th>
|
||||||
|
<td><%= @term.description %></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
@ -1,4 +1,4 @@
|
|||||||
# English strings go here for Rails i18n
|
# English strings go here for Rails i18n
|
||||||
en:
|
en:
|
||||||
label_glossary_terms: "Glossary terms"
|
label_glossary_terms: "Glossary terms"
|
||||||
|
label_glossary_term: "Glossary term"
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
ja:
|
ja:
|
||||||
label_glossary_terms: "用語集"
|
label_glossary_terms: "用語集"
|
||||||
|
label_glossary_term: "用語"
|
||||||
|
|
@ -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]
|
resources :glossary_terms, only: [:index, :show]
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user