Conflicts: app/views/contests/show_attendingcontest.html.erb db/schema.rbexceptionHandle
commit
d47facc9e8
@ -0,0 +1,90 @@
|
||||
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")
|
||||
@limit = 10
|
||||
@feedback_count = @jours.count
|
||||
@feedback_pages = Paginator.new @feedback_count, @limit, params['page']
|
||||
@offset ||= @feedback_pages.offset
|
||||
@jour = @jours[@offset, @limit]
|
||||
end
|
||||
|
||||
#删除留言
|
||||
def destroy
|
||||
@journal_destroyed = JournalsForMessage.delete_message(params[:object_id])
|
||||
#@homework = HomeworkAttach.find(params[:id])
|
||||
#@jours = @homework.journals_for_messages.order("created_on DESC")
|
||||
#@limit = 10
|
||||
#@feedback_count = @jours.count
|
||||
#@feedback_pages = Paginator.new @feedback_count, @limit, params['page']
|
||||
#@offset ||= @feedback_pages.offset
|
||||
#@jour = @jours[@offset, @limit]
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
#添加留言
|
||||
def addjours
|
||||
@homework = HomeworkAttach.find(params[:jour_id])
|
||||
@homework.addjours User.current.id, params[:new_form][:user_message],0
|
||||
@jours = @homework.journals_for_messages.order("created_on DESC")
|
||||
#@limit = 10
|
||||
#@feedback_count = @jours.count
|
||||
#@feedback_pages = Paginator.new @feedback_count, @limit, params['page']
|
||||
#@offset ||= @feedback_pages.offset
|
||||
#@jour = @jours[@offset, @limit]
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
#获取指定作业的平均得分
|
||||
def score
|
||||
#stars_reates = @homework.rates(:quality)
|
||||
#percent = 0
|
||||
#stars_reates.each do |star_reates|
|
||||
# percent = percent + star_reates.stars
|
||||
#end
|
||||
#stars_reates_count = stars_reates.count == 0 ? 1 : stars_reates.count
|
||||
#result = percent * 1.0 / stars_reates_count
|
||||
#result
|
||||
end
|
||||
|
||||
#添加回复
|
||||
def add_jour_reply
|
||||
parent_id = params[:reference_id]
|
||||
author_id = User.current.id
|
||||
reply_user_id = params[:reference_user_id]
|
||||
reply_id = params[:reference_message_id] # 暂时不实现
|
||||
content = params[:user_notes]
|
||||
options = {:user_id => author_id,
|
||||
:m_parent_id => parent_id,
|
||||
:m_reply_id => reply_id,
|
||||
:reply_id => reply_user_id,
|
||||
:notes => content,
|
||||
:is_readed => false}
|
||||
@jfm = JournalsForMessage.new(options)
|
||||
@jfm.save
|
||||
respond_to do |format|
|
||||
format.js{
|
||||
@save_succ = true if @jfm.errors.empty?
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -0,0 +1,3 @@
|
||||
class HomeworkUsersController < ApplicationController
|
||||
|
||||
end
|
@ -0,0 +1,2 @@
|
||||
module HomeworkUsersHelper
|
||||
end
|
@ -1,10 +1,37 @@
|
||||
class HomeworkAttach < ActiveRecord::Base
|
||||
include Redmine::SafeAttributes
|
||||
|
||||
#attr_accessible :name, :description, :state, :user_id, :bid_id
|
||||
|
||||
belongs_to :user
|
||||
belongs_to :bid
|
||||
has_many :journals_for_messages, :as => :jour, :dependent => :destroy
|
||||
has_many :homework_users, :dependent => :destroy
|
||||
seems_rateable :allow_update => true, :dimensions => :quality
|
||||
|
||||
safe_attributes "bid_id",
|
||||
"user_id"
|
||||
acts_as_attachable
|
||||
|
||||
|
||||
def addjours user_id,message,status = 0
|
||||
jfm = self.journals_for_messages.build(:user_id => user_id,:notes =>message,:status => status)
|
||||
jfm.save
|
||||
jfm
|
||||
end
|
||||
|
||||
def score
|
||||
stars_reates = self.rates(:quality)
|
||||
percent = 0
|
||||
stars_reates.each do |star_reates|
|
||||
percent = percent + star_reates.stars
|
||||
end
|
||||
result = percent * 1.0 / stars_reates.count
|
||||
result
|
||||
end
|
||||
|
||||
def add_jours options
|
||||
jfm = self.journals_for_messages.build(options)
|
||||
jfm.save
|
||||
jfm
|
||||
end
|
||||
end
|
||||
|
@ -0,0 +1,6 @@
|
||||
class HomeworkUser < ActiveRecord::Base
|
||||
attr_accessible :homework_attach_id, :user_id
|
||||
|
||||
belongs_to :homework_attach
|
||||
has_one :user
|
||||
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,3 @@
|
||||
<%if @attachmentNew != nil%>
|
||||
$("#div-attachments[" + @attachmentNew.id + "]").html('<%= j(render :partial => 'tags/tag', :locals => {:obj => @attachmentNew, :object_flag => "6"})%>');
|
||||
<%end%>
|
@ -0,0 +1,14 @@
|
||||
|
||||
<%= form_tag({:controller => 'homework_attach', :action => 'add_jour_reply'}, :remote => true) do %>
|
||||
<%= text_area_tag 'user_notes', "", :class => 'noline',
|
||||
:style => "resize: none;", :rows => 4,
|
||||
:placeholder => l(:label_projects_feedback_respond_content),
|
||||
:maxlength => 250 %>
|
||||
<span style="float: left; margin-top: 1px; margin-right: 4px;"></span>
|
||||
<%= hidden_field_tag 'reference_id', params[:reference_id], :value => journal.id %>
|
||||
<%= hidden_field_tag 'reference_user_id', params[:reference_user_id], :value => m_reply_id.user.id %>
|
||||
<%= hidden_field_tag 'reference_message_id', params[:reference_message_id], :value => m_reply_id.id %>
|
||||
<%= submit_tag l(:button_projects_feedback_respond),
|
||||
:name => nil , :class => "enterprise", :style => "float: right; margin-top: 1px; margin-right: 4px;"%>
|
||||
|
||||
<% end %>
|
@ -0,0 +1,93 @@
|
||||
<!-- fq -->
|
||||
<style>
|
||||
input[type="submit"].bid_btn {
|
||||
vertical-align: middle;
|
||||
width: 60px;/*modified by ming*/
|
||||
height: 25px;
|
||||
line-height: 19px;
|
||||
font-size: 14px;
|
||||
color: rgb(0, 0, 0);
|
||||
background: buttonface;/*url("/images/button/bg103.jpg") no-repeat scroll left top transparent;*/
|
||||
padding: 0px 0px 4px 0px;
|
||||
border-radius: 2px;
|
||||
border: 1px solid rgb(148, 148, 148);
|
||||
box-shadow: none;
|
||||
text-shadow: none;
|
||||
margin-top: -10px;
|
||||
/*margin-right: -4px;*/
|
||||
}
|
||||
input[type="button"].bid_btn {
|
||||
width: 60px;/*modified by ming*/
|
||||
height: 25px;
|
||||
line-height: 19px;
|
||||
font-size: 14px;
|
||||
color: rgb(0, 0, 0);
|
||||
background: buttonface;/*url("/images/button/bg103.jpg") no-repeat scroll left top transparent;*/
|
||||
padding: 0px 0px 4px 0px;
|
||||
border-radius: 2px;
|
||||
border: 1px solid rgb(148, 148, 148);
|
||||
box-shadow: none;
|
||||
text-shadow: none;
|
||||
margin-top: -10px;
|
||||
margin-right: -2px;
|
||||
}
|
||||
textarea:focus {
|
||||
border: #d5dee9 1px solid;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script type="text/javascript" language="javascript">
|
||||
function clearInfo(id, content) {
|
||||
var text = $('#' + id);
|
||||
if (text.val() == content) {
|
||||
$('#' + id).val('');
|
||||
}
|
||||
}
|
||||
|
||||
function showInfo(id, content) {
|
||||
var text = $('#' + id);
|
||||
if (text.val() == '') {
|
||||
$('#' + id).val(content);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<%= form_for('new_form', :remote => true, :method => :post,
|
||||
:url => {:controller => 'homework_attach',
|
||||
:action => 'addjours',
|
||||
:jour_id => homework_attach.id,
|
||||
:sta => sta}) do |f|%>
|
||||
|
||||
<div id = 'pre_show'>
|
||||
<%= render :partial => 'words/pre_show', :locals => {:content => @content} %>
|
||||
</div>
|
||||
|
||||
<% if User.current.logged? %>
|
||||
<table border="0" width="525px" align="center" >
|
||||
<tr>
|
||||
<td><%= f.text_area 'user_message', :rows => 3, :cols => 65, :value => "#{l(:label_leave_a_message)}",
|
||||
:onfocus => "clearInfo('new_form_user_message','#{l(:label_leave_a_message)}')",
|
||||
:onblur => "showInfo('new_form_user_message','#{l(:label_leave_a_message)}')",
|
||||
:style => "resize: none;", :class => 'noline'%></td>
|
||||
</tr>
|
||||
</table>
|
||||
<%= f.text_field :reference_user_id, :style=>"display:none"%>
|
||||
<table border="0" width="525px" align="center">
|
||||
<tr>
|
||||
<td align="right"> <%= submit_tag l(:button_leave_meassge),
|
||||
:name => nil , :class => "enterprise",
|
||||
:onmouseout => "this.style.backgroundPosition = 'left top'",
|
||||
:onmouseover => "this.style.backgroundPosition = 'left -31px'"%>
|
||||
<%= submit_tag l(:button_clear), :name => nil, :class => "enterprise",
|
||||
:onclick => "clearMessage('new_form_user_message');",
|
||||
:onmouseout => "this.style.backgroundPosition = 'left top'",
|
||||
:onmouseover => "this.style.backgroundPosition = 'left -31px'" %> </td>
|
||||
</tr>
|
||||
</table>
|
||||
<% else %>
|
||||
<div style="font-size: 14px;margin:10px;text-align: center">
|
||||
<%= l(:label_user_login_tips) %>
|
||||
<%= link_to l(:label_user_login_new), signin_path %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
@ -0,0 +1,6 @@
|
||||
<% id = "journal_reply_ul_" + journal.id.to_s%>
|
||||
<ul class="messages-for-user-reply" id = '<%= id %>' >
|
||||
<% journal.children.each do |reply|%>
|
||||
<%= render :partial => "journal_reply_items", :locals => {:reply => reply, :journal => journal, :m_reply_id => reply} %>
|
||||
<% end %>
|
||||
</ul>
|
@ -0,0 +1,34 @@
|
||||
<% reply_allow = JournalsForMessage.create_by_user? User.current %>
|
||||
<% ids_r = 'reply_respond_form_'+ reply.id.to_s %>
|
||||
<li id='word_li_<%=reply.id.to_s%>' onmouseover="$('#<%= ids_r %>').show()" onmouseout="$('#<%= ids_r %>').hide()">
|
||||
<span class="portrait">
|
||||
<%= image_tag url_to_avatar(reply.user), :class => "avatar-3" %>
|
||||
</span>
|
||||
<div class="message-body">
|
||||
<% id = 'project_respond_form_'+ reply.id.to_s %>
|
||||
<p>
|
||||
<span><%= link_to reply.user.name, user_path(reply.user) %>: </span>
|
||||
<span class="message-notes"> <%= reply.notes %></span>
|
||||
</p>
|
||||
<p>
|
||||
<span class="time"><%= format_time reply.created_on %></span>
|
||||
<span style="display: none; margin-left: 4px;" id='<%=ids_r%>' >
|
||||
<% if reply_allow %>
|
||||
<%= link_to l(:label_projects_feedback_respond),'',
|
||||
{:focus => 'project_respond', :onclick => "toggleAndSettingWordsVal($('##{id}'), $('##{id} textarea'), '#{l(:label_reply_plural)} #{m_reply_id.user.name}: '); return false;"}
|
||||
%>
|
||||
<% end %>
|
||||
<% if @user == User.current || User.current.admin? || reply.user.id == User.current.id %>
|
||||
<%= link_to(l(:label_newfeedback_delete), {:controller => 'homework_attach', :action => 'destroy', :object_id => reply, :user_id => reply.user},
|
||||
:remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "delete", :title => l(:button_delete)) %>
|
||||
<% end %>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<div id='<%=id %>' class="respond-form">
|
||||
<% if reply_allow %>
|
||||
<%= render :partial => "add_jour_reply", :locals => {:journal => journal, :m_reply_id => m_reply_id} %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div style="clear: both;"></div>
|
||||
</li>
|
@ -0,0 +1,11 @@
|
||||
<!-- fq -->
|
||||
<% unless content.nil?%>
|
||||
<table width="60%" style="margin-left: 60px;">
|
||||
<tr>
|
||||
<td> <%= textilizable content %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><%= hidden_field_tag 'reference_content', params[:reference_content], :value => content%></td>
|
||||
</tr>
|
||||
</table>
|
||||
<% end %>
|
@ -0,0 +1,73 @@
|
||||
<script>
|
||||
var W3CDOM = document.createElement && document.getElementsByTagName;
|
||||
|
||||
window.onload = setMaxLength;
|
||||
|
||||
function setMaxLength() {
|
||||
if (!W3CDOM) return;
|
||||
var textareas = document.getElementsByTagName('textarea');
|
||||
for (var i=0;i<textareas.length;i++) {
|
||||
var textarea = textareas[i];
|
||||
setMaxLengthItem(textareas[i]);
|
||||
}
|
||||
}
|
||||
function setMaxLengthItem(textarea){
|
||||
if (textarea.getAttribute('maxlength')) {
|
||||
var counter = document.createElement('div');
|
||||
counter.className = 'counter';
|
||||
var counterClone = counter.cloneNode(true);
|
||||
counterClone.innerHTML = '<span>0</span>/'+textarea.getAttribute('maxlength');
|
||||
textarea.parentNode.insertBefore(counterClone,textarea.nextSibling);
|
||||
textarea.relatedElement = counterClone.getElementsByTagName('span')[0];
|
||||
textarea.onkeyup = textarea.onchange = checkMaxLength;
|
||||
textarea.onkeyup();
|
||||
}
|
||||
}
|
||||
|
||||
function checkMaxLength() {
|
||||
var maxLength = this.getAttribute('maxlength');
|
||||
var currentLength = this.value.length;
|
||||
if (currentLength > maxLength)
|
||||
this.relatedElement.className = 'toomuch';
|
||||
else
|
||||
this.relatedElement.className = '';
|
||||
this.relatedElement.firstChild.nodeValue = currentLength;
|
||||
}
|
||||
|
||||
</script>
|
||||
<% if jour.size > 0 %>
|
||||
<ul class="message-for-user">
|
||||
<% for journal in jour%>
|
||||
<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>
|
||||
<%= link_to l(:label_projects_feedback_respond),'',
|
||||
{:focus => 'project_respond', :onclick => "toggleAndSettingWordsVal($('##{ids}'), $('##{ids} textarea'), '#{l(:label_reply_plural)} #{journal.user.name}: '); $('##{ids} textarea') ;return false;"}
|
||||
%>
|
||||
<% if journal.user==User.current|| User.current.admin? %>
|
||||
<%= link_to(l(:label_bid_respond_delete), {:controller => 'homework_attach', :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>
|
||||
<div id='<%= ids %>' class="respond-form">
|
||||
<%= render :partial => 'add_jour_reply', :locals => {:journal => journal, :m_reply_id => journal} %>
|
||||
</div>
|
||||
<div style="clear: both;"></div>
|
||||
<div>
|
||||
<%= render :partial => "jour_reply", :locals => {:journal => journal } %>
|
||||
</div>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<% end %>
|
@ -0,0 +1,14 @@
|
||||
<% if @save_succ %>
|
||||
var pre_append = $('<%= j(
|
||||
render :partial => "journal_reply_items",
|
||||
:locals => {:reply => @jfm, :journal => @jfm.parent, :m_reply_id => @jfm}
|
||||
) %>').hide();
|
||||
$('#journal_reply_ul_<%=@jfm.m_parent_id%>').append(pre_append);
|
||||
pre_append.fadeIn(600);
|
||||
var textarea = $('#project_respond_form_<%=@jfm.m_reply_id.to_s%> textarea');
|
||||
textarea.val('');
|
||||
$('#project_respond_form_<%=@jfm.m_reply_id.to_s%>').hide();
|
||||
setMaxLengthItem(pre_append.find('textarea')[0]);
|
||||
<% else %>
|
||||
alert("<%= l(:label_feedback_fail) %>");
|
||||
<% end %>
|
@ -0,0 +1,4 @@
|
||||
$('#message').html('<%= escape_javascript(render(:partial => 'showjour', :locals => {:jour =>@jours, :state => false} )) %>');
|
||||
$('#pre_show').html('<%= escape_javascript(render(:partial => 'pre_show', :locals => {:content => nil})) %>');
|
||||
$('#new_form_user_message').val("");
|
||||
$('#new_form_reference_user_id').val("");
|
@ -0,0 +1,8 @@
|
||||
<% if @journal_destroyed.nil? %>
|
||||
alert('<%=l(:notice_failed_delete)%>');
|
||||
<% else %>
|
||||
var destroyedItem = $('#word_li_<%=@journal_destroyed.id%>')
|
||||
destroyedItem.fadeOut(600,function(){
|
||||
destroyedItem.remove();
|
||||
});
|
||||
<% end %>
|
@ -0,0 +1,125 @@
|
||||
|
||||
<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="text-align: center;">评分:
|
||||
<%= rating_for @homework, dimension: :quality, class: 'rateable div_inline' %>
|
||||
<span style="font-size: 11px">(您可以重新打分,打分结果以最后一次打分为主!)</span>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!--提示登录后对应用进行评价-->
|
||||
<div id='leave-message'>
|
||||
<%= render :partial => 'addjour', :locals => {:homework_attach => @homework, :sta => 0} %>
|
||||
</div>
|
||||
|
||||
<!-- 留言列表区 -->
|
||||
<div id="message" style="font-size: 14px;">
|
||||
<%= render :partial => 'showjour', :locals => {:jour => @jours} %>
|
||||
</div>
|
||||
<div>
|
||||
<%#= link_to '返回竞赛页面', show_softapplication_contest_path(@softapplication.contest) %>
|
||||
</div>
|
@ -1,4 +1,4 @@
|
||||
<em>尊敬的用户,<%= @user %>(<%= @user.mail%>)给你留言了:</em>
|
||||
<em>尊敬的用户,<%= @user %>给你留言了:</em>
|
||||
<div><%= @message %></div>
|
||||
<h1>点击链接查看最新回复<%= link_to(@url, @url) %></h1>
|
||||
|
||||
|
@ -1,3 +1,3 @@
|
||||
尊敬的用户,<%= @user %>(<%= @user.mail%>)给你留言了:
|
||||
尊敬的用户,<%= @user %>给你留言了:
|
||||
<%= @message %>
|
||||
点击链接查看最新回复<%= link_to(@url, @url) %>
|
||||
|
@ -0,0 +1,165 @@
|
||||
<script>
|
||||
window.onload=function (){
|
||||
$('#upload_form').submit(function() {
|
||||
$(this).ajaxSubmit( {
|
||||
target : '#tags_show'
|
||||
});
|
||||
return false;
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<div id="tags">
|
||||
<%#begin
|
||||
1 代表是user类型
|
||||
2 代表是project类型
|
||||
3 代表是issue类型
|
||||
4 代表是bid类型
|
||||
5 代表是forum类型
|
||||
6 代表是Attachment类型
|
||||
7 代表是contest类型
|
||||
8 代表是OpenSourceProject类型
|
||||
9 代表是RelativeMemo类型
|
||||
#end%>
|
||||
<!-- 3 代表的是issue 当是issue是 处理方式与前2个对象不同 -->
|
||||
<% if object_flag == '3' %>
|
||||
<span><%= image_tag("/images/sidebar/tags.png") %></span>
|
||||
<span class="font_title_tag"><%= l(:label_tag) %>:</span>
|
||||
<% if User.current.logged? %>
|
||||
<span> <%= toggle_link (image_tag "/images/sidebar/add.png"), 'put-tag-form-issue', {:focus => 'name-issue'} %></span>
|
||||
<% end %>
|
||||
|
||||
<div id="tags_show_issue">
|
||||
<%= render :partial => "tags/tag_name",:locals => {:obj => obj,:non_list_all => false ,:object_flag => object_flag} %>
|
||||
</div>
|
||||
<div id="put-tag-form-issue" style="display: none">
|
||||
<%= form_for "tag_for_save",:remote=>true,:url=>tag_path,
|
||||
:update => "tags_show",
|
||||
:complete => '$("#put-tag-form-issue").hide();' do |f| %>
|
||||
<%= f.text_field :name ,:id => "name-issue",:size=>"30",:require=>true,:maxlength => Setting.tags_max_length,:minlength=>1 %>
|
||||
<%= f.text_field :object_id,:value=> obj.id,:style=>"display:none"%>
|
||||
<%= f.text_field :object_flag,:value=> object_flag,:style=>"display:none"%>
|
||||
<%= f.submit l(:button_project_tags_add),:class => "small"%>
|
||||
<%= link_to_function l(:button_cancel), '$("#put-tag-form-issue").hide();'%>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<% elsif object_flag == '6' %>
|
||||
<span><%#= image_tag("/images/sidebar/tags.png") %></span>
|
||||
<span>
|
||||
<%= link_to (image_tag "/images/sidebar/add.png"), 'javascript:void(0);', :class => "tags_icona", :onclick=>"$('#put-tag-form-#{obj.class}-#{obj.id}').toggle(); readmore(this);" if User.current.logged? %>
|
||||
<%#= toggle_link (image_tag "/images/sidebar/add.png"), "put-tag-form-#{obj.class}-#{obj.id}", {:focus => "put-tag-form-#{obj.class}-#{obj.id} #name"} if User.current.logged? %>
|
||||
</span>
|
||||
|
||||
|
||||
<div id="tags_show">
|
||||
<div id="tags_show-<%=obj.class%>-<%=obj.id%>" style="display:inline; ">
|
||||
<%= render :partial => "tags/tag_name",:locals => {:obj => obj,:non_list_all => false ,:object_flag => object_flag} %>
|
||||
</div>
|
||||
<div id="put-tag-form-<%=obj.class%>-<%=obj.id%>" style="display: none">
|
||||
<%= text_field "tag_name" ,"name"%>
|
||||
<input id="object_id" type="text" size="20" name="object_id" value='<%=obj.id%>' class="hidden">
|
||||
<input id="object_flag" type="text" size="20" name="object_flag" value='<%=object_flag%>' class="hidden">
|
||||
<%= button_tag "增加", :type=>"button", :onclick=>"tagAddClick(tags_show-"+obj.class.to_s + "-" +obj.id.to_s + ","+ obj.id.to_s + "," + object_flag.to_s + ")" %>
|
||||
<%#= f.text_field :object_id,:value=> obj.id,:style=>"display:none"%>
|
||||
<%#= f.text_field :object_flag,:value=> object_flag,:style=>"display:none"%>
|
||||
<input type="image" name="button" onclick="submitForm('<%=obj.id%>,<%=object_flag%>')" src="/commit.png"/>
|
||||
<%= submit_tag "增加", :name=>"add_tag" %>
|
||||
<div class='hidden'>
|
||||
<% preTags = @preTags.nil? ? [] : @preTags %>
|
||||
<% preTags.each do |tag|%>
|
||||
<%= link_to tag, "
|
||||
javascript:(function(){
|
||||
var $tagInputVal = $('#put-tag-form-"+obj.class.to_s+"-"+obj.id.to_s+"').find('#name');
|
||||
var tagArr = [];
|
||||
tagArr = tagArr.concat( $tagInputVal[0].value.split(',') );
|
||||
tagArr = tagArr.concat('"+tag.to_s+"');
|
||||
tagArr = cleanArray(tagArr);
|
||||
$tagInputVal.val(tagArr.join(','));
|
||||
})();
|
||||
"
|
||||
%>
|
||||
<% end%>
|
||||
</div>
|
||||
<%#= link_to_function l(:button_cancel), "$(\"#put-tag-form-#{obj.class}-#{obj.id}\").hide();"%>
|
||||
</div>
|
||||
</div>
|
||||
<% else %>
|
||||
|
||||
<span><%= image_tag("/images/sidebar/tags.png") %></span>
|
||||
<span class="font_title_tag"><%= l(:label_tag) %>:</span>
|
||||
|
||||
<% if User.current.logged? %>
|
||||
<span><%= toggle_link (image_tag "/images/sidebar/add.png"), 'put-tag-form', {:focus => 'name'} %></span>
|
||||
<% end %>
|
||||
|
||||
<div id="tags_show">
|
||||
<%= render :partial => "tags/tag_name",:locals => {:obj => obj,:non_list_all => false ,:object_flag => object_flag} %>
|
||||
</div>
|
||||
<div id="put-tag-form" style="display: none">
|
||||
|
||||
<%= form_for "tag_for_save",:remote=>true,:url=>tag_path,
|
||||
:update => "tags_show",
|
||||
:complete => '$("#put-tag-form").hide();' do |f| %>
|
||||
<%= f.text_field :name ,:id => "name",:size=>"28",:require=>true,:maxlength => Setting.tags_max_length,:minlength=>Setting.tags_min_length %>
|
||||
<%= f.text_field :object_id,:value=> obj.id,:style=>"display:none"%>
|
||||
<%= f.text_field :object_flag,:value=> object_flag,:style=>"display:none"%>
|
||||
<%= f.submit l(:button_project_tags_add),:class => "small" %>
|
||||
<%= link_to_function l(:button_cancel), '$("#put-tag-form").hide();'%>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
|
||||
<script language="JavaScript">
|
||||
function submitForm(objId,objTag){
|
||||
alert("OK");
|
||||
$.ajax({
|
||||
type :"POST",
|
||||
url :'<%= users_tag_saveEx_path%>',
|
||||
data: {
|
||||
tagname: $('tag_name').value,
|
||||
obj_id: encodeURIComponent(objId),
|
||||
obj_flag:encodeURIComponent(objTag)
|
||||
},
|
||||
success: function(data, textStatus){
|
||||
alert("OK");
|
||||
$(id).empty();
|
||||
$(id).html('123');
|
||||
$("#" + id + " #name").val("");
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
function eval_ajax (xhr, textStatus) {
|
||||
if (textStatus == 'success') {
|
||||
eval(xhr.responseText);
|
||||
} else if (textStatus == 'error') {
|
||||
alert('error');
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<script type='text/javascript'>
|
||||
function tagAddClick(id,objId,objTag)
|
||||
{
|
||||
alert("OK");
|
||||
$.ajax({
|
||||
type :"POST",
|
||||
url :'<%= users_tag_saveEx_path%>',
|
||||
data: {
|
||||
tagname: $('tag_name').value,
|
||||
obj_id: encodeURIComponent(objId),
|
||||
obj_flag:encodeURIComponent(objTag)
|
||||
},
|
||||
success: function(data, textStatus){
|
||||
alert("OK");
|
||||
$(id).empty();
|
||||
$(id).html('123');
|
||||
$("#" + id + " #name").val("");
|
||||
}
|
||||
})
|
||||
}
|
||||
</script>
|
@ -0,0 +1,20 @@
|
||||
<% if @obj_flag == '3'%>
|
||||
|
||||
$('#tags_show_issue').html('<%= escape_javascript(render :partial => 'tags/tag_name',
|
||||
:locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>');
|
||||
//$('#put-tag-form-issue').hide();
|
||||
$('#name-issue').val("");
|
||||
<% elsif @obj_flag == '6'%>
|
||||
$("#tags_show-<%=@obj.class%>-<%=@obj.id%>").empty();
|
||||
$("#tags_show-<%=@obj.class%>-<%=@obj.id%>").html('<%= escape_javascript(render :partial => 'tags/tag_name',
|
||||
:locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>');
|
||||
//$("#put-tag-form-<%=@obj.class%>-<%=@obj.id%>").hide();
|
||||
$("#put-tag-form-<%=@obj.class%>-<%=@obj.id%> #name").val("");
|
||||
<% else %>
|
||||
|
||||
$('#tags_show').html('<%= escape_javascript(render :partial => 'tags/tag_name',
|
||||
:locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>');
|
||||
$('#put-tag-form #name').val("");
|
||||
//$('#put-tag-form').hide();
|
||||
<% end %>
|
||||
|
@ -0,0 +1,6 @@
|
||||
<div class="clearfix"></div>
|
||||
<div class="linkother">
|
||||
<a href="http://forge.trustie.net" class="link_other_item">项目托管平台</a>
|
||||
<a href="http://course.trustie.net" class="link_other_item">课程实践平台</a>
|
||||
<a href="http://contest.trustie.net" class="link_other_item">竞赛托管平台</a>
|
||||
</div>
|
@ -0,0 +1,10 @@
|
||||
class CreateHomeworkUsers < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :homework_users do |t|
|
||||
t.string :homework_attach_id
|
||||
t.string :user_id
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,7 @@
|
||||
class AddNameToHomeworkAttach < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :homework_attaches, :name, :string
|
||||
add_column :homework_attaches, :description, :string
|
||||
add_column :homework_attaches, :state, :int
|
||||
end
|
||||
end
|
Before Width: | Height: | Size: 522 B After Width: | Height: | Size: 522 B |
@ -0,0 +1,9 @@
|
||||
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
|
||||
|
||||
one:
|
||||
homework_attach_id: MyString
|
||||
user_id: MyString
|
||||
|
||||
two:
|
||||
homework_attach_id: MyString
|
||||
user_id: MyString
|
Loading…
Reference in new issue