diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index d8ecb4ef7..638a883d2 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -226,7 +226,14 @@ class UsersController < ApplicationController end end - membership = @user.coursememberships.all#@user.coursememberships.all(:conditions => Course.visible_condition(User.current)) + #@user.coursememberships.all(:conditions => Course.visible_condition(User.current)) + + if User.current == @user || User.current.admin? + membership = @user.coursememberships.all + else + membership = @user.coursememberships.all(:conditions => Course.visible_condition(User.current)) + end + membership.sort! {|older, newer| newer.created_on <=> older.created_on } @memberships = [] membership.collect { |e| @@ -235,9 +242,9 @@ class UsersController < ApplicationController ## 判断课程是否过期 [需封装] @memberships_doing = [] @memberships_done = [] - now_time = Time.now.year + #now_time = Time.now.year @memberships.map { |e| - end_time = e.course.get_time.year + #end_time = e.course.get_time.year isDone = course_endTime_timeout?(e.course) if isDone @memberships_done.push e diff --git a/app/views/my/account.html.erb b/app/views/my/account.html.erb index a57e35e65..3cb4fad80 100644 --- a/app/views/my/account.html.erb +++ b/app/views/my/account.html.erb @@ -12,8 +12,6 @@ ); - - - -
<%= link_to(l(:button_change_password), {:action => 'password'}, :class => 'icon icon-passwd') if @user.change_password_allowed? %> <%= call_hook(:view_my_account_contextual, :user => @user) %> @@ -39,9 +32,7 @@

<%= l(:label_my_account) %>

<%= error_messages_for 'user' %> -
- <%= labelled_form_for :user, @user, :url => {:action => "account"}, :html => {:id => 'my_account_form', @@ -70,7 +61,6 @@
@@ -95,10 +86,10 @@

<% else %> <% if @user.user_extensions.gender == 0 %> -

- <%= l(:label_gender) %>   - <%= select_tag 'gender', "".html_safe, :class => 'gender' %> -

+

+ <%= l(:label_gender) %>   + <%= select_tag 'gender', "".html_safe, :class => 'gender' %> +

<% else %>

<%= l(:label_gender) %>   @@ -107,12 +98,11 @@ <% end %> <% end %> - -

<% if User.current.user_extensions.school.nil? %> - <%= l(:field_occupation) %> * + <%= l(:field_occupation) %>  + * @@ -126,8 +116,7 @@

- -

学校列表

+

<%= l(:lable_school_list)%>

  
    @@ -234,39 +223,40 @@ <% unless @user.user_extensions.identity == 2 %> -

    - <%= l(:label_identity) %> - - - - <% end %> - - - <% else %> - - - -

    +

    + <%= l(:label_identity) %> + + + + <% end %> + + +

    + <% else %> +

    + + + +

    <% end %>
diff --git a/app/views/welcome/course.html.erb b/app/views/welcome/course.html.erb index 51f082ae6..d28c89aa8 100644 --- a/app/views/welcome/course.html.erb +++ b/app/views/welcome/course.html.erb @@ -39,19 +39,20 @@
- <% if @school_id.nil? and (User.current.user_extensions.nil? || User.current.user_extensions.school.nil?) %> + + <% if @school_id.nil? and (User.current.user_extensions.nil? || User.current.user_extensions.school.nil?) %> <% else %> - <% if @school_id == "0" %> - <% else %> - <% if @school_id.nil? %> - <%= link_to School.find(User.current.user_extensions.school.id).name, options={:action => 'course', :school_id => User.current.user_extensions.school.id}, html_options={:class => 'font_welcome_school', :method => 'get'} %> -
- <% else %> - <%= link_to School.find(@school_id).name, options={:action => 'course', :school_id => @school_id}, html_options={:class => 'font_welcome_school', :method => 'get'} %> -
- <% end %> + <% if @school_id == "0" %> + <% else %> + <% if @school_id.nil? %> + <%= link_to School.find(User.current.user_extensions.school.id).name, options={:action => 'course', :school_id => User.current.user_extensions.school.id}, html_options={:class => 'font_welcome_school', :method => 'get'} %> +
+ <% else %> + <%= link_to School.find(@school_id).name, options={:action => 'course', :school_id => @school_id}, html_options={:class => 'font_welcome_school', :method => 'get'} %> +
<% end %> <% end %> + <% end %>
<% unless @course_page.nil? %> <%= @course_page.title %> diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 7ddff7d04..c4fe1d833 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -2145,3 +2145,4 @@ zh: lable_sure_exit_project: 是否确认退出该项目 lable_input_class: 在此输入课时 lable_input_class_vilidate: 学时只能为整数 + lable_school_list: 学校列表