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 ADDED
@@ -0,0 +1,6 @@
1
+ == 0.0.4
2
+
3
+ * enhancements
4
+ * namespaced cms layouts
5
+ * default page for root_url
6
+ * articles are rendered as templates
data/Gemfile.lock CHANGED
@@ -1,12 +1,12 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- kuztuscms (0.0.1)
4
+ kuztuscms (0.0.3)
5
5
  actionmailer
6
6
  coffee-rails
7
- devise
7
+ devise (>= 2.0.4)
8
8
  omniauth
9
- rails
9
+ rails (>= 3.1)
10
10
  sass-rails
11
11
  tzinfo
12
12
  uglifier
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
- if @page = Page.find_by_path(params[:page])
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
@@ -14,7 +14,7 @@ class KuztuscmsController < ActionController::Base
14
14
 
15
15
  def after_sign_out_path_for(resource_or_scope)
16
16
  kuztuscms.root_path
17
- end
17
+ end
18
18
 
19
19
  def signed_in_root_path(resource_or_scope)
20
20
  kuztuscms.root_path
@@ -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
- <%=raw @article.body %>
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
@@ -0,0 +1,5 @@
1
+ class AddDefaultToKuztuscmsPages < ActiveRecord::Migration
2
+ def change
3
+ add_column :kuztuscms_pages, :default, :boolean
4
+ end
5
+ end
@@ -1,3 +1,3 @@
1
1
  module Kuztuscms
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
data/lib/kuztuscms.rb CHANGED
@@ -4,4 +4,8 @@ require "kuztuscms/engine"
4
4
 
5
5
  module Kuztuscms
6
6
  autoload :Settings, 'kuztuscms/settings'
7
+
8
+ # namespace cms layouts
9
+ mattr_accessor :layout_prefix
10
+ @@layout_prefix = 'kuztuscms_layout_'
7
11
  end
@@ -1,8 +1,7 @@
1
1
  Rails.application.routes.draw do
2
-
3
- root :to => 'home#index'
4
-
5
2
  mount Kuztuscms::Engine => "/kuztuscms"
6
-
7
3
  get '/*page' => 'kuztuscms/pages#show'
4
+
5
+ root :to => 'home#index'
6
+ #root :to => 'kuztuscms/pages#show'
8
7
  end
@@ -0,0 +1,6 @@
1
+ # This migration comes from kuztuscms (originally 20120317201453)
2
+ class AddDefaultToKuztuscmsPages < ActiveRecord::Migration
3
+ def change
4
+ add_column :kuztuscms_pages, :default, :boolean
5
+ end
6
+ end
@@ -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 => 20120316084434) do
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.3
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-17 00:00:00.000000000 Z
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: &70280454469220 !ruby/object:Gem::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: *70280454469220
24
+ version_requirements: *70313732041080
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: sass-rails
27
- requirement: &70280454465840 !ruby/object:Gem::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: *70280454465840
35
+ version_requirements: *70313732035300
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: coffee-rails
38
- requirement: &70280454458660 !ruby/object:Gem::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: *70280454458660
46
+ version_requirements: *70313732025360
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: uglifier
49
- requirement: &70280454281160 !ruby/object:Gem::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: *70280454281160
57
+ version_requirements: *70313731887180
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: devise
60
- requirement: &70280454273120 !ruby/object:Gem::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: *70280454273120
68
+ version_requirements: *70313731879940
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: tzinfo
71
- requirement: &70280454267780 !ruby/object:Gem::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: *70280454267780
79
+ version_requirements: *70313731874440
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: omniauth
82
- requirement: &70280454264700 !ruby/object:Gem::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: *70280454264700
90
+ version_requirements: *70313731870680
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: actionmailer
93
- requirement: &70280454262080 !ruby/object:Gem::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: *70280454262080
101
+ version_requirements: *70313731867160
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: sqlite3
104
- requirement: &70280454257960 !ruby/object:Gem::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: *70280454257960
112
+ version_requirements: *70313731864720
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: rspec-rails
115
- requirement: &70280454255940 !ruby/object:Gem::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: *70280454255940
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