From 9921acdf8befec9c75f0aab34eda1cc7e6c05f2f Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 11 Dec 2019 11:41:10 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E9=9B=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/shixuns_controller.rb | 6 +++++- .../shixuns/jupyter_data_sets.json.jbuilder | 17 ++++++++++------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index b12818ec8..a3030001c 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -458,7 +458,11 @@ class ShixunsController < ApplicationController # Jupyter数据集 def jupyter_data_sets - @data_sets = @shixun.jupyter_data_sets + page = params[:page] || 1 + limit = params[:limit] || 10 + data_sets = @shixun.jupyter_data_sets + @data_count = data_sets.count + @data_sets= data_sets.page(page).per(limit) end def apply_shixun_mirror diff --git a/app/views/shixuns/jupyter_data_sets.json.jbuilder b/app/views/shixuns/jupyter_data_sets.json.jbuilder index 103cf45be..ffe419312 100644 --- a/app/views/shixuns/jupyter_data_sets.json.jbuilder +++ b/app/views/shixuns/jupyter_data_sets.json.jbuilder @@ -1,7 +1,10 @@ -json.array! @data_sets do |set| - json.id set.id - json.title set.title - json.author set.author.real_name - json.created_on set.created_on - json.filesize number_to_human_size(set.filesize) -end \ No newline at end of file +json.data_sets do + json.array! @data_sets do |set| + json.id set.id + json.title set.title + json.author set.author.real_name + json.created_on set.created_on + json.filesize number_to_human_size(set.filesize) + end +end +json.data_sets_count @data_count \ No newline at end of file