tkh_content 0.1 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +13 -0
- data/README.md +2 -1
- data/app/controllers/blog_controller.rb +94 -0
- data/app/controllers/pages_controller.rb +21 -0
- data/app/models/page.rb +38 -3
- data/app/views/blog/index.html.erb +16 -0
- data/app/views/pages/_form.html.erb +6 -4
- data/app/views/pages/index.html.erb +11 -2
- data/app/views/pages/show.html.erb +7 -4
- data/config/routes.rb +8 -1
- data/lib/generators/tkh_content/create_or_update_locales/templates/de.yml +30 -0
- data/lib/generators/tkh_content/create_or_update_locales/templates/en.yml +0 -16
- data/lib/generators/tkh_content/create_or_update_locales/templates/es.yml +2 -2
- data/lib/generators/tkh_content/create_or_update_locales/templates/fr.yml +4 -183
- data/lib/generators/tkh_content/create_or_update_migrations/create_or_update_migrations_generator.rb +1 -0
- data/lib/generators/tkh_content/create_or_update_migrations/templates/add_short_title_to_pages.rb +6 -0
- data/lib/tkh_content.rb +1 -0
- data/lib/tkh_content/version.rb +1 -1
- metadata +24 -4
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,19 @@
|
|
2
2
|
|
3
3
|
|
4
4
|
|
5
|
+
|
6
|
+
## 0.1.1
|
7
|
+
|
8
|
+
* Creation of blog section
|
9
|
+
* Page title in h1 in show view only for blog posts
|
10
|
+
* Refactored meta_title generation
|
11
|
+
* Added short title page attribute mostly used for menus
|
12
|
+
* Pages act as a tree to build menu system
|
13
|
+
* Pages are either published or draft according to published_at attribute
|
14
|
+
* Needs a shared/menus partial or the tkh_menus gem
|
15
|
+
* Cleaned up some locale files and added the German locale but it's not translated yet
|
16
|
+
|
17
|
+
|
5
18
|
## 0.1
|
6
19
|
|
7
20
|
* Reverted pages show route to that one of a normal resource
|
data/README.md
CHANGED
@@ -4,7 +4,7 @@ This Rails engine puts the C in CMS. It provides the pages and the blog section.
|
|
4
4
|
|
5
5
|
Primarily developed for Ten Thousand Hours but we are happy to share if anybody finds it useful.
|
6
6
|
|
7
|
-
It's still embryonic but many improvements to come. The blog is
|
7
|
+
It's still embryonic but many improvements to come. The blog is now coming bit by bit.
|
8
8
|
|
9
9
|
|
10
10
|
|
@@ -14,6 +14,7 @@ It's still embryonic but many improvements to come. The blog is not in yet.
|
|
14
14
|
The following things are needed:
|
15
15
|
|
16
16
|
* Ruby 1.9.2 or later
|
17
|
+
* A shared/menus view partial or the tkh_menus gem
|
17
18
|
|
18
19
|
|
19
20
|
## Installation
|
@@ -0,0 +1,94 @@
|
|
1
|
+
class BlogController < ApplicationController
|
2
|
+
|
3
|
+
def index
|
4
|
+
@posts = Page.for_blog.published.order('updated_at').offset(60).limit(30)
|
5
|
+
render :layout => 'blog'
|
6
|
+
end
|
7
|
+
|
8
|
+
def update_data
|
9
|
+
|
10
|
+
@count = 0
|
11
|
+
@pages = Array.new
|
12
|
+
|
13
|
+
Page.all.each do |page|
|
14
|
+
# determine whether page contains path
|
15
|
+
if page.body.match /src="\/system\/photos\/.*\.jpg/
|
16
|
+
# extract string to be changed
|
17
|
+
# match_data = page.body.match /src="\/system\/photos\/.*\.jpg/
|
18
|
+
# # extract an image name with jpg extension in the blog/2006 section
|
19
|
+
# extracted_image = match_data.to_s.sub("src=\"/images/photos/", '')
|
20
|
+
# # find the corresponding illustration
|
21
|
+
# illustration = Illustration.find_by_name(extracted_image)
|
22
|
+
# if illustration
|
23
|
+
# # change the image path
|
24
|
+
# page.body = page.body.sub("/images/blog/2007/", "/system/images/illustration/#{illustration.id}/large_")
|
25
|
+
# # save the page with new path
|
26
|
+
# page.save
|
27
|
+
# end
|
28
|
+
@count += 1
|
29
|
+
@pages << page
|
30
|
+
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
# @list_of_files = Array.new
|
35
|
+
|
36
|
+
# @count = 0
|
37
|
+
|
38
|
+
# Illustration.all.each do |illustration|
|
39
|
+
#
|
40
|
+
# if illustration.name == 'No name given'
|
41
|
+
#
|
42
|
+
# illustration.destroy
|
43
|
+
# @count += 1
|
44
|
+
#
|
45
|
+
# end
|
46
|
+
#
|
47
|
+
# # # extract an image name with jpg extension in the blog/2006 section
|
48
|
+
# # extracted_image = page.body.match(/src="\/images\/blog\/2006\/.*\.jpg/).to_s.sub("src=\"/images/blog/2006/", '')
|
49
|
+
# #
|
50
|
+
# # if extracted_image
|
51
|
+
# #
|
52
|
+
# # # find the corresponding illustration
|
53
|
+
# # @illustration = Illustration.find_by_image(File.basename("/Users/swamiatma/Documents/railsapps/aya/public/images/blog/2006/#{extracted_image}"))
|
54
|
+
# #
|
55
|
+
# # if @illustration
|
56
|
+
# # # change the path of the image
|
57
|
+
# # page.body = page.body.sub("/images/blog/2006/", "/system/images/illustration/#{@illustration.id}/large_")
|
58
|
+
# # # save the page with new path
|
59
|
+
# # page.save
|
60
|
+
# #
|
61
|
+
# # count += 1
|
62
|
+
# # extracted_image = nil
|
63
|
+
# # end
|
64
|
+
# #
|
65
|
+
# # end
|
66
|
+
#
|
67
|
+
# end
|
68
|
+
|
69
|
+
# # take a blog post as an example
|
70
|
+
# @page = Page.find(9)
|
71
|
+
|
72
|
+
|
73
|
+
# redirect_to blog_path, notice: "#{count} wp images have been detected"
|
74
|
+
#
|
75
|
+
# count = 0
|
76
|
+
#
|
77
|
+
# Dir["/Users/swamiatma/Documents/railsapps/aya/public/images/photos/*.*"].each do |file|
|
78
|
+
#
|
79
|
+
# illustration = Illustration.new
|
80
|
+
# illustration.image = File.open(file)
|
81
|
+
# illustration.name = "photos-#{File.basename(file)}"
|
82
|
+
# illustration.save
|
83
|
+
#
|
84
|
+
# count += 1
|
85
|
+
#
|
86
|
+
# end
|
87
|
+
#
|
88
|
+
#
|
89
|
+
# redirect_to illustrations_path, notice: "#{count} new illustrations should be uploaded"
|
90
|
+
|
91
|
+
|
92
|
+
end
|
93
|
+
|
94
|
+
end
|
@@ -48,4 +48,25 @@ class PagesController < ApplicationController
|
|
48
48
|
redirect_to pages_url, notice: t('pages.destroy.notice')
|
49
49
|
end
|
50
50
|
|
51
|
+
def publish
|
52
|
+
page = Page.find(params[:id])
|
53
|
+
page.published_at = Time.now
|
54
|
+
page.save
|
55
|
+
redirect_to pages_path, notice: 'The page has been published'
|
56
|
+
end
|
57
|
+
|
58
|
+
def unpublish
|
59
|
+
page = Page.find(params[:id])
|
60
|
+
page.published_at = nil
|
61
|
+
page.save
|
62
|
+
redirect_to pages_path, notice: "The page has been unpublished. It's a draft again."
|
63
|
+
end
|
64
|
+
|
65
|
+
def toggle_for_blog
|
66
|
+
page = Page.find(params[:id])
|
67
|
+
page.for_blog? ? page.for_blog = false : page.for_blog = true
|
68
|
+
page.save
|
69
|
+
redirect_to pages_path notice: "The blog status of the page has been changed"
|
70
|
+
end
|
71
|
+
|
51
72
|
end
|
data/app/models/page.rb
CHANGED
@@ -7,19 +7,54 @@ class Page < ActiveRecord::Base
|
|
7
7
|
|
8
8
|
belongs_to :author, class_name: 'User', foreign_key: 'author_id'
|
9
9
|
|
10
|
-
attr_accessible :
|
10
|
+
attr_accessible :title, :short_title, :description, :body, :for_blog, :parent_id
|
11
11
|
|
12
12
|
validates_presence_of :title
|
13
13
|
validates_presence_of :description
|
14
14
|
validates_presence_of :body
|
15
15
|
validates_presence_of :author_id
|
16
16
|
|
17
|
-
translates :title, :description, :body
|
17
|
+
translates :title, :short_title, :description, :body
|
18
18
|
|
19
19
|
def to_param
|
20
20
|
title ? "#{id}-#{title.to_url}" : id
|
21
21
|
end
|
22
22
|
|
23
|
-
scope :by_recent,
|
23
|
+
scope :by_recent, order('updated_at desc')
|
24
|
+
scope :for_blog, where('for_blog = ?', true)
|
25
|
+
scope :not_for_blog, where('for_blog = ?', false)
|
26
|
+
scope :published, where('published_at IS NOT ?', nil)
|
27
|
+
scope :by_recently_published, order('published_at desc')
|
28
|
+
# tree scopes
|
29
|
+
scope :orphans, where('parent_id IS ?', nil)
|
30
|
+
scope :with_parent_id, lambda { |id| where('parent_id = ?', id) }
|
31
|
+
|
32
|
+
def nickname
|
33
|
+
short_title || title
|
34
|
+
end
|
35
|
+
|
36
|
+
def orphan?
|
37
|
+
parent_id == nil
|
38
|
+
end
|
39
|
+
|
40
|
+
def has_children?
|
41
|
+
Page.with_parent_id(id).count >= 1
|
42
|
+
end
|
43
|
+
|
44
|
+
def children
|
45
|
+
Page.with_parent_id(id)
|
46
|
+
end
|
47
|
+
|
48
|
+
def parent
|
49
|
+
Page.find(parent_id)
|
50
|
+
end
|
51
|
+
|
52
|
+
def has_siblings?
|
53
|
+
Page.with_parent_id(parent_id).count >= 1
|
54
|
+
end
|
55
|
+
|
56
|
+
def siblings
|
57
|
+
Page.with_parent_id(parent_id)
|
58
|
+
end
|
24
59
|
|
25
60
|
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<% content_for :meta_title, 'Blog' %>
|
2
|
+
|
3
|
+
<% unless @posts.blank? %>
|
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 %>
|
11
|
+
<% end %>
|
12
|
+
<% end %>
|
13
|
+
|
14
|
+
|
15
|
+
|
16
|
+
|
@@ -2,10 +2,12 @@
|
|
2
2
|
<%= f.error_notification %>
|
3
3
|
|
4
4
|
<div class="form-inputs">
|
5
|
-
<%= f.input :title %><br
|
6
|
-
<%= f.input :
|
7
|
-
|
8
|
-
<%= f.input :
|
5
|
+
<%= f.input :title, hint: 'nice and descriptive' %><br />
|
6
|
+
<%= f.input :short_title, hint: 'ideally one word only, used for the menu' %><br />
|
7
|
+
<%= f.input :parent_id %><br />
|
8
|
+
<%= f.input :for_blog %><br />
|
9
|
+
<%= f.input :description, :input_html => { :rows => 3 } %>
|
10
|
+
<%= f.input :body, :input_html => { :rows => 25 } %>
|
9
11
|
</div>
|
10
12
|
|
11
13
|
<div class="form-actions">
|
@@ -18,8 +18,17 @@
|
|
18
18
|
<td><%= link_to page.title, page %></td>
|
19
19
|
<td><%= truncate page.description, length: 55, separator: ' ...' %></td>
|
20
20
|
<td><%= page.author.name %></td>
|
21
|
-
<td
|
22
|
-
|
21
|
+
<td>
|
22
|
+
<%= page.for_blog? ? "<span class=\"label label-success\">✓</span>".html_safe : "<span class=\"label label-important\">X</span>".html_safe %>
|
23
|
+
<%= link_to 'toggle', toggle_for_blog_page_path(page), class: 'btn btn-mini', method: :post %>
|
24
|
+
</td>
|
25
|
+
<td>
|
26
|
+
<% if page.published_at %>
|
27
|
+
<span class="label label-success">✓</span> <%= link_to 'unpublish', unpublish_page_path(page), class: 'btn btn-mini', method: :post %>
|
28
|
+
<% else %>
|
29
|
+
<span class="label label-important">X</span> <%= link_to 'publish', publish_page_path(page), class: 'btn btn-mini btn-primary', method: :post %>
|
30
|
+
<% end -%>
|
31
|
+
</td>
|
23
32
|
<td><%= link_to t('edit'), edit_page_path(page), class: 'btn btn-mini' %>
|
24
33
|
<%= link_to t('delete'), page, method: :delete, data: { confirm: t('are_you_sure') }, class: 'btn btn-mini btn-danger' %></td>
|
25
34
|
</tr>
|
@@ -1,6 +1,9 @@
|
|
1
|
-
<%
|
2
|
-
<%
|
1
|
+
<% content_for :meta_title, @page.title %>
|
2
|
+
<% content_for :meta_description, @page.description %>
|
3
3
|
|
4
|
-
|
4
|
+
<%= content_tag(:h1, @page.title) if @page.for_blog? %>
|
5
5
|
|
6
|
-
<%= raw @page.body %>
|
6
|
+
<%= raw @page.body %>
|
7
|
+
|
8
|
+
<%# partial in tkh_menus gem or has to be added in host app %>
|
9
|
+
<%= render './shared/menus' %>
|
data/config/routes.rb
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
Rails.application.routes.draw do
|
2
2
|
scope "(:locale)", locale: /#{I18n.available_locales.join("|")}/ do
|
3
|
-
resources :pages
|
3
|
+
resources :pages do
|
4
|
+
member do
|
5
|
+
post :publish
|
6
|
+
post :unpublish
|
7
|
+
post :toggle_for_blog
|
8
|
+
end
|
9
|
+
end
|
10
|
+
match 'blog' => 'blog#index'
|
4
11
|
end
|
5
12
|
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
de:
|
2
|
+
|
3
|
+
are_you_sure: 'are you sure?'
|
4
|
+
delete: 'delete'
|
5
|
+
edit: 'edit'
|
6
|
+
pages: 'pages'
|
7
|
+
sections: 'sections'
|
8
|
+
|
9
|
+
activerecord:
|
10
|
+
attributes:
|
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
|
+
|
18
|
+
pages:
|
19
|
+
author: 'author'
|
20
|
+
create_new: 'create new page'
|
21
|
+
published: 'published?'
|
22
|
+
|
23
|
+
create:
|
24
|
+
notice: 'The page was successfully created.'
|
25
|
+
warning: 'There was a problem saving the page'
|
26
|
+
update:
|
27
|
+
notice: 'The page was successfully updated.'
|
28
|
+
warning: 'There was a problem saving the page'
|
29
|
+
destroy:
|
30
|
+
notice: 'The page was deleted'
|
@@ -1,18 +1,4 @@
|
|
1
|
-
# Sample localization file for English. Add more files in this directory for other locales.
|
2
|
-
# See http://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
|
3
|
-
|
4
1
|
en:
|
5
|
-
date:
|
6
|
-
formats:
|
7
|
-
simple_date: "%B %d"
|
8
|
-
time:
|
9
|
-
formats:
|
10
|
-
informal: "at %H:%M"
|
11
|
-
default: "%a. %b. %d, '%y at %H:%M"
|
12
|
-
just_time: "%I:%M %p"
|
13
|
-
long: "%A %d %B %Y at %H:%M"
|
14
|
-
# custom sections - the obove is provided by rails
|
15
|
-
language_name: English
|
16
2
|
|
17
3
|
are_you_sure: 'are you sure?'
|
18
4
|
delete: 'delete'
|
@@ -33,5 +19,3 @@ en:
|
|
33
19
|
warning: 'There was a problem saving the page'
|
34
20
|
destroy:
|
35
21
|
notice: 'The page was deleted'
|
36
|
-
|
37
|
-
|
@@ -1,5 +1,4 @@
|
|
1
1
|
es:
|
2
|
-
language_name: "Español"
|
3
2
|
|
4
3
|
are_you_sure: '¿estás seguro?'
|
5
4
|
delete: 'borrar'
|
@@ -11,9 +10,10 @@ es:
|
|
11
10
|
attributes:
|
12
11
|
pages:
|
13
12
|
title: "título"
|
13
|
+
short_title: 'título breve'
|
14
14
|
description: "descripción"
|
15
15
|
body: "parte principal"
|
16
|
-
|
16
|
+
for_the_blog: 'contraseña'
|
17
17
|
|
18
18
|
pages:
|
19
19
|
author: 'autor'
|
@@ -1,184 +1,4 @@
|
|
1
1
|
fr:
|
2
|
-
date:
|
3
|
-
formats:
|
4
|
-
short: "%e %b"
|
5
|
-
long: "%e %B %Y"
|
6
|
-
only_day: "%e"
|
7
|
-
simple_date: "%d %B"
|
8
|
-
day_names: [dimanche, lundi, mardi, mercredi, jeudi, vendredi, samedi]
|
9
|
-
abbr_day_names: [dim, lun, mar, mer, jeu, ven, sam]
|
10
|
-
month_names: [~, janvier, février, mars, avril, mai, juin, juillet, août, septembre, octobre, novembre, décembre]
|
11
|
-
abbr_month_names: [~, jan., fév., mar., avr., mai, juin, juil., août, sept., oct., nov., déc.]
|
12
|
-
order:
|
13
|
-
- :day
|
14
|
-
- :month
|
15
|
-
- :year
|
16
|
-
time:
|
17
|
-
formats:
|
18
|
-
informal: "à %H:%M"
|
19
|
-
default: "%a. %d %b %Y à %H:%M"
|
20
|
-
short: "%d %b %H:%M"
|
21
|
-
long: "%A %d %B %Y à %H:%M"
|
22
|
-
just_time: "%H:%M"
|
23
|
-
|
24
|
-
am: 'am'
|
25
|
-
pm: 'pm'
|
26
|
-
|
27
|
-
datetime:
|
28
|
-
distance_in_words:
|
29
|
-
half_a_minute: "une demi-minute"
|
30
|
-
less_than_x_seconds:
|
31
|
-
zero: "moins d'une seconde"
|
32
|
-
one: "moins d'une seconde"
|
33
|
-
other: "moins de %{count} secondes"
|
34
|
-
x_seconds:
|
35
|
-
one: "1 seconde"
|
36
|
-
other: "%{count} secondes"
|
37
|
-
less_than_x_minutes:
|
38
|
-
zero: "moins d'une minute"
|
39
|
-
one: "moins d'une minute"
|
40
|
-
other: "moins de %{count} minutes"
|
41
|
-
x_minutes:
|
42
|
-
one: "1 minute"
|
43
|
-
other: "%{count} minutes"
|
44
|
-
about_x_hours:
|
45
|
-
one: "environ une heure"
|
46
|
-
other: "environ %{count} heures"
|
47
|
-
x_days:
|
48
|
-
one: "1 jour"
|
49
|
-
other: "%{count} jours"
|
50
|
-
about_x_months:
|
51
|
-
one: "environ un mois"
|
52
|
-
other: "environ %{count} mois"
|
53
|
-
x_months:
|
54
|
-
one: "1 mois"
|
55
|
-
other: "%{count} mois"
|
56
|
-
about_x_years:
|
57
|
-
one: "environ un an"
|
58
|
-
other: "environ %{count} ans"
|
59
|
-
over_x_years:
|
60
|
-
one: "plus d'un an"
|
61
|
-
other: "plus de %{count} ans"
|
62
|
-
almost_x_years:
|
63
|
-
one: "presqu'un an"
|
64
|
-
other: "presque %{count} ans"
|
65
|
-
prompts:
|
66
|
-
year: "Année"
|
67
|
-
month: "Mois"
|
68
|
-
day: "Jour"
|
69
|
-
hour: "Heure"
|
70
|
-
minute: "Minute"
|
71
|
-
second: "Seconde"
|
72
|
-
|
73
|
-
number:
|
74
|
-
format:
|
75
|
-
separator: ","
|
76
|
-
delimiter: " "
|
77
|
-
precision: 3
|
78
|
-
significant: false
|
79
|
-
strip_insignificant_zeros: false
|
80
|
-
currency:
|
81
|
-
format:
|
82
|
-
format: "%n %u"
|
83
|
-
unit: "€"
|
84
|
-
separator: ","
|
85
|
-
delimiter: " "
|
86
|
-
precision: 2
|
87
|
-
significant: false
|
88
|
-
strip_insignificant_zeros: false
|
89
|
-
percentage:
|
90
|
-
format:
|
91
|
-
delimiter: ""
|
92
|
-
precision:
|
93
|
-
format:
|
94
|
-
delimiter: ""
|
95
|
-
human:
|
96
|
-
format:
|
97
|
-
delimiter: ""
|
98
|
-
precision: 2
|
99
|
-
significant: true
|
100
|
-
strip_insignificant_zeros: true
|
101
|
-
storage_units:
|
102
|
-
format: "%n %u"
|
103
|
-
units:
|
104
|
-
byte:
|
105
|
-
one: "octet"
|
106
|
-
other: "octets"
|
107
|
-
kb: "ko"
|
108
|
-
mb: "Mo"
|
109
|
-
gb: "Go"
|
110
|
-
tb: "To"
|
111
|
-
decimal_units:
|
112
|
-
format: "%n %u"
|
113
|
-
units:
|
114
|
-
unit: ""
|
115
|
-
thousand: "millier"
|
116
|
-
million: "million"
|
117
|
-
billion: "milliard"
|
118
|
-
trillion: "billion"
|
119
|
-
quadrillion: "million de milliards"
|
120
|
-
|
121
|
-
support:
|
122
|
-
array:
|
123
|
-
words_connector: ", "
|
124
|
-
two_words_connector: " et "
|
125
|
-
last_word_connector: " et "
|
126
|
-
select:
|
127
|
-
prompt: "Veuillez sélectionner"
|
128
|
-
|
129
|
-
helpers:
|
130
|
-
select:
|
131
|
-
prompt: "Veuillez sélectionner"
|
132
|
-
submit:
|
133
|
-
create: "Créer un %{model}"
|
134
|
-
update: "Modifier ce %{model}"
|
135
|
-
submit: "Enregistrer ce %{model}"
|
136
|
-
|
137
|
-
attributes:
|
138
|
-
created_at: "Créé le"
|
139
|
-
updated_at: "Modifié le"
|
140
|
-
|
141
|
-
errors:
|
142
|
-
format: "Le %{attribute} %{message}"
|
143
|
-
messages: &errors_messages
|
144
|
-
inclusion: "n'est pas inclus(e) dans la liste"
|
145
|
-
exclusion: "n'est pas disponible"
|
146
|
-
invalid: "n'est pas valide"
|
147
|
-
confirmation: "ne concorde pas avec la confirmation"
|
148
|
-
accepted: "doit être accepté(e)"
|
149
|
-
empty: "doit être rempli(e)"
|
150
|
-
blank: "doit être rempli(e)"
|
151
|
-
too_long: "est trop long (pas plus de %{count} caractères)"
|
152
|
-
too_short: "est trop court (au moins %{count} caractères)"
|
153
|
-
wrong_length: "ne fait pas la bonne longueur (doit comporter %{count} caractères)"
|
154
|
-
not_a_number: "n'est pas un nombre"
|
155
|
-
not_an_integer: "doit être un nombre entier"
|
156
|
-
greater_than: "doit être supérieur à %{count}"
|
157
|
-
greater_than_or_equal_to: "doit être supérieur ou égal à %{count}"
|
158
|
-
equal_to: "doit être égal à %{count}"
|
159
|
-
less_than: "doit être inférieur à %{count}"
|
160
|
-
less_than_or_equal_to: "doit être inférieur ou égal à %{count}"
|
161
|
-
odd: "doit être impair"
|
162
|
-
even: "doit être pair"
|
163
|
-
template: &errors_template
|
164
|
-
header:
|
165
|
-
one: "Impossible d'enregistrer ce %{model} : 1 erreur"
|
166
|
-
other: "Impossible d'enregistrer ce %{model} : %{count} erreurs"
|
167
|
-
body: "Veuillez vérifier les champs suivants : "
|
168
|
-
|
169
|
-
activerecord:
|
170
|
-
errors:
|
171
|
-
messages:
|
172
|
-
taken: "n'est pas disponible"
|
173
|
-
record_invalid: "La validation a échoué : %{errors}"
|
174
|
-
<<: *errors_messages
|
175
|
-
template:
|
176
|
-
<<: *errors_template
|
177
|
-
full_messages:
|
178
|
-
format: "%{attribute} %{message}"
|
179
|
-
|
180
|
-
# custom sections - the obove is provided by rails
|
181
|
-
language_name: Français
|
182
2
|
|
183
3
|
are_you_sure: 'êtes vous sûr ?'
|
184
4
|
delete: 'supprimer'
|
@@ -190,9 +10,10 @@ fr:
|
|
190
10
|
attributes:
|
191
11
|
pages:
|
192
12
|
title: "titre"
|
13
|
+
short_title: 'titre raccourci'
|
193
14
|
description: "description"
|
194
15
|
body: "texte principal"
|
195
|
-
|
16
|
+
for_the_blog: 'pour le blog'
|
196
17
|
|
197
18
|
pages:
|
198
19
|
author: 'auteur'
|
@@ -201,9 +22,9 @@ fr:
|
|
201
22
|
|
202
23
|
create:
|
203
24
|
notice: 'La page a été créée.'
|
204
|
-
warning: "Il y'a eu un
|
25
|
+
warning: "Il y'a eu un probleme et la page n'a pas été sauvegardée"
|
205
26
|
update:
|
206
27
|
notice: 'Les changements de cette page ont été sauvegardés'
|
207
|
-
warning: "Il y'a eu un
|
28
|
+
warning: "Il y'a eu un probleme et les changements de cette page n'ont pas été sauvegardés"
|
208
29
|
destroy:
|
209
30
|
notice: 'La page a été supprimée'
|
data/lib/generators/tkh_content/create_or_update_migrations/create_or_update_migrations_generator.rb
CHANGED
@@ -20,6 +20,7 @@ module TkhContent
|
|
20
20
|
migration_template "create_pages.rb", "db/migrate/create_pages.rb"
|
21
21
|
migration_template "add_author_to_pages.rb", "db/migrate/add_author_to_pages.rb"
|
22
22
|
migration_template "add_parent_id_to_pages.rb", "db/migrate/add_parent_id_to_pages.rb"
|
23
|
+
migration_template "add_short_title_to_pages.rb", "db/migrate/add_short_title_to_pages.rb"
|
23
24
|
end
|
24
25
|
|
25
26
|
end
|
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:
|
4
|
+
version: 0.1.1
|
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-
|
12
|
+
date: 2012-09-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -43,6 +43,22 @@ dependencies:
|
|
43
43
|
- - ~>
|
44
44
|
- !ruby/object:Gem::Version
|
45
45
|
version: '1.4'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: bootstrap-sass
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ~>
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '2.0'
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '2.0'
|
46
62
|
- !ruby/object:Gem::Dependency
|
47
63
|
name: simple_form
|
48
64
|
requirement: !ruby/object:Gem::Requirement
|
@@ -98,8 +114,10 @@ executables: []
|
|
98
114
|
extensions: []
|
99
115
|
extra_rdoc_files: []
|
100
116
|
files:
|
117
|
+
- app/controllers/blog_controller.rb
|
101
118
|
- app/controllers/pages_controller.rb
|
102
119
|
- app/models/page.rb
|
120
|
+
- app/views/blog/index.html.erb
|
103
121
|
- app/views/pages/_form.html.erb
|
104
122
|
- app/views/pages/edit.html.erb
|
105
123
|
- app/views/pages/index.html.erb
|
@@ -110,12 +128,14 @@ files:
|
|
110
128
|
- lib/generators/tkh_content/create_or_update_files/create_or_update_files_generator.rb
|
111
129
|
- lib/generators/tkh_content/create_or_update_files/templates/blog.html.erb
|
112
130
|
- lib/generators/tkh_content/create_or_update_locales/create_or_update_locales_generator.rb
|
131
|
+
- lib/generators/tkh_content/create_or_update_locales/templates/de.yml
|
113
132
|
- lib/generators/tkh_content/create_or_update_locales/templates/en.yml
|
114
133
|
- lib/generators/tkh_content/create_or_update_locales/templates/es.yml
|
115
134
|
- lib/generators/tkh_content/create_or_update_locales/templates/fr.yml
|
116
135
|
- lib/generators/tkh_content/create_or_update_migrations/create_or_update_migrations_generator.rb
|
117
136
|
- lib/generators/tkh_content/create_or_update_migrations/templates/add_author_to_pages.rb
|
118
137
|
- lib/generators/tkh_content/create_or_update_migrations/templates/add_parent_id_to_pages.rb
|
138
|
+
- lib/generators/tkh_content/create_or_update_migrations/templates/add_short_title_to_pages.rb
|
119
139
|
- lib/generators/tkh_content/create_or_update_migrations/templates/create_pages.rb
|
120
140
|
- lib/tasks/tkh_content_tasks.rake
|
121
141
|
- lib/tkh_content/version.rb
|
@@ -168,7 +188,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
168
188
|
version: '0'
|
169
189
|
segments:
|
170
190
|
- 0
|
171
|
-
hash: -
|
191
|
+
hash: -2576848684436899421
|
172
192
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
173
193
|
none: false
|
174
194
|
requirements:
|
@@ -177,7 +197,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
177
197
|
version: '0'
|
178
198
|
segments:
|
179
199
|
- 0
|
180
|
-
hash: -
|
200
|
+
hash: -2576848684436899421
|
181
201
|
requirements: []
|
182
202
|
rubyforge_project:
|
183
203
|
rubygems_version: 1.8.23
|