kuztuscms 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.rdoc +6 -0
- data/Gemfile.lock +3 -3
- data/README.rdoc +4 -0
- data/app/controllers/kuztuscms/pages_controller.rb +7 -4
- data/app/controllers/kuztuscms_controller.rb +1 -1
- data/app/models/kuztuscms/layout.rb +2 -0
- data/app/models/kuztuscms/page.rb +8 -0
- data/app/views/kuztuscms/pages/_form.html.erb +8 -0
- data/app/views/kuztuscms/pages/index.html.erb +2 -0
- data/app/views/kuztuscms/pages/show.html.erb +1 -1
- data/config/initializers/resolver.rb +1 -1
- data/db/migrate/20120317201453_add_default_to_kuztuscms_pages.rb +5 -0
- data/lib/kuztuscms/version.rb +1 -1
- data/lib/kuztuscms.rb +4 -0
- data/spec/dummy/config/routes.rb +3 -4
- data/spec/dummy/db/migrate/20120317202305_add_default_to_kuztuscms_pages.kuztuscms.rb +6 -0
- data/spec/dummy/db/schema.rb +2 -1
- metadata +25 -22
data/CHANGELOG.rdoc
ADDED
data/Gemfile.lock
CHANGED
data/README.rdoc
CHANGED
@@ -20,6 +20,10 @@ add to your config/routes.rb
|
|
20
20
|
mount Kuztuscms::Engine => "/kuztuscms"
|
21
21
|
get '/*page' => 'kuztuscms/pages#show'
|
22
22
|
|
23
|
+
if you want to show default page as root_url then add following line to config/routes.rb
|
24
|
+
|
25
|
+
root :to => 'kuztuscms/page#show'
|
26
|
+
|
23
27
|
run
|
24
28
|
|
25
29
|
rails server
|
@@ -1,8 +1,8 @@
|
|
1
1
|
module Kuztuscms
|
2
2
|
class PagesController < KuztuscmsController
|
3
3
|
append_view_path Kuztuscms::Resolver.instance
|
4
|
-
before_filter :authenticate_for_cms!, :except => [:show]
|
5
4
|
|
5
|
+
before_filter :authenticate_for_cms!, :except => [:show]
|
6
6
|
before_filter :build_articles_list, :only => [:new, :edit, :create, :update]
|
7
7
|
before_filter :build_layouts_list, :only => [:new, :edit, :create, :update]
|
8
8
|
|
@@ -12,10 +12,13 @@ module Kuztuscms
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def show
|
15
|
-
|
15
|
+
@page = Page.find_by_path(params[:page])
|
16
|
+
@page = Page.default.first if params[:page].blank? && @page.blank?
|
17
|
+
|
18
|
+
if @page
|
16
19
|
@settings = Kuztuscms::Settings
|
17
20
|
@article = @page.article
|
18
|
-
render :layout => @page.layout.path
|
21
|
+
render :layout => "#{Kuztuscms.layout_prefix}#{@page.layout.path}"
|
19
22
|
else
|
20
23
|
raise ActionController::RoutingError.new('Not Found')
|
21
24
|
end
|
@@ -61,7 +64,7 @@ module Kuztuscms
|
|
61
64
|
redirect_to kuztuscms.pages_url
|
62
65
|
end
|
63
66
|
|
64
|
-
private
|
67
|
+
private
|
65
68
|
|
66
69
|
def build_layouts_list
|
67
70
|
@layouts = Layout.all
|
@@ -7,6 +7,8 @@ module Kuztuscms
|
|
7
7
|
validates :locale, :inclusion => I18n.available_locales.map(&:to_s)
|
8
8
|
validates :handler, :inclusion => ActionView::Template::Handlers.extensions.map(&:to_s)
|
9
9
|
|
10
|
+
class_attribute :prefix
|
11
|
+
|
10
12
|
after_save do
|
11
13
|
Kuztuscms::Resolver.instance.clear_cache
|
12
14
|
end
|
@@ -4,5 +4,13 @@ module Kuztuscms
|
|
4
4
|
belongs_to :article, :foreign_key => :article_id, :class_name => 'Article'
|
5
5
|
|
6
6
|
validates :name, :path, :layout_id, :article_id, :presence => true
|
7
|
+
validates :default, :uniqueness => true, :if => :default
|
8
|
+
|
9
|
+
class << self
|
10
|
+
def default
|
11
|
+
where(:default => true)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
7
15
|
end
|
8
16
|
end
|
@@ -64,6 +64,14 @@
|
|
64
64
|
</div>
|
65
65
|
</div>
|
66
66
|
|
67
|
+
<div class="control-group">
|
68
|
+
<div class="controls">
|
69
|
+
<label class="checkbox">
|
70
|
+
<%= f.check_box :default %> <%= f.label :default %>
|
71
|
+
</label>
|
72
|
+
</div>
|
73
|
+
</div>
|
74
|
+
|
67
75
|
<div class="form-actions">
|
68
76
|
<%= f.submit nil, :class => 'btn btn-primary' %>
|
69
77
|
<%= link_to 'Cancel', kuztuscms.pages_path, :class => 'btn' %>
|
@@ -6,6 +6,7 @@
|
|
6
6
|
<th>Path</th>
|
7
7
|
<th>Article</th>
|
8
8
|
<th>Layout</th>
|
9
|
+
<th>Default</th>
|
9
10
|
<th>Actions</th>
|
10
11
|
</tr>
|
11
12
|
</thead>
|
@@ -16,6 +17,7 @@
|
|
16
17
|
<td><%= page.path %></td>
|
17
18
|
<td><%= page.article.name %></td>
|
18
19
|
<td><%= page.layout.path %></td>
|
20
|
+
<td><%= page.default %></td>
|
19
21
|
<td>
|
20
22
|
<%= link_to 'Edit', kuztuscms.edit_page_path(page), :class => 'btn btn-mini' %>
|
21
23
|
<%= link_to 'Destroy', kuztuscms.page_path(page), :method => :delete, :confirm => 'Are you sure?', :class => 'btn btn-mini btn-danger' %>
|
@@ -1 +1 @@
|
|
1
|
-
<%=
|
1
|
+
<%=render :inline => @article.body %>
|
@@ -27,7 +27,7 @@ module Kuztuscms
|
|
27
27
|
# "users/index" and the tuple ["template", nil] becomes "template".
|
28
28
|
def normalize_path(name, prefix)
|
29
29
|
return name if prefix == "kuztuscms/pages"
|
30
|
-
return name if prefix == "layouts"
|
30
|
+
return name.gsub(/^#{Kuztuscms.layout_prefix}/, '') if prefix == "layouts"
|
31
31
|
|
32
32
|
prefix.present? ? "#{prefix}/#{name}" : name
|
33
33
|
end
|
data/lib/kuztuscms/version.rb
CHANGED
data/lib/kuztuscms.rb
CHANGED
data/spec/dummy/config/routes.rb
CHANGED
data/spec/dummy/db/schema.rb
CHANGED
@@ -11,7 +11,7 @@
|
|
11
11
|
#
|
12
12
|
# It's strongly recommended to check this file into your version control system.
|
13
13
|
|
14
|
-
ActiveRecord::Schema.define(:version =>
|
14
|
+
ActiveRecord::Schema.define(:version => 20120317202305) do
|
15
15
|
|
16
16
|
create_table "kuztuscms_articles", :force => true do |t|
|
17
17
|
t.string "name"
|
@@ -41,6 +41,7 @@ ActiveRecord::Schema.define(:version => 20120316084434) do
|
|
41
41
|
t.integer "article_id"
|
42
42
|
t.datetime "created_at", :null => false
|
43
43
|
t.datetime "updated_at", :null => false
|
44
|
+
t.boolean "default"
|
44
45
|
end
|
45
46
|
|
46
47
|
create_table "kuztuscms_settings", :force => true do |t|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kuztuscms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-03-
|
12
|
+
date: 2012-03-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
16
|
-
requirement: &
|
16
|
+
requirement: &70313732041080 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '3.1'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70313732041080
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: sass-rails
|
27
|
-
requirement: &
|
27
|
+
requirement: &70313732035300 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70313732035300
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: coffee-rails
|
38
|
-
requirement: &
|
38
|
+
requirement: &70313732025360 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70313732025360
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: uglifier
|
49
|
-
requirement: &
|
49
|
+
requirement: &70313731887180 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70313731887180
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: devise
|
60
|
-
requirement: &
|
60
|
+
requirement: &70313731879940 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: 2.0.4
|
66
66
|
type: :runtime
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70313731879940
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: tzinfo
|
71
|
-
requirement: &
|
71
|
+
requirement: &70313731874440 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: '0'
|
77
77
|
type: :runtime
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *70313731874440
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: omniauth
|
82
|
-
requirement: &
|
82
|
+
requirement: &70313731870680 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ! '>='
|
@@ -87,10 +87,10 @@ dependencies:
|
|
87
87
|
version: '0'
|
88
88
|
type: :runtime
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *70313731870680
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: actionmailer
|
93
|
-
requirement: &
|
93
|
+
requirement: &70313731867160 !ruby/object:Gem::Requirement
|
94
94
|
none: false
|
95
95
|
requirements:
|
96
96
|
- - ! '>='
|
@@ -98,10 +98,10 @@ dependencies:
|
|
98
98
|
version: '0'
|
99
99
|
type: :runtime
|
100
100
|
prerelease: false
|
101
|
-
version_requirements: *
|
101
|
+
version_requirements: *70313731867160
|
102
102
|
- !ruby/object:Gem::Dependency
|
103
103
|
name: sqlite3
|
104
|
-
requirement: &
|
104
|
+
requirement: &70313731864720 !ruby/object:Gem::Requirement
|
105
105
|
none: false
|
106
106
|
requirements:
|
107
107
|
- - ! '>='
|
@@ -109,10 +109,10 @@ dependencies:
|
|
109
109
|
version: '0'
|
110
110
|
type: :development
|
111
111
|
prerelease: false
|
112
|
-
version_requirements: *
|
112
|
+
version_requirements: *70313731864720
|
113
113
|
- !ruby/object:Gem::Dependency
|
114
114
|
name: rspec-rails
|
115
|
-
requirement: &
|
115
|
+
requirement: &70313731863240 !ruby/object:Gem::Requirement
|
116
116
|
none: false
|
117
117
|
requirements:
|
118
118
|
- - ! '>='
|
@@ -120,7 +120,7 @@ dependencies:
|
|
120
120
|
version: '0'
|
121
121
|
type: :development
|
122
122
|
prerelease: false
|
123
|
-
version_requirements: *
|
123
|
+
version_requirements: *70313731863240
|
124
124
|
description: KuztusCMS for rails >= 3.1
|
125
125
|
email:
|
126
126
|
- dummy@email.com
|
@@ -130,6 +130,7 @@ extra_rdoc_files: []
|
|
130
130
|
files:
|
131
131
|
- .gitignore
|
132
132
|
- .rvmrc
|
133
|
+
- CHANGELOG.rdoc
|
133
134
|
- Gemfile
|
134
135
|
- Gemfile.lock
|
135
136
|
- MIT-LICENSE
|
@@ -214,6 +215,7 @@ files:
|
|
214
215
|
- db/migrate/20120311141419_create_kuztuscms_articles.rb
|
215
216
|
- db/migrate/20120311173954_create_kuztuscms_layouts.rb
|
216
217
|
- db/migrate/20120316081613_create_kuztuscms_settings.rb
|
218
|
+
- db/migrate/20120317201453_add_default_to_kuztuscms_pages.rb
|
217
219
|
- kuztuscms.gemspec
|
218
220
|
- lib/kuztuscms.rb
|
219
221
|
- lib/kuztuscms/engine.rb
|
@@ -265,6 +267,7 @@ files:
|
|
265
267
|
- spec/dummy/db/migrate/20120313083014_create_kuztuscms_articles.kuztuscms.rb
|
266
268
|
- spec/dummy/db/migrate/20120313083015_create_kuztuscms_layouts.kuztuscms.rb
|
267
269
|
- spec/dummy/db/migrate/20120316084434_create_kuztuscms_settings.kuztuscms.rb
|
270
|
+
- spec/dummy/db/migrate/20120317202305_add_default_to_kuztuscms_pages.kuztuscms.rb
|
268
271
|
- spec/dummy/db/schema.rb
|
269
272
|
- spec/dummy/lib/assets/.gitkeep
|
270
273
|
- spec/dummy/log/.gitkeep
|