リビジョン 04643542
| app/controllers/glossary_controller.rb | ||
|---|---|---|
|
|
||
|
class GlossaryController < ApplicationController
|
||
|
menu_item :glossary
|
||
|
unloadable
|
||
|
|
||
|
layout 'base'
|
||
| ... | ... | |
|
|
||
|
def index_clear
|
||
|
params[:search_index_ch] = nil
|
||
|
redirect_to :controller => 'glossary', :action => 'index', :id => @project
|
||
|
redirect_to :controller => 'glossary', :action => 'index', :project_id => @project
|
||
|
end
|
||
|
|
||
|
|
||
| ... | ... | |
|
attach_files(@term, params[:attachments])
|
||
|
flash[:notice] = l(:notice_successful_create)
|
||
|
if (params[:continue])
|
||
|
redirect_to :controller => 'glossary', :action => 'new', :id => @project
|
||
|
redirect_to :controller => 'glossary', :action => 'new', :project_id => @project
|
||
|
else
|
||
|
redirect_to :controller => 'glossary', :action => 'show', :id => @project,
|
||
|
:term_id => @term
|
||
|
redirect_to :controller => 'glossary', :action => 'show', :project_id => @project,
|
||
|
:id => @term
|
||
|
end
|
||
|
end
|
||
|
end
|
||
| ... | ... | |
|
if @term.save
|
||
|
attach_files(@term, params[:attachments])
|
||
|
flash[:notice] = l(:notice_successful_update)
|
||
|
redirect_to :controller => 'glossary', :action => 'show', :id => @project, :term_id => @term
|
||
|
redirect_to(:controller => 'glossary', :action => 'show',
|
||
|
:project_id => @project, :id => @term.id)
|
||
|
return
|
||
|
end
|
||
|
end
|
||
| ... | ... | |
|
|
||
|
def destroy
|
||
|
@term.destroy
|
||
|
redirect_to :action => 'index', :id => @project
|
||
|
redirect_to :action => 'index', :project_id => @project
|
||
|
end
|
||
|
|
||
|
def add_term_category
|
||
| ... | ... | |
|
respond_to do |format|
|
||
|
format.html do
|
||
|
flash[:notice] = l(:notice_successful_create)
|
||
|
redirect_to :controller => 'term_categories', :action => 'index', :id => @project
|
||
|
redirect_to :controller => 'term_categories', :action => 'index', :project_id => @project
|
||
|
end
|
||
|
format.js do
|
||
|
term_categories = TermCategory.find(:all, :conditions => "project_id = #{@project.id}")
|
||
| ... | ... | |
|
}
|
||
|
Term::update_all("project_id = #{newproj.id}", "project_id = #{@project.id}")
|
||
|
flash[:notice] = l(:notice_successful_update)
|
||
|
redirect_to({:action => 'index', :id => newproj})
|
||
|
redirect_to({:action => 'index', :project_id => newproj})
|
||
|
end
|
||
|
end
|
||
|
|
||
| ... | ... | |
|
return unless (ch and !ch.empty?)
|
||
|
charset = get_search_index_charset(ch, type)
|
||
|
searchprms = [:name, :abbr_whole, :rubi]
|
||
|
searchprms << [:name_en] if (type)
|
||
|
searchprms << :name_en if (type)
|
||
|
cnt = 0
|
||
|
charset.each {|tch|
|
||
|
symbols["search_ch_#{cnt}".to_sym] = tch + '%'
|
||
| ... | ... | |
|
|
||
|
|
||
|
def find_project
|
||
|
@project = Project.find(params[:id])
|
||
|
project_id = params[:project_id] || (params[:issue] && params[:issue][:project_id])
|
||
|
@project = Project.find(project_id)
|
||
|
rescue ActiveRecord::RecordNotFoundpp
|
||
|
render_404
|
||
|
end
|
||
|
|
||
|
def find_term
|
||
|
@term = Term.find(:first,
|
||
|
:conditions => "project_id = #{@project.id} and id = #{params[:term_id]}")
|
||
|
:conditions => "project_id = #{@project.id} and id = #{params[:id]}")
|
||
|
render_404 unless @term
|
||
|
rescue
|
||
|
render_404
|
||
compatible to Redmine1.4 and add Frech language (merge from Martin's github)