diff --git a/app/controllers/bids_controller.rb b/app/controllers/bids_controller.rb index 0c0b71ffa..206421e5d 100644 --- a/app/controllers/bids_controller.rb +++ b/app/controllers/bids_controller.rb @@ -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 diff --git a/app/controllers/memos_controller.rb b/app/controllers/memos_controller.rb index 20f0b45c4..b4de06fb6 100644 --- a/app/controllers/memos_controller.rb +++ b/app/controllers/memos_controller.rb @@ -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 diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 01021cb57..116ccd5d7 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -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). diff --git a/app/controllers/school_controller.rb b/app/controllers/school_controller.rb index fdcdb8e8a..ec14ba5c8 100644 --- a/app/controllers/school_controller.rb +++ b/app/controllers/school_controller.rb @@ -46,15 +46,21 @@ class SchoolController < ApplicationController @provinces.each do |p| options << "" 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 << "" + school.each do |s| options_s << "
  • #{s.name}
  • " end + res = Hash.new res[:text] = options res[:text_s] = options_s diff --git a/app/models/attachmentstype.rb b/app/models/attachmentstype.rb index 6a37cc51f..fb774836f 100644 --- a/app/models/attachmentstype.rb +++ b/app/models/attachmentstype.rb @@ -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 diff --git a/app/models/biding_project.rb b/app/models/biding_project.rb index cc9c1fba2..0b7b3718e 100644 --- a/app/models/biding_project.rb +++ b/app/models/biding_project.rb @@ -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) diff --git a/app/models/issue.rb b/app/models/issue.rb index b69ac246c..d2332350a 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -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)}" diff --git a/app/models/journal.rb b/app/models/journal.rb index 02d313731..0997640d8 100644 --- a/app/models/journal.rb +++ b/app/models/journal.rb @@ -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' }, diff --git a/app/views/bids/_bid_homework_show.html.erb b/app/views/bids/_bid_homework_show.html.erb index 9237b2aa8..3ef55c567 100644 --- a/app/views/bids/_bid_homework_show.html.erb +++ b/app/views/bids/_bid_homework_show.html.erb @@ -45,7 +45,7 @@ end %> <% if bid.homework_type == 1%> - <%= l(:label_x_homework_project, :count => @temp.count) %>(<%= link_to @temp.count, project_for_bid_path(bid.id) %>) + <%= l(:label_x_homework_project, :count => bid.homeworks.count) %>(<%= link_to bid.homeworks.count, project_for_bid_path(bid.id) %>) <% else %> <%= l(:label_x_homework_project, :count => @temp.count) %>(<%= link_to @temp.count, project_for_bid_path(bid.id) %>) <% end %> diff --git a/app/views/bids/_list_projects.html.erb b/app/views/bids/_list_projects.html.erb index ecbf5dfc3..e51314c48 100644 --- a/app/views/bids/_list_projects.html.erb +++ b/app/views/bids/_list_projects.html.erb @@ -153,7 +153,12 @@ 迟交 <% end %> - <%= link_to image_tag('delete.png') %> + + <% 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 %> + diff --git a/app/views/files/index.html.erb b/app/views/files/index.html.erb index 978b4420a..a4f63e4b2 100644 --- a/app/views/files/index.html.erb +++ b/app/views/files/index.html.erb @@ -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'); } }); } diff --git a/app/views/memos/show.html.erb b/app/views/memos/show.html.erb index 6ea5b17bc..642d71649 100644 --- a/app/views/memos/show.html.erb +++ b/app/views/memos/show.html.erb @@ -65,7 +65,7 @@ <% pages_count = @reply_pages.offset %> <% @replies.each do |reply| %>
    "> -

    <%= pages_count += 1 %>楼 :

    +

    + <%= link_to image_tag(url_to_avatar(message.author), :class => "avatar"), user_path(message.author) %>
    <%= link_to( @@ -150,7 +151,7 @@
    - <%= link_to image_tag(url_to_avatar(message.author), :class => "avatar"), user_path(message.author) %> +
    <%= textilizable message, :content, :attachments => message.attachments %> diff --git a/app/views/projects/_member_list.html.erb b/app/views/projects/_member_list.html.erb index ce5dfc694..6fe6b55f0 100644 --- a/app/views/projects/_member_list.html.erb +++ b/app/views/projects/_member_list.html.erb @@ -12,7 +12,7 @@ <% if @project.project_type == 1 %> <% unless member.user.user_extensions.identity ==0 %> - <% 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 %> diff --git a/app/views/repositories/show.html.erb b/app/views/repositories/show.html.erb index 493280647..09ab9738f 100644 --- a/app/views/repositories/show.html.erb +++ b/app/views/repositories/show.html.erb @@ -13,7 +13,6 @@ <%=h @repository.url %> <% end %>
    - <% if @repositories.size >1 %>

    (<%= 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(' | ').html_safe %>)

    - <% else %>

    项目代码请设置好正确的编码方式(utf-8),否则中文会出现乱码

    建立版本库文件夹,打开命令行执行如下:

    @@ -29,6 +27,7 @@

    git add *

    git commit -m "first commit"

    git remote add origin <%= @repos_url%>

    +

    git config http.postBuffer 524288000 #设置本地post缓存为500MB

    git push -u origin master:master

    已经有本地库,还没有配置远程地址,打开命令行执行如下:

    @@ -36,6 +35,7 @@

    git remote add origin <%= @repos_url%>

    git add .

    git commit -m "first commit"

    +

    git config http.postBuffer 524288000 #设置本地post缓存为500MB

    git push -u origin master:matser

    @@ -44,10 +44,10 @@

    git remote add trustie <%= @repos_url%>

    git add .

    git commit -m "first commit"

    +

    git config http.postBuffer 524288000 #设置本地post缓存为500MB

    git push -u trustie master:matser

    <%= link_to "李海提供", user_path(646)%>

    - <% end %> <% if !@entries.nil? && authorize_for('repositories', 'browse') %> <%= render :partial => 'dir_list' %> diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index 8168060e5..d521d59f5 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -33,15 +33,24 @@ <% when 'JournalsForMessage' %> <% if User.current.login == @user.login %> <%# if e.user_id == act.jour.id %> - <%= link_to("#{e.user.name}", user_path(e.user_id)) %> 有了<%= link_to("#{e.act.user.name}", user_path(e.user.id))%>的留言 + <%= link_to("#{l(:label_i)}", user_path(e.user_id)) %> <%= l(:label_have_feedback) %><%= + link_to("#{e.act.user.name}", user_path(e.user.id)) %><%= l(:label_of_feedback) + l(:label_layouts_feedback) %> <%# else %> <%# end %> <% else %> - <%= link_to("#{@user.name}", user_path(e.user_id)) %> 有了新的动态 + <%= link_to("#{e.user.name}", user_path(e.user_id)) %> <%= l(:label_have_feedback) %><%= + link_to("#{e.act.user.name}", user_path(e.user.id)) %><%= l(:label_of_feedback) + l(:label_layouts_feedback) %> <% end %> -

    <%=textilizable act.notes %>

    - + +

    <%= textilizable act.notes %>

    +
    <%= link_to(l(:label_goto), user_newfeedback_user_path(e.user_id)) %> +
    + + + + +
    <%=(l(:label_update_time).to_s << ':' << format_time(e.act.created_on)).to_s %>
    @@ -171,9 +180,26 @@
    <%= (l(:label_update_time).to_s << ':' << format_time(e.act.created_on)).to_s %>
    -
    <%= link_to l(:label_find_all_comments), {:controller => 'issues', :action => 'show', :id => act.id} %><%= l(:label_comments_count, :count => e.act.journals.count)%>
    +
    <%= link_to l(:label_find_all_comments), {:controller => 'issues', :action => 'show', :id => act.id} %><%= l(:label_comments_count, :count => e.act.journals.count)%>
    +<% when 'Contest' %> + + <% if e.user == User.current%> + <%= link_to("#{l(:label_i)}", user_path(e.user_id)) %> <%= l(:label_i_new_activity) %> <%= link_to format_activity_title("#{l(:label_contest)}: #{act.name}"), {:controller => 'contests', :action => 'show_contest', :id => act.id} %> + <% else %> + <%= link_to(h(e.user), user_path(e.user_id)) %> <%= l(:label_new_activity) %> <%= link_to format_activity_title("#{l(:label_contest)}: #{act.name}"), {:controller => 'contests', :action => 'show_contest', :id => act.id} %> + <% end %> + +

    <%= h act.description %>

    + + +
    + <%= (l(:label_update_time).to_s << ':' << format_time(e.act.created_on)).to_s %> +
    + +<% else %> + <% f=1 %> <% end %> diff --git a/app/views/users/user_projects.html.erb b/app/views/users/user_projects.html.erb index 6b218a97d..ffb420339 100644 --- a/app/views/users/user_projects.html.erb +++ b/app/views/users/user_projects.html.erb @@ -1,6 +1,6 @@ <%= 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)%> -温馨提示:项目可以是一次作业,也可以是别人或者自己创建的一项小工程~ + <%= watch_projects @state %> <% unless @memberships.empty? %>
    diff --git a/app/views/users/watch_projects.html.erb b/app/views/users/watch_projects.html.erb index 7842e6d52..42047d4ea 100644 --- a/app/views/users/watch_projects.html.erb +++ b/app/views/users/watch_projects.html.erb @@ -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)%> -温馨提示:项目可以是一次作业,也可以是别人或者自己创建的一项小工程~ + <%= watch_projects @state%> <% if @watch_projects.count > 0 %> <% for watch_project in @watch_projects %> diff --git a/app/views/welcome/contest.html.erb b/app/views/welcome/contest.html.erb index 8fa857708..65c96e4d0 100644 --- a/app/views/welcome/contest.html.erb +++ b/app/views/welcome/contest.html.erb @@ -153,7 +153,7 @@ <%= 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 %> - (<%= link_to("含#{contest.projects.where('is_public=1').count}个app", show_attendingcontest_contest_path(contest), :target => "_blank") %>) + (<%= link_to("含#{contest.projects.where('is_public=1').count}个作品", show_attendingcontest_contest_path(contest), :target => "_blank") %>) <% else %> (<%= link_to("含#{contest.contesting_softapplications.count}个app", show_attendingcontest_contest_path(contest), :target => "_blank") %>) <% end %> diff --git a/config/locales/en.yml b/config/locales/en.yml index 1ae68b839..0215d43b6 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -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: diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 219327f45..3d8a0e54e 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -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: diff --git a/config/routes.rb b/config/routes.rb index 46d710b64..d93112c54 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -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' diff --git a/public/stylesheets/nyan.css b/public/stylesheets/nyan.css index 24fffd20f..e1088c8c0 100644 --- a/public/stylesheets/nyan.css +++ b/public/stylesheets/nyan.css @@ -950,7 +950,7 @@ div.issue { /* project 文件列表 资源库 *******************************************************************************/ .tags_area { - height: 5px; + height: 13px; } #ver-zebra, .file_table_des {