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 +10 -1
- data/README.md +2 -2
- data/app/controllers/blog_controller.rb +1 -1
- data/app/controllers/pages_controller.rb +9 -4
- data/app/views/blog/index.html.erb +7 -10
- data/app/views/pages/index.html.erb +2 -0
- data/lib/generators/tkh_content/create_or_update_locales/templates/de.yml +22 -21
- data/lib/generators/tkh_content/create_or_update_locales/templates/en.yml +1 -0
- data/lib/generators/tkh_content/create_or_update_locales/templates/es.yml +1 -0
- data/lib/generators/tkh_content/create_or_update_locales/templates/fr.yml +2 -1
- data/lib/tkh_content.rb +2 -0
- data/lib/tkh_content/version.rb +1 -1
- metadata +36 -4
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
|
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
|
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
|
-
|
47
|
-
|
48
|
-
|
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, '
|
1
|
+
<% content_for :meta_title, 'Home' %>
|
2
2
|
|
3
3
|
<% unless @posts.blank? %>
|
4
4
|
<% for post in @posts %>
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
</
|
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 %>
|
@@ -1,30 +1,31 @@
|
|
1
1
|
de:
|
2
2
|
|
3
|
-
are_you_sure: '
|
4
|
-
delete: '
|
5
|
-
edit: '
|
6
|
-
pages: '
|
7
|
-
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: "
|
13
|
-
short_title: '
|
14
|
-
description: "
|
15
|
-
body: "
|
16
|
-
for_the_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: '
|
20
|
-
create_new: '
|
21
|
-
published: '
|
22
|
-
|
19
|
+
author: 'Autor'
|
20
|
+
create_new: 'Neue Seite anlegen'
|
21
|
+
published: 'veröffentlichen?'
|
22
|
+
|
23
23
|
create:
|
24
|
-
notice: '
|
25
|
-
warning: '
|
24
|
+
notice: 'Diese Seite wurde erfolgreich angelegt.'
|
25
|
+
warning: 'Beim Speichern dieser Seite ist ein Problem aufgetreten'
|
26
26
|
update:
|
27
|
-
notice: '
|
28
|
-
warning: '
|
27
|
+
notice: 'Die Seite wurde erfolgreich aktualisiert.'
|
28
|
+
warning: 'Beim Speichern der Seite ist ein Problem aufgetreten'
|
29
29
|
destroy:
|
30
|
-
notice: '
|
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."
|
@@ -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
data/lib/tkh_content/version.rb
CHANGED
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.
|
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-
|
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: -
|
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: -
|
231
|
+
hash: -1172791185126554956
|
200
232
|
requirements: []
|
201
233
|
rubyforge_project:
|
202
234
|
rubygems_version: 1.8.23
|