homeland-wiki 0.0.1 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ffedcf29dc9556d5e14b77be5275716ca387310f
4
- data.tar.gz: 4de8f046b38214d11606fa3ae1cdae7bd7445dcb
3
+ metadata.gz: 8efe19f3119e5867c24bc768eb200e44fedcd984
4
+ data.tar.gz: 94f9232944ad2e7f08a25de1faf0b4b677111444
5
5
  SHA512:
6
- metadata.gz: 7b32ad8f0188cb84499561e28bf11f27d6975269137bec2a9c876a6e68adb19fef47285d2c51d8b0e13d2b9ec35f6b66f4a0c06b83824f7dbaa183714d9016ef
7
- data.tar.gz: f398e902ee2126272d128c7beb1c2f6bfa841e8844adbc9d7ea2bedd726dfc8ab54b3b7e7884b114fc02e96e421ec29d05b7e94b41206b244eecc01ee15df9bd
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.destroy
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
@@ -22,7 +22,7 @@
22
22
 
23
23
  <% end %>
24
24
 
25
- <div class="panel-body markdown">
25
+ <div class="panel-body markdown markdown-toc">
26
26
  <article>
27
27
  <%= @page.body_html %>
28
28
  </article>
@@ -7,9 +7,6 @@
7
7
  <% end %>
8
8
 
9
9
  <% content_for :main do %>
10
- <script type="text/javascript">
11
- $('.navbar-nav .nav-plugin-wiki').addClass("active");
12
- </script>
13
10
  <div id="homeland-wiki">
14
11
  <%= yield %>
15
12
  </div>
@@ -10,7 +10,7 @@ Homeland::Wiki::Engine.routes.draw do
10
10
  end
11
11
 
12
12
  namespace :admin do
13
- resources :pages do
13
+ resources :pages, path: 'wiki' do
14
14
  resources :versions, controller: :page_versions do
15
15
  member do
16
16
  post :revert
@@ -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
@@ -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 = '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 = true
15
- plugin.root_path = "/wiki"
16
- plugin.admin_path = "/admin/pages"
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 = config.root.join('spec')
18
+ plugin.spec_path = config.root.join('spec')
19
19
  end
20
20
 
21
21
  app.routes.prepend do
@@ -2,6 +2,6 @@ module Homeland
2
2
  module Wiki
3
3
  NAME = 'wiki'
4
4
  DESCRIPTION = 'Display Wiki channel in navbar for wike pages.'
5
- VERSION = '0.0.1'
5
+ VERSION = '0.2.0'
6
6
  end
7
7
  end
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.1
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-06 00:00:00.000000000 Z
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