From 8cd3dd0287f32a43a9a4b3c50fae91fe9eccaf7d Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 10 Oct 2014 09:21:10 +0800 Subject: [PATCH] =?UTF-8?q?1.#1249=20=E6=9C=AA=E7=99=BB=E5=BD=95=E5=92=8C?= =?UTF-8?q?=E9=9D=9E=E6=9C=AC=E4=BA=BA=E8=BF=9B=E5=85=A5=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E7=95=8C=E9=9D=A2=E6=97=B6=E9=9A=90=E8=97=8F?= =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E4=B8=8D=E6=98=BE=E7=A4=BA=20=E8=A7=A3?= =?UTF-8?q?=E5=86=B3=E6=96=B9=E6=A1=88=EF=BC=9A=E5=88=A4=E6=96=AD=E5=BD=93?= =?UTF-8?q?=E5=89=8D=E7=94=A8=E6=88=B7=E5=92=8C=E6=89=80=E6=9F=A5=E7=9C=8B?= =?UTF-8?q?=E7=9A=84=E7=94=A8=E6=88=B7=E6=98=AF=E5=90=A6=E4=B8=80=E8=87=B4?= =?UTF-8?q?=EF=BC=8C=E4=B8=8D=E4=B8=80=E8=87=B4=E5=8F=96=E6=B6=88=E9=9A=90?= =?UTF-8?q?=E8=97=8F=E8=AF=BE=E7=A8=8B=E7=9A=84=E6=98=BE=E7=A4=BA=202.?= =?UTF-8?q?=E5=9B=BD=E9=99=85=E5=8C=96=E4=BB=A3=E7=A0=81=E4=BB=A5=E5=8F=8A?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E4=BB=A3=E7=A0=81=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 13 +++- app/views/my/account.html.erb | 96 +++++++++++++---------------- app/views/welcome/course.html.erb | 21 ++++--- config/locales/zh.yml | 1 + 4 files changed, 65 insertions(+), 66 deletions(-) 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: 学校列表