リビジョン 0e0aa071
| app/controllers/glossary_terms_controller.rb | ||
|---|---|---|
|
class GlossaryTermsController < ApplicationController
|
||
|
|
||
|
before_action :find_term_from_id, only: [:show, :edit, :update, :destroy]
|
||
|
before_action :find_project_by_project_id, :authorize
|
||
|
|
||
|
before_action :find_project_by_project_id, :authorize, except: [:preview]
|
||
|
before_action :find_attachments, only: [:preview]
|
||
|
|
||
|
def index
|
||
|
@glossary_terms = GlossaryTerm.where(project_id: @project.id)
|
||
|
if not params[:index].nil?
|
||
| ... | ... | |
|
@term.destroy
|
||
|
redirect_to project_glossary_terms_path
|
||
|
end
|
||
|
|
||
|
def preview
|
||
|
term = GlossaryTerm.find_by_id(params[:id])
|
||
|
if term
|
||
|
@attachments += term.attachments
|
||
|
@previewed = term
|
||
|
end
|
||
|
@text = params[:glossary_term][:description]
|
||
|
render partial: 'common/preview'
|
||
|
end
|
||
|
|
||
|
# Find the term whose id is the :id parameter
|
||
|
def find_term_from_id
|
||
[phase-14]add wiki-style description and preview