tkh_content 0.9.8 → 0.9.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5aa776dd50acb59c951e8fd0506a2af67d60aa50
4
- data.tar.gz: 3ecdb0062469aae86f29403e5fa710a8f36a8c5c
3
+ metadata.gz: f230ccfce698411234a73a0f7af063514073b454
4
+ data.tar.gz: 2cbf6a17b28cc3f33a9315d27c1d633ea968ae27
5
5
  SHA512:
6
- metadata.gz: ccff788f856910f0b2b1b6478d5495917a0e72c9c082afd69c3a94cdd734dad97e6d7896a3ca43c26395e208635920c1bf3de3887017e179e5f43d61edb5a1c9
7
- data.tar.gz: f3edf90b3b14d5b35314dd59119b7619236c320dded4c8416308f1bc19fa31adec1e3aad8acd2f9f0f8b317c124b727b1f4ebc83cdbd14b4f0231b5366e3f90c
6
+ metadata.gz: a0c01a592713676df2ba8e61823714c2177703d66e62023f7d974587289a3c940f23dc5fa9c8d1a8a9a7f33a872302cd58a519edb46b3a803a1dfbbf7dfa474e
7
+ data.tar.gz: 370e7f3ee81d01bc54b17a636534c3329cb763d3e848d506ca61f02f7791c8e93c880afe3c3f0cf355da95b1da0a908586dea3e43b91bfdd299bc29c490d1e9a
data/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
 
4
4
 
5
+
6
+ ## 0.9.9
7
+
8
+ * Added tag resource and tag section in admin panel
9
+
10
+
5
11
  ## 0.9.8
6
12
 
7
13
  * Full implementation of blog tags
@@ -0,0 +1,32 @@
1
+ class TagsController < ApplicationController
2
+
3
+ before_filter :authenticate
4
+ before_filter :authenticate_with_admin
5
+
6
+ def index
7
+ @tags = Tag.alphabetically
8
+ switch_to_admin_layout
9
+ end
10
+
11
+ def edit
12
+ @tag = Tag.find(params[:id])
13
+ switch_to_admin_layout
14
+ end
15
+
16
+ def update
17
+ @tag = Tag.find(params[:id])
18
+ if @tag.update_attributes(tag_params)
19
+ redirect_to tags_path, notice: t('tags.update.notice')
20
+ else
21
+ render action: "edit", warning: t('tags.update.warning'), layout: 'admin'
22
+ end
23
+ end
24
+
25
+ private
26
+
27
+ # Never trust parameters from the scary internet, only allow the white list through.
28
+ def tag_params
29
+ params.require(:tag).permit(:name)
30
+ end
31
+
32
+ end
data/app/models/tag.rb CHANGED
@@ -5,8 +5,6 @@
5
5
 
6
6
  class Tag < ActiveRecord::Base
7
7
 
8
- # attr_accessible :name
9
-
10
8
  has_many :taggings
11
9
  has_many :pages, through: :taggings
12
10
 
@@ -4,7 +4,7 @@
4
4
 
5
5
  <div class="panel panel-info">
6
6
  <div class="panel-heading">
7
- <h3 class="panel-title"><%= @tag.name %></h3>
7
+ <h3 class="panel-title"><%= "#{@tag.name} (#{@tag.taggings.count})" %></h3>
8
8
  </div>
9
9
  <div class="panel-body">
10
10
  Liste des articles avec cette étiquette
@@ -6,7 +6,11 @@
6
6
  hint: t('pages.hint.title'),
7
7
  input_html: { size: 45 } %>
8
8
  <%= f.input :for_blog, label: t('activerecord.attributes.pages.for_the_blog') %>
9
- <%= f.input :tag_list, hint: 'space separated', :wrapper_html => { :id => 'page-tag-list' }, input_html: { size: 45 } %>
9
+ <%= f.input :tag_list,
10
+ label: t('tags.tag_list'),
11
+ hint: t('tags.hint.name'),
12
+ :wrapper_html => { :id => 'page-tag-list' },
13
+ input_html: { size: 45 } %>
10
14
  <%= f.input :short_title, label: t('activerecord.attributes.pages.short_title'), hint: t('pages.hint.short_title'), :wrapper_html => { :id => 'page-short-title' } %>
11
15
  <%= f.input :parent_page_title,
12
16
  as: :string,
@@ -0,0 +1,12 @@
1
+ <%= simple_form_for @tag, :html => { class: 'form-horizontal', role: 'form' } do |f| %>
2
+ <%= f.error_notification %>
3
+
4
+ <%= f.input :name,
5
+ label: t('activerecord.attributes.tags.name'),
6
+ hint: t('tags.hint.name'),
7
+ input_html: { size: 45 } %>
8
+
9
+ <br />
10
+ <%= f.button :submit, :class => 'btn btn-primary' %>
11
+
12
+ <% end %>
@@ -0,0 +1,6 @@
1
+ <h1><%= t 'activerecord.models.tags' %></h1>
2
+
3
+ <ul class="nav nav-tabs" id="admin-menu-tab">
4
+ <%= content_tag :li, link_to(t('list'), tags_path), ({ class: 'active' } if controller.action_name.to_s == 'index' ) %>
5
+ <%= content_tag :li, link_to(t('edit'), '#'), ({ class: 'active' }) if controller.action_name.to_s == 'edit' %>
6
+ </ul>
@@ -0,0 +1,4 @@
1
+ <%= render 'tab_admin_menu' %>
2
+
3
+ <%= render 'form' %>
4
+ <%= render 'shared/admin_sidebar' %>
@@ -0,0 +1,21 @@
1
+ <%= render 'tab_admin_menu' %>
2
+
3
+ <table class='table table-striped'>
4
+ <thead>
5
+ <tr>
6
+ <th><%= t 'activerecord.attributes.tags.name' %></th>
7
+ <th><%= t('actions') %></th>
8
+ </tr>
9
+ </thead>
10
+
11
+ <tbody>
12
+ <% @tags.each do |tag| %>
13
+ <tr>
14
+ <td><%= link_to ("#{tag.name} (#{tag.taggings.count})"), blog_by_tag_path(tag.name) %></td>
15
+ <td><%= link_to t('edit'), edit_tag_path(tag), class: 'btn btn-xs btn-primary' %></td>
16
+ </tr>
17
+ <% end %>
18
+ </tbody>
19
+ </table>
20
+
21
+ <%= render 'shared/admin_sidebar' %>
data/config/routes.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  Rails.application.routes.draw do
2
2
  scope "(:locale)", locale: /#{I18n.available_locales.join("|")}/ do
3
+
3
4
  resources :pages do
4
5
  member do
5
6
  post :publish
@@ -25,6 +26,9 @@ Rails.application.routes.draw do
25
26
  post :block
26
27
  end
27
28
  end
29
+
30
+ resources :tags
31
+
28
32
  get 'blog' => 'blog#index', as: :blog
29
33
  get 'blog_by_tag/:id', :to => 'blog#by_tag', :as => 'blog_by_tag'
30
34
 
@@ -10,7 +10,7 @@ de:
10
10
  pages: 'Seiten'
11
11
  tag: 'Tag'
12
12
  tags: 'Tags'
13
-
13
+
14
14
  attributes:
15
15
  pages:
16
16
  title: "Überschrift"
@@ -19,12 +19,15 @@ de:
19
19
  body: "Haupttext"
20
20
  for_the_blog: 'Für den Blog'
21
21
  parent_title: 'Seitenüberschrift'
22
-
22
+
23
+ tags:
24
+ name: "name"
25
+
23
26
  contacts:
24
27
  sender_name: "Absender-Name"
25
28
  sender_email: 'Absender-Email'
26
29
  body: 'Nachricht'
27
-
30
+
28
31
  comments:
29
32
  author: 'Verfasser'
30
33
  body: "Haupttext"
@@ -41,7 +44,7 @@ de:
41
44
  published: 'veröffentlicht'
42
45
  unpublish: 'veröffentlichen zurücknehmen'
43
46
  reorder_root_menus: 'Neuanfordern der Root-Menü-Items'
44
-
47
+
45
48
  create:
46
49
  notice: 'Diese Seite wurde erfolgreich angelegt.'
47
50
  warning: 'Beim Speichern dieser Seite ist ein Problem aufgetreten.'
@@ -60,10 +63,20 @@ de:
60
63
  unpublished: "Die Veröffentlichung der Seite wurde aufgehoben. Sie ist wieder Entwurf."
61
64
  toggled: "Der Blog-Status der Seite wurde geändert"
62
65
 
66
+ tags:
67
+ edit_this: 'edit this tag'
68
+ tag_list: 'tag list'
69
+
70
+ update:
71
+ notice: 'The tag was successfully updated.'
72
+ warning: 'There was a problem saving the tag'
73
+ hint:
74
+ name: 'Lower case only. Multiple words should be joined by a dash (-) and NOT spaces'
75
+
63
76
  contacts:
64
77
  messages_from_forms: 'Nachrichten vom Kontaktformular'
65
78
  send_message: 'Nachricht senden'
66
- sent: 'Gesendet am'
79
+ sent: 'Gesendet am'
67
80
  create:
68
81
  did_not_reach: 'Etwas ist schief gegangen. Deine Nachricht hat den gewünschten Adressaten nicht erreicht.'
69
82
  invalid_email: 'Deine Emai-Adresse scheint ungültig zu sein!'
@@ -74,12 +87,12 @@ de:
74
87
  sender_name: "Absendername:"
75
88
  sender_email: "Absender-Email:"
76
89
  message: 'Nachricht'
77
-
90
+
78
91
  comments:
79
92
  login_needed: 'Du must angemeldet sein, um einen Kommentar zu verfassen'
80
93
  sorted_by_oldest: 'Dieser Abschnitt ist nach Datum sortiert, der älteste Kommentar zuerst, sodass sie von oben nach untern bearbeitet werden können.'
81
94
  what_do_you_think: 'Was denkst Du?'
82
-
95
+
83
96
  create:
84
97
  notice: 'Der Kommentar wurde erfolgreich erstellt.'
85
98
  warning: 'Beim Speichern des Kommentars in der Database ist ein Problem aufgetreten'
@@ -102,7 +115,7 @@ de:
102
115
  pending: 'In Bearbeitung'
103
116
  accepted: 'Akzeptiert'
104
117
  blocked: 'Abgelehnt'
105
-
118
+
106
119
  blog:
107
120
  itself: 'Blog'
108
121
  home: 'Home-Blog'
@@ -1,5 +1,5 @@
1
1
  en:
2
-
2
+
3
3
  activerecord:
4
4
  models:
5
5
  comment: 'comment'
@@ -10,7 +10,7 @@ en:
10
10
  pages: 'pages'
11
11
  tag: 'tag'
12
12
  tags: 'tags'
13
-
13
+
14
14
  attributes:
15
15
  pages:
16
16
  title: "title"
@@ -19,18 +19,21 @@ en:
19
19
  body: "body text"
20
20
  for_the_blog: 'for the blog'
21
21
  parent_title: 'page parent title'
22
-
22
+
23
+ tags:
24
+ name: "name"
25
+
23
26
  contacts:
24
27
  sender_name: "sender name"
25
28
  sender_email: 'sender email'
26
29
  body: 'message'
27
-
30
+
28
31
  comments:
29
32
  author: 'author'
30
33
  body: "body text"
31
34
  locale: 'language'
32
35
  status: 'status'
33
-
36
+
34
37
  pages:
35
38
  author: 'author'
36
39
  create_new: 'create new page'
@@ -41,7 +44,7 @@ en:
41
44
  published: 'published?'
42
45
  unpublish: 'unpublish'
43
46
  reorder_root_menus: 'reorder root menu items'
44
-
47
+
45
48
  create:
46
49
  notice: 'The page was successfully created.'
47
50
  warning: 'There was a problem saving the page'
@@ -59,7 +62,17 @@ en:
59
62
  published: 'The page has been published'
60
63
  unpublished: "The page has been unpublished. It's a draft again."
61
64
  toggled: "The blog status of the page has been changed"
62
-
65
+
66
+ tags:
67
+ edit_this: 'edit this tag'
68
+ tag_list: 'tag list'
69
+
70
+ update:
71
+ notice: 'The tag was successfully updated.'
72
+ warning: 'There was a problem saving the tag'
73
+ hint:
74
+ name: 'Lower case only. Multiple words should be joined by a dash (-) and NOT spaces'
75
+
63
76
  contacts:
64
77
  messages_from_forms: 'messages from contact form'
65
78
  send_message: 'send message'
@@ -74,12 +87,12 @@ en:
74
87
  sender_name: "Sender's name:"
75
88
  sender_email: "Sender's email:"
76
89
  message: 'Message:'
77
-
90
+
78
91
  comments:
79
92
  login_needed: 'You need to be logged in to leave a comment'
80
93
  sorted_by_oldest: 'This section is sorted by oldest comment first so that they can be moderated from top to bottom.'
81
94
  what_do_you_think: 'What do you think?'
82
-
95
+
83
96
  create:
84
97
  notice: 'The comment was successfully created.'
85
98
  warning: 'There was a problem saving the comment to the database'
@@ -102,7 +115,7 @@ en:
102
115
  pending: 'pending'
103
116
  accepted: 'accepted'
104
117
  blocked: 'blocked'
105
-
118
+
106
119
  blog:
107
120
  itself: 'blog'
108
121
  home: 'home blog'
@@ -1,5 +1,5 @@
1
1
  es:
2
-
2
+
3
3
  activerecord:
4
4
  models:
5
5
  comment: 'comment'
@@ -10,7 +10,7 @@ es:
10
10
  pages: 'pages'
11
11
  tag: 'tag'
12
12
  tags: 'tags'
13
-
13
+
14
14
  attributes:
15
15
  pages:
16
16
  title: "título"
@@ -19,12 +19,15 @@ es:
19
19
  body: "parte principal"
20
20
  for_the_blog: 'contraseña'
21
21
  parent_title: 'page parent title'
22
-
22
+
23
+ tags:
24
+ name: "name"
25
+
23
26
  contacts:
24
27
  sender_name: "nombre del remitente"
25
28
  sender_email: 'correo electrónico del remitente'
26
29
  body: 'mensaje'
27
-
30
+
28
31
  comments:
29
32
  author: 'author'
30
33
  body: "body text"
@@ -41,7 +44,7 @@ es:
41
44
  published: '¿publicado?'
42
45
  unpublish: 'unpublish'
43
46
  reorder_root_menus: 'reorder root menu items'
44
-
47
+
45
48
  create:
46
49
  notice: 'La página se ha creado correctamente'
47
50
  warning: 'Hubo un problema al guardar la página'
@@ -59,7 +62,17 @@ es:
59
62
  published: 'The page has been published'
60
63
  unpublished: "The page has been unpublished. It's a draft again."
61
64
  toggled: "The blog status of the page has been changed"
62
-
65
+
66
+ tags:
67
+ edit_this: 'edit this tag'
68
+ tag_list: 'tag list'
69
+
70
+ update:
71
+ notice: 'The tag was successfully updated.'
72
+ warning: 'There was a problem saving the tag'
73
+ hint:
74
+ name: 'Lower case only. Multiple words should be joined by a dash (-) and NOT spaces'
75
+
63
76
  contacts:
64
77
  messages_from_forms: 'mensajes del formulario de contacto'
65
78
  send_message: 'enviar el mensaje'
@@ -79,7 +92,7 @@ es:
79
92
  login_needed: 'You need to be logged in to leave a comment'
80
93
  sorted_by_oldest: 'This section is sorted by oldest comment first so that they can be moderated from top to bottom.'
81
94
  what_do_you_think: 'What do you think?'
82
-
95
+
83
96
  create:
84
97
  notice: 'The comment was successfully created.'
85
98
  warning: 'There was a problem saving the comment to the database'
@@ -102,7 +115,7 @@ es:
102
115
  pending: 'pending'
103
116
  accepted: 'accepted'
104
117
  blocked: 'blocked'
105
-
118
+
106
119
  blog:
107
120
  itself: 'blog'
108
121
  home: 'home blog'
@@ -1,5 +1,5 @@
1
1
  fr:
2
-
2
+
3
3
  activerecord:
4
4
  models:
5
5
  comment: 'commentaire'
@@ -10,7 +10,7 @@ fr:
10
10
  pages: 'les pages'
11
11
  tag: 'étiquette'
12
12
  tags: 'les étiquettes'
13
-
13
+
14
14
  attributes:
15
15
  pages:
16
16
  title: "titre"
@@ -20,17 +20,20 @@ fr:
20
20
  for_the_blog: 'pour le blog'
21
21
  parent_title: 'titre de la page maternelle'
22
22
 
23
+ tags:
24
+ name: "nom"
25
+
23
26
  contacts:
24
27
  sender_name: "nom de l'auteur"
25
28
  sender_email: "email de l'auteur"
26
29
  body: 'contenu du message'
27
-
30
+
28
31
  comments:
29
32
  author: 'auteur'
30
33
  body: "texte"
31
34
  locale: 'langue'
32
35
  status: 'état'
33
-
36
+
34
37
  pages:
35
38
  author: 'auteur'
36
39
  create_new: 'créer une nouvelle page'
@@ -41,7 +44,7 @@ fr:
41
44
  published: 'publiée ?'
42
45
  unpublish: 'la depublier'
43
46
  reorder_root_menus: 'réorganiser les menus racines'
44
-
47
+
45
48
  create:
46
49
  notice: 'La page a été créée.'
47
50
  warning: "Il y'a eu un probleme et la page n'a pas été sauvegardée."
@@ -60,10 +63,20 @@ fr:
60
63
  unpublished: "La publication de la page a été annulée. Elle est a nouveau en mode brouillon."
61
64
  toggled: "Le status de blog ou non-blog a été modifié."
62
65
 
66
+ tags:
67
+ edit_this: 'modifier cette étiquette'
68
+ tag_list: 'liste des étiquettes'
69
+
70
+ update:
71
+ notice: 'Les changements de cette étiquette ont été sauvegardés.'
72
+ warning: "Il y'a eu un probleme et les changements de cette étiquette n'ont pas été sauvegardés."
73
+ hint:
74
+ name: 'Pas de majuscules, que des minuscules. Entre les mots multiples, utilisez un tiret ( - ), pas avec un espace.'
75
+
63
76
  contacts:
64
77
  messages_from_forms: 'messages du formulaire de contact'
65
78
  send_message: 'envoyez le message'
66
- sent: 'Envoyé le'
79
+ sent: 'Envoyé le'
67
80
  create:
68
81
  did_not_reach: "Il y a eu un problem. Le message n'a pas été acheminé a sa destination."
69
82
  invalid_email: 'Votre adresse courriel ne semble pas bonne !'
@@ -74,12 +87,12 @@ fr:
74
87
  sender_name: "Nom de l'auteur :"
75
88
  sender_email: "Adresse courriel de l'auteur :"
76
89
  message: 'Message :'
77
-
90
+
78
91
  comments:
79
92
  login_needed: 'Vous devez être identifié pour fournir un commentaire'
80
93
  sorted_by_oldest: 'Cette section va du plus vieux au plus recent pour vous permettre de modérer les commentaires du haut en bas.'
81
94
  what_do_you_think: "Qu'en pensez vous ?"
82
-
95
+
83
96
  create:
84
97
  notice: 'Le commentaire a bien été créé.'
85
98
  warning: "Il y a eu un problem et le commentaire n'a pas été sauvegardé"
@@ -1,3 +1,3 @@
1
1
  module TkhContent
2
- VERSION = "0.9.8"
2
+ VERSION = "0.9.9"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tkh_content
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.8
4
+ version: 0.9.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Swami Atma
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-07 00:00:00.000000000 Z
11
+ date: 2014-03-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -152,6 +152,7 @@ files:
152
152
  - app/controllers/comments_controller.rb
153
153
  - app/controllers/contacts_controller.rb
154
154
  - app/controllers/pages_controller.rb
155
+ - app/controllers/tags_controller.rb
155
156
  - app/helpers/blog_helper.rb
156
157
  - app/helpers/pages_helper.rb
157
158
  - app/mailers/contact_mailer.rb
@@ -194,6 +195,10 @@ files:
194
195
  - app/views/pages/new.html.erb
195
196
  - app/views/pages/show.html.erb
196
197
  - app/views/shared/_admin_sidebar.html.erb
198
+ - app/views/tags/_form.html.erb
199
+ - app/views/tags/_tab_admin_menu.html.erb
200
+ - app/views/tags/edit.html.erb
201
+ - app/views/tags/index.html.erb
197
202
  - config/routes.rb
198
203
  - lib/generators/tkh_content/create_or_update_files/create_or_update_files_generator.rb
199
204
  - lib/generators/tkh_content/create_or_update_files/templates/blog.html.erb