Merge branch 'develop'

This commit is contained in:
t430 2014-05-15 18:16:24 +08:00
commit 03ee62de64
23 changed files with 108 additions and 35 deletions

View File

@ -7,7 +7,7 @@ class BidsController < ApplicationController
menu_item :homework_respond, :only => :homework_respond
menu_item :homework_statistics, :only => :homework_statistics
#Ended by young
before_filter :find_bid, :only => [:show, :show_project, :create,:destroy,:more,:back,:add,:new,:show_results,:set_reward, :add_homework, :fork, :create_fork,
before_filter :find_bid, :only => [:show, :show_project, :create,:destroy,:more,:back,:add,:delete,:new,:show_results,:set_reward, :add_homework, :fork, :create_fork,
:show_course, :show_bid_project, :show_bid_user, :join_in_contest, :unjoin_in_contest, :new_join,:show_participator, :settings]
# added by fq
before_filter :require_login, :only => [:join_in_contest, :unjoin_in_contest]
@ -500,6 +500,15 @@ class BidsController < ApplicationController
end
end
#删除已提交的项目作业(不删项目)
def delete
binding_project = params[:binding_project]
if BidingProject.delete(binding_project)
redirect_to project_for_bid_path
else
redirect_to 403;
end
end
## 新建留言
def create
@ -693,7 +702,10 @@ class BidsController < ApplicationController
redirect_to respond_path(@bid)
else
@bid.safe_attributes = params[:bid]
render :action => 'new_bid'
@homework = @bid
@project = Project.find_by_id(params[:course_id])
@project_id = @project.id
render file: 'projects/new_homework', layout: 'base_courses'
end
end

View File

@ -94,7 +94,7 @@ class MemosController < ApplicationController
@reply_pages = Paginator.new @reply_count, pre_count, page
@replies = @memo.children.
includes(:author, :attachments).
reorder("#{Memo.table_name}.created_at ASC").
reorder("#{Memo.table_name}.created_at DESC").
limit(@reply_pages.per_page).
offset(@reply_pages.offset).
all

View File

@ -812,6 +812,8 @@ class ProjectsController < ApplicationController
@render_file = 'member_list'
# 判断是否课程
if @project.project_type == Project::ProjectType_course
@teachers= searchTeacherAndAssistant(@project)
@canShowCode = isCourseTeacher(User.current.id)
case params[:role]
when '1'
@subPage_title = l :label_teacher_list
@ -833,6 +835,15 @@ class ProjectsController < ApplicationController
render :layout => 'base_courses' if @project.project_type == 1
end
#判断指定用户是否为课程教师
def isCourseTeacher(id)
result = false
if @teachers.find_by_user_id(id) != nil
result = true
end
result
end
def sort_project_members project, members
#userGrade = UserGrade.where(:project_id => project.id)
users = UserGrade.where(:project_id => project.id).

View File

@ -46,15 +46,21 @@ class SchoolController < ApplicationController
@provinces.each do |p|
options << "<option value = '#{p.province}' >#{p.province}</option>"
end
@school = School.all
# 取id取学校名
# 连接子表: 查询已添加用户的学校
school = School.select("id, name").
joins("RIGHT JOIN (
SELECT DISTINCT school_id
FROM #{UserExtensions.table_name}
WHERE school_id IS NOT NULL) AS sids ON schools.id = sids.school_id").
where("#{School.table_name}.id IS NOT NULL")
options_s = ""
@school.each do |s|
#options << "<option value=#{s.id}>#{s.name}</option>"
school.each do |s|
options_s << "<li style = 'width: 33%; float: left'><a id=#{s.id} onclick='test(this.id, this.text)'>#{s.name}</a></li>"
end
res = Hash.new
res[:text] = options
res[:text_s] = options_s

View File

@ -3,7 +3,7 @@ class Attachmentstype < ActiveRecord::Base
has_many :attachments, :foreign_key => "attachtype",:primary_key => "id"
# 当前使用的文件内容分类列表
@@SuffixArr = ['pdf','zip','doc','docx','rar','txt','jpg','bmp','xls','xlsx']
@@SuffixArr = ['pdf','zip','doc','docx','ppt','pptx','rar','txt','jpg','bmp','xls','xlsx']
def suffixArr
@@SuffixArr

View File

@ -19,7 +19,7 @@ class BidingProject < ActiveRecord::Base
self.create(:user_id => User.current.id, :bid_id => bid_id,
:project_id => project_id, :description => description)
end
# used to update the reward ,the value varies from 0,1,2,3,4,5
# added by william
def update_reward(which)

View File

@ -57,7 +57,7 @@ class Issue < ActiveRecord::Base
:include => [:project, :visible_journals],
# sort by id so that limited eager loading doesn't break with postgresql
:order_column => "#{table_name}.id"
acts_as_event :title => Proc.new {|o|
acts_as_event :title => Proc.new {|o|
#"#{o.tracker.name} ##{o.id} (#{o.status}): #{o.subject}"
"#{o.tracker.name} #{o.source_from} (#{o.status}): #{o.subject}"
},
@ -991,6 +991,11 @@ class Issue < ActiveRecord::Base
"#{tracker} ##{id}: #{subject}"
end
# 缺陷在项目中的序号
def inProjectIndex
(self.project.issues.index(self).to_i + 1).to_s
end
# Returns a string of css classes that apply to the issue
def css_classes
s = "issue tracker-#{tracker_id} status-#{status_id} #{priority.try(:css_classes)}"

View File

@ -29,8 +29,8 @@ class Journal < ActiveRecord::Base
# end
attr_accessor :indice
acts_as_event :title => Proc.new {|o| status = ((s = o.new_status) ? " (#{s})" : nil); "#{o.issue.tracker} ##{o.issue.id}#{status}: #{o.issue.subject}" },
:description => :notes,
acts_as_event :title =>Proc.new {|o| status = ((s = o.new_status) ? " (#{s})" : nil); "#{o.issue.tracker} ##{o.issue.inProjectIndex}#{status}: #{o.issue.subject}" },
:description =>:notes,
:author => :user,
:group => :issue,
:type => Proc.new {|o| (s = o.new_status) ? (s.is_closed? ? 'issue-closed' : 'issue-edit') : 'issue-note' },

View File

@ -45,7 +45,7 @@
end
%>
<% if bid.homework_type == 1%>
<%= l(:label_x_homework_project, :count => @temp.count) %>(<strong><%= link_to @temp.count, project_for_bid_path(bid.id) %></strong>)
<%= l(:label_x_homework_project, :count => bid.homeworks.count) %>(<strong><%= link_to bid.homeworks.count, project_for_bid_path(bid.id) %></strong>)
<% else %>
<%= l(:label_x_homework_project, :count => @temp.count) %>(<strong><%= link_to @temp.count, project_for_bid_path(bid.id) %></strong>)
<% end %></span>

View File

@ -153,7 +153,12 @@
<span class="required">迟交</span>
<% end %>
</td>
<td align="right"><%= link_to image_tag('delete.png') %></td>
<td align="right">
<% if b_project.user.id == User.current.id || User.current.id == b_project.bid.author.id
%>
<%= link_to image_tag('delete.png'),{ :action => "delete", :binding_project => b_project}, :confirm => "Are you sure?" %>
<% end %>
</td>
</tr>
</table>
</td>

View File

@ -82,7 +82,7 @@
var $tags = $td_tags_area.find('#tags')
var $icona = $td_tags_area.find('.tags_icona')
var slideHeight = 5; //px
var slideHeight = 13; //px
var defHeight = $tags.height();
var curHeight = $tags_area.height();
@ -181,7 +181,7 @@
alert('error');
});
} else if (textStatus == 'error') {
alert('error');
alert('An error has occurred');
}
});
}

View File

@ -65,7 +65,7 @@
<% pages_count = @reply_pages.offset %>
<% @replies.each do |reply| %>
<div class="reply" id="<%= "reply-#{reply.id}" %>">
<p class="font_lighter"><%= pages_count += 1 %>楼 :</p>
<p class="font_lighter"><!--<span style="display: inline"><%= pages_count += 1 %>楼 :</span>--></p>
<div class="contextual-borad">
<!-- <%= link_to(
image_tag('comment.png'),
@ -103,7 +103,7 @@
) if reply.destroyable_by?(User.current) %>
</div>
<br/>
<table class="borad-text-list">
<tr>
<td rowspan="3" valign="top" width="60px">

View File

@ -124,7 +124,8 @@
<table class="borad-text-list">
<tr>
<td class="font_lighter"><span style="display: none"><%= reply_count += 1 %>楼</span> </td>
<!--<td class="font_lighter"> </td> -->
<td rowspan="3" valign="top" width="60px"><%= link_to image_tag(url_to_avatar(message.author), :class => "avatar"), user_path(message.author) %></td>
<td>
<div class="contextual-borad">
<%= link_to(
@ -150,7 +151,7 @@
</div></td>
</tr>
<tr>
<td rowspan="3" valign="top" width="60px"><%= link_to image_tag(url_to_avatar(message.author), :class => "avatar"), user_path(message.author) %></td>
<td class="comments">
<div class="wiki">
<%= textilizable message, :content, :attachments => message.attachments %>

View File

@ -12,7 +12,7 @@
<% if @project.project_type == 1 %>
<% unless member.user.user_extensions.identity ==0 %>
<!-- added by bai 加学号 -->
<% if User.current.logged? && (!Member.where('user_id = ? and project_id = ?', User.current.id, @project.id).first.nil?) %>
<%if @canShowCode# if User.current.logged? && (!Member.where('user_id = ? and project_id = ?', User.current.id, @project.id).first.nil?) %>
<%= content_tag "p", "#{l(:label_bidding_user_studentcode)}#{' : '}#{member.user.user_extensions.student_id}", :class => "nomargin avatar_name" %>
<% end %>
<% end %>

View File

@ -13,7 +13,6 @@
<td><%=h @repository.url %></td>
<% end %>
</div>
<% if @repositories.size >1 %>
<p style=" word-wrap: break-word; word-break: break-all">
(<%= l(:label_all_revisions) %><%= @repositories.sort.collect {|repo|
link_to h(repo.name),
@ -21,7 +20,6 @@
:id => @project, :repository_id => repo.identifier_param, :rev => nil, :path => nil},
:class => 'repository' + (repo == @repository ? ' selected' : '')
}.join('&nbsp|&nbsp').html_safe %>)</p>
<% else %>
<h3>项目代码请设置好正确的编码方式utf-8否则中文会出现乱码</h3>
<h3>建立版本库文件夹,打开命令行执行如下:</h3>
<div class="repos_explain">
@ -29,6 +27,7 @@
<p>git add *</p>
<p>git commit -m "first commit"</p>
<p>git remote add origin <%= @repos_url%></p>
<p>git config http.postBuffer 524288000 #设置本地post缓存为500MB</p>
<p>git push -u origin master:master</p>
</div>
<h3>已经有本地库,还没有配置远程地址,打开命令行执行如下:</h3>
@ -36,6 +35,7 @@
<p>git remote add origin <%= @repos_url%></p>
<p>git add .</p>
<p>git commit -m "first commit"</p>
<p>git config http.postBuffer 524288000 #设置本地post缓存为500MB</p>
<p>git push -u origin master:matser</p>
</div>
</h3>
@ -44,10 +44,10 @@
<p>git remote add trustie <%= @repos_url%></p>
<p>git add .</p>
<p>git commit -m "first commit"</p>
<p>git config http.postBuffer 524288000 #设置本地post缓存为500MB</p>
<p>git push -u trustie master:matser</p>
<p><%= link_to "李海提供", user_path(646)%></p>
</div>
<% end %>
</h3>
<% if !@entries.nil? && authorize_for('repositories', 'browse') %>
<%= render :partial => 'dir_list' %>

View File

@ -33,15 +33,24 @@
<% when 'JournalsForMessage' %>
<% if User.current.login == @user.login %>
<%# if e.user_id == act.jour.id %>
<tr><td colspan="2" valign="top"><strong><%= link_to("#{e.user.name}", user_path(e.user_id)) %></strong>&nbsp;<span class="font_lighter">有了<%= link_to("#{e.act.user.name}", user_path(e.user.id))%>的留言</span></td></tr>
<tr><td colspan="2" valign="top"><strong><%= link_to("#{l(:label_i)}", user_path(e.user_id)) %></strong>&nbsp;<span class="font_lighter"><%= l(:label_have_feedback) %><%=
link_to("#{e.act.user.name}", user_path(e.user.id)) %><%= l(:label_of_feedback) + l(:label_layouts_feedback) %></span></td></tr>
<%# else %>
<!-- <tr><td colspan="2" valign="top" class="font_lighter"><strong><%#= link_to("#{e.user.name}", user_path(e.user_id)) %> 给 <%#= link_to("#{act.at_user.name if act.at_user}", user_path(act.jour.id)) %> 留言了</strong>&nbsp;</td></tr> -->
<%# end %>
<% else %>
<tr><td colspan="2" valign="top"><strong><%= link_to("#{@user.name}", user_path(e.user_id)) %></strong>&nbsp;<span class="font_lighter">有了新的动态</span></td></tr>
<tr><td colspan="2" valign="top"><strong><%= link_to("#{e.user.name}", user_path(e.user_id)) %></strong>&nbsp;<span class="font_lighter"><%= l(:label_have_feedback) %><%=
link_to("#{e.act.user.name}", user_path(e.user.id)) %><%= l(:label_of_feedback) + l(:label_layouts_feedback) %></span></td></tr>
<% end %>
<tr> <td colspan="2" width="580" > <p class="font_description"> <%=textilizable act.notes %> </p></td> </tr>
<tr> <td>
<tr>
<td colspan="2" width="580"><p class="font_description"> <%= textilizable act.notes %> </p>
<div style="display: inline-block; float: right; margin-top: 0px"><span><%= link_to(l(:label_goto), user_newfeedback_user_path(e.user_id)) %>
</span></div>
</td>
</tr>
<tr>
<td>
<div style="display: inline-block; float: left; margin-top: 0px" width="200" align="right" class="a">
<span class="font_lighter"> <%=(l(:label_update_time).to_s << ':' << format_time(e.act.created_on)).to_s %></span>
</div>
@ -171,9 +180,26 @@
<div style="display: inline-block; float: left; margin-top: 0px" width="200" align="right" class="a">
<span class="font_lighter"> <%= (l(:label_update_time).to_s << ':' << format_time(e.act.created_on)).to_s %></span>
</div>
<div style="display: inline-block; float: right; margin-top: 0px"><span><%= link_to l(:label_find_all_comments), {:controller => 'issues', :action => 'show', :id => act.id} %></span><a class="font_lighter"><%= l(:label_comments_count, :count => e.act.journals.count)%></a></div>
<div style="display: inline-block; float: right; margin-top: 0px"><span><%= link_to l(:label_find_all_comments), {:controller => 'issues', :action => 'show', :id => act.id} %></span><a class="font_lighter"><%= l(:label_comments_count, :count => e.act.journals.count)%></a></div>
</td>
</tr>
<% when 'Contest' %>
<tr>
<% if e.user == User.current%>
<td colspan="2" valign="top"><strong><%= link_to("#{l(:label_i)}", user_path(e.user_id)) %></strong>&nbsp;<span class="font_lighter"><%= l(:label_i_new_activity) %></span>&nbsp;<%= link_to format_activity_title("#{l(:label_contest)}: #{act.name}"), {:controller => 'contests', :action => 'show_contest', :id => act.id} %></td>
<% else %>
<td colspan="2" valign="top"><strong><%= link_to(h(e.user), user_path(e.user_id)) %></strong>&nbsp;<span class="font_lighter"><%= l(:label_new_activity) %></span>&nbsp;<%= link_to format_activity_title("#{l(:label_contest)}: #{act.name}"), {:controller => 'contests', :action => 'show_contest', :id => act.id} %></td>
<% end %>
</tr>
<tr> <td colspan="2" width="580" > <p class="font_description"> <%= h act.description %> </p></td> </tr>
<tr>
<td>
<div style="display: inline-block; float: left; margin-top: 0px" width="200" align="right" class="a">
<span class="font_lighter"> <%= (l(:label_update_time).to_s << ':' << format_time(e.act.created_on)).to_s %></span>
</div>
</tr>
<% else %>
<% f=1 %>
<% end %><!-- < % #case end %> -->
</table>
</td>

View File

@ -1,6 +1,6 @@
<!--add by huang-->
<%= link_to(l(:label_project_new), {:controller => 'projects', :action => 'new', :course => 0, :project_type => 0}, :class => 'icon icon-add') if(User.current.allowed_to?(:add_project, nil, :global => true) && @user == User.current)%>
<span class="font_lighter" >温馨提示:项目可以是一次作业,也可以是别人或者自己创建的一项小工程~</span>
<!--span class="font_lighter" >温馨提示:项目可以是一次作业,也可以是别人或者自己创建的一项小工程~</span-->
<%= watch_projects @state %>
<% unless @memberships.empty? %>
<div class="content_frame">

View File

@ -1,5 +1,5 @@
<%= link_to(l(:label_project_new), {:controller => 'projects', :action => 'new', :course => 0, :project_type => 0}, :class => 'icon icon-add') if(User.current.allowed_to?(:add_project, nil, :global => true) && @user == User.current)%>
<span class="font_lighter" >温馨提示:项目可以是一次作业,也可以是别人或者自己创建的一项小工程~</span>
<!--span class="font_lighter" >温馨提示:项目可以是一次作业,也可以是别人或者自己创建的一项小工程~</span-->
<%= watch_projects @state%>
<% if @watch_projects.count > 0 %>
<% for watch_project in @watch_projects %>

View File

@ -153,7 +153,7 @@
<!-- <%= link_to(contest.name, contest.event_url, :class => "d-g-blue d-p-project-name", :title => "#{contest.name}", :target => "_blank") %> -->
<%= link_to(contest.name, show_contest_contest_path(contest.id), :class => "d-g-blue d-p-project-name", :title => "#{contest.name}", :target => "_blank") %>
<% if contest.id == 2 or contest.id == 3 or contest.id == 6 %>
<span class="font_lighter">(<span style="font-size: 13px"><%= link_to("含#{contest.projects.where('is_public=1').count}个app", show_attendingcontest_contest_path(contest), :target => "_blank") %></span>)</span>
<span class="font_lighter">(<span style="font-size: 13px"><%= link_to("含#{contest.projects.where('is_public=1').count}个作品", show_attendingcontest_contest_path(contest), :target => "_blank") %></span>)</span>
<% else %>
<span class="font_lighter">(<span style="font-size: 13px"><%= link_to("含#{contest.contesting_softapplications.count}个app", show_attendingcontest_contest_path(contest), :target => "_blank") %></span>)</span>
<% end %>

View File

@ -1306,6 +1306,7 @@ en:
label_have_respond: had a respond
label_welcome: Welcome
label_goto: Go to>>
label_join: join Trustie
label_repository_new: link to existing SVN repository
label_repository_path: path of repository
@ -1411,6 +1412,8 @@ en:
label_user_activity_myself: About me
label_user_all_respond: All replies
label_layouts_feedback: Messages
label_have_feedback: Have
label_of_feedback: Of
label_welcome_participate: participates
#modify by men
label_x_welcome_participate:

View File

@ -1497,6 +1497,7 @@ zh:
label_issue_praise_over: 我刚才顶过了~
label_issue_tread_over: 我刚才踩过了~
#end
label_goto: 前往>>
label_issue_appraise_over: 只能评价一次哦!
label_welcome_my_respond: 请在此留下你的意见和建议!
label_no_current_fans: 该用户暂无粉丝
@ -1577,6 +1578,8 @@ zh:
label_my_honework_no_homework: 暂无任何作业!
label_user_all_respond: 所有反馈
label_layouts_feedback: 留言
label_have_feedback: 有了
label_of_feedback:
label_welcome_participate: 参与了
#modify by men
label_x_welcome_participate:

View File

@ -552,6 +552,7 @@ RedmineApp::Application.routes.draw do
match 'calls/:id/show_project', :controller => 'bids', :action => 'show_project', :as => 'project_for_bid'
match 'calls/:id/show_project_homework', :controller => 'bids', :action => 'show_project_homework', :as => 'project_for_bid_homework' # by huang
match 'calls/:id/add', :controller => 'bids', :action => 'add'
match 'calls/:id/delete', :controller => 'bids', :action => 'delete'
match 'calls/:id/add_homework', :controller => 'bids', :action => 'add_homework', via: :post
match 'calls/:id/new_submit_homework', to: 'bids#new_submit_homework', via: :get, as: 'new_submit_homework'
match 'words/add_project_respond', :controller => 'words', :action => 'add_project_respond'

View File

@ -950,7 +950,7 @@ div.issue {
/* project 文件列表 资源库
*******************************************************************************/
.tags_area {
height: 5px;
height: 13px;
}
#ver-zebra, .file_table_des {