Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Homepage, just use topics#index as Homepage. #1246

Merged
merged 1 commit into from
Jan 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion app/controllers/home_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

class HomeController < ApplicationController
def index
@excellent_topics = Topic.excellent.recent.fields_for_list.limit(20).to_a
end

def uploads
Expand Down
4 changes: 1 addition & 3 deletions app/models/setting.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ def legecy_envs
custom_head_html
navbar_html
footer_html
index_html
wiki_index_html
wiki_sidebar_html
site_index_html
Expand Down Expand Up @@ -79,7 +78,7 @@ def legecy_envs
# = Basic
field :app_name, default: (ENV["app_name"] || "Homeland"), validates: { presence: true }
field :timezone, default: "UTC"
# Module [topic,home,team,github,editor.code]
# Module [topic,team,github,editor.code]
field :modules, default: (ENV["modules"] || "all"), type: :array
# Plugin sort
field :sorted_plugins, default: [], type: :array, separator: /[\s,]+/
Expand Down Expand Up @@ -160,7 +159,6 @@ def legecy_envs
field :custom_head_html, default: ""
field :navbar_html, default: ""
field :footer_html, default: ""
field :index_html, default: ""
field :wiki_index_html, default: ""
field :wiki_sidebar_html, default: ""
field :site_index_html, default: ""
Expand Down
31 changes: 0 additions & 31 deletions app/views/home/index.html.erb

This file was deleted.

2 changes: 1 addition & 1 deletion app/views/shared/_navbar.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<ul id="main-nav-menu" class="navbar-nav d-flex flex-md-row">
<%= render_list_items do |li|
li << link_to(t("menu.topics"), Setting.has_module?(:home) ? main_app.topics_path : main_app.root_path, class: "nav-link")
li << link_to(t("menu.topics"), main_app.root_path, class: "nav-link")

Homeland.navbar_plugins.each do |plugin|
li << link_to(plugin.display_name, plugin.root_path, class: "nav-link")
Expand Down
1 change: 0 additions & 1 deletion config/locales/menu.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@
users: "Users"
admin: "Control Panel"
nodes: "Nodes"
my_home_page: "My home page"
edit_account_path: "Account Profile"
likes: "Favorites"
teams: "Teams"
Expand Down
3 changes: 1 addition & 2 deletions config/locales/menu.zh-CN.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@
users: "会员"
admin: "后台"
nodes: "节点"
my_home_page: "我的主页"
edit_account_path: "个人资料设置"
likes: "我的收藏"
teams: "公司/组织"
Expand Down Expand Up @@ -144,7 +143,7 @@
sorted_plugins: 插件排序,调整这个可以影响插件在导航栏的顺序。请用换行或逗号间隔,比如:"jobs, wiki, press, site"。
timezone: "日期时间显示时区,默认: UTC"
profile_fields: "用户个性资料支持字段,默认:all 可选:[company,twitter,website,tagline,location,alipay,paypal,qq,weibo,wechat,douban,dingding,aliwangwang,facebook,instagram,dribbble,battle_tag,psn_id,steam_id]"
modules: "启用模块,默认 all 全部开启,可选:[topic,home,team,github,editor.code]"
modules: "启用模块,默认 all 全部开启,可选:[topic,team,github,editor.code]"
domain: "网站域名,默认: localhost"
asset_host: "静态资源 CDN,比如:https://assets.your-host.com (如果没有,请留空)"
https: "是否启用 HTTPS"
Expand Down
1 change: 0 additions & 1 deletion config/locales/menu.zh-TW.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@
users: "會員"
admin: "後臺"
nodes: "節點"
my_home_page: "我的主頁"
edit_account_path: "個人資料設置"
likes: "我的收藏"
teams: "團體 / 組織"
Expand Down
6 changes: 1 addition & 5 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,7 @@
resources :devices
resources :teams

if Setting.has_module?(:home)
root to: "home#index"
else
root to: "topics#index"
end
root to: "topics#index"
match "/uploads/:path(![large|lg|md|sm|xs])", to: "home#uploads", via: :get, constraints: {
path: /[\w\d\.\/\-]+/i
}
Expand Down