Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh
This commit is contained in:
commit
5ca9d96acd
|
@ -276,10 +276,18 @@ class AccountController < ApplicationController
|
||||||
set_autologin_cookie(user)
|
set_autologin_cookie(user)
|
||||||
end
|
end
|
||||||
call_hook(:controller_account_success_authentication_after, {:user => user })
|
call_hook(:controller_account_success_authentication_after, {:user => user })
|
||||||
#by young
|
|
||||||
# redirect_back_or_default my_page_path
|
code = /\d*/
|
||||||
redirect_back_or_default User.current
|
#根据home_url生产正则表达式
|
||||||
# redirect_to User.current
|
eval("code = " + "/^" + home_url.gsub(/\//,"\\\/") + "\\\/*(welcome)?\\\/*(\\\/index\\\/*.*)?\$/")
|
||||||
|
if code=~params[:back_url]
|
||||||
|
redirect_to user_activities_path(user)
|
||||||
|
else
|
||||||
|
#by young
|
||||||
|
#redirect_back_or_default my_page_path
|
||||||
|
redirect_back_or_default User.current
|
||||||
|
#redirect_to User.current
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_autologin_cookie(user)
|
def set_autologin_cookie(user)
|
||||||
|
|
|
@ -18,6 +18,8 @@ class BidsController < ApplicationController
|
||||||
helper :attachments
|
helper :attachments
|
||||||
include AttachmentsHelper
|
include AttachmentsHelper
|
||||||
include ApplicationHelper
|
include ApplicationHelper
|
||||||
|
include BidsHelper
|
||||||
|
|
||||||
helper :projects
|
helper :projects
|
||||||
helper :words
|
helper :words
|
||||||
helper :welcome
|
helper :welcome
|
||||||
|
@ -503,10 +505,12 @@ class BidsController < ApplicationController
|
||||||
#删除已提交的项目作业(不删项目)
|
#删除已提交的项目作业(不删项目)
|
||||||
def delete
|
def delete
|
||||||
binding_project = params[:binding_project]
|
binding_project = params[:binding_project]
|
||||||
if BidingProject.delete(binding_project)
|
if can_delete_project_homework(BidingProject.find(binding_project),User.current)
|
||||||
redirect_to project_for_bid_path
|
if BidingProject.delete(binding_project)
|
||||||
else
|
redirect_to project_for_bid_path
|
||||||
redirect_to 403;
|
else
|
||||||
|
redirect_to 403;
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
## 新建留言
|
## 新建留言
|
||||||
|
@ -728,9 +732,9 @@ class BidsController < ApplicationController
|
||||||
def update
|
def update
|
||||||
@bid = Bid.find(params[:id])
|
@bid = Bid.find(params[:id])
|
||||||
@project = @bid.courses.first#Project.find(params[:course_id])
|
@project = @bid.courses.first#Project.find(params[:course_id])
|
||||||
if @bid.update_attributes(params[:bid])
|
@bid.save_attachments(params[:attachments] || (params[:bid] && params[:bid][:uploads]))
|
||||||
|
if @bid.update_attributes(params[:bid]) && @bid.save
|
||||||
flash[:notice] = l(:label_update_homework_succeed)
|
flash[:notice] = l(:label_update_homework_succeed)
|
||||||
#@project = Project.find(params[:course_id])
|
|
||||||
redirect_to project_homework_path(@project)
|
redirect_to project_homework_path(@project)
|
||||||
else
|
else
|
||||||
@bid.safe_attributes = params[:bid]
|
@bid.safe_attributes = params[:bid]
|
||||||
|
|
|
@ -0,0 +1,61 @@
|
||||||
|
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])
|
||||||
|
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
|
||||||
|
end
|
||||||
|
|
|
@ -151,4 +151,8 @@ module BidsHelper
|
||||||
tmp
|
tmp
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def can_delete_project_homework bind_project,current_user
|
||||||
|
current_user.id == bind_project.user.id || current_user.admin
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
|
@ -2,9 +2,26 @@ class HomeworkAttach < ActiveRecord::Base
|
||||||
include Redmine::SafeAttributes
|
include Redmine::SafeAttributes
|
||||||
belongs_to :user
|
belongs_to :user
|
||||||
belongs_to :bid
|
belongs_to :bid
|
||||||
|
has_many :journals_for_messages, :as => :jour, :dependent => :destroy
|
||||||
|
seems_rateable :allow_update => true, :dimensions => :quality
|
||||||
|
|
||||||
safe_attributes "bid_id",
|
safe_attributes "bid_id",
|
||||||
"user_id"
|
"user_id"
|
||||||
acts_as_attachable
|
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
|
||||||
end
|
end
|
||||||
|
|
|
@ -21,6 +21,7 @@ class JournalsForMessage < ActiveRecord::Base
|
||||||
|
|
||||||
belongs_to :jour, :polymorphic => true
|
belongs_to :jour, :polymorphic => true
|
||||||
belongs_to :user
|
belongs_to :user
|
||||||
|
belongs_to :homework_attach
|
||||||
belongs_to :at_user, :class_name => "User", :foreign_key => 'reply_id'
|
belongs_to :at_user, :class_name => "User", :foreign_key => 'reply_id'
|
||||||
|
|
||||||
acts_as_event :title => Proc.new {|o| "#{l(:label_my_message)}"},
|
acts_as_event :title => Proc.new {|o| "#{l(:label_my_message)}"},
|
||||||
|
|
|
@ -1,10 +1,15 @@
|
||||||
<!-- #wang -->
|
<!-- #wang -->
|
||||||
<% for attachment in attachments %><%= link_to_attachment attachment, :class => 'icon icon-attachment', :download => true -%>
|
<% for attachment in attachments %>
|
||||||
<% if attachment.is_text? %>
|
<% 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'),
|
<%= link_to image_tag('magnifier.png'),
|
||||||
:controller => 'attachments', :action => 'show',
|
:controller => 'attachments', :action => 'show',
|
||||||
:id => attachment, :filename => attachment.filename %>
|
:id => attachment, :filename => attachment.filename %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<%= h(" - #{attachment.description}") unless attachment.description.blank? %>
|
<%= h(" - #{attachment.description}") unless attachment.description.blank? %>
|
||||||
<span class="size">(<%= number_to_human_size attachment.filesize %>)</span>
|
<span class="size">(<%= number_to_human_size attachment.filesize %>)</span>
|
||||||
|
|
||||||
<% end -%>
|
<% end -%>
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
<span id="attachments_fields">
|
<span id="attachments_fields">
|
||||||
<% if defined?(container) && container && container.saved_attachments %>
|
<% if defined?(container) && container && container.saved_attachments %>
|
||||||
<% container.saved_attachments.each_with_index do |attachment, i| %>
|
<% container.attachments.each_with_index do |attachment, i| %>
|
||||||
<span id="attachments_p<%= i %>">
|
<span id="attachments_p<%= i %>" class="attachment">
|
||||||
<span style="width:100px;"><%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename', :maxlength => 10)%>
|
<%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename readonly', :readonly=>'readonly')%>
|
||||||
</span>
|
|
||||||
<%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 155, :placeholder => l(:label_optional_description), :class => 'description') +
|
<%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 255, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") +
|
||||||
link_to(' '.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') %>
|
link_to(' '.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') %>
|
||||||
<%= render :partial => 'tags/tag', :locals => {:obj => attachment, :object_flag => "6"} %>
|
<%= render :partial => 'tags/tag', :locals => {:obj => attachment, :object_flag => "6"} %>
|
||||||
<%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %>
|
<%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %>
|
||||||
|
|
|
@ -37,5 +37,5 @@
|
||||||
<p><%= hidden_field_tag 'course_id', @project_id %>
|
<p><%= hidden_field_tag 'course_id', @project_id %>
|
||||||
</p>
|
</p>
|
||||||
<fieldset><legend><%= l(:label_attachment_plural) %></legend>
|
<fieldset><legend><%= l(:label_attachment_plural) %></legend>
|
||||||
<p><%= render :partial => 'attachments/form', :locals => {:container => @homework} %></p>
|
<p><%= render :partial => 'attachments/form', :locals => {:container => @bid} %></p>
|
||||||
</fieldset>
|
</fieldset>
|
|
@ -25,8 +25,31 @@
|
||||||
<td colspan="2" valign="top" width="50" ><%= image_tag(url_to_avatar(homework.user), :class => "avatar")%></td>
|
<td colspan="2" valign="top" width="50" ><%= image_tag(url_to_avatar(homework.user), :class => "avatar")%></td>
|
||||||
<td>
|
<td>
|
||||||
<table width="580px" border="0">
|
<table width="580px" border="0">
|
||||||
|
<tr> <strong>作业 :</strong>
|
||||||
|
<% filename = "" %>
|
||||||
|
<% homework.attachments.map do |attachment| %>
|
||||||
|
<% filename = attachment.filename %>
|
||||||
|
<% if homework.attachments.count > 1%>
|
||||||
|
<% filename += "等#{homework.attachments.count}个文件" %>
|
||||||
|
<% end %>
|
||||||
|
<% break %>
|
||||||
|
<% end %>
|
||||||
|
<%= link_to filename , homework_attach_path(homework)%>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="1" valign="top"><strong> <%= link_to homework.user, user_path(homework.user)%></strong> <span class="font_lighter">已提交</span></td>
|
<td colspan="1" valign="top" style="width: 300px">
|
||||||
|
<strong>发布人: <%= link_to homework.user, user_path(homework.user)%></strong>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<strong>作业评分:</strong>
|
||||||
|
<% stars_reates = homework.rates(:quality) %>
|
||||||
|
<% sum = 0 %>
|
||||||
|
<% stars_reates.each do |star_reates| %>
|
||||||
|
<% sum = sum + star_reates.stars %>
|
||||||
|
<% end %>
|
||||||
|
<% stars_reates_count = stars_reates.count == 0 ? 1 : stars_reates.count %>
|
||||||
|
<%= sum * 1.0 / stars_reates_count %>
|
||||||
|
</td>
|
||||||
<td valign="top" align="right">
|
<td valign="top" align="right">
|
||||||
<% if Time.parse(@bid.deadline.to_s) < Time.parse(homework.attachments[0].created_on.to_s) %>
|
<% if Time.parse(@bid.deadline.to_s) < Time.parse(homework.attachments[0].created_on.to_s) %>
|
||||||
<span class="required">迟交</span>
|
<span class="required">迟交</span>
|
||||||
|
@ -36,7 +59,7 @@
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2" valign="top">
|
<td colspan="2" valign="top">
|
||||||
<% if display_id %>
|
<% if display_id %>
|
||||||
<strong><%= l(:label_bidding_user_studentcode) %> :<%= homework.user.user_extensions.student_id%></strong>
|
<strong><%= l(:label_bidding_user_studentcode) %> : <%= homework.user.user_extensions.student_id%></strong>
|
||||||
<% end %>
|
<% end %>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
|
@ -154,9 +154,9 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
</td>
|
</td>
|
||||||
<td align="right">
|
<td align="right">
|
||||||
<% if b_project.user.id == User.current.id || User.current.id == b_project.bid.author.id
|
<% if can_delete_project_homework b_project,User.current
|
||||||
%>
|
%>
|
||||||
<%= link_to image_tag('delete.png'),{ :action => "delete", :binding_project => b_project}, :confirm => "Are you sure?" %>
|
<%= link_to image_tag('delete.png'),{ :action => "delete", :binding_project => b_project}, :confirm => l(:text_are_you_sure) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
|
@ -60,7 +60,6 @@
|
||||||
$("#put-bid-form").hide();
|
$("#put-bid-form").hide();
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<% if User.current.logged? %>
|
<% if User.current.logged? %>
|
||||||
<!--我要竞标弹出框-->
|
<!--我要竞标弹出框-->
|
||||||
<div id = 'flash' style="float:left; width: 100%; display: none" ></div>
|
<div id = 'flash' style="float:left; width: 100%; display: none" ></div>
|
||||||
|
@ -89,15 +88,15 @@
|
||||||
<tr>
|
<tr>
|
||||||
<td><%= f.text_area :bid_message, :id => "bid_message", :required => true, :rows => 4, :cols => 40, :placeholder => l(:label_bid_reason), :style => "resize: none;", :class => 'noline'%></td>
|
<td><%= f.text_area :bid_message, :id => "bid_message", :required => true, :rows => 4, :cols => 40, :placeholder => l(:label_bid_reason), :style => "resize: none;", :class => 'noline'%></td>
|
||||||
</tr>
|
</tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
<tr>
|
<tr>
|
||||||
<td align="right">
|
<td align="right">
|
||||||
<%= submit_tag l(:button_add), :name => nil , :class => "enterprise",
|
<%= submit_tag l(:button_add), :name => nil , :class => "enterprise",
|
||||||
:onmouseout => "this.style.backgroundPosition = 'left top'",
|
:onmouseout => "this.style.backgroundPosition = 'left top'",
|
||||||
:onmouseover => "this.style.backgroundPosition = 'left -30px'"%>
|
:onmouseover => "this.style.backgroundPosition = 'left -30px'"%>
|
||||||
<%= submit_tag l(:button_cancel), :name => nil, :onclick => "cancel();",
|
<%= submit_tag l(:button_cancel), :name => nil, :onclick => "cancel();",
|
||||||
:type => 'button', :class => "enterprise", :onmouseout => "this.style.backgroundPosition = 'left top'",
|
:type => 'button', :class => "enterprise", :onmouseout => "this.style.backgroundPosition = 'left top'",
|
||||||
:onmouseover => "this.style.backgroundPosition = 'left -30px'" %>
|
:onmouseover => "this.style.backgroundPosition = 'left -30px'" %>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
|
@ -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,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,64 @@
|
||||||
|
<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>
|
||||||
|
|
||||||
|
<% 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>
|
||||||
|
</li>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
|
<% end %>
|
|
@ -0,0 +1,4 @@
|
||||||
|
$('#message').html('<%= escape_javascript(render(:partial => 'showjour', :locals => {:jour =>@jour, :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,11 @@
|
||||||
|
<% if @journal_destroyed.nil? %>
|
||||||
|
alert('<%=l(:notice_failed_delete)%>');
|
||||||
|
<% elsif (['Principal','Project', 'Bid', 'Contest', 'Softapplication','HomeworkAttach'].include? @journal_destroyed.jour_type)%>
|
||||||
|
var destroyedItem = $('#word_li_<%=@journal_destroyed.id%>')
|
||||||
|
destroyedItem.fadeOut(600,function(){
|
||||||
|
destroyedItem.remove();
|
||||||
|
});
|
||||||
|
<% else %>
|
||||||
|
$('#message').html('<%= escape_javascript(render(:partial => 'showjour', :locals => {:jour => @jour, :state => false})) %>');
|
||||||
|
$('#new_form_reference_user_id').val("");
|
||||||
|
<% 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>
|
|
@ -15,7 +15,7 @@
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<%= form_for('softapplication_message',
|
<%= form_for('softapplication_message',
|
||||||
:remote => true, :method => :post,
|
:remote => true, :method => :post,
|
||||||
:url => {:controller => 'softapplications',
|
:url => {:controller => 'softapplications',
|
||||||
:action => 'create_message',
|
:action => 'create_message',
|
||||||
|
@ -23,19 +23,19 @@
|
||||||
:sta => sta}
|
:sta => sta}
|
||||||
) do |f|%>
|
) do |f|%>
|
||||||
|
|
||||||
<div id = 'pre_show'>
|
<div id = 'pre_show'>
|
||||||
<%= render :partial => 'pre_show', :locals => {:content => @content} %>
|
<%= render :partial => 'pre_show', :locals => {:content => @content} %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<% if User.current.logged? %>
|
<% if User.current.logged? %>
|
||||||
<table border="0" width="525px" align="center" >
|
<table border="0" width="525px" align="center" >
|
||||||
<tr>
|
<tr>
|
||||||
<td><%= f.text_area 'message', :rows => 3, :cols => 65, :placeholder => l(:label_my_respond), :style => "resize: none;", :class => 'noline'%></td>
|
<td><%= f.text_area 'message', :rows => 3, :cols => 65, :placeholder => l(:label_my_respond), :style => "resize: none;", :class => 'noline'%></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<%= f.text_field :reference_user_id, :style=>"display:none"%> <!--what function?-->
|
<%= f.text_field :reference_user_id, :style=>"display:none"%> <!--what function?-->
|
||||||
|
|
||||||
<!-- modified by bai -->
|
<!-- modified by bai -->
|
||||||
<table border="0" width="518px" align="center">
|
<table border="0" width="518px" align="center">
|
||||||
<tr>
|
<tr>
|
||||||
|
|
|
@ -54,7 +54,7 @@ function checkMaxLength() {
|
||||||
<%= link_to l(:label_projects_feedback_respond),'',
|
<%= 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;"}
|
{:focus => 'project_respond', :onclick => "toggleAndSettingWordsVal($('##{ids}'), $('##{ids} textarea'), '#{l(:label_reply_plural)} #{journal.user.name}: '); $('##{ids} textarea') ;return false;"}
|
||||||
%>
|
%>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if @user == User.current || User.current.admin? || journal.user.id == User.current.id %>
|
<% if @user == User.current || User.current.admin? || journal.user.id == User.current.id %>
|
||||||
<%= link_to(l(:label_newfeedback_delete), {:controller => 'words', :action => 'destroy', :object_id => journal, :user_id => user},
|
<%= link_to(l(:label_newfeedback_delete), {:controller => 'words', :action => 'destroy', :object_id => journal, :user_id => user},
|
||||||
:remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "delete", :title => l(:button_delete)) %>
|
:remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "delete", :title => l(:button_delete)) %>
|
||||||
|
|
|
@ -22,7 +22,8 @@ RedmineApp::Application.routes.draw do
|
||||||
resources :apply_project_masters
|
resources :apply_project_masters
|
||||||
delete 'apply_project_masters', :to => 'apply_project_masters#delete'
|
delete 'apply_project_masters', :to => 'apply_project_masters#delete'
|
||||||
|
|
||||||
|
resources :homework_attach
|
||||||
|
match 'homework_attach/addjours', :controller => 'homework_attach', :action => 'addjours', :via => [:get,:post]
|
||||||
resources :open_source_projects do
|
resources :open_source_projects do
|
||||||
collection do
|
collection do
|
||||||
match 'search', via: [:get, :post]
|
match 'search', via: [:get, :post]
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 522 B |
Loading…
Reference in New Issue