Permalink
Browse files

adds some UI for the compulsory answers

  • Loading branch information...
1 parent 040943a commit d3f4be252f976ce9d3437d6cb22a5b11edb30121 @thegcat committed Aug 8, 2010
View
2 app/controllers/doodles_controller.rb
@@ -93,7 +93,7 @@ def find_project
end
def find_doodle
- @doodle = Doodle.find(params[:id], :include => [:project, :author, :responses])
+ @doodle = Doodle.find(params[:id], :include => [:project, :author, :responses, :should_answer])
@project = @doodle.project
rescue ActiveRecord::RecordNotFound
render_404
View
4 app/models/doodle.rb
@@ -43,6 +43,10 @@ def visible?(user=User.current)
!user.nil? && user.allowed_to?(:view_doodles, project)
end
+ def users_missing_answer
+ @users_missing_answer ||= should_answer - responses.collect(&:author)
+ end
+
private
def sanitize_options
View
3 app/views/doodles/show.html.erb
@@ -13,6 +13,9 @@
<%= authoring @doodle.created_on, @doodle.author %>
</p>
<p><strong><%=l(:field_expiry_date)%></strong>: <%= format_date(@doodle.expiry_date) %></p>
+ <% unless @doodle.should_answer.empty? -%>
+ <p><strong><%=l(:field_missing_answers)%></strong>: <%= @doodle.users_missing_answer.size %> <%= "(#{@doodle.users_missing_answer.collect(&:name).join(", ")})" if User.current == @doodle.author && !@doodle.users_missing_answer.empty? %></p>
+ <% end -%>
<hr />
<p><strong><%=l(:field_description)%></strong></p>
<div class="wiki">
View
1 config/locales/de.yml
@@ -7,6 +7,7 @@ de:
field_expiry_date: "Expiration date"
field_option: "Option"
field_options: "Optionen"
+ field_missing_answers: "Ausstehende Antworten"
permission_manage_doodles: "Doodles verwalten"
permission_create_doodles: "Doodles erstellen"
permission_view_doodles: "Doodles ansehen"
View
1 config/locales/en.yml
@@ -7,6 +7,7 @@ en:
field_expiry_date: "Expiration date"
field_option: "Option"
field_options: "Options"
+ field_missing_answers: "Missing answers"
permission_manage_doodles: "Manage doodles"
permission_create_doodles: "Create doodles"
permission_view_doodles: "View doodles"

0 comments on commit d3f4be2

Please sign in to comment.