《调整学生列表页面》和《优化个人主页查询》

Signed-off-by: alan <547533434@qq.com>
This commit is contained in:
alan 2014-12-22 17:02:32 +08:00
parent 2084a17191
commit 629641d065
5 changed files with 32 additions and 25 deletions

View File

@ -433,14 +433,16 @@ class UsersController < ApplicationController
else else
activity = Activity.where(where_condition).where('user_id = ?', @user.id).order('id desc') activity = Activity.where(where_condition).where('user_id = ?', @user.id).order('id desc')
end end
activity = activity.reject { |e|
@activity_count = activity.count
@activity_pages = Paginator.new @activity_count, pre_count, params['page']
activity_page = activity.slice(@activity_pages.offset,@activity_pages.per_page * 2)
activity_page = activity_page.reject { |e|
((e.act_type=="Issue") && ( !e.act.visible?(User.current))) || ((e.act_type=="Issue") && ( !e.act.visible?(User.current))) ||
((e.act_type == "Journal") && (!e.act.project.visible?(User.current))) || ((e.act_type == "Journal") && (!e.act.project.visible?(User.current))) ||
((e.act_type == "Bid") && ((!User.current.member_of_course?(e.act.courses.first) || !User.current.admin?))) ((e.act_type == "Bid") && ((!User.current.member_of_course?(e.act.courses.first) || !User.current.admin?)))
} }
@activity_count = activity.count @activity = activity.slice(0,@activity_pages.per_page)
@activity_pages = Paginator.new @activity_count, pre_count, params['page']
@activity = activity.slice(@activity_pages.offset,@activity_pages.per_page)
@state = 0 @state = 0
end end

View File

@ -2,15 +2,18 @@
<div class="cl"></div> <div class="cl"></div>
<ul> <ul>
<li class="classbox" id = "group_name_0" name="check_group_name"> <li class="classbox" id = "group_name_0" name="check_group_name">
<% course_member_count = l(:label_all) + " ( " + @membercount.to_s + "人)" %> <% course_member_count = l(:label_all) %>
<%= link_to course_member_count, searchgroupmembers_course_path(@course,:group_id => 0), :onclick => "checkclass('group_name_0')", method: 'get', remote: true,:style => " border:0px; color: #0d90c3; float:left;"%> <%= link_to course_member_count, searchgroupmembers_course_path(@course,:group_id => 0), :onclick => "checkclass('group_name_0')", method: 'get', remote: true,:style => " border:0px; color: #0d90c3; float:left;"%>
</li> </li>
<% if course_groups.any? %> <% if course_groups.any? %>
<% course_groups.each do |group| %> <% course_groups.each do |group| %>
<% group_display = group.name + " ( " + group.members.count.to_s + "人)" %> <% group_display = group.name %>
<% group_count = " ( " + group.members.count.to_s + "人)" %>
<li class="classbox" id="group_name_<%= group.id %>" name="check_group_name"> <li class="classbox" id="group_name_<%= group.id %>" name="check_group_name">
<%= link_to group_display, searchgroupmembers_course_path(@course,:group_id => group.id), method: 'get', remote: true, <%= link_to group_display, searchgroupmembers_course_path(@course,:group_id => group.id), method: 'get', remote: true,
:onclick => "checkclass('group_name_#{group.id}')",:style => " border:0px; color: #0d90c3; float:left;"%> :onclick => "checkclass('group_name_#{group.id}')"%>
<%= link_to group_count, searchgroupmembers_course_path(@course,:group_id => group.id), method: 'get', remote: true,
:onclick => "checkclass('group_name_#{group.id}')", :style => "color: red;"%>
<% if @canShowCode && group.members.count == 0 %> <% if @canShowCode && group.members.count == 0 %>
<%= link_to '', deletegroup_course_path(:group_id => group.id), :method => 'delete', :remote => true, <%= link_to '', deletegroup_course_path(:group_id => group.id), :method => 'delete', :remote => true,
:data => {confirm: l(:label_delete_group)}, :data => {confirm: l(:label_delete_group)},

View File

@ -28,7 +28,7 @@
<% end %> <% end %>
<div class="cl"></div> <div class="cl"></div>
<div class="st_box"> <div class="st_box">
<ul class="st_box_top"> <ul class="st_box_top" style="margin-left: 17px;">
<% if @subPage_title == l(:label_student_list) %> <% if @subPage_title == l(:label_student_list) %>
<li class="ml358"><%= link_to '作业积分', member_score_sort_course_path ,method: 'get', remote: true, :onclick => "change_pic('pic')"%> <li class="ml358"><%= link_to '作业积分', member_score_sort_course_path ,method: 'get', remote: true, :onclick => "change_pic('pic')"%>
<a id="pic" href="#" class="st_down"></a></li> <a id="pic" href="#" class="st_down"></a></li>
@ -38,7 +38,7 @@
<% end %> <% end %>
</ul> </ul>
<div id="list_detail"> <div id="list_detail" style="margin-left: 17px">
<% members.each do |member| %> <% members.each do |member| %>
<div class="cl"></div><!--st_box_top end--> <div class="cl"></div><!--st_box_top end-->

View File

@ -59,19 +59,19 @@
<div class="st_list"> <div class="st_list">
<div class="st_search" style="margin-left: 14px"> <div class="st_search" style="margin-left: 14px">
<span class="f_l"><%= @subPage_title %></span> <span class="f_l"><%= @subPage_title %></span>
<span>
<% if @subPage_title && @subPage_title == l(:label_student_list)%> <% if @subPage_title && @subPage_title == l(:label_student_list)%>
<%= form_tag( searchmembers_course_path(@course), method: 'get',:class => "f_l",:style => "margin-left: 5px; ",:remote=>true) do %> <%= form_tag( searchmembers_course_path(@course), method: 'get',:class => "f_l",:style => "margin-left: 5px; ",:remote=>true) do %>
<%= text_field_tag 'name', params[:name], name: "name", :class => 'f_1', :style => "height:15px"%> <%= text_field_tag 'name', params[:name], name: "name", :class => 'f_1', :style => "height:15px; float: left;"%>
<% if @group %> <% if @group %>
<%= hidden_field "search_group_id", params[:search_group_id],:value => "#{@group.id}", name: 'search_group_id' %> <%= hidden_field "search_group_id", params[:search_group_id],:value => "#{@group.id}", name: 'search_group_id' %>
<%= submit_tag l(:label_search_member), :name => "ingroup",:class => "f_2"%> <%= submit_tag l(:label_search_member), :name => "ingroup",:class => "f_2", :style => "float: left "%>
<% else %> <% else %>
<%= submit_tag l(:label_search_member), :name => 'incourse',:onclick => "checkclass('group_name_0')",:class => "f_2"%> <%= submit_tag l(:label_search_member),:style => "float: left", :name => 'incourse',:onclick => "checkclass('group_name_0')",:class => "f_2"%>
<% end %> <% end %>
<% end %> <% end %>
<% end %> <% end %>
</span>
</div> </div>
<div class="cl"></div> <div class="cl"></div>
<% if @subPage_title == l(:label_student_list) %> <% if @subPage_title == l(:label_student_list) %>

View File

@ -45,7 +45,9 @@ input.f_2 {
/*.st_search input.f_2{ background:#1c9ec7; padding: 3px; margin-left: 3px; color:#fff;border:1px solid #1c9ec7; text-align:center; display:block; width:45px; height:28px; font-size:12px; }*/ /*.st_search input.f_2{ background:#1c9ec7; padding: 3px; margin-left: 3px; color:#fff;border:1px solid #1c9ec7; text-align:center; display:block; width:45px; height:28px; font-size:12px; }*/
.classbox{ border:1px solid #f8df8c; background:#fffce6; color:#0d90c3; padding:0 3px; float:left; margin-left:15px;} .classbox{ border:1px solid #f8df8c; background:#fffce6; color:#0d90c3; padding:0 3px; float:left; margin-left:15px;}
.st_addclass ul li.selected { border:1px solid #f8df8c; background:#f8df8c; color:#0d90c3; padding:0 3px; float:left; margin-left:15px;} .classbox a { border:0px; color: #0d90c3; float:left;text-decoration: none;}
.st_addclass ul li.selected {border:1px solid #f8df8c; background:#f6f098; padding:0 3px; float:left; margin-left:15px;}
.st_addclass ul li.selected a { color:#716cad;text-decoration: none;}
.st_addclass{ margin-top:5px;} .st_addclass{ margin-top:5px;}
.st_addclass ul li{ margin-bottom:10px;} .st_addclass ul li{ margin-bottom:10px;}
.st_addclass ul li,.st_addclass a,.st_addclass img{ float:left;} .st_addclass ul li,.st_addclass a,.st_addclass img{ float:left;}
@ -83,11 +85,11 @@ a:hover.st_add{ color:#ff8e15;}
.isTxt{background:#fbfbfb url(../images/inputBg.png) repeat-x left top;height:22px;line-height:22px;border:1px solid #c1c1c1;padding:0 5px;color:#666666;} .isTxt{background:#fbfbfb url(../images/inputBg.png) repeat-x left top;height:22px;line-height:22px;border:1px solid #c1c1c1;padding:0 5px;color:#666666;}
.group_in { .group_in {
width:90px !important; width:90px !important;
height:28px !important;
color:#1c9ec7!important; color:#1c9ec7!important;
margin-right:5px !important; margin-right:5px !important;
border:none !important; border:none !important;
font-size: 14px !important; font-size: 12px !important;
margin-left:0px !important; margin-left:0px !important;
box-shadow: none !important; box-shadow: none !important;
float: right; float: right;