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

This commit is contained in:
lizanle 2015-08-29 12:32:08 +08:00
commit acbf58837a
15 changed files with 68 additions and 41 deletions

View File

@ -352,7 +352,7 @@ class UsersController < ApplicationController
homework = HomeworkCommon.new
homework.name = params[:homework_common][:name]
homework.description = params[:homework_common][:description]
homework.end_time = params[:homework_common][:end_time]
homework.end_time = params[:homework_common][:end_time] || Time.now
homework.publish_time = Time.now
homework.homework_type = 1
homework.late_penalty = 2

View File

@ -37,7 +37,17 @@ module PollHelper
pv.vote_text
end
end
#判断用户是否已经提交了问卷
def has_commit_poll?(poll_id,user_id)
pu = PollUser.find_by_poll_id_and_user_id(poll_id,user_id)
if pu.nil?
false
else
true
end
end
#统计答题百分比,统计结果保留两位小数
def statistics_result_percentage(e, t)
e = e.to_f

View File

@ -50,7 +50,7 @@
</li>
<li class=" ml90" >
<a href="javascript:void(0)" class="blue_btn fl c_white" onclick="submit_new_course();" >提交</a>
<a href="http://<%= Setting.host_course%>" target="_blank" class="blue_btn grey_btn fl c_white">取消</a>
<%= link_to "取消",user_activities_path(User.current.id),:class => "blue_btn grey_btn fl c_white"%>
<div class="cl"></div>
</li>
<% end%>

View File

@ -19,7 +19,7 @@
</div>
<script>
<% type = type%>
$(document).ready(function (){
$(function (){
if('<%= type %>' != null && '<%= type %>' == 'courses' ){
$('input:radio[value="courses"]').attr('checked','checked');
}
@ -30,13 +30,22 @@
$('input:radio[value="users"]').attr('checked','checked');
}
});
$(function(){
$("#navHomepageSearchInput").keypress(function(e){
if (e.keyCode == '13') {
$('#type').val($('input[type=radio]:checked').val());
$(this).parent().submit();
}
})
});
</script>
<div class="fl" id="navHomepageSearch">
<!--<form class="navHomepageSearchBox">-->
<% name = name%>
<%= form_tag({controller: :welcome, action: :search },:class=>'navHomepageSearchBox', method: :get) do %>
<input type="text" name="q" value="<%= name.nil? ? "" : name%>" class="navHomepageSearchInput" placeholder="请输入关键词进行搜索" />
<input type="text" name="q" value="<%= name.nil? ? "" : name%>" id="navHomepageSearchInput" class="navHomepageSearchInput" placeholder="请输入关键词进行搜索"/>
<input type="hidden" name="search_type" id="type" value=""/>
<a href="javascript:void(0);" class="homepageSearchIcon" onclick="$('#type').val($('input[type=radio]:checked').val());$(this).parent().submit();"></a>
<% end %>

View File

@ -19,7 +19,7 @@
$(doc).parent().submit();
}
<% type = type%>
$(document).ready(function (){
$(function (){
if('<%= type %>' != null && '<%= type %>' == 'courses' ){
$('input:radio[value="courses"]').attr('checked','checked');
}
@ -30,13 +30,22 @@
$('input:radio[value="users"]').attr('checked','checked');
}
});
$(function(){
$("#navHomepageSearchInput").keypress(function(e){
if (e.keyCode == '13') {
$('#type').val($('input[type=radio]:checked').val());
$(this).parent().submit();
}
})
});
</script>
<div class="fl" id="navHomepageSearch">
<!--<form class="navHomepageSearchBox">-->
<% name = name%>
<%= form_tag({controller: :welcome, action: :search },:class=>'navHomepageSearchBox', method: :get) do %>
<input type="text" name="q" value="<%= name.nil? ? "" : name%>" class="navHomepageSearchInput" placeholder="请输入关键词进行搜索" />
<input type="text" name="q" value="<%= name.nil? ? "" : name%>" id="navHomepageSearchInput" class="navHomepageSearchInput" placeholder="请输入关键词进行搜索" />
<input type="hidden" name="search_type" id="type" value=""/>
<a href="javascript:void(0);" class="homepageSearchIcon" onclick="$('#type').val($('input[type=radio]:checked').val());$(this).parent().submit();"></a>
<% end %>

View File

@ -98,7 +98,7 @@
<%= link_to "动态",user_activities_path(@user.id),:class => "homepageMenuText"%>
</div>
<div class="homepageLeftMenuBlock">
<a href="javascript:void(0);" class="homepageMenuText">课程</a>
<a href="javascript:void(0);" class="homepageMenuText" onclick="$('#homepageLeftMenuCourses').slideToggle();">课程</a>
<% if is_current_user%>
<% if User.current.user_extensions && User.current.user_extensions.identity == 0 && User.current.allowed_to?(:add_course, nil, :global => true)%>
<%=link_to image_tag("../images/menu_setting.png",width:"14px", height: "14px",class: "homepageMenuSetting"), new_course_path%>
@ -107,20 +107,20 @@
<% end%>
<% end%>
</div>
<div class="homepageLeftMenuCourses">
<div class="homepageLeftMenuCourses" id="homepageLeftMenuCourses">
<ul>
<% courses = @user.courses.visible.select("courses.*,(SELECT MAX(created_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").limit(5)%>
<%= render :partial => 'layouts/user_courses', :locals => {:courses => courses,:user => @user, :page => 0} %>
</ul>
</div>
<div class="homepageLeftMenuBlock">
<a href="javascript:void(0);" class="homepageMenuText">项目</a>
<a href="javascript:void(0);" class="homepageMenuText" onclick="$('#homepageLeftMenuForge').slideToggle();">项目</a>
<% if is_current_user%>
<%=link_to image_tag("../images/menu_setting.png",width:"14px", height: "14px",class: "homepageMenuSetting"), new_project_path%>
<% end%>
</div>
<div class="homepageLeftMenuCourses">
<div class="homepageLeftMenuCourses" id="homepageLeftMenuForge">
<ul>
<% projects = @user.projects.visible.select("projects.*,(SELECT MAX(created_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS a").order("a desc").limit(5)%>
<%= render :partial => 'layouts/user_projects', :locals => {:projects => projects,:user => @user, :page => 0} %>
@ -162,10 +162,10 @@
<div class="pro_new">
<h3 class="box_h3 mb10">头像设置</h3>
<div class="uppicBox">
<input type="button" class="uppic_btn" onclick="$('#upload_user_image').click();" value="浏览.."/>
<%= file_field_tag 'avatar[image]',
:id => nil,
:class => 'uppic_btn',
:style => 'width:70px;',#added by young
:id => "upload_user_image",
:style => 'display:none;',#added by young
:size => "1",
:multiple => false,
:onchange => 'addInputAvatar(this);',

View File

@ -4,10 +4,10 @@
</div>
<div >
<form class="coursesSearchBox">
<input type="text" name="homework_name" placeholder="输入作业名称进行搜索" class="searchCoursesPopup" id="search_homework_name"/>
<a href="javascript:void(0);" class="searchIconPopup" onclick="search_homework_by_name('<%= user_search_homeworks_user_path(User.current.id)%>');"></a>
</form>
<%= form_tag user_search_homeworks_user_path(User.current.id), :multipart => true, :remote => true, :class => "coursesSearchBox" do%>
<input type="text" name="name" placeholder="输入作业名称进行搜索" class="searchCoursesPopup" id="search_homework_name"/>
<a href="javascript:void(0);" class="searchIconPopup" onclick="$(this).parent().submit();"></a>
<% end%>
</div>
<%= form_tag(user_select_homework_users_path, :multipart => true,:remote => true,:name=>"select_homework_form",:id=>'select_homework_form') do %>
<div class="homeworkListForm mb10 " id="homework_list_form_show">

View File

@ -11,7 +11,7 @@
TO
<%= link_to homework_common.course.name, course_path(homework_common.course_id), :class => "newsBlue ml15"%>
</div>
<div class="homepagePostTitle">
<div class="homepagePostTitle hidden">
<%= link_to homework_common.name,student_work_index_path(:homework => homework_common.id),:class => "postGrey"%>
</div>

View File

@ -6,23 +6,23 @@
<ul class="newsType">
<li><%= link_to "全部",user_message_path(User.current), :class => "resourcesGrey" %></li>
<%# 课程相关消息 %>
<li><%= link_to "作业消息", user_message_path(User.current, :type => 'course_message'), :class => "homework" %></li>
<li><%= link_to "课程讨论",user_message_path(User.current, :type => 'course_message'), :class => "resourcesGrey" %></li>
<li><%= link_to "作业消息", user_message_path(User.current, :type => 'homework'), :class => "resourcesGrey" %></li>
<li><%= link_to "课程讨论",user_message_path(User.current, :type => 'course_message'), :class => "resourcesGrey" %></li>
<li><%= link_to "课程通知",user_message_path(User.current, :type => 'course_news'), :class => "resourcesGrey" %></li>
<li><%= link_to "通知回复", user_message_path(User.current, :type => 'course_news_reply'), :class => "resourcesGrey" %></li>
<li><%= link_to "课程问卷", user_message_path(User.current, :type => 'poll'), :class => "resourcesGrey" %></a></li>
<li><%= link_to "作品评阅", user_message_path(User.current, :type => 'works_reviewers'), :class => "resourcesGrey" %></li>
<li><%= link_to "作品讨论", user_message_path(User.current, :type => 'works_reply'), :class => "resourcesGrey" %></li>
<!--<li><%#= link_to "通知回复", user_message_path(User.current, :type => 'course_news_reply'), :class => "resourcesGrey" %></li>-->
<!--<li><%#= link_to "课程问卷", user_message_path(User.current, :type => 'poll'), :class => "resourcesGrey" %></a></li>-->
<!--<li><%#= link_to "作品评阅", user_message_path(User.current, :type => 'works_reviewers'), :class => "resourcesGrey" %></li>-->
<!--<li><%#= link_to "作品讨论", user_message_path(User.current, :type => 'works_reply'), :class => "resourcesGrey" %></li>-->
<%# 项目相关消息 %>
<li><%= link_to "指派问题", user_message_path(User.current, :type => 'issue'), :class => "resourcesGrey" %></li>
<li><%= link_to "问题更新", user_message_path(User.current, :type => 'issue_update'), :class => "resourcesGrey" %></li>
<li><%= link_to "项目讨论区", user_message_path(User.current, :type => 'forge_message'), :class => "resourcesGrey" %></li>
<li><%= link_to "项目新闻", user_message_path(User.current, :type => 'forge_news'), :class => "resourcesGrey" %></li>
<li><%= link_to "新闻回复", user_message_path(User.current, :type => 'forge_news_reply'), :class => "resourcesGrey" %></li>
<li><%= link_to "项目任务", user_message_path(User.current, :type => 'issue'), :class => "resourcesGrey" %></li>
<!--<li><%#= link_to "问题更新", user_message_path(User.current, :type => 'issue_update'), :class => "resourcesGrey" %></li>-->
<!--<li><%#= link_to "项目讨论区", user_message_path(User.current, :type => 'forge_message'), :class => "resourcesGrey" %></li>-->
<!--<li><%#= link_to "项目新闻", user_message_path(User.current, :type => 'forge_news'), :class => "resourcesGrey" %></li>-->
<!--<li><%#= link_to "新闻回复", user_message_path(User.current, :type => 'forge_news_reply'), :class => "resourcesGrey" %></li>-->
<%# 项目相关消息 %>
<li><%= link_to "贴吧帖子", user_message_path(User.current, :type => 'forum'), :class => "resourcesGrey" %></li>
<!--<li><%#= link_to "贴吧帖子", user_message_path(User.current, :type => 'forum'), :class => "resourcesGrey" %></li>-->
<%# 系统贴吧 %>
<li><%= link_to "用户留言",user_message_path(User.current, :type => 'user_feedback'), :class => "resourcesGrey" %></li>
<!--<li><%#= link_to "用户留言",user_message_path(User.current, :type => 'user_feedback'), :class => "resourcesGrey" %></li>-->
</ul>
</li>

View File

@ -42,7 +42,7 @@ RedmineApp::Application.routes.draw do
end
resources :school do
resources :school, :except => [:show] do
collection do
end
@ -328,7 +328,7 @@ RedmineApp::Application.routes.draw do
match 'user_visitorlist', :to => 'users#user_visitorlist', :via => :get
match 'user_homeworks', :to => 'users#user_homeworks', :via => :get
get 'user_import_homeworks'
get 'user_search_homeworks'
post 'user_search_homeworks'
get 'user_import_resource'
match 'watch_projects', :to => 'users#watch_projects', :via => :get
#

View File

@ -32,6 +32,6 @@ class AboutUserActivities < ActiveRecord::Migration
end
def down
UserActivity.destroy_all
end
end

View File

@ -1,7 +1,7 @@
/* CSS Document */
/* 2015-06-26 */
body,h1,h2,h3,h4,h5,h6,hr,p,blockquote,dl,dt,dd,ul,ol,li,pre,form,fieldset,legend,button,input,textarea,th,td{ margin:0; padding:0;}
body,table,input,textarea,select,button { font-family: "微软雅黑","宋体"; font-size:12px;line-height:1.5;}
.navContainer h1,h2,h3,h4,h5,h6,hr,blockquote,dl,dt,dd,ul,ol,li,pre,form,fieldset,legend,button,input,textarea,th,td{ margin:0; padding:0;}
.navContainer body,table,input,textarea,select,button { font-family: "微软雅黑","宋体"; font-size:12px;line-height:1.5;}
div,img,tr,td,table{ border:0;}
table,tr,td{border:0;cellspacing:0; cellpadding:0;}
ol,ul,li{ list-style-type:none}

View File

@ -97,9 +97,9 @@ a.topnav_login_box:hover {color:#a1ebff;}
/*底部*/
#Footer{background-color:#ffffff; padding-bottom:15px; color:#666666;} /*margin-bottom:10px;*/
.footerAboutContainer {width:auto; border-bottom:1px solid #efefef;}
.footerAbout{ width:455px; margin:0 auto;height:35px; line-height:35px;}
.footerAbout{ width:485px; margin:0 auto;height:35px; line-height:35px;}
.languageBox {width:55px; height:20px; margin-left:5px; outline:none; color:#666666; border:1px solid #d9d9d9;}
.departments{ width:890px; margin:5px auto 0 auto;height:30px;line-height:30px;}
.departments{ width:950px; margin:5px auto 0 auto;height:30px;line-height:30px;}
.copyright{ width:375px; margin:0 auto;height:20px;line-height:20px;}
a.f_grey {color:#666666 !important;}
a.f_grey:hover {color:#000000 !important;}

View File

@ -865,7 +865,7 @@ a.box_close{background:url(../images/img_floatbox.png) -22px 0 no-repeat;}
.uppicBox{ width:265px; height:265px; background:#f2f2f5; float:left; color:#666; text-align:center;}
.showpicBox{width:133px; height:250px; background:#f2f2f5; float:left; margin-left:20px; text-align:center; padding-top:15px; color:#666;}
.mr15{ margin-right:15px;}
.uppic_btn{border:none; width:150px; background:none; margin-bottom:5px; color:#666; margin-top:105px;}
.uppic_btn{background: #64bdd9;color: #fff;width: 80px;height: 25px;margin-top: 105px;}
/*20150820课程作业 LB*/
.HomeWork {width:708px; background-color:#ffffff; padding:10px 20px 20px 20px; border:1px solid #dddddd;}

View File

@ -116,7 +116,6 @@ a:hover.c_lgrey{ color:#3ca5c6;}
.uppicBox{ width:265px; height:265px; background:#f2f2f5; float:left; color:#666; text-align:center;}
.showpicBox{width:133px; height:250px; background:#f2f2f5; float:left; margin-left:20px; text-align:center; padding-top:15px; color:#666;}
.mr15{ margin-right:15px;}
.uppic_btn{border:none; width:150px; background:none; margin-bottom:5px; color:#666; margin-top:105px;}
/* 新建作品*/
.mr8{ margin-right:8px;}
.mt2{ margin-top:2px;}