aboutsummaryrefslogtreecommitdiff
blob: 06d29babd6109cd37509077aae547615ca24f5e7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<def tag="home-page" polymorphic >
</def>

<def tag="home-page" for="Guest">
  Hello. Your not currently logged in. Feel free to browse publicly available resources.
</def>

<def tag="home-page" for="User">

  <h3>Welcome, <name/>.</h3>

  <section class="content-body">

    <section class="users common">
      Your current role is: <view:role/><if:administrator> and you are administrator</if>,
      <a with="&current_user">view your profile</a>.<br/>
    </section>

    <section class="users recruits" if="&this.role.is_recruit?">

      <if:question_categories>
        You are currently assigned to categories:
        <collection/>
        View questions:
        <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 href="&user_questions_path(current_user)">All questions you should answer(including answered).</a></li>
        </ul>
      </if>

       <if test="&current_user.any_pending_project_acceptances?">
        <a with="&ProjectAcceptance" action="pending_acceptances">Recruits waiting for your acceptance</a>.
      </if>

      <if test="&current_user.answered_all_multi_choice_questions?">
        <if test="&Answer.wrong_answers_of(current_user.id).count > 0">
          You answered all multiple choice questions, but some of them wrong.<br/>
        </if>
        <else>
          You answered all multiple choice questions, correctly.<br/>
        </else>
      </if>

      <if:project_acceptances> <collection/> </if>

    </section>

    <section class="users mentors" if="&current_user.role.is_mentor? || current_user.role.is_recruiter?">

      <a with="&User" action="mentorless_recruits" if="&User.mentorless_recruits.count > 0">See mentorless recruits</a><br/>

      <unless test="&this.recruits.empty?">
        Check <a with="&Answer" action="my_recruits">answers</a> of recruits you mentor.
        You also can view answers of the recruits you mentor in categories:
        <collection with="&QuestionCategory.all">
          <a href="/answers/my_recruits_cat/#{this.id}"><name/></a>
        </collection>
      </unless>

    </section>

    <section class="users recruiters" if="&this.role.is_recruiter?">
        <h3>Registered users:</h3>
        <collection with="&User.all"/>

        <if test="&User.recruits_answered_all.count > 0">
          <a with="&User" action="ready_recruits">Recruits that answered all questions</a>.<br/>
        </if>

        <a if="&this.administrator?" href="&new_question_path">New Question</a>
    </section>

  </section>
</def>