monologue 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +1 -1
- data/README.md +28 -6
- data/app/assets/images/monologue/admin/select2.png +0 -0
- data/app/assets/javascripts/monologue/admin/application.js +6 -2
- data/app/assets/javascripts/monologue/admin/ckeditor-config.js +21 -0
- data/app/assets/javascripts/monologue/admin/posts.js +62 -0
- data/app/assets/stylesheets/monologue/admin/application.css +2 -1
- data/app/assets/stylesheets/monologue/admin/posts.sass +21 -0
- data/app/assets/stylesheets/monologue/blog/application.css +1 -1
- data/app/assets/stylesheets/monologue/blog/monologue.css +12 -1
- data/app/controllers/monologue/admin/base_controller.rb +2 -2
- data/app/controllers/monologue/admin/posts_controller.rb +31 -44
- data/app/controllers/monologue/admin/sessions_controller.rb +2 -2
- data/app/controllers/monologue/admin/users_controller.rb +39 -3
- data/app/controllers/monologue/application_controller.rb +7 -7
- data/app/controllers/monologue/posts_controller.rb +5 -7
- data/app/controllers/monologue/tags_controller.rb +8 -3
- data/app/form_builders/monologue_admin_form_builder.rb +12 -8
- data/app/helpers/monologue/application_helper.rb +9 -39
- data/app/helpers/monologue/html_helper.rb +35 -0
- data/app/helpers/monologue/tags_helper.rb +25 -0
- data/app/models/monologue/post.rb +38 -23
- data/app/models/monologue/tag.rb +3 -4
- data/app/models/monologue/tagging.rb +2 -0
- data/app/models/monologue/user.rb +13 -2
- data/app/sweepers/monologue/posts_sweeper.rb +2 -5
- data/app/views/layouts/monologue/admin.html.erb +2 -2
- data/app/views/layouts/monologue/admin/_nav_bar.html.erb +8 -16
- data/app/views/layouts/monologue/application.html.erb +1 -1
- data/app/views/layouts/monologue/application/_fb_open_graph.html.erb +2 -2
- data/app/views/layouts/monologue/application/_sidebar.html.erb +3 -1
- data/app/views/layouts/monologue/application/_twitter_cards.html.erb +2 -2
- data/app/views/monologue/admin/cache/_config.html.erb +1 -1
- data/app/views/monologue/admin/cache/show.html.erb +1 -1
- data/app/views/monologue/admin/posts/_form.html.erb +23 -9
- data/app/views/monologue/admin/posts/edit.html.erb +3 -3
- data/app/views/monologue/admin/posts/index.html.erb +5 -3
- data/app/views/monologue/admin/posts/new.html.erb +1 -1
- data/app/views/monologue/admin/sessions/new.html.erb +1 -1
- data/app/views/monologue/admin/users/_form.html.erb +5 -0
- data/app/views/monologue/admin/users/edit.html.erb +3 -7
- data/app/views/monologue/admin/users/index.html.erb +28 -0
- data/app/views/monologue/admin/users/new.html.erb +5 -0
- data/app/views/monologue/posts/_pagination.html.erb +2 -2
- data/app/views/monologue/posts/_post.html.erb +6 -8
- data/app/views/monologue/posts/_post_header.html.erb +16 -0
- data/app/views/monologue/posts/_social_sharing.html.erb +6 -6
- data/app/views/monologue/posts/feed.rss.builder +7 -8
- data/app/views/monologue/posts/index.html.erb +1 -1
- data/app/views/monologue/posts/show.html.erb +8 -8
- data/app/views/monologue/sidebar/_latest_posts.html.erb +1 -1
- data/app/views/monologue/sidebar/_latest_tweets.html.erb +1 -1
- data/app/views/monologue/sidebar/_tag_cloud.html.erb +1 -1
- data/config/locales/en.yml +81 -112
- data/config/locales/es.yml +148 -0
- data/config/locales/fr.yml +76 -110
- data/config/locales/it.yml +147 -0
- data/config/locales/pt.yml +147 -0
- data/config/locales/ro.yml +78 -110
- data/config/routes.rb +12 -10
- data/db/migrate/20120120193858_create_monologue_posts_revisions.rb +1 -1
- data/db/migrate/20120514194459_join_posts_and_tags.rb +1 -1
- data/db/migrate/20120526131841_migrate_old_urls.rb +3 -0
- data/db/migrate/20120612015727_delete_join_posts_tags.rb +1 -1
- data/db/migrate/20130108123111_move_user_id_to_post.rb +31 -0
- data/db/migrate/20130509015400_merge_revisions_into_posts.rb +40 -0
- data/db/seeds.rb +1 -1
- data/lib/monologue/engine.rb +6 -6
- data/lib/monologue/version.rb +1 -1
- data/lib/tasks/monologue_cache.rake +1 -1
- data/vendor/assets/javascripts/monologue/bootstrap/bootstrap-datepicker-es.js +7 -0
- data/vendor/assets/javascripts/monologue/bootstrap/bootstrap-datepicker-it.js +9 -0
- data/vendor/assets/javascripts/monologue/bootstrap/bootstrap-datepicker-pt.js +9 -0
- metadata +88 -78
- data/app/assets/javascripts/monologue/admin/tinymce-config.js +0 -21
- data/app/models/monologue/posts_revision.rb +0 -61
- 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
|
-
| <%= revision.user.name %> | <a href="<%= revision.full_url + "#disqus_thread" %>"></a>
|
8
|
-
</div>
|
9
|
-
</header>
|