simple_static_pages 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 43b13fc8552363850bd73f8569508436b37e338d
|
4
|
+
data.tar.gz: af1fe6a4fcad1631d8ca6e033a05e796d6d7e6f2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 979756fb97975a9b6b8e4df08e8a4d82d35333c7c918fd1acc674fd020756c51f4c5135771b8a82e458f37853db35861795df137ef5180a3aa49f881cbe8e766
|
7
|
+
data.tar.gz: a58c49bcfa9942c15dedfd892c0695b324d58f9cca80909f030ddb272eb8d63b100a0e5462ee1c41c9684e12e496db7c189cb764d9c656d8e5ee5f4efe5b6082
|
data/README.md
CHANGED
@@ -2,13 +2,34 @@
|
|
2
2
|
|
3
3
|
This project rocks and uses MIT-LICENSE.
|
4
4
|
|
5
|
+
Add the following line into `config/routes.rb`
|
6
|
+
|
7
|
+
```ruby
|
8
|
+
mount SimpleStaticPages::Engine => '/simple_static_pages'
|
9
|
+
```
|
10
|
+
|
5
11
|
`rake simple_static_pages:install:migrations`
|
6
12
|
|
7
13
|
`rake db:migrate`
|
8
14
|
|
15
|
+
Open [http://localhost:3000/simple_static_pages/admins/pages](http://localhost:3000/simple_static_pages/admins/pages)
|
16
|
+
|
9
17
|
You can use `simple_menu` helper for pages menu. Or you can create your helper.
|
10
18
|
|
11
19
|
```haml
|
12
20
|
- @pages.each do |page|
|
13
21
|
= link_to page.title, simple_page_path(page)
|
14
22
|
```
|
23
|
+
|
24
|
+
### Authentication
|
25
|
+
|
26
|
+
If you want to authenticate users who can access Simple Static Pages Admin Panel, you need to provide `SimpleStaticPages::Admins::PagesController.authenticator` proc. For example :
|
27
|
+
|
28
|
+
```ruby
|
29
|
+
# config/initializers/simple_static_pages.rb
|
30
|
+
SimpleStaticPages::Admins::PagesController.authenticator = proc {
|
31
|
+
authenticate_or_request_with_http_basic do |user_name, password|
|
32
|
+
user_name == 'simple_static_pages' && password == 'simple_static_pages'
|
33
|
+
end
|
34
|
+
}
|
35
|
+
```
|
@@ -1,6 +1,9 @@
|
|
1
1
|
module SimpleStaticPages
|
2
2
|
class Admins::PagesController < SimpleStaticPages::ApplicationController
|
3
3
|
respond_to :html, :json, :xml, :js
|
4
|
+
|
5
|
+
before_filter :authenticate
|
6
|
+
|
4
7
|
layout 'application'
|
5
8
|
def index
|
6
9
|
@pages = Page.all
|
@@ -35,5 +38,11 @@ module SimpleStaticPages
|
|
35
38
|
@page.destroy
|
36
39
|
respond_with(:admins, @page)
|
37
40
|
end
|
41
|
+
|
42
|
+
cattr_accessor :authenticator
|
43
|
+
|
44
|
+
def authenticate
|
45
|
+
self.authenticator.bind(self).call if self.authenticator && self.authenticator.respond_to?(:call)
|
46
|
+
end
|
38
47
|
end
|
39
48
|
end
|
data/test/dummy/config/routes.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_static_pages
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- lab2023
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-06-
|
11
|
+
date: 2013-06-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - '>='
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: haml-rails
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: sqlite3
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|