diff --git a/app/controllers/glossary_terms_controller.rb b/app/controllers/glossary_terms_controller.rb
index 05c3edc..45f00c1 100644
--- a/app/controllers/glossary_terms_controller.rb
+++ b/app/controllers/glossary_terms_controller.rb
@@ -5,6 +5,7 @@ class GlossaryTermsController < ApplicationController
def index
@glossary_terms = GlossaryTerm.where(project_id: @project.id)
+ @glossary_terms = @glossary_terms.search_by_name(params[:index]) unless params[:index].nil?
end
def new
diff --git a/app/models/glossary_term.rb b/app/models/glossary_term.rb
index fd087b3..eee2c69 100644
--- a/app/models/glossary_term.rb
+++ b/app/models/glossary_term.rb
@@ -1,4 +1,9 @@
class GlossaryTerm < ActiveRecord::Base
belongs_to :category, class_name: 'GlossaryCategory', foreign_key: 'category_id'
belongs_to :project
+
+ scope :search_by_name, -> (keyword) {
+ where 'name like ?', "#{sanitize_sql_like(keyword)}%"
+ }
+
end
diff --git a/app/views/glossary_terms/_sidebar.html.erb b/app/views/glossary_terms/_sidebar.html.erb
new file mode 100644
index 0000000..57dd03c
--- /dev/null
+++ b/app/views/glossary_terms/_sidebar.html.erb
@@ -0,0 +1,24 @@
+<% content_for :sidebar do %>
+
<%=l :label_view %>
+
+ <%=l :label_glossary_term %>
+ <%= link_to l(:label_glossary_term_new), new_project_glossary_term_path,
+ class: 'icon icon-add' %>
+
+ <%=l :label_glossary_category %>
+ <%= link_to l(:label_glossary_category_new),
+ new_project_glossary_category_path, class: 'icon icon-add' %>
+ <%= link_to l(:label_glossary_categories),
+ project_glossary_categories_path %>
+
+ <%=l :label_glossary_index %>
+
+ <% l(:index_en).each_line do |line| %>
+
+ <% line.split(" ").each do |ch| %>
+ <%= link_to ch, project_glossary_terms_path(index: ch) %> |
+ <% end %>
+
+ <% end %>
+
+<% end %>
diff --git a/app/views/glossary_terms/index.html.erb b/app/views/glossary_terms/index.html.erb
index 65dea9b..7df779e 100644
--- a/app/views/glossary_terms/index.html.erb
+++ b/app/views/glossary_terms/index.html.erb
@@ -3,7 +3,9 @@
<%= link_to l(:label_glossary_term_new), new_project_glossary_term_path, class: 'icon icon-add' %>
-
+
+<%= render partial: 'sidebar' %>
+
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 76087ed..969663e 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -7,4 +7,15 @@ en:
label_glossary_category: "Glossary category"
label_glossary_category_new: "New glossary category"
- glossary_title: Glossary
\ No newline at end of file
+ glossary_title: Glossary
+
+ label_view: View
+ label_glossary_index: index
+
+ index_en: |
+ A B C D E F
+ G H I J K L
+ M N O P Q R
+ S T U V W X
+ Y Z
+
\ No newline at end of file
diff --git a/config/locales/ja.yml b/config/locales/ja.yml
index e84965a..7128d78 100644
--- a/config/locales/ja.yml
+++ b/config/locales/ja.yml
@@ -2,7 +2,11 @@ ja:
label_glossary_terms: "用語集"
label_glossary_term: "用語"
label_glossary_term_new: "用語の作成"
- label_glossary_categories: "用語のカテゴリ"
+ label_glossary_categories: "用語のカテゴリ一覧"
label_glossary_category: "用語のカテゴリ"
label_glossary_category_new: "カテゴリの作成"
- glossary_title: 用語集
\ No newline at end of file
+ glossary_title: 用語集
+
+ label_view: 表示
+ label_glossary_index: 索引
+
\ No newline at end of file