个人主页的新建入口

dev_haigong
cxt 6 years ago
parent 5e0cea8e88
commit 3f63a51499

@ -2559,6 +2559,11 @@ class UsersController < ApplicationController
end end
end end
@objects_count = @objects.size @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 @objects = paginateHelper @objects, 16
respond_to do |format| respond_to do |format|

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

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

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

Loading…
Cancel
Save