homeland-wiki 0.0.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/homeland/wiki/admin/pages_controller.rb +5 -18
- data/app/views/homeland/wiki/pages/show.html.erb +1 -1
- data/app/views/layouts/homeland/wiki/application.html.erb +0 -3
- data/config/routes.rb +1 -1
- data/db/migrate/20170305220755_create_pages.rb +26 -0
- data/lib/homeland/wiki/engine.rb +9 -9
- data/lib/homeland/wiki/version.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8efe19f3119e5867c24bc768eb200e44fedcd984
|
4
|
+
data.tar.gz: 94f9232944ad2e7f08a25de1faf0b4b677111444
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ab76466efa368b108ba4f8d96d41bf48ceb6cafaa2b9f32971f4d9dc89283663a7bcfda852462756cd01ed47ef3bb75da1f7a431b1ee9d00742053239c49465d
|
7
|
+
data.tar.gz: '087f335fd8666bba63cfeabd7e823f70f9eeab58b647f719a5b659bd2be3aca8dd6d5dd09184317f018b3d3a3e461f09b827dcc86924ffe1b03b64dc00db8daf'
|
@@ -6,26 +6,9 @@ module Homeland::Wiki::Admin
|
|
6
6
|
@pages = Page.unscoped.order(id: :desc).page(params[:page])
|
7
7
|
end
|
8
8
|
|
9
|
-
def show
|
10
|
-
end
|
11
|
-
|
12
|
-
def new
|
13
|
-
@page = Page.new
|
14
|
-
end
|
15
|
-
|
16
9
|
def edit
|
17
10
|
end
|
18
11
|
|
19
|
-
def create
|
20
|
-
@page = Page.new(params[:page].permit!)
|
21
|
-
|
22
|
-
if @page.save
|
23
|
-
redirect_to(admin_pages_path, notice: 'Page was successfully created.')
|
24
|
-
else
|
25
|
-
render action: 'new'
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
12
|
def update
|
30
13
|
@page.title = params[:page][:title]
|
31
14
|
@page.body = params[:page][:body]
|
@@ -41,7 +24,11 @@ module Homeland::Wiki::Admin
|
|
41
24
|
end
|
42
25
|
|
43
26
|
def destroy
|
44
|
-
@page.
|
27
|
+
if @page.deleted_at.present?
|
28
|
+
@page.delete
|
29
|
+
else
|
30
|
+
@page.destroy
|
31
|
+
end
|
45
32
|
|
46
33
|
redirect_to(admin_pages_path)
|
47
34
|
end
|
data/config/routes.rb
CHANGED
@@ -0,0 +1,26 @@
|
|
1
|
+
class CreatePages < ActiveRecord::Migration[5.0]
|
2
|
+
def up
|
3
|
+
return if ActiveRecord::Base.connection.table_exists? :pages
|
4
|
+
|
5
|
+
create_table :pages do |t|
|
6
|
+
t.string :slug, null: false
|
7
|
+
t.string :title, null: false
|
8
|
+
t.text :body, null: false
|
9
|
+
t.boolean :locked, default: false
|
10
|
+
t.integer :version, default: 0, null: false
|
11
|
+
t.integer :editor_ids, default: [], null: false, array: true
|
12
|
+
t.integer :word_count, default: 0, null: false
|
13
|
+
t.integer :changes_cout, default: 1, null: false
|
14
|
+
t.integer :comments_count, default: 0, null: false
|
15
|
+
t.datetime :deleted_at
|
16
|
+
|
17
|
+
t.timestamps
|
18
|
+
end
|
19
|
+
|
20
|
+
add_index :pages, :slug, unique: true
|
21
|
+
end
|
22
|
+
|
23
|
+
def down
|
24
|
+
drop_table :pages, if_exists: true
|
25
|
+
end
|
26
|
+
end
|
data/lib/homeland/wiki/engine.rb
CHANGED
@@ -6,16 +6,16 @@ module Homeland
|
|
6
6
|
initializer 'homeland.wiki.init' do |app|
|
7
7
|
if Setting.has_module?(:wiki)
|
8
8
|
Homeland.register_plugin do |plugin|
|
9
|
-
plugin.name
|
10
|
-
plugin.display_name
|
11
|
-
plugin.description
|
12
|
-
plugin.version
|
13
|
-
plugin.navbar_link
|
14
|
-
plugin.user_menu_link
|
15
|
-
plugin.root_path
|
16
|
-
plugin.admin_path
|
9
|
+
plugin.name = 'wiki'
|
10
|
+
plugin.display_name = 'Wiki'
|
11
|
+
plugin.description = Homeland::Wiki::DESCRIPTION
|
12
|
+
plugin.version = Homeland::Wiki::VERSION
|
13
|
+
plugin.navbar_link = true
|
14
|
+
plugin.user_menu_link = false
|
15
|
+
plugin.root_path = "/wiki"
|
16
|
+
plugin.admin_path = "/admin/wiki"
|
17
17
|
plugin.admin_navbar_link = true
|
18
|
-
plugin.spec_path
|
18
|
+
plugin.spec_path = config.root.join('spec')
|
19
19
|
end
|
20
20
|
|
21
21
|
app.routes.prepend do
|
metadata
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: homeland-wiki
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Griffin Qiu
|
8
|
+
- Jason Lee
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date: 2017-03-
|
12
|
+
date: 2017-03-07 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: rails
|
@@ -27,6 +28,7 @@ dependencies:
|
|
27
28
|
description: Display Wiki channel in navbar for wike pages.
|
28
29
|
email:
|
29
30
|
- griffinqiu@gmail.com
|
31
|
+
- huacnlee@gmail.com
|
30
32
|
executables: []
|
31
33
|
extensions: []
|
32
34
|
extra_rdoc_files: []
|
@@ -62,6 +64,7 @@ files:
|
|
62
64
|
- config/locales/pages.zh-CN.yml
|
63
65
|
- config/locales/pages.zh-TW.yml
|
64
66
|
- config/routes.rb
|
67
|
+
- db/migrate/20170305220755_create_pages.rb
|
65
68
|
- lib/homeland/wiki.rb
|
66
69
|
- lib/homeland/wiki/engine.rb
|
67
70
|
- lib/homeland/wiki/version.rb
|