simple-pages-rails 0.5.0 → 0.6.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/simple_pages/pages_controller.rb +10 -2
- data/app/models/simple_pages/page.rb +0 -2
- data/app/views/simple_pages/pages/_table.html.erb +13 -11
- data/db/migrate/20130318034034_add_cluster_to_simple_pages.rb +1 -1
- data/lib/generators/simple_pages/templates/simple_pages.rb +3 -0
- data/lib/simple-pages-rails/version.rb +1 -1
- data/lib/simple_pages.rb +6 -0
- data/lib/simple_pages/models/page_cluster.rb +1 -2
- data/lib/simple_pages/models/page_owner.rb +0 -1
- data/lib/simple_pages/models/page_url.rb +0 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3d41286186d3466f03371243b10c95a323973cb8
|
4
|
+
data.tar.gz: 1ff02604adfdbb548791dad6b005082010db2825
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cdae70ecf369fcbc36c015a8aa6533b7c81ccaea1c6f4ee3374ee6d83630906f70bd93fe99401af2ad3a98a52b9467fb76ca091b22aa53ee12d8adb8ec89d928
|
7
|
+
data.tar.gz: af430b859d15ad2c71220a4e3f3018aebf80dad91181b1efa203a78e90c1ea1b0345b73a4ca4434e6b38d2dcf31454ea8dcb3f4867a9c894957ee972ec92dbf8
|
@@ -38,7 +38,7 @@ module SimplePages
|
|
38
38
|
end
|
39
39
|
|
40
40
|
def update
|
41
|
-
@page.update_attributes
|
41
|
+
@page.update_attributes page_params
|
42
42
|
if @page.invalid?
|
43
43
|
load_page_options
|
44
44
|
end
|
@@ -52,8 +52,16 @@ module SimplePages
|
|
52
52
|
|
53
53
|
protected
|
54
54
|
|
55
|
+
def page_params
|
56
|
+
if params.respond_to? :permit and params.has_key? :page
|
57
|
+
params.require(:page).permit(SimplePages.permitted_fields)
|
58
|
+
else
|
59
|
+
params[:page]
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
55
63
|
def new_page
|
56
|
-
@page = SimplePages::Page.new
|
64
|
+
@page = SimplePages::Page.new page_params
|
57
65
|
end
|
58
66
|
|
59
67
|
def load_page_options
|
@@ -2,8 +2,6 @@ module SimplePages
|
|
2
2
|
class Page < ActiveRecord::Base
|
3
3
|
self.table_name = SimplePages.page_table_name
|
4
4
|
|
5
|
-
attr_accessible :title, :excerpt, :content, :published_at, :layout_at
|
6
|
-
|
7
5
|
validates :title, presence: true
|
8
6
|
|
9
7
|
scope :published, lambda { where('published_at <= ?', Time.zone.now) }
|
@@ -15,17 +15,19 @@
|
|
15
15
|
<td><%= t(page.layout_at, scope: 'simple_pages.layout_at') if page.layout_at? %></td>
|
16
16
|
<td><%= page.author.name %></td>
|
17
17
|
<td><%= publish_time(page.published_at, page.updated_at) %></td>
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
18
|
+
<td class="actions">
|
19
|
+
<%= render_btn_group do |btn|
|
20
|
+
if can? :show, page
|
21
|
+
btn << link_to_show(page_path(page))
|
22
|
+
end
|
23
|
+
if can? :edit, page
|
24
|
+
btn << link_to_edit(edit_page_path(page))
|
25
|
+
end
|
26
|
+
if can? :destroy, page
|
27
|
+
btn << link_to_destroy(page_path(page))
|
28
|
+
end
|
29
|
+
end %>
|
30
|
+
</td>
|
29
31
|
</tr>
|
30
32
|
<% end %>
|
31
33
|
</tbody>
|
data/lib/simple_pages.rb
CHANGED
@@ -36,6 +36,12 @@ module SimplePages
|
|
36
36
|
mattr_accessor :pages_per_page
|
37
37
|
@@pages_per_page = 30
|
38
38
|
|
39
|
+
mattr_accessor :permitted_fields
|
40
|
+
@@permitted_fields = [
|
41
|
+
:url, :title, :excerpt, :content, :owner, :published_at,
|
42
|
+
:layout_at, { cluster: [] }
|
43
|
+
]
|
44
|
+
|
39
45
|
def self.configure
|
40
46
|
yield self
|
41
47
|
end
|
@@ -6,12 +6,11 @@ module SimplePages
|
|
6
6
|
extend ActiveSupport::Concern
|
7
7
|
included do
|
8
8
|
serialize :cluster
|
9
|
-
attr_accessible :cluster
|
10
9
|
end
|
11
10
|
|
12
11
|
module ClassMethods
|
13
12
|
def without_cluster
|
14
|
-
where(cluster: "--- \n...\n")
|
13
|
+
where(cluster: [nil, "--- \n...\n"])
|
15
14
|
end
|
16
15
|
|
17
16
|
def with_cluster(name)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple-pages-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tse-Ching Ho
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-08-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -304,7 +304,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
304
304
|
version: '0'
|
305
305
|
requirements: []
|
306
306
|
rubyforge_project:
|
307
|
-
rubygems_version: 2.0.
|
307
|
+
rubygems_version: 2.0.3
|
308
308
|
signing_key:
|
309
309
|
specification_version: 4
|
310
310
|
summary: provides simple pages with rails engine
|