个人主页的新建入口

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,6 +16,7 @@
<!--我的课堂-->
<div class="square-list clearfix">
<% if @new_icon %>
<!--课堂新建入口-->
<div class="square-Item">
@ -40,6 +41,8 @@
</div>
<% @objects.shift %>
<% end %>
<%#= render :partial => "users/course_item", :locals => {:objects => @objects} %>

@ -16,6 +16,7 @@
<!--我的项目-->
<div class="square-list clearfix">
<% if @new_icon %>
<!--新建项目新建入口-->
<div class="square-Item">
@ -41,6 +42,8 @@
</div>
<% @objects.shift %>
<% end %>
<% @objects.each do |object| %>
<% allow_visit = object.is_public || User.current.admin? || User.current.member_of?(object) %>

@ -35,6 +35,7 @@
<!--我的实训-->
<div class="square-list clearfix">
<% if @new_icon %>
<!--实训新建入口-->
<div class="square-Item">
@ -60,7 +61,8 @@
</div>
</div>
<% @objects.shift %>
<% end %>
<% @objects.each do |object| %>
<div class="square-Item">

@ -23,6 +23,7 @@
<!--我的实训路径-->
<div class="square-list clearfix">
<% if @new_icon %>
<!--实训路径新建入口-->
<div class="square-Item">
@ -48,6 +49,8 @@
</div>
<% @objects.shift %>
<% end %>
<% @objects.each_with_index do |object, index| %>

Loading…
Cancel
Save