From 809a580cca79fc1d15c2295a89203b9641faa3df Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 9 Jun 2017 16:17:31 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=88=91=E7=9A=84=E5=AE=9E?= =?UTF-8?q?=E8=AE=AD=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/application_controller.rb | 2 +- app/controllers/users_controller.rb | 22 ++++-- app/views/users/shixuns.html.erb | 88 +++++++++++++++++++++++ app/views/users/user_shixuns.html.erb | 5 -- config/routes.rb | 2 +- public/stylesheets/css/edu-class.css | 20 ++++++ 6 files changed, 128 insertions(+), 11 deletions(-) create mode 100644 app/views/users/shixuns.html.erb 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 %> > + 项目实训 > 我的实训

+
+
+
+ +
+
+
+ <% if @shixuns.blank? %> + <%= render :partial => "welcome/no_data" %> + <% else %> + <% @shixuns.each do |shixun| %> +
+
+ <%= shixun.name %> +
+

+ <%= shixun.language %> + <%= shixun.authentication == 1 ? "已审核" : "未审核" %> + <%= shixun.challenges.count %> 任务 + <%= shixun.myshixuns.count %>人挑战 + <%= format_time(shixun.updated_at) %> 更新 +

+
+ 查看详情 +
+ <% end %> + <% end %> +
+
+
+
    + <%= pagination_links_full @shixun_pages, @shixuns_count, :per_page_links => false, :remote => false, :flag => true, :is_new => true %> +
+
+
+
+
+
+
+
+ <% if @join_shixuns.blank? %> + <%= render :partial => "welcome/no_data" %> + <% else %> + <% @join_shixuns.each do |shixun| %> +
+
+ <%= shixun.name %> +
+

+ <%= shixun.language %> + <%= had_passed_changllenge_count shixun %> / <%= shixun.challenges.count %> 任务完成 + + <%= format_time(shixun.updated_at) %> 开启 +

+
+ 查看详情 +
+ <% end %> + + <% end %> +
+
+
+
+
+
+
+ \ No newline at end of file diff --git a/app/views/users/user_shixuns.html.erb b/app/views/users/user_shixuns.html.erb index 70b0e5db1..e69de29bb 100644 --- a/app/views/users/user_shixuns.html.erb +++ b/app/views/users/user_shixuns.html.erb @@ -1,5 +0,0 @@ - \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 42b8396b6..dc479cba5 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -808,7 +808,7 @@ RedmineApp::Application.routes.draw do end member do - get 'user_shixuns', :to => 'users#user_shixuns' + get 'shixuns', :to => 'users#shixuns' get 'user_myshixuns', :to => 'users#user_myshixuns' match 'user_projects_index', :to => 'users#user_projects_index', :via => :get match 'user_projects', :to => 'users#user_projects', :via => :get diff --git a/public/stylesheets/css/edu-class.css b/public/stylesheets/css/edu-class.css index 0a918398b..1b906989a 100644 --- a/public/stylesheets/css/edu-class.css +++ b/public/stylesheets/css/edu-class.css @@ -329,3 +329,23 @@ a:hover.edu-class-inner-list{color:#3498db;} .edu-bg-blue{ background:#f7f9fd} .padding10{ padding:10px;} .padding15{ padding:15px;} + +/* 我的实训我的课堂 20170608byLB */ +.edu-class-inner-max a.edu-class-inner-list{ max-width:84%;} +.edu-class-list-inner a.edu-class-inner-list{max-width:80%;} +.edu-class-inner-max .task-form-90{ width: 92%;} +.edu-class-list-inner .task-form-90{width: 91%;} +/* new tab */ +#edu-tab-nav li {width: 150px; } +.edu-tab{ width: 100%; background:#fff; } +#edu-tab-nav{height:47px;background: #fff; border-bottom:2px solid #5faee3;} +#edu-tab-nav li.new-tab-nav {float:left; width: 150px; text-align:center;height:48px;line-height:48px; } +#edu-tab-nav li a{font-size:14px; } +.edu-new-tab-hover { background:#5faee3; } +.edu-new-tab-hover a{color:#fff!important;} +.edu-class-con-list:hover{ background:#fbfbfb;} +.edu-bg-shadow{ box-shadow: 0px 0px 5px rgba(146, 153, 169, 0.2);} +a.task-btn-line{display: inline-block;font-weight: bold;padding: 0 12px;color: #666;background: #fff;letter-spacing: 1px;text-align: center;font-size: 14px;height: 30px;line-height: 30px;border-radius: 3px; border:1px solid #ccc;} +a:hover.task-btn-line{ border:1px solid #3498db;background:#3498db;color: #fff;} + +