Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh
This commit is contained in:
commit
d525220aca
|
@ -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 = 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.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 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 s_score
|
||||
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?
|
||||
@temp = []
|
||||
@homework_list.each do |pro|
|
||||
|
@ -788,6 +788,7 @@ class BidsController < ApplicationController
|
|||
@bid.name = params[:bid][:name]
|
||||
@bid.description = params[:bid][:description]
|
||||
@bid.is_evaluation = params[:bid][:is_evaluation]
|
||||
@bid.proportion = params[:bid][:proportion]
|
||||
@bid.reward_type = 3
|
||||
# @bid.budget = params[:bid][:budget]
|
||||
@bid.deadline = params[:bid][:deadline]
|
||||
|
|
|
@ -490,6 +490,7 @@ class CoursesController < ApplicationController
|
|||
# 新建作业
|
||||
def new_homework
|
||||
@homework = Bid.new
|
||||
@homework.proportion
|
||||
@homework.safe_attributes = params[:bid]
|
||||
if (User.current.logged? && User.current.member_of_course?(Course.find params[:id] ))
|
||||
render :layout => 'base_courses'
|
||||
|
|
|
@ -105,7 +105,7 @@ class SchoolController < ApplicationController
|
|||
end
|
||||
options = ""
|
||||
@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
|
||||
|
||||
render :text => options
|
||||
|
|
|
@ -64,15 +64,18 @@ class TagsController < ApplicationController
|
|||
@forum_tags_num, @attachments_tags_num, @open_source_projects_num = get_tags_size
|
||||
|
||||
# 获取搜索结果
|
||||
@obj,@obj_pages,@results_count,@users_results,
|
||||
@obj,
|
||||
@obj_pages,
|
||||
@results_count,
|
||||
@users_results,
|
||||
@projects_results,
|
||||
@@courses_results,
|
||||
@issues_results,
|
||||
@bids_results,
|
||||
@forums_results,
|
||||
@attachments_results,
|
||||
@contests_tags,
|
||||
@open_source_projects_results = refresh_results(@obj_id,@obj_flag,@selected_tags)
|
||||
@forums_results,
|
||||
attachments_results,
|
||||
@contests_results,
|
||||
@courses_results,
|
||||
@open_source_projects_results= refresh_results(@obj_id,@obj_flag,@selected_tags)
|
||||
|
||||
# 这里是做tag推荐用的, 用来生产推荐的tags
|
||||
unless @obj.nil?
|
||||
|
@ -97,14 +100,18 @@ class TagsController < ApplicationController
|
|||
$related_tags.delete(@tag)
|
||||
|
||||
# 获取搜索结果
|
||||
@obj,@obj_pages,@results_count,@users_results,
|
||||
@obj,
|
||||
@obj_pages,
|
||||
@results_count,
|
||||
@users_results,
|
||||
@projects_results,
|
||||
@@courses_results,
|
||||
@issues_results,
|
||||
@bids_results,
|
||||
@forums_results,
|
||||
@attachments_results,
|
||||
@contests_results = refresh_results(@obj_id,@show_flag)
|
||||
@forums_results,
|
||||
attachments_results,
|
||||
@contests_results,
|
||||
@courses_results,
|
||||
@open_source_projects_results= refresh_results(@obj_id,@show_flag)
|
||||
end
|
||||
|
||||
# 删除已选tag
|
||||
|
@ -116,14 +123,18 @@ class TagsController < ApplicationController
|
|||
$selected_tags.delete(@tag)
|
||||
|
||||
# 获取搜索结果
|
||||
@obj,@obj_pages,@results_count,@users_results,
|
||||
@obj,
|
||||
@obj_pages,
|
||||
@results_count,
|
||||
@users_results,
|
||||
@projects_results,
|
||||
@@courses_results,
|
||||
@issues_results,
|
||||
@bids_results,
|
||||
@forums_results,
|
||||
@attachments_results,
|
||||
@contests_results = refresh_results(@obj_id,@show_flag)
|
||||
attachments_results,
|
||||
@contests_results,
|
||||
@courses_results,
|
||||
@open_source_projects_results= refresh_results(@obj_id,@show_flag)
|
||||
end
|
||||
|
||||
def show_all
|
||||
|
|
|
@ -30,6 +30,11 @@ class WelcomeController < ApplicationController
|
|||
end
|
||||
|
||||
def course
|
||||
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
|
||||
end
|
||||
@logoLink ||= logolink()
|
||||
end
|
||||
|
||||
|
@ -75,8 +80,7 @@ class WelcomeController < ApplicationController
|
|||
redirect_to projects_search_path(:name => search_condition,
|
||||
:project_type => Project::ProjectType_project)
|
||||
when :courses
|
||||
redirect_to projects_search_path(:name => search_condition,
|
||||
:project_type => Project::ProjectType_course)
|
||||
redirect_to courses_search_path(:name => search_condition)
|
||||
when :users
|
||||
redirect_to users_search_path(:name => search_condition)
|
||||
when :users_teacher
|
||||
|
|
|
@ -473,7 +473,11 @@ module ApplicationHelper
|
|||
def principals_check_box_tags_ex(name, principals)
|
||||
s = ''
|
||||
principals.each do |principal|
|
||||
s << "<label>#{ check_box_tag name, principal.id, false, :id => nil } #{h principal.userInfo }</label>\n"
|
||||
if principal.has_attribute?(:userInfo)
|
||||
s << "<label>#{ check_box_tag name, principal.id, false, :id => nil } #{h principal.userInfo }</label>\n"
|
||||
else
|
||||
s << "<label>#{ check_box_tag name, principal.id, false, :id => nil } #{h principal}</label>\n"
|
||||
end
|
||||
end
|
||||
s.html_safe
|
||||
end
|
||||
|
|
|
@ -83,6 +83,19 @@ module CoursesHelper
|
|||
type << option2
|
||||
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
|
||||
def teacherCount project
|
||||
|
@ -308,7 +321,7 @@ module CoursesHelper
|
|||
#最终评分 = 学生评分的平均分 * 0.4 +教师评分 * 0.6
|
||||
def score_for_homework homework
|
||||
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
|
||||
return teacher_score_for_homework homework
|
||||
end
|
||||
|
@ -332,7 +345,7 @@ module CoursesHelper
|
|||
return format("%.2f",teacher_stars == nil ? 0 : teacher_stars.stars)
|
||||
end
|
||||
|
||||
#获取指定作业的得分
|
||||
#获取指定项目的得分
|
||||
def project_score project
|
||||
issue_count = project.issues.count
|
||||
issue_journal_count = project.issue_changes.count
|
||||
|
@ -370,4 +383,9 @@ module CoursesHelper
|
|||
end
|
||||
return homework_users
|
||||
end
|
||||
|
||||
def get_courses_by_tag(tag_name)
|
||||
Course.tagged_with(tag_name).order('updated_at desc')
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -67,6 +67,30 @@ module WatchersHelper
|
|||
|
||||
link_to text, url, :remote => true, :method => method, :class => css
|
||||
end
|
||||
|
||||
# add by nwb
|
||||
# 关注课程
|
||||
def new_course_watcher_link(objects, user, options=[])
|
||||
return '' unless user && user.logged?
|
||||
objects = Array.wrap(objects)
|
||||
|
||||
watched = objects.any? {|object| object.watched_by?(user)}
|
||||
@watch_flag = (objects.first.instance_of?(User) or objects.first.instance_of?(Project) or (objects.first.instance_of?(Contest)))
|
||||
css = @watch_flag ? ([watcher_css(objects), watched ? 'icon ' : 'icon '].join(' ') << options[0].to_s) :
|
||||
([watcher_css(objects), watched ? 'icon icon-fav ' : 'icon icon-fav-off '].join(' ') << options[0].to_s)
|
||||
|
||||
text = @watch_flag ?
|
||||
(watched ? l(:button_unfollow) : l(:button_follow)) : (watched ? l(:button_unwatch) : l(:button_watch))
|
||||
|
||||
url = watch_path(
|
||||
:object_type => objects.first.class.to_s.underscore,
|
||||
:object_id => (objects.size == 1 ? objects.first.id : objects.map(&:id).sort)
|
||||
)
|
||||
method = watched ? 'delete' : 'post'
|
||||
|
||||
link_to text, url, :remote => true, :method => method, :class => css
|
||||
end
|
||||
|
||||
# added by fq, modify nyan
|
||||
# Somebody may use option params
|
||||
def join_in_course(course, user, options=[])
|
||||
|
|
|
@ -83,7 +83,8 @@ module WelcomeHelper
|
|||
# # => 前7个项目为新课程,后面三个是参与人数最多的
|
||||
#
|
||||
# Returns project&courses array
|
||||
def find_miracle_course(sum=10, max_rate=7, school_id)
|
||||
# 原来的取课程逻辑
|
||||
def find_miracle_course_base(sum=10, max_rate=7, school_id)
|
||||
|
||||
if User.current.user_extensions.school.nil? and school_id.nil?
|
||||
Project.active.visible.course_entities.
|
||||
|
@ -133,6 +134,52 @@ module WelcomeHelper
|
|||
# (c1.take(max)+c2).take(sum)
|
||||
end
|
||||
|
||||
#获取课程列表
|
||||
# add by nwb
|
||||
def find_miracle_course(sum=10, max_rate=7, school_id)
|
||||
if User.current.user_extensions.school.nil? and school_id.nil?
|
||||
Course.active.visible.
|
||||
joins(:memberships).
|
||||
group('members.course_id').
|
||||
reorder("courses.time DESC, COUNT(members.course_id) DESC").take sum
|
||||
|
||||
else
|
||||
if school_id.nil?
|
||||
Course.active.visible.
|
||||
joins(:memberships).
|
||||
where("#{Course.table_name}.school_id = ?", User.current.user_extensions.school.id).
|
||||
group('members.course_id').
|
||||
reorder("courses.time DESC, COUNT(members.course_id) DESC").take sum
|
||||
else
|
||||
if school_id == "0"
|
||||
Course.active.visible.
|
||||
joins(:memberships).
|
||||
group('members.course_id').
|
||||
reorder("courses.time DESC, COUNT(members.course_id) DESC").take sum
|
||||
else
|
||||
Course.active.visible.
|
||||
joins(:memberships).
|
||||
where("#{Course.table_name}.school_id = ?", school_id).
|
||||
group('members.course_id').
|
||||
reorder("courses.time DESC, COUNT(members.course_id) DESC").take sum
|
||||
end
|
||||
end
|
||||
end
|
||||
# else
|
||||
# Project.active.visible.course_entities.
|
||||
# joins(:course_extra).
|
||||
# joins(:memberships).
|
||||
# where("#{Course.table_name}.school_id = ?", school_id).
|
||||
# group('members.project_id').
|
||||
# reorder("courses.time DESC, COUNT(members.project_id) DESC").take sum
|
||||
# end
|
||||
# max = sum*(max_rate.to_f/10)
|
||||
# c1 = find_new_course(sum).to_a.dup
|
||||
# c2 = find_all_hot_course(sum).to_a.dup
|
||||
# c2 = c2 - c1
|
||||
# (c1.take(max)+c2).take(sum)
|
||||
end
|
||||
|
||||
#查找所有学校按每个学校开设课程数量降序排序
|
||||
#page 分页查询开始条数的编号,从0开始
|
||||
#limit 分页查询的数量
|
||||
|
@ -182,11 +229,18 @@ module WelcomeHelper
|
|||
sort_course_by_hot limit
|
||||
end
|
||||
|
||||
# modif by nwb
|
||||
def find_all_new_hot_course limit = 9 ,school_id = 0
|
||||
#sort_project_by_hot_rails 1, 'course_ac_para DESC', limit
|
||||
time_now = Time.new.strftime("%Y");
|
||||
Project.visible.joins(:project_status).where("#{Project.table_name}.project_type = ? and #{Project.table_name}.created_on like '%#{time_now}%' and #{Project.table_name}.identifier not in
|
||||
(select extra from courses where school_id = ?)", 1,school_id).order("course_ac_para DESC").limit(limit).all
|
||||
if 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
|
||||
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
|
||||
end
|
||||
|
||||
def find_all_hot_bid
|
||||
|
|
|
@ -27,6 +27,7 @@ class Course < ActiveRecord::Base
|
|||
has_many :boards, :dependent => :destroy, :order => "position ASC"
|
||||
#has_many :course_journals_for_messages, :class_name => 'CourseJournalsForMessage', :as => :jour, :dependent => :destroy
|
||||
has_many :news, :dependent => :destroy, :include => :author
|
||||
has_one :course_status, :class_name => "CourseStatus", :dependent => :destroy
|
||||
|
||||
acts_as_taggable
|
||||
acts_as_nested_set :order => 'name', :dependent => :destroy
|
||||
|
|
|
@ -113,6 +113,7 @@ class Project < ActiveRecord::Base
|
|||
|
||||
validates_presence_of :name, :identifier
|
||||
validates_uniqueness_of :identifier
|
||||
validates_uniqueness_of :name
|
||||
validates_associated :repository, :wiki
|
||||
# validates_length_of :description, :maximum => 255
|
||||
validates_length_of :name, :maximum => 255
|
||||
|
|
|
@ -38,7 +38,7 @@ class Repository < ActiveRecord::Base
|
|||
|
||||
validates_length_of :password, :maximum => 255, :allow_nil => true
|
||||
validates_length_of :identifier, :maximum => IDENTIFIER_MAX_LENGTH, :allow_blank => true
|
||||
validates_presence_of :identifier, :unless => Proc.new { |r| r.is_default? || r.set_as_default? }
|
||||
validates_presence_of :identifier#, :unless => Proc.new { |r| r.is_default? || r.set_as_default? }
|
||||
validates_uniqueness_of :identifier, :scope => :project_id, :allow_blank => true
|
||||
validates_exclusion_of :identifier, :in => %w(show entry raw changes annotate diff show stats graph)
|
||||
# donwcase letters, digits, dashes, underscores but not digits only
|
||||
|
|
|
@ -34,6 +34,8 @@
|
|||
</p>
|
||||
<p><%= f.select :is_evaluation, is_evaluation_option %>
|
||||
</p>
|
||||
<p><%= f.select :proportion, proportion_option %>
|
||||
</p>
|
||||
<p><%= hidden_field_tag 'course_id', @course.id %>
|
||||
</p>
|
||||
<fieldset><legend><%= l(:label_attachment_plural) %></legend>
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
<div>
|
||||
<table class="underline-evreycontent" style="font-size: 14px;">
|
||||
<tr>
|
||||
<td colspan="2" valign="top" width="50" ><%= image_tag(url_to_avatar(e.event_author), :class => "avatar")%></td>
|
||||
<td colspan="2" valign="top" width="50"><%= image_tag(url_to_avatar(e.event_author), :class => "avatar") %></td>
|
||||
<td>
|
||||
<table width="580px" border="0">
|
||||
<tr>
|
||||
|
@ -19,7 +19,9 @@
|
|||
<strong> <%= h(e.event_title) if @course.nil? || (e.course != nil && @course.id != e.course.id) %></strong>
|
||||
<span class="font_lighter">
|
||||
<% if @canShowRealName %>
|
||||
<%= link_to_user(e.event_author) if e.respond_to?(:event_author) %>(<%= link_to_user(e.event_author,@canShowRealName) if e.respond_to?(:event_author) %>)
|
||||
<%= link_to_user(e.event_author) if e.respond_to?(:event_author) %>
|
||||
(<%= link_to_user(e.event_author, @canShowRealName) if e.respond_to?(:event_author) %>
|
||||
)
|
||||
<% else %>
|
||||
<%= link_to_user(e.event_author) if e.respond_to?(:event_author) %>
|
||||
<% end %>
|
||||
|
@ -31,18 +33,23 @@
|
|||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" width="580px" >
|
||||
<td colspan="2" width="580px">
|
||||
<p class="info-break">
|
||||
<%= h(truncate(strip_tags(e.event_description).gsub(/ /,' '), length: 30, omission:'...')) %>
|
||||
<%= h(truncate(strip_tags(e.event_description).gsub(/ /, ' '), length: 30, omission: '...')) %>
|
||||
</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left"><span class="font_lighter"> <%= l :label_activity_time %>: <%= format_activity_day(day) %> <%= format_time(e.event_datetime, false) %></span></td>
|
||||
<td align="left"><span class="font_lighter"> <%= l :label_activity_time %>
|
||||
: <%= format_activity_day(day) %> <%= format_time(e.event_datetime, false) %></span>
|
||||
</td>
|
||||
<% if e.event_type == "issue" %>
|
||||
<td align="right"><span> <%= link_to l(:label_find_all_comments), issue_path(e) %> </span><span class="font_lighter"><%= l(:label_comments_count, :count => e.journals.count)%></span></td>
|
||||
<td align="right">
|
||||
<span> <%= link_to l(:label_find_all_comments), issue_path(e) %> </span><span class="font_lighter"><%= l(:label_comments_count, :count => e.journals.count) %></span>
|
||||
</td>
|
||||
<% end %>
|
||||
</tr>
|
||||
</table></td>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
@ -50,60 +57,47 @@
|
|||
<% end %>
|
||||
</div>
|
||||
|
||||
<!-- Added by Longjun 在最后一页显示创建信息 -->
|
||||
<% if format_date(day) == format_date(@date_to - @days) %>
|
||||
<h1>Test</h1>
|
||||
<div >
|
||||
<table width="660">
|
||||
<tr>
|
||||
<td><%= image_tag(url_to_avatar(@user), :class => "avatar") %></td>
|
||||
<td colspan="2">
|
||||
<table width="580">
|
||||
<tr>
|
||||
<td > <%= link_to (h @user.try(:name)), user_path(@user) if @user %> <%= l(:label_user_create_project) %> <%= link_to @course.name %><strong> !</strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="font_lighter" style="float: right"><%= l :label_update_time %>: <%= format_time(@course.created_on) %>
|
||||
</table></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end -%>
|
||||
|
||||
|
||||
<div class="pagination">
|
||||
<ul>
|
||||
<%= pagination_links_full @events_pages%>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="font_description">
|
||||
<table width="660">
|
||||
<tr>
|
||||
<td><%= image_tag(url_to_avatar(@user), :class => "avatar") %></td>
|
||||
<td colspan="2">
|
||||
<table width="580">
|
||||
<tr>
|
||||
<td >
|
||||
<%
|
||||
#判断是否显示真名
|
||||
if @canShowRealName
|
||||
%>
|
||||
<%= link_to (h @user.try(:name)), user_path(@user) if @user %>(<%= link_to (h @user.try(:realname)), user_path(@user) if @user %>)
|
||||
<% else %>
|
||||
<%= link_to (h @user.try(:name)), user_path(@user) if @user %>
|
||||
<% end %>
|
||||
<%= l(:label_user_create_project) %> <%= link_to @course.name %><strong> !</strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="font_lighter" style="float: right"><%= l :label_update_time %>: <%= format_time(@course.created_at) %>
|
||||
</table></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="font_description">
|
||||
<table width="660">
|
||||
<tr>
|
||||
<td><%= image_tag(url_to_avatar(@user), :class => "avatar") %></td>
|
||||
<td colspan="2">
|
||||
<table width="580">
|
||||
<tr>
|
||||
<td>
|
||||
<%
|
||||
#判断是否显示真名
|
||||
if @canShowRealName
|
||||
%>
|
||||
<%= link_to (h @user.try(:name)), user_path(@user) if @user %>
|
||||
(<%= link_to (h @user.try(:realname)), user_path(@user) if @user %>)
|
||||
<% else %>
|
||||
<%= link_to (h @user.try(:name)), user_path(@user) if @user %>
|
||||
<% end %>
|
||||
<%= l(:label_user_create_project) %> <%= link_to @course.name %>
|
||||
<strong> !</strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="font_lighter" style="float: right"><%= l :label_update_time %>
|
||||
: <%= format_time(@course.created_at) %>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="pagination">
|
||||
<ul>
|
||||
<%= pagination_links_full @events_pages %>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -5,7 +5,9 @@
|
|||
<% end %>
|
||||
<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 %>
|
||||
<% 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>
|
||||
|
@ -24,44 +26,44 @@
|
|||
<%= call_hook(:view_projects_form, :project => @project, :form => f) %>
|
||||
|
||||
|
||||
<!-- <% if @project.new_record? %>
|
||||
<fieldset class="box tabular"><legend><%= l(:label_module_plural) %></legend>
|
||||
<% Redmine::AccessControl.available_project_modules.each do |m| %>
|
||||
<!-- <%# if @project.new_record? %>
|
||||
<fieldset class="box tabular"><legend><%#= l(:label_module_plural) %></legend>
|
||||
<%# Redmine::AccessControl.available_project_modules.each do |m| %>
|
||||
<label class="floating">
|
||||
<%= 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_") %>
|
||||
<%#= 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_") %>
|
||||
</label>
|
||||
<% end %>
|
||||
<%= hidden_field_tag 'project[enabled_module_names][]', '' %>
|
||||
<%= javascript_tag 'observeProjectModules()' %>
|
||||
<%# end %>
|
||||
<%#= hidden_field_tag 'project[enabled_module_names][]', '' %>
|
||||
<%#= javascript_tag 'observeProjectModules()' %>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
<%# end %>
|
||||
|
||||
<% if @project.new_record? || @project.module_enabled?('issue_tracking') %>
|
||||
<% unless @trackers.empty? %>
|
||||
<fieldset class="box tabular" id="project_trackers"><legend><%=l(:label_tracker_plural)%></legend>
|
||||
<% @trackers.each do |tracker| %>
|
||||
<%# if @project.new_record? || @project.module_enabled?('issue_tracking') %>
|
||||
<%# unless @trackers.empty? %>
|
||||
<fieldset class="box tabular" id="project_trackers"><legend><%#=l(:label_tracker_plural)%></legend>
|
||||
<%# @trackers.each do |tracker| %>
|
||||
<label class="floating">
|
||||
<%= check_box_tag 'project[tracker_ids][]', tracker.id, @project.trackers.include?(tracker) %>
|
||||
<%=h tracker %>
|
||||
<%#= check_box_tag 'project[tracker_ids][]', tracker.id, @project.trackers.include?(tracker) %>
|
||||
<%#=h tracker %>
|
||||
</label>
|
||||
<% end %>
|
||||
<%= hidden_field_tag 'project[tracker_ids][]', '' %>
|
||||
<%# end %>
|
||||
<%#= hidden_field_tag 'project[tracker_ids][]', '' %>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
<%# end %>
|
||||
|
||||
<% unless @issue_custom_fields.empty? %>
|
||||
<fieldset class="box tabular" id="project_issue_custom_fields"><legend><%=l(:label_custom_field_plural)%></legend>
|
||||
<% @issue_custom_fields.each do |custom_field| %>
|
||||
<%# unless @issue_custom_fields.empty? %>
|
||||
<fieldset class="box tabular" id="project_issue_custom_fields"><legend><%#=l(:label_custom_field_plural)%></legend>
|
||||
<%# @issue_custom_fields.each do |custom_field| %>
|
||||
<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"} : {}) %>
|
||||
<%=h custom_field.name %>
|
||||
<%#= 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 %>
|
||||
</label>
|
||||
<% end %>
|
||||
<%= hidden_field_tag 'project[issue_custom_field_ids][]', '' %>
|
||||
<%# end %>
|
||||
<%#= hidden_field_tag 'project[issue_custom_field_ids][]', '' %>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
<% end %> -->
|
||||
<%# end %>
|
||||
<%# end %> -->
|
||||
<!--[eoform:project]-->
|
||||
|
||||
<% unless @project.identifier_frozen? %>
|
||||
|
|
|
@ -48,37 +48,14 @@
|
|||
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<% end -%>
|
||||
|
||||
<!-- Added by Longjun 在最后一页显示创建信息 -->
|
||||
<% if format_date(day) == format_date(@date_to - @days) %>
|
||||
<h1>Test</h1>
|
||||
<div >
|
||||
<table width="660">
|
||||
<tr>
|
||||
<td><%= image_tag(url_to_avatar(@user), :class => "avatar") %></td>
|
||||
<td colspan="2">
|
||||
<table width="580">
|
||||
<tr>
|
||||
<td > <%= link_to (h @user.try(:name)), user_path(@user) if @user %> <%= l(:label_user_create_project) %> <%= link_to @project.name %><strong> !</strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="font_lighter" style="float: right"><%= l :label_update_time %>: <%= format_time(@project.created_on) %>
|
||||
</table></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end -%>
|
||||
|
||||
|
||||
<div class="pagination">
|
||||
<ul>
|
||||
<%= pagination_links_full @events_pages%>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<% else %>
|
||||
<%end%>
|
||||
|
||||
<div class="font_description">
|
||||
<table width="660">
|
||||
<tr>
|
||||
|
@ -103,6 +80,13 @@
|
|||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
|
||||
|
||||
<div class="pagination">
|
||||
<ul>
|
||||
<%= pagination_links_full @events_pages%>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
|
|
|
@ -43,9 +43,9 @@
|
|||
|
||||
<script type="text/javascript">
|
||||
function test(id){
|
||||
|
||||
location.href = encodeURI('http://course.trustie.net<%=port%>?school_id='+id);
|
||||
location.href = encodeURI('/course/'+id);
|
||||
}
|
||||
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
function ssearch(){
|
||||
|
@ -69,8 +69,9 @@
|
|||
|
||||
<div>
|
||||
<p>
|
||||
<a href="http://course.trustie.net<%=port%>?school_id=0">全部学校</a>
|
||||
<a href="http://course.trustie.net<%=port%>">我的学校</a>
|
||||
|
||||
<%= link_to "全部学校",school_index_path %>
|
||||
<%= link_to '我的学校',school_course_list_path(User.current.user_extensions.school) %>
|
||||
</p>
|
||||
<ul>
|
||||
<li style="width: 40%; float: left">请选择省份:
|
||||
|
@ -84,7 +85,7 @@
|
|||
<div style="clear: both"></div>
|
||||
<div>
|
||||
<ul id="schoollist" style="line-height: 25px">
|
||||
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<div id="issues">
|
||||
<% if attachments_results.size < 0 %>
|
||||
<% if attachments_results.try(:size).to_i < 0 %>
|
||||
<% else %>
|
||||
<hr />
|
||||
<% attachments_results.each do |file| %>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<div id="issues">
|
||||
<% if bids_results.size > 0 %>
|
||||
<% if bids_results.try(:size).to_i > 0 %>
|
||||
<hr />
|
||||
<% bids_results.each do |bid| %>
|
||||
<p class="font_description2">
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<div id="issues">
|
||||
<% if contests_results.size > 0 %>
|
||||
<% if contests_results.try(:size).to_i > 0 %>
|
||||
<hr />
|
||||
<% contests_results.each do |contest| %>
|
||||
<p class="font_description2">
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
<div id="issues">
|
||||
<% if courses_results.try(:size).to_i > 0 %>
|
||||
<hr />
|
||||
<% courses_results.each do |course| %>
|
||||
<p class="font_description2">
|
||||
<strong><%= l(:label_course) %>:<%= link_to "#{course.name}",course_path(course) %></strong>
|
||||
<br />
|
||||
<strong><%= l(:label_new_course_description) %>:</strong><%= course.description %>
|
||||
<%= course.updated_at %>
|
||||
</p>
|
||||
<div class="line_under"></div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
|
@ -1,5 +1,5 @@
|
|||
<div id="issues">
|
||||
<% if forums_results.size > 0 %>
|
||||
<% if forums_results.try(:size).to_i > 0 %>
|
||||
<hr />
|
||||
<% forums_results.each do |forum| %>
|
||||
<p class="font_description2">
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<div id="issues">
|
||||
<% if issues_results.size > 0 %>
|
||||
<% if issues_results.try(:size).to_i > 0 %>
|
||||
<hr />
|
||||
<% issues_results.each do |issue| %>
|
||||
<p class="font_description2">
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<div id="projects">
|
||||
<% if projects_results.size > 0 %>
|
||||
<% if projects_results.try(:size).to_i > 0 %>
|
||||
<hr />
|
||||
<% projects_results.each do |prj| %>
|
||||
<div>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<div id="projects">
|
||||
<% if projects_results.size > 0 %>
|
||||
<% if projects_results.try(:size).to_i > 0 %>
|
||||
<hr />
|
||||
<% projects_results.each do |prj| %>
|
||||
<div>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<div id="users">
|
||||
<% if users_results.size > 0 %>
|
||||
<% if users_results.try(:size).to_i > 0 %>
|
||||
<hr />
|
||||
<% users_results.each do |user| %>
|
||||
<p class="font_description2">
|
||||
|
|
|
@ -26,6 +26,9 @@
|
|||
<strong><%#= l(:label_attachment)%>
|
||||
开源项目:(<%= @results_count %>)</strong>
|
||||
<%= render :partial => "show_open_source_projects",:locals => {:projects_results => open_source_projects_results}%>
|
||||
<% when show_flag == '9'%>
|
||||
<strong><%= l(:label_course)%>(<%= @results_count %>)</strong>
|
||||
<%= render :partial => "show_courses",:locals => {:courses_results => courses_results}%>
|
||||
<% else %>
|
||||
<strong><%= l(:label_tags_all_objects)%></strong>
|
||||
<!-- 这里为显示搜有过滤结果预留了默认设置 -->
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
<%= l(:label_user_plural) %>(<%= @users_tags_num %>) |
|
||||
<%= l(:label_tags_call)%>(<%= @bids_tags_num %>) |
|
||||
<%= l(:field_filename)%>(<%= @attachments_tags_num %>) |
|
||||
开源项目(<%= @open_source_projects_num %>)
|
||||
开源项目(<%= @open_source_projects_num %>) |
|
||||
<%= l(:label_tags_contest)%>(<%= @contests_tags_num %>) |
|
||||
</div>
|
||||
<div id="show_results">
|
||||
|
@ -37,6 +37,7 @@
|
|||
:attachments_results=> @attachments_results,
|
||||
:contests_results => @contests_results,
|
||||
:open_source_projects_results => @open_source_projects_results,
|
||||
:courses_results => @courses_results,
|
||||
:show_flag => @obj_flag}
|
||||
%>
|
||||
</div>
|
||||
|
|
|
@ -0,0 +1,58 @@
|
|||
<%
|
||||
select_option = []
|
||||
(select_option << ['项目', 'projects']) if project_type == Project::ProjectType_project
|
||||
(select_option << ['课程', 'courses']) if project_type == Project::ProjectType_course
|
||||
select_option << ['用户', 'users']
|
||||
#select_option << ['教师', 'users_teacher'],
|
||||
#select_option << ['学生', 'users_student']
|
||||
%>
|
||||
<style type="text/css">
|
||||
form #q, form #search_type{
|
||||
-webkit-box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
display: inline-block;
|
||||
margin: 0px;
|
||||
padding: 5px;
|
||||
height: 33px;
|
||||
}
|
||||
form #q{
|
||||
font-size: 13px;
|
||||
border-top-left-radius: 5px;
|
||||
border-bottom-left-radius: 5px;
|
||||
border-right: none;
|
||||
|
||||
}
|
||||
form #search_type{
|
||||
font-size: 13px;
|
||||
color: #363739;
|
||||
border-top-right-radius: 5px;
|
||||
border-bottom-right-radius: 5px;
|
||||
border-bottom-left-radius: 0px;
|
||||
border-top-left-radius: 0px;
|
||||
border-left: 1px outset #83A9A9;
|
||||
margin-left: -4px;
|
||||
-webkit-appearance: none;
|
||||
-moz-appearance: none;
|
||||
text-indent: 0.01px;
|
||||
text-overflow: '';
|
||||
}
|
||||
.search_widget{
|
||||
display:inline-block;
|
||||
border-radius: 5px;
|
||||
}
|
||||
.search_widget:hover{
|
||||
box-shadow: 0px 0px 3px #56B4EF;
|
||||
}
|
||||
<%#完了把上面东西放到 .css 里%>
|
||||
</style>
|
||||
<%= form_tag({controller: :welcome, action: :search }, method: :get) do %>
|
||||
<div class="project-search" style="float: right">
|
||||
<div class='search_widget'>
|
||||
<%= text_field_tag :q, nil, placeholder:'请输入要搜索的关键字', :size => 27 %>
|
||||
<%= select_tag(:search_type, options_for_select(select_option) ) %>
|
||||
</div>
|
||||
<%#= hidden_field_tag 'project_type', project_type %>
|
||||
<%= submit_tag l(:label_search), :class => "enterprise", :name => nil %>
|
||||
</div>
|
||||
<% end %>
|
|
@ -3,26 +3,25 @@
|
|||
<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">
|
||||
|
||||
$(function(){
|
||||
$(function () {
|
||||
$("#main").find("a").attr("target", "_blank");
|
||||
setCss();
|
||||
});
|
||||
|
||||
//设置div居中
|
||||
function setCss()
|
||||
{
|
||||
function setCss() {
|
||||
var mainBar = $('#main-content-bar')[0];
|
||||
var topHeight = mainBar.offsetHeight;
|
||||
var welcomeLeft = $('#welcome_left')[0];
|
||||
var leftHeight = welcomeLeft.offsetHeight;
|
||||
var leftHeight = welcomeLeft.offsetHeight;
|
||||
var searchbar = $('#search-bar')[0];
|
||||
var searchHeight = searchbar.offsetHeight;
|
||||
welcomeLeft.style.marginTop = (topHeight - leftHeight)/2 + "px";
|
||||
searchbar.style.marginTop = (topHeight - searchHeight)/2 + "px";
|
||||
welcomeLeft.style.marginTop = (topHeight - leftHeight) / 2 + "px";
|
||||
searchbar.style.marginTop = (topHeight - searchHeight) / 2 + "px";
|
||||
//alert((topHeight - leftHeight)/2 );
|
||||
}
|
||||
// 给主页用户弹新页面
|
||||
$(document).ready(function($) {
|
||||
$(document).ready(function ($) {
|
||||
$("#loggedas").find("a").attr("target", "_blank");
|
||||
//$("#content .tabs_new~ .pagination").find("a").removeAttr("target");
|
||||
});
|
||||
|
@ -35,34 +34,34 @@
|
|||
</div>
|
||||
<div class="main-content-bar" id="main-content-bar">
|
||||
<div style="float: left">
|
||||
<%= image_tag(@logoLink, size:'75x75') %>
|
||||
<%= image_tag(@logoLink, size: '75x75') %>
|
||||
|
||||
</div>
|
||||
<div class="course welcome_left" id="welcome_left" >
|
||||
<span class="font_welcome_school"> <% if params[:school_id].nil? and User.current.user_extensions.school.nil? %>
|
||||
<% else%>
|
||||
<% if params[:school_id] == "0" %>
|
||||
<div class="course welcome_left" id="welcome_left">
|
||||
<span class="font_welcome_school"> <% if @school_id.nil? and User.current.user_extensions.school.nil? %>
|
||||
<% else %>
|
||||
<% if @school_id == "0" %>
|
||||
<% else %>
|
||||
<% if params[: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'}%>
|
||||
<br />
|
||||
<% 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'} %>
|
||||
<br/>
|
||||
<% else %>
|
||||
<%= link_to School.find(params[:school_id]).name ,options={:action => 'course',:school_id => params[:school_id]}, html_options={:class => 'font_welcome_school',:method => 'get'}%>
|
||||
<br />
|
||||
<%= link_to School.find(@school_id).name, options={:action => 'course', :school_id => @school_id}, html_options={:class => 'font_welcome_school', :method => 'get'} %>
|
||||
<br/>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %> </span>
|
||||
<span class="font_welcome_trustie"><%= l(:label_welcome_trustie) %><%= l(:label_welcome_trustie_course) %> </span>
|
||||
<% if params[:school_id].nil? and User.current.user_extensions.school.nil? %>
|
||||
<% if @school_id.nil? and User.current.user_extensions.school.nil? %>
|
||||
<span class="font_welcome_tdescription">, <%= l(:label_welcome_trustie_course_description) %></span>
|
||||
<% else %>
|
||||
<% if params[:school_id] == "0" %>
|
||||
<% if @school_id == "0" %>
|
||||
<span class="font_welcome_tdescription">, <%= l(:label_welcome_trustie_course_description) %></span>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="search-bar" id="search-bar">
|
||||
<%= render :partial => "search_project", :locals => {:project_type => Project::ProjectType_course}%>
|
||||
<%= render :partial => "search_course", :locals => {:project_type => Project::ProjectType_course} %>
|
||||
</div>
|
||||
<div style="clear: both;"></div>
|
||||
</div>
|
||||
|
@ -73,32 +72,38 @@
|
|||
|
||||
<div id="J_Slide" class="d-p-index-box d-p-index-hotproject">
|
||||
<h3><strong>新开课程</strong></h3>
|
||||
<% school_course = find_miracle_course(10, 7,params[:school_id]) %>
|
||||
<% if(school_course.count == 0) %>
|
||||
<span><%= link_to "更多>>", {:controller => 'projects', :action => 'course', :project_type => 1, :school_id => nil} %></span>
|
||||
<% if @school_id %>
|
||||
<% 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>
|
||||
|
||||
<div class="d-p-projectlist-box">
|
||||
<ul class="d-p-projectlist">
|
||||
|
||||
</ul>
|
||||
<ul class="d-p-projectlist">
|
||||
<h1></h1>
|
||||
|
||||
<p id="errorExplanation">
|
||||
该学校未开设任何课程,您可以查看其他学校课程
|
||||
</p>
|
||||
|
||||
<h1></h1>
|
||||
<% find_all_new_hot_course(9,params[:school_id]).map do |project| %>
|
||||
<li class='<%= cycle("odd", "even") %>' title=<%=project.description.to_s%>>
|
||||
<% find_all_new_hot_course(9, @school_id).map do |course| %>
|
||||
<li class='<%= cycle("odd", "even") %>' title=<%= course.description.to_s %>>
|
||||
<div class='avatar'>
|
||||
<%= image_tag(get_course_avatar(project), :class => "avatar-4") %>
|
||||
<%= image_tag(get_course_avatar(course), :class => "avatar-4") %>
|
||||
</div>
|
||||
<!-- 上左下右 -->
|
||||
<div class='desc_item' >
|
||||
<div class='desc_item'>
|
||||
<span class=''>
|
||||
<% course = Course.find_by_extra(project.identifier)%>
|
||||
<% if(course.school == nil) %>
|
||||
<% if (course.school == nil) %>
|
||||
|
||||
<% 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 %>
|
||||
</span>
|
||||
<span class='font_bolder'>
|
||||
|
@ -107,21 +112,11 @@
|
|||
</span>
|
||||
</div>
|
||||
<div class='desc_item text_nowrap' style="width: 310px;">
|
||||
[<%= get_course_term project %>]
|
||||
<%= link_to( project.name, project_path(project.id), :class => "d-g-blue d-p-project-name",:title => "#{project.name}" )%>
|
||||
(<%= "#{studentCount(project)}人" %>)
|
||||
<% files_count = (project.attachments.count.to_i+Version.joins(:project).where("projects.id=#{project.id}").count.to_i).to_s %>
|
||||
(<%=link_to "#{files_count}份", project_files_path(project) %>资料)
|
||||
</div>
|
||||
<!-- <div class='desc_item' style="">
|
||||
<span class='font_lighter' title=<%#=project.description.to_s%>><%#=project.description.truncate(25, omission: '...')%></span>
|
||||
</div> -->
|
||||
<div>
|
||||
<% if !course_endTime_timeout?(project)%>
|
||||
<div >
|
||||
<%= new_watcher_link(project, User.current)%>
|
||||
</div>
|
||||
<% end %>
|
||||
[<%= get_course_term course %>]
|
||||
<%= link_to(course.name, course_path(course.id), :class => "d-g-blue d-p-project-name", :title => "#{course.name}") %>
|
||||
(<%= "#{studentCount(course)}人" %>)
|
||||
<% files_count = course.attachments.count.to_s %>
|
||||
(<%= link_to "#{files_count}份", course_files_path(course) %>资料)
|
||||
</div>
|
||||
</li>
|
||||
<% end %>
|
||||
|
@ -130,11 +125,11 @@
|
|||
<% else %>
|
||||
<% if school_course.count < 9 %>
|
||||
<span>
|
||||
<%= link_to "更多>>", {:controller => 'projects', :action => 'course', :project_type => 1, :school_id => nil} %>
|
||||
<%= link_to "更多>>", {:controller => 'courses', :action => 'index', :school_id => nil} %>
|
||||
</span>
|
||||
<% else %>
|
||||
<span>
|
||||
<%= link_to "更多>>", {:controller => 'projects', :action => 'course', :project_type => 1, :school_id => params[:school_id]} %>
|
||||
<%= link_to "更多>>", {:controller => 'courses', :action => 'index', :school_id => @school_id} %>
|
||||
</span>
|
||||
<% end %>
|
||||
<div class="d-p-projectlist-box">
|
||||
|
@ -142,81 +137,73 @@
|
|||
|
||||
</ul>
|
||||
<ul class="d-p-projectlist">
|
||||
<% school_course.map do |project| %>
|
||||
<li class='<%= cycle("odd", "even") %>' title=<%=project.description.to_s%>>
|
||||
<% school_course.map do |course| %>
|
||||
<li class='<%= cycle("odd", "even") %>' title=<%= course.description.to_s %>>
|
||||
<div class='avatar'>
|
||||
<%= image_tag(get_course_avatar(project), :class => "avatar-4") %>
|
||||
<%= image_tag(get_course_avatar(course), :class => "avatar-4") %>
|
||||
</div>
|
||||
<!-- 上左下右 -->
|
||||
<div class='desc_item' >
|
||||
<div class='desc_item'>
|
||||
<span class=''>
|
||||
<% course = Course.find_by_extra(project.identifier) %>
|
||||
<%=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 class='font_bolder'>
|
||||
<%= link_to(course.try(:teacher).try(:realname), user_path(course.teacher)) %>
|
||||
</span>
|
||||
</div>
|
||||
<div class='desc_item text_nowrap' style="width: 310px;">
|
||||
[<%= get_course_term project %>]
|
||||
<%= link_to( project.name, project_path(project.id), :class => "d-g-blue d-p-project-name",:title => "#{project.name}" )%>
|
||||
(<%= "#{studentCount(project)}人" %>)
|
||||
<% files_count = (project.attachments.count.to_i+Version.joins(:project).where("projects.id=#{project.id}").count.to_i).to_s %>
|
||||
(<%=link_to "#{files_count}份", project_files_path(project) %>资料)
|
||||
<div class='desc_item text_nowrap' style="width: 310px;">
|
||||
[<%= get_course_term course %>]
|
||||
<%= link_to(course.name, course_path(course.id), :class => "d-g-blue d-p-project-name", :title => "#{course.name}") %>
|
||||
(<%= "#{studentCount(course)}人" %>)
|
||||
<% files_count = course.attachments.count.to_s %>
|
||||
(<%= link_to "#{files_count}份", course_files_path(course) %>资料)
|
||||
</div>
|
||||
|
||||
<div class='join_course_link'>
|
||||
<% if !course_endTime_timeout?(project)%>
|
||||
<div >
|
||||
<%= join_in_course(project, User.current)%>
|
||||
<% if !course_endTime_timeout?(course) %>
|
||||
<div>
|
||||
<%= join_in_course(course, User.current) %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</li>
|
||||
<% end; reset_cycle %>
|
||||
<% end; reset_cycle %>
|
||||
<% if school_course.count < 9 %>
|
||||
<li>
|
||||
<h1></h1>
|
||||
<p id="errorExplanation">
|
||||
该学校开设课程较少,您可以查看其他学校课程
|
||||
</p>
|
||||
</li>
|
||||
<% find_all_new_hot_course(9 - school_course.count,params[:school_id]).map do |project| %>
|
||||
<li class='<%= cycle("odd", "even") %>' title=<%=project.description.to_s%>>
|
||||
<div class='avatar'>
|
||||
<%= image_tag(get_course_avatar(project), :class => "avatar-4") %>
|
||||
</div>
|
||||
<!-- 上左下右 -->
|
||||
<div class='desc_item' >
|
||||
<li>
|
||||
<h1></h1>
|
||||
|
||||
<p id="errorExplanation">
|
||||
该学校开设课程较少,您可以查看其他学校课程
|
||||
</p>
|
||||
</li>
|
||||
<% find_all_new_hot_course(9 - school_course.count, @school_id).map do |course| %>
|
||||
<li class='<%= cycle("odd", "even") %>' title=<%= course.description.to_s %>>
|
||||
<div class='avatar'>
|
||||
<%= image_tag(get_course_avatar(course), :class => "avatar-4") %>
|
||||
</div>
|
||||
<!-- 上左下右 -->
|
||||
<div class='desc_item'>
|
||||
<span class=''>
|
||||
<% course = Course.find_by_extra(project.identifier)%>
|
||||
<% if(course.school == nil) %>
|
||||
<% if (course.school == nil) %>
|
||||
|
||||
<% else %>
|
||||
<!-- 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 %>
|
||||
</span>
|
||||
<span class='font_bolder'>
|
||||
<%= link_to(course.try(:teacher).try(:name), user_path(course.teacher)) %>
|
||||
</span>
|
||||
</div>
|
||||
<div class='desc_item text_nowrap' style="width: 310px;">
|
||||
[<%= get_course_term project %>]
|
||||
<%= link_to( project.name, project_path(project.id), :class => "d-g-blue d-p-project-name",:title => "#{project.name}" )%>
|
||||
<%= "#{studentCount(project)}人" %> )
|
||||
<% files_count = (project.attachments.count.to_i+Version.joins(:project).where("projects.id=#{project.id}").count.to_i).to_s %>
|
||||
(<%=link_to "#{files_count}份", project_files_path(project) %>资料)
|
||||
</div>
|
||||
<div>
|
||||
<% if !course_endTime_timeout?(project)%>
|
||||
<div >
|
||||
<%= new_watcher_link(project, User.current)%>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</li>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class='desc_item text_nowrap' style="width: 310px;">
|
||||
[<%= get_course_term course %>]
|
||||
<%= link_to(course.name, course_path(course.id), :class => "d-g-blue d-p-project-name", :title => "#{course.name}") %>
|
||||
<%= "#{studentCount(course)}人" %> )
|
||||
<% files_count = course.attachments.count.to_i.to_s %>
|
||||
(<%= link_to "#{files_count}份", course_files_path(course) %>资料)
|
||||
</div>
|
||||
</li>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
|
@ -226,18 +213,20 @@
|
|||
<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;">
|
||||
<strong>问题和反馈动态</strong>
|
||||
<%= 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 "我要提问", newbie_send_path, {:class => 'orangeButton idea_btn', :style => "color: #EEEEEE"} %>
|
||||
<%= link_to "我要反馈", suggestion_send_path, {:class => 'orangeButton idea_btn', :style => "color: #EEEEEE"} %>
|
||||
</h3>
|
||||
<span style="margin-top: -20px;float: right; display: block;"><%= link_to "更多>>", forums_path %></span>
|
||||
|
||||
<div class="d-p-projectlist-box">
|
||||
<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; ">
|
||||
<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;">
|
||||
<%= 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>
|
||||
|
||||
<div class='memo_activity memo_attr'>
|
||||
<span class='memo_timestamp'>
|
||||
<%= "#{l(:label_updated_time, value: time_tag_welcome(topic_last_time topic))}".html_safe %>
|
||||
|
@ -246,7 +235,7 @@
|
|||
楼主: <%= link_to_user(topic.author) %>
|
||||
</span>
|
||||
<span class="memo_last_person">
|
||||
最后回复:<%=link_to_user topic.last_reply.try(:author) %>
|
||||
最后回复:<%= link_to_user topic.last_reply.try(:author) %>
|
||||
</span>
|
||||
<span class="memo_reply">
|
||||
回复(<%= link_to topic.try(:replies_count), topic.event_url %>)
|
||||
|
|
|
@ -1574,6 +1574,7 @@ zh:
|
|||
field_budget: 奖励
|
||||
field_deadline: 截止日期
|
||||
field_is_evaluation: 是否启动互评
|
||||
field_proportion: 教师评分比例
|
||||
label_tags_selected: 已选标签
|
||||
label_tags_related: 相关标签
|
||||
button_project_tags_add: 增加
|
||||
|
|
|
@ -573,6 +573,8 @@ RedmineApp::Application.routes.draw do
|
|||
end
|
||||
end
|
||||
|
||||
match 'projects/course', :to => 'courses#course', :as => 'courses_course'
|
||||
match 'courses/search', :to => 'courses#search'
|
||||
# add by nwb
|
||||
# 课程路由设置
|
||||
resources :courses do
|
||||
|
@ -698,8 +700,8 @@ RedmineApp::Application.routes.draw do
|
|||
#######confusing########
|
||||
get 'welcome/search', to: 'welcome#search'
|
||||
get 'school/index', to: 'school#index'
|
||||
get 'course/:school_id', to: 'welcome#course'
|
||||
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'
|
||||
post 'school/get_options/:province', :to => 'school#get_options'
|
||||
get 'school/get_options/:province', :to => 'school#get_options'
|
||||
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
class AddProportionToBid < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :bids, :proportion, :integer, default: 60
|
||||
end
|
||||
end
|
|
@ -0,0 +1,11 @@
|
|||
class ClearCourseData < ActiveRecord::Migration
|
||||
def up
|
||||
# 清理课程表垃圾数据
|
||||
# 之前删除项目未删除课程的数据
|
||||
sql = 'delete from courses where name is null and extra not in (select identifier from projects)'
|
||||
execute(sql)
|
||||
end
|
||||
|
||||
def down
|
||||
end
|
||||
end
|
12
db/schema.rb
12
db/schema.rb
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20140626012511) do
|
||||
ActiveRecord::Schema.define(:version => 20140703085204) do
|
||||
|
||||
create_table "activities", :force => true do |t|
|
||||
t.integer "act_id", :null => false
|
||||
|
@ -94,18 +94,19 @@ ActiveRecord::Schema.define(:version => 20140626012511) do
|
|||
|
||||
create_table "bids", :force => true do |t|
|
||||
t.string "name"
|
||||
t.string "budget", :null => false
|
||||
t.string "budget", :null => false
|
||||
t.integer "author_id"
|
||||
t.date "deadline"
|
||||
t.string "description"
|
||||
t.datetime "created_on", :null => false
|
||||
t.datetime "updated_on", :null => false
|
||||
t.datetime "created_on", :null => false
|
||||
t.datetime "updated_on", :null => false
|
||||
t.integer "commit"
|
||||
t.integer "reward_type"
|
||||
t.integer "homework_type"
|
||||
t.integer "parent_id"
|
||||
t.string "password"
|
||||
t.integer "is_evaluation"
|
||||
t.integer "proportion", :default => 60
|
||||
end
|
||||
|
||||
create_table "boards", :force => true do |t|
|
||||
|
@ -793,7 +794,7 @@ ActiveRecord::Schema.define(:version => 20140626012511) do
|
|||
end
|
||||
|
||||
create_table "relative_memos", :force => true do |t|
|
||||
t.integer "osp_id"
|
||||
t.integer "osp_id", :null => false
|
||||
t.integer "parent_id"
|
||||
t.string "subject", :null => false
|
||||
t.text "content", :null => false
|
||||
|
@ -924,6 +925,7 @@ ActiveRecord::Schema.define(:version => 20140626012511) do
|
|||
|
||||
add_index "taggings", ["tag_id"], :name => "index_taggings_on_tag_id"
|
||||
add_index "taggings", ["taggable_id", "taggable_type", "context"], :name => "index_taggings_on_taggable_id_and_taggable_type_and_context"
|
||||
add_index "taggings", ["taggable_type"], :name => "index_taggings_on_taggable_type"
|
||||
|
||||
create_table "tags", :force => true do |t|
|
||||
t.string "name"
|
||||
|
|
Binary file not shown.
Binary file not shown.
BIN
doc/测试环境搭建.doc
BIN
doc/测试环境搭建.doc
Binary file not shown.
Loading…
Reference in New Issue