admin界面增加学校列表显示,以及按名称过滤功能

This commit is contained in:
sw 2015-07-27 16:07:29 +08:00
parent 922bb0167c
commit 7c818ce59a
6 changed files with 60 additions and 1 deletions

View File

@ -337,6 +337,19 @@ class AdminController < ApplicationController
format.html
end
end
#学校列表
def schools
@q = params[:school_name]
if @q
@schools = School.where("name like '%#{@q}%'")
else
@schools = School.all
end
respond_to do |format|
format.html
end
end
#移动端版本管理
def mobile_version
@versions = PhoneAppVersion.reorder('created_at desc')

View File

@ -0,0 +1,44 @@
<h3 style="float: left">
<%=l(:label_school_plural)%>
</h3>
<%= form_tag({:controller => 'admin', :action => 'schools' }, :method => :get,:id=>"search_course_form") do %>
<%= submit_tag "搜索",:style => "float: right;margin-right: 15px;"%>
<input style="float: right;margin-right: 10px;" id="v_subject" placeholder="学校名称" type="text" name="school_name" value="<%= @q%>">
<% end %>
<div class="cl"></div>
<div class="autoscroll" style="margin-top: 40px;">
<table class="list" style="width: 100%;table-layout: fixed">
<thead>
<tr>
<th>
LOGO
</th>
<th>
学校名称
</th>
<th></th>
</tr>
</thead>
<tbody>
<% @schools.each do |school|%>
<tr class="<%= cycle("odd", "even") %>">
<td align="center">
<%= image_tag(school.logo_link,width:46,height:46) %>
</td>
<td style="text-align:center;vertical-align: middle;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<%=school.name%>'>
<span>
<%= link_to school.name,"http://#{Setting.host_course}/?school_id=#{school.id}" %>
</span>
</td>
<td class="buttons" style="vertical-align: middle;">
<%= link_to("上传logo", edit_organization_path(school.id), :class => 'icon icon-copy') %>
<%#= link_to(l(:button_delete), organization_path(school.id), :method => :delete,:confirm => l(:text_are_you_sure), :class => 'icon icon-del') %>
</td>
</tr>
<% end%>
</tbody>
</table>
</div>
<% html_title(l(:label_project_plural)) -%>

View File

@ -381,6 +381,7 @@ zh:
label_organization_choose: --请选择组织--
label_organization_name: 组织名称
label_organization_list: 组织列表
label_school_plural: 学校列表
label_organization_new: 新建组织
label_organization_edit: 修改组织
label_project_plural: 项目列表

View File

@ -670,6 +670,7 @@ RedmineApp::Application.routes.draw do
match 'admin/test_email', :via => :get
match 'admin/default_configuration', :via => :post
get 'admin/organization'
get 'admin/schools'
resources :auth_sources do
member do

View File

@ -369,6 +369,7 @@ Redmine::MenuManager.map :admin_menu do |menu|
menu.push :projects, {:controller => 'admin', :action => 'projects'}, :caption => :label_project_plural
menu.push :courses, {:controller => 'admin', :action => 'courses'}, :caption => :label_course_all
menu.push :users, {:controller => 'admin', :action => 'users'}, :caption => :label_user_plural
menu.push :schools, {:controller => 'admin', :action => 'schools'}, :caption => :label_school_plural
menu.push :first_page_made, {:controller => 'admin',:action => 'first_page_made'},:caption => :label_first_page_made
menu.push :mobile_version, {:controller => 'admin',:action => 'mobile_version'},:caption => :label_mobile_version
menu.push :groups, {:controller => 'groups'}, :caption => :label_group_plural

View File

@ -665,7 +665,6 @@ a:hover.ping_pic{border:1px solid #64bdd9;}
.ping_back_tit{ float:left; width:523px; margin-left:10px; }
a.down_btn{ border:1px solid #CCC; color:#999; padding:0px 5px; font-size:12px; text-align:center; display:block;}
a:hover.down_btn{ background:#14ad5a; color:#fff; border:1px solid #14ad5a;}
.fr{ float:right;}
.min_search{ width:140px; height:20px; border:1px solid #d0d0d0; color:#666; background:url(../images/public_icon.png) 185px -193px no-repeat; }
.li_min_search{ float:right; margin-right:-10px;}
.info_ni_download{ width:100px; padding:5px;position: absolute;display:none;-moz-border-radius:3px; -webkit-border-radius:3px; border-radius:3px; box-shadow:0px 0px 5px #194a81; color:#666; background:#fff; text-align:left;margin-left: 200px;margin-top: 10px;}