Import archive redmine_questions-1_0_3-light

This commit is contained in:
Alexandr Antonov 2022-04-20 13:05:34 +03:00
commit fa7793f5ba
132 changed files with 6782 additions and 0 deletions

34
.drone.jsonnet Normal file
View File

@ -0,0 +1,34 @@
local Pipeline(rubyVer, db, license, redmine, dependents) = {
kind: "pipeline",
name: rubyVer + "-" + db + "-" + redmine + "-" + license + "-" + dependents,
steps: [
{
name: "tests",
image: "redmineup/redmineup_ci",
commands: [
"service postgresql start && service mysql start && sleep 5",
"export PATH=~/.rbenv/shims:$PATH",
"export CODEPATH=`pwd`",
"/root/run_for.sh redmine_questions+" + license + " ruby-" + rubyVer + " " + db + " redmine-" + redmine + " " + dependents
]
}
]
};
[
Pipeline("2.7.3", "mysql", "pro", "trunk", ""),
Pipeline("2.7.3", "mysql", "light", "trunk", ""),
Pipeline("2.7.3", "pg", "pro", "trunk", ""),
Pipeline("2.4.1", "mysql", "pro", "4.1", ""),
Pipeline("2.4.1", "mysql", "light", "4.1", ""),
Pipeline("2.4.1", "pg", "pro", "4.1", ""),
Pipeline("2.4.1", "mysql", "pro", "4.0", ""),
Pipeline("2.4.1", "mysql", "light", "4.0", ""),
Pipeline("2.4.1", "pg", "pro", "4.0", ""),
Pipeline("2.4.1", "pg", "light", "4.0", ""),
Pipeline("2.2.6", "mysql", "pro", "3.4", ""),
Pipeline("2.2.6", "pg", "pro", "3.4", ""),
Pipeline("2.2.6", "mysql", "pro", "3.0", ""),
Pipeline("2.2.6", "mysql", "light", "3.0", ""),
Pipeline("1.9.3", "pg", "pro", "2.6", ""),
]

1
Gemfile Normal file
View File

@ -0,0 +1 @@
gem "redmine_crm"

3
README.rdoc Normal file
View File

@ -0,0 +1,3 @@
= redmine_qa
Description goes here

View File

@ -0,0 +1,109 @@
# This file is a part of Redmine Q&A (redmine_questions) plugin,
# Q&A plugin for Redmine
#
# Copyright (C) 2011-2022 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
(render_403; return false) unless @answer.editable_by?(User.current)
end
def update
(render_403; return false) unless @answer.editable_by?(User.current) || User.current.allowed_to?(:accept_answers, @project)
@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 => "questions_answer_#{@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

View File

@ -0,0 +1,78 @@
# This file is a part of Redmine Q&A (redmine_questions) plugin,
# Q&A plugin for Redmine
#
# Copyright (C) 2011-2022 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

View File

@ -0,0 +1,199 @@
# This file is a part of Redmine Q&A (redmine_questions) plugin,
# Q&A plugin for Redmine
#
# Copyright (C) 2011-2022 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_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
helper :watchers
helper :attachments
include QuestionsHelper
def index
@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
(render_403; return false) unless @question_item.editable_by?(User.current)
@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
respond_to do |format|
format.html { render :edit}
end
end
end
def update_form
@question_item = Question.new
@question_item.safe_attributes = params[:question]
end
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|
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_subject
render :layout => false
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
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_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 }
tokens = [] << tokens unless tokens.is_a?(Array)
token_clauses = columns.collect { |column| "(LOWER(#{column}) LIKE ?)" }
sql = (['(' + token_clauses.join(' OR ') + ')'] * tokens.size).join(' AND ')
find_options = [sql, * (tokens.collect {|w| "%#{w.downcase}%"} * token_clauses.size).sort]
scope = scope.in_project(@project)
scope = scope.where(find_options) unless tokens.blank?
@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
@limit = per_page_option
@offset = params[:page].to_i * @limit
scope = scope.limit(@limit).offset(@offset)
scope = scope.tagged_with(params[:tag]) if params[:tag].present?
@topic_count = scope.count
@topic_pages = Paginator.new @topic_count, @limit, params[:page]
@question_items = scope
end
def find_section
@section = QuestionsSection.find_by_id(params[:section_id] || (params[:question] && params[:question][:section_id]))
@section ||= @project.questions_sections.first if @project
rescue ActiveRecord::RecordNotFound
render_404
end
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

View File

@ -0,0 +1,107 @@
# This file is a part of Redmine Q&A (redmine_questions) plugin,
# Q&A plugin for Redmine
#
# Copyright (C) 2011-2022 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]
@section.insert_at(@section.position) if @section.position_changed?
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

View File

@ -0,0 +1,82 @@
# This file is a part of Redmine Q&A (redmine_questions) plugin,
# Q&A plugin for Redmine
#
# Copyright (C) 2011-2022 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
@questions_status.safe_attributes = 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])
@questions_status.safe_attributes = params[:questions_status]
if @questions_status.save
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

View File

@ -0,0 +1,51 @@
# encoding: utf-8
#
# This file is a part of Redmine Q&A (redmine_questions) plugin,
# Q&A plugin for Redmine
#
# Copyright (C) 2011-2022 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/>.
module QuestionsHelper
def question_status_tag(status)
return '' unless status
content_tag(:span, status.name, :class => 'question-status-tag tag-label-color', :style => "background-color: #{status.color}")
end
def allow_voting?(votable, user = User.current)
(votable.author == user && QuestionsSettings.vote_own? || votable.author != user) &&
user.allowed_to?(:vote_questions, votable.project)
end
def question_breadcrumb(item)
links = []
links << link_to(l(:label_questions), { :controller => 'questions_sections', :action => 'index', :project_id => nil})
links << link_to(item.project.name, { :controller => 'questions_sections', :action => 'index', :project_id => item.project }) if item && item.project
links << link_to(item.section.name, { :controller => 'questions', :action => 'index', :project_id => item.project, :section_id => item.section }) if item && item.is_a?(Question) && item.section.present?
breadcrumb links
end
def global_modificator
return {:global => true} if !@project
{}
end
def path_to_sections
return project_questions_sections_path if @project
questions_sections_path
end
end

290
app/models/question.rb Normal file
View File

@ -0,0 +1,290 @@
# This file is a part of Redmine Q&A (redmine_questions) plugin,
# Q&A plugin for Redmine
#
# Copyright (C) 2011-2022 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 Question < ActiveRecord::Base
unloadable
include Redmine::SafeAttributes
extend ApplicationHelper
belongs_to :author, :class_name => 'User', :foreign_key => 'author_id'
belongs_to :section, :class_name => 'QuestionsSection', :foreign_key => 'section_id'
belongs_to :status, :class_name => 'QuestionsStatus', :foreign_key => 'status_id'
delegate :section_type, :to => :section, :allow_nil => true
has_many :answers, :class_name => 'QuestionsAnswer', :dependent => :destroy
if ActiveRecord::VERSION::MAJOR >= 4
has_many :comments, lambda { order('created_on') }, :as => :commented, :dependent => :delete_all
else
has_many :comments, :as => :commented, :dependent => :delete_all, :order => "created_on"
end
rcrm_acts_as_viewed
acts_as_attachable_questions
acts_as_watchable
acts_as_event :datetime => :created_on,
:url => Proc.new {|o| {:controller => 'questions', :action => 'show', :id => o }},
:type => Proc.new {|o| 'icon ' + (o.is_solution? ? 'icon-solution': 'icon-question')},
:description => :content,
:title => Proc.new {|o| o.subject }
if ActiveRecord::VERSION::MAJOR >= 4
acts_as_activity_provider :type => 'questions',
:permission => :view_questions,
:author_key => :author_id,
:timestamp => "#{table_name}.created_on",
:scope => joins({:section => :project}, :author)
acts_as_searchable :columns => ["#{table_name}.subject",
"#{table_name}.content",
"#{QuestionsAnswer.table_name}.content"],
:scope => joins({:section => :project}, :answers),
:project_key => "#{QuestionsSection.table_name}.project_id"
else
acts_as_activity_provider :type => 'questions',
:permission => :view_questions,
:author_key => :author_id,
:timestamp => "#{table_name}.created_on",
:find_options => { :include => [{:section => :project}, :author] }
acts_as_searchable :columns => ["#{table_name}.subject",
"#{table_name}.content",
"#{QuestionsAnswer.table_name}.content"],
:include => [{:section => :project}, :answers],
:project_key => "#{QuestionsSection.table_name}.project_id"
end
scope :solutions, lambda { joins(:section).where(:questions_sections => {:section_type => QuestionsSection::SECTION_TYPE_SOLUTIONS}) }
scope :questions, lambda { joins(:section).where(:questions_sections => {:section_type => QuestionsSection::SECTION_TYPE_QUESTIONS}) }
scope :by_votes, lambda { order("#{Question.table_name}.cached_weighted_score DESC") }
scope :by_date, lambda { order("#{Question.table_name}.created_on DESC") }
scope :by_update, lambda { order("#{Question.table_name}.updated_on DESC") }
scope :by_views, lambda { order("#{Question.table_name}.views DESC") }
scope :positive, lambda { where("#{Question.table_name}.cached_weighted_score > 0") }
scope :featured, lambda {|*args| where(:featured => true) }
scope :in_section, lambda { |section|
where(:section_id => section) if section.present?
}
scope :in_project, lambda { |project|
joins(:section => :project).where("#{QuestionsSection.table_name}.project_id = ?", project) if project.present?
}
scope :visible, lambda { |*args|
joins(:section => :project)
.where(Project.allowed_to_condition(args.shift || User.current, :view_questions, *args))
}
validates_presence_of :author, :content, :subject, :section
after_create :add_author_as_watcher
after_create :send_notification
safe_attributes 'author',
'subject',
'content',
'tag_list',
'section_id',
'status_id'
safe_attributes 'status_id',
:if => lambda {|question, user| question.is_idea?}
def self.visible_condition(user)
user.reload if user
global_questions_allowed = user.allowed_to?(:view_questions, nil)
projects_allowed_to_view_questions = Project.where(Project.allowed_to_condition(user, :view_questions)).pluck(:id)
allowed_to_view_condition = global_questions_allowed ? "(#{table_name}.project_id IS NULL)" : '(0=1)'
allowed_to_view_condition += projects_allowed_to_view_questions.empty? ? ' OR (0=1) ' : " OR (#{table_name}.project_id IN (#{projects_allowed_to_view_questions.join(',')}))"
user.admin? ? '(1=1)' : allowed_to_view_condition
end
def self.related(question, limit)
tokens = question.subject.strip.scan(%r{((\s|^)"[\s\w]+"(\s|$)|\S+)}).
collect {|m| m.first.gsub(%r{(^\s*"\s*|\s*"\s*$)}, '').gsub(%r{('|"|`)}, '')}.select{|m| m.size > 3} || ""
related_questions = where(tokens.map{ |t| "LOWER(subject) LIKE LOWER('%#{t}%')" }.join(' OR '))
related_questions = related_questions.in_project(question.project)
related_questions = related_questions.where("#{Question.table_name}.id != ?", question.id)
related_questions.limit(limit).to_a.compact
end
def commentable?(user = User.current)
return false if locked?
user.allowed_to?(:comment_question, project)
end
def visible?(user=User.current)
user.allowed_to?(:view_questions, project)
end
def to_param
"#{id}-#{ActiveSupport::Inflector.transliterate(subject || " ").parameterize}"
end
def section_name
section.try(:name)
end
def project
section.project
end
def allow_voting?
false
end
def allow_liking?
section.allow_liking?
end
def allow_answering?
!locked? && section.allow_answering?
end
def last_reply
answers.order('created_on DESC').last
end
def last_comment
Comment.where(:commented_type => self.class.name, :commented_id => [id] + answer_ids).order('created_on DESC').last
end
def replies_count
answers.count
end
def editable_by?(user)
(author == user && user.allowed_to?(:edit_own_questions, project)) ||
user.allowed_to?(:edit_questions, project)
end
def destroyable_by?(user)
user.allowed_to?(:delete_questions, project)
end
def votable_by?(user)
user.allowed_to?(:vote_questions, project)
end
def convertable_by?(user)
return false if project.blank?
user.allowed_to?(:convert_questions, project)
end
def answered?
answers.where(:accepted => true).any?
end
def is_question?
section && section.is_questions?
end
def is_solution?
section && section.is_solutions?
end
def is_idea?
section && section.is_ideas?
end
# def to_issue
# issue = Issue.new
# issue.author = self.author
# issue.created_on = self.created_on
# issue.subject = self.subject
# issue.description = self.content
# issue.watchers = self.watchers
# issue.attachments = self.attachments
# issue.project = self.project
# issue.tracker = self.project.trackers.first
# issue.status = IssueStatus.first
# self.answers.each do |ans|
# journal = Journal.new(:notes => ans.content, :user => ans.author)
# issue.journals << journal
# end
# issue
# end
# def self.from_issue(issue)
# question = Question.new
# question.author = issue.author
# question.created_on = issue.created_on
# question.subject = issue.subject
# question.content = issue.description.blank? ? issue.subject : issue.description
# question.watchers = issue.watchers
# question.attachments = issue.attachments
# question.project = issue.project
# question.section = issue.project.questions_sections.first
# issue.journals.select{|j| j.notes.present?}.each do |journal|
# reply = Question.new
# reply.author = journal.user
# reply.created_on = journal.created_on
# reply.content = journal.notes
# reply.project = issue.project
# reply.question = question
# question.answers << reply
# end
# question
# end
def notified_users
project.notified_users.select { |user| visible?(user) }.collect(&:mail)
end
def self.to_text(input)
textile_glyphs = {
'&#8217;' => "'",
'&#8216' => "'",
'&lt;' => '<',
'&gt;' => '>',
'&#8221;' => "'",
'&#8220;' => '"',
'&#8230;' => '...',
'\1&#8212;' => '--',
' &rarr; ' => '->',
'&para;' => ' ',
' &#8211; ' => '-',
'&#215;' => '-',
'&#8482;' => '(TM)',
'&#174;' => '(R)',
'&#169;' => '(C)',
'&amp;' => '&'
}.freeze
html_regexp = /<(?:[^>"']+|"(?:\\.|[^\\"]+)*"|'(?:\\.|[^\\']+)*')*>/xm
input.dup.gsub(html_regexp, '').tap do |h|
textile_glyphs.each do |entity, char|
h.gsub!(entity, char)
end
end
end
private
def add_author_as_watcher
Watcher.create(:watchable => self, :user => author)
end
def send_notification
Mailer.question_question_added(User.current, self).deliver if Setting.notified_events.include?('question_added')
end
end

View File

@ -0,0 +1,127 @@
# This file is a part of Redmine Q&A (redmine_questions) plugin,
# Q&A plugin for Redmine
#
# Copyright (C) 2011-2022 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 QuestionsAnswer < ActiveRecord::Base
unloadable
include Redmine::SafeAttributes
extend ApplicationHelper
belongs_to :author, :class_name => 'User', :foreign_key => 'author_id'
belongs_to :question, :counter_cache => 'answers_count', :touch => true
attr_protected :id if ActiveRecord::VERSION::MAJOR <= 4
acts_as_attachable_questions
acts_as_event :datetime => :created_on,
:url => Proc.new {|o| {:controller => 'questions', :action => 'show', :id => o.question, :anchor => "questions_answer_#{o.id}" }},
:group => :question,
:type => Proc.new {|o| 'icon icon-reply'},
:description => :content,
:title => Proc.new {|o| o.question.subject }
if ActiveRecord::VERSION::MAJOR >= 4
acts_as_activity_provider :type => 'questions',
:permission => :view_questions,
:author_key => :author_id,
:timestamp => "#{table_name}.created_on",
:scope => joins({ :question => { :section => :project } }, :author)
else
acts_as_activity_provider :type => 'questions',
:permission => :view_questions,
:author_key => :author_id,
:timestamp => "#{table_name}.created_on",
:find_options => { :joins => [{ :question => { :section => :project } }, :author] }
end
scope :visible, lambda {|*args| where(Question.visible_condition(args.shift || User.current)) }
scope :by_votes, lambda { order("#{table_name}.cached_weighted_score DESC") }
scope :by_accepted, lambda { order("#{table_name}.accepted DESC") }
scope :by_date, lambda { order("#{table_name}.created_on DESC") }
scope :featured, lambda {|*args| where(:featured => true) }
validates_presence_of :question, :author, :content
validate :cannot_answer_to_locked_question, :on => :create
after_create :add_author_as_watcher
after_create :send_notification
safe_attributes 'author',
'content'
def commentable?(user = User.current)
return false if question.locked?
user.allowed_to?(:comment_question, project)
end
def cannot_answer_to_locked_question
# Can not reply to a locked topic
errors.add :base, 'Question is locked' if question && question.locked?
end
def section_name
question.try(:section).try(:name)
end
def project
question.project if question
end
def allow_voting?
question && question.section && question.section.allow_voting?
end
def last_comment
Comment.where(:commented_type => self.class.name, :commented_id => [id] + answer_ids).order('created_on DESC').last
end
def replies_count
answers.count
end
def editable_by?(user)
(author == user && user.allowed_to?(:edit_own_answers, project)) ||
user.allowed_to?(:edit_questions, project)
end
def destroyable_by?(user)
user.allowed_to?(:delete_answers, project)
end
def votable_by?(user)
user.allowed_to?(:vote_questions, project)
end
private
def check_accepted
question.answers.update_all(:accepted => false) if question &&
accepted? &&
accepted_changed?
end
# </PRO>
def add_author_as_watcher
Watcher.create(:watchable => question, :user => author)
end
def send_notification
Mailer.question_answer_added(User.current, self).deliver if Setting.notified_events.include?('question_answer_added')
end
end

View File

@ -0,0 +1,97 @@
# This file is a part of Redmine Q&A (redmine_questions) plugin,
# Q&A plugin for Redmine
#
# Copyright (C) 2011-2022 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 QuestionsSection < ActiveRecord::Base
unloadable
include Redmine::SafeAttributes
belongs_to :project
has_many :questions, :foreign_key => "section_id", :dependent => :destroy
attr_protected :id if ActiveRecord::VERSION::MAJOR <= 4
safe_attributes 'name', 'project', 'position', 'description', 'section_type'
scope :with_questions_count, lambda {
select("#{QuestionsSection.table_name}.*, count(#{QuestionsSection.table_name}.id) as questions_count").
joins(:questions).
order("project_id ASC").
group(QuestionsSection.column_names.map { |column| "#{QuestionsSection.table_name}.#{column}" }.join(', '))
}
scope :for_project, lambda { |project| where(:project_id => project) unless project.blank? }
scope :visible, lambda {|*args|
joins(:project).
where(Project.allowed_to_condition(args.shift || User.current, :view_questions, *args))
}
scope :sorted, lambda { order(:position) }
rcrm_acts_as_list :scope => 'project_id = #{project_id}'
acts_as_watchable
SECTION_TYPE_QUESTIONS = 'questions'
validates_presence_of :section_type, :project_id, :name
validates_uniqueness_of :name, :scope => :project_id
def initialize(attributes=nil, *args)
super
if new_record?
# set default values for new records only
self.section_type ||= SECTION_TYPE_QUESTIONS
end
end
def to_param
"#{id}-#{ActiveSupport::Inflector.transliterate(name).parameterize}"
end
def is_questions?
true
end
def is_solutions?
false
end
def is_ideas?
false
end
def allow_voting?
false
end
def allow_liking?
false
end
def allow_answering?
is_questions?
end
def self.types_list
end
def l_type
I18n.t("label_questions_section_type_#{section_type}") if section_type
end
def to_s
name
end
end

View File

@ -0,0 +1,47 @@
# This file is a part of Redmine Q&A (redmine_questions) plugin,
# Q&A plugin for Redmine
#
# Copyright (C) 2011-2022 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 QuestionsSettings
unloadable
IDEA_COLORS = {
:green => 'green',
:blue => 'blue',
:turquoise => 'turquoise',
:light_green => 'lightgreen',
:yellow => 'yellow',
:orange => 'orange',
:red => 'red',
:purple => 'purple',
:gray => 'gray'
}
class << self
def vote_own?
false
end
def show_popular?
false
end
end
end

View File

@ -0,0 +1,38 @@
# This file is a part of Redmine Q&A (redmine_questions) plugin,
# Q&A plugin for Redmine
#
# Copyright (C) 2011-2022 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 QuestionsStatus < ActiveRecord::Base
unloadable
include Redmine::SafeAttributes
belongs_to :question
attr_protected :id if ActiveRecord::VERSION::MAJOR <= 4
safe_attributes 'name', 'is_closed', 'position', 'color'
validates :name, presence: true, uniqueness: true
scope :sorted, lambda { order(:position) }
rcrm_acts_as_list
def to_s
name
end
end

View File

@ -0,0 +1,6 @@
<%= raw @questions_tags.map { |question_tag| {
'id' => @names_only ? question_tag.name : question_tag.id,
'text' => question_tag.name
}
}.to_json
%>

View File

@ -0,0 +1,5 @@
<h1><%= @question.section_name %>: <%= link_to(@question.subject, @question_url) %></h1>
<p><%= l(:text_user_wrote, :value => h(@answer.author)) %></p>
<%= textilizable @answer, :content, :only_path => false %>

View File

@ -0,0 +1,6 @@
<%= @question.section_name %>: <%= @question.subject %>
<%= @question_url %>
<%= l(:text_user_wrote, :value => @answer.author) %>
<%= @answer.content %>

View File

@ -0,0 +1,5 @@
<h1><%= @question.section_name %>: <%= link_to(@question.subject, @question_url) %></h1>
<p><%= l(:text_user_wrote, :value => h(@comment.author)) %></p>
<%= textilizable @comment, :comments, :only_path => false %>

View File

@ -0,0 +1,6 @@
<%= @question.section_name %>: <%= @question.subject %>
<%= @question_url %>
<%= l(:text_user_wrote, :value => @comment.author) %>
<%= @comment.comments %>

View File

@ -0,0 +1,5 @@
<h1><%= @question.section_name %>: <%= link_to(@question.subject, @question_url) %></h1>
<p><%= l(:text_user_wrote, :value => h(@question.author)) %></p>
<%= textilizable @question, :content, :only_path => false %>

View File

@ -0,0 +1,6 @@
<%= @question.section_name %>: <%= @question.subject %>
<%= @question_url %>
<%= l(:text_user_wrote, :value => @question.author) %>
<%= @question.content %>

View File

@ -0,0 +1,43 @@
<% @project_sections = QuestionsSection.for_project(@project).sorted %>
<h3><%= l(:label_questions_sections_plural) %></h3>
<% if @project_sections.any? %>
<table class="list questions_sections">
<thead>
<tr>
<th><%= l(:field_name) %></th>
<th><%=l(:field_type)%></th>
<th></th>
</tr>
</thead>
<tbody>
<% @project_sections.each do |section| %>
<tr class="<%= cycle 'odd', 'even' %>">
<td class="name">
<%= h(section.name) %>
</td>
<td>
<%= section.l_type %>
</td>
<td class="buttons">
<% if User.current.allowed_to?(:manage_sections, @project) %>
<%= reorder_handle(section, url: project_questions_section_path(@project, section), param: 'questions_section') if respond_to?(:reorder_handle) %>
<%= link_to l(:button_edit), edit_questions_section_path(section, project_id: @project), class: 'icon icon-edit' %>
<%= delete_link questions_section_path(section, project_id: @project) %>
<% end %>
</td>
</tr>
<% end %>
</tbody>
</table>
<% else %>
<p class="nodata"><%= l(:label_no_data) %></p>
<% end %>
<% if User.current.allowed_to?(:manage_sections, @project) %>
<%= link_to image_tag('add.png', style: 'vertical-align: middle;') + l(:label_questions_section_new), new_questions_section_path(project_id: @project) %>
<% end %>
<%= javascript_tag do %>
$(function() { $("table.questions_sections tbody").positionedItems(); });
<% end if respond_to?(:reorder_handle) %>

View File

@ -0,0 +1,43 @@
<%= error_messages_for @question_item %>
<%= fields_for :question, @question_item do |f| %>
<div class="box">
<!--[form:message]-->
<p><label for="message_subject"><%= l(:field_subject) %></label><br />
<%= f.text_field :subject, :id => "question_subject", :size => 120%>
</p>
<p><label><%= l(:label_questions_section) %></label><br />
<%= f.select :section_id, options_from_collection_for_select(QuestionsSection.where(:project_id => @project).sorted, :id, :name, f.object.section_id), :style => "width: 80%;", :required => true %>
<%= javascript_tag do %>
$('#question_section_id').change(function() {
$.ajax({
url: '<%= escape_javascript update_form_questions_path(:id => @question_item, :format => 'js', :project_id => @project) %>',
type: 'put',
data: $('#question_form').serialize()
});
});
<% end %>
<%= link_to(image_tag('add.png', :style => 'vertical-align: middle;'),
(@project ? new_project_questions_section_url(:project_id => @project) : new_questions_section_url ),
:remote => true,
:method => 'get',
:title => l(:label_questions_section_new),
:class => "add_section",
:tabindex => 200) if User.current.allowed_to?(:manage_sections, @project) %>
</p>
<% if @question_item.is_idea? %>
<p><label><%= l(:field_status) %></label><br />
<%= f.select :status_id, options_from_collection_for_select(QuestionsStatus.sorted,:id, :name, @question_item.status_id ), :include_blank => true %>
</p>
<% end %>
<p>
<%= f.text_area :content, :cols => 80, :rows => 15, :class => 'wiki-edit', :id => 'question_content', :label => l(:label_questions_message) %>
</p>
<%= wikitoolbar_for 'question_content' %>
<!--[eoform:question]-->
<p>
<%= l(:label_attachment_plural) %><br />
<%= render :partial => 'attachments/form', :locals => {:container => @question_item} %>
</p>
</div>
<% end %>

View File

@ -0,0 +1,8 @@
<h3><%= l(:label_questions_latest_messages) %></h3>
<ul class="related-topics">
<% Question.visible.by_date.in_project(@project).limit(5).each do |question| %>
<li class="related-topic">
<%= link_to h(question.subject), { :controller => 'questions', :action => 'show', :id => question, :project_id => @project } %>
</li>
<% end %>
</ul>

View File

@ -0,0 +1,18 @@
<%
@popular_topics = Question.
visible.
in_project(@project).
in_section(@section).
positive.
by_views.
by_votes.
limit(5)
%>
<h3><%= l(:label_questions_most_popular) %></h3>
<ul class="related-topics">
<% @popular_topics.each do |question| %>
<li class="related-topic">
<%= link_to h(question.subject), { :controller => 'questions', :action => 'show', :section_id => question.section, :id => question } %>
</li>
<% end unless @popular_topics.blank? %>
</ul>

View File

@ -0,0 +1,65 @@
<div class="contextual">
<%= content_tag('span', watcher_link(@question_item, User.current), :id => 'watcher') %>
<%= link_to(l(:button_edit), edit_question_path(@question_item), :class => 'icon icon-edit' ) if @question_item.editable_by?(User.current)
%>
<%= link_to(l(:button_delete), question_path(@question_item), :method => :delete, :data => {:confirm => l(:text_are_you_sure)}, :class => 'icon icon-del') if @question_item.destroyable_by?(User.current)
%>
</div>
<h1 class="question-title"><%=h @question_item.subject %></h1>
<%= render :partial => 'question_item', :object => @question_item %>
<% if @question_item.section.allow_answering? %>
<div id="answers">
<% if @answers.any? %>
<h3><%= l(:label_questions_answer_plural) %> (<%= @answer_count %>)</h3>
<% @answers.each do |answer| %>
<%= render :partial => 'questions_answers/answer_item', :locals => { :question_item => answer } %>
<% end %>
<span class="pagination"><%= pagination_links_full @answer_pages, @answer_count %></span>
<% end %>
<% if @question_item.allow_answering? && User.current.allowed_to?(:add_answers, @project) %>
<h3><%= l(:label_questions_your_answer) %></h3>
<div id="reply" >
<%= form_for @answer, :as => :answer, :url => question_answers_path(@question_item), :html => {:multipart => true, :id => 'answer-form'} do |f| %>
<%= render :partial => 'questions_answers/form', :locals => {:f => f, :replying => true} %>
<%= submit_tag l(:button_submit) %>
<% end %>
<div id="preview" class="wiki"></div>
</div>
<% end %>
</div>
<% end %>
<% content_for :sidebar do %>
<h3><%= l(:label_questions_message) %></h3>
<ul class="question-meta">
<li class="views icon icon-view">
<%= l(:label_questions_views, :count => @question_item.views ) %>
</li>
</ul>
<% if @question_item.convertable_by?(User.current) && User.current.allowed_to?(:add_issues, @project) %>
<h3><%= l(:label_questions_actions) %></h3>
<ul class="action">
<li>
<%= link_to(
l(:button_questions_to_issue),
convert_to_issue_project_question_path(@project, @question_item)
)
%>
</li>
</ul>
<% end %>
<h3><%= l(:label_questions_related_questions) %></h3>
<ul class="related-topics">
<% Question.visible.related(@question_item, 5).each do |question| %>
<li class="related-topic">
<%= link_to h(question.subject), { :controller => 'questions', :action => 'show', :board_id => nil, :id => question } %>
</li>
<% end %>
</ul>
<% end %>

View File

@ -0,0 +1,23 @@
<div class="question<%= " votable" if question_item.allow_voting? %> div-table" id="question_<%= question_item.id %>">
<a href="#<%= question_item.id %>" class="wiki-anchor"></a>
<% if question_item.allow_voting? %>
<div class="vote">
<%= render :partial => 'questions_votes/question_item_vote', :locals => {:question_item => question_item} %>
</div>
<% end %>
<div class="question-container div-table-cell">
<%= avatar(question_item.author, :size => "32") %>
<p class="author">
<%= link_to_user question_item.author %><br>
<%= l(:label_questions_added_time, :value => time_tag(question_item.created_on)).html_safe %>
</p>
<div class="wiki">
<%= textilizable(question_item, :content) %>
</div>
<%= link_to_attachments question_item, :author => false %>
<%= render :partial => 'questions_comments/comments_container', :locals => { :question_item => question_item } %>
</div>
</div>

View File

@ -0,0 +1,47 @@
<% if @question_items && @question_items.any? %>
<% unless params[:tag].blank? %>
<div class="title-bar">
<h4><%= l(:label_questions_tagged_by, :count => @question_items.size, :tag => params[:tag]) %></h4>
</div>
<% end %>
<div id="forum_list">
<div id="topics_container" class="<%= " votable" if @section && @section.allow_voting? %>">
<% @question_items.each do |question| %>
<div class="topic">
<% if @section && @section.allow_voting? %>
<div class="topic-vote">
<span class="vote-score"><%= question.weighted_score %></span>
<label><%= l(:label_questions_x_votes, :count => question.weighted_score.abs) %></label>
<% if question.answered? %>
<div class="status-answered" title="Answered"></div>
<% end %>
</div>
<% end %>
<div class="topic-content">
<h3 class="subject">
<%= link_to h(question.subject), { :controller => 'questions', :action => 'show', :project_id => question.project, :id => question } %>
<%= question_status_tag(question.status) %>
</h3>
<p><%= truncate(Question.to_text(textilizable(question.content)), :length => 100) %></p>
<ul class="meta">
<% if question.allow_answering? %>
<li class="answers icon icon-comment"><%= l(:label_questions_answers, :count => question.answers_count) %></li>
<% end %>
<li class="views icon icon-view"><%= l(:label_questions_views, :count => question.views ) %></li>
</ul>
</div>
</div>
<% end %>
</div>
</div>
<% if @topic_pages %>
<% params[:controller] = 'questions'
params[:action] = 'topics'
%>
<p class="pagination"><%= pagination_links_full @topic_pages, @topic_count %></p>
<% end %>
<% else %>
<p style="display: inline-block"></p>
<p class="nodata"><%= l(:label_no_data) %></p>
<% end %>

View File

@ -0,0 +1,16 @@
<%
# scope = Message.scoped({})
# 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.where(:featured => true)
# @featured_topics = scope.visible.includes(:board).order("#{Message.table_name}.cached_votes_up DESC").limit(10)
%>
<h3><%= l(:label_questions_most_voted) %></h3>
<ul class="related-topics">
<% @featured_questions.each do |question| %>
<li class="related-topic">
<%= link_to h(question.subject), { :controller => 'questions', :action => 'show', :project_id => question.project, :id => question } %>
</li>
<% end unless @featured_topics.blank? %>
</ul>

View File

@ -0,0 +1,30 @@
<% if @topics && @topics.any? %>
<% unless params[:tag].blank? %>
<div class="title-bar">
<h4><%= l(:label_questions_tagged_by, :count => @topics.size, :tag => params[:tag]) %></h4>
</div>
<% end %>
<div id="topics_container">
<% @topics.each do |topic| %>
<div class="topic">
<h3 class="subject">
<%= link_to h(topic.subject), { :controller => 'messages', :action => 'show', :board_id => topic.board, :id => topic } %>
</h3>
<p><%= truncate(topic.content.gsub(/\r\n/, ' ').strip , :length => 100) %></p>
<ul class="meta">
<li class="votes icon icon-vote"><%= l(:label_questions_votes, :count => topic.count_votes_up - topic.count_votes_down ) %></li>
<li class="answers icon icon-comment"><%= l(:label_questions_answers, :count => topic.replies_count) %></li>
</ul>
</div>
<% end %>
</div>
<% if @topic_pages %>
<% params[:controller] = 'questions'
params[:action] = 'topics'
%>
<p class="pagination"><%= pagination_links_full @topic_pages, @topic_count %></p>
<% end %>
<% else %>
<p class="nodata"><%= l(:label_no_data) %></p>
<% end %>

View File

@ -0,0 +1 @@
<%= render :partial => "questions/question_list" %>

View File

@ -0,0 +1,16 @@
<h2><%= avatar(@question_item.author, :size => "24") %><%=h @question_item.subject %></h2>
<%= form_for @question_item, { :url => question_path(@question_item), :html => {:multipart => true,
:id => 'question_form', :method => :put}} do |f| %>
<%= back_url_hidden_field_tag %>
<div id="all_attributes">
<%= render :partial => 'form', :locals => {:f => f} %>
</div>
<%= submit_tag l(:button_save) %>
<%= preview_link({:controller => 'questions', :action => 'preview', :question_id => @question_item}, 'question_form') if Redmine::VERSION.to_s <= '3.4.5' %>
| <%= link_to l(:button_cancel), question_path(@question_item) %>
<% end %>
<div id="preview" class="wiki"></div>

View File

@ -0,0 +1,35 @@
<% html_title l(:label_questions) %>
<div class="questions" >
<div class="contextual">
<%= link_to(l(:label_questions_new),
{:controller => 'questions', :action => 'new', :section_id => @section},
:class => 'icon icon-add') if User.current.allowed_to?(:add_questions, @project) %>
<%= link_to(l(:label_questions_section_edit),
{:controller => 'questions_sections', :action => 'edit', :id => @section},
:class => 'icon icon-edit') if @section && User.current.allowed_to?(:manage_sections, @project) %>
</div>
<%= question_breadcrumb @section %>
<h2 class="section-title">
<%= @section ? @section.name : l(:label_questions)%>
</h2>
<% if @section && !@section.description.blank? %>
<em class="info"><%= @section.description %></em>
<% end %>
<div class="filters">
<%= form_tag({:controller => "questions", :action => "index"}, :method => :get, :id => "query_form") do %>
<%= text_field_tag(:topic_search, params[:topic_search], :autocomplete => "off", :class => "questions-search", :placeholder => l(:label_questions_search) ) %>
<%= javascript_tag "observeSearchfield('topic_search', 'topics_list', '#{ escape_javascript(autocomplete_for_subject_questions_path(:project_id => @project, :section_id => @section, :sort_order => @sort_order)) }')" %>
<% end %>
</div>
</div>
<div id="topics_list" >
<%= render :partial => "questions/question_list" %>
</div>
<% content_for :sidebar do %>
<%= render :partial => "questions/latest_topics" %>
<%= render :partial => "questions/popular_topics" %>
<% end %>

View File

@ -0,0 +1,12 @@
<h2><%= l(:label_message_new) %></h2>
<%= form_for @question_item, { :url => project_questions_path(@project, {}), :html => {:multipart => true,
:id => 'question_form'}} do |f| %>
<div id="all_attributes">
<%= render partial: 'form', locals: { f: f } %>
</div>
<%= submit_tag l(:button_create) %>
<% preview_link({ controller: 'questions', action: 'preview', id: @question_item }, 'question_form') if Redmine::VERSION.to_s <= '3.4.5' %>
<% end %>
<div id="preview" class="wiki"></div>

View File

@ -0,0 +1,6 @@
<%= question_breadcrumb @question_item %>
<%= render :partial => 'question' if QA_VERSION_TYPE.match(/Light/) %>
<% html_title @question_item.subject %>

View File

@ -0,0 +1 @@
$('#all_attributes').html('<%= escape_javascript(render :partial => 'form') %>');

View File

@ -0,0 +1,11 @@
<div class="contextual">
<% if question_item.editable_by?(User.current) %>
<%= link_to(l(:button_edit), edit_questions_answer_path(question_item), :class => 'icon icon-edit') %>
<% elsif User.current.allowed_to?(:accept_answers, @project) && !question_item.accepted? %>
<%= link_to(l(:label_questions_accept), questions_answer_path(question_item, answer: {accepted: true}), method: :put, :class => 'icon icon-accept') %>
<% elsif User.current.allowed_to?(:accept_answers, @project) && question_item.accepted? %>
<%= link_to(l(:label_questions_discard), questions_answer_path(question_item, answer: {accepted: false}), method: :put, :class => 'icon icon-discard') %>
<% end %>
<%= link_to(l(:button_delete), questions_answer_path(question_item), :method => :delete, :data => {:confirm => l(:text_are_you_sure)}, :class => 'icon icon-del') if question_item.destroyable_by?(User.current)
%>
</div>

View File

@ -0,0 +1,23 @@
<div class="question answer<%= ' votable' if question_item.allow_voting? %> div-table" id="questions_answer_<%= question_item.id %>">
<a href="#<%= question_item.id %>" class="wiki-anchor"></a>
<% if question_item.allow_voting? %>
<div class="vote" >
<%= render :partial => 'questions_votes/question_item_vote', :locals => {:question_item => question_item } %>
</div>
<% end %>
<div class="question-container div-table-cell">
<%= render :partial => "questions_answers/actions", :locals => { :question_item => question_item } %>
<%= avatar(question_item.author, :size => "32") %>
<p class="author">
<%= link_to_user question_item.author %><br>
<%= l(:label_questions_added_time, :value => time_tag(question_item.created_on)).html_safe %>
</p>
<div class="wiki">
<%= textilizable(question_item, :content) %>
</div>
<%= link_to_attachments question_item, :author => false %>
</div>
</div>

View File

@ -0,0 +1,10 @@
<%= error_messages_for @answer %>
<div class="box">
<%= f.text_area :content, :cols => 80, :rows => 15, :class => 'wiki-edit', :id => 'answer_content', :no_label => true %>
<%= wikitoolbar_for 'answer_content' %>
<p>
<%= l(:label_attachment_plural) %><br />
<%= render :partial => 'attachments/form', :locals => {:container => @answer} %>
</p>
</div>

View File

@ -0,0 +1,12 @@
<h2><%= avatar(@answer.author, :size => "24") %><%=h @answer.question.subject %></h2>
<%= form_for @answer, :as => :answer, :url => questions_answer_path(@answer), :html => {:multipart => true, :id => 'answer-form', :method => :put} do |f| %>
<%= back_url_hidden_field_tag %>
<%= render :partial => 'form', :locals => {:f => f} %>
<%= submit_tag l(:button_save) %>
<%= preview_link(preview_questions_answers_path(@answer), 'answer-form') if Redmine::VERSION.to_s <= '3.4.5' %>
| <%= link_to l(:button_cancel), question_path(@answer.question, :anchor => "question_item_#{@answer.id}") %>
<% end %>
<div id="preview" class="wiki"></div>

View File

@ -0,0 +1,27 @@
<div class="comment" id="comment_<%= comment.id %>">
<div class="contextual">
<%= link_to(
"",
{:controller => 'questions_comments', :action => 'edit', :source_id => comment.commented, :source_type => comment.commented.class.name.underscore, :id => comment.id},
:class => 'icon icon-edit',
:method => :get
) if (User.current.allowed_to?(:edit_question_comments, comment.commented.project) || (comment.author == User.current && User.current.allowed_to?(:edit_own_question_comments, comment.commented.project)))
%>
<%= link_to(
"",
{:controller => 'questions_comments', :action => 'destroy', :source_id => comment.commented, :id => comment, :source_type => comment.commented.class.name.underscore}, :class => 'icon icon-del',
:data => {:confirm => l(:text_are_you_sure)},
:method => :delete,
:title => l(:button_delete)
) if (User.current.allowed_to?(:edit_question_comments, comment.commented.project) || (comment.author == User.current && User.current.allowed_to?(:edit_own_question_comments, comment.commented.project)))
%>
</div>
<div class="author">
<%= link_to_user comment.author %>
<%= time_tag(comment.created_on) %>
</div>
<div class="wiki-content">
<%= textilizable(comment.comments) %>
</div>
</div>

View File

@ -0,0 +1,7 @@
<% if question_item.commentable? %>
<%= form_tag({:controller => 'questions_comments', :action => 'create', :id => question_item, :source_id => question_item, :source_type => question_item.class.name.underscore}, :class => "add-comment-form", :remote => true) do %>
<%= text_area 'comment', @comment.respond_to?(:content) ? 'content' : 'comments', :cols => 80, :rows => 5, :id => "comments_for_#{question_item.class.name.underscore}_#{question_item.id}" %>
<%= submit_tag l(:button_add), :class => "button-small" %>
<%= link_to l(:button_cancel), {}, :onclick => "$('#add_#{question_item.class.name.underscore}_comments_#{question_item.id}').hide(); return false;" %>
<% end %>
<% end %>

View File

@ -0,0 +1,12 @@
<% if question_item.comments.any? %>
<div class="question-comments">
<% question_item.comments.each do |comment| %>
<% next if comment.new_record? %>
<%= render :partial => "questions_comments/comment", :locals => {:comment => comment, :comment_source => question_item} %>
<% end %>
</div>
<% end %>
<div class="add_comments" id="add_<%= question_item.class.name.underscore %>_comments_<%= question_item.id %>" style="display:none;">
<%= render :partial => "questions_comments/comment_form", :locals => {:question_item => question_item} %>
</div>

View File

@ -0,0 +1,7 @@
<% if question_item.commentable? %>
<%= link_to l(:label_questions_comment), "#", :onclick => "$('#add_comments_#{question_item.id}').toggle(); showAndScrollTo('add_#{question_item.class.name.underscore}_comments_#{question_item.id}', 'comments_for_#{question_item.class.name.underscore}_#{question_item.id}'); return false;", :class => 'icon icon-comment add-comment-link' %>
<% end %>
<div class="comments_container">
<%= render :partial => 'questions_comments/comment_list', :locals => {:question_item => question_item} %>
</div>

View File

@ -0,0 +1,3 @@
$("#<%= @comment_source.class.name.underscore %>_<%= @comment_source.id %> .comments_container").html('<%= escape_javascript(render :partial => "questions_comments/comment_list", :locals => {:question_item => @comment_source}) %>');
$(".comment#comment_<%= @comment.id %>").effect('highlight', {}, 1000);
$("textarea#comments_for_<%= @comment_source.class.name.underscore %>_<%= @comment_source.id %>").val("");

View File

@ -0,0 +1,12 @@
<h2><%= avatar(@comment.author, :size => "24") %></h2>
<%= form_tag({:controller => 'questions_comments', :action => 'update', :source_id => @comment_source, :source_type => @comment_source.class.name.underscore, :id => @comment, :method => :put}) do %>
<div class="box">
<%= text_area 'comment', 'comments', :cols => 80, :rows => 5%>
</div>
<p><%= submit_tag l(:button_update) %></p>
<% end %>
<div id="preview" class="wiki"></div>

View File

@ -0,0 +1,7 @@
<%= error_messages_for @section %>
<p>
<%= f.text_field :name, :required => true %>
</p>
<p>
<%= f.text_area :description, :rows => 5 %>
</p>

View File

@ -0,0 +1,8 @@
<h3 class="title"><%=l(:label_questions_section_new) %></h3>
<%= labelled_form_for((@project ? [@project, @section] : @section), :remote => true, :html => {:class => 'tabular'}) do |f|%>
<%= render :partial => 'form', :locals => { :f => f} %>
<p>
<%= f.submit l(:button_create) %>
</p>
<% end %>

View File

@ -0,0 +1,25 @@
<% @sections.group_by(&:project).each do |project, sections| %>
<% if @project.blank? %>
<div class="project-forums">
<h3>
<%= project.name %>
<%= link_to " \xc2\xbb", project_questions_sections_path(project_id: project.identifier) %>
</h3>
</div>
<% end %>
<div class="section-list">
<% sections.each do |section| %>
<a id="section_<%= section.id %>" class="section-tile"
href="<%= url_for({ controller: "questions", action: 'index', section_id: section, project_id: section.project }) %>">
<h4>
<%= section.name %>
<span class="topic-count"><%= "(#{section.questions_count})" %></span>
</h4>
<div class="description">
<%= section.description %>
</div>
</a>
<% end %>
</div>
<% end %>

View File

@ -0,0 +1,8 @@
hideModal();
<% select = content_tag('select', content_tag('option') + options_from_collection_for_select(QuestionsSection.where(:project_id => @project), :id, :name, @section.id.to_s), :id => 'question_section_id', :name => 'question[section_id]') %>
$('#question_section_id').replaceWith('<%= escape_javascript(select) %>');
$.ajax({
url: '<%= escape_javascript update_form_questions_path(:id => @question_item, :format => 'js', :project_id => @project) %>',
type: 'put',
data: $('#question_form').serialize()
});

View File

@ -0,0 +1,11 @@
<h2><%=l(:label_questions_section)%></h2>
<%= labelled_form_for (@project ? [@project, @section] : @section), :method => "PUT", :html => {:class => 'tabular'} do |f|%>
<div class="box tabular">
<%= back_url_hidden_field_tag %>
<%= render :partial => 'form', :locals => { :f => f} %>
</div>
<p>
<%= f.submit l(:button_save) %>
</p>
<% end %>

View File

@ -0,0 +1,28 @@
<% html_title l(:label_questions) %>
<div class="contextual">
<%= link_to(l(:label_questions_new),
{:controller => 'questions', :action => 'new', :section_id => @section},
:class => 'icon icon-add') if User.current.allowed_to?(:add_questions, @project) %>
</div>
<h2 class=""><%= l(:label_questions) %></h2>
<div class="filters">
<%= form_tag({:controller => "questions", :action => "index"}, :method => :get, :id => "query_form") do %>
<%= text_field_tag(:topic_search, params[:topic_search], :autocomplete => "off", :class => "questions-search", :placeholder => l(:label_questions_search) ) %>
<%= javascript_tag "observeSearchfield('topic_search', 'forum_list', '#{ escape_javascript(autocomplete_for_subject_questions_path(:project_id => @project, :section_id => @section)) }')" %>
<% end %>
</div>
<div id="forum_list">
<%= render :partial => 'tiles' %>
</div>
<% content_for :sidebar do %>
<%= render :partial => "questions/latest_topics" %>
<%= render :partial => "questions/popular_topics" %>
<% end %>
<% content_for :header_tags do %>
<%= javascript_include_tag :redmine_questions, :plugin => 'redmine_questions' %>
<% end %>

View File

@ -0,0 +1,11 @@
<h2><%=l(:label_questions_section_new)%></h2>
<%= labelled_form_for((@project ? [@project, @section] : @section), :html => {:class => 'tabular'}) do |f|%>
<div class="box tabular">
<%= back_url_hidden_field_tag %>
<%= render :partial => 'form', :locals => { :f => f} %>
</div>
<p>
<%= f.submit l(:button_create) %>
</p>
<% end %>

View File

@ -0,0 +1,2 @@
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'new_modal') %>');
showModal('ajax-modal', '600px');

View File

@ -0,0 +1,14 @@
<%= error_messages_for 'questions_status' %>
<div class="box tabular">
<p><%= f.text_field :name, :required => true %></p>
<p><%= f.select :color, options_for_select(QuestionsSettings::IDEA_COLORS, @questions_status.color), {:label => l(:field_color)} %></p>
<p><%= f.check_box :is_closed, :label => :label_questions_status_closed %></p>
</div>
<%= javascript_tag "$('#questions_status_color').simplecolorpicker({picker: true});"%>
<% content_for :header_tags do %>
<%= javascript_include_tag 'jquery.simplecolorpicker.js', :plugin => "redmine_questions" %>
<%= stylesheet_link_tag 'jquery.simplecolorpicker.css', :plugin => 'redmine_questions' %>
<% end %>

View File

@ -0,0 +1,6 @@
<h2><%= link_to l(:label_questions_status_plural), :action =>"plugin", :id => "redmine_questions", :controller => "settings", :tab => 'questions_statuses' %> &#187; <%=h @questions_status %></h2>
<%= labelled_form_for @questions_status do |f| %>
<%= render :partial => 'form', :locals => {:f => f} %>
<%= submit_tag l(:button_save) %>
<% end %>

View File

@ -0,0 +1,10 @@
api.array :questions_statuses do
@questions_statuses.each do |status|
api.questions_status do
api.id status.id
api.name status.name
api.color status.color
api.is_closed status.is_closed
end
end
end

View File

@ -0,0 +1,6 @@
<h2><%= link_to l(:label_questions_status_plural), :action =>"plugin", :id => "redmine_questions", :controller => "settings", :tab => 'questions_statuses' %> &#187; <%=l(:label_questions_status_new)%></h2>
<%= labelled_form_for @questions_status do |f| %>
<%= render :partial => 'form', :locals => {:f => f} %>
<%= submit_tag l(:button_create) %>
<% end %>

BIN
assets/images/accept.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 781 B

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0" y="0" width="35" height="35" viewBox="0, 0, 35, 35">
<g id="answered">
<path d="M17.5,0 C27.165,0 35,7.835 35,17.5 C35,27.165 27.165,35 17.5,35 C7.835,35 0,27.165 0,17.5 C0,7.835 7.835,0 17.5,0 z M17.5,2 C8.94,2 2,8.94 2,17.5 C2,26.06 8.94,33 17.5,33 C26.06,33 33,26.06 33,17.5 C33,8.94 26.06,2 17.5,2 z" fill="#5DBA7D"/>
<path d="M10.135,15.26 L6.628,19.186 L14.979,26.648 L29.232,13.863 L25.775,9.894 L14.979,19.651 z" fill="#5EBA7D"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 703 B

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0" y="0" width="35" height="35" viewBox="0, 0, 35, 35">
<g id="answered">
<path d="M-0.077,10.673 L-0.077,23.495 L13.026,35 L35.077,15.186 L35.077,3.042 L13.026,22.856 z" fill="#5EBA7D"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 446 B

BIN
assets/images/book_open.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 622 B

BIN
assets/images/discard.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0" y="0" width="35" height="35" viewBox="0, 0, 35, 35">
<defs>
<clipPath id="Clip_1">
<path d="M35,-1 L-1,-1 L-1,35 L35,35 z"/>
</clipPath>
</defs>
<g id="Layer_1">
<g clip-path="url(#Clip_1)" id="Layer_1">
<path d="M5.126,29.874 C-1.709,23.04 -1.709,11.96 5.126,5.126 C11.96,-1.709 23.04,-1.709 29.874,5.126 C36.709,11.96 36.709,23.04 29.874,29.874 C23.04,36.709 11.96,36.709 5.126,29.874" fill="#F2F2F2"/>
<path d="M10.033,13 L17.5,24.4 L24.967,13 z M10.033,13.2" fill="#AAAAAA"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 780 B

View File

@ -0,0 +1,3 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xl="http://www.w3.org/1999/xlink" version="1.1" viewBox="0 0 35 18" width="35pt" height="18pt" xmlns:dc="http://purl.org/dc/elements/1.1/"><metadata> Produced by OmniGraffle 6.5.3 <dc:date>2016-07-07 08:57:24 +0000</dc:date></metadata><defs/><g stroke="none" stroke-opacity="1" stroke-dasharray="none" fill="none" fill-opacity="1"><title>Canvas 1</title><g><title>Layer 1</title><path d="M .21475331 .19262309 L 35 .19262309 L 17.607377 17.585246 Z" fill="#9a9a9a"/></g></g></svg>

After

Width:  |  Height:  |  Size: 681 B

BIN
assets/images/eye.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 750 B

BIN
assets/images/tag_blue.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 586 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 601 B

BIN
assets/images/thumb_up.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 619 B

BIN
assets/images/unvote.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 667 B

Binary file not shown.

15
assets/images/upvote.svg Normal file
View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0" y="0" width="35" height="35" viewBox="0, 0, 35, 35">
<defs>
<clipPath id="Clip_1">
<path d="M0,36 L36,36 L36,0 L0,0 z"/>
</clipPath>
</defs>
<g id="Layer_1">
<g clip-path="url(#Clip_1)" id="Layer_1">
<path d="M29.874,5.126 C36.709,11.96 36.709,23.04 29.874,29.874 C23.04,36.709 11.96,36.709 5.126,29.874 C-1.709,23.04 -1.709,11.96 5.126,5.126 C11.96,-1.709 23.04,-1.709 29.874,5.126" fill="#F2F2F2"/>
<path d="M24.967,22 L17.5,10.6 L10.033,22 z M24.967,21.8" fill="#AAAAAA"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 776 B

View File

@ -0,0 +1,3 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xl="http://www.w3.org/1999/xlink" version="1.1" viewBox="0 0 35 18" width="35pt" height="18pt" xmlns:dc="http://purl.org/dc/elements/1.1/"><metadata> Produced by OmniGraffle 6.5.3 <dc:date>2016-07-07 08:55:07 +0000</dc:date></metadata><defs/><g stroke="none" stroke-opacity="1" stroke-dasharray="none" fill="none" fill-opacity="1"><title>Canvas 1</title><g><title>Layer 1</title><path d="M 34.785247 17.992623 L 71054274e-22 17.992623 L 17.392623 .6 Z" fill="#9a9a9a"/></g></g></svg>

After

Width:  |  Height:  |  Size: 684 B

26
assets/images/voting.svg Normal file
View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0" y="0" width="140" height="105" viewBox="0, 0, 140, 105">
<g id="answered">
<path d="M17.5,0 C27.165,0 35,7.835 35,17.5 C35,27.165 27.165,35 17.5,35 C7.835,35 0,27.165 0,17.5 C0,7.835 7.835,0 17.5,0 z M17.5,2 C8.94,2 2,8.94 2,17.5 C2,26.06 8.94,33 17.5,33 C26.06,33 33,26.06 33,17.5 C33,8.94 26.06,2 17.5,2 z" fill="#5DBA7D"/>
<path d="M10.135,15.26 L6.628,19.186 L14.979,26.648 L29.232,13.863 L25.775,9.894 L14.979,19.651 z" fill="#5EBA7D"/>
<path d="M7.947,84.081 L3.454,89.11 L14.15,98.667 L32.405,82.292 L27.978,77.208 L14.15,89.705 z" fill="#5EBA7D"/>
<path d="M52.5,79.594 C57.108,79.594 60.844,83.329 60.844,87.937 C60.844,92.546 57.108,96.281 52.5,96.281 C47.892,96.281 44.156,92.546 44.156,87.937 C44.156,83.329 47.892,79.594 52.5,79.594 z M52.5,81.094 C48.72,81.094 45.656,84.158 45.656,87.937 C45.656,91.717 48.72,94.781 52.5,94.781 C56.28,94.781 59.344,91.717 59.344,87.937 C59.344,84.158 56.28,81.094 52.5,81.094 z" fill="#5DBA7D"/>
<path d="M48.989,86.869 L47.316,88.741 L51.298,92.299 L58.094,86.204 L56.446,84.311 L51.298,88.963 z" fill="#5EBA7D"/>
<g>
<path d="M99.874,5.126 C106.709,11.96 106.709,23.04 99.874,29.874 C93.04,36.709 81.96,36.709 75.126,29.874 C68.291,23.04 68.291,11.96 75.126,5.126 C81.96,-1.709 93.04,-1.709 99.874,5.126" fill="#EFEFEF"/>
<path d="M94.967,21.625 L87.5,10.225 L80.033,21.625 z M94.967,21.425" fill="#9A9A9A"/>
</g>
<path d="M99.874,40.126 C106.709,46.96 106.709,58.04 99.874,64.874 C93.04,71.709 81.96,71.709 75.126,64.874 C68.291,58.04 68.291,46.96 75.126,40.126 C81.96,33.291 93.04,33.291 99.874,40.126" fill="#D6F5E6"/>
<path d="M94.967,56.625 L87.5,45.225 L80.033,56.625 z M94.967,56.425" fill="#9A9A9A"/>
<g>
<path d="M40.126,29.874 C33.291,23.04 33.291,11.96 40.126,5.126 C46.96,-1.709 58.04,-1.709 64.874,5.126 C71.709,11.96 71.709,23.04 64.874,29.874 C58.04,36.709 46.96,36.709 40.126,29.874" fill="#EFEFEF"/>
<path d="M45.033,13.375 L52.5,24.775 L59.967,13.375 z M45.033,13.575" fill="#9A9A9A"/>
</g>
<path d="M40.126,64.874 C33.291,58.04 33.291,46.96 40.126,40.126 C46.96,33.291 58.04,33.291 64.874,40.126 C71.709,46.96 71.709,58.04 64.874,64.874 C58.04,71.709 46.96,71.709 40.126,64.874" fill="#F9DEDE"/>
<path d="M45.033,48.375 L52.5,59.775 L59.967,48.375 z M45.033,48.575" fill="#9A9A9A"/>
<path d="M4.75,45.839 L4.75,56.07 L14.255,65.25 L30.25,49.44 L30.25,39.75 L14.255,55.56 z" fill="#5EBA7D"/>
<path d="M108,60 L137,60 L122.5,45 z" fill="#AAAAAA"/>
<path d="M137,10.771 L108,10.771 L122.5,25.771 z" fill="#AAAAAA"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

@ -0,0 +1,235 @@
/*
* Very simple jQuery Color Picker
* https://github.com/tkrotoff/jquery-simplecolorpicker
*
* Copyright (C) 2012-2013 Tanguy Krotoff <tkrotoff@gmail.com>
*
* Licensed under the MIT license
*/
(function($) {
'use strict';
/**
* Constructor.
*/
var SimpleColorPicker = function(select, options) {
this.init('simplecolorpicker', select, options);
};
/**
* SimpleColorPicker class.
*/
SimpleColorPicker.prototype = {
constructor: SimpleColorPicker,
init: function(type, select, options) {
var self = this;
self.type = type;
self.$select = $(select);
self.$select.hide();
self.options = $.extend({}, $.fn.simplecolorpicker.defaults, options);
self.$colorList = null;
if (self.options.picker === true) {
var selectText = self.$select.find('> option:selected').text();
self.$icon = $('<span class="simplecolorpicker button"'
+ ' title="' + selectText + '"'
+ ' style="background-color: ' + self.$select.val() + ';"'
+ ' role="button" tabindex="0">'
+ '</span>').insertAfter(self.$select);
self.$icon.on('click.' + self.type, $.proxy(self.showPicker, self));
self.$picker = $('<span class="simplecolorpicker picker ' + self.options.theme + '"></span>').appendTo(document.body);
self.$colorList = self.$picker;
// Hide picker when clicking outside
$(document).on('mousedown.' + self.type, $.proxy(self.hidePicker, self));
self.$picker.on('mousedown.' + self.type, $.proxy(self.mousedown, self));
} else {
self.$inline = $('<span class="simplecolorpicker inline ' + self.options.theme + '"></span>').insertAfter(self.$select);
self.$colorList = self.$inline;
}
// Build the list of colors
// <span class="color selected" title="Green" style="background-color: #7bd148;" role="button"></span>
self.$select.find('> option').each(function() {
var $option = $(this);
var color = $option.val();
var isSelected = $option.is(':selected');
var isDisabled = $option.is(':disabled');
var selected = '';
if (isSelected === true) {
selected = ' data-selected';
}
var disabled = '';
if (isDisabled === true) {
disabled = ' data-disabled';
}
var title = '';
if (isDisabled === false) {
title = ' title="' + $option.text() + '"';
}
var role = '';
if (isDisabled === false) {
role = ' role="button" tabindex="0"';
}
var $colorSpan = $('<span class="color"'
+ title
+ ' style="background-color: ' + color + ';"'
+ ' data-color="' + color + '"'
+ selected
+ disabled
+ role + '>'
+ '</span>');
self.$colorList.append($colorSpan);
$colorSpan.on('click.' + self.type, $.proxy(self.colorSpanClicked, self));
var $next = $option.next();
if ($next.is('optgroup') === true) {
// Vertical break, like hr
self.$colorList.append('<span class="vr"></span>');
}
});
},
/**
* Changes the selected color.
*
* @param color the hexadecimal color to select, ex: '#fbd75b'
*/
selectColor: function(color) {
var self = this;
var $colorSpan = self.$colorList.find('> span.color').filter(function() {
return $(this).data('color').toLowerCase() === color.toLowerCase();
});
if ($colorSpan.length > 0) {
self.selectColorSpan($colorSpan);
} else {
console.error("The given color '" + color + "' could not be found");
}
},
showPicker: function() {
var pos = this.$icon.offset();
this.$picker.css({
// Remove some pixels to align the picker icon with the icons inside the dropdown
left: pos.left - 1,
top: pos.top - 4//+ this.$icon.outerHeight()
});
this.$picker.show(this.options.pickerDelay);
},
hidePicker: function() {
this.$picker.hide(this.options.pickerDelay);
},
/**
* Selects the given span inside $colorList.
*
* The given span becomes the selected one.
* It also changes the HTML select value, this will emit the 'change' event.
*/
selectColorSpan: function($colorSpan) {
var color = $colorSpan.data('color');
var title = $colorSpan.prop('title');
// Mark this span as the selected one
$colorSpan.siblings().removeAttr('data-selected');
$colorSpan.attr('data-selected', '');
if (this.options.picker === true) {
this.$icon.css('background-color', color);
this.$icon.prop('title', title);
this.hidePicker();
}
// Change HTML select value
this.$select.val(color);
},
/**
* The user clicked on a color inside $colorList.
*/
colorSpanClicked: function(e) {
// When a color is clicked, make it the new selected one (unless disabled)
if ($(e.target).is('[data-disabled]') === false) {
this.selectColorSpan($(e.target));
this.$select.trigger('change');
}
},
/**
* Prevents the mousedown event from "eating" the click event.
*/
mousedown: function(e) {
e.stopPropagation();
e.preventDefault();
},
destroy: function() {
if (this.options.picker === true) {
this.$icon.off('.' + this.type);
this.$icon.remove();
$(document).off('.' + this.type);
}
this.$colorList.off('.' + this.type);
this.$colorList.remove();
this.$select.removeData(this.type);
this.$select.show();
}
};
/**
* Plugin definition.
* How to use: $('#id').simplecolorpicker()
*/
$.fn.simplecolorpicker = function(option) {
var args = $.makeArray(arguments);
args.shift();
// For HTML element passed to the plugin
return this.each(function() {
var $this = $(this),
data = $this.data('simplecolorpicker'),
options = typeof option === 'object' && option;
if (data === undefined) {
$this.data('simplecolorpicker', (data = new SimpleColorPicker(this, options)));
}
if (typeof option === 'string') {
data[option].apply(data, args);
}
});
};
/**
* Default options.
*/
$.fn.simplecolorpicker.defaults = {
// No theme by default
theme: '',
// Show the picker or make it inline
picker: false,
// Animation delay in milliseconds
pickerDelay: 0
};
})(jQuery);

View File

View File

@ -0,0 +1,88 @@
/*
* Very simple jQuery Color Picker
* https://github.com/tkrotoff/jquery-simplecolorpicker
*
* Copyright (C) 2012-2013 Tanguy Krotoff <tkrotoff@gmail.com>
*
* Licensed under the MIT license
*/
/**
* Inspired by Bootstrap Twitter.
* See https://github.com/twbs/bootstrap/blob/master/less/navbar.less
* See https://github.com/twbs/bootstrap/blob/master/less/dropdowns.less
*/
.simplecolorpicker.picker {
position: absolute;
top: 100%;
left: 0;
z-index: 1051; /* Above Bootstrap modal (@zindex-modal = 1050) */
display: none;
float: left;
min-width: 160px;
max-width: 283px; /* @popover-max-width = 276px + 7 */
padding: 5px 0 0 5px;
margin: 2px 0 0;
list-style: none;
background-color: #fff; /* @dropdown-bg */
border: 1px solid #ccc;
}
.simplecolorpicker.inline {
display: inline-block;
}
.simplecolorpicker span {
margin: 0 5px 5px 0;
}
.simplecolorpicker.button,
.simplecolorpicker span.color {
display: inline-block;
outline: none;
cursor: pointer;
border: 1px solid transparent;
}
.simplecolorpicker.button {
border: 1px solid #DDD;
}
.simplecolorpicker.button:after,
.simplecolorpicker span.color:after {
content: '\00a0\00a0\00a0\00a0'; /* Spaces */
}
.simplecolorpicker span.color[data-disabled]:hover {
cursor: not-allowed;
border: 1px solid transparent;
}
.simplecolorpicker span.color:hover,
.simplecolorpicker span.color[data-selected],
.simplecolorpicker span.color[data-selected]:hover {
border: 1px solid #222; /* @gray-dark */
}
.simplecolorpicker span.color[data-selected]:after {
color: #fff;
}
/* Vertical separator, replaces optgroup. */
.simplecolorpicker span.vr {
border-left: 1px solid #222; /* @gray-dark */
}
.simplecolorpicker span.color[data-selected]:after {
/*font-family: 'FontAwesome';*/
-webkit-font-smoothing: antialiased;
content: '\2714'; /* Ok/check mark */
margin-right: 2px;
margin-left: 2px;
}

View File

@ -0,0 +1,404 @@
/**********************************************************************/
/* SECTION list
/**********************************************************************/
.section-list {margin-top: 10px}
.section-list .section-tile {
text-align: center;
display: inline-block;
width: 29%;
border: 1px solid #e0e0e0;
margin: 0 .8% 20px;
padding: 1.5em 1em;
cursor: pointer;
-webkit-transition: background .15s;
-moz-transition: background .15s;
-o-transition: background .15s;
transition: background .15s;
vertical-align: top;
}
.section-list .section-tile:hover {
text-decoration: none;
background: #f8f8f8
}
.section-list .section-tile .description {
color: #999;
}
/**********************************************************************/
/* QUESTION index
/**********************************************************************/
.questions h2.section-title {
margin-bottom: 0px;
}
.questions .filters {
margin-top: 10px;
}
.questions-filters {
float: right;
}
.questions-filters > ul > li {
list-style-type: none;
float: left;
margin-left: 5px;
}
.questions-filters > ul > li:not(:last-child):after {
content: " |"
}
.questions-filters > ul > li a.selected {
color: #888;
}
#forum_list div.list-item {
margin-bottom: 10px;
}
#forum_list div.list-item .last-author {
font-size: 80%;
color: gray;
}
#forum_list div.list-item .last-author a {
color: gray;
}
#forum_list > ul > li {
float: left;
width: 44%;
padding: 0;
margin: 15px 3% 0 0;
}
#forum_list div.project-forums {
border-bottom: 1px solid #CCC;
padding-top: 20px;
clear: left;
}
#forum_list > ul {
list-style: none;
padding: 0px;
margin-top: 0px;
}
#forum_list > ul > li.even {
margin-right: 0;
width: 46%;
}
#forum_list > ul > li.odd {
clear: left;
}
#forum_list > ul > li.odd, #forum_list > ul > li.even {
background-color: inherit;
}
.topic {
padding: 20px 0 20px;
}
.comment_container .topic{
padding: 5px 0 5px;
}
div.topic p {
margin: 5px 0;
}
div.topic h3.subject {
margin: 0px;
}
div.topic ul.meta {
margin: 0px;
padding: 0px;
}
div.topic ul.meta li {
display: block;
float: left;
font-size: 11px;
color: #999;
margin-right: 8px;
list-style: none;
}
div.topic ul.meta li a {
color: #999;
}
#topics_container.votable .topic-vote {float: left; width: 60px; text-align: center;}
#topics_container.votable .topic-content {padding-left: 60px;}
#topics_container.votable .topic-vote .vote-score {display: block; font-size: 24px;}
#topics_container.votable .topic-vote .vote-score {display: block; font-size: 24px;}
#topics_container.votable .topic-vote label {color: #999; line-height: 1; font-size: 12px; margin-bottom: 3px; display: block;}
#topics_container.votable .topic-vote .status-answered {
height: 30px;
width: 35px;
background-position: -35px -75px;
margin-left: auto;
margin-right: auto;
}
#topics_list div.title-bar h4 {
padding: 15px 0;
border-bottom: 1px dotted #bbb;
}
input.questions-search {
background: url(/images/magnifier.png) no-repeat 6px 50%;
border: 1px solid #D7D7D7;
background-color: white;
padding-left: 30px !important;
border-radius: 3px;
height: 1.5em;
width: 94%;
font-size: 16px;
}
input.questions-search.ajax-loading {
background-image: url(/images/loading.gif);
}
/**********************************************************************/
/* QUESTION show
/**********************************************************************/
h1.question-title {
font-weight: normal;
}
div.question.answer {
margin-bottom: 20px;
padding-top: 10px;
border-top: 1px solid #ddd;
}
.question a[disabled] {
color: #aaa;
pointer-events: none;
}
div.question img.gravatar {
float: left;
margin-right: 5px;
}
div.question p.author {
margin-top: 0px;
}
.question-status-tag {
font-family: Verdana, sans-serif;
background-color: #759FCF;
border: 1px solid rgba(0, 0, 0, 0.2);
border-radius: 3px;
padding: 2px 4px;
font-size: 10px;
display: inline-block;
vertical-align: middle;
color: white;
font-weight: normal;
}
/* Question vote*/
div.question {display: table; width: 100%;}
div.question.votable .vote {display: table-cell; padding: 0px 12px;}
div.question.votable .question-container {display: table-cell;vertical-align: top;}
div.question.votable .question-container .contextual {margin-top: 0px;}
.question .vote a.disabled {pointer-events: none;opacity: 0.5}
.question .vote {font-size: 24px; width: 35px;}
.question .vote .vote-up,
.question .vote .vote-down,
.question .vote .vote-count,
.question .vote .accepted {
display: block;
margin: 0 auto;
width: 35px;
height: 35px;
margin-bottom: 2px;
text-align: center;
text-decoration: none;
cursor: pointer;
}
.question .vote .vote-up,
.question .vote .vote-down,
.question .vote .accepted,
#topics_container.votable .topic-vote .status-answered {
background-image: url(../images/voting.svg);
background-size: initial;
background-repeat: no-repeat;
overflow: hidden;
}
.question .vote .accepted {cursor: default; background-position: 0px -69px;}
.question .vote .vote-up {background-position: -70px 0px;}
.question .vote .vote-down {background-position: -35px 0px;}
.question .vote .vote-count {height: 32px;}
/*.question .vote .vote-up:hover {background-position: -70px -35px;}
.question .vote .vote-down:hover {background-position: -35px -35px;}
*/
.question div.attachments {
margin-bottom: 12px;
}
/* Question meta */
#sidebar ul.question-meta, #sidebar ul.related-topics {
list-style: none;
padding: 0px;
}
#sidebar ul.question-meta li {
margin-bottom: 10px;
padding-left: 20px;
padding-top: 2px;
padding-bottom: 3px;
}
#sidebar ul.related-topics li {
margin-bottom: 5px;
}
/* Tags cloud */
#sidebar ul.questions-tags {
list-style: none;
padding: 0px;
}
#sidebar ul.questions-tags li {
margin-bottom: 5px;
}
#sidebar ul.questions-tags span.count {
color: gray;
}
/**********************************************************************/
/* SOLUTION show
/**********************************************************************/
.question.solution > h2 {
margin-bottom: 0px;
padding-bottom: 10px;
border-bottom: 1px solid #ddd;
}
.question.solution .liking {
padding: 10px 0px;
border-top: 1px solid #ddd;
border-bottom: 1px solid #ddd;
margin: 10px 0px
}
.question.solution .liking > a {
padding: 0 5px;
}
.question.solution .liking .author {
float: right;
}
/**********************************************************************/
/* COMMENTS
/**********************************************************************/
.comments_container {
background-color: #f5f5f5;
font-size: 0.9em;
margin: 10px 0px 0px 10px;
}
.question-comments .comment .contextual {
display: none;
}
.question-comments .comment:hover .contextual {
display: inline-block;
opacity: 0.4;
}
.question-comments .comment .contextual:hover {
opacity: 1;
}
.question-comments .comment {
padding: 10px;
border-bottom: 1px dashed #ccc;
}
.question-comments .comment:last-child {
border-bottom: 0px;
}
.question-comments .comment .author {
margin-bottom: 3px;
}
.question-comments .comment .wiki-content {
color: #707070;
display: inline-block;
}
.comments_container .comment .wiki-content p {
margin-bottom: 0px;
}
.question-comments .comment .wiki-content p:first-child {
margin-top: 0px;
}
.add-comment-link {
font-size: 0.9em;
display: block;
}
.add_comments {padding: 10px 10px 10px;}
.add_comments:not(:first-child) {border-top: 1px dashed #ccc;}
.add_comments textarea {
width: 98%;
}
/* Answers*/
#answers {
padding-top: 10px;
}
.accepted_answer{
float: right;
}
/**********************************************************************/
/* ICONS
/**********************************************************************/
.icon-vote { background-image: url(../images/thumb_up.png); }
.icon-unvote { background-image: url(../images/unvote.png); }
.icon-downvote { background-image: url(../images/thumb_down.png); }
.icon-view { background-image: url(../images/eye.png); }
.icon-calendar { background-image: url(/images/calendar.png); }
.icon-tag { background-image: url(../images/tag_blue.png); }
.icon-question { background-image: url(../../../images/help.png); }
.icon-solution { background-image: url(../images/book_open.png); }
.icon-accept { background-image: url(../images/accept.png); }
.icon-discard { background-image: url(../images/discard.png); }

173
config/locales/de.yml Normal file
View File

@ -0,0 +1,173 @@
# encoding: utf-8
# English strings go here for Rails i18n
de:
label_questions: "Hilfe & Support"
label_questions_search: "Suche nach Frage, Antwort, Hinweis oder ..."
label_questions_new: Neue Frage
label_questions_message: Nachricht
label_questions_added_time: "Vor %{value} hinzugefügt"
label_questions_related_questions: Verwandte Fragen
label_questions_latest_messages: Letzte Nachrichten
label_questions_views: "%{count} Ansichten"
label_questions_votes: "%{count} Bewertungen"
label_questions_answers: "%{count} Antworten"
label_questions_tags: Tags
label_questions_tagged_by: "%{count} item(s) tagged by %{tag}"
label_questions_sidebar_message: Sidebar Nachricht
label_questions_notice: Notiz
label_questions_most_voted: Meistbewertet
button_questions_vote: Abstimmen
button_questions_unvote: Bewertung zurückziehen
button_questions_like: Positiv
button_questions_unlike: Negativ
field_questions_tags: Tags
label_questions_add_comment: Kommentar hinzufügen
label_question_comment_successful_added: Kommentar erfolgreich hinzugefügt
label_question_successful_update: Frage erfolgreich aktualisiert
label_answer_successful_update: Antwort erfolgreich aktualisiert
label_answer_successful_added: Antwort erfolgreich hinzugefügt
lebel_questions_new_comment: Neuer Kommentar
button_questions_to_issue: Zu Ticket konvertieren
button_questions_issue_to_question: In Frage konvertieren
label_questions_actions: Aktionen
label_questions_accept: Akzeptieren
label_questions_section_type_questions: Fragen
label_questions_section_type_solutions: Lösungen
label_questions_section_type_ideas: Ideen
label_questions_section: Sektion
label_questions_sections_plural: Sektionen
label_questions_section_new: Neue Sektion
label_questions_section_type: Sektion Typ
label_questions_topic: Thema
label_questions_featured: Besonders
label_questions_locked: Gesperrt
project_module_questions: Fragen
i18n:
transliterate:
rule:
і: "i"
ґ: "g"
ё: "yo"
: "#"
є: "e"
ї: "yi"
а: "a"
б: "b"
в: "v"
г: "g"
д: "d"
е: "e"
ж: "zh"
з: "z"
и: "i"
й: "y"
к: "k"
л: "l"
м: "m"
н: "n"
о: "o"
п: "p"
р: "r"
с: "s"
т: "t"
у: "u"
ф: "f"
х: "h"
ц: "ts"
ч: "ch"
ш: "sh"
щ: "sch"
ъ: ""
ы: "y"
ь: ""
э: "e"
ю: "yu"
я: "ya"
"Ґ": "G"
"Ё": "YO"
"Є": "E"
"Ї": "YI"
"І": "I"
"А": "A"
"Б": "B"
"В": "V"
"Г": "G"
"Д": "D"
"Е": "E"
"Ж": "ZH"
"З": "Z"
"И": "I"
"Й": "Y"
"К": "K"
"Л": "L"
"М": "M"
"Н": "N"
"О": "O"
"П": "P"
"Р": "R"
"С": "S"
"Т": "T"
"У": "U"
"Ф": "F"
"Х": "H"
"Ц": "TS"
"Ч": "CH"
"Ш": "SH"
"Щ": "SCH"
"Ъ": "'"
"Ы": "Y"
"Ь": ""
"Э": "E"
"Ю": "YU"
"Я": "YA"
label_questions_comment: Kommentar
label_questions_your_answer: Ihre Antwort
label_questions_answer_plural: Antworten
label_questions_x_votes:
one: "Bewertung"
other: "Bewertungen"
label_questions_wasthishelpful: War dies hilfreich?
label_question_plural: Fragen
label_questions_related_solutions: Verwandte LÖsungen
label_questions_section_edit: Sektion bearbeiten
label_soluition_plural: Lösungen
label_questions_add_tag: "+ Tag hinzufügen"
label_questions_vote_added: Bewertung hinzugefügt
label_questions_vote_removed: Bewertung entfernt
label_questions_vote_own: Eigene Frage bewerten
label_questions_show_popular: Zeigen beliebte Artikel in Sektion
label_questions_most_popular: Am beliebtesten
label_questions_status_plural: Ideenstatus
label_questions_status_closed: Geschlossen
label_questions_status_new: Neuer Status
label_questions_newest: Neueste
label_questions_active: Aktive
label_questions_voted: Bewertete
label_questions_unanswered: Nicht beantwortet
permission_view_questions: Fragen anzeigen
permission_create_tags: Neue Tags erstellen
permission_edit_vote_messages: Fragen bewerten
permission_add_answers: Antwort hinzufügen
permission_delete_answers: Antworten Löschen
permission_edit_question_comments: Kommentare bearbeiten
permission_edit_own_question_comments: Eigene Kommentare bearbeiten
permission_comment_question: Kommentare hinzufügen
permission_add_questions: Fragen hinzufügen
permission_edit_questions: Fragen bearbeiten
permission_edit_own_questions: Eigene Fragen bearbeiten
permission_delete_questions: Fragen löschen
permission_vote_questions: Fragen bewerten
permission_accept_answers: Fragen akzeptieren
permission_manage_sections: Sektionen verwalten
label_questions_discard: Verwerfen
permission_edit_own_answers: Eigene Antworten bearbeiten

174
config/locales/en.yml Normal file
View File

@ -0,0 +1,174 @@
# encoding: utf-8
# English strings go here for Rails i18n
en:
label_questions: 'Help & Support'
label_questions_search: 'Search for a specific question, answer or topic ...'
label_questions_new: New question
label_questions_message: Message
label_questions_added_time: "Added %{value} ago"
label_questions_related_questions: Related questions
label_questions_latest_messages: Latest messages
label_questions_views: '%{count} views'
label_questions_votes: '%{count} votes'
label_questions_answers: '%{count} answers'
label_questions_tags: Tags
label_questions_tagged_by: '%{count} item(s) tagged by %{tag}'
label_questions_sidebar_message: Sidebar message
label_questions_notice: Notice
label_questions_most_voted: Most voted
button_questions_vote: Vote
button_questions_unvote: Unvote
button_questions_like: Like
button_questions_unlike: Unlike
field_questions_tags: Tags
label_questions_add_comment: Add comment
label_question_comment_successful_added: Comment successful added
label_question_successful_update: Question successful updated
label_answer_successful_update: Answer successful updated
label_answer_successful_added: Answer successful added
lebel_questions_new_comment: New comment
button_questions_to_issue: Convert to issue
button_questions_issue_to_question: Convert to question
label_questions_actions: Actions
label_questions_accept: Accept
label_questions_section_type_questions: Questions
label_questions_section_type_solutions: Solutions
label_questions_section_type_ideas: Ideas
label_questions_section: Section
label_questions_sections_plural: Sections
label_questions_section_new: New section
label_questions_section_type: Section type
label_questions_topic: Topic
label_questions_featured: Featured
label_questions_locked: Locked
project_module_questions: Questions
i18n:
transliterate:
rule:
і: 'i'
ґ: 'g'
ё: 'yo'
: '#'
є: 'e'
ї: 'yi'
а: 'a'
б: 'b'
в: 'v'
г: 'g'
д: 'd'
е: 'e'
ж: 'zh'
з: 'z'
и: 'i'
й: 'y'
к: 'k'
л: 'l'
м: 'm'
н: 'n'
о: 'o'
п: 'p'
р: 'r'
с: 's'
т: 't'
у: 'u'
ф: 'f'
х: 'h'
ц: 'ts'
ч: 'ch'
ш: 'sh'
щ: 'sch'
ъ: ''
ы: 'y'
ь: ''
э: 'e'
ю: 'yu'
я: 'ya'
"Ґ": "G"
"Ё": "YO"
"Є": "E"
"Ї": "YI"
"І": "I"
"А": "A"
"Б": "B"
"В": "V"
"Г": "G"
"Д": "D"
"Е": "E"
"Ж": "ZH"
"З": "Z"
"И": "I"
"Й": "Y"
"К": "K"
"Л": "L"
"М": "M"
"Н": "N"
"О": "O"
"П": "P"
"Р": "R"
"С": "S"
"Т": "T"
"У": "U"
"Ф": "F"
"Х": "H"
"Ц": "TS"
"Ч": "CH"
"Ш": "SH"
"Щ": "SCH"
"Ъ": "'"
"Ы": "Y"
"Ь": ""
"Э": "E"
"Ю": "YU"
"Я": "YA"
label_questions_comment: Comment
label_questions_your_answer: Your answer
label_questions_answer_plural: Answers
label_questions_x_votes:
one: "vote"
other: "votes"
label_questions_wasthishelpful: Was this helpful?
label_question_plural: Questions
label_questions_related_solutions: Related solutions
label_questions_section_edit: Edit section
label_soluition_plural: Solutions
label_questions_add_tag: '+ add tag'
label_questions_vote_added: Vote added
label_questions_vote_removed: Vote removed
label_questions_vote_own: Vote own questions
label_questions_show_popular: Show popular articles in section
label_questions_most_popular: Most popular
label_questions_status_plural: Idea statuses
label_questions_status_closed: Closed
label_questions_status_new: New status
label_questions_newest: Newest
label_questions_active: Active
label_questions_voted: Voted
label_questions_unanswered: Unanswered
permission_view_questions: View questions
permission_create_tags: Create new tags
permission_edit_vote_messages: Vote questions
permission_add_answers: Add answers
permission_delete_answers: Delete answers
permission_edit_question_comments: Edit comments
permission_edit_own_question_comments: Edit own comments
permission_comment_question: Add comments
permission_add_questions: Add questions
permission_edit_questions: Edit questions
permission_edit_own_questions: Edit own questions
permission_delete_questions: Delete questions
permission_vote_questions: Vote questions
permission_accept_answers: Accept answers
permission_manage_sections: Manage sections
permission_create_tags: Create new tags
label_questions_discard: Discard
permission_edit_own_answers: Edit own answers

27
config/locales/es.yml Normal file
View File

@ -0,0 +1,27 @@
es:
label_questions: 'Ayuda y Soporte'
label_questions_search: 'Buscar una pregunta, respuesta o tópico...'
label_questions_new: Nueva pregunta
label_questions_message: Mensaje
label_questions_added_time: "Agregado hace %{value}"
label_questions_related_questions: Mensajes relacionados
label_questions_latest_messages: Últimos mensajes
label_questions_views: '%{count} vistas'
label_questions_votes: '%{count} votos'
label_questions_answers: '%{count} respuestas'
label_questions_tags: Etiquetas
label_questions_tagged_by: '%{count} tópico(s) etiquetado como %{tag}'
label_questions_notice_message: Mensaje noticia
label_questions_notice: Noticia
label_questions_most_voted: Más votados
button_questions_vote: Votar
button_questions_unvote: Quitar Voto
button_questions_like: Me gusta
button_questions_unlike: Ya no me gusta
field_questions_tags: Etiquetas
permission_view_questions: Ver Ayuda y Soporte
permission_edit_messages_tags: Editar etiquetas
permission_edit_vote_messages: Votar mensajes

175
config/locales/it.yml Normal file
View File

@ -0,0 +1,175 @@
# encoding: utf-8
# Italian strings go here for Rails i18n
it:
label_questions: Aiuto e supporto
label_questions_search: "Ricerca di una domanda, una risposta o un argomento specifico ...."
label_questions_new: Nuova domanda
label_questions_message: Messaggio
label_questions_added_time: "Aggiunto %{value} fa."
label_questions_related_questions: Domande correlate
label_questions_latest_messages: Ultimi messaggi
label_questions_views: "%{count} visualizzazioni"
label_questions_votes: "%{count} voti"
label_questions_answers: "%{count} risposte"
label_questions_tags: Tags
label_questions_tagged_by: "%{count} voce(i) etichettata(e) da %{tag}."
label_questions_sidebar_message: Messaggio a margine
label_questions_notice: Avviso
label_questions_most_voted: I più votati
button_questions_vote: Vota
button_questions_unvote: Annulla voto
button_questions_like: Come
button_questions_unlike: A differenza di
field_questions_tags: Tags
label_questions_add_comment: Aggiungi commento
label_question_comment_successful_added: Aggiungi commento riuscito
label_question_successful_update: Domanda aggiornata con successo
label_answer_successful_update: Risposta aggiornata con successo
label_answer_successful_added: Aggiungi risposta riuscito
lebel_questions_new_comment: Nuovo commento
button_questions_to_issue: Conversione da domanda in segnalazione
button_questions_issue_to_question: Conversione da segnalazione a domanda
label_questions_actions: Azioni
label_questions_accept: Accettazione
label_questions_section_type_questions: Domande
label_questions_section_type_solutions: Soluzioni
label_questions_section_type_ideas: Idee
label_questions_section: Sezione
label_questions_sections_plural: Sezioni
label_questions_section_new: Nuova sezione
label_questions_section_type: Tipo di sezione
label_questions_topic: Argomento
label_questions_featured: In primo piano
label_questions_locked: Bloccato
project_module_questions: Domande
i18n:
transliterate:
rule:
і: 'i'
ґ: 'g'
ё: 'yo'
: '#'
є: 'e'
ї: 'yi'
а: 'a'
б: 'b'
в: 'v'
г: 'g'
д: 'd'
е: 'e'
ж: 'zh'
з: 'z'
и: 'i'
й: 'y'
к: 'k'
л: 'l'
м: 'm'
н: 'n'
о: 'o'
п: 'p'
р: 'r'
с: 's'
т: 't'
у: 'u'
ф: 'f'
х: 'h'
ц: 'ts'
ч: 'ch'
ш: 'sh'
щ: 'sch'
ъ: ''
ы: 'y'
ь: ''
э: 'e'
ю: 'yu'
я: 'ya'
"Ґ": "G"
"Ё": "YO"
"Є": "E"
"Ї": "YI"
"І": "I"
"А": "A"
"Б": "B"
"В": "V"
"Г": "G"
"Д": "D"
"Е": "E"
"Ж": "ZH"
"З": "Z"
"И": "I"
"Й": "Y"
"К": "K"
"Л": "L"
"М": "M"
"Н": "N"
"О": "O"
"П": "P"
"Р": "R"
"С": "S"
"Т": "T"
"У": "U"
"Ф": "F"
"Х": "H"
"Ц": "TS"
"Ч": "CH"
"Ш": "SH"
"Щ": "SCH"
"Ъ": "'"
"Ы": "Y"
"Ь": ""
"Э": "E"
"Ю": "YU"
"Я": "YA"
label_questions_comment: Commento
label_questions_your_answer: La tua risposta
label_questions_answer_plural: Risposte
label_questions_x_votes:
one: "voto"
other: "voti"
label_questions_wasthishelpful: È stato utile?
label_question_plural: Domande
label_questions_related_solutions: Soluzioni correlate
label_questions_section_edit: Modifica sezione
label_soluition_plural: Soluzioni
label_solution_plural: Soluzioni
label_questions_add_tag: + aggiungi il tag
label_questions_vote_added: Voto aggiunto
label_questions_vote_removed: Voto eliminato
label_questions_vote_own: Votate le vostre domande
label_questions_show_popular: Mostra articoli popolari nella sezione
label_questions_most_popular: I più popolari
label_questions_status_plural: Stati dell'idea
label_questions_status_closed: Chiuso
label_questions_status_new: Nuovo stato
label_questions_newest: Novità
label_questions_active: Attivo
label_questions_voted: Votato
label_questions_unanswered: Senza risposta
permission_view_questions: Visualizza le domande
permission_create_tags: Creare nuovi tag
permission_edit_vote_messages: Vota domande
permission_add_answers: Aggiungi risposte
permission_delete_answers: Cancella le risposte
permission_edit_question_comments: Modifica i commenti
permission_edit_own_question_comments: Modifica i propri commenti
permission_comment_question: Aggiungi commenti
permission_add_questions: Aggiungere domande
permission_edit_questions: Modifica domande
permission_edit_own_questions: Modifica le proprie domande
permission_delete_questions: Cancella le domande
permission_vote_questions: Vota domande
permission_accept_answers: Accetta le risposte
permission_manage_sections: Gestire le sezioni
permission_create_tags: Creare nuovi tag
label_questions_discard: Scartare
permission_edit_own_answers: Modifica le proprie risposte

99
config/locales/ru.yml Normal file
View File

@ -0,0 +1,99 @@
# Russian strings go here for Rails i18n
# encoding: utf-8
# English strings go here for Rails i18n
ru:
label_questions: 'Вопросы/Ответы'
label_questions_search: 'Поиск вопросов и ответов ...'
label_questions_new: Новая тема
label_questions_message: Сообщение
label_questions_added_time: "Добавлена %{value} назад"
label_questions_related_questions: Связанные вопросы
label_questions_latest_messages: Последние сообщения
label_questions_views: '%{count} просмотров'
label_questions_votes: '%{count} голосов'
label_questions_answers: '%{count} ответов'
label_questions_tags: Тэги
label_questions_tagged_by: '%{count} тем с тэгом %{tag}'
label_questions_sidebar_message: Сообщение справа
label_questions_notice: Информация
label_questions_most_voted: Больше голосов
button_questions_vote: Голосовать
button_questions_unvote: Отменить голос
button_questions_like: Like
button_questions_unlike: Unlike
field_questions_tags: Тэги
label_questions_add_comment: Комментировать
label_question_comment_successful_added: Комментарий добавлен
label_question_successful_update: Вопрос обновлен
label_answer_successful_update: Ответ обновлен
label_answer_successful_added: Ответ добавлен
lebel_questions_new_comment: Новый комментарий
button_questions_to_issue: Конв. в задачу
button_questions_issue_to_question: Конв. в вопрос
label_questions_actions: Действия
label_questions_accept: Принять
label_questions_section_type_questions: Вопросы
label_questions_section_type_solutions: Решения
label_questions_section_type_ideas: Идеи
label_questions_section: Раздел
label_questions_sections_plural: Разделы
label_questions_section_new: Новый раздел
label_questions_section_type: Тип раздела
label_questions_featured: Выделено
label_questions_locked: Заблокировано
project_module_questions: Вопросы/Ответы
label_questions_comment: Комментарий
label_questions_your_answer: Ваш ответ
label_questions_answer_plural: Ответы
label_questions_x_votes:
one: "голос"
few: "голоса"
many: "голосов"
other: "голоса"
label_questions_wasthishelpful: Полезно ли Вам было?
label_question_plural: Вопросы
label_questions_related_solutions: Связанные решения
label_questions_section_edit: Редактировать раздел
label_soluition_plural: Решения
label_questions_add_tag: '+ добавить тэг'
label_questions_vote_added: Голос добавлен
label_questions_vote_removed: Голос удален
label_questions_vote_own: Голосовать за свои вопросы
label_questions_show_popular: Показыть популярные вопросы на списке секций
label_questions_most_popular: Популярные
label_questions_status_plural: Статусы идеи
label_questions_status_closed: Закрыто
label_questions_status_new: Новый статус
label_questions_newest: Новейшие
label_questions_active: Активные
label_questions_voted: Голоса
label_questions_unanswered: Неотвеченные
permission_view_questions: Просматривать вопросы ответы
permission_create_tags: Создавать тэги
permission_edit_vote_messages: Голосовать
permission_add_answers: Добавить ответы
permission_delete_answers: Удалить ответы
permission_edit_question_comments: Редактировать комментарии
permission_edit_own_question_comments: Редактировать свои комментарии
permission_comment_question: Добавить комментарии
permission_add_questions: Добавить вопросы
permission_edit_questions: Редактировать вопросы
permission_edit_own_questions: Редактировать свои вопросы
permission_delete_questions: Удалить вопросы
permission_vote_questions: Голосовать за вопросы
permission_accept_answers: Принимать ответы
permission_manage_sections: Управлять секциями
permission_create_tags: Создавать новые тэги
label_questions_discard: Не принимать
permission_edit_own_answers: Редактировать свои ответы

32
config/locales/zh-TW.yml Normal file
View File

@ -0,0 +1,32 @@
# encoding: utf-8
# Simplified Chinese strings go here for Rails i18n
# Author: Salivaxiu@163.com
# Based on file: en.yml
zh-TW:
label_questions: '幫助與支持'
label_questions_search: '搜索特定的問題或回答或回覆...'
label_questions_new: 新問答
label_questions_message: 消息
label_questions_added_time: "在 %{value} 之前增加"
label_questions_related_messages: 相關的消息
label_questions_latest_messages: 最後的消息
label_questions_views: '顯示 %{count} 次'
label_questions_votes: '投票 %{count} 次'
label_questions_answers: '回答 %{count} 次'
label_questions_tags: 標籤
label_questions_tagged_by: '%{count} 個主題包含標籤 %{tag}'
label_questions_sidebar_message: 側邊欄信息
label_questions_notice: 通知
label_questions_most_voted: 大多數投票
button_questions_vote: 投票
button_questions_unvote: 取消投票
button_questions_like: 喜歡
button_questions_unlike: 不喜歡
field_questions_tags: 標籤
permission_view_questions: 查看幫助和支持
permission_edit_messages_tags: 編輯標籤
permission_edit_vote_messages: 投票消息

175
config/locales/zh.yml Normal file
View File

@ -0,0 +1,175 @@
# encoding: utf-8
# Simplified Chinese strings go here for Rails i18n
# Author: Salivaxiu@163.com
# Based on file: en.yml
zh:
label_questions: '帮助与支持'
label_questions_search: '搜索特定的提问或回答或帖子...'
label_questions_new: 新问答
label_questions_message: 消息
label_questions_added_time: "在 %{value} 之前增加"
label_questions_related_questions: 相关的消息
label_questions_latest_messages: 最后的消息
label_questions_views: '显示 %{count} 次'
label_questions_votes: '投票 %{count} 次'
label_questions_answers: '回答 %{count} 次'
label_questions_tags: 标签
label_questions_tagged_by: '%{count} 个主题包含标签 %{tag}'
label_questions_sidebar_message: 侧边栏信息
label_questions_notice: 通知
label_questions_most_voted: 大多数投票
button_questions_vote: 投票
button_questions_unvote: 取消投票
button_questions_like: 喜欢
button_questions_unlike: 不喜欢
field_questions_tags: 标签
label_questions_add_comment: 添加评论
label_question_comment_successful_added: 评论成功添加
label_question_successful_update: Question 问题成功更新
label_answer_successful_update: 回答更新成功
label_answer_successful_added: 回答添加成功
lebel_questions_new_comment: 新的评论
button_questions_to_issue: 转换为问题
button_questions_issue_to_question: 转换为提问
label_questions_actions: 行动
label_questions_accept: 接受
label_questions_section_type_questions: 提问
label_questions_section_type_solutions: 解决方案
label_questions_section_type_ideas: 想法
label_questions_section: 板块
label_questions_sections_plural: 板块
label_questions_section_new: 新板块
label_questions_section_type: 板块类型
label_questions_topic: 主题
label_questions_featured: 精选
label_questions_locked: 锁定
project_module_questions: 提问
i18n:
transliterate:
rule:
і: 'i'
ґ: 'g'
ё: 'yo'
: '#'
є: 'e'
ї: 'yi'
а: 'a'
б: 'b'
в: 'v'
г: 'g'
д: 'd'
е: 'e'
ж: 'zh'
з: 'z'
и: 'i'
й: 'y'
к: 'k'
л: 'l'
м: 'm'
н: 'n'
о: 'o'
п: 'p'
р: 'r'
с: 's'
т: 't'
у: 'u'
ф: 'f'
х: 'h'
ц: 'ts'
ч: 'ch'
ш: 'sh'
щ: 'sch'
ъ: ''
ы: 'y'
ь: ''
э: 'e'
ю: 'yu'
я: 'ya'
"Ґ": "G"
"Ё": "YO"
"Є": "E"
"Ї": "YI"
"І": "I"
"А": "A"
"Б": "B"
"В": "V"
"Г": "G"
"Д": "D"
"Е": "E"
"Ж": "ZH"
"З": "Z"
"И": "I"
"Й": "Y"
"К": "K"
"Л": "L"
"М": "M"
"Н": "N"
"О": "O"
"П": "P"
"Р": "R"
"С": "S"
"Т": "T"
"У": "U"
"Ф": "F"
"Х": "H"
"Ц": "TS"
"Ч": "CH"
"Ш": "SH"
"Щ": "SCH"
"Ъ": "'"
"Ы": "Y"
"Ь": ""
"Э": "E"
"Ю": "YU"
"Я": "YA"
label_questions_comment: 评论
label_questions_your_answer: 你的回答
label_questions_answer_plural: 回答
label_questions_x_votes:
one: "投票"
other: "票"
label_questions_wasthishelpful: 这有帮助吗?
label_question_plural: 提问
label_questions_related_solutions: 相关解决方案
label_questions_section_edit: 编辑板块
label_soluition_plural: 解决方案
label_questions_add_tag: '+ 加标签'
label_questions_vote_added: 投票已添加
label_questions_vote_removed: 投票已删除
label_questions_vote_own: 投自己的提问
label_questions_show_popular: 在板块显示热门文章
label_questions_most_popular: 最受欢迎
label_questions_status_plural: 提示状态
label_questions_status_closed: 已关闭
label_questions_status_new: 新状态
label_questions_newest: 最新
label_questions_active: 有效
label_questions_voted: 已投票
label_questions_unanswered: 未回答
permission_view_questions: 查看问题
permission_create_tags: 创建新标签
permission_edit_vote_messages: 投票提问
permission_add_answers: 添加回答
permission_delete_answers: 删除回答
permission_edit_question_comments: 编辑评论
permission_edit_own_question_comments: 编辑自己的评论
permission_comment_question: 添加评论
permission_add_questions: 添加提问
permission_edit_questions: 编辑提问
permission_edit_own_questions: 编辑自己的提问
permission_delete_questions: 删除提问
permission_vote_questions: 投票提问
permission_accept_answers: 接受回答
permission_manage_sections: 管理板块
permission_create_tags: 创建新标签
label_questions_discard: 舍弃
permission_edit_own_answers: 编辑自己的回答

65
config/routes.rb Normal file
View File

@ -0,0 +1,65 @@
# This file is a part of Redmine Q&A (redmine_questions) plugin,
# Q&A plugin for Redmine
#
# Copyright (C) 2011-2022 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/>.
# Plugin's routes
# See: http://guides.rubyonrails.org/routing.html
# match '/news/:id/comments', :to => 'comments#create', :via => :post
# match '/news/:id/comments/:comment_id', :to => 'comments#destroy', :via => :delete
resources :questions do
collection do
put :preview
put :update_form
# match :preview, :to => 'questions#preview', :via => [:get, :put, :post]
get :autocomplete_for_subject
get :topics
get :index_public
end
member do
get :from_issue
# post :new_comment
end
resources :questions_answers, :as => :answers
end
resources :questions_answers, :except => [:show, :index] do
collection do
put :preview
end
end
match "questions_votes", :to => 'questions_votes#create', :via => [:get, :post], :as => 'questions_votes'
resources :questions_comments do
member do
post :update
end
end
resources :questions_sections
resources :questions_statuses, :except => :show
resources :projects do
resources :questions_sections
resources :questions
end
match "projects/:project_id/questions/questions_sections/:section_id" => "questions#index", :via => [:get]
match "questions/questions_sections/:section_id" => "questions#index", :via => [:get]
match 'auto_completes/questions_tags' => 'auto_completes#questions_tags', :via => :get, :as => 'auto_complete_questions_tags'

View File

@ -0,0 +1,27 @@
# This file is a part of Redmine Q&A (redmine_questions) plugin,
# Q&A plugin for Redmine
#
# Copyright (C) 2011-2022 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 ActsAsVotableMigration < Rails.version < '5.1' ? ActiveRecord::Migration : ActiveRecord::Migration[4.2]
def self.up
ActiveRecord::Base.create_votable_table
end
def self.down
end
end

View File

@ -0,0 +1,29 @@
# This file is a part of Redmine Q&A (redmine_questions) plugin,
# Q&A plugin for Redmine
#
# Copyright (C) 2011-2022 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 AddViewingMigration < Rails.version < '5.1' ? ActiveRecord::Migration : ActiveRecord::Migration[4.2]
def self.up
unless table_exists?(:viewings)
ActiveRecord::Base.create_viewings_table
end
end
def self.down
end
end

View File

@ -0,0 +1,27 @@
# This file is a part of Redmine Q&A (redmine_questions) plugin,
# Q&A plugin for Redmine
#
# Copyright (C) 2011-2022 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 AddTaggingMigration < Rails.version < '5.1' ? ActiveRecord::Migration : ActiveRecord::Migration[4.2]
def up
ActiveRecord::Base.create_taggable_table
end
def down
end
end

View File

@ -0,0 +1,39 @@
# This file is a part of Redmine Q&A (redmine_questions) plugin,
# Q&A plugin for Redmine
#
# Copyright (C) 2011-2022 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 CreateQuestions < Rails.version < '5.1' ? ActiveRecord::Migration : ActiveRecord::Migration[4.2]
def change
create_table :questions do |t|
t.string :subject
t.text :content
t.references :section, :index => true
t.references :status, :index => true
t.references :author, :index => true
t.boolean :featured, :default => false
t.boolean :locked, :default => false
t.integer :cached_weighted_score, :default => 0
t.integer :comments_count, :default => 0
t.integer :answers_count, :default => 0
t.integer :views, :default => 0
t.integer :total_views, :default => 0
t.datetime :created_on
t.datetime :updated_on
end
end
end

View File

@ -0,0 +1,31 @@
# This file is a part of Redmine Q&A (redmine_questions) plugin,
# Q&A plugin for Redmine
#
# Copyright (C) 2011-2022 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 CreateQuestionsSections < Rails.version < '5.1' ? ActiveRecord::Migration : ActiveRecord::Migration[4.2]
def change
create_table :questions_sections do |t|
t.string :name
t.text :description
t.references :project, :index => true
t.string :section_type
t.integer :position
end
add_index :questions_sections, :position
end
end

View File

@ -0,0 +1,35 @@
# This file is a part of Redmine Q&A (redmine_questions) plugin,
# Q&A plugin for Redmine
#
# Copyright (C) 2011-2022 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 CreateQuestionsAnswers < Rails.version < '5.1' ? ActiveRecord::Migration : ActiveRecord::Migration[4.2]
def change
create_table :questions_answers do |t|
t.text :content
t.references :author, :index => true
t.references :question, :index => true
t.boolean :accepted, :default => false
t.integer :cached_weighted_score, :default => 0
t.integer :comments_count, :default => 0
t.datetime :created_on
t.datetime :updated_on
end
add_index :questions_answers, :accepted
end
end

View File

@ -0,0 +1,32 @@
# This file is a part of Redmine Q&A (redmine_questions) plugin,
# Q&A plugin for Redmine
#
# Copyright (C) 2011-2022 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 CreateQuestionsStatuses < Rails.version < '5.1' ? ActiveRecord::Migration : ActiveRecord::Migration[4.2]
def change
create_table :questions_statuses do |t|
t.string :name
t.boolean :is_closed, :default => false
t.string :color
t.integer :position
end
add_index :questions_statuses, :is_closed
add_index :questions_statuses, :position
end
end

58
doc/CHANGELOG Executable file
View File

@ -0,0 +1,58 @@
== Redmine Q&A plugin changelog
Redmine Q&A plugin
Copyright (C) 2011-2022 RedmineUP
https://www.redmineup.com/
== 2022-04-11 v1.0.3
* Added German locale
* Added Italian locale
* Updated zh-tw locale
* Fixed wrong JS path
* Redmine 5.0 compatibility
== 2020-03-03 v1.0.2
* Redmine 4.1 support
* Fixed section position bug
* Fixed MSSQL group by bug
* Fixed "Help & Support" page layout
== 2019-08-23 v1.0.1
* Accept answer links
* Edit own answers permission
* Redmine 4 support
* Fixed sorting by unanswered question not working
* Fixed project variable dismissed
* Fixed status creating bug
* Fixed preview link, empty project bug
* Fixed boards migration bug
== 2018-08-31 v1.0.0
* Separate models for questions, answers and comments
* Voting for questions and answers
* Comments for questions and asnwers
* Section types: Question, Idea, Solution
* Different main page styles
* Answered question status
* Idea statutes
* Chinese translation (zhoutt)
== 2014-02-04 v0.0.6
* Redmine 2.4 support
* View count fixes for topic
* Topic count fixed in boards view
== 2013-05-28 v0.0.5
* Redmine 2.3 support
* Search by all words
== 2013-01-20 v0.0.3
* Redmine 2.2.0 support
* License files

339
doc/COPYING Normal file
View File

@ -0,0 +1,339 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program 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 2 of the License, or
(at your option) any later version.
This program 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 this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.

26
doc/LICENSE Normal file
View File

@ -0,0 +1,26 @@
LICENSING
RedmineUP Licencing
This End User License Agreement is a binding legal agreement between you and RedmineUP. Purchase, installation or use of RedmineUP Extensions provided on redmineup.com signifies that you have read, understood, and agreed to be bound by the terms outlined below.
RedmineUP GPL Licencing
All Redmine Extensions produced by RedmineUP are released under the GNU General Public License, version 2 (http://www.gnu.org/licenses/gpl-2.0.html). Specifically, the Ruby code portions are distributed under the GPL license. If not otherwise stated, all images, manuals, cascading style sheets, and included JavaScript are NOT GPL, and are released under the RedmineUP Proprietary Use License v1.0 (See below) unless specifically authorized by RedmineUP. Elements of the extensions released under this proprietary license may not be redistributed or repackaged for use other than those allowed by the Terms of Service.
RedmineUP Proprietary Use License (v1.0)
The RedmineUP Proprietary Use License covers any images, cascading stylesheets, manuals and JavaScript files in any extensions produced and/or distributed by redmineup.com. These files are copyrighted by redmineup.com (RedmineUP) and cannot be redistributed in any form without prior consent from redmineup.com (RedmineUP)
Usage Terms
You are allowed to use the Extensions on one or many "production" domains, depending on the type of your license
You are allowed to make any changes to the code, however modified code will not be supported by us.
Modification Of Extensions Produced By RedmineUP.
You are authorized to make any modification(s) to RedmineUP extension Ruby code. However, if you change any Ruby code and it breaks functionality, support may not be available to you.
In accordance with the RedmineUP Proprietary Use License v1.0, you may not release any proprietary files (modified or otherwise) under the GPL license. The terms of this license and the GPL v2 prohibit the removal of the copyright information from any file.
Please contact us if you have any requirements that are not covered by these terms.

72
init.rb Normal file
View File

@ -0,0 +1,72 @@
# This file is a part of Redmine Q&A (redmine_questions) plugin,
# Q&A plugin for Redmine
#
# Copyright (C) 2011-2022 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/>.
requires_redmine_crm version_or_higher: '0.0.56'
QA_VERSION_NUMBER = '1.0.3'
QA_VERSION_TYPE = "Light version"
Redmine::Plugin.register :redmine_questions do
name "Redmine Q&A plugin (#{QA_VERSION_TYPE})"
author 'RedmineUP'
description 'This is a Q&A plugin for Redmine'
version QA_VERSION_NUMBER
url 'https://www.redmineup.com/pages/plugins/questions'
author_url 'mailto:support@redmineup.com'
requires_redmine :version_or_higher => '3.0'
delete_menu_item(:top_menu, :help)
menu :top_menu, :questions, {controller: 'questions_sections', action: 'index', project_id: nil},
caption: :label_questions,
if: Proc.new {User.current.allowed_to?({controller: 'questions_sections', action: 'index'}, nil, {global: true})}
menu :project_menu, :questions, {controller: 'questions_sections', action: 'index'},
param: :project_id
project_module :questions do
permission :add_questions, { questions: [:create, :new, :preview, :update_form] }
permission :edit_questions, { questions: [:edit, :update, :preview, :update_form], questions_answers: [:edit, :update, :preview] }, require: :loggedin
permission :edit_own_questions, {questions: [:edit, :update, :preview, :update_form]}, require: :loggedin
permission :edit_own_answers, {questions_answers: [:edit, :update, :preview]}, require: :loggedin
permission :add_answers, { questions_answers: [:create, :show, :new, :edit, :update, :preview] }
permission :view_questions, { questions: [:index, :show, :autocomplete_for_subject], questions_sections: [:index] }, read: true
permission :delete_questions, { questions: [:destroy] }, require: :loggedin
permission :delete_answers, { questions_answers: [:destroy] }, require: :loggedin
permission :vote_questions, { questions_votes: [:create] }
permission :accept_answers, { questions_answers: [:update] }, require: :loggedin
permission :comment_question, { questions_comments: [:create] }
permission :edit_question_comments, { questions_comments: [:update, :destroy, :edit] }, require: :loggedin
permission :edit_own_question_comments, { questions_comments: [:update, :destroy, :edit] }, require: :loggedin
permission :manage_sections, { projects: :settings, questions_sections: [:create, :new, :edit, :update] }, require: :loggedin
permission :create_tags, {}
end
activity_provider :questions, default: false, class_name: ['Question', 'QuestionsAnswer']
Redmine::Search.map do |search|
search.register :questions
end
end
if Rails.configuration.respond_to?(:autoloader) && Rails.configuration.autoloader == :zeitwerk
Rails.autoloaders.each { |loader| loader.ignore(File.dirname(__FILE__) + '/lib') }
end
require File.dirname(__FILE__) + '/lib/redmine_questions'

View File

@ -0,0 +1,28 @@
# This file is a part of Redmine Q&A (redmine_questions) plugin,
# Q&A plugin for Redmine
#
# Copyright (C) 2011-2022 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/>.
# $LOAD_PATH.unshift(File.dirname(__FILE__))
# require "lib/acts_as_viewable"
# $LOAD_PATH.shift
require File.dirname(__FILE__) + '/lib/acts_as_attachable_questions'
unless ActiveRecord::Base.included_modules.include?(Redmine::Acts::AttachableQuestions)
ActiveRecord::Base.send(:include, Redmine::Acts::AttachableQuestions)
end

View File

@ -0,0 +1,108 @@
# This file is a part of Redmine Q&A (redmine_questions) plugin,
# Q&A plugin for Redmine
#
# Copyright (C) 2011-2022 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/>.
module Redmine
module Acts
module AttachableQuestions
def self.included(base)
base.extend ClassMethods
end
module ClassMethods
def acts_as_attachable_questions(options = {})
if Redmine::VERSION.to_s >= '3.0'
has_many :attachments, lambda { order("#{Attachment.table_name}.created_on") }, as: :container, dependent: :destroy
else
has_many :attachments, options.merge(:as => :container,
:order => "#{Attachment.table_name}.created_on",
:dependent => :destroy)
end
send :include, Redmine::Acts::AttachableQuestions::InstanceMethods
before_save :attach_saved_attachments
end
end
module InstanceMethods
def self.included(base)
base.extend ClassMethods
end
def attachments_visible?(user = User.current)
respond_to?(:visible?) ? visible?(user) : true
end
def attachments_editable?(user = User.current)
(respond_to?(:visible?) ? visible?(user) : true) &&
(user.allowed_to?(:manage_sections, project, :global => true) ||
user.allowed_to?(:add_questions, project, :global => true))
end
def attachments_deletable?(user = User.current)
(respond_to?(:visible?) ? visible?(user) : true) &&
(user.allowed_to?(:delete_questions, project, :global => true) ||
user.allowed_to?(:add_questions, project, :global => true))
end
def saved_attachments
@saved_attachments ||= []
end
def unsaved_attachments
@unsaved_attachments ||= []
end
def save_attachments(attachments, author = User.current)
attachments = attachments.to_unsafe_hash if attachments.respond_to?(:to_unsafe_hash)
attachments = attachments.values if attachments.is_a?(Hash)
if attachments.is_a?(Array)
attachments.each do |attachment|
a = nil
if file = attachment['file']
next unless file.size > 0
a = Attachment.create(:file => file, :author => author)
elsif token = attachment['token']
a = Attachment.find_by_token(token)
next unless a
a.filename = attachment['filename'] unless attachment['filename'].blank?
a.content_type = attachment['content_type']
end
next unless a
a.description = attachment['description'].to_s.strip
if a.new_record?
unsaved_attachments << a
else
saved_attachments << a
end
end
end
{ :files => saved_attachments, :unsaved => unsaved_attachments }
end
def attach_saved_attachments
saved_attachments.each do |attachment|
attachments << attachment
end
end
module ClassMethods
end
end
end
end
end

36
lib/redmine_questions.rb Normal file
View File

@ -0,0 +1,36 @@
# This file is a part of Redmine Q&A (redmine_questions) plugin,
# Q&A plugin for Redmine
#
# Copyright (C) 2011-2022 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/>.
module RedmineQuestions
end
REDMINE_QUESTIONS_REQUIRED_FILES = [
'redmine_questions/hooks/views_layouts_hook',
'redmine_questions/patches/user_patch',
'redmine_questions/patches/project_patch',
'redmine_questions/patches/notifiable_patch',
'redmine_questions/patches/mailer_patch',
'redmine_questions/patches/projects_helper_patch',
'redmine_questions/patches/auto_completes_controller_patch',
'redmine_questions/patches/comment_patch',
'acts_as_attachable_questions/init'
]
base_url = File.dirname(__FILE__)
REDMINE_QUESTIONS_REQUIRED_FILES.each { |file| require(base_url + '/' + file) }

Some files were not shown because too many files have changed in this diff Show More