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

This commit is contained in:
lizanle 2015-04-15 10:31:09 +08:00
commit c2ccf6a1f8
24 changed files with 169 additions and 147 deletions

View File

@ -490,7 +490,7 @@ class BidsController < ApplicationController
(SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND is_teacher_score = 1 AND stars IS NOT NULL ORDER BY updated_at DESC limit 0,1) AS t_score,
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND is_teacher_score = 0) AS s_score
FROM homework_attaches WHERE bid_id = #{@bid.id} ORDER BY s_score DESC,created_at ASC) AS table1
WHERE table1.t_score IS NULL")
WHERE table1.t_score IS NULL OR table1.t_score = 0")
@not_batch_homework = true
@cur_type = 1
else

View File

@ -429,7 +429,7 @@ class CoursesController < ApplicationController
else
respond_to do |format|
format.html {
render :layout => 'base_courses'
# render :layout => 'base_courses'
flash[:notice] = l(:notice_successful_create)
if params[:continue]
redirect_to new_course_url(attrs, :course => '0')

View File

@ -22,6 +22,7 @@ class HomeworkAttachController < ApplicationController
#获取未批作业列表
def get_not_batch_homework
@not_batch_homework = true
@search_name = params[:name]
sort, direction = params[:sort] || "s_socre", params[:direction] || "desc"
get_not_batch_homework_list sort,direction, @bid.id
@cur_page = params[:page] || 1
@ -39,6 +40,7 @@ class HomeworkAttachController < ApplicationController
#获取已评作业列表
def get_batch_homeworks
@search_name = params[:name]
sort, direction = params[:sort] || "s_socre", params[:direction] || "desc"
@is_batch_homeworks = true
if sort == 't_socre'
@ -49,11 +51,12 @@ class HomeworkAttachController < ApplicationController
order_by = "created_at #{direction}"
end
all_homework_list = HomeworkAttach.eager_load(:attachments,:user,:rate_averages).find_by_sql("SELECT * FROM (SELECT homework_attaches.*,
(SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND is_teacher_score = 1 AND stars IS NOT NULL ORDER BY updated_at DESC limit 0,1) AS t_score,
(SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND is_teacher_score = 1 AND stars IS NOT NULL AND stars > 0 ORDER BY updated_at DESC limit 0,1) AS t_score,
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND is_teacher_score = 0) AS s_score
FROM homework_attaches WHERE bid_id = #{@bid.id}
ORDER BY #{order_by}) AS table1
WHERE table1.t_score IS NOT NULL")
all_homework_list = search_homework_member(all_homework_list,@search_name.to_s.downcase) if @search_name
@cur_page = params[:page] || 1
@cur_type = 2
@homework_list = paginateHelper all_homework_list,10
@ -72,6 +75,7 @@ class HomeworkAttachController < ApplicationController
#获取所有作业列表
def get_homeworks
@is_all_homeworks = true
@search_name = params[:name]
sort, direction = params[:sort] || "s_socre", params[:direction] || "desc"
if sort == 't_socre'
order_by = "t_score #{direction}"
@ -85,6 +89,8 @@ class HomeworkAttachController < ApplicationController
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND is_teacher_score = 0) AS s_score
FROM homework_attaches WHERE bid_id = #{@bid.id}
ORDER BY #{order_by}")
all_homework_list = search_homework_member(all_homework_list,@search_name.to_s.downcase) if @search_name
@cur_page = params[:page] || 1
@cur_type = 3
@homework_list = paginateHelper all_homework_list,10
@ -477,7 +483,7 @@ class HomeworkAttachController < ApplicationController
get_not_batch_homework_list params[:cur_sort] || "s_socre",params[:cur_direction] || "desc",@homework.bid_id
elsif @cur_type == "2" #老师已批列表
@result_homework = HomeworkAttach.find_by_sql("SELECT homework_attaches.*,
(SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND is_teacher_score = 1 AND stars IS NOT NULL ORDER BY updated_at DESC limit 0,1) AS t_score,
(SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND is_teacher_score = 1 AND stars IS NOT NULL AND stars > 0 ORDER BY updated_at DESC limit 0,1) AS t_score,
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND is_teacher_score = 0) AS s_score
FROM homework_attaches WHERE id = #{@homework.id}").first
elsif @cur_type == "3" #全部作业列表
@ -538,6 +544,14 @@ class HomeworkAttachController < ApplicationController
end
private
#根据条件过滤作业结果
def search_homework_member homeworks,name
select_homework = homeworks.select{ |homework|
homework.user[:login].to_s.downcase.include?(name) || homework.user.user_extensions[:student_id].to_s.downcase.include?(name) || (homework.user[:lastname].to_s.downcase + homework.user[:firstname].to_s.downcase).include?(name)
}
select_homework
end
#验证是否显示课程
def can_show_course
@first_page = FirstPage.find_by_page_type('project')
@ -596,7 +610,8 @@ class HomeworkAttachController < ApplicationController
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND is_teacher_score = 0) AS s_score
FROM homework_attaches WHERE bid_id = #{bid_id}
ORDER BY #{order_by}) AS table1
WHERE table1.t_score IS NULL")
WHERE table1.t_score IS NULL OR table1.t_score = 0 ")
@all_homework_list = search_homework_member(@all_homework_list,@search_name.to_s.downcase) if @search_name
@homework_list = paginateHelper @all_homework_list,10
end

View File

@ -233,10 +233,10 @@ module CoursesHelper
#searchPeopleByRoles(project, StudentRoles)
mems = []
if name != ""
name = name.to_s.downcase
members.each do |m|
username = m.user[:lastname].to_s + m.user[:firstname].to_s
if(m.user[:login].to_s.include?(name) || m.user.user_extensions[:student_id].to_s.include?(name) || username.include?(name))
username = m.user[:lastname].to_s.downcase + m.user[:firstname].to_s.downcase
if(m.user[:login].to_s.downcase.include?(name) || m.user.user_extensions[:student_id].to_s.downcase.include?(name) || username.include?(name))
mems << m
end
end

View File

@ -27,7 +27,7 @@ class Comment < ActiveRecord::Base
def send_mail
if self.commented.is_a?(News) && Setting.notified_events.include?('news_comment_added')
Mailer.news_comment_added(self)
Mailer.run.news_comment_added(self)
end
end
after_destroy :delete_kindeditor_assets

View File

@ -42,7 +42,8 @@ class Principal < ActiveRecord::Base
where({})
else
pattern = "%#{q}%"
sql = %w(login firstname lastname mail).map {|column| "LOWER(#{table_name}.#{column}) LIKE LOWER(:p)"}.join(" OR ")
# sql = %w(login firstname lastname mail).map {|column| "LOWER(#{table_name}.#{column}) LIKE LOWER(:p)"}.join(" OR ")
sql= "LOWER(concat(lastname,firstname)) LIKE LOWER(:p) or LOWER(login) LIKE LOWER(:p) or LOWER(mail) LIKE LOWER(:p)"
params = {:p => pattern}
if q =~ /^(.+)\s+(.+)$/
a, b = "#{$1}%", "#{$2}%"

View File

@ -58,54 +58,17 @@
function hidden_homework_atert_form(cur_page,cur_type)
{
hideModal($("#popbox"));
// 评了分的则刷新列表
// switch (cur_type)
// {
// case 1:
// $.ajax({
// type: "GET",
// url: "<%#= get_not_batch_homework_homework_attach_index_path(:bid_id => @bid.id)%>&page=" + cur_page,
// data: 'text',
// success: function (data) {
//
// }
// });
// break;
// case 2:
// $.ajax({
// type: "GET",
// url: "<%#= get_batch_homeworks_homework_attach_index_path(:bid_id => @bid.id)%>&page=" + cur_page,
// data: 'text',
// success: function (data) {
//
// }
// });
// break;
// case 3:
// $.ajax({
// type: "GET",
// url: "<%#= get_homeworks_homework_attach_index_path(:bid_id => @bid.id)%>&page=" + cur_page,
// data: 'text',
// success: function (data) {
//
// }
// });
// break;
// case 4:
// $.ajax({
// type: "GET",
// url: "<%#= get_student_batch_homework_homework_attach_index_path(:bid_id => @bid.id)%>&page=" + cur_page,
// data: 'text',
// success: function (data) {
//
// }
// });
// break;
// case 5:
// break;
// default :
// break;
// }
}
function search_homework_member(url)
{
$.get(
url,
{ name: $.trim($("#homework_member_search").val()) },
function (data) {
}
);
}
</script>
</div>

View File

@ -1,8 +1,3 @@
<% attachmenttypes = @course.attachmenttypes %>
<% sufixtypes = @course.contenttypes %>
<!--<%#= stylesheet_link_tag 'resource', :media => 'all' %> -->
<script>
function show_upload()
{

View File

@ -11,9 +11,17 @@
(<font color="#CC0000">
<%= homework_count%>
</font>)
<%
url= get_batch_homeworks_homework_attach_index_path(:bid_id => @bid.id) if is_batch_homeworks
url= get_not_batch_homework_homework_attach_index_path(:bid_id => @bid.id) if not_batch_homework
url= get_homeworks_homework_attach_index_path(:bid_id => @bid.id) if is_all_homeworks
%>
<%= link_to l(:label_export_excel), get_batch_homeworks_homework_attach_index_path(:bid_id => @bid.id,:format => 'xls'),:class=>'xls' if is_batch_homeworks%>
<%= link_to l(:label_export_excel), get_not_batch_homework_homework_attach_index_path(:bid_id => @bid.id,:format => 'xls'),:class=>'xls' if not_batch_homework%>
<%= link_to l(:label_export_excel), get_homeworks_homework_attach_index_path(:bid_id => @bid.id,:format => 'xls'),:class=>'xls' if is_all_homeworks%>
<input type="text" id="homework_member_search" placeholder="昵称、学号、姓名搜索" class="min_search ml10" value="<%= @search_name%>" >
<a href="javascript:void(0)" class="member_search" onclick="search_homework_member('<%= url%>');">搜索</a>
</span>
<span class="fr">
按&nbsp;

View File

@ -37,6 +37,8 @@
.span_wping a:hover{ background-color:#03a1b3;}
.span_wping_background{background: #CCC !important;}
.font_lighter_sidebar img{max-width: 100%}
/*上传图片处理*/
.upload_img img{max-width: 100%;}
</style>
</head>
<body class="<%= h body_css_classes %>">
@ -122,7 +124,7 @@
<!--count-->
<div class="inf_user_image">
<table>
<table style="width: 100%;">
<% if (User.current.admin?||User.current.allowed_to?(:as_teacher,course)) %>
<tr>
<td valign="top" style="padding-left: 8px; font-size: 15px" colspan="2">
@ -151,8 +153,8 @@
</tr>
<tr>
<td class="font_lighter_sidebar" colspan="2" style="padding-left: 8px;" title="<%= @bid.description %>">
<%= @bid.description.html_safe %>
<td class="font_lighter_sidebar" colspan="2" style="padding-left: 8px;">
<div class="upload_img" style="width: 210px;"><%= @bid.description.html_safe %></div>
</td>
</tr>

View File

@ -257,6 +257,47 @@
</ul>
</div>
<div id="J_Slide" class="d-p-index-box d-p-index-left">
<h3 style="margin-left: 5px; color: #e8770d;"><strong><%=l(:label_current_attendingcontest_work)%></strong></h3>
<div class="d-p-projectlist-box">
<% if Softapplication.count > 0%>
<div class="d-p-projectlist">
<% find_all_hot_softapplication.map do |softapplication| break if(softapplication == find_all_hot_softapplication[5]) %>
<li style="position:relative;height:6em;" class='<%= cycle("odd", "even") %>'>
<div class="avatar-4" style="float: left; margin-top: 7px">
<%= image_tag('/images/app1.png')%>
</div>
<div style="float: left; margin-left: 10px; margin-top: 7px;margin-bottom: -2px; width: 380px;">
<%= link_to(softapplication.name, softapplication_path(softapplication.id), :class => "d-g-blue d-p-project-name", :title => "#{softapplication.name}", :target => "_blank") %>
</div>
<div class='text_nowrap' style="float: left;margin:5px; margin-left: 10px; margin-bottom:1px; width: 380px;">
<span class='font_lighter' title =<%=softapplication.description.to_s%>>
<%=softapplication.description.to_s.truncate(50, omission: '...')%>
</span>
</div><br />
<div style="padding-left: 55px; clear: left;">
<span class="font_lighter">
<%=l(:label_release_time)%>:&nbsp;
<%=format_time softapplication.created_at %>
</span>
</div>
</li>
<% end; reset_cycle %>
</div>
<% else %>
<p class="font_lighter">
<%= l(:label_no_ftapplication) %>
</p>
<% end %>
</div>
</div>
<div id="J_Slide" class="d-p-index-box d-p-index-Dynamic">
<h3 style="margin-left: 5px; color: #e8770d;">
<strong><%=l(:label_issue_feedback_activities)%></strong>
@ -299,49 +340,6 @@
</div>
<div id="J_Slide" class="d-p-index-box d-p-index-left">
<h3 style="margin-left: 5px; color: #e8770d;"><strong><%=l(:label_current_attendingcontest_work)%></strong></h3>
<div class="d-p-projectlist-box">
<% if Softapplication.count > 0%>
<div class="d-p-projectlist">
<% find_all_hot_softapplication.map do |softapplication| break if(softapplication == find_all_hot_softapplication[5]) %>
<li style="position:relative;height:6em;" class='<%= cycle("odd", "even") %>'>
<div class="avatar-4" style="float: left; margin-top: 7px">
<%= image_tag('/images/app1.png')%>
</div>
<div style="float: left; margin-left: 10px; margin-top: 7px;margin-bottom: -2px; width: 380px;">
<%= link_to(softapplication.name, softapplication_path(softapplication.id), :class => "d-g-blue d-p-project-name", :title => "#{softapplication.name}", :target => "_blank") %>
</div>
<div class='text_nowrap' style="float: left;margin:5px; margin-left: 10px; margin-bottom:1px; width: 380px;">
<span class='font_lighter' title =<%=softapplication.description.to_s%>>
<%=softapplication.description.to_s.truncate(50, omission: '...')%>
</span>
</div><br />
<div style="padding-left: 55px; clear: left;">
<span class="font_lighter">
<%=l(:label_release_time)%>:&nbsp;
<%=format_time softapplication.created_at %>
</span>
</div>
</li>
<% end; reset_cycle %>
</div>
<% else %>
<p class="font_lighter">
<%= l(:label_no_ftapplication) %>
</p>
<% end %>
</div>
</div>
<div class="clearfix"></div>
</div>
<%= render partial: 'link_to_another' %>

View File

@ -41,8 +41,18 @@
<div class="course welcome_left" id="welcome_left">
<span class="font_welcome_school">
<% if @school_id.nil? and (User.current.user_extensions.nil? || User.current.user_extensions.school.nil?) %>
<span class="font_welcome_tdescription">,
<!--
edit by meng
@course_page.description存储在first_page表中的description字段
原本代码
<%= @course_page.description %>
!-->
<%= l(:label_welcome_trustie_course_description) %>
</span>
<% else %>
<% if @school_id == "0" %>
<% else %>
<% 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'} %>
@ -65,23 +75,6 @@
<%= l(:label_welcome_trustie_course) %>
</span>
<% if @school_id.nil? and (User.current.user_extensions.nil? || User.current.user_extensions.school.nil?) %>
<span class="font_welcome_tdescription">,
<!--
edit by meng
@course_page.description存储在first_page表中的description字段
原本代码
<%= @course_page.description %>
!-->
<%= l(:label_welcome_trustie_course_description) %>
</span>
<% else %>
<% if @school_id == "0" %>
<span class="font_welcome_tdescription">,
<%= @course_page.description %>
</span>
<% end %>
<% end %>
<% end %>
</div>
<div class="search-bar" id="search-bar">

View File

@ -11,7 +11,7 @@ RedmineApp::Application.configure do
# Show full error reports and disable caching
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
config.cache_store = :file_store, "#{Rails.root }/public/tmp/"
config.cache_store = :file_store, "#{Rails.root }/files/cache_store/"
# Don't care if the mailer can't send
config.action_mailer.raise_delivery_errors = true

View File

@ -19,7 +19,7 @@ RedmineApp::Application.configure do
# Full error reports are disabled and caching is turned on
config.logger = Logger.new('log/production.log', 'daily',1048576) # daily, weekly or monthly
config.action_controller.perform_caching = true
config.cache_store = :file_store, "#{Rails.root }/public/tmp/"
config.cache_store = :file_store, "#{Rails.root }/files/cache_store/"
# Enable serving of images, stylesheets, and javascripts from an asset server
# config.action_controller.asset_host = "http://assets.example.com"

View File

@ -1 +1 @@
Rails.application.config.session_store ActionDispatch::Session::CacheStore, :expire_after => 20.minutes
Rails.application.config.session_store ActionDispatch::Session::CacheStore, :expire_after => 20.minutes, :key => '_trustie_session', :domain => :all

View File

@ -1169,15 +1169,6 @@ en:
#end
# label_welcome_trustie: Trustie
# label_welcome_trustie_project: Online projects hosting platform
# label_welcome_trustie_course: Online Courses practice platform
# label_welcome_trustie_contest: Online Contests practice platform
# label_welcome_trustie_project_description: Software for Chinese college students and practitioners to provide social-oriented project management, code hosting, resource sharing, cooperation and exchange.
# label_welcome_trustie_course_description: Teachers and Students for Chinese universities to provide social-oriented curriculum management, resource sharing, cooperation achieved, collaborative research.
# label_welcome_trustie_contest_description: Software for Chinese college students and practitioners to provide social-oriented contest management, code hosting, resource sharing, cooperation and exchange.
# label_welcome_trustie_description: a socialized collaboration platform for project management, collaborative research, software development and software crowdsourcing for creative university students and entrepreneurs.
label_bid_if_agreement: If you like me, please press me #bai

View File

@ -81,7 +81,7 @@ zh:
label_brief_introduction: 个性签名
label_my_brief_introduction: 今天的心情如何?留下你的脚印吧~
label_user_joinin: 加入时间
label_user_join: 加入时间
label_user_login: 最后登录
label_technical_title: 职称
@ -213,6 +213,7 @@ zh:
#
# Followers & Fans
#
label_user_joinin: 加入时间
label_x_contribute_to:
zero: "参与了 %{count} 个项目"
one: "参与了 %{count} 个项目——"

View File

@ -763,7 +763,7 @@ zh:
label_feedback_fail: "留言失败"
label_user_login: "最后登录"
label_user_mail: "邮件地址"
label_user_joinin: "加入时间"
label_overview: "概述"
@ -1411,13 +1411,7 @@ zh:
label_project_sort: 排序方式
label_welcome_trustie: Trustie
label_welcome_trustie_project: 在线项目托管平台
label_welcome_trustie_course: 在线课程实践平台
label_welcome_trustie_contest: 在线竞赛实战平台
label_welcome_trustie_project_description: 面向中国大学生与软件从业者,提供社交化的项目管理、代码托管、资源共享、合作交流。
label_welcome_trustie_course_description: 面向中国高校教师与大学生,提供社交化的课程管理、资源共享、合作实验、协同研究。
label_welcome_trustie_contest_description: 面向中国大学生与编程爱好者,提供社交化的竞赛管理、应用管理、代码托管、合作交流。
label_user_project: 项目
label_user_course: 课程
label_user_homework: 作业

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

View File

@ -893,3 +893,22 @@ $(function(){
})
});
//firefox的pre标签换行
$(document).ready(function () {
var userAgent = navigator.userAgent.toLowerCase();
var browser = {
version: (userAgent.match(/.+(?:rv|it|ra|ie)[/: ]([d.]+)/) || [])[1],
safari: /webkit/.test(userAgent),
opera: /opera/.test(userAgent),
msie: /msie/.test(userAgent) && !/opera/.test(userAgent),
mozilla: /mozilla/.test(userAgent) && !/(compatible|webkit)/.test(userAgent)
};
if (browser.mozilla || browser.opera){
$("pre").addClass("break_word_firefox");
}
else{
$("pre").addClass("break_word");
}
});

View File

@ -407,8 +407,23 @@ $(function(){
});
//将右侧的最小高度设置成左侧高度,美化界面
// firefox pre标签换行
$(document).ready(function () {
$("#RSide").css("min-height",$("#LSide").height()-30);
var userAgent = navigator.userAgent.toLowerCase();
var browser = {
version: (userAgent.match(/.+(?:rv|it|ra|ie)[/: ]([d.]+)/) || [])[1],
safari: /webkit/.test(userAgent),
opera: /opera/.test(userAgent),
msie: /msie/.test(userAgent) && !/opera/.test(userAgent),
mozilla: /mozilla/.test(userAgent) && !/(compatible|webkit)/.test(userAgent)
};
if (browser.mozilla || browser.opera){
$("pre").addClass("break_word_firefox");
}
else{
$("pre").addClass("break_word");
}
});
// 日历选择日期后关闭

View File

@ -3150,6 +3150,11 @@ input[class~='m3p10'], .m3p10 {
cursor:pointer;
}
/*pre标签换行*/
.break_word{word-break: break-all;word-wrap: break-word;}
.break_word_firefox{white-space: pre-wrap;word-break: break-all;}
/*lizanle 日誌搜索結果樣式*/
.search_results {
color: red;

View File

@ -166,6 +166,27 @@ a:hover.tijiao{ background:#0f99a9 !important;}
.upload_box_span{ color: #333; font-weight: bold;}
.c_grey{ color:#A7A7A7;}
/*新增*/
.min_search {
width: 150px;
height: 15px;
border: 1px solid #d0d0d0 !important;
color: #666;
/*background: url(../images/course/public_icon.png) 135px -193px no-repeat;*/
/*cursor: pointer;*/
}
a.member_search {
width: 43px;
height: 22px;
background: #15bccf;
color: #fff;
text-align: center;
padding: 4px 6px;
text-decoration: none;
}
/*上传图片处理*/
.upload_img img{max-width: 100%;}

View File

@ -212,6 +212,7 @@ a:hover.close_btn {background-position:-66px 0;}
.show_btn {background-position:-119px 0;}
.msgserver a:hover { color: #0fa9bb; }
.break_word{word-break: break-all;word-wrap: break-word;}
.break_word_firefox{white-space: pre-wrap;word-break: break-all;}
/***** Ajax indicator ******/
#ajax-indicator {
position: absolute; /* fixed not supported by IE */