parent
603010c30a
commit
029eb1a195
@ -0,0 +1,27 @@
|
||||
class HomeworkAttachController < ApplicationController
|
||||
#显示作业信息
|
||||
def show
|
||||
@homework = HomeworkAttach.find(params[:id])
|
||||
# 打分统计
|
||||
stars_reates = @homework.
|
||||
rates(:quality)
|
||||
stars_reates_count = stars_reates.count == 0 ? 1 : stars_reates.count
|
||||
stars_status = stars_reates.select("stars, count(*) as scount").
|
||||
group("stars")
|
||||
@stars_status_map = Hash.new(0.0)
|
||||
stars_status.each do |star_status|
|
||||
percent = (star_status.scount * 1.0/ stars_reates_count) * 100.to_f
|
||||
percent_m = format("%.2f", percent)
|
||||
@stars_status_map["star#{star_status.stars.to_i}".to_sym] =
|
||||
percent_m.to_s + "%"
|
||||
end
|
||||
@jours = @homework.journals_for_messages.order("created_on DESC")
|
||||
end
|
||||
|
||||
def destroyjours
|
||||
@homework = HomeworkAttach.find(params[:homework_id])
|
||||
JournalsForMessage.delete_message(params[:object_id])
|
||||
redirect_to homework_attach_path(@homework)
|
||||
end
|
||||
end
|
||||
|
@ -1,10 +1,15 @@
|
||||
<!-- #wang -->
|
||||
<% for attachment in attachments %><%= link_to_attachment attachment, :class => 'icon icon-attachment', :download => true -%>
|
||||
<% if attachment.is_text? %>
|
||||
<% for attachment in attachments %>
|
||||
<% if attachments.count > 1 && attachment != attachments.first%>
|
||||
<br/>
|
||||
<% end %>
|
||||
<%= link_to_attachment attachment, :class => 'icon icon-attachment', :download => true -%>
|
||||
<% if attachment.is_text? %>
|
||||
<%= link_to image_tag('magnifier.png'),
|
||||
:controller => 'attachments', :action => 'show',
|
||||
:id => attachment, :filename => attachment.filename %>
|
||||
<% end %>
|
||||
<%= h(" - #{attachment.description}") unless attachment.description.blank? %>
|
||||
<span class="size">(<%= number_to_human_size attachment.filesize %>)</span>
|
||||
|
||||
<% end -%>
|
||||
|
@ -0,0 +1,148 @@
|
||||
<%= render_flash_messages %>
|
||||
<style>
|
||||
.softapplication-img .soft-application {
|
||||
float: left;
|
||||
width: 25%;
|
||||
height: 200px;
|
||||
}
|
||||
</style>
|
||||
<p id="notice"><%= notice %></p>
|
||||
<!-- <%= image_tag(url_to_avatar(@user), :class => "avatar2") %> -->
|
||||
<div style="height: auto; padding-bottom: 10px">
|
||||
<tr>
|
||||
<td colspan="2" valign="top" width="320" >
|
||||
</td>
|
||||
<td>
|
||||
<table width="100%" border="0">
|
||||
<tr style="font-size: 18px">
|
||||
<td colspan="2" valign="top"><strong>作业基础信息<%=@count %></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width: 570px; padding-left:40px; word-wrap: break-word; word-break: break-all">发布人员:<%= link_to @homework.user, user_path(@homework.user)%></td>
|
||||
<td>发布时间:<%=format_time @homework.created_at %></td>
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding-left: 40px">
|
||||
<span>作业下载:</span>
|
||||
<% options = {:author => true } %>
|
||||
<%= render :partial => 'attachments/app_link', :locals => {:attachments => @homework.attachments, :options => options} %>
|
||||
</td>
|
||||
<td style="width: 240px; word-wrap: break-word; word-break: break-all">所属任务:<%= link_to(@homework.bid.name, project_for_bid_path(@homework.bid))%></td>
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding-left: 40px" colspan="2">平均评分:
|
||||
<%= rating_for @homework, :static => true, dimension: :quality, class: 'rateable div_inline' %>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</div>
|
||||
<div class="underline-contests_one"></div>
|
||||
|
||||
<div style="height: auto; padding-bottom: 10px">
|
||||
<tr>
|
||||
<td colspan="2" valign="top" width="320" >
|
||||
</td>
|
||||
<td>
|
||||
<table width="100%" border="0">
|
||||
<tr>
|
||||
<td colspan="2" valign="top"><strong><div style="font-size: 15px;">作业描述:</div></strong></td>
|
||||
</tr>
|
||||
<% @homework.attachments.map do |attachment| %>
|
||||
<% if attachment.description != nil && attachment.description != "" %>
|
||||
<tr>
|
||||
<td style="width: 570px; padding-left:40px; word-wrap: break-word; word-break: break-all">
|
||||
<div style="padding-top: 5px"> <%= attachment.description %></div>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</div>
|
||||
<div class="underline-contests_one"></div>
|
||||
|
||||
<div style="height: auto; padding-bottom: 10px">
|
||||
<div style="font-size: 15px;"><strong>作业得分:</strong></div>
|
||||
<div style="overflow: hidden">
|
||||
<div style="margin-left: 15%; float: left">
|
||||
<div style="padding-left: 45px; padding-bottom: 5px">得分比例</div>
|
||||
<div>
|
||||
<% 100.step(20,-20) do |star| %>
|
||||
<div data-kls="Softapplication" data-id="2" data-dimension="quality" data-average="3.25" class="rateable div_inline jDisabled" style="height: 20px; width: 115px; overflow: hidden; z-index: 1; position: relative;">
|
||||
<div class="jRatingColor" style="width: <%=star%>%;"></div>
|
||||
<div class="jRatingAverage" style="width: 0px; top: -20px;"></div>
|
||||
<div class="jStar" style="width: 115px; height: 20px; top: -40px; background: url('/images/seems_rateable/stars.png') repeat-x scroll 0% 0% transparent;">
|
||||
</div>
|
||||
</div>
|
||||
<%= @stars_status_map["star#{(star/20).to_s}".to_sym] %>
|
||||
<br>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<div style="float: left; padding-left: 100px; padding-top:35px ">
|
||||
<div style="padding-left: 25px;">最终得分</div>
|
||||
<div style="padding-top: 3px">
|
||||
<%= rating_for @homework, :static => true, dimension: :quality, class: 'rateable div_inline' %>
|
||||
</div>
|
||||
</div>
|
||||
<div style="float: left; padding-left: 100px; padding-top:35px ">
|
||||
<div>打分总人数</div>
|
||||
<div style="padding-left: 28px; padding-top: 1px; font-size: 25px; color: blue">
|
||||
<strong>
|
||||
<%= @homework.raters(:quality).count%>
|
||||
</strong>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="underline-contests_one"></div>
|
||||
|
||||
<div style="height: 50px">
|
||||
<div style="font-size: 15px"><strong>作业评论:</strong></div>
|
||||
<div style="padding-left: 210px">评分:
|
||||
<%= rating_for @homework, dimension: :quality, class: 'rateable div_inline' %>
|
||||
<span style="font-size: 11px">(您可以重新打分,打分结果以最后一次打分为主!)</span>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!--提示登录后对应用进行评价-->
|
||||
<div id='leave-message'>
|
||||
<% if User.current.logged? %>
|
||||
<% else %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<!-- 留言列表区 -->
|
||||
<ul class="message-for-user">
|
||||
<% for journal in @jours%>
|
||||
<li id='word_li_<%= journal.id.to_s %>' class="outer-message-for-user">
|
||||
<span class="portrait"><%= image_tag(url_to_avatar(journal.user), :class => "avatar") %></span>
|
||||
<span class="body">
|
||||
<span class="user"><%= link_to journal.user, user_path(journal.user)%></span>
|
||||
<span class="font_lighter"><% label = l(:label_contest_requirement) %></span>
|
||||
<div> <%= textilizable journal.notes%> </div>
|
||||
<span class="font_lighter"><%= l(:label_bids_published) %>
|
||||
<%= time_tag(journal.created_on).html_safe %>
|
||||
<%= l(:label_bids_published_ago) %>
|
||||
</span>
|
||||
<% ids = 'project_respond_form_'+ journal.id.to_s%>
|
||||
<span>
|
||||
<% if journal.user==User.current|| User.current.admin? %>
|
||||
<%= link_to(l(:label_bid_respond_delete), {:controller => 'words', :action => 'destroy', :object_id => journal, :user_id => journal.user},
|
||||
:remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "delete", :title => l(:button_delete)) %>
|
||||
<% end %>
|
||||
</span>
|
||||
</span>
|
||||
<div style="clear: both;"></div>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<div>
|
||||
<%#= link_to '返回竞赛页面', show_softapplication_contest_path(@softapplication.contest) %>
|
||||
</div>
|
Loading…
Reference in new issue