Merge remote-tracking branch 'remotes/origin/szzh' into develop

This commit is contained in:
nwb 2014-07-04 13:39:34 +08:00
commit 164d4f9e78
14 changed files with 104 additions and 40 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -1,3 +1,7 @@
class CourseStatus < ActiveRecord::Base
attr_accessible :changesets_count, :course_ac_para, :course_id, :grade, :watchers_count
belongs_to :course
validates_presence_of :course_id
validates_uniqueness_of :course_id
end

View File

@ -15,7 +15,7 @@
<span style="float: right">
<% 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)) %>
<%# 提交作业按钮 %>
<!--<%= link_to l(:label_commit_homework), '#OpenWindow', rel: 'leanModal', onclick: "showSubH(#{bid.id}, '#{bid.name}');" if User.current.member_of?(@course) %>-->
<!--<%#= link_to l(:label_commit_homework), '#OpenWindow', rel: 'leanModal', onclick: "showSubH(#{bid.id}, '#{bid.name}');" if User.current.member_of?(@course) %>-->
<% 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 @@
</tr>
<tr>
<td colspan="2"><span class="font_lighter">
<% @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) %>(<strong><%= link_to bid.homeworks.count, course_for_bid_path(bid.id) %></strong>)
<% else %>
<%= l(:label_x_homework_project, :count => @temp.count) %>(<strong><%= link_to @temp.count, course_for_bid_path(bid.id) %></strong>)
<%= l(:label_x_homework_project, :count => temp.count) %>(<strong><%= link_to temp.count, course_for_bid_path(bid.id) %></strong>)
<% end %></span>
<span class="font_lighter"><%= l(:label_x_responses, :count => bid.commit) %>(<strong><%= link_to bid.commit, respond_path(bid) %></strong>)</span>
<span style="float: right">
@ -74,7 +74,7 @@
<%= bid.budget%></span></strong> <% elsif bid.reward_type == 2 %> <strong><%= l(:label_bids_reward_method) %><span style="color: #15bccf;font-family: 14px; font-family:' 微软雅黑'"><%= bid.budget%></span></strong>
<% else %>
<% end %> <!-- <td style="color: rgb(255, 0, 0);"><strong><%= l(:label_price) %><%= l(:label_RMB_sign) %><%= bid.budget%></strong></td> --></td>
<% end %> <!-- <td style="color: rgb(255, 0, 0);"><strong><%#= l(:label_price) %><%#= l(:label_RMB_sign) %><%#= bid.budget%></strong></td> --></td>
</tr>
<tr>
<td colspan="2" width="580px" ><span class="font_description">

View File

@ -13,7 +13,34 @@
<td width="500">
<table border="0">
<tr>
<td> <% if bid.reward_type.nil? or bid.reward_type == 1%> <strong><%= l(:label_bids_reward_method) %><span style="color: #ed8924;font-family: 14px; font-family: 微软雅黑"><%= l(:label_call_bonus) %>&nbsp;<%= l(:label_RMB_sign) %><%= bid.budget%></span></strong> <% elsif bid.reward_type == 2%> <strong><%= l(:label_bids_reward_method) %><span style="color: #15bccf;font-family: 14px; font-family: 微软雅黑"><%= bid.budget%></span></strong> <% else %> <!-- <strong><%= l(:label_bids_reward_method) %><span style="color: #00aa83;font-family: 14px; font-family: 微软雅黑"><%= l(:label_bids_credit) %>&nbsp;<%= bid.budget%>&nbsp;<%= l(:label_bids_credit_number) %></span></strong> --> <% end %> <!-- <td style="color: rgb(255, 0, 0);"><strong><%= l(:label_price) %><%= l(:label_RMB_sign) %><%= bid.budget%></strong></td> --></td>
<td>
<% if bid.reward_type.nil? or bid.reward_type == 1%>
<strong>
<%= l(:label_bids_reward_method) %>
<span style="color: #ed8924;font-family: 14px; font-family: '微软雅黑'">
<%= l(:label_call_bonus) %>&nbsp;
<%= l(:label_RMB_sign) %>
<%= bid.budget%>
</span>
</strong>
<% elsif bid.reward_type == 2%>
<strong>
<%= l(:label_bids_reward_method) %>
<span style="color: #15bccf;font-family: 14px; font-family: '微软雅黑'"><%= bid.budget%></span>
</strong>
<% else %> <!-- <strong>
<%#= l(:label_bids_reward_method) %>
<span style="color: #00aa83;font-family: 14px; font-family: 微软雅黑">
<%#= l(:label_bids_credit) %>&nbsp;
<%#= bid.budget%>&nbsp;
<%#= l(:label_bids_credit_number) %>
</span></strong> -->
<% end %>
<!-- <td style="color: rgb(255, 0, 0);">
<strong>
<%#= l(:label_price) %>
<%#= l(:label_RMB_sign) %>
<%#= bid.budget%></strong></td> --></td>
</tr>
<% if bid.reward_type == 3 %>
<tr>
@ -60,6 +87,6 @@
<div class="pagination">
<ul>
<%= pagination_links_full bid_pages %>
<ul>
</ul>
</div>

View File

@ -32,13 +32,13 @@
<!-- <div class="pagination" style="border-bottom: 1px solid rgb(223,223,223); width: 95%; margin-left: 2%; margin-top: 15px" >
<ul style="margin-right:0px">
<li>
<%= link_to l(:label_sort_by_time), calls_path(:bid_sort_type => '0') %>
<%#= link_to l(:label_sort_by_time), calls_path(:bid_sort_type => '0') %>
</li>
<li>
<%= link_to l(:label_sort_by_active), calls_path(:bid_sort_type => '1') %>
<%#= link_to l(:label_sort_by_active), calls_path(:bid_sort_type => '1') %>
</li>
<!-- <li>
<%= link_to l(:label_sort_by_influence), calls_path(:bid_sort_type => '2') %>
<%#= link_to l(:label_sort_by_influence), calls_path(:bid_sort_type => '2') %>
</li> -->
<!-- </ul>
</div> -->

View File

@ -71,7 +71,7 @@
<p>
<%= link_to "全部学校",school_index_path %>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<%= 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? %>
</p>
<ul>
<li style="width: 40%; float: left">请选择省份:

View File

@ -39,7 +39,7 @@
<!-- modified by bai -->
<div style="position:relative;float:left;margin-top:-2px;margin-left: 160px">
<%= l(:label_user_grade) %>: <span style="color:#ec6300">
<span style="color:#ec6300">
<%= render :partial => 'users/user_score', :locals => {:user => user}%></span>
</div>
<!-- end -->
@ -61,14 +61,17 @@
<% end %>
<p>
<% unless user.memberships.empty? %>
<% cond = Project.visible_condition(User.current) + " AND projects.project_type = 1" %>
<% memberships = user.memberships.all(:conditions => cond) %>
<%= l(:label_x_course_contribute_to, :count => memberships.count) %>
<% for member in memberships %>
<%= link_to_project(member.project) %><%= (user.memberships.last == member) ? '' : '' %>
<% end %>
<%# unless user.memberships.empty? %>
<%# cond = Project.visible_condition(User.current) + " AND projects.project_type = 1" %>
<%# memberships = user.memberships.all(:conditions => cond) %>
<% user_courses = user.coursememberships.map(&:course) %>
<%= l(:label_x_course_contribute_to, :count => user_courses.count) %>
<% for course in user_courses %>
<%# if course.name != nil %>
<%= link_to course.name,course_path(course) %><%= (user_courses.last == course) ? '' : '' %>
<%# end %>
<% end %>
<%# end %>
</p>
<%= user.changesets.count == 0 ? '' : "#{l(:label_x_total_commit, :count => user.changesets.count)}" %>

View File

@ -28,13 +28,13 @@
<!-- <div class="pagination" style="border-bottom: 1px solid rgb(223,223,223); width: 95%; margin-left: 2%; margin-top: 0px">
<ul style="margin-right:0px">
<li>
<%= link_to l(:label_sort_by_time), users_path(:user_sort_type => '0') %>
<%#= link_to l(:label_sort_by_time), users_path(:user_sort_type => '0') %>
</li>
<li>
<%= link_to l(:label_sort_by_active), users_path(:user_sort_type => '1') %>
<%#= link_to l(:label_sort_by_active), users_path(:user_sort_type => '1') %>
</li>
<li>
<%= link_to l(:label_sort_by_influence), users_path(:user_sort_type => '2') %>
<%#= link_to l(:label_sort_by_influence), users_path(:user_sort_type => '2') %>
</li>
</ul>
</div> -->

View File

@ -50,7 +50,7 @@
<table width="580" border="0" class="info-break">
<% 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 %>
<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.act.user.id)) %><%= l(:label_of_feedback) + l(:label_layouts_feedback) %></span></td></tr>

View File

@ -31,7 +31,7 @@ class StoredCourseProcedure < ActiveRecord::Migration
courseStatus.watchers_count = projectstatus.watchers_count
courseStatus.grade = projectstatus.grade
courseStatus.course_ac_para = projectstatus.course_ac_para
courseStatus.save(:validate => false)
courseStatus.save()
end
end
end

View File

@ -0,0 +1,16 @@
class ClearCourseStatus < ActiveRecord::Migration
def up
# 删除重复的课程状态
# 之前做迁移的时候未加验证可能引起此问题
courseidlist = "(-1"
CourseStatus.all.each do |status|
sql = "delete from course_statuses where course_id=" + status.course_id.to_s + " and id<>" + status.id.to_s +
" and course_id not in " +courseidlist + ")"
courseidlist += "," + status.course_id.to_s;
execute(sql)
end
end
def down
end
end

View File

@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20140703085204) do
ActiveRecord::Schema.define(:version => 20140704034832) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
@ -794,20 +794,20 @@ ActiveRecord::Schema.define(:version => 20140703085204) do
end
create_table "relative_memos", :force => true do |t|
t.integer "osp_id", :null => false
t.integer "osp_id"
t.integer "parent_id"
t.string "subject", :null => false
t.text "content", :null => false
t.string "subject", :null => false
t.text "content", :limit => 16777215, :null => false
t.integer "author_id"
t.integer "replies_count", :default => 0
t.integer "replies_count", :default => 0
t.integer "last_reply_id"
t.boolean "lock", :default => false
t.boolean "sticky", :default => false
t.boolean "is_quote", :default => false
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.integer "viewed_count_crawl", :default => 0
t.integer "viewed_count_local", :default => 0
t.boolean "lock", :default => false
t.boolean "sticky", :default => false
t.boolean "is_quote", :default => false
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.integer "viewed_count_crawl", :default => 0
t.integer "viewed_count_local", :default => 0
t.string "url"
t.string "username"
t.string "userhomeurl"