Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh
This commit is contained in:
commit
7ae9556404
|
@ -500,7 +500,8 @@ class CoursesController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
def course
|
||||
def
|
||||
course
|
||||
@school_id = params[:school_id]
|
||||
per_page_option = 10
|
||||
if @school_id == "0" or @school_id.nil?
|
||||
|
|
|
@ -20,7 +20,7 @@ module CoursesHelper
|
|||
|
||||
# 返回教师数量,即roles表中定义的Manager
|
||||
def teacherCount project
|
||||
searchTeacherAndAssistant(project).count
|
||||
project.members.count - studentCount(project).to_i
|
||||
# or
|
||||
# searchTeacherAndAssistant(project).count
|
||||
end
|
||||
|
@ -114,7 +114,7 @@ module CoursesHelper
|
|||
# 学生人数计算
|
||||
# add by nwb
|
||||
def studentCount course
|
||||
searchStudent(course).count.to_s#course.student.count
|
||||
course.student.count.to_s#course.student.count
|
||||
end
|
||||
|
||||
#课程成员数计算
|
||||
|
|
|
@ -38,7 +38,7 @@ class Course < ActiveRecord::Base
|
|||
|
||||
validates_presence_of :password, :term,:name
|
||||
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\s\S]+$/
|
||||
validates_length_of :description, :maximum => 10000
|
||||
before_save :self_validate
|
||||
after_create :create_board_sync
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
<script type="text/javascript">
|
||||
jQuery(document).ready(function () {
|
||||
var $group_name = $('#group_name')
|
||||
$group_name.blur(function (event) {
|
||||
if ($(this).is('#group_name')) {
|
||||
function check_groupname() {
|
||||
var $group_name = $('#group_name');
|
||||
|
||||
$.get(
|
||||
'<%=valid_ajax_course_path%>',
|
||||
{ valid: "name",
|
||||
|
@ -14,8 +13,7 @@
|
|||
});
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
<script type=" text/javascript" charset="utf-8">
|
||||
function validate_groupname(value1) {
|
||||
|
@ -49,6 +47,7 @@
|
|||
}
|
||||
function validate_add_group() {
|
||||
value1 = document.getElementById('group_name').value;
|
||||
check_groupname();
|
||||
validate_groupname(value1);
|
||||
validate_groupname_null(value1);
|
||||
|
||||
|
|
|
@ -41,11 +41,14 @@
|
|||
</td>
|
||||
<td rowspan="2" width="250px">
|
||||
<div class="project-search">
|
||||
<%= form_tag(:controller => 'bids', :action => 'contest', :method => :get) do %>
|
||||
<%= form_tag({:controller => 'bids', :action => 'contest'}, :id => "contest_search_form",:method => :get) do %>
|
||||
<%= text_field_tag 'name', params[:name], :size => 20 %>
|
||||
<%= hidden_field_tag 'reward_type', @bid.reward_type %>
|
||||
<%= hidden_field_tag 'project_type', params[:project_type] %>
|
||||
<%= submit_tag l(:label_search), :class => "enterprise", :name => nil %>
|
||||
<a href="#" onclick="$('#contest_search_form').submit();" class="ButtonColor m3p10" style="float:left;padding-top: 3px; margin: 0px;padding-bottom:0px;" >
|
||||
<%= l(:label_search)%>
|
||||
</a>
|
||||
<%#= submit_tag l(:label_search), :class => "enterprise", :name => nil %>
|
||||
<% end %>
|
||||
</div>
|
||||
</td>
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
@nav_dispaly_forum_label = 1
|
||||
@nav_dispaly_course_label = nil
|
||||
@nav_dispaly_store_all_label = 1 %>
|
||||
<% teacher_num = teacherCount(@course) %>
|
||||
<% student_num = studentCount(@course) %>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
|
@ -46,9 +48,13 @@
|
|||
</td>
|
||||
<td rowspan="2" width="250px">
|
||||
<div class="top-content-search">
|
||||
<%= form_tag(:controller => 'courses', :action => 'search', :method => :get) do %>
|
||||
<%= text_field_tag 'name', params[:name], :size => 20 %>
|
||||
<%= submit_tag l(:label_search), :class => "enterprise", :name => nil %>
|
||||
|
||||
<%= form_tag({:controller => 'courses', :action => 'search'},:id => "course_search_form", :method => :get) do %>
|
||||
<%= text_field_tag 'name', params[:name], :size => 20, :style => "float:left" %>
|
||||
<a href="#" onclick="$('#course_search_form').submit();" class="ButtonColor m3p10" style="float:left;padding-top: 3px; margin: 0px;padding-bottom:0px;" >
|
||||
<%= l(:label_search)%>
|
||||
</a>
|
||||
<%#= submit_tag l(:label_search), :class => "ButtonColor m3p10", :name => nil, :style => "float:left;padding-top: 3px; margin: 0px;padding-bottom:0px;" %>
|
||||
<% end %>
|
||||
</div>
|
||||
</td>
|
||||
|
@ -120,19 +126,19 @@
|
|||
<td class="font_index">
|
||||
<!-- 1 教师; 2 学生;0 全部-->
|
||||
<% if User.current.member_of_course?(@course) %>
|
||||
<%= link_to "#{teacherCount(@course)}", course_member_path(@course, :role => 1), :course => '1' %>
|
||||
<%= link_to "#{teacher_num}", course_member_path(@course, :role => 1), :course => '1' %>
|
||||
<% else %>
|
||||
<span>
|
||||
<%= teacherCount(@course)%>
|
||||
<%= teacher_num %>
|
||||
</span>
|
||||
<% end%>
|
||||
</td>
|
||||
<td class="font_index">
|
||||
<% if (User.current.logged? && @course.open_student == 1) || (User.current.member_of_course?(@course)) %>
|
||||
<%= link_to "#{studentCount(@course)}", course_member_path(@course, :role => 2), :course => '1' %>
|
||||
<%= link_to "#{student_num}", course_member_path(@course, :role => 2), :course => '1' %>
|
||||
<% else %>
|
||||
<span>
|
||||
<%= studentCount(@course)%>
|
||||
<%= student_num %>
|
||||
</span>
|
||||
<% end %>
|
||||
</td>
|
||||
|
@ -141,10 +147,10 @@
|
|||
</td>
|
||||
<tr class="font_aram">
|
||||
<td align="center" width="80px" id="teacherCount">
|
||||
<%= l(:label_x_base_courses_teacher, :count => teacherCount(@course)) %>
|
||||
<%= l(:label_x_base_courses_teacher, :count => teacher_num) %>
|
||||
</td>
|
||||
<td align="center" width="80px" id="studentCount">
|
||||
<%= l(:label_x_base_courses_student, :count => studentCount(@course)) %>
|
||||
<%= l(:label_x_base_courses_student, :count => student_num) %>
|
||||
</td>
|
||||
<td align="center" width="80px">
|
||||
<%= l(:label_x_course_data, :count => files_count) %>
|
||||
|
|
|
@ -61,12 +61,12 @@
|
|||
if(regexName1()){$("#contst_search_form").submit();}
|
||||
}
|
||||
</script>
|
||||
<div class="project-search">
|
||||
<div class="project-search" style="float: left; margin: 0px">
|
||||
<%= form_tag({controller: 'contests', action: 'index'}, method: :get, :id => "contst_search_form") do %>
|
||||
<%= text_field_tag 'name', params[:name], :size => 20, :onkeyup => 'regexName1();', :width => "125px" %>
|
||||
<%= text_field_tag 'name', params[:name], :size => 20, :onkeyup => 'regexName1();', :width => "125px", :style=>"float:left" %>
|
||||
<%= hidden_field_tag 'project_type', params[:project_type] %>
|
||||
<%#= submit_tag l(:label_search), :class => "enterprise", :name => nil %>
|
||||
<a href="#" onclick="submitSerch();" class="ButtonColor m3p10" style="padding-top: 7px !important;">
|
||||
<a href="#" onclick="submitSerch();" class="ButtonColor m3p10" style="float:left;padding-top: 3px; margin: 0px;padding-bottom:0px;" >
|
||||
<%= l(:label_search)%>
|
||||
</a>
|
||||
<br />
|
||||
|
@ -78,8 +78,8 @@
|
|||
<tr>
|
||||
<td>
|
||||
<%=link_to l(:field_homepage), home_path %> >
|
||||
<a>
|
||||
<%=link_to l(:label_contest_innovate), home_path %>
|
||||
<a href="http://<%= Setting.host_contest %>" class="link_other_item">
|
||||
<%=l(:label_courses_management_platform)%>
|
||||
</a> >
|
||||
<span title="<%= @contest.name%>">
|
||||
<%= link_to h(truncate(@contest.name, length: 20, omission: '...')), show_contest_contest_path(@contest) %>
|
||||
|
|
|
@ -64,10 +64,10 @@
|
|||
}
|
||||
</script>
|
||||
<%= form_tag(projects_search_path, :method => :get, :id => "project_search_form") do %>
|
||||
<%= text_field_tag 'name', params[:name], :size => 20, :onkeyup => "regexName();" %>
|
||||
<%= text_field_tag 'name', params[:name], :size => 20, :onkeyup => "regexName();", :style => "float:left" %>
|
||||
<%= hidden_field_tag 'project_type', params[:project_type] %>
|
||||
<%#= submit_tag l(:label_search), :class => "enterprise", :name => nil %>
|
||||
<a href="#" onclick="submitSerch();" class="ButtonColor m3p10" >
|
||||
<a href="#" onclick="submitSerch();" class="ButtonColor m3p10" style="float:left;padding-top: 3px; margin: 0px;padding-bottom:0px;" >
|
||||
<%= l(:label_search)%>
|
||||
</a>
|
||||
<br />
|
||||
|
|
|
@ -221,16 +221,16 @@
|
|||
<div class="inf_user_context">
|
||||
<table style="font-family:'微软雅黑'" width="240">
|
||||
<tr>
|
||||
<td style="padding-left: 5px" width="70px">
|
||||
<%= l(:label_user_joinin) %>:
|
||||
<td style=" float: right" width="70px">
|
||||
<span style="float: right"> <%= l(:label_user_joinin) %>:</span>
|
||||
</td>
|
||||
<td class="font_lighter_sidebar" style="padding-left: 0px" width="170px">
|
||||
<%= format_time(@user.created_on) %>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding-left: 5px">
|
||||
<%= l(:label_user_login) %>:
|
||||
<td style=" float: right" width="70px">
|
||||
<span style="float: right"> <%= l(:label_user_login) %>:</span>
|
||||
</td>
|
||||
<td class="font_lighter_sidebar" style="padding-left: 0px">
|
||||
<%= format_time(@user.last_login_on) %>
|
||||
|
@ -239,8 +239,8 @@
|
|||
<% unless @user.user_extensions.nil? %>
|
||||
<% if @user.user_extensions.identity == 0 || @user.user_extensions.identity == 1 %>
|
||||
<tr>
|
||||
<td style="padding-left: 5px" width="70px">
|
||||
<%= l(:field_occupation) %>:
|
||||
<td style=" float: right" width="70px">
|
||||
<span style="float: right"><%= l(:field_occupation) %>:</span>
|
||||
</td>
|
||||
<td class="font_lighter_sidebar" style="padding-left: 0px" width="170px">
|
||||
<% unless @user.user_extensions.school.nil? %>
|
||||
|
@ -250,8 +250,8 @@
|
|||
</tr>
|
||||
<% elsif @user.user_extensions.identity == 3 %>
|
||||
<tr>
|
||||
<td style="padding-left: 5px" width="70px">
|
||||
<%= l(:field_occupation) %>:
|
||||
<td style=" float: right" width="70px">
|
||||
<span style="float: right"> <%= l(:field_occupation) %>:</span>
|
||||
</td>
|
||||
<td class="font_lighter_sidebar" style="padding-left: 0px" width="170px">
|
||||
<%= @user.user_extensions.occupation %>
|
||||
|
@ -259,8 +259,8 @@
|
|||
</tr>
|
||||
<% elsif @user.user_extensions.identity == 2 %>
|
||||
<tr>
|
||||
<td style="padding-left: 18px" width="70px">
|
||||
<%= l(:label_company_name) %>:
|
||||
<td style=" float: right" width="70px">
|
||||
<span style="float: right"> <%= l(:label_company_name) %>:</span>
|
||||
</td>
|
||||
<td class="font_lighter_sidebar" style="padding-left: 0px" width="170px">
|
||||
<%= @user.firstname %>
|
||||
|
@ -268,8 +268,8 @@
|
|||
</tr>
|
||||
<% end %>
|
||||
<tr>
|
||||
<td style="padding-left: 31px" width="76px">
|
||||
<%= l(:label_location) %>:
|
||||
<td style=" float: right" width="70px">
|
||||
<span style="float: right"> <%= l(:label_location) %>:</span>
|
||||
</td>
|
||||
<td class="font_lighter_sidebar" style="padding-left: 0px" width="170px">
|
||||
<%= @user.user_extensions.location %>
|
||||
|
@ -278,8 +278,8 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<% if @user.user_extensions.identity == 0 %>
|
||||
<td style="padding-left: 31px" width="76px" >
|
||||
<%= l(:label_technical_title) %>:
|
||||
<td style=" float: right" width="70px" >
|
||||
<span style="float: right"> <%= l(:label_technical_title) %>:</span>
|
||||
</td>
|
||||
<td class="font_lighter_sidebar" style="padding-left: 0px" width="170px">
|
||||
<span id = "td_tech_title"></span>
|
||||
|
@ -289,8 +289,8 @@
|
|||
<% if @user.user_extensions.identity == 1 %>
|
||||
<% if(is_watching?(@user) ) %>
|
||||
<tr>
|
||||
<td style="padding-left: 31px" width="70px" >
|
||||
<%= l(:label_bidding_user_studentcode)%>:
|
||||
<td style=" float: right" width="70px" >
|
||||
<span style="float: right"> <%= l(:label_bidding_user_studentcode)%>:</span>
|
||||
</td>
|
||||
<td class="font_lighter_sidebar" style="padding-left: 0px" width="170px">
|
||||
<%= @user.user_extensions.student_id %>
|
||||
|
@ -298,7 +298,7 @@
|
|||
</tr>
|
||||
<% else %>
|
||||
<tr>
|
||||
<td style="padding-left: 31px" width="70px" >
|
||||
<td style=" float: right" width="70px" >
|
||||
<%= l(:label_identity)%>:
|
||||
</td>
|
||||
<td class="font_lighter_sidebar" style="padding-left: 0px" width="170px">
|
||||
|
@ -309,7 +309,7 @@
|
|||
<% end %>
|
||||
<% elsif @user.user_extensions.identity == 3 %>
|
||||
<tr>
|
||||
<td style="padding-left: 31px" width="70px" >
|
||||
<td style=" float: right" width="70px" >
|
||||
<%= l(:label_identity)%>:
|
||||
</td>
|
||||
<td class="font_lighter_sidebar" style="padding-left: 0px" width="170px">
|
||||
|
|
|
@ -77,10 +77,10 @@
|
|||
<%= f.text_field :object_id,:value=> obj.id,:style=>"display:none"%>
|
||||
<%= f.text_field :object_flag,:value=> object_flag,:style=>"display:none"%>
|
||||
<!--<%#= f.submit l(:button_project_tags_add),:class => "ButtonColor m3p10" %>-->
|
||||
<a href="#" onclick='$("#tags_name").parent().submit();' class="ButtonColor m3p10" >
|
||||
<a href="#" onclick='$("#tags_name").parent().submit();' class="ButtonColor m3p10" style="padding: 3px 6px">
|
||||
<%= l(:button_project_tags_add)%>
|
||||
</a>
|
||||
<%= link_to_function l(:button_cancel), '$("#put-tag-form").slideUp();',:class=>'ButtonColor m3p10'%>
|
||||
<%= link_to_function l(:button_cancel), '$("#put-tag-form").slideUp();',:class=>'ButtonColor m3p10' ,:style=>"padding:3px 6px"%>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
|
|
@ -2912,7 +2912,7 @@ input[class~='ButtonClolr'],.ButtonColor{
|
|||
|
||||
input[class~='m3p10'], .m3p10 {
|
||||
margin-top: 5px;
|
||||
padding: 5px 10px !important;
|
||||
padding: 5px 10px;
|
||||
height: 20px;
|
||||
display: inline-block;
|
||||
color: #ffffff;
|
||||
|
|
Loading…
Reference in New Issue