单位名称列表功能代码

This commit is contained in:
daiao 2016-07-29 20:48:36 +08:00
parent 38f9bf0482
commit 430a93e4b2
9 changed files with 41 additions and 21 deletions

View File

@ -160,7 +160,7 @@ class AdminController < ApplicationController
@sort = "" @sort = ""
if params[:sort] && (params[:order] == 'name') if params[:sort] && (params[:order] == 'name')
# courses = School.find_by_sql("SELECT c.*,count(c.id) FROM courses c,course_activities ca WHERE c.id = ca.course_id AND c.name like '%#{name}%' GROUP BY c.id ORDER BY count(c.id) #{params[:sort]}, c.id desc") # courses = School.find_by_sql("SELECT c.*,count(c.id) FROM courses c,course_activities ca WHERE c.id = ca.course_id AND c.name like '%#{name}%' GROUP BY c.id ORDER BY count(c.id) #{params[:sort]}, c.id desc")
school = School.find_by_sql(" SELECT aas.name FROM apply_add_schools aas where aas.status = '0' GROUP BY CONVERT(name USING gbk) #{params[:sort]}, aas.id desc ") school = School.find_by_sql(" SELECT aas.name FROM apply_add_schools aas where aas.status = '0' ORDER BY CONVERT(aas.name USING gbk) #{params[:sort]}, aas.id asc ")
@order = params[:order] @order = params[:order]
@sort = params[:sort] @sort = params[:sort]
end end

View File

@ -187,6 +187,12 @@ class SchoolController < ApplicationController
user_extention= User.current.extensions user_extention= User.current.extensions
user_extention.school_id = school.id user_extention.school_id = school.id
user_extention.save! user_extention.save!
# status=4 向管理员发送信息
users = User.where(:admin => 1)
users.each do |user|
AppliedMessage.create(:user_id => user.id, :status => 4, :viewed => true, :applied_id => school.id, :applied_type => "ApplyAddSchools", :name => school.name )
end
else else
data[:result] = 3 data[:result] = 3
end end

View File

@ -1,5 +1,4 @@
<%= stylesheet_link_tag 'css/common','css/popup' %> <%= stylesheet_link_tag 'css/common','css/popup' %>
<div class="boxContainer" style="height: auto;"> <div class="boxContainer" style="height: auto;">
<div class="sendText fl mr10" style="width: auto">更改为</div> <div class="sendText fl mr10" style="width: auto">更改为</div>
<div class="cl"></div> <div class="cl"></div>

View File

@ -53,7 +53,7 @@
<td style="text-align: center;"> <td style="text-align: center;">
<%= apply.id %> <%= apply.id %>
</td> </td>
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<%=apply.name%>' id="apply_title_<%= apply.id %>"> <td class="name center" title='<%=apply.name%>' id="apply_title_<%= apply.id %>">
<%= apply.name %> <%= apply.name %>
</td> </td>
<td class="center"> <td class="center">
@ -65,7 +65,7 @@
<td class="center"> <td class="center">
<%= (apply.province.nil? ? "" : apply.province) + (apply.city.nil? ? "" : apply.city) %> <%= (apply.province.nil? ? "" : apply.province) + (apply.city.nil? ? "" : apply.city) %>
</td> </td>
<td align="left" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;"> <td class="center">
<%= apply.address %> <%= apply.address %>
</td> </td>
<td class="center"> <td class="center">
@ -76,9 +76,9 @@
<%= format_date(apply.created_at) %> <%= format_date(apply.created_at) %>
</td> </td>
<td class="center"> <td class="center">
<%= link_to( l(:label_approve), { :controller => 'admin', :action => 'approve_applied_schools', :id => apply.id }) %> <%= link_to( l(:label_approve), { :controller => 'admin', :action => 'approve_applied_schools', :id => apply.id }, :class => "application-default-link" ) %>
<%= link_to( l(:button_delete), { :controller => 'admin', :action => 'delete_applied_schools', :id => apply.id, :tip => 'unapplied' },:method => :delete, :confirm => l(:text_are_you_sure)) %> <%= link_to( l(:button_delete), { :controller => 'admin', :action => 'delete_applied_schools', :id => apply.id, :tip => 'unapplied' },:method => :delete, :confirm => l(:text_are_you_sure), :class => "application-default-link") %>
<%=link_to '更改', admin_all_schools_path(:school_id =>apply.id), :remote => true %> <%=link_to '更改', admin_all_schools_path(:school_id =>apply.id), :remote => true, :class => "application-default-link" %>
</td> </td>
</tr> </tr>

View File

@ -38,6 +38,9 @@
<th style="width: 85px;"> <th style="width: 85px;">
原名 原名
</th> </th>
<th style="width: 30px;">
用户
</th>
<th style="width: 60px;"> <th style="width: 60px;">
创建时间 创建时间
</th> </th>
@ -53,7 +56,7 @@
<td style="text-align: center;"> <td style="text-align: center;">
<%= apply.id %> <%= apply.id %>
</td> </td>
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<%=apply.name%>' id="apply_title_<%= apply.id %>"> <td class="name center" title='<%=apply.name%>' id="apply_title_<%= apply.id %>">
<% unless apply.school_id.nil? %> <% unless apply.school_id.nil? %>
<% school_name = School.where("id=?", apply.school_id).first %> <% school_name = School.where("id=?", apply.school_id).first %>
<%= school_name.name %> <%= school_name.name %>
@ -71,12 +74,16 @@
<%= school_province.province %> <%= school_province.province %>
<% end %> <% end %>
</td> </td>
<td align="left" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;"> <td class="center">
<%= apply.address %> <%= apply.address %>
</td> </td>
<td class="center"> <td class="center">
<%= apply.name %> <%= apply.name %>
</td> </td>
<td class="center">
<% count = UserExtensions.where("school_id = #{apply.school_id}").count %>
<%= count %>
</td>
<td class="center"> <td class="center">
<%= format_date(apply.created_at) %> <%= format_date(apply.created_at) %>
</td> </td>
@ -84,16 +91,6 @@
<%= link_to( l(:button_delete), { :controller => 'admin', :action => 'delete_applied_schools', :id => apply.id, :tip => 'applied' },:method => :delete, :confirm => l(:text_are_you_sure) ) %> <%= link_to( l(:button_delete), { :controller => 'admin', :action => 'delete_applied_schools', :id => apply.id, :tip => 'applied' },:method => :delete, :confirm => l(:text_are_you_sure) ) %>
</td> </td>
</tr> </tr>
<% unless apply.remarks.blank? %>
<tr class="odd">
<td>
</td>
<td style="text-align: left;" colspan="6">
<%= apply.remarks %>
</td>
</tr>
<% end %>
<% end %> <% end %>
<% end %> <% end %>
</tbody> </tbody>

View File

@ -62,3 +62,10 @@
<%= call_hook :view_layouts_base_body_bottom %> <%= call_hook :view_layouts_base_body_bottom %>
</body> </body>
</html> </html>
<script>
$("#sidebar ul").css({"marginLeft":"40px","marginTop":"1em","padding":"0"});
$("#sidebar a").css({"color":"#169","fontSize":"12px","lineHeight":"1.5"});
$("#sidebar a").mouseover(function(){$(this).css({"color":"#fff","backgroundColor":"#169"});});
$("#sidebar a").mouseout(function(){$(this).css({"color":"#169","backgroundColor":"#fff"});});
</script>

View File

@ -27,6 +27,14 @@
<%= link_to ma.name + "的申请,因名称不合法,已被拒绝,请重新编辑您的基本资料", { :controller=> "my",:action => "account" } %> <%= link_to ma.name + "的申请,因名称不合法,已被拒绝,请重新编辑您的基本资料", { :controller=> "my",:action => "account" } %>
</li> </li>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </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>
<li class="homepageNewsContent fl">
<a class ="#{ma.viewed == 0 ? 'newsBlack' : 'newsGrey'}" target = '_blank'>
<%= User.where("id=?", ma.user_id).first.login %>提交了申请:添加新的单位“<%= ma.name %>”</a>
</li>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
<% end %> <% end %>
</li> </li>
</ul> </ul>

View File

@ -388,7 +388,7 @@ zh:
label_organization_name: 组织名称 label_organization_name: 组织名称
label_organization_list: 组织列表 label_organization_list: 组织列表
label_school_plural: 学校列表 label_school_plural: 学校列表
label_applied_shcools: 单位名称列表 label_applied_shcools: 单位审核
label_organization_new: 新建组织 label_organization_new: 新建组织
label_edit_organization: 编辑组织 label_edit_organization: 编辑组织
label_organization_edit: 修改组织 label_organization_edit: 修改组织

View File

@ -1281,6 +1281,9 @@ a, a:link, a:visited{ color: #169; text-decoration: none; }
a:hover, a:active{ color: #c61a1a; text-decoration: underline;} a:hover, a:active{ color: #c61a1a; text-decoration: underline;}
a img{ border: 0; } a img{ border: 0; }
a.application-default-link {color: #169 !important; text-decoration: none;}
a.application-default-link:hover {color: #c61a1a !important; text-decoration: underline;}
a.issue.closed, a.issue.closed:link, a.issue.closed:visited { color: #999; text-decoration: line-through; } a.issue.closed, a.issue.closed:link, a.issue.closed:visited { color: #999; text-decoration: line-through; }
a.project.closed, a.project.closed:link, a.project.closed:visited { color: #999; } a.project.closed, a.project.closed:link, a.project.closed:visited { color: #999; }
a.user.locked, a.user.locked:link, a.user.locked:visited {color: #999;} a.user.locked, a.user.locked:link, a.user.locked:visited {color: #999;}