finish student data list page

This commit is contained in:
BOHUNG 2020-02-04 00:17:54 +08:00
parent 0ad22b9fa6
commit 2d0e43787c
2 changed files with 39 additions and 1 deletions

View File

@ -204,8 +204,10 @@ class OlympiamanagementsController < ApplicationController
end
end
def sign_up_student_data_list
@field_infos = StudentDataField.first.student_data_fields
@student_fields = OlympiaStudentDataFields.all
render_contents_in_index_page
@page_content = render_to_string(:formats=> [:html] ,:partial=>'student_data_list.html',:locals=>{:@student_fields=>(@student_fields rescue [])}).html_safe
render_contents_in_index_page(@breadcumb+@page_content)
end
def edit_password
if !session[:olympia_login_id].to_s.blank?

View File

@ -0,0 +1,36 @@
<link rel="stylesheet" media="screen" type="text/css" href="/assets/admin/olympiamanagement.scss">
<link rel="stylesheet" media="print" type="text/css" href="/assets/admin/olympiamanagement.scss">
<script src="/assets/admin/olympiamanagement.js"></script>
<% th_name_list = ['StudentIdentity','StudentName','StudentClass','StudentArea','StudentPhone','action']%>
<table cellspacing="0" class="ts_rowsonly" width="100%" id="RSS_Table_page_contest_admin_1">
<thead>
<tr>
<% th_name_list.each do |th_name|%>
<th><%= t('olympiamanagement.'+th_name) %></th>
<% end %>
</tr>
</thead>
<tbody>
<% @student_fields.each do |field| %>
<tr>
<% th_name_list.each do |th_name|%>
<%if th_name != 'action'%>
<% @value = field[th_name] %>
<% @index = @field_infos.map{|hash| hash.keys[0]}.index(th_name) rescue nil%>
<% if !@index.nil? %>
<% (['String','Year','select_num','File'].include?(@field_infos.map{|hash| hash.values[0]}[@index]['type'])) ? (nil) : (@value=(@field_infos.map{|hash| hash.values[0]}[@index]['values'][I18n.locale.to_s][@value.to_i].to_s rescue @value))%>
<% end %>
<td><%= @value %></td>
<% else %>
<td>
<a href="<%=add_sign_up_student_data_olympiamanagements_path+"?id=#{field.id}"%>"><img src="/assets/edit.gif" alt="<%= t('olympiamanagement.edit') %>" align="top" width="24"><%= t('olympiamanagement.edit') %></a>
<a href="<%=updata_student_data_olympiamanagements_path+"?id=#{field.id}&type=delete_student_data"%>"><img src="/assets/trash.gif" alt="<%= t('olympiamanagement.delete') %>" align="top" width="24"><%= t('olympiamanagement.delete') %></a>
</td>
<% end %>
<% end %>
</tr>
<%end%>
</tbody>
</table>
<% @extra_params = request.query_parameters.map{|key,value| key+'='+value}.join('&') %>
<%=create_pagination(params[:page].to_i,@student_fields,@extra_params).html_safe%>