Actualizado plugin Redmine Questions 1.0.0 light
This commit is contained in:
parent
27e60f8ec1
commit
5d7889f1c9
140 changed files with 5342 additions and 1430 deletions
|
@ -0,0 +1,107 @@
|
|||
# This file is a part of Redmine Q&A (redmine_questions) plugin,
|
||||
# Q&A plugin for Redmine
|
||||
#
|
||||
# Copyright (C) 2011-2018 RedmineUP
|
||||
# http://www.redmineup.com/
|
||||
#
|
||||
# redmine_questions is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# redmine_questions is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with redmine_questions. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
class QuestionsAnswersController < ApplicationController
|
||||
unloadable
|
||||
|
||||
before_action :find_question, :only => [:new, :create]
|
||||
before_action :find_answer, :only => [:update, :destroy, :edit, :show]
|
||||
|
||||
helper :questions
|
||||
helper :watchers
|
||||
helper :attachments
|
||||
|
||||
include QuestionsHelper
|
||||
|
||||
def new
|
||||
@answer = QuestionsAnswer.new(:question => @question_item)
|
||||
end
|
||||
|
||||
def edit
|
||||
end
|
||||
|
||||
def update
|
||||
@answer.safe_attributes = params[:answer]
|
||||
@answer.save_attachments(params[:attachments])
|
||||
if @answer.save
|
||||
flash[:notice] = l(:label_answer_successful_update)
|
||||
respond_to do |format|
|
||||
format.html { redirect_to_question }
|
||||
end
|
||||
else
|
||||
respond_to do |format|
|
||||
format.html { render :edit}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def create
|
||||
@answer = QuestionsAnswer.new
|
||||
@answer.author = User.current
|
||||
@answer.question = @question_item
|
||||
@answer.safe_attributes = params[:answer]
|
||||
@answer.save_attachments(params[:attachments])
|
||||
if @answer.save
|
||||
flash[:notice] = l(:label_answer_successful_added)
|
||||
render_attachment_warning_if_needed(@answer)
|
||||
end
|
||||
redirect_to_question
|
||||
end
|
||||
|
||||
def destroy
|
||||
if @answer.destroy
|
||||
flash[:notice] = l(:notice_successful_delete)
|
||||
respond_to do |format|
|
||||
format.html { redirect_to_question }
|
||||
format.api { render_api_ok }
|
||||
end
|
||||
else
|
||||
flash[:error] = l(:notice_unsuccessful_save)
|
||||
end
|
||||
end
|
||||
|
||||
def preview
|
||||
if params[:id].present? && answer = Question.find_by_id(params[:id])
|
||||
@previewed = answer
|
||||
end
|
||||
@text = (params[:answer] ? params[:answer][:content] : nil)
|
||||
render :partial => 'common/preview'
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def redirect_to_question
|
||||
redirect_to question_path(@answer.question, :anchor => "question_item_#{@answer.id}")
|
||||
end
|
||||
|
||||
def find_answer
|
||||
@answer = QuestionsAnswer.find(params[:id])
|
||||
@question_item = @answer.question
|
||||
@project = @question_item.project
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render_404
|
||||
end
|
||||
|
||||
def find_question
|
||||
@question_item = Question.visible.find(params[:question_id]) unless params[:question_id].blank?
|
||||
@project = @question_item.project
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render_404
|
||||
end
|
||||
end
|
|
@ -0,0 +1,78 @@
|
|||
# This file is a part of Redmine Q&A (redmine_questions) plugin,
|
||||
# Q&A plugin for Redmine
|
||||
#
|
||||
# Copyright (C) 2011-2018 RedmineUP
|
||||
# http://www.redmineup.com/
|
||||
#
|
||||
# redmine_questions is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# redmine_questions is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with redmine_questions. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
class QuestionsCommentsController < ApplicationController
|
||||
before_action :find_comment_source
|
||||
|
||||
helper :questions
|
||||
|
||||
def create
|
||||
raise Unauthorized unless @comment_source.commentable?
|
||||
|
||||
@comment = Comment.new
|
||||
@comment.safe_attributes = params[:comment]
|
||||
@comment.author = User.current
|
||||
if @comment_source.comments << @comment
|
||||
@comment_source.touch
|
||||
flash[:notice] = l(:label_comment_added) unless request.xhr?
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to_question }
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
@comment = @comment_source.comments.find(params[:id])
|
||||
end
|
||||
|
||||
def update
|
||||
@comment = @comment_source.comments.find(params[:id])
|
||||
@comment.safe_attributes = params[:comment]
|
||||
if @comment.save
|
||||
flash[:notice] = l(:notice_successful_update)
|
||||
redirect_to_question
|
||||
else
|
||||
render :action => 'edit'
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
@comment_source.comments.find(params[:id]).destroy
|
||||
redirect_to_question
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def find_comment_source
|
||||
comment_source_type = params[:source_type]
|
||||
comment_source_id = params[:source_id]
|
||||
|
||||
klass = Object.const_get(comment_source_type.camelcase)
|
||||
@comment_source = klass.find(comment_source_id)
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render_404
|
||||
end
|
||||
|
||||
def redirect_to_question
|
||||
question = @comment_source.is_a?(QuestionsAnswer) ? @comment_source.question : @comment_source
|
||||
redirect_to question_path(question, :anchor => @comment.blank? ? "#{@comment_source.class.name.underscore}_#{@comment_source.id}" : "comment_#{@comment.id}")
|
||||
end
|
||||
end
|
|
@ -1,76 +1,146 @@
|
|||
# This file is a part of Redmine Q&A (redmine_questions) plugin,
|
||||
# Q&A plugin for Redmine
|
||||
#
|
||||
# Copyright (C) 2011-2018 RedmineUP
|
||||
# http://www.redmineup.com/
|
||||
#
|
||||
# redmine_questions is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# redmine_questions is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with redmine_questions. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
class QuestionsController < ApplicationController
|
||||
unloadable
|
||||
|
||||
before_filter :find_optional_project, :only => [:autocomplete_for_topic, :topics]
|
||||
before_filter :find_optional_board, :only => [:autocomplete_for_topic, :topics]
|
||||
before_filter :find_topic, :authorize, :only => :vote
|
||||
before_filter :find_topics, :only => [:topics, :autocomplete_for_topic]
|
||||
before_action :find_question, :only => [:edit, :show, :update, :destroy]
|
||||
before_action :find_optional_project, :only => [:index, :update_form, :new, :create, :autocomplete_for_subject]
|
||||
before_action :find_section, :only => [:new, :create, :update, :edit]
|
||||
before_action :find_questions, :only => [:autocomplete_for_subject, :index] #:autocomplete_for_subject
|
||||
|
||||
helper :questions
|
||||
if Redmine::VERSION.to_s > '2.1'
|
||||
helper :boards
|
||||
end
|
||||
helper :watchers
|
||||
helper :attachments
|
||||
|
||||
include QuestionsHelper
|
||||
|
||||
def index
|
||||
@boards = Board.visible.includes(:last_message => :author).includes(:messages).order(:project_id)
|
||||
# show the board if there is only one
|
||||
if @boards.size == 1
|
||||
@board = @boards.first
|
||||
redirect_to project_board_url(@board, :project_id => @board.project)
|
||||
@question_item = Question.new
|
||||
end
|
||||
|
||||
def new
|
||||
@question_item = Question.new
|
||||
@question_item.section ||= @section
|
||||
end
|
||||
|
||||
def show
|
||||
@answers = @question_item.answers.by_accepted.by_votes.by_date
|
||||
if @answers
|
||||
@limit = Setting.issues_export_limit.to_i
|
||||
@answer_count = @answers.count
|
||||
@answer_pages = Paginator.new @answer_count, @limit, (params[:page] || 1)
|
||||
@offset ||= @answer_pages.offset
|
||||
end
|
||||
@answer = QuestionsAnswer.new
|
||||
@answer.question = @question_item
|
||||
@question_item.view request.remote_addr, User.current
|
||||
end
|
||||
|
||||
def update
|
||||
@question_item.safe_attributes = params[:question]
|
||||
@question_item.save_attachments(params[:attachments])
|
||||
if @question_item.save
|
||||
flash[:notice] = l(:label_question_successful_update)
|
||||
respond_to do |format|
|
||||
format.html {redirect_to :action => :show, :id => @question_item}
|
||||
end
|
||||
else
|
||||
render "boards/index"
|
||||
respond_to do |format|
|
||||
format.html { render :edit}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def topics
|
||||
def update_form
|
||||
@question_item = Question.new
|
||||
@question_item.safe_attributes = params[:question]
|
||||
end
|
||||
|
||||
def vote
|
||||
User.current.voted_for?(@topic) ? @topic.dislike(User.current.becomes(Principal)) : @topic.like(User.current.becomes(Principal))
|
||||
def create
|
||||
@question_item = Question.new
|
||||
@question_item.section = @section
|
||||
@question_item.safe_attributes = params[:question]
|
||||
@question_item.author = User.current
|
||||
@question_item.save_attachments(params[:attachments])
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to_referer_or {render :text => (watching ? 'Vote added.' : 'Vote removed.'), :layout => true}}
|
||||
if @question_item.save
|
||||
format.html { redirect_to :action => :show, :id => @question_item}
|
||||
else
|
||||
format.html { render :action => 'new' }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def autocomplete_for_topic
|
||||
def autocomplete_for_subject
|
||||
render :layout => false
|
||||
end
|
||||
|
||||
def convert_issue
|
||||
issue = Issue.visible.find(params[:issue_id])
|
||||
board = Board.visible.find(params[:board_id])
|
||||
message = Message.new
|
||||
message.author = issue.author
|
||||
message.created_on = issue.created_on
|
||||
message.board = board
|
||||
message.subject = issue.subject
|
||||
message.content = issue.description.blank? ? issue.subject : issue.description
|
||||
message.watchers = issue.watchers
|
||||
message.add_watcher(issue.author)
|
||||
message.attachments = issue.attachments
|
||||
issue.journals.select{|j| !j.notes.blank?}.each do |journal|
|
||||
reply = Message.new
|
||||
reply.author = journal.user
|
||||
reply.created_on = journal.created_on
|
||||
reply.subject = "Re: #{message.subject}"
|
||||
reply.content = journal.notes
|
||||
reply.board = board
|
||||
message.children << reply
|
||||
end
|
||||
if message.save
|
||||
issue.destroy if params[:destroy]
|
||||
redirect_to board_message_path(board, message)
|
||||
else
|
||||
redirect_back_or_default({:controller => 'issues', :action => 'show', :id => issue})
|
||||
end
|
||||
# def convert_issue_to_question
|
||||
# issue = Issue.visible.find(params[:issue_id])
|
||||
# question = Question.from_issue(issue)
|
||||
# if question.save
|
||||
# issue.destroy if params[:destroy]
|
||||
# redirect_to _question_path(question)
|
||||
# else
|
||||
# redirect_back_or_default({:controller => 'issues', :action => 'show', :id => issue})
|
||||
# end
|
||||
# end
|
||||
|
||||
# def convert_to_issue
|
||||
# issue = @question_item.to_issue
|
||||
# if issue.save
|
||||
# redirect_to issue_path(issue)
|
||||
# else
|
||||
# redirect_back_or_default question_path(@question_item)
|
||||
# end
|
||||
# end
|
||||
|
||||
def destroy
|
||||
back_id = @question_item.section
|
||||
if @question_item.destroy
|
||||
flash[:notice] = l(:notice_successful_delete)
|
||||
else
|
||||
flash[:error] = l(:notice_unsuccessful_save)
|
||||
end
|
||||
respond_to do |format|
|
||||
format.html { redirect_back_or_default questions_path(:section_id => back_id) }
|
||||
format.api { render_api_ok }
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def preview
|
||||
if params[:id].present? && query = Question.find_by_id(params[:question_id])
|
||||
@previewed = query
|
||||
end
|
||||
@text = (params[:question] ? params[:question][:content] : nil)
|
||||
render :partial => 'common/preview'
|
||||
end
|
||||
private
|
||||
|
||||
def find_topics
|
||||
def find_questions
|
||||
seach = params[:q] || params[:topic_search]
|
||||
@section = QuestionsSection.find(params[:section_id]) if params[:section_id]
|
||||
|
||||
scope = Question.visible
|
||||
scope = scope.where(:section_id => @section) if @section
|
||||
|
||||
columns = ["subject", "content"]
|
||||
tokens = seach.to_s.scan(%r{((\s|^)"[\s\w]+"(\s|$)|\S+)}).collect{|m| m.first.gsub(%r{(^\s*"\s*|\s*"\s*$)}, '')}.uniq.select {|w| w.length > 1 }
|
||||
|
@ -79,39 +149,49 @@ private
|
|||
sql = (['(' + token_clauses.join(' OR ') + ')'] * tokens.size).join(' AND ')
|
||||
find_options = [sql, * (tokens.collect {|w| "%#{w.downcase}%"} * token_clauses.size).sort]
|
||||
|
||||
scope = Message.joins(:board).where({})
|
||||
scope = scope.where("#{Message.table_name}.parent_id IS NULL")
|
||||
scope = scope.where(["#{Board.table_name}.project_id = ?", @project.id]) if @project
|
||||
scope = scope.where(["#{Message.table_name}.board_id = ?", @board.id]) if @board
|
||||
scope = scope.in_project(@project)
|
||||
scope = scope.where(find_options) unless tokens.blank?
|
||||
scope = scope.visible.includes(:board).order("#{Message.table_name}.updated_on DESC")
|
||||
@sort_order = params[:sort_order]
|
||||
case @sort_order
|
||||
when 'popular'
|
||||
scope = scope.by_views.by_update
|
||||
when 'newest'
|
||||
scope = scope.by_date
|
||||
when 'active'
|
||||
scope = scope.by_update
|
||||
when 'unanswered'
|
||||
scope = scope.questions.where(:answers_count => 0)
|
||||
else
|
||||
scope = scope.by_votes.by_views.by_update
|
||||
end
|
||||
|
||||
@topic_count = scope.count
|
||||
@limit = per_page_option
|
||||
@topic_pages = Paginator.new(self, @topic_count, @limit, params[:page])
|
||||
@offset = @topic_pages.current.offset
|
||||
@offset = params[:page].to_i*@limit
|
||||
scope = scope.limit(@limit).offset(@offset)
|
||||
scope = scope.tagged_with(params[:tag]) unless params[:tag].blank?
|
||||
@topics = scope
|
||||
|
||||
@topic_count = scope.count
|
||||
@topic_pages = Paginator.new @topic_count, @limit, params[:page]
|
||||
|
||||
@question_items = scope
|
||||
end
|
||||
|
||||
def find_topic
|
||||
@topic = Message.visible.find(params[:id]) unless params[:id].blank?
|
||||
@board = @topic.board
|
||||
@project = @board.project
|
||||
def find_section
|
||||
@section = QuestionsSection.find_by_id(params[:section_id] || (params[:question] && params[:question][:section_id]))
|
||||
@section ||= @project.questions_sections.first
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render_404
|
||||
end
|
||||
|
||||
def find_optional_board
|
||||
@board = Board.visible.find(params[:board_id]) unless params[:board_id].blank?
|
||||
@project = @board.project if @board
|
||||
allowed = User.current.allowed_to?({:controller => params[:controller], :action => params[:action]}, @project, :global => true)
|
||||
allowed ? true : deny_access
|
||||
def find_question
|
||||
if Redmine::VERSION.to_s =~ /^2.6/
|
||||
@question_item = Question.visible.find(params[:id], readonly: false)
|
||||
else
|
||||
@question_item = Question.visible.find(params[:id])
|
||||
end
|
||||
return deny_access unless @question_item.visible?
|
||||
@project = @question_item.project
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render_404
|
||||
end
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
|
|
@ -0,0 +1,106 @@
|
|||
# This file is a part of Redmine Q&A (redmine_questions) plugin,
|
||||
# Q&A plugin for Redmine
|
||||
#
|
||||
# Copyright (C) 2011-2018 RedmineUP
|
||||
# http://www.redmineup.com/
|
||||
#
|
||||
# redmine_questions is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# redmine_questions is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with redmine_questions. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
class QuestionsSectionsController < ApplicationController
|
||||
menu_item :questions
|
||||
|
||||
before_action :find_section, :only => [:edit, :update, :destroy]
|
||||
before_action :find_optional_project, :only => [:index, :new, :create]
|
||||
|
||||
helper :questions
|
||||
|
||||
def new
|
||||
@section = @project.questions_sections.build
|
||||
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def create
|
||||
@section = @project.nil? ? QuestionsSection.new : @project.questions_sections.build
|
||||
@section.safe_attributes = params[:questions_section]
|
||||
if @section.save
|
||||
respond_to do |format|
|
||||
format.html do
|
||||
flash[:notice] = l(:notice_successful_create)
|
||||
redirect_to_settings_in_projects
|
||||
end
|
||||
format.js
|
||||
end
|
||||
else
|
||||
respond_to do |format|
|
||||
format.html { render :action => 'new' }
|
||||
format.js
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
end
|
||||
|
||||
def update
|
||||
@section.safe_attributes = params[:questions_section]
|
||||
if @section.save
|
||||
respond_to do |format|
|
||||
format.html do
|
||||
flash[:notice] = l(:notice_successful_update)
|
||||
redirect_to_settings_in_projects
|
||||
end
|
||||
format.js { head 200 }
|
||||
end
|
||||
else
|
||||
respond_to do |format|
|
||||
format.html { render :action => 'edit' }
|
||||
format.js { head 422 }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
@section.destroy
|
||||
respond_to do |format|
|
||||
format.html { redirect_to_settings_in_projects }
|
||||
end
|
||||
end
|
||||
|
||||
def index
|
||||
ApplicationController.menu_item :questions
|
||||
@question_item = Question.new
|
||||
@sections = QuestionsSection.visible.order(:project_id).sorted.for_project(@project)
|
||||
redirect_to project_questions_path(:section_id => @sections.last, :project_id => @sections.last.project) if @sections.size == 1
|
||||
|
||||
@sections = @sections.with_questions_count
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def find_section
|
||||
@section = QuestionsSection.find(params[:id])
|
||||
@project = @section.project
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render_404
|
||||
end
|
||||
|
||||
def redirect_to_settings_in_projects
|
||||
redirect_back_or_default( @project ? settings_project_path(@project, :tab => 'questions') : plugin_settings_path(:id => "redmine_questions"))
|
||||
end
|
||||
|
||||
end
|
|
@ -0,0 +1,82 @@
|
|||
# This file is a part of Redmine Q&A (redmine_questions) plugin,
|
||||
# Q&A plugin for Redmine
|
||||
#
|
||||
# Copyright (C) 2011-2018 RedmineUP
|
||||
# http://www.redmineup.com/
|
||||
#
|
||||
# redmine_questions is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# redmine_questions is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with redmine_questions. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
class QuestionsStatusesController < ApplicationController
|
||||
unloadable
|
||||
layout 'admin'
|
||||
|
||||
before_action :require_admin, :except => :index
|
||||
before_action :require_admin_or_api_request, :only => :index
|
||||
|
||||
accept_api_auth :index
|
||||
|
||||
def index
|
||||
respond_to do |format|
|
||||
format.api {
|
||||
@questions_statuses = QuestionsStatus.sorted
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
def new
|
||||
@questions_status = QuestionsStatus.new
|
||||
end
|
||||
|
||||
def create
|
||||
@questions_status = QuestionsStatus.new(params[:questions_status])
|
||||
if request.post? && @questions_status.save
|
||||
flash[:notice] = l(:notice_successful_create)
|
||||
redirect_to :action => "plugin", :id => "redmine_questions", :controller => "settings", :tab => 'questions_statuses'
|
||||
else
|
||||
render :action => 'new'
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
@questions_status = QuestionsStatus.find(params[:id])
|
||||
end
|
||||
|
||||
def update
|
||||
@questions_status = QuestionsStatus.find(params[:id])
|
||||
if @questions_status.update_attributes(params[:questions_status])
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
flash[:notice] = l(:notice_successful_update)
|
||||
redirect_to :action => 'plugin', :id => 'redmine_questions', :controller => 'settings', :tab => 'questions_statuses'
|
||||
}
|
||||
format.js { head 200 }
|
||||
end
|
||||
else
|
||||
respond_to do |format|
|
||||
format.html { render :action => 'edit' }
|
||||
format.js { head 422 }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
QuestionsStatus.find(params[:id]).destroy
|
||||
redirect_to :action =>"plugin", :id => "redmine_questions", :controller => "settings", :tab => 'questions_statuses'
|
||||
rescue
|
||||
flash[:error] = l(:error_products_unable_delete_questions_status)
|
||||
redirect_to :action =>"plugin", :id => "redmine_questions", :controller => "settings", :tab => 'questions_statuses'
|
||||
end
|
||||
|
||||
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue