tkh_content 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -2,6 +2,15 @@
2
2
 
3
3
 
4
4
 
5
+ ## 0.1.4
6
+
7
+ * Added pagination to the pages index method.
8
+ * Added pagination to blog home page.
9
+ * The user CANNOT delete the home page. For any reason whatsoever.
10
+ * Minor improvements to blog
11
+ * Translated German strings.
12
+
13
+
5
14
  ## 0.1.3
6
15
 
7
16
  * Debugged blog controller index method query. Now it's properly returning blog posts by most recently published and without offset. Still need to do the pagination.
@@ -9,7 +18,7 @@
9
18
 
10
19
  ## 0.1.2
11
20
 
12
- * Refactored generation of short_title attribute. Moved it ot the create_pages migration to avoid conflict in globalize3.
21
+ * Refactored generation of short_title attribute. Moved it to the create_pages migration to avoid conflict in globalize3.
13
22
 
14
23
 
15
24
  ## 0.1.1
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  This Rails engine puts the C in CMS. It provides the pages and the blog section.
4
4
 
5
- Primarily developed for Ten Thousand Hours but we are happy to share if anybody finds it useful.
5
+ Primarily developed for Ten Thousand Hours but we are happy to share if anybody finds it useful. It's meant primarily to be used with the tkh_cms gem suite but over time we want it to be used individually as well. The latter implementation will be accelerated if some issues and pull requests come in, denoting some interest out there.
6
6
 
7
7
  It's still embryonic but many improvements to come. The blog is now coming bit by bit.
8
8
 
@@ -46,7 +46,7 @@ Update the gem:
46
46
 
47
47
  $ bundle update tkh_content
48
48
 
49
- Update files, migrations, etc. This is only needed with a new minor version number ( second level from left )
49
+ Update files, migrations, etc. This is not always needed.
50
50
 
51
51
  $ rake tkh_content:update
52
52
 
@@ -1,7 +1,7 @@
1
1
  class BlogController < ApplicationController
2
2
 
3
3
  def index
4
- @posts = Page.for_blog.published.order('published_at desc')
4
+ @posts = Page.for_blog.published.order('published_at desc').paginate(:page => params[:page], :per_page => 20)
5
5
  render :layout => 'blog'
6
6
  end
7
7
 
@@ -4,7 +4,7 @@ class PagesController < ApplicationController
4
4
  before_filter :authenticate_with_admin, :except => 'show'
5
5
 
6
6
  def index
7
- @pages = Page.by_recent
7
+ @pages = Page.by_recent.paginate(:page => params[:page], :per_page => 35)
8
8
  switch_to_admin_layout
9
9
  end
10
10
 
@@ -43,9 +43,14 @@ class PagesController < ApplicationController
43
43
  end
44
44
 
45
45
  def destroy
46
- @page = Page.find(params[:id])
47
- @page.destroy
48
- redirect_to pages_url, notice: t('pages.destroy.notice')
46
+ unless params[:id].to_i == 1
47
+ @page = Page.find(params[:id])
48
+ @page.destroy
49
+ redirect_to pages_url, notice: t('pages.destroy.notice')
50
+ else # one should not be able to destroy the page #1 which is the site's home page
51
+ flash[:warning] = t('pages.destroy.root_warning')
52
+ redirect_to ( :back || pages_url )
53
+ end
49
54
  end
50
55
 
51
56
  def publish
@@ -1,16 +1,13 @@
1
- <% content_for :meta_title, 'Blog' %>
1
+ <% content_for :meta_title, 'Home' %>
2
2
 
3
3
  <% unless @posts.blank? %>
4
4
  <% for post in @posts %>
5
- <h1><%= link_to post.title, post %></h1>
6
- <p><%= link_to 'edit post', edit_page_path(post) %></p>
7
- <p>
8
- by <%= post.author.name %> on <%= l post.published_at, format: :default %> | <%= link_to 'Permalink.', post %>
9
- </p>
10
- <%= raw post.body %>
5
+ <div class="individual-post">
6
+ <h1><%= link_to post.title, post %></h1>
7
+ <p class="meta-info">by <%= post.author.name %> on <%= l post.published_at, format: :default %> | <%= link_to 'Permalink.', post %></p>
8
+ <%= raw post.body %>
9
+ </div>
11
10
  <% end %>
12
11
  <% end %>
13
12
 
14
-
15
-
16
-
13
+ <%= will_paginate @posts %>
@@ -36,6 +36,8 @@
36
36
  </tbody>
37
37
  </table>
38
38
 
39
+ <%= will_paginate @pages %>
40
+
39
41
  <%= link_to t('pages.create_new').capitalize, new_page_path, class: 'btn btn-primary' %>
40
42
 
41
43
  <%= render 'shared/admin_sidebar' %>
@@ -1,30 +1,31 @@
1
1
  de:
2
2
 
3
- are_you_sure: 'are you sure?'
4
- delete: 'delete'
5
- edit: 'edit'
6
- pages: 'pages'
7
- sections: 'sections'
8
-
3
+ are_you_sure: 'Bist Du sicher?'
4
+ delete: 'löschen'
5
+ edit: 'bearbeiten'
6
+ pages: 'Seiten'
7
+ sections: 'Abschnitte'
8
+
9
9
  activerecord:
10
10
  attributes:
11
11
  pages:
12
- title: "titre"
13
- short_title: 'titre raccourci'
14
- description: "description"
15
- body: "texte principal"
16
- for_the_blog: 'pour le blog'
17
-
12
+ title: "Überschrift"
13
+ short_title: 'Kurzüberschrifti'
14
+ description: "Beschreibung"
15
+ body: "Haupttext"
16
+ for_the_blog: 'Für den Blog'
17
+
18
18
  pages:
19
- author: 'author'
20
- create_new: 'create new page'
21
- published: 'published?'
22
-
19
+ author: 'Autor'
20
+ create_new: 'Neue Seite anlegen'
21
+ published: 'veröffentlichen?'
22
+
23
23
  create:
24
- notice: 'The page was successfully created.'
25
- warning: 'There was a problem saving the page'
24
+ notice: 'Diese Seite wurde erfolgreich angelegt.'
25
+ warning: 'Beim Speichern dieser Seite ist ein Problem aufgetreten'
26
26
  update:
27
- notice: 'The page was successfully updated.'
28
- warning: 'There was a problem saving the page'
27
+ notice: 'Die Seite wurde erfolgreich aktualisiert.'
28
+ warning: 'Beim Speichern der Seite ist ein Problem aufgetreten'
29
29
  destroy:
30
- notice: 'The page was deleted'
30
+ notice: 'Die Seite wurde gelöscht'
31
+ root_warning: "You cannot delete this page as this is the root page of the site. You should only modify it."
@@ -19,3 +19,4 @@ en:
19
19
  warning: 'There was a problem saving the page'
20
20
  destroy:
21
21
  notice: 'The page was deleted'
22
+ root_warning: "You cannot delete this page as this is the root page of the site. You should only modify it."
@@ -28,5 +28,6 @@ es:
28
28
  warning: 'Hubo un problema al guardar la página'
29
29
  destroy:
30
30
  notice: 'la página se ha eliminado'
31
+ root_warning: "No se puede eliminar la página, ya que es la bienvenida principal. Por favor, cámbialo."
31
32
 
32
33
 
@@ -27,4 +27,5 @@ fr:
27
27
  notice: 'Les changements de cette page ont été sauvegardés'
28
28
  warning: "Il y'a eu un probleme et les changements de cette page n'ont pas été sauvegardés"
29
29
  destroy:
30
- notice: 'La page a été supprimée'
30
+ notice: 'La page a été supprimée'
31
+ root_warning: "Vous ne pouvez pas supprimer cette page parce que c'est la page principale de bienvenue. Veuillez la modifier."
data/lib/tkh_content.rb CHANGED
@@ -3,6 +3,8 @@ require 'bootstrap-sass'
3
3
  require 'simple_form'
4
4
  require 'stringex'
5
5
  require 'globalize3'
6
+ require 'will_paginate'
7
+ require 'bootstrap-will_paginate'
6
8
 
7
9
  module TkhContent
8
10
  class Engine < ::Rails::Engine
@@ -1,3 +1,3 @@
1
1
  module TkhContent
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tkh_content
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-04 00:00:00.000000000 Z
12
+ date: 2012-09-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -91,6 +91,38 @@ dependencies:
91
91
  - - ~>
92
92
  - !ruby/object:Gem::Version
93
93
  version: '0.2'
94
+ - !ruby/object:Gem::Dependency
95
+ name: will_paginate
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ~>
100
+ - !ruby/object:Gem::Version
101
+ version: '3.0'
102
+ type: :runtime
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ~>
108
+ - !ruby/object:Gem::Version
109
+ version: '3.0'
110
+ - !ruby/object:Gem::Dependency
111
+ name: bootstrap-will_paginate
112
+ requirement: !ruby/object:Gem::Requirement
113
+ none: false
114
+ requirements:
115
+ - - ! '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ! '>='
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
94
126
  - !ruby/object:Gem::Dependency
95
127
  name: sqlite3
96
128
  requirement: !ruby/object:Gem::Requirement
@@ -187,7 +219,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
187
219
  version: '0'
188
220
  segments:
189
221
  - 0
190
- hash: -1251104337554282840
222
+ hash: -1172791185126554956
191
223
  required_rubygems_version: !ruby/object:Gem::Requirement
192
224
  none: false
193
225
  requirements:
@@ -196,7 +228,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
196
228
  version: '0'
197
229
  segments:
198
230
  - 0
199
- hash: -1251104337554282840
231
+ hash: -1172791185126554956
200
232
  requirements: []
201
233
  rubyforge_project:
202
234
  rubygems_version: 1.8.23