/
show.html.erb~
94 lines (81 loc) · 4.51 KB
/
show.html.erb~
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<section id="articleheader">
<h2><%= @article.title %>
<ul class="stars floatstars">
<li class="yellowstars" style="width: <%= @article.avg_rating * 25 %>px !important;"></li>
<li class="text">Ο μέσος όρος είναι <%= @article.avg_rating %> από συνολικά <%= pluralize(@article.count_ratings, "ψήφο") %></li>
</ul>
</h2>
<div class="byline">Γράφτηκε από: <%= link_to @article.student.fullname, "" %></div>
<div class="avatar"><%= image_tag gravatar(@article.student.email, 64) %></div>
</section>
<section id="articlebody" class="textile">
<h2><%= @article.title %></h2>
<div class="textile">
<%= sanitize textilize(coderay_dressed(@article.body)) %>
</div>
</section>
<% # comments και ratings είναι διαθέσιμα μόνο για άρθρα που είναι δημοσιευμένα %>
<% if @article.state > 2 %>
<section id="rating">
<% if student_signed_in? %>
<%= form_for [@article, @rating_currentstudent] do |f| %>
<div id="ratingbox">
<ul id="ratingbuttons">
<li><%= f.radio_button :stars, "5" %><span>Τέλειο</span></li>
<li><%= f.radio_button :stars, "4" %><span>Πολύ καλό</span></li>
<li><%= f.radio_button :stars, "3" %><span>Καλό</span></li>
<li><%= f.radio_button :stars, "2" %><span>Μέτριο</span></li>
<li><%= f.radio_button :stars, "1" %><span>Αδιάφορο</span></li>
</ul>
<div class="center"><%= f.submit "Αξιολόγησε αυτό το άρθρο", :class => "awesome custom red" %></div>
</div>
<% end %>
<% else %>
<div id="ratingbox"><%= link_to "Είσοδος", new_student_session_path %> για να βαθμολογήσεις αυτό το άρθρο</div>
<% end %>
</section>
<section id="comments">
<% @comments.each do |comment| %>
<article class="comment">
<div class="avatar"><%= image_tag gravatar(comment.student.email, 48) %></div>
<div class="commentbody">
<div class="commenthead">
<%= comment.student.fullname %> - <%=time_ago_in_words(comment.created_at)%> ago
<% # display delete link only for comments written by this particular student %>
<% if student_signed_in? and comment.student_id == current_student.id %>
<span><%= link_to 'delete', article_comment_path(@article, comment), :confirm => 'Are you sure?', :method => :delete, :class => "" %></span>
<% end %>
</div>
<div><%= comment.body %></div>
</div>
</article>
<% end %>
<% # add a new comment %>
<article class="comment newcomment">
<% if student_signed_in? %>
<div class="avatar"><%= image_tag gravatar(current_student.email, 48) %></div>
<div class="commentbody">
<% if current_student.fullname == nil or current_student.fullname == '' %>
<div class="commenthead">
Παρακαλώ ενημερώστε το <%= link_to "Προφίλ", edit_student_registration_path %> πριν σχολιάσετε το άρθρο.
</div>
<% else %>
<div class="commenthead">
<%= current_student.fullname %>
</div>
<div>
<%= form_for [@article, current_student.comments.new] do |f| %>
<%= f.text_area :body, :size => "100%x20", :class => "fullwidth" %>
<%= f.submit "Πρόσθεσε σχόλιο", :class => "awesome custom red" %>
<% end %>
</div>
<% end %>
</div>
<% else %>
<div class="signin">
Παρακαλώ κάντε <%= link_to "Σύνδεση", new_student_session_path %> πριν σχολιάσετε κάποιο άρθρο.
</div>
<% end %>
</article>
</section>
<% end %>