Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
0ae89200
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
0ae89200
编写于
4月 10, 2013
作者:
D
Dmitriy Zaporozhets
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove Wiki and db table since we use gollum now
上级
0415566b
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
11 addition
and
106 deletion
+11
-106
app/contexts/search_context.rb
app/contexts/search_context.rb
+1
-1
app/models/project.rb
app/models/project.rb
+0
-1
app/models/wiki.rb
app/models/wiki.rb
+0
-55
db/migrate/20130410175022_remove_wiki_table.rb
db/migrate/20130410175022_remove_wiki_table.rb
+9
-0
db/schema.rb
db/schema.rb
+1
-14
spec/models/wiki_spec.rb
spec/models/wiki_spec.rb
+0
-35
未找到文件。
app/contexts/search_context.rb
浏览文件 @
0ae89200
...
...
@@ -13,7 +13,7 @@ class SearchContext
result
[
:projects
]
=
Project
.
where
(
id:
project_ids
).
search
(
query
).
limit
(
10
)
result
[
:merge_requests
]
=
MergeRequest
.
where
(
project_id:
project_ids
).
search
(
query
).
limit
(
10
)
result
[
:issues
]
=
Issue
.
where
(
project_id:
project_ids
).
search
(
query
).
limit
(
10
)
result
[
:wiki_pages
]
=
Wiki
.
where
(
project_id:
project_ids
).
search
(
query
).
limit
(
10
)
result
[
:wiki_pages
]
=
[]
result
end
...
...
app/models/project.rb
浏览文件 @
0ae89200
...
...
@@ -53,7 +53,6 @@ class Project < ActiveRecord::Base
has_many
:snippets
,
dependent: :destroy
has_many
:deploy_keys
,
dependent: :destroy
,
class_name:
"Key"
,
foreign_key:
"project_id"
has_many
:hooks
,
dependent: :destroy
,
class_name:
"ProjectHook"
has_many
:wikis
,
dependent: :destroy
has_many
:protected_branches
,
dependent: :destroy
has_many
:user_team_project_relationships
,
dependent: :destroy
...
...
app/models/wiki.rb
已删除
100644 → 0
浏览文件 @
0415566b
# == Schema Information
#
# Table name: wikis
#
# id :integer not null, primary key
# title :string(255)
# content :text
# project_id :integer
# created_at :datetime not null
# updated_at :datetime not null
# slug :string(255)
# user_id :integer
#
class
Wiki
<
ActiveRecord
::
Base
attr_accessible
:title
,
:content
,
:slug
belongs_to
:project
belongs_to
:user
has_many
:notes
,
as: :noteable
,
dependent: :destroy
validates
:content
,
presence:
true
validates
:user
,
presence:
true
validates
:title
,
presence:
true
,
length:
1
..
250
before_update
:set_slug
scope
:ordered
,
order
(
"created_at DESC"
)
def
to_param
slug
end
class
<<
self
def
search
(
query
)
where
(
"title like :query OR content like :query"
,
query:
"%
#{
query
}
%"
)
end
end
protected
def
self
.
regenerate_from
wiki
regenerated_field
=
[
:slug
,
:content
,
:title
]
new_wiki
=
Wiki
.
new
regenerated_field
.
each
do
|
field
|
new_wiki
.
send
(
"
#{
field
}
="
,
wiki
.
send
(
field
))
end
new_wiki
end
def
set_slug
self
.
slug
=
self
.
title
.
parameterize
end
end
db/migrate/20130410175022_remove_wiki_table.rb
0 → 100644
浏览文件 @
0ae89200
class
RemoveWikiTable
<
ActiveRecord
::
Migration
def
up
drop_table
:wikis
end
def
down
raise
ActiveRecord
::
IrreversibleMigration
end
end
db/schema.rb
浏览文件 @
0ae89200
...
...
@@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord
::
Schema
.
define
(
:version
=>
201304
04164628
)
do
ActiveRecord
::
Schema
.
define
(
:version
=>
201304
10175022
)
do
create_table
"events"
,
:force
=>
true
do
|
t
|
t
.
string
"target_type"
...
...
@@ -300,17 +300,4 @@ ActiveRecord::Schema.define(:version => 20130404164628) do
t
.
integer
"service_id"
end
create_table
"wikis"
,
:force
=>
true
do
|
t
|
t
.
string
"title"
t
.
text
"content"
t
.
integer
"project_id"
t
.
datetime
"created_at"
,
:null
=>
false
t
.
datetime
"updated_at"
,
:null
=>
false
t
.
string
"slug"
t
.
integer
"user_id"
end
add_index
"wikis"
,
[
"project_id"
],
:name
=>
"index_wikis_on_project_id"
add_index
"wikis"
,
[
"slug"
],
:name
=>
"index_wikis_on_slug"
end
spec/models/wiki_spec.rb
已删除
100644 → 0
浏览文件 @
0415566b
# == Schema Information
#
# Table name: wikis
#
# id :integer not null, primary key
# title :string(255)
# content :text
# project_id :integer
# created_at :datetime not null
# updated_at :datetime not null
# slug :string(255)
# user_id :integer
#
require
'spec_helper'
describe
Wiki
do
describe
"Associations"
do
it
{
should
belong_to
(
:project
)
}
it
{
should
belong_to
(
:user
)
}
it
{
should
have_many
(
:notes
).
dependent
(
:destroy
)
}
end
describe
"Mass assignment"
do
it
{
should_not
allow_mass_assignment_of
(
:project_id
)
}
it
{
should_not
allow_mass_assignment_of
(
:user_id
)
}
end
describe
"Validation"
do
it
{
should
validate_presence_of
(
:title
)
}
it
{
should
ensure_length_of
(
:title
).
is_within
(
1
..
250
)
}
it
{
should
validate_presence_of
(
:content
)
}
it
{
should
validate_presence_of
(
:user
)
}
end
end
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录