diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 7df2cd1de..0ee869c4d 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -65,7 +65,7 @@ class ApplicationController < ActionController::Base return true # if User.current.logged? # uthentication = AuthenticationsUsers.where(:user_id => User.current.id).first - # user_account = User.current.user_extensions.try(:occupation) + # user_account = User.current.try(:user_extensions).try(:occupation) # if uthentication.blank? || user_account.blank? # redirect_to my_account_path # return diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 54dd8c081..3b9ac6c69 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -43,7 +43,7 @@ class UsersController < ApplicationController :user_courses4show,:user_projects4show,:user_contests4show,:user_course_activities,:user_project_activities,:user_feedback4show,:user_visitorlist,:user_messages,:edit_brief_introduction, :user_import_homeworks,:user_search_homeworks,:user_import_resource, :user_system_messages,:choose_user_course,:user_courselist,:user_projectlist,:sort_syllabus_list, :sort_project_list,:my_homeworks,:manage_or_receive_homeworks,:search_m_r_homeworks, :cancel_or_collect,:expand_courses,:homepage, :user_issues, :course_community, :project_community, :contest_community, - :user_shixuns] + :shixuns] before_filter :auth_user_extension, only: :show before_filter :show_system_message, :only => [:show] #before_filter :rest_user_score, only: :show @@ -654,10 +654,24 @@ class UsersController < ApplicationController end # 我发布的实训 - def shixuns_zone - @shixuns = Shixun.where(:user_id => User.current) + def shixuns + type = params[:type] + # 我发布的 + @shixuns = Shixun.where(:user_id => @user.id) + @shixuns_count = @shixuns.count + @limit = 10 + @shixun_pages = Paginator.new @shixuns_count, @limit, params['page'] || 1 + @offset ||= @shixun_pages.offset + @shixuns = paginateHelper @shixuns, @limit + + # 我参入的 + @join_shixuns = Shixun.find_by_sql("select * from shixuns where id in (select id from shixun_members where role =2 and user_id = #{@user.id})") + # @join_shixuns_count = @join_shixuns.count + # @join_shixuns_pages = Paginator.new @join_shixuns_count, @limit, params['page'] || 1 + # @join_shixuns_offset ||= @join_shixuns_pages.offset + # @join_shixuns = paginateHelper @join_shixuns, @limit respond_to do |format| - format.html{render :layout=>'base_users_new'} + format.html{render :layout=> 'base_edu'} end end diff --git a/app/views/users/shixuns.html.erb b/app/views/users/shixuns.html.erb new file mode 100644 index 000000000..19d1ed6eb --- /dev/null +++ b/app/views/users/shixuns.html.erb @@ -0,0 +1,88 @@ +
<%= @user.show_name %> > + 项目实训 > 我的实训
++ <%= shixun.language %> + <%= shixun.authentication == 1 ? "已审核" : "未审核" %> + <%= shixun.challenges.count %> 任务 + <%= shixun.myshixuns.count %>人挑战 + <%= format_time(shixun.updated_at) %> 更新 +
++ <%= shixun.language %> + <%= had_passed_changllenge_count shixun %> / <%= shixun.challenges.count %> 任务完成 + + <%= format_time(shixun.updated_at) %> 开启 +
+