Merge pull request #40 from davidtaylorhq/icon_on_unsolved

Added empty box icon to unsolved topics
This commit is contained in:
Sam 2017-02-27 16:29:38 -05:00 committed by GitHub
commit d4348f4581
5 changed files with 23 additions and 1 deletions

View File

@ -223,6 +223,13 @@ export default {
title: I18n.t('solved.has_accepted_answer'),
icon: 'check-square-o'
});
}else if(this.topic.can_have_answer && this.siteSettings.solved_enabled && this.siteSettings.empty_box_on_unsolved){
results.push({
openTag: 'span',
closeTag: 'span',
title: I18n.t('solved.has_no_accepted_answer'),
icon: 'square-o'
});
}
return results;
}.property()

View File

@ -5,6 +5,7 @@ en:
allow_accepted_answers: "Allow topic owner and staff to mark a reply as the solution"
accept_answer: "This reply solves the problem"
has_accepted_answer: "This topic has a solution"
has_no_accepted_answer: "This topic has no solution"
unaccept_answer: "This reply no longer solves the problem"
accepted_answer: "Solution"
solution: "Solution"

View File

@ -3,6 +3,7 @@ en:
solved_enabled: "Enable solved plugin, allow users to select solutions for topics"
allow_solved_on_all_topics: "Allow users to select solutions on all topics (by default you control this by editing categories)"
accept_all_solutions_trust_level: "Minimum trust level required to accept solutions on any topic (even when not OP)"
empty_box_on_unsolved: "Display an empty box next to unsolved topics"
reports:
accepted_solutions:
title: "Accepted solutions"

View File

@ -8,3 +8,6 @@ plugins:
accept_all_solutions_trust_level:
default: 4
client: true
empty_box_on_unsolved:
default: false
client: true

View File

@ -363,11 +363,21 @@ SQL
require_dependency 'topic_list_item_serializer'
class ::TopicListItemSerializer
attributes :has_accepted_answer
attributes :has_accepted_answer, :can_have_answer
def has_accepted_answer
object.custom_fields["accepted_answer_post_id"] ? true : false
end
def can_have_answer
return true if SiteSetting.allow_solved_on_all_topics
return scope.allow_accepted_answers_on_category?(object.category_id)
end
def include_can_have_answer?
SiteSetting.empty_box_on_unsolved
end
end
TopicList.preloaded_custom_fields << "accepted_answer_post_id" if TopicList.respond_to? :preloaded_custom_fields