diff --git a/app/controllers/bids_controller.rb b/app/controllers/bids_controller.rb index 868e3edac..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 diff --git a/app/controllers/contests_controller.rb b/app/controllers/contests_controller.rb index 7741333a8..debda938f 100644 --- a/app/controllers/contests_controller.rb +++ b/app/controllers/contests_controller.rb @@ -5,7 +5,7 @@ class ContestsController < ApplicationController menu_item :project, :only => :show_project menu_item :application, :only => :show_softapplication menu_item :attendingcontest, :only => :show_attendingcontest - before_filter :find_contest, :only => [:show_contest, :show_project, :show_softapplication, :show_attendingcontest, :create,:destroy,:more,:back,:add,:add_softapplication,:new,:show_results, :set_reward, + before_filter :find_contest, :only => [:show_contest, :show_project, :show_softapplication, :show_attendingcontest, :set_reward_project, :set_reward_softapplication, :create,:destroy,:more,:back,:add,:add_softapplication,:new,:show_results, :set_reward, :show_contest_project, :show_contest_user, :join_in_contest, :unjoin_in_contest, :new_join,:show_participator, :settings] # added by fq @@ -335,7 +335,12 @@ class ContestsController < ApplicationController end ##取出参赛应用 @softapplication = Softapplication.all - @contesting_softapplication = @contest.contesting_softapplications.reverse + @contesting_softapplication = @contest.contesting_softapplications. + joins("LEFT JOIN softapplications ON contesting_softapplications.softapplication_id=softapplications.id"). + joins("LEFT JOIN ( + SELECT * FROM seems_rateable_cached_ratings WHERE cacheable_type='Softapplication' AND DIMENSION = 'quality') AS cached + ON cached.cacheable_id=softapplications.id"). + order("cached.avg").reverse_order @contesting_softapplication = paginateHelper @contesting_softapplication, 10 @@ -350,6 +355,44 @@ class ContestsController < ApplicationController end ###end + + def set_reward_project + @c_p = nil + @contesting_project_id = nil + + if params[:set_reward_project][:reward]&&((User.current.id==@contest.author_id)||User.current.admin) + # @bid_id = params[:id] + @contesting_project_id = params[:set_reward_project][:c_id] + @c_p = ContestingProject.find_by_id(@contesting_project_id) + + # 把字段存进表中 + @c_p.update_reward(params[:set_reward_project][:reward].to_s) + end + + respond_to do |format| + format.js + end + end + + def set_reward_softapplication + @c_sa = nil + @contesting_softapplication_id = nil + + if params[:set_reward_softapplication][:reward]&&((User.current.id==@contest.author_id)||User.current.admin) + # @bid_id = params[:id] + @contesting_softapplication_id = params[:set_reward_softapplication][:c_id] + @c_sa = ContestingSoftapplication.find_by_id(@contesting_softapplication_id) + + # 把字段存进表中 + @c_sa.update_reward(params[:set_reward_softapplication][:reward].to_s) + end + + respond_to do |format| + format.js + end + end + + ###添加已创建的参赛项目 def add project = Project.find(params[:contest]) 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/controllers/softapplications_controller.rb b/app/controllers/softapplications_controller.rb index 9ede52489..6860bfa6a 100644 --- a/app/controllers/softapplications_controller.rb +++ b/app/controllers/softapplications_controller.rb @@ -100,14 +100,34 @@ class SoftapplicationsController < ApplicationController # POST /softapplications # POST /softapplications.json + # def create + # @softapplication = Softapplication.new(params[:softapplication]) + # @softapplication.user = User.current + # @softapplication.save_attachments(params[:attachments]) + # respond_to do |format| + # if @softapplication.save + # format.js + # format.html { redirect_to @softapplication, notice: 'Softapplication was successfully created.' } + # # format.json { render json: @softapplication, status: :created, location: @softapplication } + # else + # format.js { render status: 406 } + # format.html { render action: "new" } + # # format.json { render json: @softapplication.errors, status: :unprocessable_entity } + # end + # end + # end + + +#new changed created function def create @softapplication = Softapplication.new(params[:softapplication]) @softapplication.user = User.current @softapplication.save_attachments(params[:attachments]) respond_to do |format| if @softapplication.save + ContestingSoftapplication.create(:contest_id => params[:contest_id], :softapplication_id => @softapplication.id) format.js - format.html { redirect_to @softapplication, notice: 'Softapplication was successfully created.' } + format.html { redirect_to show_attendingcontest_contest_path(:id => params[:contest_id]) } # format.json { render json: @softapplication, status: :created, location: @softapplication } else format.js { render status: 406 } @@ -115,8 +135,13 @@ class SoftapplicationsController < ApplicationController # format.json { render json: @softapplication.errors, status: :unprocessable_entity } end end + #关联新建的参赛作品 + + # @contesting_softapplication = paginateHelper @contest.contesting_softapplications + + + end - # PUT /softapplications/1 # PUT /softapplications/1.json def update diff --git a/app/helpers/contests_helper.rb b/app/helpers/contests_helper.rb index 36f2351cb..fff2f785a 100644 --- a/app/helpers/contests_helper.rb +++ b/app/helpers/contests_helper.rb @@ -91,6 +91,10 @@ module ContestsHelper def get_prize(c_project) c_project.get_reward end + + def get_prize(c_softapplication) + c_softapplication.get_reward + end def count_contest_project contests = Contest.find(:id) 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/contesting_softapplication.rb b/app/models/contesting_softapplication.rb index 93aea2658..f880818d9 100644 --- a/app/models/contesting_softapplication.rb +++ b/app/models/contesting_softapplication.rb @@ -11,5 +11,18 @@ class ContestingSoftapplication < ActiveRecord::Base self.create(:user_id => User.current.id, :contest_id => contest_id, :softapplication_id => softapplication_id, :description => description) end + + def self.create_work_contesting(contest_id, softapplication_id) + self.create(:user_id => User.current.id, :contest_id => contest_id, + :softapplication_id => softapplication_id) + end + + def update_reward(which) + self.update_attribute(:reward,which) + end + + def get_reward + self.reward + end end 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/models/softapplication.rb b/app/models/softapplication.rb index 6782b2436..3911424e9 100644 --- a/app/models/softapplication.rb +++ b/app/models/softapplication.rb @@ -1,5 +1,5 @@ class Softapplication < ActiveRecord::Base - attr_accessible :android_min_version_available, :app_type_id, :app_type_name, :description, :name, :user_id, :contest_id, :application_developers + attr_accessible :android_min_version_available, :app_type_id, :app_type_name, :description, :name, :user_id, :contest_id, :application_developers, :deposit_project_url acts_as_attachable seems_rateable :allow_update => true, :dimensions => :quality 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/contests/set_reward.js.erb b/app/views/contests/set_reward_project.js.erb similarity index 87% rename from app/views/contests/set_reward.js.erb rename to app/views/contests/set_reward_project.js.erb index d6d8c4f9f..c0de3e2ef 100644 --- a/app/views/contests/set_reward.js.erb +++ b/app/views/contests/set_reward_project.js.erb @@ -1,15 +1,14 @@ $('#reward_result_<%= @contesting_project_id %>').html('<%= j( -if get_prize(@b_p).nil? or get_prize(@b_p) == "" +if get_prize(@c_p).nil? or get_prize(@c_p) == "" if @contest.deadline < Date.today puts '未评奖' end else - case get_prize(@b_p) + case get_prize(@c_p) when '-1' image_tag("/images/bid/special_reward.png") - when '1' when '0' image_tag("/images/bid/first_reward.png") when '1' @@ -22,7 +21,7 @@ else image_tag("/images/bid/fifth_reward.png") when '5' image_tag("/images/bid/qualified.png") - end + end end ) diff --git a/app/views/contests/set_reward_softapplication.js.erb b/app/views/contests/set_reward_softapplication.js.erb new file mode 100644 index 000000000..a8cf0d486 --- /dev/null +++ b/app/views/contests/set_reward_softapplication.js.erb @@ -0,0 +1,30 @@ +$('#reward_result_<%= @contesting_softapplication_id %>').html('<%= j( + +if get_prize(@c_sa).nil? or get_prize(@c_sa) == "" + if @contest.deadline < Date.today + puts '未评奖' + end +else + + case get_prize(@c_sa) + when '-1' + image_tag("/images/bid/special_reward.png") + when '0' + image_tag("/images/bid/first_reward.png") + when '1' + image_tag("/images/bid/second_reward.png") + when '2' + image_tag("/images/bid/third_reward.png") + when '3' + image_tag("/images/bid/forth_reward.png") + when '4' + image_tag("/images/bid/fifth_reward.png") + when '5' + image_tag("/images/bid/qualified.png") + end + +end +) +%>') + +$('#<%= @contesting_softapplication_id %>').hide() diff --git a/app/views/contests/show_attendingcontest.html.erb b/app/views/contests/show_attendingcontest.html.erb index 8a00f12ae..ad8222224 100644 --- a/app/views/contests/show_attendingcontest.html.erb +++ b/app/views/contests/show_attendingcontest.html.erb @@ -61,61 +61,59 @@ -
    - 温馨提示:如果您希望在我们平台托管参赛数据和代码,请按下面参赛步骤参赛! +
    + 温馨提示:如果您准备参加竞赛,请点击下面的"新建参赛作品"!
    <% if User.current.logged? %> -
    -
    - 参赛步骤: +
    +
    + 参加竞赛: + <%= link_to '新建参赛作品', "javascript:void(0);", onclick: "$('#put-project-form').toggle();" %>
    -
    + - - - - <%= l(:label_softapplication_name) %> + + - - <% end %> @@ -189,10 +166,63 @@ <% if c_project.project %>
    - - 参赛作品: - <%= link_to(c_project.project.name, project_path(c_project.project), :target => '_blank') %> -
    +
    +
    参赛作品: <%= link_to(c_project.project.name, project_path(c_project.project), :target => '_blank') %> +
    + + + + <% if get_prize(c_project).nil? or get_prize(c_project) == "" %> + <% if @contest.deadline < Date.today %> + <%= l(:label_noawards)%> + <% else%> + <%= l(:label_noawards_current)%> + <% end %> + <% else %> + <% case get_prize(c_project) %> + <% when '-1' %> + <%= image_tag("/images/bid/special_reward.png")%> + <% when '0' %> + <%= image_tag("/images/bid/first_reward.png")%> + <% when '1' %> + <%= image_tag("/images/bid/second_reward.png")%> + <% when '2' %> + <%= image_tag("/images/bid/third_reward.png")%> + <% when '3' %> + <%= image_tag("/images/bid/forth_reward.png")%> + <% when '4' %> + <%= image_tag("/images/bid/fifth_reward.png")%> + <% when '5' %> + <%= image_tag("/images/bid/qualified.png")%> + <% end %> + <% end %> + + + + + + <% if ((User.current.id == @contest.author_id) && (@contest.deadline > Date.today))||User.current.admin %> + + <%= toggle_link '评奖', c_project.id.to_s %> + + + + <% end %> +
    +
    +

    @@ -201,11 +231,12 @@
    - - 发布时间: - <%= format_time c_project.created_at%> + 参赛时间:<%= format_time c_project.created_at%> + 参赛代表:<%= c_project.user.name %> +
    + +
    -
    <% end %> @@ -221,18 +252,75 @@ <%= link_to(c_softapplication.softapplication.name, softapplication_path(c_softapplication.softapplication), :target => '_blank') %>
    -
    + +
    - 简介: + 简介: <%= c_softapplication.softapplication.description.truncate(90, omission: '...') %>
    -
    - - 发布时间: - <%= format_time c_softapplication.created_at %> - - + +
    + 参赛时间:<%= format_time c_softapplication.created_at %> + 参赛代表:<%= c_softapplication.softapplication.user.name %> +
    + + +
    + 最终得分:<%= c_softapplication.softapplication.average(:quality).try(:avg).try(:round, 2).to_i.to_s%>分 + + + + + <% if get_prize(c_softapplication).nil? or get_prize(c_softapplication) == "" %> + <% if @contest.deadline < Date.today %> + <%= l(:label_noawards)%> + <% else%> + <%= l(:label_noawards_current)%> + <% end %> + <% else %> + <% case get_prize(c_softapplication) %> + <% when '-1' %> + <%= image_tag("/images/bid/special_reward.png")%> + <% when '0' %> + <%= image_tag("/images/bid/first_reward.png")%> + <% when '1' %> + <%= image_tag("/images/bid/second_reward.png")%> + <% when '2' %> + <%= image_tag("/images/bid/third_reward.png")%> + <% when '3' %> + <%= image_tag("/images/bid/forth_reward.png")%> + <% when '4' %> + <%= image_tag("/images/bid/fifth_reward.png")%> + <% when '5' %> + <%= image_tag("/images/bid/qualified.png")%> + <% end %> + <% end %> + + + + + + <% if ((User.current.id == @contest.author_id) && (@contest.deadline > Date.today))||User.current.admin %> +
    + <%= toggle_link '评奖', c_softapplication.id.to_s %> + + +
    + <% end %> +
    <% 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 09ab9738f..d11fd2564 100644 --- a/app/views/repositories/show.html.erb +++ b/app/views/repositories/show.html.erb @@ -36,7 +36,7 @@

    git add .

    git commit -m "first commit"

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

    -

    git push -u origin master:matser

    +

    git push -u origin master:master

    从网上获取别人的开源版本库,转交到trustie网站上,打开命令行执行如下:

    @@ -45,7 +45,7 @@

    git add .

    git commit -m "first commit"

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

    -

    git push -u trustie master:matser

    +

    git push -u trustie master:master

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

    diff --git a/app/views/softapplications/show.html.erb b/app/views/softapplications/show.html.erb index 4bd6871a0..c077bc822 100644 --- a/app/views/softapplications/show.html.erb +++ b/app/views/softapplications/show.html.erb @@ -10,7 +10,6 @@

    <%= notice %>

    -
    @@ -44,8 +43,15 @@ 开发人员:<%= @softapplication.application_developers %> - 平均评分: <%= rating_for @softapplication, :static => true, dimension: :quality, class: 'rateable div_inline' %> - 发布时间:<%=format_time @softapplication.created_at %> + 平均评分: <%= rating_for @softapplication, :static => true, dimension: :quality, class: 'rateable div_inline' %> + 发布时间:<%=format_time @softapplication.created_at %> + + + + <% unless @softapplication.deposit_project_url.nil? %> + <%= textilizable ("托管项目网址: " + @softapplication.deposit_project_url) %> + <% end %> + @@ -80,13 +86,14 @@ <% end %>
    -
    -
    最终得分
    -
    <%= rating_for @softapplication, :static => true, dimension: :quality, class: 'rateable div_inline' %>
    +
    +
    最终得分
    +
    <%=@softapplication.average(:quality).try(:avg).try(:round, 2).to_i.to_s%>分
    +
    <%= rating_for @softapplication, :static => true, dimension: :quality, class: 'rateable div_inline' %>
    -
    +
    打分总人数
    -
    <%= @softapplication.raters(:quality).count%>
    +
    <%= @softapplication.raters(:quality).count%>
    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 65c96e4d0..ede51bdb0 100644 --- a/app/views/welcome/contest.html.erb +++ b/app/views/welcome/contest.html.erb @@ -155,7 +155,7 @@ <% if contest.id == 2 or contest.id == 3 or contest.id == 6 %> (<%= 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") %>) + (<%= link_to("含#{contest.contesting_softapplications.count}个作品", 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..c6020d957 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: @@ -1854,15 +1857,20 @@ zh: label_release_softapplication: 发布应用 label_upload_softapplication_packets: 上传应用软件包 label_upload_softapplication_photo: 上传产品截图 - label_upload_softapplication_packets_mustpacketed: 应用软件作品必须打包后以压缩包的形式上传,便于上传和下载 ; - label_upload_softapplication_photo_condition: 应用软件截图需上传4张;格式为gif/jpg/png, 尺寸480*800, 每张小于2M - label_updated_caution: 注意:若修改应用,则之前上传的软件包和截图都将被删除,请重新上传! + label_upload_softapplication_packets_mustpacketed: 作品相关代码及相关说明文件必须打包后以压缩包的形式上传,便于上传和下载 ; + label_upload_softapplication_photo_condition: 作品截图需上传0~4张;格式为gif/jpg/png, 每张小于5M + label_updated_caution: 注意:若参赛作品,则之前上传的软件包和截图都将被删除,请重新上传! label_softapplication_name: 应用名称 + label_work_name: 作品名称 label_softapplication_description: 应用简介 + label_work_description: 作品简介 label_softapplication_type: 应用分类 + label_work_type: 作品分类 label_softapplication_version_available: 适配版本 + label_running_platform: 运行平台 label_softapplication_developer: 上传人员 label_softapplication_developers: 开发人员 + label_work_deposit_project_url: 托管项目网址 label_softapplication_name_condition: 25个汉字以内(50个字符) label_user_login_softapplication_board: 您还没有登录,请登录后参与应用评价。 label_contest_description_no: 暂无描述。 @@ -1892,6 +1900,7 @@ zh: label_relation_files: 关联已有资源 label_contest_settings: 配置竞赛 label_contest_delete: 删除竞赛 + label_noawards_current: 暂未评奖 # ajax异步验证 modal_valid_passing: 可以使用 diff --git a/config/routes.rb b/config/routes.rb index 46d710b64..201de8876 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -67,16 +67,18 @@ RedmineApp::Application.routes.draw do end member do match 'add_softapplication' - match 'update_contest' , via: [:put] - match 'show_contest' , via: :get - match 'show_project' , via: :get - match 'show_softapplication' , via: :get - match 'show_attendingcontest' , via: :get - match 'show_participator' , via: :get - match 'add' , via: [:get, :post] - match 'add_softapplication' , via: [:get, :post] - match 'create' , via: :post - match 'settings' , via: [:get, :post] + match 'update_contest' , via: [:put] + match 'show_contest' , via: :get + match 'show_project' , via: :get + match 'show_softapplication' , via: :get + match 'show_attendingcontest' , via: :get + match 'show_participator' , via: :get + match 'set_reward_project' , via: [:get, :post] + match 'set_reward_softapplication' , via: [:get, :post] + match 'add' , via: [:get, :post] + match 'add_softapplication' , via: [:get, :post] + match 'create' , via: :post + match 'settings' , via: [:get, :post] end end @@ -552,6 +554,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/db/migrate/20140513073801_add_deposit_project_url_to_softapplications.rb b/db/migrate/20140513073801_add_deposit_project_url_to_softapplications.rb new file mode 100644 index 000000000..dd01cdab5 --- /dev/null +++ b/db/migrate/20140513073801_add_deposit_project_url_to_softapplications.rb @@ -0,0 +1,5 @@ +class AddDepositProjectUrlToSoftapplications < ActiveRecord::Migration + def change + add_column :softapplications, :deposit_project_url, :string + end +end diff --git a/db/schema.rb b/db/schema.rb index 74310a946..b5cabfa7f 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20140509020307) do +ActiveRecord::Schema.define(:version => 20140513073801) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -756,6 +756,7 @@ ActiveRecord::Schema.define(:version => 20140509020307) do t.integer "softapplication_id" t.integer "is_public" t.string "application_developers" + t.string "deposit_project_url" end create_table "students_for_courses", :force => true do |t| @@ -864,8 +865,10 @@ ActiveRecord::Schema.define(:version => 20140509020307) do add_index "user_grades", ["user_id"], :name => "index_user_grades_on_user_id" create_table "user_levels", :force => true do |t| - t.integer "user_id" - t.integer "level" + t.integer "user_id" + t.integer "level" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false end create_table "user_preferences", :force => true do |t| 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 {