commit
1eff394498
@ -1 +0,0 @@
|
|||||||
{"access_token":"b_Pc60Dd5eyg_ut3cHbsjQO9EJJdj2Qj5F99o9LH9ltKSme7_FZ3Of22lWLL-K2V0siWzv-bd9PO0Dn-L1PBvIy9LhXa0qPVaFl6vTtZHR2kA8qjo1ps2ancya0t7KmzURGbAFAAXM","expires_in":7200,"got_token_at":1467976842}
|
|
@ -0,0 +1,181 @@
|
|||||||
|
#coding=utf-8
|
||||||
|
|
||||||
|
module Mobile
|
||||||
|
module Apis
|
||||||
|
class Projects < Grape::API
|
||||||
|
|
||||||
|
resources :projects do
|
||||||
|
desc "获取项目列表"
|
||||||
|
params do
|
||||||
|
requires :token, type: String
|
||||||
|
end
|
||||||
|
get do
|
||||||
|
authenticate!
|
||||||
|
|
||||||
|
ps = ProjectsService.new
|
||||||
|
projects = ps.user_projects(current_user)
|
||||||
|
present :data, projects, with: Mobile::Entities::Project,user: current_user
|
||||||
|
present :status, 0
|
||||||
|
end
|
||||||
|
|
||||||
|
desc "返回单个项目"
|
||||||
|
params do
|
||||||
|
requires :id, type: Integer
|
||||||
|
requires :token,type:String
|
||||||
|
end
|
||||||
|
route_param :id do
|
||||||
|
get do
|
||||||
|
# course = Course.find(params[:id])
|
||||||
|
ps = ProjectsService.new
|
||||||
|
project = ps.show_project(params,current_user)
|
||||||
|
|
||||||
|
if project[:status] == 9
|
||||||
|
{status:-1, message: '该项目不存在或已被删除啦' }
|
||||||
|
else
|
||||||
|
present :data, project, with: Mobile::Entities::Project,user: current_user
|
||||||
|
present :status, 0
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
desc "获取项目动态"
|
||||||
|
params do
|
||||||
|
requires :id, type: Integer
|
||||||
|
requires :token, type: String
|
||||||
|
end
|
||||||
|
post 'activities' do
|
||||||
|
authenticate!
|
||||||
|
|
||||||
|
user = current_user
|
||||||
|
|
||||||
|
project_types = "('Message','Issue','Project')"
|
||||||
|
activities = UserActivity.where("(container_type = 'Project' and container_id = #{params[:id]} and act_type in #{project_types})").order('updated_at desc')
|
||||||
|
|
||||||
|
page = params[:page] ? params[:page] : 0
|
||||||
|
all_count = activities.count
|
||||||
|
activities = activities.limit(10).offset(page * 10)
|
||||||
|
count = activities.count
|
||||||
|
present :data, activities, with: Mobile::Entities::Activity,user: user
|
||||||
|
present :all_count, all_count
|
||||||
|
present :count, count
|
||||||
|
present :page, page
|
||||||
|
present :status, 0
|
||||||
|
end
|
||||||
|
|
||||||
|
desc "获取项目成员"
|
||||||
|
params do
|
||||||
|
requires :id, type: Integer
|
||||||
|
requires :token, type: String
|
||||||
|
end
|
||||||
|
post 'members' do
|
||||||
|
authenticate!
|
||||||
|
|
||||||
|
project = Project.find("#{params[:id]}")
|
||||||
|
members = project.member_principals
|
||||||
|
|
||||||
|
master_members = project.member_principals.includes(:roles, :principal).where("member_roles.role_id=3").all.sort
|
||||||
|
|
||||||
|
master_members.each do |m|
|
||||||
|
if m.user_id == project.user_id
|
||||||
|
master_members.delete(m)
|
||||||
|
master_members.insert(0,m)
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
develop_members = project.member_principals.includes(:roles, :principal).where("member_roles.role_id=4").all.sort
|
||||||
|
report_members = project.member_principals.includes(:roles, :principal).where("member_roles.role_id=5").all.sort
|
||||||
|
|
||||||
|
present :master_members,master_members, with: Mobile::Entities::ProjectMember
|
||||||
|
present :develop_members,develop_members, with: Mobile::Entities::ProjectMember
|
||||||
|
present :report_members,report_members, with: Mobile::Entities::ProjectMember
|
||||||
|
present :status, 0
|
||||||
|
end
|
||||||
|
|
||||||
|
desc "获取项目某成员角色信息"
|
||||||
|
params do
|
||||||
|
requires :id, type: Integer
|
||||||
|
requires :token, type: String
|
||||||
|
requires :user_id, type: Integer
|
||||||
|
end
|
||||||
|
post 'get_member_info' do
|
||||||
|
authenticate!
|
||||||
|
|
||||||
|
project = Project.find("#{params[:id]}")
|
||||||
|
|
||||||
|
my_member = project.member_principals.where("users.id=#{params[:user_id]}").first
|
||||||
|
|
||||||
|
if my_member && my_member.roles[0]
|
||||||
|
present :project_id,params[:id]
|
||||||
|
present :user_id,params[:user_id]
|
||||||
|
present :member_info,my_member, with: Mobile::Entities::ProjectMember
|
||||||
|
present :status, 0
|
||||||
|
else
|
||||||
|
present :status, -1
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
desc "修改项目某成员角色信息"
|
||||||
|
params do
|
||||||
|
requires :id, type: Integer
|
||||||
|
requires :token, type: String
|
||||||
|
requires :user_id, type: Integer
|
||||||
|
requires :role_id, type: Integer
|
||||||
|
end
|
||||||
|
post 'edit_member_role' do
|
||||||
|
authenticate!
|
||||||
|
|
||||||
|
project = Project.find("#{params[:id]}")
|
||||||
|
|
||||||
|
my_member = project.member_principals.where("users.id=#{current_user.id}").first
|
||||||
|
|
||||||
|
#3管理 4开发 5报告
|
||||||
|
if !(my_member && my_member.roles[0] && my_member.roles[0].id == 3 ) || project.user_id == params[:user_id] || !(params[:role_id] == 3 || params[:role_id] == 4 || params[:role_id] == 5)
|
||||||
|
present :status, -1
|
||||||
|
else
|
||||||
|
ps = ProjectsService.new
|
||||||
|
|
||||||
|
status = ps.modify_user_project_role params
|
||||||
|
|
||||||
|
present :status, status
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
desc "新建项目"
|
||||||
|
params do
|
||||||
|
requires :token, type: String
|
||||||
|
requires :name, type: String, desc: '项目名称'
|
||||||
|
end
|
||||||
|
post 'create' do
|
||||||
|
authenticate!
|
||||||
|
|
||||||
|
ps = ProjectsService.new
|
||||||
|
|
||||||
|
status = ps.createNewProject params,current_user
|
||||||
|
|
||||||
|
|
||||||
|
present :status, 0
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
desc "加入项目"
|
||||||
|
params do
|
||||||
|
requires :token, type: String
|
||||||
|
requires :invite_code, type: String, desc: '邀请码'
|
||||||
|
end
|
||||||
|
post "join" do
|
||||||
|
authenticate!
|
||||||
|
|
||||||
|
# ps = ProjectsService.new
|
||||||
|
# status = ps.join_project({role: "5", openid: params[:openid], invite_code: params[:invite_code]}, current_user)
|
||||||
|
#
|
||||||
|
# present :status, status
|
||||||
|
|
||||||
|
{status:-1, message: '该功能将在近日开放,敬请期待!' }
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,32 @@
|
|||||||
|
module Mobile
|
||||||
|
module Entities
|
||||||
|
class Project < Grape::Entity
|
||||||
|
expose :name
|
||||||
|
expose :id
|
||||||
|
expose :user_id
|
||||||
|
# expose :invite_code
|
||||||
|
# expose :qrcode
|
||||||
|
expose :can_setting, if: lambda { |instance, options| options[:user] } do |instance, options|
|
||||||
|
current_user = options[:user]
|
||||||
|
|
||||||
|
my_member = instance.member_principals.where("users.id=#{current_user.id}").first
|
||||||
|
can_setting = false
|
||||||
|
if my_member && my_member.roles[0] && my_member.roles[0].id == 3
|
||||||
|
can_setting = true
|
||||||
|
end
|
||||||
|
can_setting
|
||||||
|
end
|
||||||
|
|
||||||
|
expose :is_creator, if: lambda { |instance, options| options[:user] } do |instance, options|
|
||||||
|
current_user = options[:user]
|
||||||
|
|
||||||
|
current_user.id == instance.user_id
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
expose :member_count, if: lambda { |instance, options| options[:user] } do |instance, options|
|
||||||
|
instance.members.count
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,35 @@
|
|||||||
|
module Mobile
|
||||||
|
module Entities
|
||||||
|
class ProjectMember < Grape::Entity
|
||||||
|
include Redmine::I18n
|
||||||
|
include ApplicationHelper
|
||||||
|
include ApiHelper
|
||||||
|
def self.member_expose(f)
|
||||||
|
expose f do |u,opt|
|
||||||
|
if u.is_a?(Hash) && u.key?(f)
|
||||||
|
u[f]
|
||||||
|
elsif u.is_a?(::Member)
|
||||||
|
if u.respond_to?(f)
|
||||||
|
u.send(f)
|
||||||
|
else
|
||||||
|
case f
|
||||||
|
when :roles_id
|
||||||
|
u.roles[0].id
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
expose :user, using: Mobile::Entities::User do |c, opt|
|
||||||
|
if c.is_a?(::Member)
|
||||||
|
c.user
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
member_expose :roles_id
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,13 @@
|
|||||||
|
#coding=utf-8
|
||||||
|
#
|
||||||
|
module Mobile
|
||||||
|
module Exceptions
|
||||||
|
class AuthException < StandardError
|
||||||
|
attr_reader :err_code, :msg
|
||||||
|
def initialize(code, msg)
|
||||||
|
@err_code = code
|
||||||
|
@msg = msg
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,145 @@
|
|||||||
|
#coding=utf-8
|
||||||
|
|
||||||
|
class ProjectsService
|
||||||
|
|
||||||
|
include ApplicationHelper
|
||||||
|
|
||||||
|
#获取指定用户的项目列表
|
||||||
|
def user_projects(user)
|
||||||
|
projects = user.projects.not_deleted.select("projects.*,(SELECT MAX(updated_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS updated_at ").order("updated_at desc")
|
||||||
|
projects
|
||||||
|
end
|
||||||
|
|
||||||
|
#显示项目
|
||||||
|
def show_project(params,current_user)
|
||||||
|
project = Project.find(params[:id])
|
||||||
|
# project.generate_invite_code
|
||||||
|
# project.generate_qrcode
|
||||||
|
|
||||||
|
project
|
||||||
|
end
|
||||||
|
|
||||||
|
def send_wechat_create_project_notice user,project
|
||||||
|
count = ShieldWechatMessage.where("container_type='User' and container_id=#{user.id} and shield_type='Project' and shield_id=#{project.id}").count
|
||||||
|
Rails.logger.info "!!!!!!!!!!!!!!!!!!!!!!#{project}"
|
||||||
|
if count == 0
|
||||||
|
ws = WechatService.new
|
||||||
|
title = "恭喜您创建项目成功。"
|
||||||
|
ws.create_project_notice user.id, "create_project_notice", project.id,title, project.name, format_time(project.created_on),"点击查看项目详情。"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
def createNewProject params,user
|
||||||
|
status = -1
|
||||||
|
issue_custom_fields = IssueCustomField.sorted.all
|
||||||
|
trackers = Tracker.sorted.all
|
||||||
|
project = Project.new
|
||||||
|
|
||||||
|
project[:name] = params[:name]
|
||||||
|
project[:description] = ''
|
||||||
|
project[:is_public] = '0' #公开
|
||||||
|
project[:project_type] = 0
|
||||||
|
project[:project_new_type] = 1
|
||||||
|
project[:identifier] = Project.next_identifier if Setting.sequential_project_identifiers?
|
||||||
|
|
||||||
|
project.organization_id = params[:organization_id]
|
||||||
|
project.user_id = user.id
|
||||||
|
|
||||||
|
# if validate_parent_id && @project.save
|
||||||
|
if project.save
|
||||||
|
p = Project.find("#{project.id}")
|
||||||
|
send_wechat_create_project_notice user,p
|
||||||
|
r = Role.givable.find_by_id(Setting.new_project_user_role_id.to_i) || Role.givable.first
|
||||||
|
m = Member.new(:user => user, :roles => [r])
|
||||||
|
# project's score
|
||||||
|
if ProjectScore.where("project_id=?", project.id).first.nil?
|
||||||
|
ProjectScore.create(:project_id => project.id, :score => false)
|
||||||
|
end
|
||||||
|
# end
|
||||||
|
project_info = ProjectInfo.new(:user_id => user.id, :project_id => project.id)
|
||||||
|
user_grades = UserGrade.create(:user_id => user.id, :project_id => project.id)
|
||||||
|
project_status = ProjectStatus.create(:project_id => project.id, :watchers_count => 0, :changesets_count => 0, :project_type => project.project_type,:grade => 0)
|
||||||
|
project.members << m
|
||||||
|
project.project_infos << project_info
|
||||||
|
status = 0
|
||||||
|
end
|
||||||
|
status
|
||||||
|
end
|
||||||
|
|
||||||
|
#修改项目成员角色
|
||||||
|
def modify_user_project_role params
|
||||||
|
status = -1
|
||||||
|
|
||||||
|
project = Project.find("#{params[:id]}")
|
||||||
|
|
||||||
|
member = project.member_principals.includes(:roles, :principal).where("user_id=?",params[:user_id]).first
|
||||||
|
|
||||||
|
if member
|
||||||
|
member.member_roles[0].role_id = params[:role_id]
|
||||||
|
|
||||||
|
|
||||||
|
role = Role.find(params[:role_id])
|
||||||
|
if role.allowed_to?(:is_manager)
|
||||||
|
projectInfo = ProjectInfo.new(:user_id => member.user_id, :project_id => project.id)
|
||||||
|
projectInfo.save
|
||||||
|
else
|
||||||
|
user_admin = ProjectInfo.where("user_id = ? and project_id = ?", member.user_id, project.id)
|
||||||
|
if user_admin.size > 0
|
||||||
|
user_admin.each do |user|
|
||||||
|
user.destroy
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if member.member_roles[0].save
|
||||||
|
status = 0
|
||||||
|
end
|
||||||
|
end
|
||||||
|
status
|
||||||
|
end
|
||||||
|
|
||||||
|
class JoinProjectError < Errors
|
||||||
|
define_error [
|
||||||
|
0, '加入成功',
|
||||||
|
1, '您的邀请码不正确',
|
||||||
|
2, '您还未登录',
|
||||||
|
3, '您已经是该项目的管理人员',
|
||||||
|
4, '您已经是该项目的开发人员',
|
||||||
|
5, '您已经是该项目的报告人员',
|
||||||
|
6, '该项目不存在或已被删除啦',
|
||||||
|
'未知错误,请稍后再试'
|
||||||
|
]
|
||||||
|
end
|
||||||
|
|
||||||
|
def join_project params,current_user
|
||||||
|
status = -1
|
||||||
|
project = project.find_by_invite_code(params[:invite_code]) if params[:invite_code]
|
||||||
|
|
||||||
|
if project
|
||||||
|
if project[:is_delete] == 1
|
||||||
|
status = 6
|
||||||
|
else
|
||||||
|
if current_user.member_of?(project) #如果已经是成员
|
||||||
|
member = project.member_principals.includes(:roles, :principal).where("user_id=?",current_user.id).first
|
||||||
|
status = member.member_roles[0].role_id
|
||||||
|
else
|
||||||
|
if params[:invite_code].present?
|
||||||
|
members = []
|
||||||
|
members << Member.new(:role_ids => [5], :user_id => current_user.id)
|
||||||
|
project.members << members
|
||||||
|
projectInfo = ProjectInfo.new(:user_id => current_user.id, :project_id => project.id)
|
||||||
|
projectInfo.save
|
||||||
|
status = 0
|
||||||
|
else
|
||||||
|
status = 4
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
status = 4
|
||||||
|
end
|
||||||
|
status
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
@ -0,0 +1,55 @@
|
|||||||
|
<%= 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,147 @@
|
|||||||
|
<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;" class = "<%= @order == 'name' ? (@sort == 'desc' ? 'st_up' : (@sort == 'asc' ? 'st_down' : '')) : '' %>">
|
||||||
|
<%= link_to '单位名称', apply_shcool_sort_path(:sort=> @sort == "desc" ? 'asc' : 'desc', :order => 'name', :tip=>'unapplied') %>
|
||||||
|
</th>
|
||||||
|
<th style="width: 30px;">
|
||||||
|
申请者
|
||||||
|
</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 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),:target => '_blank' %>
|
||||||
|
<% end %>
|
||||||
|
</td>
|
||||||
|
<td class="center">
|
||||||
|
<span ondblclick = "show_edit_school_province('<%= apply.id %>');" id="apply_province_<%= apply.id %>">
|
||||||
|
<%= (apply.province.nil? ? "" : apply.province) + (apply.city.nil? ? "" : apply.city) %>
|
||||||
|
</span>
|
||||||
|
<select onchange="showcity(this.value, document.getElementById('schoolCity_<%=apply.id%>'));edit_school_province('<%= edit_apply_province_school_path(apply.id)%>','<%= apply.id %>');" name="province" id="school_province_edit_<%=apply.id%>" class="fl" style="width:50px; height:18px; display: none">
|
||||||
|
<option value="北京">北京</option>
|
||||||
|
<option value="上海">上海</option>
|
||||||
|
<option value="广东">广东</option>
|
||||||
|
<option value="江苏">江苏</option>
|
||||||
|
<option value="浙江">浙江</option>
|
||||||
|
<option value="重庆">重庆</option>
|
||||||
|
<option value="安徽">安徽</option>
|
||||||
|
<option value="福建">福建</option>
|
||||||
|
<option value="甘肃">甘肃</option>
|
||||||
|
<option value="广西">广西</option>
|
||||||
|
<option value="贵州">贵州</option>
|
||||||
|
<option value="海南">海南</option>
|
||||||
|
<option value="河北">河北</option>
|
||||||
|
<option value="黑龙江">黑龙江</option>
|
||||||
|
<option value="河南">河南</option>
|
||||||
|
<option value="湖北">湖北</option>
|
||||||
|
<option value="湖南">湖南</option>
|
||||||
|
<option value="江西">江西</option>
|
||||||
|
<option value="吉林">吉林</option>
|
||||||
|
<option value="辽宁">辽宁</option>
|
||||||
|
<option value="内蒙古">内蒙古</option>
|
||||||
|
<option value="宁夏">宁夏</option>
|
||||||
|
<option value="青海">青海</option>
|
||||||
|
<option value="山东">山东</option>
|
||||||
|
<option value="山西">山西</option>
|
||||||
|
<option value="陕西">陕西</option>
|
||||||
|
<option value="四川">四川</option>
|
||||||
|
<option value="天津">天津</option>
|
||||||
|
<option value="新疆">新疆</option>
|
||||||
|
<option value="西藏">西藏</option>
|
||||||
|
<option value="云南">云南</option>
|
||||||
|
<option value="香港">香港特别行政区</option>
|
||||||
|
<option value="澳门">澳门特别行政区</option>
|
||||||
|
<option value="台湾">台湾</option>
|
||||||
|
<option value="海外">海外</option>
|
||||||
|
</select>
|
||||||
|
<select onchange="edit_school_province('<%= edit_apply_province_school_path(apply.id)%>','<%= apply.id %>');" name="city" id="schoolCity_<%=apply.id%>" class="fl ml5" style="width:50px; height:18px; display: none"></select>
|
||||||
|
</td>
|
||||||
|
<td class="center">
|
||||||
|
<span title="双击可编辑" ondblclick = "show_edit_school_address('<%= apply.id %>');" id="apply_address_<%= apply.id %>"><%= apply.address %></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_address_edit_<%=apply.id%>" onblur="edit_school_address('<%= edit_apply_address_school_path(apply.id)%>','<%= apply.id %>');"><%= apply.address %></textarea>
|
||||||
|
</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 => "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), :class => "application-default-link") %>
|
||||||
|
<%=link_to '更改', admin_all_schools_path(:school_id =>apply.id), :remote => true, :class => "application-default-link" %>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<script>
|
||||||
|
init_province_and_city(document.getElementById('school_province_edit_<%=apply.id%>'), '<%=apply.province%>', document.getElementById('schoolCity_<%=apply.id%>'), '<%=apply.city%>');
|
||||||
|
</script>
|
||||||
|
<% unless apply.remarks.blank? %>
|
||||||
|
<tr class="odd">
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td style="text-align: left;" colspan="6">
|
||||||
|
<%= apply.remarks %>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</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>
|
@ -0,0 +1,143 @@
|
|||||||
|
<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: 80px;">
|
||||||
|
单位名称
|
||||||
|
</th>
|
||||||
|
<th style="width: 30px;">
|
||||||
|
申请者
|
||||||
|
</th>
|
||||||
|
<th style="width: 95px;">
|
||||||
|
地区
|
||||||
|
</th>
|
||||||
|
<th style="width: 75px;">
|
||||||
|
详细地址
|
||||||
|
</th>
|
||||||
|
<th style="width: 85px;">
|
||||||
|
原名
|
||||||
|
</th>
|
||||||
|
<th style="width: 30px;">
|
||||||
|
用户
|
||||||
|
</th>
|
||||||
|
<th style="width: 65px;">
|
||||||
|
创建时间
|
||||||
|
</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 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>
|
||||||
|
<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 %>');"><%= school_name %></textarea>
|
||||||
|
<% end %>
|
||||||
|
</td>
|
||||||
|
<td class="center">
|
||||||
|
<% user = User.where("id=?", apply.user_id).first%>
|
||||||
|
<% unless user.nil? %>
|
||||||
|
<%=link_to user.show_name, user_path(user), :target => '_blank'%>
|
||||||
|
<% end %>
|
||||||
|
</td>
|
||||||
|
<td class="center">
|
||||||
|
<span ondblclick = "show_edit_school_province('<%= apply.id %>');" id="apply_province_<%= apply.id %>">
|
||||||
|
<%= (apply.province.nil? ? "" : apply.province) + (apply.city.nil? ? "" : apply.city) %>
|
||||||
|
</span>
|
||||||
|
<select onchange="showcity(this.value, document.getElementById('schoolCity_<%=apply.id%>'));edit_school_province('<%= edit_apply_province_school_path(apply.id)%>','<%= apply.id %>');" name="province" id="school_province_edit_<%=apply.id%>" class="fl" style="width:50px; height:18px; display: none">
|
||||||
|
<option value="北京">北京</option>
|
||||||
|
<option value="上海">上海</option>
|
||||||
|
<option value="广东">广东</option>
|
||||||
|
<option value="江苏">江苏</option>
|
||||||
|
<option value="浙江">浙江</option>
|
||||||
|
<option value="重庆">重庆</option>
|
||||||
|
<option value="安徽">安徽</option>
|
||||||
|
<option value="福建">福建</option>
|
||||||
|
<option value="甘肃">甘肃</option>
|
||||||
|
<option value="广西">广西</option>
|
||||||
|
<option value="贵州">贵州</option>
|
||||||
|
<option value="海南">海南</option>
|
||||||
|
<option value="河北">河北</option>
|
||||||
|
<option value="黑龙江">黑龙江</option>
|
||||||
|
<option value="河南">河南</option>
|
||||||
|
<option value="湖北">湖北</option>
|
||||||
|
<option value="湖南">湖南</option>
|
||||||
|
<option value="江西">江西</option>
|
||||||
|
<option value="吉林">吉林</option>
|
||||||
|
<option value="辽宁">辽宁</option>
|
||||||
|
<option value="内蒙古">内蒙古</option>
|
||||||
|
<option value="宁夏">宁夏</option>
|
||||||
|
<option value="青海">青海</option>
|
||||||
|
<option value="山东">山东</option>
|
||||||
|
<option value="山西">山西</option>
|
||||||
|
<option value="陕西">陕西</option>
|
||||||
|
<option value="四川">四川</option>
|
||||||
|
<option value="天津">天津</option>
|
||||||
|
<option value="新疆">新疆</option>
|
||||||
|
<option value="西藏">西藏</option>
|
||||||
|
<option value="云南">云南</option>
|
||||||
|
<option value="香港">香港特别行政区</option>
|
||||||
|
<option value="澳门">澳门特别行政区</option>
|
||||||
|
<option value="台湾">台湾</option>
|
||||||
|
<option value="海外">海外</option>
|
||||||
|
</select>
|
||||||
|
<select onchange="edit_school_province('<%= edit_apply_province_school_path(apply.id)%>','<%= apply.id %>');" name="city" id="schoolCity_<%=apply.id%>" class="fl ml5" style="width:50px; height:18px; display: none"></select>
|
||||||
|
</td>
|
||||||
|
<td class="center">
|
||||||
|
<span title="双击可编辑" ondblclick = "show_edit_school_address('<%= apply.id %>');" id="apply_address_<%= apply.id %>"><%= apply.address %></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_address_edit_<%=apply.id%>" onblur="edit_school_address('<%= edit_apply_address_school_path(apply.id)%>','<%= apply.id %>');"><%= apply.address %></textarea>
|
||||||
|
</td>
|
||||||
|
<td class="center">
|
||||||
|
<%= apply.name %>
|
||||||
|
</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(:button_delete), { :controller => 'admin', :action => 'delete_applied_schools', :id => apply.id, :tip => 'applied' },:method => :delete, :confirm => l(:text_are_you_sure) ) %>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<script>
|
||||||
|
init_province_and_city(document.getElementById('school_province_edit_<%=apply.id%>'), '<%=apply.province%>', document.getElementById('schoolCity_<%=apply.id%>'), '<%=apply.city%>');
|
||||||
|
</script>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</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>
|
@ -0,0 +1,29 @@
|
|||||||
|
<div class="sy_popup_top">
|
||||||
|
<h3 class="fl">欢迎加入项目</h3>
|
||||||
|
<a href="javascript:void(0);" class="sy_icons_close fr" onclick="hideModal()"></a>
|
||||||
|
<div class="cl"></div>
|
||||||
|
</div>
|
||||||
|
<div class="sy_popup_con" style="width:370px;">
|
||||||
|
<%= form_tag( url_for(:controller => 'applied_project', :action => 'applied_project_info', :project_id => (@project.nil? ? nil : @project.id)), :remote => true, :id => 'project_applied_form') do %>
|
||||||
|
<ul class="sy_popup_add ">
|
||||||
|
<li>
|
||||||
|
<label >项目邀请码:</label>
|
||||||
|
<input name="invite_code" class=" sy_input_txt fl" placeholder="请输入六位项目邀请码" style="width:250px"/>
|
||||||
|
<div class="cl"></div>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<label >身份:</label>
|
||||||
|
<input name="member" value="member_manager" type="radio" class="ml5 mr5 " /><span class="mr10">管理人员</span>
|
||||||
|
<input name="member" value="member_developer" type="radio" class="ml5 mr5 " /><span class="mr10">开发人员</span>
|
||||||
|
<input name="member" value="member_reporter" type="radio" class="ml5 mr5 " /><span class="mr10">报告人员</span>
|
||||||
|
<div class="cl"></div>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<label class="mr27"> </label>
|
||||||
|
<a href="javascript:void(0);" class="sy_btn_blue fl" onclick="$('#project_applied_form').submit();hideModal()">确 定</a>
|
||||||
|
<a href="javascript:void(0);" class="sy_btn_grey fl ml20" onclick="hideModal()">取 消</a>
|
||||||
|
<div class="cl"></div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
@ -0,0 +1,27 @@
|
|||||||
|
<div id="sy_popup_box" style="width:380px;">
|
||||||
|
<div class="sy_popup_top sy_popup_top_tishi">
|
||||||
|
<h3 class="fl">提示</h3>
|
||||||
|
<a href="javascript:void(0);" class="sy_icons_close02 fr" onclick="hideModal()"></a>
|
||||||
|
<div class="cl"></div>
|
||||||
|
</div>
|
||||||
|
<div class="sy_popup_con02" >
|
||||||
|
<ul class="sy_popup_tishi ">
|
||||||
|
<li>
|
||||||
|
<% if @flag == 1 %>
|
||||||
|
<p>您输入的邀请码错误</p>
|
||||||
|
<% elsif @flag == 2 %>
|
||||||
|
<p>您已经是该项目成员</p>
|
||||||
|
<% elsif @flag == 3 %>
|
||||||
|
<p>请选择一个角色</p>
|
||||||
|
<% elsif @flag == 4 %>
|
||||||
|
<p>您的申请已提交,请等待项目管理员审批</p>
|
||||||
|
<% elsif @flag == 5 %>
|
||||||
|
<p>您已经申请加入该项目了,请耐心等待</p>
|
||||||
|
<% end %>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="javascript:void(0);" class="sy_btn_blue " onclick="hideModal()">知道了</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
@ -0,0 +1,5 @@
|
|||||||
|
<% if @project %>
|
||||||
|
$("#join_in_project_applied").html('<%= escape_javascript( render :partial => 'projects/applied_status') %>');
|
||||||
|
<% end %>
|
||||||
|
var htmlvalue = "<%= escape_javascript(render :partial => 'applied_project/applied_project_tip') %>";
|
||||||
|
pop_box_new(htmlvalue,380,40,50);
|
@ -0,0 +1,52 @@
|
|||||||
|
<% if @object_id && @state != 6 && @state !=4 %>
|
||||||
|
$("#join_in_course_header").html("<%= escape_javascript(join_in_course_header(@course, @user)) %>");
|
||||||
|
<% end %>
|
||||||
|
<% if @state %>
|
||||||
|
<% if @state == 0 %>
|
||||||
|
alert("加入成功");
|
||||||
|
hideModal();
|
||||||
|
$("#try_join_course_link").replaceWith("<a href='<%=url_for(:controller => 'homework_common', :action => 'index',:course=>@course.id, :host=>Setting.host_course)%>' target='_blank' class='blue_n_btn fr mt20'>提交作品</a>");
|
||||||
|
window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>"
|
||||||
|
<% elsif @state == 1 %>
|
||||||
|
alert("密码错误");
|
||||||
|
<% elsif @state == 2 %>
|
||||||
|
alert("班级已过期\n请联系班级管理员重启班级。(在配置班级处)");
|
||||||
|
<% elsif @state == 3 %>
|
||||||
|
alert("您已经加入了班级");
|
||||||
|
window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>"
|
||||||
|
<% elsif @state == 4 %>
|
||||||
|
alert("您加入的班级不存在");
|
||||||
|
<% elsif @state == 5 %>
|
||||||
|
alert("您还未登录");
|
||||||
|
<% elsif @state == 6 %>
|
||||||
|
alert("申请成功,请等待审核");
|
||||||
|
hidden_join_course_form();
|
||||||
|
<% elsif @state == 7%>
|
||||||
|
alert("您已经发送过申请了,请耐心等待");
|
||||||
|
hidden_join_course_form();
|
||||||
|
<% elsif @state == 8%>
|
||||||
|
alert("您已经是该班级的教师了");
|
||||||
|
hidden_join_course_form();
|
||||||
|
window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>"
|
||||||
|
<% elsif @state == 9%>
|
||||||
|
alert("您已经是该班级的教辅了");
|
||||||
|
hidden_join_course_form();
|
||||||
|
window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>"
|
||||||
|
<% elsif @state == 10%>
|
||||||
|
alert("您已经是该班级的管理员了");
|
||||||
|
hidden_join_course_form();
|
||||||
|
window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>"
|
||||||
|
<% elsif @state == 11%>
|
||||||
|
alert("该班级已被删除");
|
||||||
|
hidden_join_course_form();
|
||||||
|
window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>"
|
||||||
|
<% elsif @state == 12 %>
|
||||||
|
alert("您已经发送过申请了,请耐心等待");
|
||||||
|
window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>"
|
||||||
|
<% elsif @state == 13 %>
|
||||||
|
alert("申请成功,请等待审核");
|
||||||
|
window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>"
|
||||||
|
<% else %>
|
||||||
|
alert("未知错误,请稍后再试");
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
@ -1,11 +1,2 @@
|
|||||||
$('#topnav_course_menu').hide();
|
var htmlvalue = "<%= escape_javascript(render :partial => 'join_private_course') %>";
|
||||||
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'join_private_course') %>');
|
pop_box_new(htmlvalue,460,40,50);
|
||||||
showModal('ajax-modal', '540px');
|
|
||||||
$('#ajax-modal').css('height','390px');
|
|
||||||
//$('#ajax-modal').siblings().remove();
|
|
||||||
$('#ajax-modal').siblings().hide();
|
|
||||||
$('#ajax-modal').before("<span style='float: right;cursor:pointer;padding-left: 513px;'>" +
|
|
||||||
"<a href='javascript:' onclick='hidden_join_course_form();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
|
|
||||||
$('#ajax-modal').parent().removeClass("alert_praise");
|
|
||||||
$('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9");
|
|
||||||
$('#ajax-modal').parent().addClass("alert_box");
|
|
||||||
|
@ -0,0 +1,5 @@
|
|||||||
|
<% if @flash_message %>
|
||||||
|
alert("<%= @flash_message %>");
|
||||||
|
<% else%>
|
||||||
|
$("#applied_project_<%= @applied_message.id %>").html('<%= render :partial => "users/user_message_applide_action", :locals =>{:ma => @applied_message} %>');
|
||||||
|
<% end%>
|
@ -0,0 +1 @@
|
|||||||
|
$("#applied_project_<%= @applied_message.id %>").html('<%= render :partial => "users/user_message_applide_action", :locals =>{:ma => @applied_message} %>');
|
@ -0,0 +1,9 @@
|
|||||||
|
<% if !User.current.member_of?(@project) && User.current.login? && !User.current.admin %>
|
||||||
|
<span><%= watcher_link_for_project(@project, User.current) %></span>
|
||||||
|
<!--加入项目 -->
|
||||||
|
<% if AppliedProject.where(:user_id => User.current, :project_id => @project_id).first.nil? %>
|
||||||
|
<%= join_in_project_link(@project, User.current) %>
|
||||||
|
<% else %>
|
||||||
|
等待审批
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
@ -1,39 +0,0 @@
|
|||||||
<ul>
|
|
||||||
<% comments.each do |comment| %>
|
|
||||||
<script type="text/javascript">
|
|
||||||
$(function(){
|
|
||||||
showNormalImage('reply_content_<%= comment.id %>');
|
|
||||||
autoUrl('reply_content_<%= comment.id %>');
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
<li class="homepagePostReplyContainer" nhname="reply_rec">
|
|
||||||
<div class="homepagePostReplyPortrait">
|
|
||||||
<%= link_to image_tag(url_to_avatar(comment.creator_user), :width => 33, :height => 33, :alt => "用户头像"), user_url_in_org(comment.creator_user.id) %>
|
|
||||||
</div>
|
|
||||||
<div class="homepagePostReplyDes">
|
|
||||||
<div class="homepagePostReplyPublisher">
|
|
||||||
<%= link_to comment.creator_user.show_name, user_url_in_org(comment.creator_user.id), :class => "newsBlue mr10 f14" %>
|
|
||||||
<%= time_from_now(comment.created_time) %>
|
|
||||||
<span id="reply_praise_count_<%=comment.id %>">
|
|
||||||
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<% if !comment.content_detail.blank? || comment.class == Journal %>
|
|
||||||
<div class="homepagePostReplyContent break_word list_style upload_img table_maxWidth" id="reply_content_<%= comment.id %>">
|
|
||||||
<% if comment.class == Journal %>
|
|
||||||
<% if comment.details.any? %>
|
|
||||||
<% details_to_strings(comment.details).each do |string| %>
|
|
||||||
<p><%= string %></p>
|
|
||||||
<% end %>
|
|
||||||
<% end %>
|
|
||||||
<P><%= comment.notes.html_safe %></P>
|
|
||||||
<% else %>
|
|
||||||
<%= comment.content_detail.html_safe %>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
<div class="cl"></div>
|
|
||||||
</li>
|
|
||||||
<% end %>
|
|
||||||
</ul>
|
|
@ -0,0 +1,30 @@
|
|||||||
|
<% unless courses.nil? %>
|
||||||
|
<% courses.each_with_index do |course, i| %>
|
||||||
|
<li class="syllabus_class_list <%=i > 2 ? 'none' : '' %>">
|
||||||
|
<% allow_visit = User.current.member_of_course?(course) || User.current.admin? || course.is_public == 1 %>
|
||||||
|
<a href="<%= allow_visit ? course_path(course.id) : "javascript:void(0)" %>" target="_blank" title="<%= allow_visit ? "" : "私有班级不可访问"%>">
|
||||||
|
<span class="icons_sy_cir "></span>
|
||||||
|
<div class="fl">
|
||||||
|
<div class="syllabus_class_w ">
|
||||||
|
<p class="syllabus_class_title fl"><%=course.name %></p>
|
||||||
|
<span class="<%= course.is_public == 0 ? 'hw_icon_private' : 'hw_icon_open' %> fl"></span>
|
||||||
|
<span class="fr sy_p_grey hidden" style="max-width: 120px;">主讲老师:<%=course.teacher.show_name %></span>
|
||||||
|
<div class="cl"></div>
|
||||||
|
</div>
|
||||||
|
<div class="">
|
||||||
|
<p class="fl grayTxt ">更新:<%=format_date Time.at(course.updatetime) %><span class="mr10"></span>学期:<%=current_time_and_term(course) %></p>
|
||||||
|
<p class="list-info fr grayTxt"><span><%=studentCount course %></span><span>学生</span><span>|</span><span><%=visable_course_homework course %></span><span>作业</span><span>|</span><span><%=visable_attachemnts_incourse(course).count %></span><span>资源</span></p>
|
||||||
|
<div class="cl"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<span class="icons_sy_arrow fl mt19 ml10" ></span>
|
||||||
|
<div class="cl"></div>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<% end %>
|
||||||
|
<% if courses.count > 3 %>
|
||||||
|
<li class="syllabus_class_list_more" id="syllabus_class_list_more_<%=syllabus.id %>">
|
||||||
|
<a href="javascript:void(0);" id="expand_list_<%=syllabus.id %>" data-init="0" onclick="expand_course_list(<%=syllabus.id %>,'#syllabus_course_ul_<%=syllabus.id %> li','#expand_list_<%=syllabus.id %>',<%=courses.count %>)">共<%=courses.count %>个班级,点击全部展开</a>
|
||||||
|
</li>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
@ -0,0 +1,61 @@
|
|||||||
|
<div class="syllabus_category">
|
||||||
|
<% if @type.to_i == 2 %>
|
||||||
|
<%= link_to "", {:controller => 'users', :action => 'sort_syllabus_list', :id =>@user,:list_type => list_type, :type => @type, :sort => @c_sort, :order => 2 }, :class => "#{@c_sort.to_i == 1 ? 'sortupbtn' : 'sortdownbtn'} fr", :style => "margin-right: 5px;", :remote => true %>
|
||||||
|
<% else %>
|
||||||
|
<%= link_to "", {:controller => 'users', :action => 'sort_syllabus_list', :id =>@user,:list_type => list_type, :type => @type, :sort => @c_sort, :order => 2 }, :class => "sortdownbtn sort_no fr", :style => "margin-right: 5px;", :remote => true %>
|
||||||
|
<% end %>
|
||||||
|
<%= link_to "人气", {:controller => 'users', :action => 'sort_syllabus_list', :id =>@user,:list_type => list_type, :type => @type, :sort => @c_sort, :order => 2 }, :class => "sortTxt fr", :remote => true %>
|
||||||
|
<% if @type.to_i == 1 %>
|
||||||
|
<%= link_to "", {:controller => 'users', :action => 'sort_syllabus_list', :id =>@user,:list_type => list_type, :type => @type, :sort => @c_sort, :order => 1 }, :class => "#{@c_sort.to_i == 1 ? 'sortupbtn' : 'sortdownbtn'} fr", :remote => true %>
|
||||||
|
<% else %>
|
||||||
|
<%= link_to "", {:controller => 'users', :action => 'sort_syllabus_list', :id =>@user,:list_type => list_type, :type => @type, :sort => @c_sort, :order => 1 }, :class => "sortdownbtn sort_no fr", :remote => true %>
|
||||||
|
<% end %>
|
||||||
|
<%= link_to "时间", {:controller => 'users', :action => 'sort_syllabus_list', :id =>@user,:list_type => list_type, :type => @type, :sort => @c_sort, :order => 1 }, :class => "sortTxt fr", :remote => true %>
|
||||||
|
<span class="grayTxt fl "><%=@user == User.current ? "我" : "他" %><%= list_type == 1 ? "创建" : "加入"%>的课程</span>
|
||||||
|
<div class="cl"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<% if syllabuses.any? %>
|
||||||
|
<% syllabuses.each_with_index do |syllabus, index|%>
|
||||||
|
<div class="syllabus_courses_box">
|
||||||
|
<% course_count = syllabus.courses.not_deleted.count %>
|
||||||
|
<div class="syllabus_courses_list" onclick="expand_courses(<%=syllabus.id %>,<%=course_count %>);" id="syllabus_courses_list_<%= syllabus.id %>">
|
||||||
|
<div class="<%=index == 0 ? 'sy_courses_open' : 'sy_courses_close' %>">
|
||||||
|
<span class="<%=index == 0 && course_count != 0 ? 'icons_sy_open' : 'icons_sy_close' %> fl mr5"></span>
|
||||||
|
<h3 class="syllabus_courses_title fl"><%=syllabus.title %></h3>
|
||||||
|
</div>
|
||||||
|
<p class="fl sy_p_grey">更新时间:<%=format_date syllabus.updated_at %>
|
||||||
|
<span class="mr10"></span>创建老师:<%=syllabus.user.show_name %>
|
||||||
|
<span class="mr10"></span>班级:<%=course_count %>
|
||||||
|
</p>
|
||||||
|
<div class="cl"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="syllabus_class_box <%=index == 0 ? '' : 'none' %>">
|
||||||
|
<ul id="syllabus_course_ul_<%=syllabus.id %>">
|
||||||
|
<% if index == 0 %>
|
||||||
|
<% courses = syllabus.courses.not_deleted.select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS updatetime").order("updatetime desc") %>
|
||||||
|
<%= render :partial => 'users/courses_list', :locals => {:courses => courses, :syllabus => syllabus}%>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
|
</div><!--syllabus_class_box end-->
|
||||||
|
|
||||||
|
<div class="homepagePostSetting">
|
||||||
|
<ul>
|
||||||
|
<li class="icons_sy_setting">
|
||||||
|
<ul class="homepagePostSettiongText">
|
||||||
|
<li>
|
||||||
|
<%=link_to '查看课程', syllabus_path(syllabus.id), :class => 'postOptionLink',:target =>'_blank', :title => '查看课程' %>
|
||||||
|
</li>
|
||||||
|
<% if User.current == syllabus.user %>
|
||||||
|
<li><%=link_to '删除课程', delete_syllabus_syllabus_path(syllabus), :class => 'postOptionLink', :remote => 'true'%></li>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
<% else %>
|
||||||
|
<p class="nodata"><%= l(:label_no_data) %></p>
|
||||||
|
<% end %>
|
@ -0,0 +1,3 @@
|
|||||||
|
<div id="user_join_syllabus_list">
|
||||||
|
<%= render :partial => "users/syllabus_course_list", :locals => {:syllabuses => @join_syllabuses, :list_type => 2} %>
|
||||||
|
</div>
|
@ -0,0 +1,12 @@
|
|||||||
|
<% if allow_to_show(ma) %>
|
||||||
|
<%= link_to "同意", allow_to_join_project_project_memberships_path(:project_id => ma.project_id, :applied_message_id => ma.id), :remote => true, :method => :post, :class => "link-blue"%> |
|
||||||
|
<%= link_to "拒绝", refused_allow_to_join_project_project_memberships_path(:project_id => ma.project_id, :applied_message_id => ma.id), :remote => true, :method => :get, :class => "link-blue" %>
|
||||||
|
<% elsif ma.status == 4 %>
|
||||||
|
<span class="fontGrey3">被拒绝</span>
|
||||||
|
<% elsif ma.status == 5 %>
|
||||||
|
<span class="fontGrey3">您已拒绝</span>
|
||||||
|
<% elsif ma.status == 6 %>
|
||||||
|
<span class="fontGrey3">已通过</span>
|
||||||
|
<% elsif ma.status == 7 %>
|
||||||
|
<span class="fontGrey3">您已同意</span>
|
||||||
|
<% end %>
|
@ -0,0 +1,2 @@
|
|||||||
|
<%=link_to applied_project_users(ma), user_path(applied_project_users(ma)), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
|
||||||
|
<span class="homepageNewsType fl"><%= applied_project_tip(ma) %></span>
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue