forked from Trustie/forgeplus
fixed 资讯增加活动报名
This commit is contained in:
parent
eb7f4e6da3
commit
14d8a248d7
|
|
@ -1,5 +1,5 @@
|
|||
class Admins::PlatformCommunicatesController < Admins::BaseController
|
||||
before_action :get_communicate, only: [:edit, :update, :destroy]
|
||||
before_action :get_communicate, only: [:edit, :update, :destroy, :show]
|
||||
def index
|
||||
sort_by = PlatformCommunicate.column_names.include?(params[:sort_by]) ? params[:sort_by] : 'order_index'
|
||||
sort_direction = %w(desc asc).include?(params[:sort_direction]) ? params[:sort_direction] : 'desc'
|
||||
|
|
@ -8,6 +8,21 @@ class Admins::PlatformCommunicatesController < Admins::BaseController
|
|||
@communicates = kaminari_paginate(communicates)
|
||||
end
|
||||
|
||||
def show
|
||||
watchers = @communicate.watchers
|
||||
if params[:search].present?
|
||||
like_sql = 'users.lastname LIKE :keyword OR users.nickname LIKE :keyword OR users.mail LIKE :keyword OR users.phone LIKE :keyword OR users.login LIKE :keyword OR users.company_name LIKE :keyword'
|
||||
watchers = watchers.left_joins(:user).where(like_sql, keyword: "%#{params[:search]}%")
|
||||
end
|
||||
if params[:user_type].present?
|
||||
watchers = watchers.left_joins(:user).where("users.user_type = ?", params[:user_type])
|
||||
end
|
||||
if params[:professional_field].present?
|
||||
watchers = watchers.left_joins(:user).where("users.professional_field = ?", params[:professional_field])
|
||||
end
|
||||
@watchers = kaminari_paginate watchers
|
||||
end
|
||||
|
||||
def new
|
||||
@communicate = PlatformCommunicate.new
|
||||
end
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
<th width="10%">帖子ID</th>
|
||||
<th width="20%">标签</th>
|
||||
<th width="20%">排序等级</th>
|
||||
<th width="20%">报名数</th>
|
||||
<th width="25%">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
|
@ -20,9 +21,11 @@
|
|||
<td><%= c.fake_id %></td>
|
||||
<td><%= c.tag_field %></td>
|
||||
<td><%= c.order_index %></td>
|
||||
<td><%= c.tag_field.to_s.include?("活动") ? link_to(c.watchers_count, "/admins/platform_communicates/#{c.id}") : "--"%></td>
|
||||
<td class="action-container">
|
||||
<%= link_to "编辑", edit_admins_platform_communicate_path(c), remote: true, class: "action" %>
|
||||
<%= link_to "删除", admins_platform_communicate_path(c), method: :delete, data:{confirm: "确认删除的吗?"}, class: "action" %>
|
||||
<%= c.tag_field.to_s.include?("活动") ? link_to("查看报名", "/admins/platform_communicates/#{c.id}") : ""%>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,38 @@
|
|||
<table class="table table-hover users-list-table">
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
<th width="5%">序号</th>
|
||||
<th width="15%" class="text-left">昵称</th>
|
||||
<th width="15%">邮件地址</th>
|
||||
<th width="10%">手机号码</th>
|
||||
<th width="10%">用户类型</th>
|
||||
<th width="10%">专业领域</th>
|
||||
<th width="20%">单位</th>
|
||||
<th width="10%">报名时间</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% if watchers.present? %>
|
||||
<% watchers.each_with_index do |watch, index| %>
|
||||
<tr class="user-item-<%= watch.user.id %>">
|
||||
<td><%= list_index_no((params[:page] || 1).to_i, index) %></td>
|
||||
<td class="text-left">
|
||||
<%= link_to "/#{watch.user.login}", target: '_blank' do %>
|
||||
<%= overflow_hidden_span watch.user.real_name, width: 100 %>
|
||||
<% end %>
|
||||
</td>
|
||||
<td><%= overflow_hidden_span display_text(watch.user.mail), width: 150 %></td>
|
||||
<td><%= overflow_hidden_span display_text(watch.user.phone), width: 100 %></td>
|
||||
<td><%= watch.user.try(:user_type).blank? ? "" : ["事业单位", "企业单位", "科研人员", "高校教师", "高校学生", "程序员", "其他"][user.try(:user_type).to_i] %></td>
|
||||
<td><%= watch.user.try(:professional_field).blank? ? "" : "#{Site.dict_str("professional_field", "#{user.professional_field}")}" %></td>
|
||||
<td><%= watch.user.try(:company_name) %></td>
|
||||
<td><%= display_text(watch.created_at&.strftime('%Y-%m-%d %H:%M')) %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<%= render 'admins/shared/no_data_for_table' %>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<%= render partial: 'admins/shared/paginate', locals: { objects: watchers } %>
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
<div class="breadcrumb-container">
|
||||
<nav aria-label="breadcrumb">
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item active" aria-current="page"><a href="/admins/platform_communicates">返回</a>>活动报名</li>
|
||||
</ol>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
<div class="box search-form-container platform-communicate-list-form">
|
||||
<%= form_tag(admins_platform_communicate_path(@communicate), method: :get, class: 'form-inline search-form flex-1', remote: true) do %>
|
||||
<div class="form-group mr-2">
|
||||
<label for="identity">用户类型:</label>
|
||||
<% user_type_options = [['全部', ''], ['事业单位', 0], ['企业单位', 1], ['科研人员', 2], ['高校教师', 3], ['高校学生', 4], ['程序员', 5], ['其他', 6]] %>
|
||||
<%= select_tag(:user_type, options_for_select(user_type_options), class: 'form-control') %>
|
||||
</div>
|
||||
<div class="form-group mr-2">
|
||||
<label for="identity">专业领域:</label>
|
||||
<% user_type_options = [['全部', '']] + Site.get_dict_data("professional_field").pluck(:name,:value)%>
|
||||
<%= select_tag(:professional_field, options_for_select(user_type_options), class: 'form-control') %>
|
||||
</div>
|
||||
<%= text_field_tag(:search, params[:search], class: 'form-control col-12 col-md-2 mr-3', placeholder: '用户姓名/Email/手机号/单位') %>
|
||||
<%= submit_tag('搜索', class: 'btn btn-primary ml-3', 'data-disable-with': '搜索中...') %>
|
||||
<input type="reset" class="btn btn-secondary clear-btn" value="清空"/>
|
||||
<% end %>
|
||||
<%= link_to "新增", new_admins_platform_communicate_path, remote: true, class: "btn btn-primary pull-right", "data-disabled-with":"...新增" %>
|
||||
</div>
|
||||
|
||||
<div class="box admin-list-container users-list-container">
|
||||
<%= render partial: 'admins/platform_communicates/users_list', locals: { watchers: @watchers } %>
|
||||
</div>
|
||||
<div id="platform-communicate-modals">
|
||||
</div>
|
||||
|
|
@ -0,0 +1 @@
|
|||
$('.users-list-container').html("<%= j( render partial: 'admins/platform_communicates/users_list', locals: { watchers: @watchers } ) %>");
|
||||
|
|
@ -17,7 +17,8 @@
|
|||
<td><%= list_index_no((params[:page] || 1).to_i, index) %></td>
|
||||
<td><%= banner.title %></td>
|
||||
<td><img style="width:150px" src="<%= banner.image %>" /></td>
|
||||
<td><a href="<%= banner.url %>" target="_blank"><%= banner.url %></a> </td>
|
||||
<!-- <td><a href="<%#= banner.url %>" target="_blank"><%#= banner.url %></a> </td>-->
|
||||
<td><%= banner.url %></td>
|
||||
<td><%= ["首页","竞赛"][Topic.locations[banner.location]] %></td>
|
||||
<td><%= banner.order_index %></td>
|
||||
<td class="action-container">
|
||||
|
|
|
|||
Loading…
Reference in New Issue