在管理员界面添加单位名称列表

This commit is contained in:
daiao 2016-07-25 18:31:28 +08:00
parent 35172dab59
commit 5883b451ca
6 changed files with 2498 additions and 2292 deletions

View File

@ -602,14 +602,47 @@ class AdminController < ApplicationController
# 获取申请的高校列表
# status: 0 未审批; 1 已批阅;
def applied_schools
@apply_status = ApplyAddSchools.where(:status => 0)
@name = params[:name]
@apply_status = ApplyAddSchools.where(:status => 0).order('created_at desc')
@apply_count = @apply_status.count
@apply_pages = Paginator.new @apply_count, 30, params['page'] || 1
@apply_status = paginateHelper @apply_status, 30
@page = (params['page'] || 1).to_i - 1
respond_to do |format|
format.html
end
end
def has_applied_schools
@name = params[:name]
@has_apply_status = ApplyAddSchools.where(:status => 1).order('created_at desc')
@has_apply_count = @has_apply_status.count
@has_apply_pages = Paginator.new @has_apply_count, 30, params['page'] || 1
@has_apply_status = paginateHelper @has_apply_status, 30
@page = (params['page'] || 1).to_i - 1
respond_to do |format|
format.html
end
end
# 批准未审批的高校
def approve_applied_schools
@applied_schools = ApplyAddSchools.find params[:id]
unless @applied_schools_schools.nil?
@applied_schools.update_column('status', 1)
end
end
# 更改申请的高校名称
# REDO: 修改该字段
# REDO: 同步修改使用了改名称的用户单位
def edit_applied_schools
@applied_schools = ApplyAddSchools.find params[:id]
@applied_schools.update_column('name', params[:name])
end
# 删除申请的高校
@ -617,7 +650,8 @@ class AdminController < ApplicationController
# REDO: 删除确认提示,是否删除
# REDO: 给申请人发送消息
def delete_applied_schools
@applied_schools = ApplyAddSchools.find params[:id]
@applied_schools.destroy
end
#移动端版本管理

View File

@ -0,0 +1,6 @@
<div class="tabs">
<ul>
<li><%= link_to '未审批', {:action => 'applied_schools'}, class: "#{current_page?(unapplied_schools_path)? 'selected' : nil }" %></li>
<li><%= link_to '已审批', {:action => 'has_applied_schools'}, class: "#{current_page?(applied_schools_path)? 'selected' : nil }" %></li>
</ul>
</div>

View File

@ -0,0 +1,76 @@
<h3>
<%=l(:label_applied_shcools)%>
</h3>
<%= render 'tab_has_applied_applied' %>
<%= form_tag({}, :method => :get) do %>
<fieldset>
<label for='name'>
单位名称:
</label>
<%= text_field_tag 'name', params[:name], :size => 30, :placeholder => '输入单位名称进行搜索' %>
<%= submit_tag l(:button_apply ), :class => "small", :name => nil %>
<%= link_to l(:button_clear), {:controller => 'admin', :action => 'applied_shcools'}, :class => 'icon icon-reload' %>
</fieldset>
<% end %>
&nbsp;
<div class="autoscroll">
<table class="list" style="width: 100%;table-layout: fixed">
<thead>
<tr>
<th style="width: 20px;">
序号
</th>
<th style="width: 85px;">
单位名称
</th>
<th style="width: 75px;">
地区
</th>
<th style="width: 75px;">
详细地址
</th>
<th style="width: 20px;">
用户
</th>
<th style="width: 60px;">
创建时间
</th>
<th style="width: 75px;">
操作
</th>
</tr>
</thead>
<tbody>
<% @apply_status.each do |apply| %>
<tr class="odd">
<td style="text-align: center;">
<%= apply.id %>
</td>
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<%=apply.name%>' id="schools_title_<%= apply.id %>">
<%= apply.name %>
</td>
<td class="center">
<%= apply.province + apply.city %>
</td>
<td align="left" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">
<%= apply.address %>
</td>
<td class="center">
<%= apply.user_id %>
</td>
<td class="center">
<%= format_date(apply.created_at) %>
</td>
<td class="center">
<%= link_to( "批准", { :controller => 'admin', :action => 'approve_applied_schools', :id => apply.id }, :class => 'icon-del') %>
<%= link_to( "删除", { :controller => 'admin', :action => 'delete_applied_schools', :id => apply.id }, :class => 'icon-del') %>
<%= link_to( "更改", { :controller => 'admin', :action => 'edit_applied_schools', :id => apply.id, :name => apply.name }, :class => 'icon-del') %>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>

View File

@ -0,0 +1,75 @@
<h3>
<%=l(:label_applied_shcools)%>
</h3>
<%= render 'tab_has_applied_applied' %>
<%= form_tag({}, :method => :get) do %>
<fieldset>
<label for='name'>
单位名称:
</label>
<%= text_field_tag 'name', params[:name], :size => 30, :placeholder => '输入单位名称进行搜索' %>
<%= submit_tag l(:button_apply ), :class => "small", :name => nil %>
<%= link_to l(:button_clear), {:controller => 'admin', :action => 'applied_shcools'}, :class => 'icon icon-reload' %>
</fieldset>
<% end %>
&nbsp;
<div class="autoscroll">
<table class="list" style="width: 100%;table-layout: fixed">
<thead>
<tr>
<th style="width: 20px;">
序号
</th>
<th style="width: 85px;">
单位名称
</th>
<th style="width: 75px;">
地区
</th>
<th style="width: 75px;">
详细地址
</th>
<th style="width: 20px;">
用户
</th>
<th style="width: 60px;">
创建时间
</th>
<th style="width: 75px;">
操作
</th>
</tr>
</thead>
<tbody>
<% @has_apply_status.each do |apply| %>
<tr class="odd">
<td style="text-align: center;">
<%= apply.id %>
</td>
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<%=apply.name%>' id="schools_title_<%= apply.id %>">
<%= apply.name %>
</td>
<td class="center">
<%= apply.province + apply.city %>
</td>
<td align="left" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">
<%= apply.address %>
</td>
<td class="center">
<%= apply.user_id %>
</td>
<td class="center">
<%= format_date(apply.created_at) %>
</td>
<td class="center">
<%= link_to( "删除", { :controller => 'admin', :action => 'delete_applied_schools', :id => apply.id }, :class => 'icon-del') %>
<%= link_to( "更改", { :controller => 'admin', :action => 'edit_applied_schools', :id => apply.id, :name => apply.name }, :class => 'icon-del') %>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>

View File

@ -1069,7 +1069,8 @@ RedmineApp::Application.routes.draw do
match 'admin/default_configuration', :via => :post
get 'admin/organization'
get 'admin/schools'
get 'admin/applied_schools'
get 'admin/applied_schools', as: :unapplied_schools
get 'admin/has_applied_schools', as: :applied_schools
get 'admin/leave_messages'
match 'admin/messages_list', as: :messages_list
match 'admin/project_messages', as: :project_messages

File diff suppressed because it is too large Load Diff