diff --git a/app/controllers/welcome_controller.rb b/app/controllers/welcome_controller.rb index 7c60e2dc3..9c72d301f 100644 --- a/app/controllers/welcome_controller.rb +++ b/app/controllers/welcome_controller.rb @@ -33,7 +33,7 @@ class WelcomeController < ApplicationController if params[:school_id] @school_id = params[:school_id] elsif User.current.logged? && User.current.user_extensions.school - @school_id = User.current.user_extensions.school.id + @school_id = User.current.user_extensions.school.try(:id) end @logoLink ||= logolink() end diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb index 87b495f00..e65fe174e 100644 --- a/app/helpers/users_helper.rb +++ b/app/helpers/users_helper.rb @@ -247,4 +247,15 @@ module UsersHelper displayed_flag = %w|index| !displayed_flag.include?(params['action']) end + + #获取指定用户的未过期的课程列表 + def user_courses_list user + result = [] + user.coursememberships.map(&:course).each do |course| + if !course_endTime_timeout?(course) + result << course + end + end + return result + end end diff --git a/app/models/course.rb b/app/models/course.rb index bf6190c88..32b192f2d 100644 --- a/app/models/course.rb +++ b/app/models/course.rb @@ -274,4 +274,7 @@ class Course < ActiveRecord::Base end end + def name + read_attribute('name') || Project.find_by_identifier(self.extra).try(:name) + end end diff --git a/app/views/bids/_bid_homework_show.html.erb b/app/views/bids/_bid_homework_show.html.erb index 6f0b35ae9..a67cbd7e3 100644 --- a/app/views/bids/_bid_homework_show.html.erb +++ b/app/views/bids/_bid_homework_show.html.erb @@ -15,7 +15,7 @@ <% if(User.current.logged? && (!Member.where('user_id = ? and course_id = ?', User.current.id, bid.courses.first.id).first.nil? && (Member.where('user_id = ? and course_id = ?', User.current.id, bid.courses.first.id).first.roles&Role.where('id = ? or id = ? or id =?',5, 10, 7)).size >0)) %> <%# 提交作业按钮 %> - + <% cur_user_homework = cur_user_homework_for_bid(bid) %> <% if cur_user_homework!= nil && cur_user_homework.count == 0 %> <%= link_to l(:label_commit_homework),new_homework_attach_path(bid) %> @@ -41,19 +41,19 @@ - <% @bidding_project = bid.biding_projects.all - @temp = [] - @bidding_project.each do |pro| + <% bidding_project = bid.biding_projects.all + temp = [] + bidding_project.each do |pro| if pro.project && pro.project.project_status - @temp << pro + temp << pro end - @temp + temp end %> <% if bid.homework_type == 1%> <%= l(:label_x_homework_project, :count => bid.homeworks.count) %>(<%= link_to bid.homeworks.count, course_for_bid_path(bid.id) %>) <% else %> - <%= l(:label_x_homework_project, :count => @temp.count) %>(<%= link_to @temp.count, course_for_bid_path(bid.id) %>) + <%= l(:label_x_homework_project, :count => temp.count) %>(<%= link_to temp.count, course_for_bid_path(bid.id) %>) <% end %> <%= l(:label_x_responses, :count => bid.commit) %>(<%= link_to bid.commit, respond_path(bid) %>) @@ -74,7 +74,7 @@ <%= bid.budget%> <% elsif bid.reward_type == 2 %> <%= l(:label_bids_reward_method) %><%= bid.budget%> <% else %> - <% end %> + <% end %> diff --git a/app/views/bids/_bid_show.html.erb b/app/views/bids/_bid_show.html.erb index 8d3ffec18..47f1560dd 100644 --- a/app/views/bids/_bid_show.html.erb +++ b/app/views/bids/_bid_show.html.erb @@ -13,7 +13,34 @@ - + <% if bid.reward_type == 3 %> @@ -60,6 +87,6 @@ diff --git a/app/views/bids/contest.html.erb b/app/views/bids/contest.html.erb index dd10f7b1b..bd069c8c8 100644 --- a/app/views/bids/contest.html.erb +++ b/app/views/bids/contest.html.erb @@ -32,13 +32,13 @@ diff --git a/app/views/school/index.html.erb b/app/views/school/index.html.erb index 6993ee7f5..1dc8bfee4 100644 --- a/app/views/school/index.html.erb +++ b/app/views/school/index.html.erb @@ -71,7 +71,7 @@

<%= link_to "全部学校",school_index_path %>      - <%= link_to '我的学校',school_course_list_path(User.current.user_extensions.school) %> + <%= link_to '我的学校',school_course_list_path(User.current.user_extensions.school) if User.current.logged? %>

<% if bid.reward_type.nil? or bid.reward_type == 1%> <%= l(:label_bids_reward_method) %><%= l(:label_call_bonus) %> <%= l(:label_RMB_sign) %><%= bid.budget%> <% elsif bid.reward_type == 2%> <%= l(:label_bids_reward_method) %><%= bid.budget%> <% else %> <% end %> + <% if bid.reward_type.nil? or bid.reward_type == 1%> + + <%= l(:label_bids_reward_method) %> + + <%= l(:label_call_bonus) %>  + <%= l(:label_RMB_sign) %> + <%= bid.budget%> + + + <% elsif bid.reward_type == 2%> + + <%= l(:label_bids_reward_method) %> + <%= bid.budget%> + + <% else %> + <% end %> +
<% case e.act_type %> <% when 'JournalsForMessage' %> - <% if User.current.login == @user.login %> + <% if User.current.login == e.user.try(:login) %> <%# if e.user_id == act.jour.id %>
<%= link_to("#{l(:label_i)}", user_path(e.user_id)) %> <%= l(:label_have_feedback) %><%= link_to("#{e.act.user.name}", user_path(e.act.user.id)) %><%= l(:label_of_feedback) + l(:label_layouts_feedback) %>