typo 5.4 → 5.4.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +23 -30
- data/Typo users guide.pdf +0 -0
- data/app/controllers/admin/content_controller.rb +28 -36
- data/app/controllers/admin/tags_controller.rb +4 -4
- data/app/controllers/articles_controller.rb +119 -1
- data/app/controllers/comments_controller.rb +0 -7
- data/app/controllers/content_controller.rb +1 -0
- data/app/helpers/admin/content_helper.rb +9 -28
- data/app/helpers/admin/themes_helper.rb +4 -6
- data/app/helpers/articles_helper.rb +4 -0
- data/app/models/article.rb +21 -12
- data/app/models/blog.rb +0 -1
- data/app/models/category.rb +1 -6
- data/app/models/content.rb +10 -6
- data/app/models/feedback/states.rb +6 -6
- data/app/models/tag.rb +8 -8
- data/app/views/admin/content/_drafts.html.erb +1 -1
- data/app/views/admin/content/_form.html.erb +7 -4
- data/app/views/admin/content/index.html.erb +3 -3
- data/app/views/admin/feedback/index.html.erb +4 -4
- data/app/views/admin/settings/feedback.html.erb +8 -7
- data/app/views/admin/settings/write.html.erb +71 -72
- data/app/views/admin/tags/index.html.erb +4 -4
- data/app/views/admin/themes/editor.html.erb +13 -10
- data/app/views/articles/_article.html.erb +6 -4
- data/bin/typo +25 -0
- data/config/initializers/access_rules.rb +4 -0
- data/config/routes.rb +2 -2
- data/db/schema.rb +32 -26
- data/db/schema.sqlite3.sql +3 -0
- data/lang/fr_FR.rb +46 -44
- data/lib/tasks/release.rake +1 -1
- data/lib/typo_version.rb +1 -1
- data/public/images/admin/loading.gif +0 -0
- data/public/images/closelabel.gif +0 -0
- data/public/stylesheets/administration.css +28 -8
- data/spec/controllers/admin/content_controller_spec.rb +91 -7
- data/spec/controllers/articles_controller_spec.rb +209 -0
- data/spec/controllers/comments_controller_spec.rb +0 -17
- data/spec/controllers/xml_controller_spec.rb +0 -5
- data/spec/factories.rb +8 -3
- data/spec/models/article_spec.rb +31 -4
- data/spec/models/configuration_spec.rb +0 -4
- data/spec/models/user_spec.rb +13 -0
- data/spec/spec_helper.rb +13 -0
- data/spec/views/articles/index_spec.rb +9 -11
- data/spec/views/articles/read_spec.rb +3 -5
- data/test/fixtures/blogs.yml +0 -1
- data/themes/dirtylicious/views/articles/_article.html.erb +6 -4
- data/themes/scribbish/views/articles/_article.html.erb +6 -4
- data/themes/standard_issue/views/articles/_article.html.erb +6 -4
- data/themes/true-blue-3/views/articles/_article.html.erb +8 -6
- data/themes/true-blue-3/views/categories/_article.html.erb +1 -1
- data/themes/typographic/views/articles/_article.html.erb +7 -5
- metadata +6 -8
- data/app/controllers/admin/previews_controller.rb +0 -10
- data/app/controllers/previews_controller.rb +0 -10
- data/app/controllers/redirect_controller.rb +0 -143
- data/app/helpers/redirect_helper.rb +0 -13
- data/spec/controllers/previews_controller_spec.rb +0 -28
- data/spec/controllers/redirect_controller_spec.rb +0 -165
data/lang/fr_FR.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
Localization.define("fr_FR") do |l|
|
2
2
|
|
3
|
+
|
3
4
|
# app/views/accounts/confirm.html.erb
|
4
5
|
l.store "You have successfully signed up", "Vous vous %etes inscrit avec succès"
|
5
6
|
l.store "Login %s", "Identifiant %s"
|
@@ -127,7 +128,7 @@ Localization.define("fr_FR") do |l|
|
|
127
128
|
l.store "You have no internet connection", "Vous n'avez pas de connection à internet"
|
128
129
|
|
129
130
|
# app/views/admin/dashboard/_overview.html.erb
|
130
|
-
l.store "This place gives you a quick overview of what happens on your Typo blog and what you can do. Maybe will you want to %s, %s or %s.", ""
|
131
|
+
l.store "This place gives you a quick overview of what happens on your Typo blog and what you can do. Maybe will you want to %s, %s or %s.", "Voici un rapide aperçu de ce que peux faire votre blog Typo. Peux-être voulez vous %s, %s ou %s"
|
131
132
|
l.store "update your profile or change your password", "mettre votre profil à jour ou changer votre mot de passe"
|
132
133
|
l.store "You can also do a bit of design, %s or %s.", "Vous pouvez également faire un peu de personnalisation, %s, %s"
|
133
134
|
l.store "change your blog presentation", "changer l'apparence de votre blog"
|
@@ -176,18 +177,19 @@ Localization.define("fr_FR") do |l|
|
|
176
177
|
l.store "Are you sure?", "Êtes-vous certain ?"
|
177
178
|
l.store "add a comment", "Ajouter un commentaire"
|
178
179
|
l.store "All comments", "Tous les commentaires"
|
179
|
-
l.store "Limit to ham", "Uniquement les commentaires
|
180
|
+
l.store "Limit to ham", "Uniquement les commentaires validés"
|
180
181
|
l.store "Limit to spam", "Afficher le spam"
|
181
182
|
|
182
183
|
# app/views/admin/feedback/edit.html.erb
|
183
184
|
l.store "Comments for", "Commentaires pour"
|
184
185
|
|
185
186
|
# app/views/admin/feedback/index.html.erb
|
186
|
-
l.store "Feedback for", "
|
187
|
+
l.store "Feedback for", "Feedbacks sur"
|
187
188
|
l.store "Search Comments and Trackbacks that contain", "Chercher les commentaires et les trackbacks contenant"
|
188
189
|
l.store "Article", "Article"
|
189
190
|
l.store "Comment Excerpt", "Extrait du commentaire"
|
190
191
|
l.store "IP", "Adresse IP"
|
192
|
+
l.store "Unapproved comments", "Commentaires non validés"
|
191
193
|
|
192
194
|
# app/views/admin/pages/_form.html.erb
|
193
195
|
l.store "Options", "Options"
|
@@ -282,7 +284,7 @@ Localization.define("fr_FR") do |l|
|
|
282
284
|
l.store "Blog subtitle", "Sous-titre du blog"
|
283
285
|
l.store "Blog URL", "Adresse du blog"
|
284
286
|
l.store "Language", "Langue"
|
285
|
-
l.store "You can allow users to register to your blog. By default, they will register as contributors, an unpriviledged account level which grant them no rights but own a profile on the site. If you don't want users to register, you can thus add them by yourself in the users part of this admin.", ""
|
287
|
+
l.store "You can allow users to register to your blog. By default, they will register as contributors, an unpriviledged account level which grant them no rights but own a profile on the site. If you don't want users to register, you can thus add them by yourself in the users part of this admin.", "Vous pouvez permettre aux utilisateur de s'enregistrer sur votre blog. Par défaut, ils seront enregistrés come contributeurs. Cet utilisateur a un niveau faible sans droit mais qui possède sont propre profile sur le site. Si vous ne voulez pas que les utilisateurs s'enregistrent, vous pouvez les ajouter vous même dans la partie d'administration des utilisateurs."
|
286
288
|
l.store "Allow users to register", "Autoriser les utilisateurs à s'enregistrer"
|
287
289
|
l.store "No", "Non"
|
288
290
|
l.store "Yes", "Oui"
|
@@ -306,23 +308,23 @@ Localization.define("fr_FR") do |l|
|
|
306
308
|
l.store "At the beginning of page title", "Au début du titre de la page"
|
307
309
|
l.store "At the end of page title", "À la fin du titre de la page"
|
308
310
|
l.store "Don't show blog name in page title", "Ne pas afficher le nom du blog dans le titre de la page"
|
309
|
-
l.store "Format of permalink", ""
|
310
|
-
l.store "Google Analytics", ""
|
311
|
-
l.store "Meta description", ""
|
312
|
-
l.store "Meta keywords", ""
|
313
|
-
l.store "Use RSS description", ""
|
314
|
-
l.store "Index categories", ""
|
315
|
-
l.store "Unchecking this box will add <code>noindex, follow</code> meta tags in every category page, removing them from search engines and preventing duplicate content issues", ""
|
316
|
-
l.store "Index tags", ""
|
317
|
-
l.store "Unchecking this box will add <code>noindex, follow</code> meta tags in every tags page, removing them from search engines and preventing duplicate content issues", ""
|
318
|
-
l.store "Robots.txt", ""
|
319
|
-
l.store "You robots.txt file is not writeable. Typo won't be able to write it", ""
|
320
|
-
l.store "Search Engine Optimization", ""
|
311
|
+
l.store "Format of permalink", "Format des liens permanents"
|
312
|
+
l.store "Google Analytics", "Google Analytics"
|
313
|
+
l.store "Meta description", "Meta description"
|
314
|
+
l.store "Meta keywords", "Meta keywords"
|
315
|
+
l.store "Use RSS description", "Utilisation de la description RSS"
|
316
|
+
l.store "Index categories", "Index de catégories"
|
317
|
+
l.store "Unchecking this box will add <code>noindex, follow</code> meta tags in every category page, removing them from search engines and preventing duplicate content issues", "Détiquer cette options ajoutera le meta tags <code>noindex, follow</code> dans toutes les pages de chaque categorie. Cela les enlevera des moteurs de recherches et préviendra ainsi des problèmes de contenu dupliqué."
|
318
|
+
l.store "Index tags", "Index des tags"
|
319
|
+
l.store "Unchecking this box will add <code>noindex, follow</code> meta tags in every tags page, removing them from search engines and preventing duplicate content issues", "Détiquer cette options ajoutera le meta tags <code>noindex, follow</code> dans toutes les pages de chaque tag. Cela les enlevera des moteurs de recherches et préviendra ainsi des problèmes de contenu dupliqué."
|
320
|
+
l.store "Robots.txt", "Robots.txt"
|
321
|
+
l.store "You robots.txt file is not writeable. Typo won't be able to write it", "Votre fichier Robots.txt n'est pas écrivable. Typo ne peux donc pas l'écrire."
|
322
|
+
l.store "Search Engine Optimization", "Optimisation pour les moteurs de recherches"
|
321
323
|
l.store "This will display", "Cela affichera"
|
322
|
-
l.store "Original article writen by", "Article original écrit par"
|
324
|
+
l.store "Original article writen by", "Article original écrit par"
|
323
325
|
l.store "and published on", "et publié sur"
|
324
|
-
l.store "direct link to this article", "lien direct vers cet article"
|
325
|
-
l.store "If you are reading this article elsewhere than", "Si vous lisez cet article ailleurs que sur"
|
326
|
+
l.store "direct link to this article", "lien direct vers cet article"
|
327
|
+
l.store "If you are reading this article elsewhere than", "Si vous lisez cet article ailleurs que sur"
|
326
328
|
l.store "it has been illegally reproduced and without proper authorization", "c'est qu'il a été reproduit illégalement et sans autorisation"
|
327
329
|
l.store "at the bottom of each of your post in the RSS feed", "en bas de chacun de vos articles sur le flux RSS"
|
328
330
|
|
@@ -402,7 +404,7 @@ Localization.define("fr_FR") do |l|
|
|
402
404
|
l.store "Get more themes", "Téléchargez d'autres thèmes"
|
403
405
|
l.store "You can download third party themes from officially supported %s ", "Vous pouvez télécharger des thèmes officiellement supportés sur %s "
|
404
406
|
l.store "Typogarden", "Typogarden"
|
405
|
-
l.store "To install a theme you just need to upload the theme folder into your themes directory. Once a theme is uploaded, you should see it on this page.", ""
|
407
|
+
l.store "To install a theme you just need to upload the theme folder into your themes directory. Once a theme is uploaded, you should see it on this page.", "Pour installer votre thèmes, il suffit de l'uploader dans le dossier themes de votre projet."
|
406
408
|
l.store "Choose a theme", "Sélectionnez un thème"
|
407
409
|
|
408
410
|
# app/views/admin/users/_form.html.erb
|
@@ -421,7 +423,7 @@ Localization.define("fr_FR") do |l|
|
|
421
423
|
l.store "Use visual rich editor", "Utiliser l'éditeur visuel"
|
422
424
|
l.store "Use simple editor", "Utiliser l'éditeur simplifié"
|
423
425
|
l.store "Send notification messages via email", "Envoi de notification des messages par email"
|
424
|
-
l.store "Send notification messages when new articles are posted", "Envoi de notification de messages quand de nouveaux articles sont postés"
|
426
|
+
l.store "Send notification messages when new articles are posted", "Envoi de notification de messages quand de nouveaux articles sont postés"
|
425
427
|
l.store "Send notification messages when comments are posted", "Envoi de notification de messages quand des commentaires sont postés"
|
426
428
|
l.store "Contact options", "Options de contact"
|
427
429
|
l.store "Your site", "Votre site"
|
@@ -462,14 +464,14 @@ Localization.define("fr_FR") do |l|
|
|
462
464
|
|
463
465
|
# app/views/articles/_comment_box.html.erb
|
464
466
|
l.store "Your name", "Votre nom "
|
465
|
-
l.store "(leave url/email »)", ""
|
467
|
+
l.store "(leave url/email »)", "(laissez votre url/email »)"
|
466
468
|
l.store "Your email", "Votre courriel"
|
467
469
|
l.store "Your message", "Votre commentaire"
|
468
470
|
l.store "Comment Markup Help", "Aide sur le balisage des commentaires"
|
469
471
|
l.store "Preview comment", "Prévisualiser le commentaire"
|
470
472
|
|
471
473
|
# app/views/articles/_comment_failed.html.erb
|
472
|
-
l.store "Oops, something wrong happened, the comment could not be saved", ""
|
474
|
+
l.store "Oops, something wrong happened, the comment could not be saved", "Oops, quelque chose s'est mal déroulé. Votre commentaire n'a donc pu être enregistré."
|
473
475
|
|
474
476
|
# app/views/articles/_trackback.html.erb
|
475
477
|
l.store "From", "De"
|
@@ -489,7 +491,7 @@ Localization.define("fr_FR") do |l|
|
|
489
491
|
|
490
492
|
# app/views/articles/read.html.erb
|
491
493
|
l.store "Leave a response", "Réagir à ce billet"
|
492
|
-
l.store "Trackbacks", ""
|
494
|
+
l.store "Trackbacks", "Trackbacks"
|
493
495
|
l.store "Use the following link to trackback from your own site", "Utilisez le lien ci-dessous pour envoyer un trackback depuis votre site"
|
494
496
|
l.store "RSS feed for this post", "Flux RSS de ce billet"
|
495
497
|
l.store "trackback uri", "URL de rétrolien"
|
@@ -676,22 +678,22 @@ Localization.define("fr_FR") do |l|
|
|
676
678
|
l.store "Destroy this draft", "Supprimer ce brouillon"
|
677
679
|
|
678
680
|
# app/helpers/application_helper.rb
|
679
|
-
# Dates
|
681
|
+
# Dates
|
680
682
|
l.store "Mon", "Lun"
|
681
683
|
l.store "Tue", "Mar"
|
682
684
|
l.store "Wed", "Mer"
|
683
|
-
l.store "Thu", "Jeu"
|
684
|
-
l.store "Fri", "Ven"
|
685
|
-
l.store "Sat", "Sam"
|
685
|
+
l.store "Thu", "Jeu"
|
686
|
+
l.store "Fri", "Ven"
|
687
|
+
l.store "Sat", "Sam"
|
686
688
|
l.store "Sun", "Dim"
|
687
689
|
l.store "Monday", "Lundi"
|
688
690
|
l.store "Tuesday", "Mardi"
|
689
691
|
l.store "Wednesday", "Mercredi"
|
690
|
-
l.store "Thursday", "Jeudi"
|
691
|
-
l.store "Friday", "Vendredi"
|
692
|
-
l.store "Saturday", "Samedi"
|
692
|
+
l.store "Thursday", "Jeudi"
|
693
|
+
l.store "Friday", "Vendredi"
|
694
|
+
l.store "Saturday", "Samedi"
|
693
695
|
l.store "Sunday", "Dimanche"
|
694
|
-
l.store "Jan", "Jan"
|
696
|
+
l.store "Jan", "Jan"
|
695
697
|
l.store "Feb", "Fév"
|
696
698
|
l.store "Mar", "Mars"
|
697
699
|
l.store "Apr", "Avr"
|
@@ -703,7 +705,7 @@ Localization.define("fr_FR") do |l|
|
|
703
705
|
l.store "Oct", "Oct"
|
704
706
|
l.store "Nov", "Nov"
|
705
707
|
l.store "Dec", "Déc"
|
706
|
-
l.store "January", "janvier"
|
708
|
+
l.store "January", "janvier"
|
707
709
|
l.store "February", "février"
|
708
710
|
l.store "March", "mars"
|
709
711
|
l.store "April", "avril"
|
@@ -721,14 +723,14 @@ Localization.define("fr_FR") do |l|
|
|
721
723
|
l.store "%%a, %%d %%b %%Y %%H:%%M", Proc.new {|date|
|
722
724
|
sprintf( date.strftime("%%s %d %%s %Y %H:%M"), _(date.strftime("%a")), _(date.strftime("%b")).downcase )
|
723
725
|
}
|
724
|
-
|
726
|
+
|
725
727
|
l.store "%%d. %%b", Proc.new {|date|
|
726
728
|
sprintf( date.strftime("%d. %%s"), _(date.strftime("%b")).downcase )
|
727
729
|
}
|
728
|
-
l.store "Original article writen by", "Article original écrit par"
|
730
|
+
l.store "Original article writen by", "Article original écrit par"
|
729
731
|
l.store "and published on", "et publié sur"
|
730
|
-
l.store "direct link to this article", "lien direct vers cet article"
|
731
|
-
l.store "If you are reading this article elsewhere than", "Si vous lisez cet article ailleurs que sur"
|
732
|
+
l.store "direct link to this article", "lien direct vers cet article"
|
733
|
+
l.store "If you are reading this article elsewhere than", "Si vous lisez cet article ailleurs que sur"
|
732
734
|
l.store "it has been illegally reproduced and without proper authorization", "c'est qu'il a été reproduit illégalement et sans autorisation"
|
733
735
|
l.store "This will display", "Cela affichera"
|
734
736
|
l.store "at the bottom of each of your post in the RSS feed", "en bas de chacun de vos articles sur le flux RSS"
|
@@ -750,11 +752,11 @@ Localization.define("fr_FR") do |l|
|
|
750
752
|
l.store "You need a permalink format with an identifier : %%month%%, %%year%%, %%day%%, %%title%%", "Vous devez spécifier un identifiant : %%month%%, %%year%%, %%day%%, %%title%%"
|
751
753
|
|
752
754
|
# app/models/feedback/states.rb
|
753
|
-
l.store "Unclassified", ""
|
754
|
-
l.store "Just Presumed Ham", ""
|
755
|
-
l.store "Ham?", ""
|
756
|
-
l.store "Just Marked As Ham", ""
|
757
|
-
l.store "Ham", ""
|
758
|
-
l.store "Spam?", ""
|
759
|
-
l.store "Just Marked As Spam", ""
|
755
|
+
l.store "Unclassified", "Non vérifié"
|
756
|
+
l.store "Just Presumed Ham", "Marqué commme supposé désirable"
|
757
|
+
l.store "Ham?", "Désirable?"
|
758
|
+
l.store "Just Marked As Ham", "Marqué comme désirable"
|
759
|
+
l.store "Ham", "Désirable"
|
760
|
+
l.store "Spam?", "Spam?"
|
761
|
+
l.store "Just Marked As Spam", "Marqué comme spam"
|
760
762
|
end
|
data/lib/tasks/release.rake
CHANGED
data/lib/typo_version.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
TYPO_VERSION = '5.4'
|
1
|
+
TYPO_VERSION = '5.4.1'
|
Binary file
|
Binary file
|
@@ -53,10 +53,6 @@ p {
|
|
53
53
|
padding-top: 20px;
|
54
54
|
}
|
55
55
|
|
56
|
-
textarea {
|
57
|
-
border: none;
|
58
|
-
}
|
59
|
-
|
60
56
|
.clear {
|
61
57
|
clear: both;
|
62
58
|
}
|
@@ -245,7 +241,11 @@ p.input_text_title {
|
|
245
241
|
margin-top: 10px;
|
246
242
|
}
|
247
243
|
|
248
|
-
|
244
|
+
textarea {
|
245
|
+
border: none;
|
246
|
+
}
|
247
|
+
|
248
|
+
input.small, #article_published_at, textarea.small, #theme_body {
|
249
249
|
padding: 2px 0 4px 5px;
|
250
250
|
margin: 0;
|
251
251
|
border: 0;
|
@@ -257,6 +257,10 @@ input.small, #article_published_at, textarea.small {
|
|
257
257
|
behavior: url("../../stylesheets/border-radius.htc");
|
258
258
|
}
|
259
259
|
|
260
|
+
#theme_body {
|
261
|
+
font-family: courier, sans-serif;
|
262
|
+
}
|
263
|
+
|
260
264
|
.ed_button {
|
261
265
|
border-color: #023;
|
262
266
|
border-width: 3px;
|
@@ -641,12 +645,28 @@ td.paginate {
|
|
641
645
|
color: #6a0;
|
642
646
|
}
|
643
647
|
|
644
|
-
.unpublished
|
648
|
+
.unpublished,
|
649
|
+
.mandatory {
|
645
650
|
color: #c00;
|
646
651
|
}
|
647
652
|
|
653
|
+
#article_keywords_auto_complete {
|
654
|
+
margin-top: 2px;
|
655
|
+
}
|
656
|
+
|
657
|
+
#article_keywords_auto_complete ul {
|
658
|
+
margin: 0;
|
659
|
+
padding: 0;
|
660
|
+
}
|
661
|
+
|
648
662
|
#article_keywords_auto_complete ul li {
|
649
663
|
list-style: none;
|
650
664
|
background: #DCF6FE;
|
651
|
-
border-bottom: #
|
652
|
-
|
665
|
+
border-bottom: #a7eafe 1px solid;
|
666
|
+
padding: 3px 5px;
|
667
|
+
}
|
668
|
+
|
669
|
+
#article_keywords_auto_complete ul li.selected {
|
670
|
+
background: #a7eafe;
|
671
|
+
}
|
672
|
+
|
@@ -36,13 +36,78 @@ describe Admin::ContentController do
|
|
36
36
|
|
37
37
|
end
|
38
38
|
|
39
|
+
describe 'autosave action', :shared => true do
|
40
|
+
it 'should save new article with draft status and link to other article if first autosave' do
|
41
|
+
lambda do
|
42
|
+
lambda do
|
43
|
+
post :autosave, :article => {:allow_comments => '1',
|
44
|
+
:body_and_extended => 'my draft in autosave',
|
45
|
+
:keywords => 'mientag',
|
46
|
+
:permalink => 'big-post',
|
47
|
+
:title => 'big post',
|
48
|
+
:text_filter => 'none',
|
49
|
+
:published => '1',
|
50
|
+
:published_at => 'December 23, 2009 03:20 PM'}
|
51
|
+
end.should change(Article, :count)
|
52
|
+
end.should change(Tag, :count)
|
53
|
+
result = Article.last
|
54
|
+
result.body.should == 'my draft in autosave'
|
55
|
+
result.title.should == 'big post'
|
56
|
+
result.permalink.should == 'big-post'
|
57
|
+
result.parent_id.should be_nil
|
58
|
+
end
|
59
|
+
|
60
|
+
describe "for a published article" do
|
61
|
+
before :each do
|
62
|
+
@article = contents(:article1)
|
63
|
+
@data = {:allow_comments => @article.allow_comments,
|
64
|
+
:body_and_extended => 'my draft in autosave',
|
65
|
+
:keywords => '',
|
66
|
+
:permalink => @article.permalink,
|
67
|
+
:title => @article.title,
|
68
|
+
:text_filter => @article.text_filter,
|
69
|
+
:published => '1',
|
70
|
+
:published_at => 'December 23, 2009 03:20 PM'}
|
71
|
+
end
|
72
|
+
|
73
|
+
it 'should create a draft article with proper attributes and existing article as a parent' do
|
74
|
+
lambda do
|
75
|
+
post :autosave, :id => @article.id, :article => @data
|
76
|
+
end.should change(Article, :count)
|
77
|
+
result = Article.last
|
78
|
+
result.body.should == 'my draft in autosave'
|
79
|
+
result.title.should == @article.title
|
80
|
+
result.permalink.should == @article.permalink
|
81
|
+
result.parent_id.should == @article.id
|
82
|
+
end
|
83
|
+
|
84
|
+
it 'should not create another draft article with parent_id if article has already a draft associated' do
|
85
|
+
draft = Article.create!(@article.attributes.merge(:guid => nil, :state => 'draft', :parent_id => @article.id))
|
86
|
+
lambda do
|
87
|
+
post :autosave, :id => @article.id, :article => @data
|
88
|
+
end.should_not change(Article, :count)
|
89
|
+
Article.last.parent_id.should == @article.id
|
90
|
+
end
|
91
|
+
|
92
|
+
it 'should create a draft with the same permalink even if the title has changed' do
|
93
|
+
@data[:title] = @article.title + " more stuff"
|
94
|
+
lambda do
|
95
|
+
post :autosave, :id => @article.id, :article => @data
|
96
|
+
end.should change(Article, :count)
|
97
|
+
result = Article.last
|
98
|
+
result.parent_id.should == @article.id
|
99
|
+
result.permalink.should == @article.permalink
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
39
104
|
describe 'insert_editor action' do
|
40
|
-
|
105
|
+
|
41
106
|
before do
|
42
107
|
@user = users(:tobi)
|
43
108
|
request.session = { :user => @user.id }
|
44
109
|
end
|
45
|
-
|
110
|
+
|
46
111
|
it 'should render _simple_editor' do
|
47
112
|
get(:insert_editor, :editor => 'simple')
|
48
113
|
response.should render_template('_simple_editor')
|
@@ -68,7 +133,7 @@ describe Admin::ContentController do
|
|
68
133
|
{ :title => "posted via tests!",
|
69
134
|
:body => "A good body",
|
70
135
|
:keywords => "tagged",
|
71
|
-
:allow_comments => '1',
|
136
|
+
:allow_comments => '1',
|
72
137
|
:allow_pings => '1' }.merge(options)
|
73
138
|
end
|
74
139
|
|
@@ -97,8 +162,8 @@ describe Admin::ContentController do
|
|
97
162
|
|
98
163
|
assert_difference 'Article.count_published_articles' do
|
99
164
|
tags = ['foo', 'bar', 'baz bliz', 'gorp gack gar']
|
100
|
-
post :new,
|
101
|
-
'article' => base_article(:keywords => tags) ,
|
165
|
+
post :new,
|
166
|
+
'article' => base_article(:keywords => tags) ,
|
102
167
|
'categories' => [category.id]
|
103
168
|
assert_response :redirect, :action => 'show'
|
104
169
|
end
|
@@ -180,12 +245,12 @@ describe Admin::ContentController do
|
|
180
245
|
it_should_behave_like 'index action'
|
181
246
|
it_should_behave_like 'new action'
|
182
247
|
it_should_behave_like 'destroy action'
|
248
|
+
it_should_behave_like 'autosave action'
|
183
249
|
|
184
250
|
describe 'edit action' do
|
185
251
|
|
186
252
|
it 'should edit article' do
|
187
253
|
get :edit, 'id' => contents(:article1).id
|
188
|
-
assigns(:selected).should == contents(:article1).categories.collect {|c| c.id}
|
189
254
|
response.should render_template('new')
|
190
255
|
assert_template_has 'article'
|
191
256
|
assigns(:article).should be_valid
|
@@ -225,6 +290,26 @@ describe Admin::ContentController do
|
|
225
290
|
article.body.should == 'foo'
|
226
291
|
article.extended.should == 'bar<!--more-->baz'
|
227
292
|
end
|
293
|
+
|
294
|
+
it 'should delete draft about this article if update' do
|
295
|
+
article = contents(:article1)
|
296
|
+
draft = Article.create!(article.attributes.merge(:state => 'draft', :parent_id => article.id, :guid => nil))
|
297
|
+
lambda do
|
298
|
+
post :edit, 'id' => article.id, 'article' => { 'title' => 'new'}
|
299
|
+
end.should change(Article, :count).by(-1)
|
300
|
+
Article.should_not be_exists({:id => draft.id})
|
301
|
+
end
|
302
|
+
|
303
|
+
it 'should delete all draft about this article if update not happen but why not' do
|
304
|
+
article = contents(:article1)
|
305
|
+
draft = Article.create!(article.attributes.merge(:state => 'draft', :parent_id => article.id, :guid => nil))
|
306
|
+
draft_2 = Article.create!(article.attributes.merge(:state => 'draft', :parent_id => article.id, :guid => nil))
|
307
|
+
lambda do
|
308
|
+
post :edit, 'id' => article.id, 'article' => { 'title' => 'new'}
|
309
|
+
end.should change(Article, :count).by(-2)
|
310
|
+
Article.should_not be_exists({:id => draft.id})
|
311
|
+
Article.should_not be_exists({:id => draft_2.id})
|
312
|
+
end
|
228
313
|
end
|
229
314
|
|
230
315
|
describe 'resource_add action' do
|
@@ -303,7 +388,6 @@ describe Admin::ContentController do
|
|
303
388
|
|
304
389
|
it 'should edit article' do
|
305
390
|
get :edit, 'id' => contents(:publisher_article).id
|
306
|
-
assigns(:selected).should == contents(:publisher_article).categories.collect {|c| c.id}
|
307
391
|
response.should render_template('new')
|
308
392
|
assert_template_has 'article'
|
309
393
|
assigns(:article).should be_valid
|
@@ -202,3 +202,212 @@ describe ArticlesController, "the index" do
|
|
202
202
|
response.should_not render_template("_atom_feed")
|
203
203
|
end
|
204
204
|
end
|
205
|
+
|
206
|
+
describe ArticlesController, "previewing" do
|
207
|
+
integrate_views
|
208
|
+
|
209
|
+
describe 'with non logged user' do
|
210
|
+
before :each do
|
211
|
+
@request.session = {}
|
212
|
+
get :preview, :id => Factory(:article).id
|
213
|
+
end
|
214
|
+
|
215
|
+
it 'should be redirect to login' do
|
216
|
+
response.should redirect_to(:controller => "accounts/login", :action => :index)
|
217
|
+
end
|
218
|
+
end
|
219
|
+
describe 'with logged user' do
|
220
|
+
before :each do
|
221
|
+
@request.session = {:user => users(:tobi).id}
|
222
|
+
@article = Factory(:article)
|
223
|
+
end
|
224
|
+
|
225
|
+
with_each_theme do |theme, view_path|
|
226
|
+
it "should render template #{view_path}/articles/read" do
|
227
|
+
this_blog.theme = theme if theme
|
228
|
+
get :preview, :id => @article.id
|
229
|
+
response.should render_template('articles/read.html.erb')
|
230
|
+
end
|
231
|
+
end
|
232
|
+
|
233
|
+
it 'should assigns article define with id' do
|
234
|
+
get :preview, :id => @article.id
|
235
|
+
assigns[:article].should == @article
|
236
|
+
end
|
237
|
+
|
238
|
+
it 'should assigns last article with id like parent_id' do
|
239
|
+
draft = Factory(:article, :parent_id => @article.id)
|
240
|
+
get :preview, :id => @article.id
|
241
|
+
assigns[:article].should == draft
|
242
|
+
end
|
243
|
+
|
244
|
+
end
|
245
|
+
end
|
246
|
+
|
247
|
+
describe ArticlesController, "redirecting" do
|
248
|
+
before do
|
249
|
+
ActionController::Base.relative_url_root = nil # avoid failures if environment.rb defines a relative URL root
|
250
|
+
end
|
251
|
+
|
252
|
+
it 'should split routing path' do
|
253
|
+
assert_routing "foo/bar/baz", {
|
254
|
+
:from => ["foo", "bar", "baz"],
|
255
|
+
:controller => 'articles', :action => 'redirect'}
|
256
|
+
end
|
257
|
+
|
258
|
+
it 'should redirect from articles_routing' do
|
259
|
+
assert_routing "articles", {
|
260
|
+
:from => ["articles"],
|
261
|
+
:controller => 'articles', :action => 'redirect'}
|
262
|
+
assert_routing "articles/foo", {
|
263
|
+
:from => ["articles", "foo"],
|
264
|
+
:controller => 'articles', :action => 'redirect'}
|
265
|
+
assert_routing "articles/foo/bar", {
|
266
|
+
:from => ["articles", "foo", "bar"],
|
267
|
+
:controller => 'articles', :action => 'redirect'}
|
268
|
+
assert_routing "articles/foo/bar/baz", {
|
269
|
+
:from => ["articles", "foo", "bar", "baz"],
|
270
|
+
:controller => 'articles', :action => 'redirect'}
|
271
|
+
end
|
272
|
+
|
273
|
+
|
274
|
+
it 'should redirect' do
|
275
|
+
get :redirect, :from => ["foo", "bar"]
|
276
|
+
assert_response 301
|
277
|
+
assert_redirected_to "http://test.host/someplace/else"
|
278
|
+
end
|
279
|
+
|
280
|
+
it 'should redirect with url_root' do
|
281
|
+
ActionController::Base.relative_url_root = "/blog"
|
282
|
+
get :redirect, :from => ["foo", "bar"]
|
283
|
+
assert_response 301
|
284
|
+
assert_redirected_to "http://test.host/blog/someplace/else"
|
285
|
+
|
286
|
+
get :redirect, :from => ["bar", "foo"]
|
287
|
+
assert_response 301
|
288
|
+
assert_redirected_to "http://test.host/blog/someplace/else"
|
289
|
+
end
|
290
|
+
|
291
|
+
it 'should no redirect' do
|
292
|
+
get :redirect, :from => ["something/that/isnt/there"]
|
293
|
+
assert_response 404
|
294
|
+
end
|
295
|
+
|
296
|
+
it 'should redirect to article' do
|
297
|
+
get :redirect, :from => ["articles", "2004", "04", "01", "second-blog-article"]
|
298
|
+
assert_response 301
|
299
|
+
assert_redirected_to "http://myblog.net/2004/04/01/second-blog-article"
|
300
|
+
end
|
301
|
+
|
302
|
+
it 'should redirect to article with url_root' do
|
303
|
+
b = blogs(:default)
|
304
|
+
b.base_url = "http://test.host/blog"
|
305
|
+
b.save
|
306
|
+
get :redirect, :from => ["articles", "2004", "04", "01", "second-blog-article"]
|
307
|
+
assert_response 301
|
308
|
+
assert_redirected_to "http://test.host/blog/2004/04/01/second-blog-article"
|
309
|
+
end
|
310
|
+
|
311
|
+
it 'should redirect to article when url_root is articles' do
|
312
|
+
b = blogs(:default)
|
313
|
+
b.base_url = "http://test.host/articles"
|
314
|
+
b.save
|
315
|
+
get :redirect, :from => ["articles", "2004", "04", "01", "second-blog-article"]
|
316
|
+
assert_response 301
|
317
|
+
assert_redirected_to "http://test.host/articles/2004/04/01/second-blog-article"
|
318
|
+
end
|
319
|
+
|
320
|
+
it 'should redirect to article with articles in url_root' do
|
321
|
+
b = blogs(:default)
|
322
|
+
b.base_url = "http://test.host/aaa/articles/bbb"
|
323
|
+
b.save
|
324
|
+
|
325
|
+
get :redirect, :from => ["articles", "2004", "04", "01", "second-blog-article"]
|
326
|
+
assert_response 301
|
327
|
+
assert_redirected_to "http://test.host/aaa/articles/bbb/2004/04/01/second-blog-article"
|
328
|
+
end
|
329
|
+
|
330
|
+
describe 'with permalink_format like %title%.html' do
|
331
|
+
|
332
|
+
integrate_views
|
333
|
+
|
334
|
+
before(:each) do
|
335
|
+
b = blogs(:default)
|
336
|
+
b.permalink_format = '/%title%.html'
|
337
|
+
b.save
|
338
|
+
end
|
339
|
+
describe 'render article' do
|
340
|
+
|
341
|
+
integrate_views
|
342
|
+
|
343
|
+
before(:each) do
|
344
|
+
get :redirect, :from => ["#{contents(:article1).permalink}.html"]
|
345
|
+
end
|
346
|
+
|
347
|
+
it 'should render template read to article' do
|
348
|
+
response.should render_template('articles/read.html.erb')
|
349
|
+
end
|
350
|
+
|
351
|
+
it 'should assign article1 to @article' do
|
352
|
+
assigns(:article).should == contents(:article1)
|
353
|
+
end
|
354
|
+
|
355
|
+
it 'should have good rss feed link' do
|
356
|
+
response.should have_tag('head>link[href=?]', "http://myblog.net/#{contents(:article1).permalink}.html.rss")
|
357
|
+
end
|
358
|
+
|
359
|
+
it 'should have good atom feed link' do
|
360
|
+
response.should have_tag('head>link[href=?]', "http://myblog.net/#{contents(:article1).permalink}.html.atom")
|
361
|
+
end
|
362
|
+
|
363
|
+
end
|
364
|
+
|
365
|
+
it 'should get good article with utf8 slug' do
|
366
|
+
get :redirect, :from => ['2004', '06', '02', 'ルビー']
|
367
|
+
assigns(:article).should == contents(:utf8_article)
|
368
|
+
end
|
369
|
+
|
370
|
+
describe 'rendering as atom feed' do
|
371
|
+
before(:each) do
|
372
|
+
get :redirect, :from => ["#{contents(:article1).permalink}.html.atom"]
|
373
|
+
end
|
374
|
+
|
375
|
+
it 'should render atom partial' do
|
376
|
+
response.should render_template('articles/_atom_feed.atom.builder')
|
377
|
+
end
|
378
|
+
|
379
|
+
it 'should render a valid feed' do
|
380
|
+
assert_feedvalidator response.body
|
381
|
+
end
|
382
|
+
end
|
383
|
+
|
384
|
+
describe 'rendering as rss feed' do
|
385
|
+
before(:each) do
|
386
|
+
get :redirect, :from => ["#{contents(:article1).permalink}.html.rss"]
|
387
|
+
end
|
388
|
+
|
389
|
+
it 'should render rss20 partial' do
|
390
|
+
response.should render_template('articles/_rss20_feed.rss.builder')
|
391
|
+
end
|
392
|
+
|
393
|
+
it 'should render a valid feed' do
|
394
|
+
assert_feedvalidator response.body
|
395
|
+
end
|
396
|
+
end
|
397
|
+
|
398
|
+
describe 'rendering comment feed with problematic characters' do
|
399
|
+
before(:each) do
|
400
|
+
@comment = contents(:article1).comments.first
|
401
|
+
@comment.body = "écoute! 4 < 2, non?"
|
402
|
+
@comment.save!
|
403
|
+
get :redirect, :from => ["#{contents(:article1).permalink}.html.atom"]
|
404
|
+
end
|
405
|
+
|
406
|
+
it 'should result in a valid atom feed' do
|
407
|
+
assigns(:article).should == contents(:article1)
|
408
|
+
assert_feedvalidator response.body
|
409
|
+
end
|
410
|
+
end
|
411
|
+
|
412
|
+
end
|
413
|
+
end
|