mirror of
https://gitlink.org.cn/Gitlink/forgeplus.git
synced 2026-05-24 13:45:44 +08:00
add: home index models
This commit is contained in:
17
app/models/topic.rb
Normal file
17
app/models/topic.rb
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
# == Schema Information
|
||||||
|
#
|
||||||
|
# Table name: topics
|
||||||
|
#
|
||||||
|
# id :integer not null, primary key
|
||||||
|
# type :string(255)
|
||||||
|
# title :string(255)
|
||||||
|
# uuid :integer
|
||||||
|
# image_url :string(255)
|
||||||
|
# url :string(255)
|
||||||
|
# order_index :integer
|
||||||
|
#
|
||||||
|
|
||||||
|
class Topic < ApplicationRecord
|
||||||
|
|
||||||
|
default_scope { order(order_index: :desc)}
|
||||||
|
end
|
||||||
17
app/models/topic/activity_forum.rb
Normal file
17
app/models/topic/activity_forum.rb
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
# == Schema Information
|
||||||
|
#
|
||||||
|
# Table name: topics
|
||||||
|
#
|
||||||
|
# id :integer not null, primary key
|
||||||
|
# type :string(255)
|
||||||
|
# title :string(255)
|
||||||
|
# uuid :integer
|
||||||
|
# image_url :string(255)
|
||||||
|
# url :string(255)
|
||||||
|
# order_index :integer
|
||||||
|
#
|
||||||
|
|
||||||
|
# 首页平台动态
|
||||||
|
class Topic::ActivityForum < Topic
|
||||||
|
|
||||||
|
end
|
||||||
16
app/models/topic/banner.rb
Normal file
16
app/models/topic/banner.rb
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
# == Schema Information
|
||||||
|
#
|
||||||
|
# Table name: topics
|
||||||
|
#
|
||||||
|
# id :integer not null, primary key
|
||||||
|
# type :string(255)
|
||||||
|
# title :string(255)
|
||||||
|
# uuid :integer
|
||||||
|
# image_url :string(255)
|
||||||
|
# url :string(255)
|
||||||
|
# order_index :integer
|
||||||
|
#
|
||||||
|
|
||||||
|
# 首页banner
|
||||||
|
class Topic::Banner < Topic
|
||||||
|
end
|
||||||
16
app/models/topic/card.rb
Normal file
16
app/models/topic/card.rb
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
# == Schema Information
|
||||||
|
#
|
||||||
|
# Table name: topics
|
||||||
|
#
|
||||||
|
# id :integer not null, primary key
|
||||||
|
# type :string(255)
|
||||||
|
# title :string(255)
|
||||||
|
# uuid :integer
|
||||||
|
# image_url :string(255)
|
||||||
|
# url :string(255)
|
||||||
|
# order_index :integer
|
||||||
|
#
|
||||||
|
|
||||||
|
# 首页卡片内容
|
||||||
|
class Topic::Card < Topic
|
||||||
|
end
|
||||||
16
app/models/topic/cooperator.rb
Normal file
16
app/models/topic/cooperator.rb
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
# == Schema Information
|
||||||
|
#
|
||||||
|
# Table name: topics
|
||||||
|
#
|
||||||
|
# id :integer not null, primary key
|
||||||
|
# type :string(255)
|
||||||
|
# title :string(255)
|
||||||
|
# uuid :integer
|
||||||
|
# image_url :string(255)
|
||||||
|
# url :string(255)
|
||||||
|
# order_index :integer
|
||||||
|
#
|
||||||
|
|
||||||
|
# 首页合作伙伴
|
||||||
|
class Topic::Cooperator < Topic
|
||||||
|
end
|
||||||
17
app/models/topic/excellent_project.rb
Normal file
17
app/models/topic/excellent_project.rb
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
# == Schema Information
|
||||||
|
#
|
||||||
|
# Table name: topics
|
||||||
|
#
|
||||||
|
# id :integer not null, primary key
|
||||||
|
# type :string(255)
|
||||||
|
# title :string(255)
|
||||||
|
# uuid :integer
|
||||||
|
# image_url :string(255)
|
||||||
|
# url :string(255)
|
||||||
|
# order_index :integer
|
||||||
|
#
|
||||||
|
|
||||||
|
# 首页优秀项目
|
||||||
|
class Topic::ExcellentProject < Topic
|
||||||
|
|
||||||
|
end
|
||||||
16
app/models/topic/experience_forum.rb
Normal file
16
app/models/topic/experience_forum.rb
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
# == Schema Information
|
||||||
|
#
|
||||||
|
# Table name: topics
|
||||||
|
#
|
||||||
|
# id :integer not null, primary key
|
||||||
|
# type :string(255)
|
||||||
|
# title :string(255)
|
||||||
|
# uuid :integer
|
||||||
|
# image_url :string(255)
|
||||||
|
# url :string(255)
|
||||||
|
# order_index :integer
|
||||||
|
#
|
||||||
|
|
||||||
|
# 首页经验分享
|
||||||
|
class Topic::ExperienceForum < Topic
|
||||||
|
end
|
||||||
16
app/models/topic/pinned_forum.rb
Normal file
16
app/models/topic/pinned_forum.rb
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
# == Schema Information
|
||||||
|
#
|
||||||
|
# Table name: topics
|
||||||
|
#
|
||||||
|
# id :integer not null, primary key
|
||||||
|
# type :string(255)
|
||||||
|
# title :string(255)
|
||||||
|
# uuid :integer
|
||||||
|
# image_url :string(255)
|
||||||
|
# url :string(255)
|
||||||
|
# order_index :integer
|
||||||
|
#
|
||||||
|
|
||||||
|
# 首页精选文章
|
||||||
|
class Topic::PinnedForum < Topic
|
||||||
|
end
|
||||||
12
db/migrate/20211102065736_create_topics.rb
Normal file
12
db/migrate/20211102065736_create_topics.rb
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
class CreateTopics < ActiveRecord::Migration[5.2]
|
||||||
|
def change
|
||||||
|
create_table :topics do |t|
|
||||||
|
t.string :type
|
||||||
|
t.string :title
|
||||||
|
t.integer :uuid
|
||||||
|
t.string :image_url
|
||||||
|
t.string :url
|
||||||
|
t.integer :order_index
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
5
spec/models/topic_spec.rb
Normal file
5
spec/models/topic_spec.rb
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe Topic, type: :model do
|
||||||
|
pending "add some examples to (or delete) #{__FILE__}"
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user