add: platform person
This commit is contained in:
parent
4a7878d16e
commit
d94b3ff2f4
|
@ -0,0 +1,7 @@
|
|||
class Home::PlatformPeopleController < ApplicationController
|
||||
|
||||
def index
|
||||
scope = PlatformPerson.order(created_at: :desc)
|
||||
@people = kaminari_paginate(scope)
|
||||
end
|
||||
end
|
|
@ -4,7 +4,7 @@
|
|||
#
|
||||
# id :integer not null, primary key
|
||||
# title :string(255)
|
||||
# content :string(255)
|
||||
# content :text(65535)
|
||||
# tag_field :text(65535)
|
||||
# fake_id :integer
|
||||
# created_at :datetime not null
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
# == Schema Information
|
||||
#
|
||||
# Table name: platform_people
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# name :string(255)
|
||||
# image_url :string(255)
|
||||
# announcement :string(255)
|
||||
# content :text(65535)
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
#
|
||||
|
||||
class PlatformPerson < ApplicationRecord
|
||||
end
|
|
@ -0,0 +1,7 @@
|
|||
json.total_count @people.total_count
|
||||
json.people do
|
||||
json.array! @people.each do |p|
|
||||
json.(p, :id, :name, :image_url, :announcement, :content)
|
||||
json.created_time format_time(p.created_at)
|
||||
end
|
||||
end
|
|
@ -106,6 +106,7 @@ Rails.application.routes.draw do
|
|||
resources :platform_statistics, only: [:index]
|
||||
resources :competitions, only:[:index]
|
||||
resources :platform_communicates, only: [:index]
|
||||
resources :platform_people, only: [:index]
|
||||
end
|
||||
get 'home/index'
|
||||
get 'home/search'
|
||||
|
|
|
@ -2,7 +2,7 @@ class CreatePlatformCommunicates < ActiveRecord::Migration[5.2]
|
|||
def change
|
||||
create_table :platform_communicates do |t|
|
||||
t.string :title
|
||||
t.string :content
|
||||
t.text :content
|
||||
t.text :tag_field
|
||||
t.integer :fake_id
|
||||
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
class CreatePlatformPeople < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
create_table :platform_people do |t|
|
||||
t.string :name
|
||||
t.string :image_url
|
||||
t.string :announcement
|
||||
t.text :content
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue