flatpages 0.0.2 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +15 -14
- data/app/controllers/flatpages_controller.rb +2 -1
- data/app/models/flatpage.rb +2 -4
- data/app/views/flatpages/show.erb +2 -0
- data/config/routes.rb +1 -1
- data/lib/flatpages/engine.rb +0 -1
- data/lib/flatpages/version.rb +1 -1
- data/lib/generators/flatpages/install/install_generator.rb +34 -0
- data/lib/generators/flatpages/install/templates/active_admin/flatpage.rb.erb +20 -0
- data/{db/migrate/20140808055521_create_flatpage.rb → lib/generators/flatpages/install/templates/create_flatpage.rb} +1 -3
- metadata +6 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 564b6cc40d42034e3ebb34c675fc0c683c9bc919
|
4
|
+
data.tar.gz: f735bfad0e3bba3ad3249ca1c1456da27f94f7b4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e5cab32d70fb56ba895310dc534fc2f9d4432b85efcba95e02d43d5893554caeb344d6d1a6fdbc5af3a2fd15e888feccfa68aa9fa2e3966f40da6b611a4f7869
|
7
|
+
data.tar.gz: 33d8aa97525ccce0392fef91d6fc52f0b6c3d22d78b5abc824cf126d0a828f3ded1aed2cdefbb042a4bc1c5622cb24b8bf8b259478cde73dfd89de4e5ac5f3c9
|
data/README.md
CHANGED
@@ -1,31 +1,32 @@
|
|
1
1
|
# Flatpages
|
2
2
|
|
3
|
-
|
3
|
+
Simple gem for save static pages in database
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
7
7
|
Add this line to your application's Gemfile:
|
8
8
|
|
9
9
|
```ruby
|
10
|
+
gem 'ckeditor'
|
10
11
|
gem 'flatpages'
|
11
12
|
```
|
12
13
|
|
13
|
-
|
14
|
+
Install and configure ckeditor
|
15
|
+
Then run
|
14
16
|
|
15
|
-
|
17
|
+
```
|
18
|
+
rails generate flatpages:install .
|
19
|
+
```
|
16
20
|
|
17
|
-
|
21
|
+
And add to your routes.rb before root route
|
18
22
|
|
19
|
-
|
23
|
+
```ruby
|
24
|
+
mount Flatpages::Engine => '/'
|
25
|
+
```
|
20
26
|
|
21
27
|
## Usage
|
22
28
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
1. Fork it ( https://github.com/[my-github-username]/flatpages/fork )
|
28
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
29
|
-
3. Commit your changes (`git commit -am 'Add some feature'`)
|
30
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
31
|
-
5. Create a new Pull Request
|
29
|
+
For make link to static page use route like this
|
30
|
+
```
|
31
|
+
flatpages_engine.flatpage_path('contacts')
|
32
|
+
```
|
data/app/models/flatpage.rb
CHANGED
data/config/routes.rb
CHANGED
data/lib/flatpages/engine.rb
CHANGED
data/lib/flatpages/version.rb
CHANGED
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'rails/generators/active_record'
|
2
|
+
|
3
|
+
module Flatpages
|
4
|
+
module Generators
|
5
|
+
class InstallGenerator < ActiveRecord::Generators::Base
|
6
|
+
include Rails::Generators::Migration
|
7
|
+
|
8
|
+
desc "Installs flatpages"
|
9
|
+
|
10
|
+
def self.source_root
|
11
|
+
@_source_root ||= File.expand_path("../templates", __FILE__)
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.next_migration_number(path)
|
15
|
+
unless @prev_migration_nr
|
16
|
+
@prev_migration_nr = Time.now.utc.strftime("%Y%m%d%H%M%S").to_i
|
17
|
+
else
|
18
|
+
@prev_migration_nr += 1
|
19
|
+
end
|
20
|
+
@prev_migration_nr.to_s
|
21
|
+
end
|
22
|
+
|
23
|
+
def setup_directory
|
24
|
+
empty_directory "app/admin"
|
25
|
+
|
26
|
+
template 'active_admin/flatpage.rb.erb', 'app/admin/flatpage.rb'
|
27
|
+
end
|
28
|
+
|
29
|
+
def copy_migrations
|
30
|
+
migration_template "create_flatpage.rb", "db/migrate/create_flatpage.rb"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
ActiveAdmin.register Flatpage do
|
2
|
+
permit_params :name, :text, :path
|
3
|
+
|
4
|
+
index do
|
5
|
+
column :name
|
6
|
+
column :path
|
7
|
+
|
8
|
+
actions
|
9
|
+
end
|
10
|
+
|
11
|
+
form do |f|
|
12
|
+
f.inputs do
|
13
|
+
f.input :name
|
14
|
+
f.input :path
|
15
|
+
f.input :text, :as => :ckeditor
|
16
|
+
end
|
17
|
+
|
18
|
+
f.actions
|
19
|
+
end
|
20
|
+
end
|
@@ -2,10 +2,8 @@ class CreateFlatpage < ActiveRecord::Migration
|
|
2
2
|
def change
|
3
3
|
create_table :flatpages do |t|
|
4
4
|
t.string :name, null: false
|
5
|
-
t.string :
|
5
|
+
t.string :path, null: false
|
6
6
|
t.text :text
|
7
7
|
end
|
8
|
-
|
9
|
-
add_index :flatpages, :slug, unique: true
|
10
8
|
end
|
11
9
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flatpages
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Semyon Pupkov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-01-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -66,12 +66,15 @@ files:
|
|
66
66
|
- Rakefile
|
67
67
|
- app/controllers/flatpages_controller.rb
|
68
68
|
- app/models/flatpage.rb
|
69
|
+
- app/views/flatpages/show.erb
|
69
70
|
- config/routes.rb
|
70
|
-
- db/migrate/20140808055521_create_flatpage.rb
|
71
71
|
- flatpages.gemspec
|
72
72
|
- lib/flatpages.rb
|
73
73
|
- lib/flatpages/engine.rb
|
74
74
|
- lib/flatpages/version.rb
|
75
|
+
- lib/generators/flatpages/install/install_generator.rb
|
76
|
+
- lib/generators/flatpages/install/templates/active_admin/flatpage.rb.erb
|
77
|
+
- lib/generators/flatpages/install/templates/create_flatpage.rb
|
75
78
|
homepage: ''
|
76
79
|
licenses:
|
77
80
|
- MIT
|