Merge branch 'szzh' into develop
This commit is contained in:
commit
ba518f0bd9
|
@ -30,19 +30,19 @@ class CoursesController < ApplicationController
|
|||
def join
|
||||
if User.current.logged?
|
||||
cs = CoursesService.new
|
||||
join = cs.join_course params,User.current
|
||||
user = User.current
|
||||
join = cs.join_course params,user
|
||||
@state = join[:state]
|
||||
course = join[:course]
|
||||
else
|
||||
@state = 5 #未登录
|
||||
end
|
||||
respond_to do |format|
|
||||
format.js { render :partial => 'set_join', :locals => {:user => User.current, :course => course, :object_id => params[:object_id]} }
|
||||
format.js { render :partial => 'set_join', :locals => {:user => user, :course => course, :object_id => params[:object_id]} }
|
||||
end
|
||||
rescue Exception => e
|
||||
@state = 4 #已经加入了课程
|
||||
respond_to do |format|
|
||||
# format.html { redirect_to_referer_or {render :text => (watching ? 'Watcher added.' : 'Watcher removed.'), :layout => true}}
|
||||
format.js { render :partial => 'set_join', :locals => {:user => User.current, :course => nil, :object_id => nil} }
|
||||
end
|
||||
end
|
||||
|
|
|
@ -677,7 +677,7 @@ module CoursesHelper
|
|||
#加入课程、退出课程按钮
|
||||
def join_in_course_header(course, user, options=[])
|
||||
if user.logged?
|
||||
joined = user.member_of_course? course
|
||||
joined = course.members.map{|member| member.user_id}.include? user.id
|
||||
text = joined ? ("<em class='pr_arrow'></em>".html_safe + l(:label_course_exit_student)) : ("<em class='pr_add'></em>".html_safe + l(:label_course_join_student))
|
||||
url = joined ? join_path(:object_id => course.id) : try_join_path(:object_id => course.id)
|
||||
method = joined ? 'delete' : 'post'
|
||||
|
|
|
@ -33,8 +33,9 @@
|
|||
<p id="bid_evaluation_num_span" class="c_red" style="padding-left: 90px;"></p>
|
||||
</li>
|
||||
<li class="ml45">
|
||||
<label> <%= l(:label_attachment_plural) %> :</label>
|
||||
<label class="fl"> <%= l(:label_attachment_plural) %> :</label>
|
||||
<%= render :partial => 'attachments/new_form', :locals => {:container => bid} %>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<li class=" ml90" >
|
||||
<a class="blue_btn fl c_white" onclick="submit_new_bid('<%= bid_id%>');" href="#"><%= l(:button_create)%></a>
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
<% if object_id%>
|
||||
$("#<%=object_id%>").replaceWith('<%= escape_javascript join_in_course(course, user) %>');
|
||||
$("#join_in_course_header").html("<%= escape_javascript(join_in_course_header(course, user)) %>");
|
||||
<% end %>
|
||||
<% if @state %>
|
||||
<% if @state == 0 %>
|
||||
alert("加入成功");
|
||||
hideModal("#popbox02");
|
||||
<% elsif @state == 1 %>
|
||||
alert("密码错误");
|
||||
<% elsif @state == 2 %>
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'projects/new_join', :locals => {:course => @course}) %>');
|
||||
showModal('ajax-modal', '400px');
|
||||
$('#ajax-modal').addClass('new-watcher');
|
||||
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'projects/new_join', locals: { :course => @course}) %>');
|
||||
showModal('ajax-modal', '500px');
|
||||
$('#ajax-modal').css('height','100px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
|
||||
"<a href='javascript:' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
|
||||
$('#ajax-modal').parent().css("top","").css("left","");
|
||||
$('#ajax-modal').parent().addClass("anonymos");
|
||||
|
|
|
@ -77,7 +77,7 @@
|
|||
<%= set_course_time @course%>
|
||||
<%= link_to "<span class='pr_copy'></span>#{l(:button_copy)}".html_safe, copy_course_course_path(@course.id), :class => "pr_join_a" %>
|
||||
<% else%>
|
||||
<%= join_in_course_header(@course, User.current) %>
|
||||
<div id="join_in_course_header"><%= join_in_course_header(@course, User.current) %></div>
|
||||
<% end%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
|
|
@ -1,62 +1,49 @@
|
|||
<!-- added by fq -->
|
||||
<style>
|
||||
input[type="submit"].bid_btn {
|
||||
vertical-align: middle;
|
||||
width: 60px;/*modified by ming*/
|
||||
height: 25px;
|
||||
line-height: 19px;
|
||||
font-size: 14px;
|
||||
color: rgb(0, 0, 0);
|
||||
background: buttonface;/*url("/images/button/bg103.jpg") no-repeat scroll left top transparent;*/
|
||||
padding: 0px 0px 4px 0px;
|
||||
border-radius: 2px;
|
||||
border: 1px solid rgb(148, 148, 148);
|
||||
box-shadow: none;
|
||||
text-shadow: none;
|
||||
/*margin-top: -10px;*/
|
||||
/*margin-right: -4px;*/
|
||||
}
|
||||
input[type="button"].bid_btn {
|
||||
width: 60px;/*modified by ming*/
|
||||
height: 25px;
|
||||
line-height: 19px;
|
||||
font-size: 14px;
|
||||
color: rgb(0, 0, 0);
|
||||
background: buttonface;/*url("/images/button/bg103.jpg") no-repeat scroll left top transparent;*/
|
||||
padding: 0px 0px 4px 0px;
|
||||
border-radius: 2px;
|
||||
border: 1px solid rgb(148, 148, 148);
|
||||
box-shadow: none;
|
||||
text-shadow: none;
|
||||
/*margin-top: -10px;*/
|
||||
margin-right: -2px;
|
||||
}
|
||||
textarea:focus {
|
||||
border: #d5dee9 1px solid;
|
||||
}
|
||||
</style>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<style>
|
||||
/* 匿名评分弹框 */
|
||||
.anonymos{width:480px;height:180px;position:fixed !important;z-index:100;left:50%;top:60%;margin:-215px 0 0 -300px; background:#fff; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px; box-shadow:0px 0px 8px #194a81; overflow:auto;}
|
||||
.ni_con { width:425px; margin:25px 30px;}
|
||||
.ni_con h2{ display:block; height:40px; width:425px; text-align:center; color:#3a3a3a;}
|
||||
.ni_con label{ color:#808181; }
|
||||
.ni_con a:hover{ text-decoration:none;}
|
||||
.ni_btn{ width:190px; margin:15px auto; line-height:1.9;}
|
||||
a.tijiao{ height:28px; display:block; width:80px; color:#fff; background:#15bccf; text-align:center; padding-top:4px; float:left; margin-right:15px;}
|
||||
a:hover.tijiao{ background:#0f99a9;}
|
||||
.c_blue{ color:#0195bd;}
|
||||
.c_pink{ color:#e65d5e;}
|
||||
</style>
|
||||
|
||||
<h3 class="title">请输入课程密码</h3>
|
||||
<script type="text/javascript">
|
||||
function clickCanel(){hideModal("#popbox02");}
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<%= form_tag({:controller => 'courses',
|
||||
<body>
|
||||
<div id="popbox02">
|
||||
<div class="ni_con">
|
||||
<%= form_tag({:controller => 'courses',
|
||||
:action => 'join',
|
||||
:object_id => course.id},
|
||||
:remote => true,
|
||||
:method => :post,
|
||||
:id => 'new-watcher-form') do %>
|
||||
<table border="0">
|
||||
<tr>
|
||||
<td align="cneter">
|
||||
</td>
|
||||
|
||||
<div>
|
||||
<%= text_field_tag 'course_password', nil, :style=>'width:100%'%>
|
||||
:id => 'new_join_course') do %>
|
||||
<label>请输入课程密码:</label>
|
||||
<%= text_field_tag 'course_password', nil, :style=>'width:300px;'%>
|
||||
<div class="ni_btn">
|
||||
<a href="javascript:" class="tijiao" onclick="$('#new_join_course').submit();" >
|
||||
确 定
|
||||
</a>
|
||||
<a href="javascript:" class="tijiao" onclick="clickCanel();">
|
||||
取 消
|
||||
</a>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
<p class="buttons" style="padding-top: 10px; padding-bottom: 1px; margin-bottom: 1px">
|
||||
<%= submit_tag l(:label_new_join), :name => nil, :class => "bid_btn", :onclick => "hideModal(this);" %>
|
||||
<%= submit_tag l(:button_cancel), :name => nil, :class => "bid_btn", :onclick => "hideModal(this);", :type => 'button' %>
|
||||
</p>
|
||||
</td>
|
||||
</tr></table>
|
||||
<% end %>
|
||||
|
|
Loading…
Reference in New Issue