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: 7874225b29584c5d5418a24935cde61773a58e71
4
- data.tar.gz: a03b30d0f42c762b90f6c96b75817d8cd7ba40ae
3
+ metadata.gz: 43b13fc8552363850bd73f8569508436b37e338d
4
+ data.tar.gz: af1fe6a4fcad1631d8ca6e033a05e796d6d7e6f2
5
5
  SHA512:
6
- metadata.gz: fb01a0dbe86368b882c1356c86b380ec5d8e07c09681620b695d59a83a96c520e5eae7e6a57973ebcf327579c4eb18d7329e6000e50deb620c00e197c9638290
7
- data.tar.gz: e143beab7c94f83fa2b4feda4eaff2520433e6825cf80bf1168d611b7d12efcf84cd183a184e44dd9bf8833feff63734f831ede1091456b15afb997081be9df7
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
@@ -1,3 +1,3 @@
1
1
  module SimpleStaticPages
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -1,5 +1,3 @@
1
1
  Rails.application.routes.draw do
2
-
3
2
  mount SimpleStaticPages::Engine => "/simple_static_pages"
4
- root :to => 'auth#index'
5
3
  end
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.2
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-01 00:00:00.000000000 Z
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