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

This commit is contained in:
nwb 2014-07-04 11:12:27 +08:00
commit 3a7065bb2d
24 changed files with 186 additions and 141 deletions

View File

@ -498,10 +498,10 @@ class BidsController < ApplicationController
#增加作业按评分排序, #增加作业按评分排序,
#@homework_list = @bid.homeworks.eager_load(:rate_averages, :user, :attachments).order('seems_rateable_cached_ratings.avg DESC').order("#{HomeworkAttach.table_name}.created_at ASC") #@homework_list = @bid.homeworks.eager_load(:rate_averages, :user, :attachments).order('seems_rateable_cached_ratings.avg DESC').order("#{HomeworkAttach.table_name}.created_at ASC")
@homework_list = HomeworkAttach.eager_load(:attachments,:user,:rate_averages).find_by_sql("SELECT homework_attaches.*, @homework_list = HomeworkAttach.eager_load(:attachments,:user,:rate_averages).find_by_sql("SELECT homework_attaches.*,
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id = #{@bid.courses.first.teacher.id}) AS t_score, (SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id = #{@bid.author_id}) AS t_score,
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id <> #{@bid.courses.first.teacher.id}) AS s_score (SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id <> #{@bid.author_id}) AS s_score
FROM homework_attaches WHERE bid_id = #{@bid.id} ORDER BY FROM homework_attaches WHERE bid_id = #{@bid.id} ORDER BY
(CASE WHEN t_score IS NULL THEN 0 ELSE t_score * 0.6 END + CASE WHEN s_score IS NULL THEN 0 ELSE s_score * 0.4 END) DESC,created_at ASC") (CASE WHEN t_score IS NULL THEN 0 ELSE t_score * #{@bid.proportion * 1.0 / 100} END + CASE WHEN s_score IS NULL THEN 0 ELSE s_score * #{1 - @bid.proportion * 1.0 / 100} END) DESC,created_at ASC")
if params[:student_id].present? if params[:student_id].present?
@temp = [] @temp = []
@homework_list.each do |pro| @homework_list.each do |pro|
@ -788,6 +788,7 @@ class BidsController < ApplicationController
@bid.name = params[:bid][:name] @bid.name = params[:bid][:name]
@bid.description = params[:bid][:description] @bid.description = params[:bid][:description]
@bid.is_evaluation = params[:bid][:is_evaluation] @bid.is_evaluation = params[:bid][:is_evaluation]
@bid.proportion = params[:bid][:proportion]
@bid.reward_type = 3 @bid.reward_type = 3
# @bid.budget = params[:bid][:budget] # @bid.budget = params[:bid][:budget]
@bid.deadline = params[:bid][:deadline] @bid.deadline = params[:bid][:deadline]

View File

@ -490,6 +490,7 @@ class CoursesController < ApplicationController
# 新建作业 # 新建作业
def new_homework def new_homework
@homework = Bid.new @homework = Bid.new
@homework.proportion
@homework.safe_attributes = params[:bid] @homework.safe_attributes = params[:bid]
if (User.current.logged? && User.current.member_of_course?(Course.find params[:id] )) if (User.current.logged? && User.current.member_of_course?(Course.find params[:id] ))
render :layout => 'base_courses' render :layout => 'base_courses'

View File

@ -51,7 +51,10 @@ class MemosController < ApplicationController
@memo_new = @memo.dup @memo_new = @memo.dup
@memo = @memo.root # 取出楼主防止输入帖子id让回复作为主贴显示 @memo = @memo.root # 取出楼主防止输入帖子id让回复作为主贴显示
unless @memo.new_record?
@memo.update_column(:viewed_count, (@memo.viewed_count.to_i + 1)) @memo.update_column(:viewed_count, (@memo.viewed_count.to_i + 1))
end
page = params[:page] page = params[:page]
if params[:r] && page.nil? if params[:r] && page.nil?
@ -68,11 +71,15 @@ class MemosController < ApplicationController
limit(@reply_pages.per_page). limit(@reply_pages.per_page).
offset(@reply_pages.offset). offset(@reply_pages.offset).
all all
if @memo.new_record?
format.html { redirect_to back_url, error: "#{l :label_memo_create_fail}: #{@memo.errors.full_messages[0]}" }
else
format.html { render action: :show }#, error: "#{l :label_memo_create_fail}: #{@memo.errors.full_messages[0]}" } format.html { render action: :show }#, error: "#{l :label_memo_create_fail}: #{@memo.errors.full_messages[0]}" }
# format.html { redirect_to back_memo_or_forum_url}#, error: "#{l :label_memo_create_fail}: #{@memo.errors.full_messages[0]}" } # format.html { redirect_to back_memo_or_forum_url}#, error: "#{l :label_memo_create_fail}: #{@memo.errors.full_messages[0]}" }
format.json { render json: @memo.errors, status: :unprocessable_entity } format.json { render json: @memo.errors, status: :unprocessable_entity }
end end
end
end end
end end

View File

@ -105,7 +105,7 @@ class SchoolController < ApplicationController
end end
options = "" options = ""
@school.each do |s| @school.each do |s|
options << "<li style = 'width: 33%; float: left'><a id=#{s.id} onclick='test(this.id)'>#{s.name}</a></li>" options << "<li style = 'width: 33%; float: left'> <a id=#{s.id} onclick='test(this.id)'>#{s.name}</a></li>"
end end
render :text => options render :text => options

View File

@ -32,7 +32,7 @@ class WelcomeController < ApplicationController
def course def course
if params[:school_id] if params[:school_id]
@school_id = params[:school_id] @school_id = params[:school_id]
else elsif User.current.logged? && User.current.user_extensions.school
@school_id = User.current.user_extensions.school.id @school_id = User.current.user_extensions.school.id
end end
@logoLink ||= logolink() @logoLink ||= logolink()

View File

@ -83,6 +83,19 @@ module CoursesHelper
type << option2 type << option2
end end
def proportion_option
type = []
i = 0
while i <= 100
option = []
option << i.to_s + "%"
option << i
type << option
i = i + 10
end
type
end
alias teacherCountOrigin teacherCount alias teacherCountOrigin teacherCount
def teacherCount project def teacherCount project
@ -308,7 +321,7 @@ module CoursesHelper
#最终评分 = 学生评分的平均分 * 0.4 +教师评分 * 0.6 #最终评分 = 学生评分的平均分 * 0.4 +教师评分 * 0.6
def score_for_homework homework def score_for_homework homework
if homework.bid.is_evaluation == 1 || homework.bid.is_evaluation == nil if homework.bid.is_evaluation == 1 || homework.bid.is_evaluation == nil
return format("%.2f",(teacher_score_for_homework(homework).to_f * 0.6 + student_score_for_homework(homework).to_f * 0.4)) return format("%.2f",(homework.bid.proportion * 1.0 / 100) * (teacher_score_for_homework(homework).to_f) + (1 - homework.bid.proportion * 1.0 / 100) * (student_score_for_homework(homework).to_f))
else else
return teacher_score_for_homework homework return teacher_score_for_homework homework
end end
@ -332,7 +345,7 @@ module CoursesHelper
return format("%.2f",teacher_stars == nil ? 0 : teacher_stars.stars) return format("%.2f",teacher_stars == nil ? 0 : teacher_stars.stars)
end end
#获取指定作业的得分 #获取指定项目的得分
def project_score project def project_score project
issue_count = project.issues.count issue_count = project.issues.count
issue_journal_count = project.issue_changes.count issue_journal_count = project.issue_changes.count

View File

@ -233,8 +233,13 @@ module WelcomeHelper
def find_all_new_hot_course limit = 9 ,school_id = 0 def find_all_new_hot_course limit = 9 ,school_id = 0
#sort_project_by_hot_rails 1, 'course_ac_para DESC', limit #sort_project_by_hot_rails 1, 'course_ac_para DESC', limit
time_now = Time.new.strftime("%Y"); time_now = Time.new.strftime("%Y");
if school_id
courses = Course.visible.joins(:course_status).where("#{Course.table_name}.created_at like '%#{time_now}%' and #{Course.table_name}.school_id <> courses = Course.visible.joins(:course_status).where("#{Course.table_name}.created_at like '%#{time_now}%' and #{Course.table_name}.school_id <>
?", school_id).order("course_ac_para DESC").limit(limit).all ?", school_id).order("course_ac_para DESC").limit(limit).all
else
courses = Course.visible.joins(:course_status).where("#{Course.table_name}.created_at like '%#{time_now}%' and #{Course.table_name}.school_id is not NULL
").order("course_ac_para DESC").limit(limit).all
end
courses courses
end end

View File

@ -38,6 +38,7 @@ class Course < ActiveRecord::Base
validates_format_of :class_period, :with =>/^[1-9]\d*$/ validates_format_of :class_period, :with =>/^[1-9]\d*$/
validates_format_of :name,:with =>/^[a-zA-Z0-9_\u4e00-\u9fa5]+$/ validates_format_of :name,:with =>/^[a-zA-Z0-9_\u4e00-\u9fa5]+$/
before_save :self_validate
after_save :create_board_sync after_save :create_board_sync
before_destroy :delete_all_members before_destroy :delete_all_members
@ -77,7 +78,7 @@ class Course < ActiveRecord::Base
where(nil) where(nil)
else else
pattern = "%#{arg.to_s.strip.downcase}%" pattern = "%#{arg.to_s.strip.downcase}%"
where("LOWER(extra) LIKE :p OR LOWER(name) LIKE :p ", :p => pattern) where(" LOWER(name) LIKE :p ", :p => pattern)
end end
} }
@ -166,10 +167,8 @@ class Course < ActiveRecord::Base
end end
#自定义验证 #自定义验证
def validate def self_validate
if !class_period.match([0-9])
errors.add_to_base("class period can only digital")
end
end end
# 创建课程讨论区 # 创建课程讨论区

View File

@ -3,9 +3,9 @@ class Memo < ActiveRecord::Base
belongs_to :forum belongs_to :forum
belongs_to :author, :class_name => "User", :foreign_key => 'author_id' belongs_to :author, :class_name => "User", :foreign_key => 'author_id'
validates_presence_of :author_id, :forum_id, :subject validates_presence_of :author_id, :forum_id, :subject,:content
# 若是主题帖,则内容可以是空 # 若是主题帖,则内容可以是空
validates :content, presence: true, if: Proc.new{|o| !o.parent_id.nil? } #validates :content, presence: true, if: Proc.new{|o| !o.parent_id.nil? }
validates_length_of :subject, maximum: 50 validates_length_of :subject, maximum: 50
validates_length_of :content, maximum: 3072 validates_length_of :content, maximum: 3072
validate :cannot_reply_to_locked_topic, :on => :create validate :cannot_reply_to_locked_topic, :on => :create

View File

@ -113,6 +113,7 @@ class Project < ActiveRecord::Base
validates_presence_of :name, :identifier validates_presence_of :name, :identifier
validates_uniqueness_of :identifier validates_uniqueness_of :identifier
validates_uniqueness_of :name
validates_associated :repository, :wiki validates_associated :repository, :wiki
# validates_length_of :description, :maximum => 255 # validates_length_of :description, :maximum => 255
validates_length_of :name, :maximum => 255 validates_length_of :name, :maximum => 255

View File

@ -164,7 +164,7 @@ class User < Principal
# Prevents unauthorized assignments # Prevents unauthorized assignments
attr_protected :login, :admin, :password, :password_confirmation, :hashed_password attr_protected :login, :admin, :password, :password_confirmation, :hashed_password
LOGIN_LENGTH_LIMIT = 60 LOGIN_LENGTH_LIMIT = 25
MAIL_LENGTH_LIMIT = 60 MAIL_LENGTH_LIMIT = 60
validates_presence_of :login, :firstname, :mail, :if => Proc.new { |user| !user.is_a?(AnonymousUser) } validates_presence_of :login, :firstname, :mail, :if => Proc.new { |user| !user.is_a?(AnonymousUser) }

View File

@ -34,6 +34,8 @@
</p> </p>
<p><%= f.select :is_evaluation, is_evaluation_option %> <p><%= f.select :is_evaluation, is_evaluation_option %>
</p> </p>
<p><%= f.select :proportion, proportion_option %>
</p>
<p><%= hidden_field_tag 'course_id', @course.id %> <p><%= hidden_field_tag 'course_id', @course.id %>
</p> </p>
<fieldset><legend><%= l(:label_attachment_plural) %></legend> <fieldset><legend><%= l(:label_attachment_plural) %></legend>

View File

@ -4,7 +4,7 @@
<div class="box ph10_5"> <div class="box ph10_5">
<!--[form:message]--> <!--[form:message]-->
<p><label for="message_subject"><%= l(:field_subject) %><span class="required"> *&nbsp;&nbsp;</span></label><br /> <p><label for="message_subject"><%= l(:field_subject) %><span class="required"> *&nbsp;&nbsp;</span></label><br />
<%= f.text_field :subject,:size => 60, :style => "width: 99%;", :id => "message_subject" %><!--by young--> <%= f.text_field :subject,:size => 60, :style => "width: 99%;", :id => "message_subject",:readonly=>true %><!--by young-->
</p> </p>
<p> <p>
<% unless replying %> <% unless replying %>
@ -30,9 +30,12 @@
<p> <p>
<%= label_tag "message_content", l(:description_message_content), :class => "hidden-for-sighted" %> <%= label_tag "message_content", l(:description_message_content), :class => "hidden-for-sighted" %>
<%= f.text_area :content, :cols => 80, :rows => 13, :class => 'wiki-edit', :id => 'message_content' %></p> <%= f.text_area :content, :cols => 80, :rows => 13, :class => 'wiki-edit', :id => 'message_content' %></p>
<%= wikitoolbar_for 'message_content' %>
<!--[eoform:message]--> <!--[eoform:message]-->
<p><%= l(:label_attachment_plural) %><br /> <p><%= l(:label_attachment_plural) %><br />
<%= render :partial => 'attachments/form', :locals => {:container => @message} %></p> <%= render :partial => 'attachments/form', :locals => {:container => @message} %></p>
</div> </div>
<%#= wikitoolbar_for 'message_content' %>

View File

@ -5,7 +5,9 @@
<% end %> <% end %>
<p><%= f.text_field :name, :required => true, :size => 60, :style => "width:490px;" %></p> <p><%= f.text_field :name, :required => true, :size => 60, :style => "width:490px;" %></p>
<p style="margin-left:-10px;padding-right: 20px;"><%= f.text_area :description, :rows => 8, :class => 'wiki-edit', :style => "font-size:small;width:490px;margin-left:10px;" %></p><!--by young--> <p style="margin-left:-10px;padding-right: 20px;">
<%= f.text_area :description, :rows => 8, :class => 'wiki-edit', :style => "font-size:small;width:490px;margin-left:10px;" %>
</p><!--by young-->
<p><%= f.text_field :identifier, :required => true, :size => 60, :style => "width:488px;", :disabled => @project.identifier_frozen?, :maxlength => Project::IDENTIFIER_MAX_LENGTH %> <p><%= f.text_field :identifier, :required => true, :size => 60, :style => "width:488px;", :disabled => @project.identifier_frozen?, :maxlength => Project::IDENTIFIER_MAX_LENGTH %>
<% unless @project.identifier_frozen? %> <% unless @project.identifier_frozen? %>
<em class="info"><%= l(:text_length_between, :min => 1, :max => Project::IDENTIFIER_MAX_LENGTH) %> <%= l(:text_project_identifier_info).html_safe %></em> <em class="info"><%= l(:text_length_between, :min => 1, :max => Project::IDENTIFIER_MAX_LENGTH) %> <%= l(:text_project_identifier_info).html_safe %></em>
@ -24,44 +26,44 @@
<%= call_hook(:view_projects_form, :project => @project, :form => f) %> <%= call_hook(:view_projects_form, :project => @project, :form => f) %>
<!-- <% if @project.new_record? %> <!-- <%# if @project.new_record? %>
<fieldset class="box tabular"><legend><%= l(:label_module_plural) %></legend> <fieldset class="box tabular"><legend><%#= l(:label_module_plural) %></legend>
<% Redmine::AccessControl.available_project_modules.each do |m| %> <%# Redmine::AccessControl.available_project_modules.each do |m| %>
<label class="floating"> <label class="floating">
<%= check_box_tag 'project[enabled_module_names][]', m, @project.module_enabled?(m), :id => "project_enabled_module_names_#{m}" %> <%#= check_box_tag 'project[enabled_module_names][]', m, @project.module_enabled?(m), :id => "project_enabled_module_names_#{m}" %>
<%= l_or_humanize(m, :prefix => "project_module_") %> <%#= l_or_humanize(m, :prefix => "project_module_") %>
</label> </label>
<% end %> <%# end %>
<%= hidden_field_tag 'project[enabled_module_names][]', '' %> <%#= hidden_field_tag 'project[enabled_module_names][]', '' %>
<%= javascript_tag 'observeProjectModules()' %> <%#= javascript_tag 'observeProjectModules()' %>
</fieldset> </fieldset>
<% end %> <%# end %>
<% if @project.new_record? || @project.module_enabled?('issue_tracking') %> <%# if @project.new_record? || @project.module_enabled?('issue_tracking') %>
<% unless @trackers.empty? %> <%# unless @trackers.empty? %>
<fieldset class="box tabular" id="project_trackers"><legend><%=l(:label_tracker_plural)%></legend> <fieldset class="box tabular" id="project_trackers"><legend><%#=l(:label_tracker_plural)%></legend>
<% @trackers.each do |tracker| %> <%# @trackers.each do |tracker| %>
<label class="floating"> <label class="floating">
<%= check_box_tag 'project[tracker_ids][]', tracker.id, @project.trackers.include?(tracker) %> <%#= check_box_tag 'project[tracker_ids][]', tracker.id, @project.trackers.include?(tracker) %>
<%=h tracker %> <%#=h tracker %>
</label> </label>
<% end %> <%# end %>
<%= hidden_field_tag 'project[tracker_ids][]', '' %> <%#= hidden_field_tag 'project[tracker_ids][]', '' %>
</fieldset> </fieldset>
<% end %> <%# end %>
<% unless @issue_custom_fields.empty? %> <%# unless @issue_custom_fields.empty? %>
<fieldset class="box tabular" id="project_issue_custom_fields"><legend><%=l(:label_custom_field_plural)%></legend> <fieldset class="box tabular" id="project_issue_custom_fields"><legend><%#=l(:label_custom_field_plural)%></legend>
<% @issue_custom_fields.each do |custom_field| %> <%# @issue_custom_fields.each do |custom_field| %>
<label class="floating"> <label class="floating">
<%= check_box_tag 'project[issue_custom_field_ids][]', custom_field.id, (@project.all_issue_custom_fields.include? custom_field), (custom_field.is_for_all? ? {:disabled => "disabled"} : {}) %> <%#= check_box_tag 'project[issue_custom_field_ids][]', custom_field.id, (@project.all_issue_custom_fields.include? custom_field), (custom_field.is_for_all? ? {:disabled => "disabled"} : {}) %>
<%=h custom_field.name %> <%#=h custom_field.name %>
</label> </label>
<% end %> <%# end %>
<%= hidden_field_tag 'project[issue_custom_field_ids][]', '' %> <%#= hidden_field_tag 'project[issue_custom_field_ids][]', '' %>
</fieldset> </fieldset>
<% end %> <%# end %>
<% end %> --> <%# end %> -->
<!--[eoform:project]--> <!--[eoform:project]-->
<% unless @project.identifier_frozen? %> <% unless @project.identifier_frozen? %>

View File

@ -43,9 +43,9 @@
<script type="text/javascript"> <script type="text/javascript">
function test(id){ function test(id){
location.href = encodeURI('/course/'+id);
location.href = encodeURI('http://course.trustie.net<%=port%>?school_id='+id);
} }
</script> </script>
<script type="text/javascript"> <script type="text/javascript">
function ssearch(){ function ssearch(){
@ -69,8 +69,9 @@
<div> <div>
<p> <p>
<a href="http://course.trustie.net<%=port%>?school_id=0">全部学校</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href="http://course.trustie.net<%=port%>">我的学校</a> <%= link_to "全部学校",school_index_path %>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<%= link_to '我的学校',school_course_list_path(User.current.user_extensions.school) %>
</p> </p>
<ul> <ul>
<li style="width: 40%; float: left">请选择省份: <li style="width: 40%; float: left">请选择省份:

View File

@ -3,26 +3,25 @@
<script type="text/javascript" language="javascript" xmlns="http://www.w3.org/1999/html" <script type="text/javascript" language="javascript" xmlns="http://www.w3.org/1999/html"
xmlns="http://www.w3.org/1999/html" xmlns="http://www.w3.org/1999/html"> xmlns="http://www.w3.org/1999/html" xmlns="http://www.w3.org/1999/html">
$(function(){ $(function () {
$("#main").find("a").attr("target", "_blank"); $("#main").find("a").attr("target", "_blank");
setCss(); setCss();
}); });
//设置div居中 //设置div居中
function setCss() function setCss() {
{
var mainBar = $('#main-content-bar')[0]; var mainBar = $('#main-content-bar')[0];
var topHeight = mainBar.offsetHeight; var topHeight = mainBar.offsetHeight;
var welcomeLeft = $('#welcome_left')[0]; var welcomeLeft = $('#welcome_left')[0];
var leftHeight = welcomeLeft.offsetHeight; var leftHeight = welcomeLeft.offsetHeight;
var searchbar = $('#search-bar')[0]; var searchbar = $('#search-bar')[0];
var searchHeight = searchbar.offsetHeight; var searchHeight = searchbar.offsetHeight;
welcomeLeft.style.marginTop = (topHeight - leftHeight)/2 + "px"; welcomeLeft.style.marginTop = (topHeight - leftHeight) / 2 + "px";
searchbar.style.marginTop = (topHeight - searchHeight)/2 + "px"; searchbar.style.marginTop = (topHeight - searchHeight) / 2 + "px";
//alert((topHeight - leftHeight)/2 ); //alert((topHeight - leftHeight)/2 );
} }
// 给主页用户弹新页面 // 给主页用户弹新页面
$(document).ready(function($) { $(document).ready(function ($) {
$("#loggedas").find("a").attr("target", "_blank"); $("#loggedas").find("a").attr("target", "_blank");
//$("#content .tabs_new~ .pagination").find("a").removeAttr("target"); //$("#content .tabs_new~ .pagination").find("a").removeAttr("target");
}); });
@ -35,20 +34,20 @@
</div> </div>
<div class="main-content-bar" id="main-content-bar"> <div class="main-content-bar" id="main-content-bar">
<div style="float: left"> <div style="float: left">
<%= image_tag(@logoLink, size:'75x75') %> <%= image_tag(@logoLink, size: '75x75') %>
</div> </div>
<div class="course welcome_left" id="welcome_left" > <div class="course welcome_left" id="welcome_left">
<span class="font_welcome_school"> <% if @school_id.nil? and User.current.user_extensions.school.nil? %> <span class="font_welcome_school"> <% if @school_id.nil? and User.current.user_extensions.school.nil? %>
<% else%> <% else %>
<% if @school_id == "0" %> <% if @school_id == "0" %>
<% else %> <% else %>
<% if @school_id.nil? %> <% if @school_id.nil? %>
<%= link_to School.find(User.current.user_extensions.school.id).name, options={:action => 'course',:school_id => User.current.user_extensions.school.id}, html_options={:class => 'font_welcome_school',:method => 'get'}%> <%= link_to School.find(User.current.user_extensions.school.id).name, options={:action => 'course', :school_id => User.current.user_extensions.school.id}, html_options={:class => 'font_welcome_school', :method => 'get'} %>
<br /> <br/>
<% else %> <% else %>
<%= link_to School.find(@school_id).name ,options={:action => 'course',:school_id => @school_id}, html_options={:class => 'font_welcome_school',:method => 'get'}%> <%= link_to School.find(@school_id).name, options={:action => 'course', :school_id => @school_id}, html_options={:class => 'font_welcome_school', :method => 'get'} %>
<br /> <br/>
<% end %> <% end %>
<% end %> <% end %>
<% end %> </span> <% end %> </span>
@ -62,7 +61,7 @@
<% end %> <% end %>
</div> </div>
<div class="search-bar" id="search-bar"> <div class="search-bar" id="search-bar">
<%= render :partial => "search_course", :locals => {:project_type => Project::ProjectType_course}%> <%= render :partial => "search_course", :locals => {:project_type => Project::ProjectType_course} %>
</div> </div>
<div style="clear: both;"></div> <div style="clear: both;"></div>
</div> </div>
@ -73,32 +72,38 @@
<div id="J_Slide" class="d-p-index-box d-p-index-hotproject"> <div id="J_Slide" class="d-p-index-box d-p-index-hotproject">
<h3><strong>新开课程</strong></h3> <h3><strong>新开课程</strong></h3>
<% school_course = find_miracle_course(10, 7,@school_id) %> <% if @school_id %>
<% if(school_course.count == 0) %> <% school_course = find_miracle_course(10, 7, @school_id) %>
<% else %>
<%school_course=[]%>
<% end %>
<% if (school_course.count == 0) %>
<span><%= link_to "更多>>", {:controller => 'courses', :action => 'index', :school_id => nil} %></span> <span><%= link_to "更多>>", {:controller => 'courses', :action => 'index', :school_id => nil} %></span>
<div class="d-p-projectlist-box"> <div class="d-p-projectlist-box">
<ul class="d-p-projectlist"> <ul class="d-p-projectlist">
</ul> </ul>
<ul class="d-p-projectlist"> <ul class="d-p-projectlist">
<h1></h1> <h1></h1>
<p id="errorExplanation"> <p id="errorExplanation">
该学校未开设任何课程,您可以查看其他学校课程 该学校未开设任何课程,您可以查看其他学校课程
</p> </p>
<h1></h1> <h1></h1>
<% find_all_new_hot_course(9,@school_id).map do |project| %> <% find_all_new_hot_course(9, @school_id).map do |course| %>
<li class='<%= cycle("odd", "even") %>' title=<%=project.description.to_s%>> <li class='<%= cycle("odd", "even") %>' title=<%= course.description.to_s %>>
<div class='avatar'> <div class='avatar'>
<%= image_tag(get_course_avatar(project), :class => "avatar-4") %> <%= image_tag(get_course_avatar(course), :class => "avatar-4") %>
</div> </div>
<!-- 上左下右 --> <!-- 上左下右 -->
<div class='desc_item' > <div class='desc_item'>
<span class=''> <span class=''>
<% course = Course.find_by_extra(project.extra)%> <% if (course.school == nil) %>
<% if(course.school == nil) %>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<% else %> <% else %>
<%= link_to course.school.name.try(:gsub, /(.+)$/, '\1:'), options={:action => 'course',:school_id => course.school.id}, html_options={:method => 'get'}%> <%= link_to course.school.name.try(:gsub, /(.+)$/, '\1:'), options={:action => 'course', :school_id => course.school.id}, html_options={:method => 'get'} %>
<% end %> <% end %>
</span> </span>
<span class='font_bolder'> <span class='font_bolder'>
@ -107,15 +112,12 @@
</span> </span>
</div> </div>
<div class='desc_item text_nowrap' style="width: 310px;"> <div class='desc_item text_nowrap' style="width: 310px;">
[<%= get_course_term project %>] [<%= get_course_term course %>]
<%= link_to( project.name, course_path(project.id), :class => "d-g-blue d-p-project-name",:title => "#{project.name}" )%> <%= link_to(course.name, course_path(course.id), :class => "d-g-blue d-p-project-name", :title => "#{course.name}") %>
(<%= "#{studentCount(project)}人" %>) (<%= "#{studentCount(course)}人" %>)
<% files_count = (project.attachments.count.to_i+Version.joins(:project).where("projects.id=#{project.id}").count.to_i).to_s %> <% files_count = course.attachments.count.to_s %>
(<%=link_to "#{files_count}份", course_files_path(project) %>资料) (<%= link_to "#{files_count}份", course_files_path(course) %>资料)
</div> </div>
<!-- <div class='desc_item' style="">
<span class='font_lighter' title=<%#=project.description.to_s%>><%#=project.description.truncate(25, omission: '...')%></span>
</div> -->
</li> </li>
<% end %> <% end %>
</ul> </ul>
@ -135,33 +137,32 @@
</ul> </ul>
<ul class="d-p-projectlist"> <ul class="d-p-projectlist">
<% school_course.map do |project| %> <% school_course.map do |course| %>
<li class='<%= cycle("odd", "even") %>' title=<%=project.description.to_s%>> <li class='<%= cycle("odd", "even") %>' title=<%= course.description.to_s %>>
<div class='avatar'> <div class='avatar'>
<%= image_tag(get_course_avatar(project), :class => "avatar-4") %> <%= image_tag(get_course_avatar(course), :class => "avatar-4") %>
</div> </div>
<!-- 上左下右 --> <!-- 上左下右 -->
<div class='desc_item' > <div class='desc_item'>
<span class=''> <span class=''>
<% course = project %> <%= link_to course.school.name.try(:gsub, /(.+)$/, '\1:'), options={:action => 'course', :school_id => course.school.id}, html_options={:method => 'get'} %>
<%=link_to course.school.name.try(:gsub, /(.+)$/, '\1:'),options={:action => 'course',:school_id => course.school.id}, html_options={:method => 'get'} %>
</span> </span>
<span class='font_bolder'> <span class='font_bolder'>
<%= link_to(course.try(:teacher).try(:realname), user_path(course.teacher)) %> <%= link_to(course.try(:teacher).try(:realname), user_path(course.teacher)) %>
</span> </span>
</div> </div>
<div class='desc_item text_nowrap' style="width: 310px;"> <div class='desc_item text_nowrap' style="width: 310px;">
[<%= get_course_term project %>] [<%= get_course_term course %>]
<%= link_to( project.name, course_path(project.id), :class => "d-g-blue d-p-project-name",:title => "#{project.name}" )%> <%= link_to(course.name, course_path(course.id), :class => "d-g-blue d-p-project-name", :title => "#{course.name}") %>
(<%= "#{studentCount(project)}人" %>) (<%= "#{studentCount(course)}人" %>)
<% files_count = (project.attachments.count.to_i+Version.joins(:project).where("projects.id=#{project.id}").count.to_i).to_s %> <% files_count = course.attachments.count.to_s %>
(<%=link_to "#{files_count}份", course_files_path(project) %>资料) (<%= link_to "#{files_count}份", course_files_path(course) %>资料)
</div> </div>
<div class='join_course_link'> <div class='join_course_link'>
<% if !course_endTime_timeout?(project)%> <% if !course_endTime_timeout?(course) %>
<div > <div>
<%= join_in_course(project, User.current)%> <%= join_in_course(course, User.current) %>
</div> </div>
<% end %> <% end %>
</div> </div>
@ -170,24 +171,24 @@
<% if school_course.count < 9 %> <% if school_course.count < 9 %>
<li> <li>
<h1></h1> <h1></h1>
<p id="errorExplanation"> <p id="errorExplanation">
该学校开设课程较少,您可以查看其他学校课程 该学校开设课程较少,您可以查看其他学校课程
</p> </p>
</li> </li>
<% find_all_new_hot_course(9 - school_course.count,@school_id).map do |project| %> <% find_all_new_hot_course(9 - school_course.count, @school_id).map do |course| %>
<li class='<%= cycle("odd", "even") %>' title=<%=project.description.to_s%>> <li class='<%= cycle("odd", "even") %>' title=<%= course.description.to_s %>>
<div class='avatar'> <div class='avatar'>
<%= image_tag(get_course_avatar(project), :class => "avatar-4") %> <%= image_tag(get_course_avatar(course), :class => "avatar-4") %>
</div> </div>
<!-- 上左下右 --> <!-- 上左下右 -->
<div class='desc_item' > <div class='desc_item'>
<span class=''> <span class=''>
<% course = project%> <% if (course.school == nil) %>
<% if(course.school == nil) %>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<% else %> <% else %>
<!-- modified by zjc 添加超链接 --> <!-- modified by zjc 添加超链接 -->
<%= link_to course.school.name.try(:gsub, /(.+)$/, '\1:'), options={:action => 'course',:school_id => course.school.id}, html_options={:method => 'get'}%> <%= link_to course.school.name.try(:gsub, /(.+)$/, '\1:'), options={:action => 'course', :school_id => course.school.id}, html_options={:method => 'get'} %>
<% end %> <% end %>
</span> </span>
<span class='font_bolder'> <span class='font_bolder'>
@ -195,11 +196,11 @@
</span> </span>
</div> </div>
<div class='desc_item text_nowrap' style="width: 310px;"> <div class='desc_item text_nowrap' style="width: 310px;">
[<%= get_course_term project %>] [<%= get_course_term course %>]
<%= link_to( project.name, project_path(project.id), :class => "d-g-blue d-p-project-name",:title => "#{project.name}" )%> <%= link_to(course.name, course_path(course.id), :class => "d-g-blue d-p-project-name", :title => "#{course.name}") %>
<%= "#{studentCount(project)}人" %> ) <%= "#{studentCount(course)}人" %> )
<% files_count = (project.attachments.count.to_i+Version.joins(:project).where("projects.id=#{project.id}").count.to_i).to_s %> <% files_count = course.attachments.count.to_i.to_s %>
(<%=link_to "#{files_count}份", project_files_path(project) %>资料) (<%= link_to "#{files_count}份", course_files_path(course) %>资料)
</div> </div>
</li> </li>
<% end %> <% end %>
@ -212,18 +213,20 @@
<div id="J_Slide" class="d-p-index-box d-p-index-hotproject" style="float: right;"> <div id="J_Slide" class="d-p-index-box d-p-index-hotproject" style="float: right;">
<h3 style="padding-bottom:0px ;margin-left: 5px; color: #e8770d;"> <h3 style="padding-bottom:0px ;margin-left: 5px; color: #e8770d;">
<strong>问题和反馈动态</strong> <strong>问题和反馈动态</strong>
<%= link_to "我要提问" , newbie_send_path, {:class => 'orangeButton idea_btn', :style => "color: #EEEEEE" }%> <%= link_to "我要提问", newbie_send_path, {:class => 'orangeButton idea_btn', :style => "color: #EEEEEE"} %>
<%= link_to "我要反馈" , suggestion_send_path, {:class => 'orangeButton idea_btn', :style => "color: #EEEEEE" }%> <%= link_to "我要反馈", suggestion_send_path, {:class => 'orangeButton idea_btn', :style => "color: #EEEEEE"} %>
</h3> </h3>
<span style="margin-top: -20px;float: right; display: block;"><%= link_to "更多>>", forums_path %></span> <span style="margin-top: -20px;float: right; display: block;"><%= link_to "更多>>", forums_path %></span>
<div class="d-p-projectlist-box"> <div class="d-p-projectlist-box">
<ul class="d-p-projectlist"> <ul class="d-p-projectlist">
<% find_new_forum_topics(10).each do |topic|%> <% find_new_forum_topics(10).each do |topic| %>
<li class="message-brief-intro" style="min-height: 65px; line-height:2em; "> <li class="message-brief-intro" style="min-height: 65px; line-height:2em; ">
<div style="display: inline-block; width: 100%;"> <div style="display: inline-block; width: 100%;">
<span class="memo_activity text_nowrap" style="color:gray; display: inline-block; margin-bottom:6px; background: url('/images/list-icon.png') no-repeat scroll ;background-position: left center;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span class="memo_activity text_nowrap" style="color:gray; display: inline-block; margin-bottom:6px; background: url('/images/list-icon.png') no-repeat scroll ;background-position: left center;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<%= link_to '['+topic.forum.name + ']',forum_path(topic.forum),:class => 'memo_Bar_title' %><%= link_to topic.subject.truncate(30, omission: '...'), topic.event_url, :class => "gray" , :style => "font-size: 10pt !important;" %> <%= link_to '['+topic.forum.name + ']', forum_path(topic.forum), :class => 'memo_Bar_title' %><%= link_to topic.subject.truncate(30, omission: '...'), topic.event_url, :class => "gray", :style => "font-size: 10pt !important;" %>
</span> </span>
<div class='memo_activity memo_attr'> <div class='memo_activity memo_attr'>
<span class='memo_timestamp'> <span class='memo_timestamp'>
<%= "#{l(:label_updated_time, value: time_tag_welcome(topic_last_time topic))}".html_safe %> <%= "#{l(:label_updated_time, value: time_tag_welcome(topic_last_time topic))}".html_safe %>
@ -232,7 +235,7 @@
楼主: <%= link_to_user(topic.author) %> 楼主: <%= link_to_user(topic.author) %>
</span> </span>
<span class="memo_last_person"> <span class="memo_last_person">
最后回复:<%=link_to_user topic.last_reply.try(:author) %> 最后回复:<%= link_to_user topic.last_reply.try(:author) %>
</span> </span>
<span class="memo_reply"> <span class="memo_reply">
回复(<%= link_to topic.try(:replies_count), topic.event_url %>) 回复(<%= link_to topic.try(:replies_count), topic.event_url %>)

View File

@ -1574,6 +1574,7 @@ zh:
field_budget: 奖励 field_budget: 奖励
field_deadline: 截止日期 field_deadline: 截止日期
field_is_evaluation: 是否启动互评 field_is_evaluation: 是否启动互评
field_proportion: 教师评分比例
label_tags_selected: 已选标签 label_tags_selected: 已选标签
label_tags_related: 相关标签 label_tags_related: 相关标签
button_project_tags_add: 增加 button_project_tags_add: 增加

View File

@ -700,8 +700,8 @@ RedmineApp::Application.routes.draw do
#######confusing######## #######confusing########
get 'welcome/search', to: 'welcome#search' get 'welcome/search', to: 'welcome#search'
get 'school/index', to: 'school#index' get 'school/index', to: 'school#index'
get 'course/:school_id', to: 'welcome#course' get 'course/:school_id', to: 'welcome#course', :as => 'school_course_list'
get 'course/:school_id', to: 'welcome#course' #get 'course/:school_id', to: 'welcome#course'
post 'school/get_options/:province', :to => 'school#get_options' post 'school/get_options/:province', :to => 'school#get_options'
get 'school/get_options/:province', :to => 'school#get_options' get 'school/get_options/:province', :to => 'school#get_options'

View File

@ -0,0 +1,5 @@
class AddProportionToBid < ActiveRecord::Migration
def change
add_column :bids, :proportion, :integer, default: 60
end
end

View File

@ -106,6 +106,7 @@ ActiveRecord::Schema.define(:version => 20140703085204) do
t.integer "parent_id" t.integer "parent_id"
t.string "password" t.string "password"
t.integer "is_evaluation" t.integer "is_evaluation"
t.integer "proportion", :default => 60
end end
create_table "boards", :force => true do |t| create_table "boards", :force => true do |t|
@ -793,7 +794,7 @@ ActiveRecord::Schema.define(:version => 20140703085204) do
end end
create_table "relative_memos", :force => true do |t| create_table "relative_memos", :force => true do |t|
t.integer "osp_id" t.integer "osp_id", :null => false
t.integer "parent_id" t.integer "parent_id"
t.string "subject", :null => false t.string "subject", :null => false
t.text "content", :null => false t.text "content", :null => false

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -449,7 +449,7 @@ a.attachments_list_color {
font-size: 9pt; font-size: 9pt;
} }
.memo_activity span a{ .memo_activity span a{
color: gray; /*color: gray;*/
} }
/*帖子的最后回复人*/ /*帖子的最后回复人*/
.memo_activity .memo_last_person{ .memo_activity .memo_last_person{