@ -113,21 +113,27 @@ module WatchersHelper
@isjoin = false
coursegroups . each do | g |
@isjoin = user . member_of_course_group? ( g )
g . members . each do | mem |
if mem . user_id == user . id
@isjoin = true
end
end
end
url_t = join_group_path ( :object_id = > group . id )
url_f = try_join_group_path ( :object_id = > group . id )
url_f = join_group_path( :object_id = > group . id )
if @isjoin == true
joined = user . member_of_course_group? ( group )
text = l ( :label_exit_course )
if joined
link_to text , url_t , :remote = > true , :method = > 'delete' , :id = > " #{ group . id } " , :confirm = > l ( :text_are_you_sure_out ) , :class = > [ ] + options
link_to text , { :controller = > " courses " , :action = > " join_group " , :object_id = > " #{ group . id } " } , :remote = > true , :method = > 'delete' , :id = > " #{ group . id } " , :confirm = > l ( :text_are_you_sure_out _group ) , :class = > [ ] + options
end
else
text = l ( :label_new_join )
link_to text , url_f , :remote = > true , :method = > 'post' , :id = > " #{ group . id } " , :class = > [ ] + options
form_tag ( { :controller = > " courses " , :action = > " join_group " , :object_id = > " #{ group . id } " } , :remote = > true , :method = > 'post' ) do
submit_tag text , class : " submit f_l " , style : " width: 43px;height: 21px; "
end
end
end
@ -146,7 +152,8 @@ module WatchersHelper
if joined
link_to text , url_t , :remote = > true , :method = > method , :id = > " #{ course . id } " , :confirm = > l ( :text_are_you_sure_out ) , :class = > [ ] + options
else
link_to text , url_f , :remote = > true , :method = > method , :id = > " #{ course . id } " , :class = > [ ] + options
link_to text , url_f , :remote = > true , :method = > method , :id = > " #{ course . id } " , :class = > [ ] + options
end
end