单位名称列表缺陷修复

This commit is contained in:
daiao 2016-07-29 23:22:32 +08:00
parent 20195d2496
commit db690bedab
4 changed files with 38 additions and 22 deletions

View File

@ -615,8 +615,10 @@ class AdminController < ApplicationController
# 获取申请的高校列表
# status: 0 未审批; 1 已批阅;
def applied_schools
@name = params[:name]
@apply_status = ApplyAddSchools.where(:status => 0).order('created_at desc')
@name = params[:name] || ""
condition = "#{@name.strip}".gsub(" ","")
@apply_status = ApplyAddSchools.where("status = 0 and name like '%#{condition}%'").order('created_at desc')
@apply_count = @apply_status.count
@apply_pages = Paginator.new @apply_count, 30, params['page'] || 1
@ -629,8 +631,10 @@ class AdminController < ApplicationController
end
def has_applied_schools
@name = params[:name]
@has_apply_status = ApplyAddSchools.where("status = 1 or status = 2").order('created_at desc')
@name = params[:name] || ""
condition = "#{@name.strip}".gsub(" ","")
@has_apply_status = ApplyAddSchools.where("(status = 1 or status = 2) and name like '%#{condition}%'").order('created_at desc')
@has_apply_count = @has_apply_status.count
@has_apply_pages = Paginator.new @has_apply_count, 30, params['page'] || 1

View File

@ -53,14 +53,14 @@
<td style="text-align: center;">
<%= apply.id %>
</td>
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<%=apply.name%>' >
<span title="双击可编辑" id="apply_title_<%= apply.id %>"><%= apply.name %></span>
<td class="name" title='<%=apply.name%>' >
<span id="apply_title_<%= apply.id %>"><%= apply.name %></span>
<textarea style="display: none; width:100px; height:16px; border:1px solid #ddd; outline:none; padding:0 0 0 5px; resize:none; overflow:hidden;" placeholder="请编辑单位名称" id="school_name_edit_<%=apply.id%>" onblur="edit_school_name('<%= edit_apply_name_school_path(apply.id)%>','<%= apply.id %>');"><%= apply.name %></textarea>
</td>
<td class="center">
<% user = User.where("id=?", apply.user_id).first %>
<% unless user.nil? %>
<%=link_to user.show_name, user_path(user) %>
<%=link_to user.show_name, user_path(user),:target => '_blank' %>
<% end %>
</td>
<td class="center">
@ -141,4 +141,7 @@
<% end %>
</tbody>
</table>
</div>
</div>
<ul class="wlist" id="pages" style="float: right;margin-top: 10px;">
<%= pagination_links_full @apply_pages, @apply_count ,:per_page_links => true, :remote => false, :flag => true %>
</ul>

View File

@ -23,7 +23,7 @@
<th style="width: 20px;">
序号
</th>
<th style="width: 85px;">
<th style="width: 80px;">
单位名称
</th>
<th style="width: 30px;">
@ -41,7 +41,7 @@
<th style="width: 30px;">
用户
</th>
<th style="width: 60px;">
<th style="width: 65px;">
创建时间
</th>
<th style="width: 75px;">
@ -56,7 +56,7 @@
<td style="text-align: center;">
<%= apply.id %>
</td>
<td class="name center" title='<%=apply.name%>' >
<td class="name" title='<%=apply.name%>' >
<% unless apply.school_id.nil? %>
<% school_name = School.where("id=?", apply.school_id).first %>
<span title="双击可编辑" ondblclick = "show_edit_school_name('<%= apply.id %>');" id="apply_title_<%= apply.id %>"><%= school_name %></span>
@ -64,9 +64,9 @@
<% end %>
</td>
<td class="center">
<% user = User.where("id=?", apply.user_id).first %>
<% user = User.where("id=?", apply.user_id).first%>
<% unless user.nil? %>
<%=link_to user.show_name, user_path(user) %>
<%=link_to user.show_name, user_path(user), :target => '_blank'%>
<% end %>
</td>
<td class="center">
@ -137,4 +137,7 @@
<% end %>
</tbody>
</table>
</div>
</div>
<ul class="wlist" id="pages" style="float: right;margin-top: 10px;">
<%= pagination_links_full @has_apply_pages, @has_apply_count ,:per_page_links => true, :remote => false, :flag => true %>
</ul>

View File

@ -4,33 +4,39 @@
<% if ma.status == 1 || ma.status == 2 || ma.status == 3 || ma.status == 4 %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl">
<a href="javascript:void(0);"><%= link_to image_tag(url_to_avatar(ma.user), :width => "30", :height => "30"), user_path(ma.user), :target => '_blank' %></a>
<a href="javascript:void(0);">
<% if ma.status == 1 || ma.status == 2 || ma.status == 3%>
<%= image_tag("/images/trustie_logo1.png", width: "30px", height: "30px", class: "mt3") %>
<% elsif ma.status == 4 %>
<%= link_to image_tag(url_to_avatar(ma.user), :width => "30", :height => "30"), user_path(ma.user), :target => '_blank' %>
<% end %>
</a>
</li>
<li class="homepageNewsPubType fl">
<% if ma.status == 1 %>
<%=link_to ma.user, user_path(ma.user), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
<span class="newsBlue homepageNewsPublisher">系统提示</span>
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl" : "homepageNewsType fl" %>">您添加新的高校(单位):</span>
<li class="homepageNewsContent fl">
<a class ="#{ma.viewed == 0 ? 'newsBlack' : 'newsGrey'}" target = '_blank' title="<%= ma.name %>的申请,已通过"><%= ma.name %>的申请,已通过</a>
<a class ="#{ma.viewed == 0 ? 'newsBlack' : 'newsGrey'}" target = '_blank' title="<%= ma.name %>的申请,已通过"><%= ma.name %>的申请,已通过</a>
</li>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
<% elsif ma.status == 2 %>
<%=link_to ma.user, user_path(ma.user), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
<span class="newsBlue homepageNewsPublisher">系统提示</span>
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl" : "homepageNewsType fl" %>">您添加新的高校(单位):</span>
<li class="homepageNewsContent fl">
<a class ="#{ma.viewed == 0 ? 'newsBlack' : 'newsGrey'}" target = '_blank' title="<%= ma.applied.name %>的申请,因名称不合法,系统已将其更改为“<%= ma.name %>”"><%= ma.applied.name %>的申请,因名称不合法,系统已将其更改为“<%= ma.name %>”</a>
</li>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
<% elsif ma.status == 3 %>
<%=link_to ma.user, user_path(ma.user), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
<span class="newsBlue homepageNewsPublisher">系统提示</span>
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl" : "homepageNewsType fl" %>">您添加新的高校(单位):</span>
<li class="homepageNewsContent fl">
<%= link_to ma.name + "的申请,因名称不合法,已被拒绝,请重新编辑您的基本资料", { :controller=> "my",:action => "account" }, :title => "#{ma.name}的申请,因名称不合法,已被拒绝,请重新编辑您的基本资料" %>
<%= link_to ma.name + "的申请,因名称不合法,已被拒绝,请重新编辑您的基本资料", { :controller=> "my",:action => "account" }, :title => "#{ma.name}的申请,因名称不合法,已被拒绝,请重新编辑您的基本资料", :target => '_blank'%>
</li>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
<% elsif ma.status == 4 %>
<%=link_to ma.user, user_path(ma.user), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl" : "homepageNewsType fl" %>"> </span>
<%=link_to User.where("id=?", ma.applied_user_id).first.show_name, user_path(ma.user), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl" : "homepageNewsType fl" %>"> 申请了单位:</span>
<li class="homepageNewsContent fl">
<a class ="#{ma.viewed == 0 ? 'newsBlack' : 'newsGrey'}" target = '_blank'>
<%= link_to User.where("id=?", ma.applied_user_id).first.show_name + "提交了申请:添加新的单位“#{ma.name}”", unapplied_schools_path(), :title => "#{User.where("id=?", ma.applied_user_id).first.show_name}提交了申请:添加新的单位“#{ma.name}”" %></a>