diff options
author | Joachim Filip Ignacy Bartosik <jbartosik@gmail.com> | 2010-07-20 20:48:07 +0200 |
---|---|---|
committer | Joachim Filip Ignacy Bartosik <jbartosik@gmail.com> | 2010-07-21 20:07:55 +0200 |
commit | 83a57b6fa38520f210f55906829f0f31fe82b298 (patch) | |
tree | b91d3b59a5602e881e942bc547c8788839ebf8b0 | |
parent | Show recruits progress on their view pages (diff) | |
download | recruiting-webapp-83a57b6fa38520f210f55906829f0f31fe82b298.tar.gz recruiting-webapp-83a57b6fa38520f210f55906829f0f31fe82b298.tar.bz2 recruiting-webapp-83a57b6fa38520f210f55906829f0f31fe82b298.zip |
Allow viewing listings of answers of other users
-rw-r--r-- | app/controllers/questions_controller.rb | 2 | ||||
-rw-r--r-- | app/controllers/users_controller.rb | 7 | ||||
-rw-r--r-- | app/views/taglibs/cards.dryml | 4 | ||||
-rw-r--r-- | app/views/taglibs/pages.dryml | 2 | ||||
-rw-r--r-- | app/views/users/questions.dryml (renamed from app/views/questions/my_questions.dryml) | 4 | ||||
-rw-r--r-- | app/views/users/show.dryml | 12 | ||||
-rw-r--r-- | features/question_listing.feature | 3 | ||||
-rw-r--r-- | features/support/paths.rb | 3 | ||||
-rw-r--r-- | features/user_progress.feature | 16 |
9 files changed, 42 insertions, 11 deletions
diff --git a/app/controllers/questions_controller.rb b/app/controllers/questions_controller.rb index 6fd2221..ba0dbdd 100644 --- a/app/controllers/questions_controller.rb +++ b/app/controllers/questions_controller.rb @@ -3,7 +3,7 @@ class QuestionsController < ApplicationController hobo_model_controller auto_actions :all, :except => :index - index_action :answered_questions, :unanswered_questions, :my_questions, :suggest_questions, :approve_questions + index_action :answered_questions, :unanswered_questions, :suggest_questions, :approve_questions def answered_questions hobo_index (current_user.signed_up? && current_user.answered_questions) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index dd8f954..433386c 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -5,6 +5,7 @@ class UsersController < ApplicationController auto_actions :all, :except => [ :index, :new, :create ] index_action :ready_recruits index_action :mentorless_recruits + show_action :questions def ready_recruits hobo_index User.recruits_answered_all @@ -13,4 +14,10 @@ class UsersController < ApplicationController def mentorless_recruits hobo_index User.mentorless_recruits end + + def questions + hobo_show do + @user = this + end + end end diff --git a/app/views/taglibs/cards.dryml b/app/views/taglibs/cards.dryml index f8f875b..32b9c72 100644 --- a/app/views/taglibs/cards.dryml +++ b/app/views/taglibs/cards.dryml @@ -1,8 +1,8 @@ -<def tag="card" for="Question"> +<def tag="card" for="Question" attrs="user"> <card class="question" param="default" merge> <header: param> <h4 param="heading"><a><name/></a></h4> - <if with="&this.answered?(current_user)"> + <if with="&this.answered?(user || current_user)"> answered </if> </header:> diff --git a/app/views/taglibs/pages.dryml b/app/views/taglibs/pages.dryml index cd01974..6499350 100644 --- a/app/views/taglibs/pages.dryml +++ b/app/views/taglibs/pages.dryml @@ -19,7 +19,7 @@ <ul> <li><a with="&Question" action="answered_questions">You answered.</a></li> <li><a with="&Question" action="unanswered_questions">You didn't answer yet but you should.</a></li> - <li><a with="&Question" action="my_questions">All questions you should answer(including answered).</a></li> + <li><a href="&user_questions_path(current_user)">All questions you should answer(including answered).</a></li> </ul> </if> <if with="&!this.recruits.empty?"> diff --git a/app/views/questions/my_questions.dryml b/app/views/users/questions.dryml index 1284d25..bf2d1f3 100644 --- a/app/views/questions/my_questions.dryml +++ b/app/views/users/questions.dryml @@ -1,7 +1,7 @@ <index-page> <content:> - <repeat with="¤t_user.all_questions"> - <card/> + <repeat with="&this.all_questions"> + <card user="&@user"/> </repeat> </content:> </index-page> diff --git a/app/views/users/show.dryml b/app/views/users/show.dryml index 515d8bc..9feb677 100644 --- a/app/views/users/show.dryml +++ b/app/views/users/show.dryml @@ -1,3 +1,13 @@ <show-page> - <field-list: fields="email_address, role, nick, contributions, state, mentor, progress"/> + <content-body:> + <field-list fields="email_address, role, nick, contributions, state, mentor, progress"/> + <h3> + <ht key="users.collection.heading.your" > + <Your/>Answers + </ht> + </h3> + <a href="&user_questions_path(this)">Questions user should answer</a>. + + <collection:answers/> + </content-body:> </show-page> diff --git a/features/question_listing.feature b/features/question_listing.feature index 28e5bcb..0e1c02b 100644 --- a/features/question_listing.feature +++ b/features/question_listing.feature @@ -5,7 +5,8 @@ Feature: Viewing question listings Scenario: View listing of all questions I should answer Given I am logged in as recruit with some answered and unanswered questions - When I am on all my questions page + When I am on the homepage + And I follow "All questions you should answer(including answered)." Then I should see following: |q1|q3|q4| And I should not see "q2" diff --git a/features/support/paths.rb b/features/support/paths.rb index c6f2aa2..d35fb62 100644 --- a/features/support/paths.rb +++ b/features/support/paths.rb @@ -38,9 +38,6 @@ module NavigationHelpers when /project acceptance of "([^\"]*)" by "([^\"]*)" edit page/ edit_project_acceptance_path(ProjectAcceptance.find_by_user_name_and_accepting_nick($1, $2)) - when /all my questions page/ - my_questions_questions_path - when /my answered questions page/ answered_questions_questions_path diff --git a/features/user_progress.feature b/features/user_progress.feature index e5910e3..7de1d69 100644 --- a/features/user_progress.feature +++ b/features/user_progress.feature @@ -15,3 +15,19 @@ Feature: Recruits progress When I am on the homepage And I follow "recruit" Then I should see "Answered 2 of 3 questions." + + Scenario: View list of users questions + Given following questions: + |question 1|category 1| + |question 2|category 1| + |question 3|category 2| + And recruit "recruit" in following categories: + |category 1|category 2| + And user "recruit" answered all questions in "category 1" + And I am logged in as "recruiter" who is "recruiter" + When I am on the homepage + And I follow "recruit" + And I follow "Questions user should answer" + Then I should see following: + |question 1 answered|question 2 answered|question 3| + |