个人主页的新建入口

dev_haigong
cxt 6 years ago
parent 5e0cea8e88
commit 3f63a51499

@ -2559,6 +2559,11 @@ class UsersController < ApplicationController
end
end
@objects_count = @objects.size
page = params[:page] ? params[:page].to_i : 1
@new_icon = @user == User.current && page == 1 && ['a_course', 'a_shixun', 'a_project', 'a_path'].include?(@type)
# 用户进自己主页的全部列表时有个新建入口在objects头部加一个"new"元素以确保翻页的正确性
@objects.unshift 'new' if @user == User.current && ['a_course', 'a_shixun', 'a_project', 'a_path'].include?(@type)
@objects = paginateHelper @objects, 16
respond_to do |format|

@ -16,30 +16,33 @@
<!--我的课堂-->
<div class="square-list clearfix">
<!--课堂新建入口-->
<div class="square-Item">
<% if @new_icon %>
<!--课堂新建入口-->
<div class="square-Item">
<div class="substance substancepad" >
<a href="/courses/new">
<div class="substancenenew">
<div class="leftten"></div>
<div class="topten"></div>
</div>
</a>
</div>
<div class="substance substancepad" >
<a href="/courses/new">
<div class="substancenenew">
<div class="leftten"></div>
<div class="topten"></div>
</div>
</a>
</div>
<div class="edu-txt-center course-bottom">
<div class="inline color-grey-6">
<div class="edu-txt-center course-bottom">
<div class="inline color-grey-6">
<span class="fl ml10 mr10 squareIconSpan substancefont">
新建课堂
</span>
</div>
</div>
</div>
</div>
</div>
<% @objects.shift %>
<% end %>
<%#= render :partial => "users/course_item", :locals => {:objects => @objects} %>

@ -16,31 +16,34 @@
<!--我的项目-->
<div class="square-list clearfix">
<!--新建项目新建入口-->
<div class="square-Item">
<% if @new_icon %>
<!--新建项目新建入口-->
<div class="square-Item">
<div class="substance substancepad" >
<div class="substance substancepad" >
<a href="/projects/new">
<div class="substancenenew">
<div class="leftten"></div>
<div class="topten"></div>
</div>
</a>
</div>
<a href="/projects/new">
<div class="substancenenew">
<div class="leftten"></div>
<div class="topten"></div>
</div>
</a>
</div>
<div class="edu-txt-center course-bottom">
<div class="inline color-grey-6">
<div class="edu-txt-center course-bottom">
<div class="inline color-grey-6">
<span class="fl ml10 mr10 squareIconSpan substancefont">
新建项目
</span>
</div>
</div>
</div>
</div>
</div>
<% @objects.shift %>
<% end %>
<% @objects.each do |object| %>
<% allow_visit = object.is_public || User.current.admin? || User.current.member_of?(object) %>

@ -35,32 +35,34 @@
<!--我的实训-->
<div class="square-list clearfix">
<!--实训新建入口-->
<div class="square-Item">
<% if @new_icon %>
<!--实训新建入口-->
<div class="square-Item">
<div class="substance substancepad" >
<div class="substance substancepad" >
<a href="/shixuns/new">
<div class="substancenenew">
<div class="leftten"></div>
<div class="topten"></div>
</div>
</a>
<a href="/shixuns/new">
<div class="substancenenew">
<div class="leftten"></div>
<div class="topten"></div>
</div>
</a>
</div>
</div>
<div class="edu-txt-center course-bottom">
<div class="inline color-grey-6">
<div class="edu-txt-center course-bottom">
<div class="inline color-grey-6">
<span class="fl ml10 mr10 squareIconSpan substancefont">
新建实训
</span>
<span class="fl ml10 mr10 squareIconSpan substancefont">
新建实训
</span>
</div>
</div>
</div>
</div>
</div>
<% @objects.shift %>
<% end %>
<% @objects.each do |object| %>
<div class="square-Item">

@ -23,31 +23,34 @@
<!--我的实训路径-->
<div class="square-list clearfix">
<!--实训路径新建入口-->
<div class="square-Item">
<% if @new_icon %>
<!--实训路径新建入口-->
<div class="square-Item">
<div class="substance substancepad" >
<div class="substance substancepad" >
<a href="/paths/new">
<div class="substancenenew">
<div class="leftten"></div>
<div class="topten"></div>
</div>
</a>
</div>
<a href="/paths/new">
<div class="substancenenew">
<div class="leftten"></div>
<div class="topten"></div>
</div>
</a>
</div>
<div class="edu-txt-center course-bottom">
<div class="inline color-grey-6">
<div class="edu-txt-center course-bottom">
<div class="inline color-grey-6">
<span class="fl ml10 mr10 squareIconSpan substancefont">
新建实训课程
</span>
</div>
</div>
</div>
</div>
</div>
<% @objects.shift %>
<% end %>
<% @objects.each_with_index do |object, index| %>

Loading…
Cancel
Save