添加我的实训功能
This commit is contained in:
parent
22acb0a041
commit
809a580cca
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,88 @@
|
|||
<div class="edu-class-container " >
|
||||
<p class="mb10"><i class="fa fa-map-marker mr5 color-grey " ></i><a href="<%= user_path(@user) %>"><%= @user.show_name %> </a> >
|
||||
<a href="<%= shixuns_path %>">项目实训 </a> > 我的实训 </p>
|
||||
<div class="edu-con-bg01 edu-bg-shadow" >
|
||||
<div class="">
|
||||
<div class="edu-tab clearfix mb20" >
|
||||
<ul id="edu-tab-nav">
|
||||
<li id="edu-tab-nav-1" class="edu-new-tab-hover new-tab-nav " onclick="HoverLi(1);">
|
||||
<a href="javascript:void(0);" class="tab_type">我已创建</a>
|
||||
</li>
|
||||
<li id="edu-tab-nav-2" onclick="HoverLi(2);">
|
||||
<a href="javascript:void(0);" class="tab_type" >我已参与</a>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="cl"></div>
|
||||
<div id="edu-tab-con-1" >
|
||||
<div class=" " style="min-height:700px;">
|
||||
<% if @shixuns.blank? %>
|
||||
<%= render :partial => "welcome/no_data" %>
|
||||
<% else %>
|
||||
<% @shixuns.each do |shixun| %>
|
||||
<div class=" clearfix edu-class-con-list padding15">
|
||||
<div class="fl task-form-90 ">
|
||||
<a href="javascript:void(0);" class="edu-class-inner-list fl"><%= shixun.name %></a>
|
||||
<div class="cl"></div>
|
||||
<p class="color-grey font-12 ">
|
||||
<span class=" "><%= shixun.language %></span>
|
||||
<span class=" ml30"><%= shixun.authentication == 1 ? "已审核" : "未审核" %></span>
|
||||
<span class=" ml30"><%= shixun.challenges.count %> 任务 </span>
|
||||
<span class=" ml30"><%= shixun.myshixuns.count %>人挑战 </span>
|
||||
<span class=" ml30"><%= format_time(shixun.updated_at) %> 更新</span>
|
||||
</p>
|
||||
</div>
|
||||
<a href="<%= shixun_path(shixun) %>" class="fr task-btn task-btn-blue mt15">查看详情</a>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
<div style="text-align:center;" class="mt10">
|
||||
<div class="pages_right_min" style="width:auto; display:inline-block;">
|
||||
<ul id="homework_pository_ref_pages">
|
||||
<%= pagination_links_full @shixun_pages, @shixuns_count, :per_page_links => false, :remote => false, :flag => true, :is_new => true %>
|
||||
</ul>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="edu-tab-con-2" class="undis " >
|
||||
<div class="" style="min-height:700px;">
|
||||
<% if @join_shixuns.blank? %>
|
||||
<%= render :partial => "welcome/no_data" %>
|
||||
<% else %>
|
||||
<% @join_shixuns.each do |shixun| %>
|
||||
<div class=" clearfix edu-class-con-list padding15">
|
||||
<div class="fl task-form-90 ">
|
||||
<a href="<%= shixun_path(shixun) %>" class="edu-class-inner-list fl"><%= shixun.name %></a>
|
||||
<div class="cl"></div>
|
||||
<p class="color-grey font-12">
|
||||
<span class=" "><%= shixun.language %></span>
|
||||
<span class=" ml30"><%= had_passed_changllenge_count shixun %> / <%= shixun.challenges.count %> 任务完成 </span>
|
||||
<!--<span class=" ml30">No.501 排名 </span>-->
|
||||
<span class=" ml30"><%= format_time(shixun.updated_at) %> 开启 </span>
|
||||
</p>
|
||||
</div>
|
||||
<a href="<%= shixun_path(shixun) %>" class="fr task-btn task-btn-blue mt15">查看详情</a>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
function g(o){return document.getElementById(o);}
|
||||
function HoverLi(n){
|
||||
for(var i=1;i<=2;i++){
|
||||
g('edu-tab-nav-'+i).className='edu-tab-nomal';
|
||||
g('edu-tab-con-'+i).className='undis';
|
||||
}
|
||||
g('edu-tab-con-'+n).className='dis';
|
||||
g('edu-tab-nav-'+n).className='edu-new-tab-hover';
|
||||
}
|
||||
</script>
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
<ul>
|
||||
<% @shixuns.each do |shixun| %>
|
||||
<li><%= shixun.name %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue