monologue 0.2.0 → 0.3.0

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 (78) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +1 -1
  3. data/README.md +28 -6
  4. data/app/assets/images/monologue/admin/select2.png +0 -0
  5. data/app/assets/javascripts/monologue/admin/application.js +6 -2
  6. data/app/assets/javascripts/monologue/admin/ckeditor-config.js +21 -0
  7. data/app/assets/javascripts/monologue/admin/posts.js +62 -0
  8. data/app/assets/stylesheets/monologue/admin/application.css +2 -1
  9. data/app/assets/stylesheets/monologue/admin/posts.sass +21 -0
  10. data/app/assets/stylesheets/monologue/blog/application.css +1 -1
  11. data/app/assets/stylesheets/monologue/blog/monologue.css +12 -1
  12. data/app/controllers/monologue/admin/base_controller.rb +2 -2
  13. data/app/controllers/monologue/admin/posts_controller.rb +31 -44
  14. data/app/controllers/monologue/admin/sessions_controller.rb +2 -2
  15. data/app/controllers/monologue/admin/users_controller.rb +39 -3
  16. data/app/controllers/monologue/application_controller.rb +7 -7
  17. data/app/controllers/monologue/posts_controller.rb +5 -7
  18. data/app/controllers/monologue/tags_controller.rb +8 -3
  19. data/app/form_builders/monologue_admin_form_builder.rb +12 -8
  20. data/app/helpers/monologue/application_helper.rb +9 -39
  21. data/app/helpers/monologue/html_helper.rb +35 -0
  22. data/app/helpers/monologue/tags_helper.rb +25 -0
  23. data/app/models/monologue/post.rb +38 -23
  24. data/app/models/monologue/tag.rb +3 -4
  25. data/app/models/monologue/tagging.rb +2 -0
  26. data/app/models/monologue/user.rb +13 -2
  27. data/app/sweepers/monologue/posts_sweeper.rb +2 -5
  28. data/app/views/layouts/monologue/admin.html.erb +2 -2
  29. data/app/views/layouts/monologue/admin/_nav_bar.html.erb +8 -16
  30. data/app/views/layouts/monologue/application.html.erb +1 -1
  31. data/app/views/layouts/monologue/application/_fb_open_graph.html.erb +2 -2
  32. data/app/views/layouts/monologue/application/_sidebar.html.erb +3 -1
  33. data/app/views/layouts/monologue/application/_twitter_cards.html.erb +2 -2
  34. data/app/views/monologue/admin/cache/_config.html.erb +1 -1
  35. data/app/views/monologue/admin/cache/show.html.erb +1 -1
  36. data/app/views/monologue/admin/posts/_form.html.erb +23 -9
  37. data/app/views/monologue/admin/posts/edit.html.erb +3 -3
  38. data/app/views/monologue/admin/posts/index.html.erb +5 -3
  39. data/app/views/monologue/admin/posts/new.html.erb +1 -1
  40. data/app/views/monologue/admin/sessions/new.html.erb +1 -1
  41. data/app/views/monologue/admin/users/_form.html.erb +5 -0
  42. data/app/views/monologue/admin/users/edit.html.erb +3 -7
  43. data/app/views/monologue/admin/users/index.html.erb +28 -0
  44. data/app/views/monologue/admin/users/new.html.erb +5 -0
  45. data/app/views/monologue/posts/_pagination.html.erb +2 -2
  46. data/app/views/monologue/posts/_post.html.erb +6 -8
  47. data/app/views/monologue/posts/_post_header.html.erb +16 -0
  48. data/app/views/monologue/posts/_social_sharing.html.erb +6 -6
  49. data/app/views/monologue/posts/feed.rss.builder +7 -8
  50. data/app/views/monologue/posts/index.html.erb +1 -1
  51. data/app/views/monologue/posts/show.html.erb +8 -8
  52. data/app/views/monologue/sidebar/_latest_posts.html.erb +1 -1
  53. data/app/views/monologue/sidebar/_latest_tweets.html.erb +1 -1
  54. data/app/views/monologue/sidebar/_tag_cloud.html.erb +1 -1
  55. data/config/locales/en.yml +81 -112
  56. data/config/locales/es.yml +148 -0
  57. data/config/locales/fr.yml +76 -110
  58. data/config/locales/it.yml +147 -0
  59. data/config/locales/pt.yml +147 -0
  60. data/config/locales/ro.yml +78 -110
  61. data/config/routes.rb +12 -10
  62. data/db/migrate/20120120193858_create_monologue_posts_revisions.rb +1 -1
  63. data/db/migrate/20120514194459_join_posts_and_tags.rb +1 -1
  64. data/db/migrate/20120526131841_migrate_old_urls.rb +3 -0
  65. data/db/migrate/20120612015727_delete_join_posts_tags.rb +1 -1
  66. data/db/migrate/20130108123111_move_user_id_to_post.rb +31 -0
  67. data/db/migrate/20130509015400_merge_revisions_into_posts.rb +40 -0
  68. data/db/seeds.rb +1 -1
  69. data/lib/monologue/engine.rb +6 -6
  70. data/lib/monologue/version.rb +1 -1
  71. data/lib/tasks/monologue_cache.rake +1 -1
  72. data/vendor/assets/javascripts/monologue/bootstrap/bootstrap-datepicker-es.js +7 -0
  73. data/vendor/assets/javascripts/monologue/bootstrap/bootstrap-datepicker-it.js +9 -0
  74. data/vendor/assets/javascripts/monologue/bootstrap/bootstrap-datepicker-pt.js +9 -0
  75. metadata +88 -78
  76. data/app/assets/javascripts/monologue/admin/tinymce-config.js +0 -21
  77. data/app/models/monologue/posts_revision.rb +0 -61
  78. data/app/views/monologue/posts/_revision_header.html.erb +0 -9
@@ -1,21 +0,0 @@
1
- $(function() {
2
- $('textarea').tinymce({
3
- theme: 'advanced',
4
- theme_advanced_buttons1 : "bold,italic,underline,strikethrough,separator,justifyleft,justifycenter,justifyright, justifyfull,bullist,numlist,undo,redo,link,unlink",
5
- theme_advanced_buttons2 : "formatselect, removeformat, indent, outdent, image, code",
6
- theme_advanced_buttons3 : "",
7
- theme_advanced_blockformats : "p,h1,h2,h3,h4,h5,h6,blockquote,dt,dd,code,samp",
8
- theme_advanced_toolbar_location : "top",
9
- theme_advanced_toolbar_align : "left",
10
- theme_advanced_statusbar_location : "bottom",
11
-
12
-
13
- plugins : "fullscreen",
14
- theme_advanced_buttons3_add : "fullscreen",
15
- fullscreen_new_window : true,
16
- fullscreen_settings : {
17
- theme_advanced_path_location : "top"
18
- }
19
-
20
- });
21
- });
@@ -1,61 +0,0 @@
1
- class Monologue::PostsRevision < ActiveRecord::Base
2
- attr_accessible :title, :content, :url, :published_at
3
-
4
- before_validation :generate_url
5
-
6
- after_save :latest_revision_is_current
7
-
8
- belongs_to :post
9
- belongs_to :user
10
-
11
- validates :title, :presence => true
12
- validates :content, :presence => true
13
- validates :url, :presence => true
14
- validate :url_do_not_start_with_slash
15
- validate :url_is_unique
16
- validates :user_id, :presence => true
17
- # validates :post_id, :presence => true # TODO: do something about this validation on the first creation of a POST
18
- validates :published_at, :presence => true
19
-
20
- #isn't it post concern?'
21
- def latest_revision_is_current
22
- #post = Monologue::Post.find(self.post_id)
23
- self.post.posts_revision_id = self.id
24
- self.post.save!
25
- end
26
-
27
- def full_url
28
- "#{Monologue::Engine.routes.url_helpers.root_path}#{self.url}"
29
- end
30
-
31
- def url_do_not_start_with_slash
32
- errors.add(:url, I18n.t("activerecord.errors.models.monologue/posts_revision.attributes.url.start_with_slash")) if self.url.start_with?("/")
33
- end
34
-
35
- def url_is_unique
36
- errors.add(:url, I18n.t("activerecord.errors.models.monologue/posts_revision.attributes.url.unique")) if self.url_exists?
37
- end
38
-
39
- def url_exists?
40
- if self.post_id.nil?
41
- return Monologue::PostsRevision.where("url = ?", self.url).count > 0
42
- else
43
- return Monologue::PostsRevision.where("url = ? and post_id <> ?", self.url, self.post_id).count > 0
44
- end
45
- end
46
-
47
- private
48
-
49
- def generate_url
50
- year = self.published_at.class == ActiveSupport::TimeWithZone ? self.published_at.year : DateTime.now.year
51
- return if self.title.blank?
52
- base_title = "#{year}/#{self.title.parameterize}"
53
- url_empty = self.url.nil? || self.url.strip == ""
54
- self.url = base_title if url_empty
55
- while self.url_exists? && url_empty
56
- i ||= 1
57
- self.url = "#{base_title}-#{i}"
58
- i += 1
59
- end
60
- end
61
- end
@@ -1,9 +0,0 @@
1
- <header class="revision-header">
2
- <h1><%= link_to revision.title, revision.full_url %></h1>
3
- <div class="posted">
4
- <time datetime="<%= revision.published_at %>">
5
- <%= I18n.localize(revision.published_at.to_date, :format => :long) %>
6
- </time>
7
- &nbsp;&nbsp;|&nbsp;&nbsp;<%= revision.user.name %>&nbsp;&nbsp;|&nbsp;&nbsp;<a href="<%= revision.full_url + "#disqus_thread" %>"></a>
8
- </div>
9
- </header>