tkh_content 0.3.1 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. data/CHANGELOG.md +25 -0
  2. data/app/assets/javascripts/ckeditor/config.js.coffee +1 -1
  3. data/app/controllers/blog_controller.rb +5 -2
  4. data/app/controllers/comments_controller.rb +14 -6
  5. data/app/controllers/contacts_controller.rb +7 -2
  6. data/app/controllers/pages_controller.rb +3 -3
  7. data/app/mailers/contact_mailer.rb +3 -3
  8. data/app/models/page.rb +0 -1
  9. data/app/views/blog/index.atom.builder +14 -0
  10. data/app/views/blog/index.html.erb +3 -2
  11. data/app/views/comments/_list_of_comments.html.erb +8 -8
  12. data/app/views/comments/_status_buttons.html.erb +3 -3
  13. data/app/views/comments/_tab_admin_menu.html.erb +8 -0
  14. data/app/views/comments/accepted.html.erb +29 -0
  15. data/app/views/comments/blocked.html.erb +29 -0
  16. data/app/views/comments/edit.html.erb +4 -1
  17. data/app/views/comments/for_feed.atom.builder +16 -0
  18. data/app/views/comments/index.html.erb +15 -14
  19. data/app/views/comments/pending.html.erb +31 -0
  20. data/app/views/contact_mailer/message_from_contact_form.text.erb +4 -5
  21. data/app/views/contacts/_tab_admin_menu.html.erb +4 -0
  22. data/app/views/contacts/index.html.erb +8 -6
  23. data/app/views/contacts/show.html.erb +18 -0
  24. data/app/views/pages/_admin_context_menu.html.erb +23 -12
  25. data/app/views/pages/_blog_post_meta.html.erb +4 -2
  26. data/app/views/pages/_comment_section.html.erb +1 -3
  27. data/app/views/pages/_form.html.erb +6 -6
  28. data/app/views/pages/_new_comment_section.html.erb +2 -2
  29. data/app/views/pages/_tab_admin_menu.html.erb +5 -0
  30. data/app/views/pages/edit.html.erb +4 -1
  31. data/app/views/pages/index.html.erb +9 -9
  32. data/app/views/pages/new.html.erb +4 -1
  33. data/app/views/pages/show.html.erb +2 -0
  34. data/app/views/shared/_admin_sidebar.html.erb +1 -1
  35. data/config/routes.rb +1 -0
  36. data/lib/generators/tkh_content/create_or_update_locales/templates/de.yml +78 -27
  37. data/lib/generators/tkh_content/create_or_update_locales/templates/en.yml +43 -16
  38. data/lib/generators/tkh_content/create_or_update_locales/templates/es.yml +72 -15
  39. data/lib/generators/tkh_content/create_or_update_locales/templates/fr.yml +73 -16
  40. data/lib/generators/tkh_content/create_or_update_locales/templates/it.yml +109 -0
  41. data/lib/tkh_content/version.rb +1 -1
  42. metadata +14 -5
  43. data/app/views/blog/index.rss.builder +0 -18
@@ -0,0 +1,18 @@
1
+ <h1><%= t('activerecord.models.contacts') %></h1>
2
+
3
+ <%= render 'tab_admin_menu' %>
4
+
5
+ <h2><%= "#{t('contacts.sent')}#{t('colon')} #{ l(@contact.created_at, :format => :tkh_default) }" %></h2>
6
+
7
+ <p>
8
+ <%= "#{t('activerecord.attributes.contacts.sender_name').capitalize}#{t('colon')} #{@contact.sender_name}" %><br />
9
+ <%= "#{t('activerecord.attributes.contacts.sender_email')}#{t('colon')} #{link_to(@contact.sender_email, "mailto:#{@contact.sender_email}")}".capitalize.html_safe %>
10
+ </p>
11
+ <h3><%= t('activerecord.attributes.contacts.body').capitalize %></h3>
12
+ <p><%= sanitize @contact.body.gsub(/\r\n?/, "<br>"), :tags => %w(br), :attributes => %w() %></p>
13
+
14
+ <hr>
15
+
16
+ <p><%= link_to t('list'), contacts_path, class: 'btn' %></p>
17
+
18
+ <%= render 'shared/admin_sidebar' %>
@@ -1,14 +1,25 @@
1
- <% content_for :admin_context_menu do %>
2
- <h2>admin section</h2>
3
- <%= link_to 'edit this page', edit_page_path(page), class: 'btn' %>
4
- <% if Page.not_for_blog.orphans.published.any? %>
5
- <h3>Reorder Root Page Menu Items</h3>
6
- <ul class="draggable" data-update-url="<%= sort_pages_path %>">
7
- <% for page in Page.not_for_blog.orphans.published.by_menu_position %>
8
- <%= content_tag :li, page, class: 'page', id: "page_#{page.id}" do %>
9
- <%= image_tag 'drag-handle.gif', :class => 'handle silhouette' %> <%= page.nickname -%>
10
- <% end -%>
11
- <% end %>
1
+ <% if administrator? %>
2
+
3
+ <% content_for :admin_context_menu do %>
4
+
5
+ <h2><%= t('admin_section') %></h2>
6
+ <ul>
7
+ <li><%= link_to t('admin_panel'), pages_path %></li>
8
+ <%= content_tag :li, link_to("#{t('activerecord.models.comments').capitalize} #{"(#{Comment.pending.count})"}", pending_comments_path) if Comment.pending.count > 0 %>
9
+ <li><%= link_to t('pages.edit_this').capitalize, edit_page_path(page) %></li>
12
10
  </ul>
13
- <% end %>
11
+
12
+ <% if Page.not_for_blog.orphans.published.any? %>
13
+ <h3><%= t('pages.reorder_root_menus') %></h3>
14
+ <ul class="draggable" data-update-url="<%= sort_pages_path %>">
15
+ <% for page in Page.not_for_blog.orphans.published.by_menu_position %>
16
+ <%= content_tag :li, page, class: 'page', id: "page_#{page.id}" do %>
17
+ <%= image_tag 'drag-handle.gif', :class => 'handle silhouette' %> <%= page.nickname -%>
18
+ <% end -%>
19
+ <% end %>
20
+ </ul>
21
+ <% end %>
22
+
23
+ <% end -%>
24
+
14
25
  <% end -%>
@@ -1,4 +1,6 @@
1
1
  <p class="meta-info">
2
- by <%= post.author.name %> <%= post.published_at ? "on #{l(post.published_at, format: :tkh_default)}" : "- not published yet" %> | <%= link_to 'Permalink', post %> | <%= pluralize post.comments.showable.for_locale(I18n.locale.to_s).count, 'comments' %>
3
- <%="| #{link_to 'edit', edit_page_path(post), class: 'btn btn-mini'}".html_safe if administrator? %>
2
+ <%= post.author.name %> |
3
+ <%= post.published_at ? link_to(l(post.published_at, format: :tkh_default), post) : t('pages.not_published_yet') %> |
4
+ <%= "#{t('activerecord.models.comments')}#{t('colon')} #{post.comments.showable.for_locale(I18n.locale.to_s).count}" %>
5
+ <%= link_to t('edit'), edit_page_path(post), class: 'btn btn-mini' if administrator? %>
4
6
  </p>
@@ -1,7 +1,5 @@
1
1
  <div id="comment-section">
2
- <h2><%= pluralize @page.comments.showable.for_locale(I18n.locale.to_s).count, 'Comment' %></h2>
2
+ <h2><%= pluralize @page.comments.showable.for_locale(I18n.locale.to_s).count, t('activerecord.models.comment') %></h2>
3
3
  <%= render 'comments/list_of_comments' %>
4
4
  <%= render 'new_comment_section' %>
5
5
  </div>
6
-
7
- <%= render( 'admin_context_menu', page: @page) if administrator? %>
@@ -2,20 +2,20 @@
2
2
  <%= f.error_notification %>
3
3
 
4
4
  <div class="form-inputs">
5
- <%= f.input :title, hint: 'nice and descriptive' %>
6
- <%= f.input :for_blog %>
5
+ <%= f.input :title, label: t('activerecord.attributes.pages.title'), hint: t('pages.hint.title') %>
6
+ <%= f.input :for_blog, label: t('activerecord.attributes.pages.for_the_blog') %>
7
7
  <%= f.input :tag_list, hint: 'space separated', :wrapper_html => { :id => 'page-tag-list' } %>
8
- <%= f.input :short_title, hint: 'ideally one word only, used for the menu', :wrapper_html => { :id => 'page-short-title' } %>
8
+ <%= f.input :short_title, label: t('activerecord.attributes.pages.short_title'), hint: t('pages.hint.short_title'), :wrapper_html => { :id => 'page-short-title' } %>
9
9
  <%= f.input :parent_page_title,
10
10
  as: :string,
11
11
  :wrapper_html => { :id => 'parent-page-title' },
12
- label: 'parent page title',
12
+ label: t('activerecord.attributes.pages.parent_title'),
13
13
  :input_html => {
14
14
  :data => { provide: 'typeahead',
15
15
  source: Page.not_for_blog.by_title.map(&:title).to_json }
16
16
  } %>
17
- <%= f.input :description, :input_html => { :rows => 3 } %>
18
- <%= f.input :body, :input_html => { :rows => 35, :class => 'ckeditor' } %>
17
+ <%= f.input :description, label: t('activerecord.attributes.pages.description'), :input_html => { :rows => 3 } %>
18
+ <%= f.input :body, label: t('activerecord.attributes.pages.body'), :input_html => { :rows => 35, :class => 'ckeditor' } %>
19
19
  </div>
20
20
 
21
21
  <div class="form-actions">
@@ -1,9 +1,9 @@
1
1
  <div id="new-comment-section">
2
- <h3>What do you think?</h3>
2
+ <h3><%= t('comments.what_do_you_think') %></h3>
3
3
  <% if current_user %>
4
4
  <%= render 'comments/form_in_page' %>
5
5
  <% else %>
6
- <p><label class="label label-info">You need to be logged in to leave a comment</label></p>
6
+ <p><label class="label label-info"><%= t('comments.login_needed') %></label></p>
7
7
  <%= render 'shared/embedded_login_module' %>
8
8
  <% end -%>
9
9
  </div>
@@ -0,0 +1,5 @@
1
+ <ul class="nav nav-tabs" id="admin-menu-tab">
2
+ <%= content_tag :li, link_to(t('new'), new_page_path), ({ class: 'active' } if controller.action_name.to_s == 'new' ) %>
3
+ <%= content_tag :li, link_to(t('list'), pages_path), ({ class: 'active' } if controller.action_name.to_s == 'index' ) %>
4
+ <%= content_tag :li, link_to(t('edit'), pages_path), ({ class: 'active' }) if controller.action_name.to_s == 'edit' %>
5
+ </ul>
@@ -1,3 +1,6 @@
1
- <h1>Edit a Page</h1>
1
+ <h1><%= t 'activerecord.models.pages' %></h1>
2
+
3
+ <%= render 'tab_admin_menu' %>
4
+
2
5
  <%= render 'form' %>
3
6
  <%= render 'shared/admin_sidebar' %>
@@ -1,16 +1,16 @@
1
- <h1>List of Pages</h1>
1
+ <h1><%= t 'activerecord.models.pages' %></h1>
2
2
 
3
- <%= link_to t('pages.create_new').capitalize, new_page_path, class: 'btn btn-primary' if @pages.size >= 5 %>
3
+ <%= render 'tab_admin_menu' %>
4
4
 
5
5
  <table class='table table-striped'>
6
6
  <thead>
7
7
  <tr>
8
8
  <th><%= t 'activerecord.attributes.pages.title' %></th>
9
9
  <th><%= t 'activerecord.attributes.pages.description' %></th>
10
- <th><%= t 'pages.author'.capitalize %></th>
11
- <th><%= t 'activerecord.attributes.pages.for_blog' %>?</th>
12
- <th><%= t 'pages.published'.capitalize %></th>
13
- <th>Actions</th>
10
+ <th><%= t 'pages.author' %></th>
11
+ <th><%= t 'activerecord.attributes.pages.for_the_blog' %>?</th>
12
+ <th><%= t 'pages.published' %></th>
13
+ <th><%= t('actions') %></th>
14
14
  </tr>
15
15
  </thead>
16
16
 
@@ -22,13 +22,13 @@
22
22
  <td><%= page.author.name %></td>
23
23
  <td>
24
24
  <%= page.for_blog? ? "<span class=\"label label-success\">✓</span>".html_safe : "<span class=\"label label-important\">X</span>".html_safe %>
25
- <%= link_to 'toggle', toggle_for_blog_page_path(page), class: 'btn btn-mini', method: :post %>
25
+ <%= link_to t('toggle'), toggle_for_blog_page_path(page), class: 'btn btn-mini', method: :post %>
26
26
  </td>
27
27
  <td>
28
28
  <% if page.published_at %>
29
- <span class="label label-success">✓</span> <%= link_to 'unpublish', unpublish_page_path(page), class: 'btn btn-mini', method: :post %>
29
+ <span class="label label-success">✓</span> <%= link_to t('pages.unpublish'), unpublish_page_path(page), class: 'btn btn-mini', method: :post %>
30
30
  <% else %>
31
- <span class="label label-important">X</span> <%= link_to 'publish', publish_page_path(page), class: 'btn btn-mini btn-primary', method: :post %>
31
+ <span class="label label-important">X</span> <%= link_to t('pages.publish'), publish_page_path(page), class: 'btn btn-mini btn-primary', method: :post %>
32
32
  <% end -%>
33
33
  </td>
34
34
  <td><%= link_to t('edit'), edit_page_path(page), class: 'btn btn-mini' %>
@@ -1,3 +1,6 @@
1
- <h1>Create a New Page</h1>
1
+ <h1><%= t 'activerecord.models.pages' %></h1>
2
+
3
+ <%= render 'tab_admin_menu' %>
4
+
2
5
  <%= render 'form' %>
3
6
  <%= render 'shared/admin_sidebar' %>
@@ -1,5 +1,6 @@
1
1
  <% content_for :meta_title, @page.title %>
2
2
  <% content_for :meta_description, @page.description %>
3
+ <% content_for :canonical_link, link_to('', @page, rel: 'canonical') %>
3
4
 
4
5
  <% unless @page.for_blog? %>
5
6
  <%= raw tkhed(@page.body) %>
@@ -13,5 +14,6 @@
13
14
 
14
15
  <% end -%>
15
16
 
17
+ <%= render( 'admin_context_menu', page: @page) %>
16
18
  <%# partial in tkh_menus gem or has to be added in host app %>
17
19
  <%= render './shared/menus' %>
@@ -1,5 +1,5 @@
1
1
  <% content_for :admin_sidebar do %>
2
- <h2><%= t 'sections'.capitalize %></h2>
2
+ <h2><%= t 'sections' %></h2>
3
3
  <ul>
4
4
  <li><%= link_to t 'pages', pages_path %></li>
5
5
  </ul>
data/config/routes.rb CHANGED
@@ -18,6 +18,7 @@ Rails.application.routes.draw do
18
18
  get :pending
19
19
  get :accepted
20
20
  get :blocked
21
+ get :for_feed
21
22
  end
22
23
  member do
23
24
  post :accept
@@ -1,43 +1,47 @@
1
1
  de:
2
2
 
3
- are_you_sure: 'Bist Du sicher?'
4
- colon: ':'
5
- delete: 'löschen'
6
- edit: 'bearbeiten'
7
- pages: 'Seiten'
8
- sections: 'Abschnitte'
9
-
10
- time:
11
- formats:
12
- # eventually this should be abstracted to a tkh_utilities gem together with all
13
- # standard helpers and functionality
14
- tkh_default: '%A, %d. %B %Y, %H:%M Uhr'
15
-
16
- are_you_sure: 'Bist Du sicher?'
17
- delete: 'löschen'
18
- edit: 'bearbeiten'
19
- pages: 'Seiten'
20
- sections: 'Abschnitte'
21
-
22
- activerecord:
3
+ activerecord:
4
+ models:
5
+ comment: 'Kommentar'
6
+ comments: 'Kommentare'
7
+ contact: 'Kontakt'
8
+ contacts: 'Kontakte'
9
+ page: 'Seite'
10
+ pages: 'Seiten'
11
+ tag: 'Tag'
12
+ tags: 'Tags'
13
+
23
14
  attributes:
24
15
  pages:
25
16
  title: "Überschrift"
26
- short_title: 'Kurzüberschrifti'
17
+ short_title: 'Kurzüberschrift'
27
18
  description: "Beschreibung"
28
19
  body: "Haupttext"
29
20
  for_the_blog: 'Für den Blog'
30
-
21
+ parent_title: 'Seitenüberschrift'
22
+
31
23
  contacts:
32
24
  sender_name: "Absender-Name"
33
25
  sender_email: 'Absender-Email'
34
26
  body: 'Nachricht'
27
+
28
+ comments:
29
+ author: 'Verfasser'
30
+ body: "Haupttext"
31
+ locale: 'Sprache'
32
+ status: 'Status'
35
33
 
36
34
  pages:
37
35
  author: 'Autor'
38
36
  create_new: 'Neue Seite anlegen'
39
- published: 'veröffentlichen?'
40
-
37
+ edit_this: 'Diese Seite bearbeiten'
38
+ home: 'Hauptseite'
39
+ not_published_yet: 'Noch nicht veröffentlicht'
40
+ publish: 'veröffentlichen'
41
+ published: 'veröffentlicht'
42
+ unpublish: 'veröffentlichen zurücknehmen'
43
+ reorder_root_menus: 'Neuanfordern der Root-Menü-Items'
44
+
41
45
  create:
42
46
  notice: 'Diese Seite wurde erfolgreich angelegt.'
43
47
  warning: 'Beim Speichern dieser Seite ist ein Problem aufgetreten.'
@@ -47,12 +51,59 @@ de:
47
51
  destroy:
48
52
  notice: 'Die Seite wurde gelöscht.'
49
53
  root_warning: "Du kannst diese Seite nicht löschen, da es die Root-Seite ist. Du kannst sie nur bearbeiten."
54
+ hint:
55
+ title: 'Schön und beschreibend'
56
+ short_title: 'Idealerweise nur ein Wort, wird für das Menü verwendet'
57
+ status:
58
+ changed:
59
+ published: 'Die Seite wurde veröffentlicht'
60
+ unpublished: "Die Veröffentlichung der Seite wurde aufgehoben. Sie ist wieder Entwurf."
61
+ toggled: "Der Blog-Status der Seite wurde geändert"
50
62
 
51
63
  contacts:
52
- messages_from_forms: 'messages from contact form'
64
+ messages_from_forms: 'Nachrichten vom Kontaktformular'
53
65
  send_message: 'Nachricht senden'
54
- sent: 'Gesendet am'
55
-
66
+ sent: 'Gesendet am'
56
67
  create:
68
+ did_not_reach: 'Etwas ist schief gegangen. Deine Nachricht hat den gewünschten Adressaten nicht erreicht.'
69
+ invalid_email: 'Deine Emai-Adresse scheint ungültig zu sein!'
57
70
  notice: 'Die Nachricht wurde gesendet.'
58
71
  warning: 'Beim Versenden der Nachricht gab es ein Problem.'
72
+ mailer:
73
+ intro: 'Hier ist die Nachricht vom Kontaktformular der Webseite:'
74
+ sender_name: "Absendername:"
75
+ sender_email: "Absender-Email:"
76
+ message: 'Nachricht'
77
+
78
+ comments:
79
+ login_needed: 'Du must angemeldet sein, um einen Kommentar zu verfassen'
80
+ sorted_by_oldest: 'Dieser Abschnitt ist nach Datum sortiert, der älteste Kommentar zuerst, sodass sie von oben nach untern bearbeitet werden können.'
81
+ what_do_you_think: 'Was denkst Du?'
82
+
83
+ create:
84
+ notice: 'Der Kommentar wurde erfolgreich erstellt.'
85
+ warning: 'Beim Speichern des Kommentars in der Database ist ein Problem aufgetreten'
86
+ update:
87
+ notice: 'Der Kommentar wurde erfolgreich aktualisiert.'
88
+ warning: 'Beim Speichern des Kommentars ist ein Problem aufgetreten'
89
+ destroy:
90
+ notice: 'Der Kommentar wurde gelöscht'
91
+ moderation:
92
+ accept:
93
+ notice: "Dieser Kommentar wurde angenommen"
94
+ warning: "Ein Fehler ist aufgetreten und der Kommentar konnte nicht bearbeitet und angenommen werden"
95
+ block:
96
+ notice: "Dieser Kommentar wurde abgelehnt"
97
+ warning: "Ein Fehler ist aufgetreten und der Kommentar konnte nicht bearbeitet und abgelehnt werden"
98
+ actions:
99
+ accept: "Akzeptieren!"
100
+ block: "Ablehnen!"
101
+ status:
102
+ pending: 'In Bearbeitung'
103
+ accepted: 'Akzeptiert'
104
+ blocked: 'Abgelehnt'
105
+
106
+ blog:
107
+ itself: 'Blog'
108
+ home: 'Home-Blog'
109
+ official: 'Der offizielle Blog'
@@ -1,12 +1,16 @@
1
1
  en:
2
2
 
3
- time:
4
- formats:
5
- # eventually this should be abstracted to a tkh_utilities gem together with all
6
- # standard helpers and functionality
7
- tkh_default: "%b. %-d, '%y at %l:%M %P"
8
-
9
- activerecord:
3
+ activerecord:
4
+ models:
5
+ comment: 'comment'
6
+ comments: 'comments'
7
+ contact: 'contact'
8
+ contacts: 'contacts'
9
+ page: 'page'
10
+ pages: 'pages'
11
+ tag: 'tag'
12
+ tags: 'tags'
13
+
10
14
  attributes:
11
15
  pages:
12
16
  title: "title"
@@ -14,6 +18,7 @@ en:
14
18
  description: "description"
15
19
  body: "body text"
16
20
  for_the_blog: 'for the blog'
21
+ parent_title: 'page parent title'
17
22
 
18
23
  contacts:
19
24
  sender_name: "sender name"
@@ -26,17 +31,16 @@ en:
26
31
  locale: 'language'
27
32
  status: 'status'
28
33
 
29
- are_you_sure: 'are you sure?'
30
- colon: ':'
31
- delete: 'delete'
32
- edit: 'edit'
33
- pages: 'pages'
34
- sections: 'sections'
35
-
36
34
  pages:
37
35
  author: 'author'
38
36
  create_new: 'create new page'
37
+ edit_this: 'edit this page'
38
+ home: 'home page'
39
+ not_published_yet: 'Not published yet'
40
+ publish: 'publish'
39
41
  published: 'published?'
42
+ unpublish: 'unpublish'
43
+ reorder_root_menus: 'reorder root menu items'
40
44
 
41
45
  create:
42
46
  notice: 'The page was successfully created.'
@@ -47,17 +51,35 @@ en:
47
51
  destroy:
48
52
  notice: 'The page was deleted'
49
53
  root_warning: "You cannot delete this page as this is the root page of the site. You should only modify it."
54
+ hint:
55
+ title: 'nice and descriptive'
56
+ short_title: 'ideally one word only, used for the menu'
57
+ status:
58
+ changed:
59
+ published: 'The page has been published'
60
+ unpublished: "The page has been unpublished. It's a draft again."
61
+ toggled: "The blog status of the page has been changed"
50
62
 
51
63
  contacts:
52
64
  messages_from_forms: 'messages from contact form'
53
65
  send_message: 'send message'
54
66
  sent: 'Sent at'
55
-
56
67
  create:
68
+ did_not_reach: 'Something went wrong. Your message did not reach the intended recipient.'
69
+ invalid_email: 'Your email address does not seem to be valid!'
57
70
  notice: 'Your message has been sent'
58
71
  warning: 'There was a problem sending your message.'
72
+ mailer:
73
+ intro: 'Here is the message sent via the contact form on the web site:'
74
+ sender_name: "Sender's name:"
75
+ sender_email: "Sender's email:"
76
+ message: 'Message:'
59
77
 
60
78
  comments:
79
+ login_needed: 'You need to be logged in to leave a comment'
80
+ sorted_by_oldest: 'This section is sorted by oldest comment first so that they can be moderated from top to bottom.'
81
+ what_do_you_think: 'What do you think?'
82
+
61
83
  create:
62
84
  notice: 'The comment was successfully created.'
63
85
  warning: 'There was a problem saving the comment to the database'
@@ -79,4 +101,9 @@ en:
79
101
  status:
80
102
  pending: 'pending'
81
103
  accepted: 'accepted'
82
- blocked: 'blocked'
104
+ blocked: 'blocked'
105
+
106
+ blog:
107
+ itself: 'blog'
108
+ home: 'home blog'
109
+ official: 'the official blog'