Merge branch 'develop' of https://git.trustie.net/jacknudt/trustieforge into develop
This commit is contained in:
commit
59a8fb8b60
|
@ -598,6 +598,113 @@ class AdminController < ApplicationController
|
||||||
format.html
|
format.html
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# 获取申请的高校列表
|
||||||
|
# status: 0 未审批; 1 已批阅;
|
||||||
|
def applied_schools
|
||||||
|
@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 or status = 2").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
|
||||||
|
|
||||||
|
# 批准未审批的高校
|
||||||
|
# 消息发送,发送对象为申请人
|
||||||
|
# status: 0表示未批准; status:1表示已批准; status: 2表示已更改; status: 3表示已拒绝
|
||||||
|
def approve_applied_schools
|
||||||
|
applied_school = ApplyAddSchools.find params[:id]
|
||||||
|
applied_school.update_column('status', 1) unless applied_school.nil?
|
||||||
|
school = applied_school.school
|
||||||
|
school.update_attribute("province", applied_school.province)
|
||||||
|
AppliedMessage.create(:user_id => applied_school.user_id, :status => 1, :viewed => true, :applied_id => applied_school.id, :applied_type => "ApplyAddSchools", :name => applied_school.name )
|
||||||
|
# School.create(:user_id => applied_school.user_id, :status => 1, :viewed => true, :applied_id => applied_school.id, :applied_type => "ApplyAddSchools", :name => applied_school.name )
|
||||||
|
respond_to do |format|
|
||||||
|
format.html{ redirect_to unapplied_schools_url }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# 更改申请的高校名称
|
||||||
|
# REDO: 修改该字段
|
||||||
|
# REDO: 同步修改使用了改名称的用户单位
|
||||||
|
def edit_applied_schools
|
||||||
|
aas = ApplyAddSchools.find(params[:applied_id])
|
||||||
|
# aas.update_attribute(:name, params[:name])
|
||||||
|
#applied_add_school = ApplyAddSchools.where(:name => aas.name)
|
||||||
|
school = School.find params[:school_id]
|
||||||
|
begin
|
||||||
|
aas.update_attribute(:status, 2)
|
||||||
|
AppliedMessage.create(:user_id => aas.user_id, :status => 2, :viewed => true, :applied_id => aas.id, :applied_type => "ApplyAddSchools", :name => school[0].name )
|
||||||
|
users = UserExtensions.where("school_id = #{aas.school_id}")
|
||||||
|
users.each do |user|
|
||||||
|
user.update_column("school_id", school[0].id)
|
||||||
|
end
|
||||||
|
aas.school.destroy
|
||||||
|
aas.update_attribute(:school_id, school[0].id)
|
||||||
|
rescue Exception => e
|
||||||
|
puts e
|
||||||
|
end
|
||||||
|
# applied_schools = ApplyAddSchools.find params[:applied_id]
|
||||||
|
# applied_schools.update_column('name', params[:name])
|
||||||
|
redirect_to unapplied_schools_url
|
||||||
|
end
|
||||||
|
|
||||||
|
def all_schools
|
||||||
|
apply_schools = ApplyAddSchools.where("status != 1")
|
||||||
|
apply_school_ids = apply_schools.empty? ? "(-1)" : "(" + apply_schools.map{|sc| sc.school_id}.join(',') + ")"
|
||||||
|
if !params[:search].nil?
|
||||||
|
search = "%#{params[:search].to_s.strip.downcase}%"
|
||||||
|
@schools = School.where("id not in #{apply_school_ids} and #{School.table_name}.name like :p",:p=>search)
|
||||||
|
#@schools = School.all
|
||||||
|
else
|
||||||
|
#@course = @user.courses.where("is_delete = 0 and #{Course.table_name}.id != #{homework.course_id}").select { |course| @user.allowed_to?(:as_teacher,course)}
|
||||||
|
@schools = School.where("id not in #{apply_school_ids}")
|
||||||
|
end
|
||||||
|
@edit_id = params[:school_id]
|
||||||
|
@search = params[:search]
|
||||||
|
respond_to do |format|
|
||||||
|
format.js
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# 删除申请的高校
|
||||||
|
# REDO: destroy关联删除
|
||||||
|
# REDO: 删除确认提示,是否删除
|
||||||
|
# REDO: 给申请人发送消息
|
||||||
|
def delete_applied_schools
|
||||||
|
applied_school = ApplyAddSchools.find(params[:id])
|
||||||
|
applied_school.update_attribute(:status, 3)
|
||||||
|
AppliedMessage.create(:user_id => applied_school.user_id, :status => 3, :viewed => true, :applied_id => applied_school.id, :applied_type => "ApplyAddSchools", :name => applied_school.name )
|
||||||
|
users = UserExtensions.where("school_id = #{applied_school.school_id}")
|
||||||
|
users.each do |user|
|
||||||
|
user.update_column("school_id", nil)
|
||||||
|
end
|
||||||
|
applied_school.school.destroy
|
||||||
|
respond_to do |format|
|
||||||
|
format.html{ redirect_to unapplied_schools_url }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
#移动端版本管理
|
#移动端版本管理
|
||||||
def mobile_version
|
def mobile_version
|
||||||
@versions = PhoneAppVersion.reorder('created_at desc')
|
@versions = PhoneAppVersion.reorder('created_at desc')
|
||||||
|
|
|
@ -169,6 +169,7 @@ class SchoolController < ApplicationController
|
||||||
school = School.new
|
school = School.new
|
||||||
school.name = params[:name].strip
|
school.name = params[:name].strip
|
||||||
school.pinyin = Pinyin.t(params[:name].strip, splitter: '')
|
school.pinyin = Pinyin.t(params[:name].strip, splitter: '')
|
||||||
|
school.province = params[:province]
|
||||||
|
|
||||||
#status 0未处理 1通过 2拒绝
|
#status 0未处理 1通过 2拒绝
|
||||||
applyschool = ApplyAddSchools.new
|
applyschool = ApplyAddSchools.new
|
||||||
|
@ -180,7 +181,7 @@ class SchoolController < ApplicationController
|
||||||
applyschool.city = params[:city]
|
applyschool.city = params[:city]
|
||||||
applyschool.address = params[:address]
|
applyschool.address = params[:address]
|
||||||
applyschool.remarks = params[:remarks]
|
applyschool.remarks = params[:remarks]
|
||||||
|
applyschool.user_id = User.current.id
|
||||||
if applyschool.save
|
if applyschool.save
|
||||||
data[:school_id] = school.id
|
data[:school_id] = school.id
|
||||||
else
|
else
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
class AppliedMessage < ActiveRecord::Base
|
||||||
|
# status: 0表示未批准; status:1表示已批准; status: 2表示已拒绝
|
||||||
|
attr_accessible :applied_id, :applied_type, :status, :user_id, :viewed, :name
|
||||||
|
belongs_to :applied ,:polymorphic => true
|
||||||
|
belongs_to :apply_add_schools
|
||||||
|
belongs_to :user
|
||||||
|
has_many :message_alls, :class_name => 'MessageAll', :as =>:message, :dependent => :destroy
|
||||||
|
|
||||||
|
validates :user_id,presence: true
|
||||||
|
validates :applied_id,presence: true
|
||||||
|
validates :applied_type, presence: true
|
||||||
|
after_create :add_user_message
|
||||||
|
|
||||||
|
# 因为要排序所以需要写入总表
|
||||||
|
def add_user_message
|
||||||
|
if MessageAll.where("message_type = '#{self.class.to_s}' and message_id = '#{self.id}'").first.nil?
|
||||||
|
self.message_alls << MessageAll.new(:user_id => self.user_id, :viewed => false)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
|
@ -1,4 +1,16 @@
|
||||||
class ApplyAddSchools < ActiveRecord::Base
|
class ApplyAddSchools < ActiveRecord::Base
|
||||||
|
# status:0 未审批 ; 1 已批阅
|
||||||
attr_accessible :address, :city, :name, :province, :remarks, :school_id, :status
|
attr_accessible :address, :city, :name, :province, :remarks, :school_id, :status
|
||||||
|
has_many :applied_messages, :class_name =>'AppliedMessage', :as => :applied
|
||||||
belongs_to :school
|
belongs_to :school
|
||||||
|
|
||||||
|
after_create :send_massage
|
||||||
|
|
||||||
|
#给系统所有管理发送消息
|
||||||
|
def send_massage
|
||||||
|
users = User.where(:admin => 1)
|
||||||
|
users.each do |user|
|
||||||
|
self.applied_messages << AppliedMessage.new(:user_id => user.id, :viewed => false, :status => false)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -0,0 +1,56 @@
|
||||||
|
<%= stylesheet_link_tag 'css/common','css/popup' %>
|
||||||
|
|
||||||
|
<div class="boxContainer" style="height: auto;">
|
||||||
|
<div class="sendText fl mr10" style="width: auto">更改为</div>
|
||||||
|
<div class="cl"></div>
|
||||||
|
<!--<div class="resourcePopupClose"> <a href="javascript:void(0);" class="resourceClose" onclick="closeModal();"></a></div>-->
|
||||||
|
<div>
|
||||||
|
<!--<input type="text" name="search" placeholder="输入班级ID或者名称搜索" class="subjectSearch fr" />-->
|
||||||
|
<input type="text" id="search_course_input" value="<%= @search %>" name="search" placeholder="输入名称搜索" class="mt10 mb10 course-search" />
|
||||||
|
</div>
|
||||||
|
<div id="schools_list">
|
||||||
|
<%= render :partial => "admin/update_school_form", :locals => {:schools => schools, :edit_id => edit_id} %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script type="text/javascript">
|
||||||
|
function school_submit() {
|
||||||
|
var checkboxs = $("input[name='school_id[]']:checked");
|
||||||
|
if(checkboxs.length == 0) {
|
||||||
|
$("#choose_courses_notice").text("请先选择班级");
|
||||||
|
} else{
|
||||||
|
$("#choose_courses_notice").text("");
|
||||||
|
$("#schools_list_form").submit();
|
||||||
|
hideModal();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var lastSearchCondition = '';
|
||||||
|
var count = 0;
|
||||||
|
function search_courses(e){
|
||||||
|
if($(e.target).val().trim() == lastSearchCondition && lastSearchCondition != '')
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
lastSearchCondition = $(e.target).val().trim();
|
||||||
|
$.ajax({
|
||||||
|
url: '<%= url_for(:controller => 'admin', :action => 'all_schools') %>'+'?search='+ e.target.value+'&school_id=<%=edit_id %>',
|
||||||
|
type:'get',
|
||||||
|
data: {is_observe:true},
|
||||||
|
success: function(data){ },
|
||||||
|
beforeSend: function(){ $(this).addClass('ajax-loading'); },
|
||||||
|
complete: function(){ $(this).removeClass('ajax-loading'); }
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function throttle(method,context,e){
|
||||||
|
clearTimeout(method.tId);
|
||||||
|
method.tId=setTimeout(function(){
|
||||||
|
method.call(context,e);
|
||||||
|
},500);
|
||||||
|
}
|
||||||
|
|
||||||
|
//查询项目
|
||||||
|
$("input[name='search']").on('input', function (e) {
|
||||||
|
throttle(search_courses,window,e);
|
||||||
|
});
|
||||||
|
|
||||||
|
</script>
|
|
@ -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>
|
|
@ -0,0 +1,27 @@
|
||||||
|
<%= form_tag admin_edit_applied_schools_path(:applied_id =>edit_id), :id => 'schools_list_form' %>
|
||||||
|
<div>
|
||||||
|
<%#= hidden_field_tag(:send_id, edit_id) %>
|
||||||
|
<div class="courseReferContainer">
|
||||||
|
<% if !schools.empty? %>
|
||||||
|
<% schools.each do |school| %>
|
||||||
|
<ul class="courseSend">
|
||||||
|
<li class="" style="display:inline-block">
|
||||||
|
<input name="school_id[]" type="radio" value="<%= school.id %>" class="courseSendCheckbox"/>
|
||||||
|
</li>
|
||||||
|
<li class="sendCourseName"><%= truncate(school.name, :lendght => 25)%></li>
|
||||||
|
</ul>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="cl"></div>
|
||||||
|
<span id="choose_courses_notice" class="c_red"></span>
|
||||||
|
<div>
|
||||||
|
<div class="courseSendSubmit">
|
||||||
|
<a href="javascript:void(0);" onfocus='this.blur();' onclick="school_submit();" class="sendSourceText">确定</a>
|
||||||
|
</div>
|
||||||
|
<div class="courseSendCancel">
|
||||||
|
<a href="javascript:void(0);" class="sendSourceText" onclick="hideModal();">取消</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="cl"></div>
|
|
@ -0,0 +1,11 @@
|
||||||
|
<% if params[:search].nil? %>
|
||||||
|
$("#ajax-modal").html('<%= escape_javascript( render :partial => 'admin/all_schools', :locals => {:schools => @schools, :edit_id => @edit_id}) %>');
|
||||||
|
showModal('ajax-modal', '452px');
|
||||||
|
$('#ajax-modal').siblings().remove();
|
||||||
|
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='hideModal();' style='margin-left: 435px;' class='resourceClose'></a>");
|
||||||
|
$('#ajax-modal').parent().css("top","50%").css("left","50%");
|
||||||
|
$('#ajax-modal').parent().addClass("popbox").addClass("resourceUploadPopup");
|
||||||
|
$('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px");
|
||||||
|
<% else %>
|
||||||
|
$("#schools_list").html("<%= escape_javascript(render :partial => 'admin/update_school_form', :locals => {:schools => @schools, :edit_id => @edit_id}) %>");
|
||||||
|
<% end %>
|
|
@ -0,0 +1,90 @@
|
||||||
|
<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 %>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="autoscroll" id = "applied_school">
|
||||||
|
<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: 30px;">
|
||||||
|
用户
|
||||||
|
</th>
|
||||||
|
<th style="width: 60px;">
|
||||||
|
创建时间
|
||||||
|
</th>
|
||||||
|
<th style="width: 75px;">
|
||||||
|
操作
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<% @apply_status.each do |apply| %>
|
||||||
|
<% if apply.status == 0 %>
|
||||||
|
<tr class="<%= cycle("odd", "even") %>">
|
||||||
|
<td style="text-align: center;">
|
||||||
|
<%= apply.id %>
|
||||||
|
</td>
|
||||||
|
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<%=apply.name%>' id="apply_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">
|
||||||
|
<% count = UserExtensions.where("school_id = #{apply.school_id}").count %>
|
||||||
|
<%= count %>
|
||||||
|
</td>
|
||||||
|
<td class="center">
|
||||||
|
<%= format_date(apply.created_at) %>
|
||||||
|
</td>
|
||||||
|
<td class="center">
|
||||||
|
<%= link_to( l(:label_approve), { :controller => 'admin', :action => 'approve_applied_schools', :id => apply.id }, :class => 'icon-del') %>
|
||||||
|
<%= link_to( l(:button_delete), { :controller => 'admin', :action => 'delete_applied_schools', :id => apply.id },:method => :delete, :confirm => l(:text_are_you_sure), :class => 'icon-del') %>
|
||||||
|
<%=link_to '更改', admin_all_schools_path(:school_id =>apply.id), :remote => true %>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<% unless apply.remarks.empty? %>
|
||||||
|
<tr class="odd">
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td style="text-align: left;" colspan="6">
|
||||||
|
<%= apply.remarks %>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
|
@ -0,0 +1,86 @@
|
||||||
|
<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 %>
|
||||||
|
|
||||||
|
|
||||||
|
<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: 85px;">
|
||||||
|
原名
|
||||||
|
</th>
|
||||||
|
<th style="width: 60px;">
|
||||||
|
创建时间
|
||||||
|
</th>
|
||||||
|
<th style="width: 75px;">
|
||||||
|
操作
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<% @has_apply_status.each do |apply| %>
|
||||||
|
<% if apply.status == 1 || apply.status == 2%>
|
||||||
|
<tr class="<%= cycle("odd", "even") %>">
|
||||||
|
<td style="text-align: center;">
|
||||||
|
<%= apply.id %>
|
||||||
|
</td>
|
||||||
|
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<%=apply.name%>' id="apply_title_<%= apply.id %>">
|
||||||
|
<%= (School.find apply.school_id).name %>
|
||||||
|
</td>
|
||||||
|
<td class="center">
|
||||||
|
<%= (School.find apply.school_id).province %>
|
||||||
|
</td>
|
||||||
|
<td align="left" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">
|
||||||
|
<%= apply.address %>
|
||||||
|
</td>
|
||||||
|
<td class="center">
|
||||||
|
<%= apply.name %>
|
||||||
|
</td>
|
||||||
|
<td class="center">
|
||||||
|
<%= format_date(apply.created_at) %>
|
||||||
|
</td>
|
||||||
|
<td class="center">
|
||||||
|
<%= link_to( l(:button_delete), { :controller => 'admin', :action => 'delete_applied_schools', :id => apply.id },:method => :delete, :confirm => l(:text_are_you_sure), :class => 'icon-del') %>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<% unless apply.remarks.empty? %>
|
||||||
|
<tr class="odd">
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td style="text-align: left;" colspan="6">
|
||||||
|
<%= apply.remarks %>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
|
@ -0,0 +1,34 @@
|
||||||
|
<% if ma.class == AppliedMessage %>
|
||||||
|
<!--申请加入项目-->
|
||||||
|
<% if ma.applied_type == "ApplyAddSchools" %>
|
||||||
|
<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>
|
||||||
|
</li>
|
||||||
|
<li class="homepageNewsPubType fl">
|
||||||
|
<% if ma.status == 1 %>
|
||||||
|
<%=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'><%= 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="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl" : "homepageNewsType fl" %>">您添加新的高校(单位):</span>
|
||||||
|
<li class="homepageNewsContent fl">
|
||||||
|
<a class ="#{ma.viewed == 0 ? 'newsBlack' : 'newsGrey'}" target = '_blank'><%= 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="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl" : "homepageNewsType fl" %>">您添加新的高校(单位):</span>
|
||||||
|
<li class="homepageNewsContent fl">
|
||||||
|
<%= link_to ma.name + "的申请,因名称不合法,已被拒绝,请重新编辑您的基本资料", { :controller=> "my",:action => "account" } %>
|
||||||
|
</li>
|
||||||
|
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
|
||||||
|
<% end %>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
|
@ -34,6 +34,8 @@
|
||||||
|
|
||||||
<%= render :partial => 'users/user_message_org', :locals => {:ma => ma} %>
|
<%= render :partial => 'users/user_message_org', :locals => {:ma => ma} %>
|
||||||
|
|
||||||
|
<%# 申请类消息 %>
|
||||||
|
<%= render :partial => 'users/user_message_applied', :locals => {:ma => ma} %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<ul class="wlist" style=" border:none; padding-top: 15px;">
|
<ul class="wlist" style=" border:none; padding-top: 15px;">
|
||||||
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
|
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
|
||||||
|
|
|
@ -388,6 +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_organization_new: 新建组织
|
label_organization_new: 新建组织
|
||||||
label_edit_organization: 编辑组织
|
label_edit_organization: 编辑组织
|
||||||
label_organization_edit: 修改组织
|
label_organization_edit: 修改组织
|
||||||
|
@ -909,6 +910,7 @@ zh:
|
||||||
button_test: 测试
|
button_test: 测试
|
||||||
button_edit: 编辑
|
button_edit: 编辑
|
||||||
button_delete: 删除
|
button_delete: 删除
|
||||||
|
button_approve: 批准
|
||||||
button_set_homepage: 设为首页
|
button_set_homepage: 设为首页
|
||||||
button_cancel_homepage: 取消首页
|
button_cancel_homepage: 取消首页
|
||||||
button_edit_homepage: 编辑首页
|
button_edit_homepage: 编辑首页
|
||||||
|
|
|
@ -1069,6 +1069,13 @@ RedmineApp::Application.routes.draw do
|
||||||
match 'admin/default_configuration', :via => :post
|
match 'admin/default_configuration', :via => :post
|
||||||
get 'admin/organization'
|
get 'admin/organization'
|
||||||
get 'admin/schools'
|
get 'admin/schools'
|
||||||
|
get 'admin/applied_schools', as: :unapplied_schools
|
||||||
|
get 'admin/has_applied_schools', as: :applied_schools
|
||||||
|
get 'admin/approve_applied_schools'
|
||||||
|
post 'admin/edit_applied_schools'
|
||||||
|
get 'admin/all_schools'
|
||||||
|
delete 'admin/delete_applied_schools'
|
||||||
|
|
||||||
get 'admin/leave_messages'
|
get 'admin/leave_messages'
|
||||||
match 'admin/messages_list', as: :messages_list
|
match 'admin/messages_list', as: :messages_list
|
||||||
match 'admin/project_messages', as: :project_messages
|
match 'admin/project_messages', as: :project_messages
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
class CreateAppliedMessages < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
create_table :applied_messages do |t|
|
||||||
|
t.integer :user_id
|
||||||
|
t.integer :applied_id
|
||||||
|
t.string :applied_type
|
||||||
|
t.integer :viewed, :default => false
|
||||||
|
t.integer :status, :default => false
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,5 @@
|
||||||
|
class AddNameToAppliedMessage < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :applied_messages, :name, :string
|
||||||
|
end
|
||||||
|
end
|
4600
db/schema.rb
4600
db/schema.rb
File diff suppressed because it is too large
Load Diff
|
@ -371,6 +371,7 @@ Redmine::MenuManager.map :admin_menu do |menu|
|
||||||
menu.push :users, {:controller => 'admin', :action => 'users'}, :caption => :label_user_plural
|
menu.push :users, {:controller => 'admin', :action => 'users'}, :caption => :label_user_plural
|
||||||
menu.push :messages, {:controller => 'admin', :action => 'messages'}, :caption => :label_system_message
|
menu.push :messages, {:controller => 'admin', :action => 'messages'}, :caption => :label_system_message
|
||||||
menu.push :schools, {:controller => 'admin', :action => 'schools'}, :caption => :label_school_plural
|
menu.push :schools, {:controller => 'admin', :action => 'schools'}, :caption => :label_school_plural
|
||||||
|
menu.push :applied_schools, {:controller => 'admin', :action => 'applied_schools'}, :caption => :label_applied_shcools
|
||||||
menu.push :first_page_made, {:controller => 'admin',:action => 'first_page_made'},:caption => :label_first_page_made
|
menu.push :first_page_made, {:controller => 'admin',:action => 'first_page_made'},:caption => :label_first_page_made
|
||||||
menu.push :mobile_version, {:controller => 'admin',:action => 'mobile_version'},:caption => :label_mobile_version
|
menu.push :mobile_version, {:controller => 'admin',:action => 'mobile_version'},:caption => :label_mobile_version
|
||||||
menu.push :groups, {:controller => 'groups'}, :caption => :label_group_plural
|
menu.push :groups, {:controller => 'groups'}, :caption => :label_group_plural
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
FactoryGirl.define do
|
||||||
|
factory :applied_message do
|
||||||
|
user_id 1
|
||||||
|
applied_id 1
|
||||||
|
applied_type "MyString"
|
||||||
|
viewed 1
|
||||||
|
status 1
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
|
@ -0,0 +1,5 @@
|
||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe AppliedMessage, :type => :model do
|
||||||
|
pending "add some examples to (or delete) #{__FILE__}"
|
||||||
|
end
|
Loading…
Reference in New Issue