From 0496c33378e19927ffceadb89a49cea55a462d24 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Tue, 24 Mar 2015 09:28:35 +0800 Subject: [PATCH 1/9] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=83=A8=E5=88=86?= =?UTF-8?q?=E6=96=B9=E6=B3=95=E7=9A=84=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/bids_controller.rb | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/app/controllers/bids_controller.rb b/app/controllers/bids_controller.rb index 5ee3d4823..49fa45d3e 100644 --- a/app/controllers/bids_controller.rb +++ b/app/controllers/bids_controller.rb @@ -181,6 +181,7 @@ class BidsController < ApplicationController end end + #将某个企业外包需求选为作业,目前此功能已放弃 def create_fork @homework = Bid.new @homework.name = params[:bid][:name] @@ -215,6 +216,7 @@ class BidsController < ApplicationController end end + #有两个路由链接到此方法:/bids/:id /calls/:id但是貌似这两个路由都不能访问。。方法作用有待确认 def show @user = @bid.author @jours = @bid.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC') @@ -250,40 +252,31 @@ class BidsController < ApplicationController else @state = 1 end - respond_to do |format| - # format.html { redirect_to_referer_or {render :text => (watching ? 'Watcher added.' : 'Watcher removed.'), :layout => true}} - # TO_DO format.js { render :partial => 'set_join', :locals => {:user => User.current, :object_id => params[:id]} } end end def unjoin_in_contest - joined = JoinInContest.where('bid_id = ? and user_id = ?', @bid.id, User.current.id) - joined.each do |join| join.delete end - respond_to do |format| - # format.html { redirect_to_referer_or {render :text => (watching ? 'Watcher added.' : 'Watcher removed.'), :layout => true}} format.js { render :partial => 'set_join', :locals => {:user => User.current, :object_id => params[:id]} } end end def new_join - # added by fq - end # added by bai 增加了参与者和竞赛设置 def show_participator render :layout => 'base_contest' - end + #配置竞赛 def settings if @bid.author.id == User.current.id if @bid.reward_type == 2 @@ -296,7 +289,7 @@ class BidsController < ApplicationController end #end - # 显示课程 + # 显示课程作业,但是好像已经废弃 def show_course bids = Bid.where('parent_id = ?', @bid.id) @courses = [] From 7970bd6df073d780ef42ee55e2f7c9511a4288c6 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Tue, 24 Mar 2015 09:57:55 +0800 Subject: [PATCH 2/9] =?UTF-8?q?1=E3=80=81=E5=A2=9E=E5=8A=A0=E4=BD=9C?= =?UTF-8?q?=E4=B8=9A=E6=88=AA=E8=87=B3=E6=97=B6=E9=97=B4=E7=9A=84js?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=202=E3=80=81=E6=88=AA=E6=AD=A2=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E5=88=B0=E4=BA=86=E4=B9=8B=E5=90=8E=E7=9A=84=E6=98=BE?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/courses/homework.html.erb | 18 +++++++++++++++--- public/javascripts/course.js | 14 ++++++++------ 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/app/views/courses/homework.html.erb b/app/views/courses/homework.html.erb index 751558237..f5fe74953 100644 --- a/app/views/courses/homework.html.erb +++ b/app/views/courses/homework.html.erb @@ -29,10 +29,22 @@

<%= textilizable bid, :description %> -
<%= l(:label_create_time)%> : <%= format_time bid.created_on%>

-
<%= l(:label_expend_information)%> - +
+ <%= l(:button_more)%>... +
+ <%= l(:label_end_time)%>:<%= bid.deadline%> + <% if betweentime(bid.deadline) < 0 %> + + <%= l(:label_commit_limit)%> + + <% else %> + +
+
+ <% end %>
diff --git a/public/javascripts/course.js b/public/javascripts/course.js index f6bc4933c..4a9854fcd 100644 --- a/public/javascripts/course.js +++ b/public/javascripts/course.js @@ -35,7 +35,7 @@ $(document).ready(function () { $("#RSide").css("min-height",$("#LSide").height()-30); }); //课程作业结束时间倒计时 -function ShowCountDown(year,month,day,divname) +function show_bid_dead_line(year,month,day,divname) { var now = new Date(); var endDate = new Date(year, month-1, day); @@ -45,11 +45,13 @@ function ShowCountDown(year,month,day,divname) var hour=Math.floor((leftsecond-day1*24*60*60)/3600); var minute=Math.floor((leftsecond-day1*24*60*60-hour*3600)/60); var second=Math.floor(leftsecond-day1*24*60*60-hour*3600-minute*60); - $("#"+divname).html("作业提交还剩 : " - +day1+"  " - +hour+"  " - +minute+"  " - +second+" "); + $("#"+divname).html("
" + + " 天" + + " 小时" + + " 分" + + " 秒" + + "
" + + "

作业提交还剩:

"); } //验证新建作业的名字 function regex_bid_name() From c4cd61c71b462ce40bfbab6f0b48fbb1ccf1d94f Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Tue, 24 Mar 2015 10:02:38 +0800 Subject: [PATCH 3/9] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AD=A6=E7=94=9F?= =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BD=9C=E4=B8=9A=E7=95=8C=E9=9D=A2=E7=9A=84?= =?UTF-8?q?layout?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/bids_controller.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/controllers/bids_controller.rb b/app/controllers/bids_controller.rb index 49fa45d3e..3d8761321 100644 --- a/app/controllers/bids_controller.rb +++ b/app/controllers/bids_controller.rb @@ -452,9 +452,7 @@ class BidsController < ApplicationController def show_courseEx if (User.current.logged? && (User.current.member_of_course?(@bid.courses.first) || User.current.admin?)) - # flash[:notice] = "" @membership = User.current.coursememberships.all(:conditions => Course.visible_condition(User.current)) - @user = @bid.author @bidding_project = @bid.biding_projects.all @@ -526,7 +524,7 @@ class BidsController < ApplicationController if @bid.reward_type == 3 format.html { html_title(l(:label_homework_info)) - render :layout => 'base_homework' + render :layout => 'base_courses' } elsif @bid.reward_type == 1 format.html { @@ -1063,6 +1061,7 @@ class BidsController < ApplicationController if params[:id] @bid = Bid.find(params[:id], :include => [{:homeworks => :user}]) @user = @bid.author + @course = @bid.courses.first end rescue render_404 From f5059147d233986a71cbabad3ead6bbd5accc56e Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Tue, 24 Mar 2015 14:11:27 +0800 Subject: [PATCH 4/9] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AD=A6=E7=94=9F?= =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BD=9C=E4=B8=9A=E7=95=8C=E9=9D=A2=E7=9A=84?= =?UTF-8?q?layout?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/bids_controller.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/controllers/bids_controller.rb b/app/controllers/bids_controller.rb index 3d8761321..9dd64bd7a 100644 --- a/app/controllers/bids_controller.rb +++ b/app/controllers/bids_controller.rb @@ -524,7 +524,7 @@ class BidsController < ApplicationController if @bid.reward_type == 3 format.html { html_title(l(:label_homework_info)) - render :layout => 'base_courses' + render :layout => 'base_homework' } elsif @bid.reward_type == 1 format.html { @@ -1061,7 +1061,6 @@ class BidsController < ApplicationController if params[:id] @bid = Bid.find(params[:id], :include => [{:homeworks => :user}]) @user = @bid.author - @course = @bid.courses.first end rescue render_404 From 1bba235ca0e80c5394c6fef6b2b912b5f07b6efd Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Tue, 24 Mar 2015 15:46:23 +0800 Subject: [PATCH 5/9] =?UTF-8?q?1=E3=80=81=E6=9B=B4=E6=96=B0poll.css?= =?UTF-8?q?=E6=96=87=E4=BB=B6=202=E3=80=81=E4=BF=AE=E6=94=B9poll=E7=9A=84i?= =?UTF-8?q?ndex=E7=95=8C=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/poll/_poll.html.erb | 132 ++++++++++------------------ app/views/poll/_poll_list.html.erb | 2 +- app/views/poll/index.html.erb | 2 +- public/stylesheets/polls.css | 133 ++++++++++++++--------------- 4 files changed, 110 insertions(+), 159 deletions(-) diff --git a/app/views/poll/_poll.html.erb b/app/views/poll/_poll.html.erb index 33bff6258..4f307279b 100644 --- a/app/views/poll/_poll.html.erb +++ b/app/views/poll/_poll.html.erb @@ -1,91 +1,51 @@ <% has_commit = has_commit_poll?(poll.id ,User.current)%> <% poll_name = poll.polls_name.empty? ? l(:label_poll_new) : poll.polls_name%> -
  • - <% if @is_teacher %> - <% if has_commit %> - - <%= link_to poll_name, poll_result_poll_path(poll.id), :class => "polls_title polls_title_w fl", :style => "max-width: 550px;width: 550px;" %> - - <% else %> - <%= link_to poll_name, poll_path(poll.id), :class => "polls_title polls_title_w fl" %> - <% end %> - <% else %> - <% if has_commit && poll.polls_status == 2 %> - <%= link_to poll_name, poll_result_poll_path(poll.id), :class => "polls_title polls_title_w fl", :style => "max-width: 500px;width: auto;" %> - <% elsif !has_commit && poll.polls_status == 2 %> - <%= link_to poll_name, poll_path(poll.id), :class => "polls_title polls_title_w fl", :style => "max-width: 550px;width: 550px;" %> - <% end %> - <% end %> -
  • -<% if !@is_teacher && has_commit && poll.polls_status == 2%> -
  • 已答
  • -<% end %> - -<%if @is_teacher%> - <% if poll.polls_status == 1%> -
  • 统计结果
  • - <% elsif poll.polls_status == 2 || poll.polls_status == 3 %> -
  • - <%= link_to l(:label_statistical_results), statistics_result_poll_path(poll.id), :class => "pollsbtn fl ml10"%> -
  • - <% end%> -<% end%> - - -<%if @is_teacher %> - <% if poll.polls_status == 1 %> -
  • - - 发布问卷 - -
  • - <% elsif poll.polls_status == 2%> -
  • - - 取消发布 - -
  • - <% else%> -
  • - 发布问卷 -
  • - <% end%> -<% end%> - -
  • - <% if @is_teacher %> - - <%= link_to(l(:button_delete), poll, - method: :delete, :confirm => l(:text_are_you_sure), :remote => true, :class => "polls_de fr ml15 mr10") %> - <% end%> -
  • - <% if @is_teacher%> - <% if poll.polls_status == 1 %> -
  • - <%= link_to l(:button_edit), edit_poll_path(poll.id), :class => "polls_de fr ml15"%> -
  • - <% else%> -
  • - 编辑 -
  • - <% end%> -<% end%> - -<% if @is_teacher%> - <% if poll.polls_status == 2 %> -
  • - 关闭 -
  • +
  • + <% if has_commit %> + <%= link_to poll_name, poll_result_poll_path(poll.id), :class => "polls_title polls_title_w fl c_dblue"%> <% else %> -
  • - 关闭 -
  • + <%= link_to poll_name, poll_path(poll.id), :class => "polls_title polls_title_w fl c_dblue" %> + <% end %> + + + <% if poll.polls_status == 1%> +
  • 统计结果
  • + <% elsif poll.polls_status == 2 || poll.polls_status == 3 %> +
  • <%= link_to l(:label_statistical_results), statistics_result_poll_path(poll.id), :class => "pollsbtn fl ml10"%>
  • + <% end%> + + <% if poll.polls_status == 1 %> +
  • 发布问卷
  • + <% elsif poll.polls_status == 2%> +
  • 取消发布
  • + <% else%> +
  • 发布问卷
  • + <% end%> + + <%= link_to(l(:button_delete), poll,:method => :delete, :confirm => l(:text_are_you_sure), :remote => true, :class => "polls_de fr ml5 mr10") %> + + <% if poll.polls_status == 1 %> +
  • <%= link_to l(:button_edit), edit_poll_path(poll.id), :class => "polls_de fr ml5"%>
  • + <% else%> +
  • 编辑
  • + <% end%> + + <% if poll.polls_status == 2 %> +
  • 关闭
  • + <% else %> +
  • 关闭
  • + <% end%> + +
  • <%= format_date poll.created_at.to_date%>
  • +<% else%> + <% if poll.polls_status == 2%> + <% if has_commit%> +
  • <%= link_to poll_name, poll_result_poll_path(poll.id), :class => "polls_title polls_title_st fl c_dblue" %>
  • +
  • 已答
  • + <%else%> + <%= link_to poll_name, poll_path(poll.id), :class => "polls_title polls_title_st fl c_dblue"%> + <%end%> <% end%> - -<% end %> - - -
  • - <%= format_time poll.created_at%> -
  • \ No newline at end of file +
  • <%= format_date poll.created_at.to_date%>
  • +<% end%> \ No newline at end of file diff --git a/app/views/poll/_poll_list.html.erb b/app/views/poll/_poll_list.html.erb index f57a4a5ff..becfc32a5 100644 --- a/app/views/poll/_poll_list.html.erb +++ b/app/views/poll/_poll_list.html.erb @@ -9,7 +9,7 @@
    <% @polls.each do |poll|%> -