Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh
commit
42b3fd9584
File diff suppressed because it is too large
Load Diff
@ -1,46 +1,46 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="<%= current_language %>">
|
<html lang="<%= current_language %>">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<title><%=h html_title %></title>
|
<title><%=h html_title %></title>
|
||||||
<meta name="description" content="<%= Redmine::Info.app_name %>" />
|
<meta name="description" content="<%= Redmine::Info.app_name %>" />
|
||||||
<meta name="keywords" content="issue,bug,tracker" />
|
<meta name="keywords" content="issue,bug,tracker" />
|
||||||
<%= csrf_meta_tag %>
|
<%= csrf_meta_tag %>
|
||||||
<%= favicon %>
|
<%= favicon %>
|
||||||
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', 'nyan', :media => 'all' %>
|
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', 'nyan', :media => 'all' %>
|
||||||
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
|
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
|
||||||
<%= javascript_heads %>
|
<%= javascript_heads %>
|
||||||
<%= javascript_include_tag "jquery.leanModal.min" %>
|
<%= javascript_include_tag "jquery.leanModal.min" %>
|
||||||
<%= javascript_include_tag 'seems_rateable/jRating', 'seems_rateable/rateable'%>
|
<%= javascript_include_tag 'seems_rateable/jRating', 'seems_rateable/rateable'%>
|
||||||
<%= heads_for_theme %>
|
<%= heads_for_theme %>
|
||||||
<%= call_hook :view_layouts_base_html_head %>
|
<%= call_hook :view_layouts_base_html_head %>
|
||||||
<!-- page specific tags -->
|
<!-- page specific tags -->
|
||||||
<%= yield :header_tags -%>
|
<%= yield :header_tags -%>
|
||||||
</head>
|
</head>
|
||||||
<body class="<%=h body_css_classes %>">
|
<body class="<%=h body_css_classes %>">
|
||||||
<div id="wrapper">
|
<div id="wrapper">
|
||||||
<div id="wrapper2">
|
<div id="wrapper2">
|
||||||
<div id="wrapper3">
|
<div id="wrapper3">
|
||||||
<%=render :partial => 'layouts/base_header'%>
|
<%=render :partial => 'layouts/base_header'%>
|
||||||
<%= render :partial => 'layouts/base_ad' %>
|
<%= render :partial => 'layouts/base_ad' %>
|
||||||
<div id="main" class="nosidebar">
|
<div id="main" class="nosidebar">
|
||||||
<div id="content_">
|
<div id="content_">
|
||||||
<%= render_flash_messages %>
|
<%= render_flash_messages %>
|
||||||
<%= yield %>
|
<%= yield %>
|
||||||
<%= call_hook :view_layouts_base_content %>
|
<%= call_hook :view_layouts_base_content %>
|
||||||
<div style="clear:both;"></div>
|
<div style="clear:both;"></div>
|
||||||
<%=render :partial => 'layouts/base_footer'%>
|
<%=render :partial => 'layouts/base_footer'%>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="ajax-indicator" style="display:none;"><span><%= l(:label_loading) %></span></div>
|
<div id="ajax-indicator" style="display:none;"><span><%= l(:label_loading) %></span></div>
|
||||||
<div id="ajax-modal" style="display:none;"></div>
|
<div id="ajax-modal" style="display:none;"></div>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<%= call_hook :view_layouts_base_body_bottom %>
|
<%= call_hook :view_layouts_base_body_bottom %>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -1,99 +1,99 @@
|
|||||||
<%
|
<%
|
||||||
select_option = []
|
select_option = []
|
||||||
(select_option << ['项目', 'projects']) if project_type == Project::ProjectType_project
|
(select_option << ['项目', 'projects']) if project_type == Project::ProjectType_project
|
||||||
(select_option << ['课程', 'courses']) if project_type == Project::ProjectType_course
|
(select_option << ['课程', 'courses']) if project_type == Project::ProjectType_course
|
||||||
select_option << ['用户', 'users']
|
select_option << ['用户', 'users']
|
||||||
%>
|
%>
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
form #q, form #search_type{
|
form #q, form #search_type{
|
||||||
-webkit-box-sizing: border-box;
|
-webkit-box-sizing: border-box;
|
||||||
-moz-box-sizing: border-box;
|
-moz-box-sizing: border-box;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
margin: 0px;
|
margin: 0px;
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
height: 33px;
|
height: 33px;
|
||||||
}
|
}
|
||||||
form #q{
|
form #q{
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
border-top-left-radius: 5px;
|
border-top-left-radius: 5px;
|
||||||
border-bottom-left-radius: 5px;
|
border-bottom-left-radius: 5px;
|
||||||
border-right: none;
|
border-right: none;
|
||||||
|
|
||||||
}
|
}
|
||||||
form #search_type{
|
form #search_type{
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
color: #363739;
|
color: #363739;
|
||||||
border-top-right-radius: 5px;
|
border-top-right-radius: 5px;
|
||||||
border-bottom-right-radius: 5px;
|
border-bottom-right-radius: 5px;
|
||||||
border-bottom-left-radius: 0px;
|
border-bottom-left-radius: 0px;
|
||||||
border-top-left-radius: 0px;
|
border-top-left-radius: 0px;
|
||||||
border-left: 1px outset #83A9A9;
|
border-left: 1px outset #83A9A9;
|
||||||
margin-left: -4px;
|
margin-left: -4px;
|
||||||
-webkit-appearance: none;
|
-webkit-appearance: none;
|
||||||
-moz-appearance: none;
|
-moz-appearance: none;
|
||||||
text-indent: 0.01px;
|
text-indent: 0.01px;
|
||||||
text-overflow: '';
|
text-overflow: '';
|
||||||
}
|
}
|
||||||
|
|
||||||
form #search_by
|
form #search_by
|
||||||
{
|
{
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
color: #363739;
|
color: #363739;
|
||||||
border-top-right-radius: 5px;
|
border-top-right-radius: 5px;
|
||||||
border-bottom-right-radius: 5px;
|
border-bottom-right-radius: 5px;
|
||||||
border-bottom-left-radius: 0px;
|
border-bottom-left-radius: 0px;
|
||||||
border-top-left-radius: 0px;
|
border-top-left-radius: 0px;
|
||||||
border-left: 1px outset #83A9A9;
|
border-left: 1px outset #83A9A9;
|
||||||
margin-left: -6px;
|
margin-left: -6px;
|
||||||
-webkit-appearance: none;
|
-webkit-appearance: none;
|
||||||
-moz-appearance: none;
|
-moz-appearance: none;
|
||||||
text-indent: 0.01px;
|
text-indent: 0.01px;
|
||||||
text-overflow: '';
|
text-overflow: '';
|
||||||
-moz-box-sizing: border-box;
|
-moz-box-sizing: border-box;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
height: 33px;
|
height: 33px;
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.search_widget{
|
.search_widget{
|
||||||
display:inline-block;
|
display:inline-block;
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
}
|
}
|
||||||
.search_widget:hover{
|
.search_widget:hover{
|
||||||
box-shadow: 0px 0px 3px #56B4EF;
|
box-shadow: 0px 0px 3px #56B4EF;
|
||||||
}
|
}
|
||||||
<%#完了把上面东西放到 .css 里%>
|
<%#完了把上面东西放到 .css 里%>
|
||||||
</style>
|
</style>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
function searchTypeChange()
|
function searchTypeChange()
|
||||||
{
|
{
|
||||||
if($("#search_type").val() == "users")
|
if($("#search_type").val() == "users")
|
||||||
{
|
{
|
||||||
$("#search_by").show();
|
$("#search_by").show();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$("#search_by").hide();
|
$("#search_by").hide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function searchByChange()
|
function searchByChange()
|
||||||
{
|
{
|
||||||
$("#search_by_input").val($("#search_by").val());
|
$("#search_by_input").val($("#search_by").val());
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<%= form_tag({controller: :welcome, action: :search }, method: :get) do %>
|
<%= form_tag({controller: :welcome, action: :search }, method: :get) do %>
|
||||||
<div class="project-search" style="float: right">
|
<div class="project-search" style="float: right">
|
||||||
<div class='search_widget'>
|
<div class='search_widget'>
|
||||||
<%= text_field_tag :q, nil, placeholder:'请输入要搜索的关键字', :size => 27 %>
|
<%= text_field_tag :q, nil, placeholder:'请输入要搜索的关键字', :size => 27 %>
|
||||||
<input type="text" name="search_by_input" hidden="hidden;" id="search_by_input" value="0">
|
<input type="text" name="search_by_input" hidden="hidden;" id="search_by_input" value="0">
|
||||||
<%= select_tag(:search_type, options_for_select(select_option), :onchange => "searchTypeChange();" ) %>
|
<%= select_tag(:search_type, options_for_select(select_option), :onchange => "searchTypeChange();" ) %>
|
||||||
<%= select_tag(:search_by,options_for_select([["昵称","0"],["姓名","1"],["邮箱","2"]]), :onchange => "searchByChange();" ) %>
|
<%= select_tag(:search_by,options_for_select([["昵称","0"],["姓名","1"],["邮箱","2"]]), :onchange => "searchByChange();" ) %>
|
||||||
</div>
|
</div>
|
||||||
<%#= hidden_field_tag 'project_type', project_type %>
|
<%#= hidden_field_tag 'project_type', project_type %>
|
||||||
<%= submit_tag l(:label_search), :class => "enterprise", :name => nil %>
|
<%= submit_tag l(:label_search), :class => "enterprise", :name => nil %>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
@ -0,0 +1,6 @@
|
|||||||
|
class AddColumnToHomeworkattaches < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :homework_attaches, :score, :float, default: 0
|
||||||
|
add_column :homework_attaches, :is_teacher_score, :integer, :default => 0
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,18 @@
|
|||||||
|
class UpdateScoreToHomeworkattaches < ActiveRecord::Migration
|
||||||
|
def up
|
||||||
|
sql = ("UPDATE homework_attaches set is_teacher_score = 1,
|
||||||
|
score = (SELECT AVG(seems_rateable_rates.stars) FROM seems_rateable_rates
|
||||||
|
WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id
|
||||||
|
AND is_teacher_score = 1 GROUP BY rateable_id);")
|
||||||
|
sql_student = ("UPDATE homework_attaches set is_teacher_score = 0,
|
||||||
|
score = (SELECT AVG(seems_rateable_rates.stars) FROM seems_rateable_rates
|
||||||
|
WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id
|
||||||
|
AND is_teacher_score = 0 GROUP BY rateable_id) WHERE homework_attaches.score = 0 OR homework_attaches.score is NULL
|
||||||
|
")
|
||||||
|
execute(sql)
|
||||||
|
execute(sql_student)
|
||||||
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in new issue