修改加入按钮失败后变为加入课程按钮

course_group
sw 11 years ago
parent 634f707425
commit 19b61118ac

@ -100,13 +100,12 @@ module WatchersHelper
return '' if user.id == course.tea_id return '' if user.id == course.tea_id
joined = user.member_of_course?(course) joined = user.member_of_course?(course)
text = joined ? l(:label_exit_course) : l(:label_new_join) text = joined ? l(:label_exit_course) : l(:label_new_join)
url_t = join_path(:object_id => course.id) url = joined ? join_path(:object_id => course.id) : try_join_path(:object_id => course.id)
url_f = try_join_path(:object_id => course.id)
method = joined ? 'delete' : 'post' method = joined ? 'delete' : 'post'
if joined if joined
link_to text, url_t, :remote => true, :method => method, :id => "#{course.id}", :confirm => l(:text_are_you_sure_out), :class => []+options link_to text, url, :remote => true, :method => method, :id => "#{course.id}", :confirm => l(:text_are_you_sure_out), :class => []+options
else else
link_to text, url_f, :remote => true, :method => method, :id => "#{course.id}", :class => []+options link_to text, url, :remote => true, :method => method, :id => "#{course.id}", :class => []+options
end end
end end

@ -1,5 +1,5 @@
<% if object_id%> <% if object_id%>
$("#<%=object_id%>").replaceWith('<%= escape_javascript join_in_course_for_list(course, user) %>'); $("#<%=object_id%>").replaceWith('<%= escape_javascript join_in_course(course, user) %>');
<% end %> <% end %>
<% if @state %> <% if @state %>
<% if @state == 0 %> <% if @state == 0 %>

@ -1899,7 +1899,7 @@ zh:
other: 成员 other: 成员
label_bids_task_list: 作业列表 label_bids_task_list: 作业列表
label_join_course: 加入课程 label_join_course: 加入
label_exit_course: 退出 label_exit_course: 退出
label_new_join: 加入 label_new_join: 加入
label_new_course_password: 课程密码 label_new_course_password: 课程密码

Loading…
Cancel
Save