mirror of
				https://github.com/discourse/discourse-solved.git
				synced 2025-10-30 22:18:42 +00:00 
			
		
		
		
	Merge pull request #40 from davidtaylorhq/icon_on_unsolved
Added empty box icon to unsolved topics
This commit is contained in:
		
						commit
						d4348f4581
					
				| @ -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() | ||||
|  | ||||
| @ -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" | ||||
|  | ||||
| @ -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" | ||||
|  | ||||
| @ -8,3 +8,6 @@ plugins: | ||||
|   accept_all_solutions_trust_level: | ||||
|     default: 4 | ||||
|     client: true | ||||
|   empty_box_on_unsolved: | ||||
|     default: false | ||||
|     client: true | ||||
|  | ||||
							
								
								
									
										12
									
								
								plugin.rb
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								plugin.rb
									
									
									
									
									
								
							| @ -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 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user