Import archive redmine_questions-1_0_7-light

This commit is contained in:
Alexandr Antonov
2025-03-12 11:56:28 +03:00
parent 86496b2533
commit 8ab8fed0ff
58 changed files with 177 additions and 165 deletions

View File

@ -1,26 +0,0 @@
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("3.2.2", "mysql", "pro", "trunk", ""),
Pipeline("3.2.2", "pg", "pro", "5.1", ""),
Pipeline("3.0.6", "mysql", "pro", "5.0", "redmineup_tags"),
Pipeline("2.7.8", "mysql", "light", "4.2", ""),
Pipeline("2.7.8", "pg", "pro", "4.2", ""),
Pipeline("2.3.8", "mysql", "pro", "4.0", ""),
Pipeline("2.3.8", "pg", "pro", "4.0", "")
]

View File

@ -1,7 +1,7 @@
# This file is a part of Redmine Q&A (redmine_questions) plugin,
# Q&A plugin for Redmine
#
# Copyright (C) 2011-2024 RedmineUP
# Copyright (C) 2011-2025 RedmineUP
# http://www.redmineup.com/
#
# redmine_questions is free software: you can redistribute it and/or modify

View File

@ -1,7 +1,7 @@
# This file is a part of Redmine Q&A (redmine_questions) plugin,
# Q&A plugin for Redmine
#
# Copyright (C) 2011-2024 RedmineUP
# Copyright (C) 2011-2025 RedmineUP
# http://www.redmineup.com/
#
# redmine_questions is free software: you can redistribute it and/or modify

View File

@ -1,7 +1,7 @@
# This file is a part of Redmine Q&A (redmine_questions) plugin,
# Q&A plugin for Redmine
#
# Copyright (C) 2011-2024 RedmineUP
# Copyright (C) 2011-2025 RedmineUP
# http://www.redmineup.com/
#
# redmine_questions is free software: you can redistribute it and/or modify

View File

@ -1,7 +1,7 @@
# This file is a part of Redmine Q&A (redmine_questions) plugin,
# Q&A plugin for Redmine
#
# Copyright (C) 2011-2024 RedmineUP
# Copyright (C) 2011-2025 RedmineUP
# http://www.redmineup.com/
#
# redmine_questions is free software: you can redistribute it and/or modify

View File

@ -1,7 +1,7 @@
# This file is a part of Redmine Q&A (redmine_questions) plugin,
# Q&A plugin for Redmine
#
# Copyright (C) 2011-2024 RedmineUP
# Copyright (C) 2011-2025 RedmineUP
# http://www.redmineup.com/
#
# redmine_questions is free software: you can redistribute it and/or modify

View File

@ -3,7 +3,7 @@
# This file is a part of Redmine Q&A (redmine_questions) plugin,
# Q&A plugin for Redmine
#
# Copyright (C) 2011-2024 RedmineUP
# Copyright (C) 2011-2025 RedmineUP
# http://www.redmineup.com/
#
# redmine_questions is free software: you can redistribute it and/or modify
@ -22,7 +22,7 @@
module QuestionsHelper
def question_status_tag(status, editable=false)
return '' unless status
content_tag(:span, status.name, class: "status-badge #{'editable' if editable}",
content_tag(:span, status.name, class: "question-status-badge #{'editable' if editable}",
style: "color:#{status.color};border: 1px solid #{status.color};")
end
@ -48,5 +48,4 @@ module QuestionsHelper
return project_questions_sections_path if @project
questions_sections_path
end
end

View File

@ -1,7 +1,7 @@
# This file is a part of Redmine Q&A (redmine_questions) plugin,
# Q&A plugin for Redmine
#
# Copyright (C) 2011-2024 RedmineUP
# Copyright (C) 2011-2025 RedmineUP
# http://www.redmineup.com/
#
# redmine_questions is free software: you can redistribute it and/or modify
@ -38,7 +38,7 @@ class Question < ApplicationRecord
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')},
:type => Proc.new {|o| o.is_solution? ? 'solution': 'question'},
:description => :content,
:title => Proc.new {|o| o.subject }

View File

@ -1,7 +1,7 @@
# This file is a part of Redmine Q&A (redmine_questions) plugin,
# Q&A plugin for Redmine
#
# Copyright (C) 2011-2024 RedmineUP
# Copyright (C) 2011-2025 RedmineUP
# http://www.redmineup.com/
#
# redmine_questions is free software: you can redistribute it and/or modify
@ -30,7 +30,7 @@ class QuestionsAnswer < ApplicationRecord
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'},
:type => 'reply',
:description => :content,
:title => Proc.new {|o| o.question.subject }

View File

@ -1,7 +1,7 @@
# This file is a part of Redmine Q&A (redmine_questions) plugin,
# Q&A plugin for Redmine
#
# Copyright (C) 2011-2024 RedmineUP
# Copyright (C) 2011-2025 RedmineUP
# http://www.redmineup.com/
#
# redmine_questions is free software: you can redistribute it and/or modify

View File

@ -1,7 +1,7 @@
# This file is a part of Redmine Q&A (redmine_questions) plugin,
# Q&A plugin for Redmine
#
# Copyright (C) 2011-2024 RedmineUP
# Copyright (C) 2011-2025 RedmineUP
# http://www.redmineup.com/
#
# redmine_questions is free software: you can redistribute it and/or modify

View File

@ -1,7 +1,7 @@
# This file is a part of Redmine Q&A (redmine_questions) plugin,
# Q&A plugin for Redmine
#
# Copyright (C) 2011-2024 RedmineUP
# Copyright (C) 2011-2025 RedmineUP
# http://www.redmineup.com/
#
# redmine_questions is free software: you can redistribute it and/or modify

View File

@ -22,7 +22,7 @@
<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' %>
<%= link_to sprite_icon('edit', 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>
@ -35,7 +35,7 @@
<% 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) %>
<%= link_to sprite_icon('add', l(:label_questions_section_new)), new_questions_section_path(project_id: @project), class: 'icon icon-add'%>
<% end %>
<%= javascript_tag do %>

View File

@ -16,7 +16,7 @@
});
});
<% end %>
<%= link_to(image_tag('add.png', :style => 'vertical-align: middle;'),
<%= link_to(sprite_icon('add', css_class: 'icon-cf-value-add') || 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',

View File

@ -1,14 +1,13 @@
<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(sprite_icon("edit", 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)
<%= link_to(sprite_icon("del", 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>
<h2 class="question-title"><%=h @question_item.subject %></h2>
<%= render :partial => 'question_item', :object => @question_item %>
<% if @question_item.section.allow_answering? %>
<div id="answers">
<% if @answers.any? %>
@ -34,11 +33,12 @@
<% content_for :sidebar do %>
<h3><%= l(:label_questions_message) %></h3>
<ul class="question-meta">
<li class="views icon icon-view">
<div class="question-meta">
<div class="views icon icon-view">
<%= sprite_icon("view", plugin: :redmine_questions) %>
<%= l(:label_questions_views, :count => @question_item.views ) %>
</li>
</ul>
</div>
</div>
<% if @question_item.convertable_by?(User.current) && User.current.allowed_to?(:add_issues, @project) %>
<h3><%= l(:label_questions_actions) %></h3>

View File

@ -26,9 +26,13 @@
<p><%= Question.to_text(textilizable(truncate(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>
<li class="answers icon icon-comment">
<%= sprite_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>
<li class="views icon icon-view">
<%= sprite_icon("view", plugin: :redmine_questions) %>
<%= l(:label_questions_views, :count => question.views ) %></li>
</ul>
</div>
</div>

View File

@ -13,7 +13,7 @@
<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>
<li class="answers icon icon-comment"><%= sprite_icon("comment") + l(:label_questions_answers, :count => topic.replies_count) %></li>
</ul>
</div>
<% end %>

View File

@ -1,10 +1,10 @@
<% html_title l(:label_questions) %>
<div class="questions" >
<div class="contextual">
<%= link_to(l(:label_questions_new),
<%= link_to(sprite_icon("add", 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),
<%= link_to(sprite_icon("edit", 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>

View File

@ -1,11 +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') %>
<%= link_to(sprite_icon("edit", 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') %>
<%= link_to(sprite_icon('accept', l(:label_questions_accept), plugin: :redmine_questions), 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') %>
<%= link_to(sprite_icon('discard', l(:label_questions_discard), plugin: :redmine_questions), 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)
<%= link_to(sprite_icon("del", 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

@ -2,14 +2,14 @@
<div class="comment" id="comment_<%= comment.id %>">
<div class="contextual">
<%= link_to(
"",
sprite_icon("edit"),
{: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 allowed_to_edit
%>
<%= link_to(
"",
sprite_icon("del"),
{: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,

View File

@ -1,5 +1,5 @@
<% 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' %>
<%= link_to sprite_icon("comment", 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">

View File

@ -1,6 +1,6 @@
<% html_title l(:label_questions) %>
<div class="contextual">
<%= link_to(l(:label_questions_new),
<%= link_to(sprite_icon("add", l(:label_questions_new)),
{:controller => 'questions', :action => 'new', :section_id => @section},
:class => 'icon icon-add') if User.current.allowed_to?(:add_questions, @project) %>
</div>

30
assets/images/icons.svg Normal file
View File

@ -0,0 +1,30 @@
<?xml version="1.0"?>
<svg xmlns="http://www.w3.org/2000/svg" class="icon--sprite">
<defs>
<symbol viewBox="0 0 24 24" stroke-linecap="round" stroke-linejoin="round" id="icon--accept">
<path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"/>
<path d="M9 12l2 2l4 -4"/>
</symbol>
<symbol viewBox="0 0 24 24" id="icon--discard">
<path d="M17 3.34a10 10 0 1 1 -14.995 8.984l-.005 -.324l.005 -.324a10 10 0 0 1 14.995 -8.336zm-1.293 5.953a1 1 0 0 0 -1.32 -.083l-.094 .083l-3.293 3.292l-1.293 -1.292l-.094 -.083a1 1 0 0 0 -1.403 1.403l.083 .094l2 2l.094 .083a1 1 0 0 0 1.226 0l.094 -.083l4 -4l.083 -.094a1 1 0 0 0 -.083 -1.32z"/>
</symbol>
<symbol viewBox="0 0 24 24" stroke-linecap="round" stroke-linejoin="round" id="icon--question">
<path d="M8 9h8"/>
<path d="M8 13h6"/>
<path d="M14 18h-1l-5 3v-3h-2a3 3 0 0 1 -3 -3v-8a3 3 0 0 1 3 -3h12a3 3 0 0 1 3 3v4.5"/>
<path d="M19 22v.01"/>
<path d="M19 19a2.003 2.003 0 0 0 .914 -3.782a1.98 1.98 0 0 0 -2.414 .483"/>
</symbol>
<symbol viewBox="0 0 24 24" stroke-linecap="round" stroke-linejoin="round" id="icon--tag">
<path d="M7.5 7.5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"/>
<path d="M3 6v5.172a2 2 0 0 0 .586 1.414l7.71 7.71a2.41 2.41 0 0 0 3.408 0l5.592 -5.592a2.41 2.41 0 0 0 0 -3.408l-7.71 -7.71a2 2 0 0 0 -1.414 -.586h-5.172a3 3 0 0 0 -3 3z"/>
</symbol>
<symbol viewBox="0 0 24 24" stroke-linecap="round" stroke-linejoin="round" id="icon--view">
<path d="M10 12a2 2 0 1 0 4 0a2 2 0 0 0 -4 0"/>
<path d="M21 12c-2.4 4 -5.4 6 -9 6c-3.6 0 -6.6 -2 -9 -6c2.4 -4 5.4 -6 9 -6c3.6 0 6.6 2 9 6"/>
</symbol>
<symbol viewBox="0 0 24 24" stroke-linecap="round" stroke-linejoin="round" id="icon--vote">
<path d="M7 11v8a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1v-7a1 1 0 0 1 1 -1h3a4 4 0 0 0 4 -4v-1a2 2 0 0 1 4 0v5h3a2 2 0 0 1 2 2l-1 5a2 3 0 0 1 -2 2h-7a3 3 0 0 1 -3 -3"/>
</symbol>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@ -281,11 +281,8 @@ div.question.votable .question-container .contextual {margin-top: 0px;}
padding: 0px;
}
#sidebar ul.question-meta li {
margin-bottom: 10px;
padding-left: 20px;
padding-top: 2px;
padding-bottom: 3px;
#sidebar .question-meta div.icon {
display: block;
}
#sidebar ul.related-topics li {
@ -411,13 +408,13 @@ div.question.votable .question-container .contextual {margin-top: 0px;}
/* 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); }
.icon-vote:not(:has(svg)) { background-image: url(../images/thumb_up.png); }
.icon-unvote:not(:has(svg)) { background-image: url(../images/unvote.png); }
.icon-downvote:not(:has(svg)) { background-image: url(../images/thumb_down.png); }
.icon-view:not(:has(svg)) { background-image: url(../images/eye.png); }
.icon-calendar:not(:has(svg)) { background-image: url(/images/calendar.png); }
.icon-tag:not(:has(svg)) { background-image: url(../images/tag_blue.png); }
.icon-question:not(:has(svg)) { background-image: url(../../../images/help.png); }
.icon-solution:not(:has(svg)) { background-image: url(../images/book_open.png); }
.icon-accept:not(:has(svg)) { background-image: url(../images/accept.png); }
.icon-discard:not(:has(svg)) { background-image: url(../images/discard.png); }

13
config/icon_source.yml Normal file
View File

@ -0,0 +1,13 @@
- name: view
svg: eye
- name: tag
svg: tag
- name: vote
svg: thumb-up
- name: question
svg: message-question
- name: accept
svg: circle-check
- name: discard
svg: circle-check
style: filled

View File

@ -1,7 +1,7 @@
# This file is a part of Redmine Q&A (redmine_questions) plugin,
# Q&A plugin for Redmine
#
# Copyright (C) 2011-2024 RedmineUP
# Copyright (C) 2011-2025 RedmineUP
# http://www.redmineup.com/
#
# redmine_questions is free software: you can redistribute it and/or modify

View File

@ -1,7 +1,7 @@
# This file is a part of Redmine Q&A (redmine_questions) plugin,
# Q&A plugin for Redmine
#
# Copyright (C) 2011-2024 RedmineUP
# Copyright (C) 2011-2025 RedmineUP
# http://www.redmineup.com/
#
# redmine_questions is free software: you can redistribute it and/or modify

View File

@ -1,7 +1,7 @@
# This file is a part of Redmine Q&A (redmine_questions) plugin,
# Q&A plugin for Redmine
#
# Copyright (C) 2011-2024 RedmineUP
# Copyright (C) 2011-2025 RedmineUP
# http://www.redmineup.com/
#
# redmine_questions is free software: you can redistribute it and/or modify

View File

@ -1,7 +1,7 @@
# This file is a part of Redmine Q&A (redmine_questions) plugin,
# Q&A plugin for Redmine
#
# Copyright (C) 2011-2024 RedmineUP
# Copyright (C) 2011-2025 RedmineUP
# http://www.redmineup.com/
#
# redmine_questions is free software: you can redistribute it and/or modify

View File

@ -1,7 +1,7 @@
# This file is a part of Redmine Q&A (redmine_questions) plugin,
# Q&A plugin for Redmine
#
# Copyright (C) 2011-2024 RedmineUP
# Copyright (C) 2011-2025 RedmineUP
# http://www.redmineup.com/
#
# redmine_questions is free software: you can redistribute it and/or modify

View File

@ -1,7 +1,7 @@
# This file is a part of Redmine Q&A (redmine_questions) plugin,
# Q&A plugin for Redmine
#
# Copyright (C) 2011-2024 RedmineUP
# Copyright (C) 2011-2025 RedmineUP
# http://www.redmineup.com/
#
# redmine_questions is free software: you can redistribute it and/or modify

View File

@ -1,7 +1,7 @@
# This file is a part of Redmine Q&A (redmine_questions) plugin,
# Q&A plugin for Redmine
#
# Copyright (C) 2011-2024 RedmineUP
# Copyright (C) 2011-2025 RedmineUP
# http://www.redmineup.com/
#
# redmine_questions is free software: you can redistribute it and/or modify

View File

@ -1,7 +1,7 @@
# This file is a part of Redmine Q&A (redmine_questions) plugin,
# Q&A plugin for Redmine
#
# Copyright (C) 2011-2024 RedmineUP
# Copyright (C) 2011-2025 RedmineUP
# http://www.redmineup.com/
#
# redmine_questions is free software: you can redistribute it and/or modify

View File

@ -1,9 +1,22 @@
== Redmine Q&A plugin changelog
Redmine Q&A plugin
Copyright (C) 2011-2024 Kirill Bezrukov (RedmineUP)
Copyright (C) 2011-2025 Kirill Bezrukov (RedmineUP)
https://www.redmineup.com/
== 2025-03-11 v1.0.7
* Fixed duplicate answers
* Fixed delete link label
* Fixed add section icon to svg
* Fixed sidebar views, votes and tags styles
== 2025-03-03 v1.0.6
* Added svg icons for compatibility with Redmine 6
* Fixed question-status-badge styles
* Fixed loading helper method
== 2024-02-15 v1.0.5
* Dropped Redmine 3 support

View File

@ -1,7 +1,7 @@
# This file is a part of Redmine Q&A (redmine_questions) plugin,
# Q&A plugin for Redmine
#
# Copyright (C) 2011-2024 RedmineUP
# Copyright (C) 2011-2025 RedmineUP
# http://www.redmineup.com/
#
# redmine_questions is free software: you can redistribute it and/or modify
@ -17,9 +17,9 @@
# 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_redmineup version_or_higher: '1.0.5' rescue raise "\n\033[31mRedmine requires newer redmineup gem version.\nPlease update with 'bundle update redmineup'.\033[0m"
requires_redmineup version_or_higher: '1.0.10' rescue raise "\n\033[31mRedmine requires newer redmineup gem version.\nPlease update with 'bundle update redmineup'.\033[0m"
QA_VERSION_NUMBER = '1.0.5'
QA_VERSION_NUMBER = '1.0.7'
QA_VERSION_TYPE = "Light version"
Redmine::Plugin.register :redmine_questions do
@ -30,7 +30,7 @@ Redmine::Plugin.register :redmine_questions do
url 'https://www.redmineup.com/pages/plugins/questions'
author_url 'mailto:support@redmineup.com'
requires_redmine :version_or_higher => '4.0'
requires_redmine version_or_higher: '4.0'
delete_menu_item(:top_menu, :help)
@ -70,3 +70,4 @@ if Rails.configuration.respond_to?(:autoloader) && Rails.configuration.autoloade
Rails.autoloaders.each { |loader| loader.ignore(File.dirname(__FILE__) + '/lib') }
end
require File.dirname(__FILE__) + '/lib/redmine_questions'
require 'redmineup/patches/compatibility_patch'

View File

@ -1,7 +1,7 @@
# This file is a part of Redmine Q&A (redmine_questions) plugin,
# Q&A plugin for Redmine
#
# Copyright (C) 2011-2024 RedmineUP
# Copyright (C) 2011-2025 RedmineUP
# http://www.redmineup.com/
#
# redmine_questions is free software: you can redistribute it and/or modify

View File

@ -1,7 +1,7 @@
# This file is a part of Redmine Q&A (redmine_questions) plugin,
# Q&A plugin for Redmine
#
# Copyright (C) 2011-2024 RedmineUP
# Copyright (C) 2011-2025 RedmineUP
# http://www.redmineup.com/
#
# redmine_questions is free software: you can redistribute it and/or modify

View File

@ -1,7 +1,7 @@
# This file is a part of Redmine Q&A (redmine_questions) plugin,
# Q&A plugin for Redmine
#
# Copyright (C) 2011-2024 RedmineUP
# Copyright (C) 2011-2025 RedmineUP
# http://www.redmineup.com/
#
# redmine_questions is free software: you can redistribute it and/or modify

View File

@ -1,7 +1,7 @@
# This file is a part of Redmine Q&A (redmine_questions) plugin,
# Q&A plugin for Redmine
#
# Copyright (C) 2011-2024 RedmineUP
# Copyright (C) 2011-2025 RedmineUP
# http://www.redmineup.com/
#
# redmine_questions is free software: you can redistribute it and/or modify

View File

@ -1,7 +1,7 @@
# This file is a part of Redmine Q&A (redmine_questions) plugin,
# Q&A plugin for Redmine
#
# Copyright (C) 2011-2024 RedmineUP
# Copyright (C) 2011-2025 RedmineUP
# http://www.redmineup.com/
#
# redmine_questions is free software: you can redistribute it and/or modify

View File

@ -1,7 +1,7 @@
# This file is a part of Redmine Q&A (redmine_questions) plugin,
# Q&A plugin for Redmine
#
# Copyright (C) 2011-2024 RedmineUP
# Copyright (C) 2011-2025 RedmineUP
# http://www.redmineup.com/
#
# redmine_questions is free software: you can redistribute it and/or modify

View File

@ -1,7 +1,7 @@
# This file is a part of Redmine Q&A (redmine_questions) plugin,
# Q&A plugin for Redmine
#
# Copyright (C) 2011-2024 RedmineUP
# Copyright (C) 2011-2025 RedmineUP
# http://www.redmineup.com/
#
# redmine_questions is free software: you can redistribute it and/or modify

View File

@ -1,7 +1,7 @@
# This file is a part of Redmine Q&A (redmine_questions) plugin,
# Q&A plugin for Redmine
#
# Copyright (C) 2011-2024 RedmineUP
# Copyright (C) 2011-2025 RedmineUP
# http://www.redmineup.com/
#
# redmine_questions is free software: you can redistribute it and/or modify

View File

@ -1,7 +1,7 @@
# This file is a part of Redmine Q&A (redmine_questions) plugin,
# Q&A plugin for Redmine
#
# Copyright (C) 2011-2024 RedmineUP
# Copyright (C) 2011-2025 RedmineUP
# http://www.redmineup.com/
#
# redmine_questions is free software: you can redistribute it and/or modify

View File

@ -1,7 +1,7 @@
# This file is a part of Redmine Q&A (redmine_questions) plugin,
# Q&A plugin for Redmine
#
# Copyright (C) 2011-2024 RedmineUP
# Copyright (C) 2011-2025 RedmineUP
# http://www.redmineup.com/
#
# redmine_questions is free software: you can redistribute it and/or modify

View File

@ -1,7 +1,7 @@
# This file is a part of Redmine Q&A (redmine_questions) plugin,
# Q&A plugin for Redmine
#
# Copyright (C) 2011-2024 RedmineUP
# Copyright (C) 2011-2025 RedmineUP
# http://www.redmineup.com/
#
# redmine_questions is free software: you can redistribute it and/or modify

View File

@ -1,17 +0,0 @@
_fixture:
model_class: Comment
comment_001:
content: text for cooment 001
commented_type: Question
commented_id: 1
author_id: 1
comment_002:
content: text for cooment 002
commented_type: Question
commented_id: 2
author_id: 1
comment_003:
content: text for cooment 003 (comment for answer!)
commented_type: Question
commented_id: 5
author_id: 1

View File

@ -1,16 +1,18 @@
comment_001:
comments: text for cooment 001
id: 1
content: text for comment 001
commented_type: Question
commented_id: 1
author_id: 1
comment_002:
comments: text for cooment 002
id: 2
content: text for comment 002
commented_type: Question
commented_id: 2
author_id: 1
comment_003:
comments: text for cooment 003 (comment for answer!)
id: 3
content: text for comment 003 (comment for answer!)
commented_type: Question
commented_id: 5
author_id: 1
author_id: 1

View File

@ -3,7 +3,7 @@
# This file is a part of Redmine Q&A (redmine_questions) plugin,
# Q&A plugin for Redmine
#
# Copyright (C) 2011-2024 RedmineUP
# Copyright (C) 2011-2025 RedmineUP
# http://www.redmineup.com/
#
# redmine_questions is free software: you can redistribute it and/or modify
@ -68,7 +68,7 @@ class QuestionsAnswersControllerTest < ActionController::TestCase
end
end
answer = QuestionsAnswer.order(:created_on).last
answer = QuestionsAnswer.order(:created_on).reload.last
mail = ActionMailer::Base.deliveries.last
assert_not_nil mail
@ -86,18 +86,18 @@ class QuestionsAnswersControllerTest < ActionController::TestCase
def test_preview_new_answer
@request.session[:user_id] = 1
answer = questions_answers(:answer_002)
compatible_xhr_request :post, :preview,
compatible_xhr_request :post, :preview,
:answer => {
:content => "Previewed answer",
}
assert_response :success
assert_select 'p', :text => 'Previewed answer'
end
def test_preview_edited_answer
@request.session[:user_id] = 1
answer = questions_answers(:answer_002)
compatible_xhr_request :post, :preview, :id => answer.id,
compatible_xhr_request :post, :preview, :id => answer.id,
:answer => {
:content => "Previewed answer 1",
}
@ -112,9 +112,9 @@ class QuestionsAnswersControllerTest < ActionController::TestCase
assert_difference 'QuestionsAnswer.count', -1 do
compatible_request :post, :destroy, :id => answer.id
end
assert_redirected_to question_path(answer.question, :anchor => "questions_answer_#{answer.id}")
assert_redirected_to question_path(answer.question, :anchor => "questions_answer_#{answer.id}")
assert_nil QuestionsAnswer.find_by_id(answer.id)
end
end
def test_add_answer_to_locked_question
@request.session[:user_id] = 1
@ -122,7 +122,7 @@ class QuestionsAnswersControllerTest < ActionController::TestCase
assert_no_difference 'QuestionsAnswer.count' do
compatible_request :post, :create, :project_id => @project, :question_id => question.id,
:answer => { :content => 'Body of answer', :question_id => question.id }
end
end
end
def test_update_answer_with_mark_as_accepted_without_permission

View File

@ -3,7 +3,7 @@
# This file is a part of Redmine Q&A (redmine_questions) plugin,
# Q&A plugin for Redmine
#
# Copyright (C) 2011-2024 RedmineUP
# Copyright (C) 2011-2025 RedmineUP
# http://www.redmineup.com/
#
# redmine_questions is free software: you can redistribute it and/or modify

View File

@ -3,7 +3,7 @@
# This file is a part of Redmine Q&A (redmine_questions) plugin,
# Q&A plugin for Redmine
#
# Copyright (C) 2011-2024 RedmineUP
# Copyright (C) 2011-2025 RedmineUP
# http://www.redmineup.com/
#
# redmine_questions is free software: you can redistribute it and/or modify
@ -46,7 +46,7 @@ class QuestionsControllerTest < ActionController::TestCase
:email_addresses
RedmineQuestions::TestCase.create_fixtures(Redmine::Plugin.find(:redmine_questions).directory + '/test/fixtures/',
[:questions, :questions_answers, :questions_sections, :tags, :taggings, :comments])
[:questions, :questions_answers, :questions_sections, :questions_statuses, :tags, :taggings, :comments])
def setup
RedmineQuestions::TestCase.prepare
@ -193,7 +193,7 @@ class QuestionsControllerTest < ActionController::TestCase
@dev_role.permissions = @dev_role_permissions
@dev_role.save
end
def test_destroy
@request.session[:user_id] = 1
question = questions(:question_001)

View File

@ -3,7 +3,7 @@
# This file is a part of Redmine Q&A (redmine_questions) plugin,
# Q&A plugin for Redmine
#
# Copyright (C) 2011-2024 RedmineUP
# Copyright (C) 2011-2025 RedmineUP
# http://www.redmineup.com/
#
# redmine_questions is free software: you can redistribute it and/or modify

View File

@ -3,7 +3,7 @@
# This file is a part of Redmine Q&A (redmine_questions) plugin,
# Q&A plugin for Redmine
#
# Copyright (C) 2011-2024 RedmineUP
# Copyright (C) 2011-2025 RedmineUP
# http://www.redmineup.com/
#
# redmine_questions is free software: you can redistribute it and/or modify

View File

@ -3,7 +3,7 @@
# This file is a part of Redmine Q&A (redmine_questions) plugin,
# Q&A plugin for Redmine
#
# Copyright (C) 2011-2024 RedmineUP
# Copyright (C) 2011-2025 RedmineUP
# http://www.redmineup.com/
#
# redmine_questions is free software: you can redistribute it and/or modify

View File

@ -3,7 +3,7 @@
# This file is a part of Redmine Q&A (redmine_questions) plugin,
# Q&A plugin for Redmine
#
# Copyright (C) 2011-2024 RedmineUP
# Copyright (C) 2011-2025 RedmineUP
# http://www.redmineup.com/
#
# redmine_questions is free software: you can redistribute it and/or modify
@ -59,12 +59,7 @@ class RedmineQuestions::TestCase
end
def self.create_fixtures(fixtures_directory, table_names, class_names = {})
if Comment.column_names.include?('content')
table_names.map!{ |x| x.to_s.gsub('comments', 'comments-3.4.6').to_sym }
ActiveRecord::FixtureSet.create_fixtures(fixtures_directory, table_names, class_names = {})
else
ActiveRecord::FixtureSet.create_fixtures(fixtures_directory, table_names, class_names = {})
end
ActiveRecord::FixtureSet.create_fixtures(fixtures_directory, table_names, class_names = {})
end
def self.prepare

View File

@ -3,7 +3,7 @@
# This file is a part of Redmine Q&A (redmine_questions) plugin,
# Q&A plugin for Redmine
#
# Copyright (C) 2011-2024 RedmineUP
# Copyright (C) 2011-2025 RedmineUP
# http://www.redmineup.com/
#
# redmine_questions is free software: you can redistribute it and/or modify
@ -22,8 +22,8 @@
require File.expand_path('../../test_helper', __FILE__)
class QuestionTest < ActiveSupport::TestCase
fixtures :users,
:projects,
fixtures :users,
:projects,
:roles,
:members,
:member_roles,
@ -38,13 +38,13 @@ class QuestionTest < ActiveSupport::TestCase
:issue_categories,
:enabled_modules,
:workflows,
:questions,
:questions_answers,
:questions,
:questions_answers,
:questions_sections,
:email_addresses
RedmineQuestions::TestCase.create_fixtures(Redmine::Plugin.find(:redmine_questions).directory + '/test/fixtures/',
[:comments, :tags, :taggings])
RedmineQuestions::TestCase.create_fixtures(Redmine::Plugin.find(:redmine_questions).directory + '/test/fixtures/',
[:comments, :tags, :taggings ])
def setup
RedmineQuestions::TestCase.prepare
@ -125,22 +125,23 @@ class QuestionTest < ActiveSupport::TestCase
end
def test_related_questions
related_questons = Question.related(question(1), 2)
assert_equal 1, related_questons.size
related_questons.each do |rq|
related_questions = Question.related(question(1), 2)
assert_equal 1, related_questions.size
related_questions.each do |rq|
assert_match /question/, rq.subject
end
end
def test_add_comment
question = Question.find 1
comment = Comment.new(:comments => 'comment text', :author => users(:users_001))
assert question.comments << comment, 'Error with adding comment to question'
question.comments.reload
assert_equal question.comments.size, 2
question = Question.find(1)
comment = question.comments.build(comments: 'comment text', author: users(:users_001))
assert comment.valid?, 'Comment validation error'
assert comment.save, 'Comment saving error'
assert_equal 2, question.comments.reload.size
end
def test_commetable
def test_commentable
assert question(1).commentable?(users(:users_002)), "Question not commentable for user with permission"
assert !question(1).commentable?(users(:users_004)), "Question commentable for user without permission"
end

View File

@ -3,7 +3,7 @@
# This file is a part of Redmine Q&A (redmine_questions) plugin,
# Q&A plugin for Redmine
#
# Copyright (C) 2011-2024 RedmineUP
# Copyright (C) 2011-2025 RedmineUP
# http://www.redmineup.com/
#
# redmine_questions is free software: you can redistribute it and/or modify

View File

@ -3,7 +3,7 @@
# This file is a part of Redmine Q&A (redmine_questions) plugin,
# Q&A plugin for Redmine
#
# Copyright (C) 2011-2024 RedmineUP
# Copyright (C) 2011-2025 RedmineUP
# http://www.redmineup.com/
#
# redmine_questions is free software: you can redistribute it and/or modify