用户看别人课程主页时显示问题
This commit is contained in:
parent
8703709bd0
commit
e25425d9a7
|
@ -78,7 +78,7 @@ class UsersController < ApplicationController
|
||||||
##added by fq
|
##added by fq
|
||||||
def watch_bids
|
def watch_bids
|
||||||
@bids = Bid.watched_by(@user)
|
@bids = Bid.watched_by(@user)
|
||||||
@bids = Bid.visible.where('reward_type = ?', 1)
|
@bids = Bid.visible.where('reward_type = ?', 1) # modified by huang
|
||||||
@offset, @limit = api_offset_and_limit({:limit => 10})
|
@offset, @limit = api_offset_and_limit({:limit => 10})
|
||||||
@bid_count = @bids.count
|
@bid_count = @bids.count
|
||||||
@bid_pages = Paginator.new @bid_count, @limit, params['page']
|
@bid_pages = Paginator.new @bid_count, @limit, params['page']
|
||||||
|
|
|
@ -94,6 +94,35 @@ module UsersHelper
|
||||||
|
|
||||||
def user_course(state)
|
def user_course(state)
|
||||||
content = ''.html_safe
|
content = ''.html_safe
|
||||||
|
if @user != User.current
|
||||||
|
if @user.user_extensions.identity == 0
|
||||||
|
case state
|
||||||
|
when 0
|
||||||
|
s = content_tag('span', '他执教的课程', :class => "current-page")
|
||||||
|
content << content_tag('li', s)
|
||||||
|
content << content_tag('li', link_to('他发布的作业', {:controller => 'users', :action => 'user_courses', :type => 1}))
|
||||||
|
content_tag('div', content, :class => "pagination")
|
||||||
|
when 1
|
||||||
|
s = content_tag('span', '他发布的作业', :class => "current-page")
|
||||||
|
content << content_tag('li', link_to('他执教的课程', {:controller => 'users', :action => 'user_courses'}))
|
||||||
|
content << content_tag('li', s, :class => "current-page")
|
||||||
|
content_tag('div', content, :class => "pagination")
|
||||||
|
end
|
||||||
|
else
|
||||||
|
case state
|
||||||
|
when 0
|
||||||
|
s = content_tag('span', '他的课程', :class => "current-page")
|
||||||
|
content << content_tag('li', s)
|
||||||
|
content << content_tag('li', link_to('他的作业', {:controller => 'users', :action => 'user_courses', :type => 1}))
|
||||||
|
content_tag('div', content, :class => "pagination")
|
||||||
|
when 1
|
||||||
|
s = content_tag('span', '他的作业', :class => "current-page")
|
||||||
|
content << content_tag('li', link_to('他的课程', {:controller => 'users', :action => 'user_courses', :type => 0}))
|
||||||
|
content << content_tag('li', s, :class => "current-page")
|
||||||
|
content_tag('div', content, :class => "pagination")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
if @user.user_extensions.identity == 0
|
if @user.user_extensions.identity == 0
|
||||||
case state
|
case state
|
||||||
when 0
|
when 0
|
||||||
|
@ -119,7 +148,8 @@ module UsersHelper
|
||||||
content << content_tag('li', link_to(l(:label_my_course), {:controller => 'users', :action => 'user_courses', :type => 0}))
|
content << content_tag('li', link_to(l(:label_my_course), {:controller => 'users', :action => 'user_courses', :type => 0}))
|
||||||
content << content_tag('li', s, :class => "current-page")
|
content << content_tag('li', s, :class => "current-page")
|
||||||
content_tag('div', content, :class => "pagination")
|
content_tag('div', content, :class => "pagination")
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -47,9 +47,9 @@
|
||||||
<table border="0">
|
<table border="0">
|
||||||
<tr>
|
<tr>
|
||||||
<td align="cneter">
|
<td align="cneter">
|
||||||
<%= text_field_tag 'course_password', nil, :size => 27 %></td>
|
</td>
|
||||||
|
|
||||||
<%= text_field_tag 'course_password', nil, :size => 48%>
|
<%= text_field_tag 'course_password', nil, :size => 45 %>
|
||||||
|
|
||||||
<p class="buttons" style="padding-top: 10px; padding-bottom: 1px; margin-bottom: 1px">
|
<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(:label_new_join), :name => nil, :class => "bid_btn", :onclick => "hideModal(this);" %>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<div class="content_frame">
|
<div class="content_frame">
|
||||||
<% if @memberships.empty? %>
|
<% if @memberships.empty? %>
|
||||||
<% if @user != User.current %>
|
<% if @user != User.current %>
|
||||||
<p class="font_description">
|
<p class="font_description">
|
||||||
<%= l(:label_project_course_un) %>
|
<%= l(:label_project_course_un) %>
|
||||||
|
@ -7,16 +7,20 @@
|
||||||
<% else %>
|
<% else %>
|
||||||
<p class="font_description">
|
<p class="font_description">
|
||||||
<% if @user.user_extensions.identity == 0 %>
|
<% if @user.user_extensions.identity == 0 %>
|
||||||
|
<!--teacher could create the course directly-->
|
||||||
<%= l(:label_project_course_unadd) %><%= link_to"#{l(:label_course_new)}",{:controller=>'projects',:action=>'new', :course => 1}, :class => 'icon icon-add' %>
|
<%= l(:label_project_course_unadd) %><%= link_to"#{l(:label_course_new)}",{:controller=>'projects',:action=>'new', :course => 1}, :class => 'icon icon-add' %>
|
||||||
<% else %>
|
<% else %>
|
||||||
|
<!--joined the list of the courstlist-->
|
||||||
<%= l(:label_project_cousre_studentun) %><%= link_to"#{l(:label_course_join_student)}",{:controller=>'projects',:action=>'course', :course => 1}, :class => 'icon icon-add' %>
|
<%= l(:label_project_cousre_studentun) %><%= link_to"#{l(:label_course_join_student)}",{:controller=>'projects',:action=>'course', :course => 1}, :class => 'icon icon-add' %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</p>
|
</p>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% else %>
|
<% else %>
|
||||||
|
<% unless @user != User.current %>
|
||||||
<% if @user.user_extensions.identity == 0 %>
|
<% if @user.user_extensions.identity == 0 %>
|
||||||
<%= link_to"#{l(:label_course_new)}",{:controller=>'projects',:action=>'new', :course => 1}, :class => 'icon icon-add' %>
|
<%= link_to"#{l(:label_course_new)}",{:controller=>'projects',:action=>'new', :course => 1}, :class => 'icon icon-add' %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<% end %>
|
||||||
<ul class="user_project_sort">
|
<ul class="user_project_sort">
|
||||||
<% for membership in @memberships %>
|
<% for membership in @memberships %>
|
||||||
|
|
||||||
|
|
|
@ -1,20 +1,19 @@
|
||||||
<!-- added by fq -->
|
<!-- added by fq -->
|
||||||
|
<!--huang-->
|
||||||
|
|
||||||
<%= user_course @state%>
|
<%= user_course @state%>
|
||||||
<% if @state == 0 %>
|
<% if @state == 0 %>
|
||||||
<% if @user.user_extensions.identity == 0 %>
|
<% if @user.user_extensions.identity == 0 %> <!-- for teacher-->
|
||||||
<%= render :partial => 'my_course' %>
|
<%= render :partial => 'my_course' %>
|
||||||
<% else %>
|
<% else %> <!--for student-->
|
||||||
<%= render :partial => 'my_joinedcourse' %>
|
<%= render :partial => 'my_joinedcourse' %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% elsif @state == 1 %>
|
<% elsif @state == 1 %>
|
||||||
<% if @user.user_extensions.identity == 0 %>
|
<% if @user.user_extensions.identity == 0 %>
|
||||||
<%= render :partial => 'my_create_homework' %>
|
<%= render :partial => 'my_create_homework' %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<%= render :partial => 'my_homework' %>
|
<%= render :partial => 'my_homework' %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% else @state == 2 %>
|
<% else @state == 2 %>
|
||||||
<%= render :partial => 'my_joinedcourse' %>
|
<%= render :partial => 'my_joinedcourse' %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue