プロジェクト

全般

プロフィール

« | » 

リビジョン 3f7c9b0b

高徹 高橋 徹 さんが約6年前に追加

[phase-8]introduced security and authorization

差分を表示:

app/views/glossary_categories/index.html.erb
<h2><%=l :label_glossary_categories %></h2>
<div class="contextual">
<%= link_to l(:label_glossary_category_new), new_project_glossary_category_path, class: 'icon icon-add' %>
<%= link_to_if_authorized l(:label_glossary_category_new),
{ controller: :glossary_categories, action: :new, project_id: @project },
class: 'icon icon-add' %>
</div>
<%= render partial: 'glossary_terms/sidebar' %>
app/views/glossary_categories/show.html.erb
<div class="contextual">
<%= link_to l(:button_edit), edit_project_glossary_category_path, class: 'icon icon-edit' %>
<%= link_to l(:button_delete), project_glossary_category_path, method: :delete,
data: {confirm: l(:text_are_you_sure)}, class: 'icon icon-del' %>
<%= link_to_if_authorized l(:button_edit),
{ controller: :glossary_categories, action: :edit, project_id: @project },
class: 'icon icon-edit' %>
<%= link_to_if_authorized l(:button_delete),
{ controller: :glossary_categories, action: :destroy,
id: @category, project_id: @project },
method: :delete, data: {confirm: l(:text_are_you_sure)}, class: 'icon icon-del' %>
</div>
<%= render partial: 'glossary_terms/sidebar' %>
app/views/glossary_terms/_sidebar.html.erb
<h3><%=l :label_view %></h3>
<h3><%=l :label_glossary_term %></h3>
<p><%= link_to l(:label_glossary_term_new), new_project_glossary_term_path,
<p><%= link_to_if_authorized l(:label_glossary_term_new),
{ controller: :glossary_terms, action: :new, project_id: @project },
class: 'icon icon-add' %></p>
<h3><%=l :label_glossary_category %></h3>
<p><%= link_to l(:label_glossary_category_new),
new_project_glossary_category_path, class: 'icon icon-add' %></p>
<p><%= link_to_if_authorized l(:label_glossary_category_new),
{ controller: :glossary_categories, action: :new, project_id: @project},
class: 'icon icon-add' %></p>
<p><%= link_to l(:label_glossary_categories),
project_glossary_categories_path %></p>
app/views/glossary_terms/index.html.erb
<h2><%=l :label_glossary_terms %></h2>
<div class="contextual">
<%= link_to l(:label_glossary_term_new), new_project_glossary_term_path, class: 'icon icon-add' %>
<%= link_to_if_authorized l(:label_glossary_term_new),
{ controller: :glossary_terms, action: :new, project_id: @project },
class: 'icon icon-add' %>
</div>
<%= render partial: 'sidebar' %>
app/views/glossary_terms/show.html.erb
<div class="contextual">
<%= link_to l(:button_edit), edit_project_glossary_term_path, class: 'icon icon-edit' %>
<%= link_to l(:button_delete), project_glossary_term_path, method: :delete,
data: {confirm: l(:text_are_you_sure)}, class: 'icon icon-del' %>
<%= link_to_if_authorized l(:button_edit),
{ controller: :glossary_terms, action: :edit, project_id: @project },
class: 'icon icon-edit' %>
<%= link_to_if_authorized l(:button_delete),
{ controller: :glossary_terms, action: :destroy,
id: @term, project_id: @project },
method: :delete, data: {confirm: l(:text_are_you_sure)}, class: 'icon icon-del' %>
</div>
<%= render partial: 'sidebar' %>
config/locales/en.yml
label_glossary_category_new: "New glossary category"
glossary_title: Glossary
project_module_glossary: Glossary
label_view: View
label_glossary_index: index
......
M N O P Q R
S T U V W X
Y Z
permission_view_glossary: View glossary
permission_manage_glossary: Manage glossary
config/locales/ja.yml
label_glossary_categories: "用語のカテゴリ一覧"
label_glossary_category: "用語のカテゴリ"
label_glossary_category_new: "カテゴリの作成"
glossary_title: 用語集
project_module_glossary: 用語集
label_view: 表示
label_glossary_index: 索引
permission_view_glossary: 用語集の閲覧
permission_manage_glossary: 用語集の管理
init.rb
project_module :glossary do
permission :all_glossary, glossary_terms: :index
permission :view_glossary, {
glossary_terms: [:index, :show],
glossary_categories: [:index, :show]
}
permission :manage_glossary, {
glossary_terms: [:new, :create, :edit, :update, :destroy],
glossary_categories: [:new, :create, :edit, :update, :destroy],
},
require: :member
end
menu :project_menu, :glossary,

他の形式にエクスポート: Unified diff