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
@@ -9,7 +9,7 @@ class Monologue::ApplicationController < ApplicationController
9
9
  end
10
10
 
11
11
  def all_tags
12
- @tags = Monologue::Tag.all(:order => "name").select{|t| t.frequency>0}
12
+ @tags = Monologue::Tag.all(order: "name").select{|t| t.frequency>0}
13
13
  #could use minmax here but it's only supported with ruby > 1.9'
14
14
  @tags_frequency_min = @tags.map{|t| t.frequency}.min
15
15
  @tags_frequency_max = @tags.map{|t| t.frequency}.max
@@ -19,22 +19,22 @@ class Monologue::ApplicationController < ApplicationController
19
19
  # fallback to the default 404.html page from main_app.
20
20
  file = Rails.root.join('public', '404.html')
21
21
  if file.exist?
22
- render :file => file.cleanpath.to_s.gsub(%r{#{file.extname}$}, ''),
23
- :layout => false, :status => 404, :formats => [:html]
22
+ render file: file.cleanpath.to_s.gsub(%r{#{file.extname}$}, ''),
23
+ layout: false, status: 404, formats: [:html]
24
24
  else
25
- render :action => "404", :status => 404, :formats => [:html]
25
+ render action: "404", status: 404, formats: [:html]
26
26
  end
27
27
  end
28
28
 
29
29
  private
30
30
 
31
- def current_user
31
+ def monologue_current_user
32
32
  @monologue_current_user ||= Monologue::User.find(session[:monologue_user_id]) if session[:monologue_user_id]
33
33
  end
34
34
 
35
35
  def monologue_page_cache_enabled?
36
- current_user.nil? && Monologue::PageCache.enabled
36
+ monologue_current_user.nil? && Monologue::PageCache.enabled
37
37
  end
38
38
 
39
- helper_method :current_user, :monologue_page_cache_enabled?
39
+ helper_method :monologue_current_user, :monologue_page_cache_enabled?
40
40
  end
@@ -1,5 +1,5 @@
1
1
  class Monologue::PostsController < Monologue::ApplicationController
2
- caches_page :index, :show, :feed , :if => Proc.new { monologue_page_cache_enabled? }
2
+ caches_page :index, :show, :feed , if: Proc.new { monologue_page_cache_enabled? }
3
3
 
4
4
  def index
5
5
  @page = params[:page].nil? ? 1 : params[:page]
@@ -7,16 +7,14 @@ class Monologue::PostsController < Monologue::ApplicationController
7
7
  end
8
8
 
9
9
  def show
10
- if current_user
11
- post = Monologue::Post.default.where("monologue_posts_revisions.url = :url", {:url => params[:post_url]}).first
10
+ if monologue_current_user
11
+ @post = Monologue::Post.default.where("url = :url", {url: params[:post_url]}).first
12
12
  else
13
- post = Monologue::Post.published.where("monologue_posts_revisions.url = :url", {:url => params[:post_url]}).first
13
+ @post = Monologue::Post.published.where("url = :url", {url: params[:post_url]}).first
14
14
  end
15
- if post.nil?
15
+ if @post.nil?
16
16
  not_found
17
- return
18
17
  end
19
- @revision = post.active_revision
20
18
  end
21
19
 
22
20
  def feed
@@ -1,12 +1,17 @@
1
1
  class Monologue::TagsController < Monologue::ApplicationController
2
- caches_page :show , :if => Proc.new { monologue_page_cache_enabled? }
2
+ caches_page :show , if: Proc.new { monologue_page_cache_enabled? }
3
3
  def show
4
- @tag = Monologue::Tag.find_by_name(params[:tag])
4
+ @tag = retrieve_tag
5
5
  if @tag
6
6
  @page = nil
7
7
  @posts = @tag.posts_with_tag
8
8
  else
9
- redirect_to :root ,:notice => "No post found with label \"#{params[:tag]}\""
9
+ redirect_to :root ,notice: "No post found with label \"#{params[:tag]}\""
10
10
  end
11
11
  end
12
+
13
+ private
14
+ def retrieve_tag
15
+ Monologue::Tag.where("lower(name) = ?", params[:tag].downcase).first
16
+ end
12
17
  end
@@ -1,9 +1,9 @@
1
1
  class MonologueAdminFormBuilder < ActionView::Helpers::FormBuilder
2
- delegate :content_tag, :tag, :to => :@template
2
+ delegate :content_tag, :tag, to: :@template
3
3
 
4
4
  %w[text_field text_area password_field collection_select select file_field].each do |method_name|
5
5
  define_method(method_name) do |name, *args|
6
- content_tag :div, :class => "field" do
6
+ content_tag :div, class: "field" do
7
7
  field_label(name, *args) + super(name, *args)
8
8
  end
9
9
  end
@@ -12,31 +12,31 @@ class MonologueAdminFormBuilder < ActionView::Helpers::FormBuilder
12
12
  def check_box(name, *args)
13
13
  options = args.extract_options!
14
14
  required = object.class.validators_on(name).any? { |v| v.kind_of? ActiveModel::Validations::PresenceValidator }
15
- content_tag :label, :class => (required ? "required checkbox inline" : "checkbox inline") do
15
+ content_tag :label, class: (required ? "required checkbox inline" : "checkbox inline") do
16
16
  super + (options[:label] || name)
17
17
  end
18
18
  end
19
19
 
20
20
  def collection_check_boxes(attribute, records, record_id, record_name)
21
- content_tag :div, :class => "field" do
21
+ content_tag :div, class: "field" do
22
22
  @template.hidden_field_tag("#{object_name}[#{attribute}][]") +
23
23
  records.map do |record|
24
24
  element_id = "#{object_name}_#{attribute}_#{record.send(record_id)}"
25
- checkbox = @template.check_box_tag("#{object_name}[#{attribute}][]", record.send(record_id), object.send(attribute).include?(record.send(record_id)), :id => element_id)
25
+ checkbox = @template.check_box_tag("#{object_name}[#{attribute}][]", record.send(record_id), object.send(attribute).include?(record.send(record_id)), id: element_id)
26
26
  checkbox + " " + @template.label_tag(element_id, record.send(record_name))
27
27
  end.join(tag(:br)).html_safe
28
28
  end
29
29
  end
30
30
 
31
31
  def submit(*args)
32
- content_tag :div, :class => "actions" do
32
+ content_tag :div, class: "form-actions" do
33
33
  super
34
34
  end
35
35
  end
36
36
 
37
37
  def error_messages
38
38
  if object.errors.full_messages.any?
39
- content_tag(:div, :class => "alert alert-error error_messages") do
39
+ content_tag(:div, class: "alert alert-error error_messages") do
40
40
  content_tag(:strong, "Invalid Fields") +
41
41
  content_tag(:ul) do
42
42
  object.errors.messages.map do |msg|
@@ -52,7 +52,11 @@ class MonologueAdminFormBuilder < ActionView::Helpers::FormBuilder
52
52
  def field_label(name, *args)
53
53
  options = args.extract_options!
54
54
  required = object.class.validators_on(name).any? { |v| v.kind_of? ActiveModel::Validations::PresenceValidator }
55
- label(name, options[:label], :class => ("required" if required))
55
+ if options[:id]
56
+ label(name, options[:label], class: ("required" if required), for: options[:id])
57
+ else
58
+ label(name, options[:label], class: ("required" if required))
59
+ end
56
60
  end
57
61
 
58
62
  def objectify_options(options)
@@ -1,8 +1,9 @@
1
1
  module Monologue
2
2
  module ApplicationHelper
3
3
  include Monologue::Engine.routes.url_helpers if ENV["RAILS_ENV"] == "test" # TODO: try and see why this is needed for specs to pass
4
- #Number of sizes defined in the css
5
- NUMBER_OF_LABEL_SIZES = 5
4
+ #Why aren't they loaded by default?
5
+ include Monologue::HtmlHelper
6
+ include Monologue::TagsHelper
6
7
 
7
8
  def monologue_admin_form_for(object, options = {}, &block)
8
9
  options[:builder] = MonologueAdminFormBuilder
@@ -13,15 +14,8 @@ module Monologue
13
14
  content_for?(:title) ? ((content_for :title) + " | #{Monologue.site_name}") : Monologue.site_name
14
15
  end
15
16
 
16
- def sidebar_section_for(title, &block)
17
- content_tag(:section, :class => 'widget') do
18
- content_tag(:header, content_tag(:h1, title)) +
19
- capture(&block)
20
- end
21
- end
22
-
23
17
  def rss_head_link
24
- tag("link", :href => feed_url, :rel => "alternate", :title => "RSS", :type => "application/rss+xml")
18
+ tag("link", href: feed_url, rel: "alternate", title: "RSS", type: "application/rss+xml")
25
19
  end
26
20
 
27
21
  def rss_icon
@@ -49,40 +43,16 @@ module Monologue
49
43
  end
50
44
 
51
45
  def absolute_image_url(url)
52
- return url if url.starts_with? "http"
53
- request.protocol + request.host + url
54
- end
55
-
56
- # TODO: That should be move in TagHelper if I manage to get that loaded
57
- def tag_url(tag)
58
- "#{Monologue::Engine.routes.url_helpers.root_path}tags/#{tag.name.downcase}"
59
- end
60
-
61
- def label_for_tag(tag, min, max)
62
- "label-size-#{size_for_tag(tag, min, max)}"
46
+ return url if url.starts_with? "http"
47
+ request.protocol + request.host + url
63
48
  end
64
49
 
65
- def size_for_tag(tag, min, max)
66
- #logarithmic scaling based on the number of occurrences of each tag
67
- if min<max && tag.frequency>0
68
- 1 + ((NUMBER_OF_LABEL_SIZES-1)*(log_distance_to_min(tag.frequency, min))/log_distance_to_min(max, min)).round
69
- else
70
- 1
71
- end
72
- end
73
-
74
- private
75
- def social_icon foundicon, url, setting
50
+ def social_icon(foundicon, url, setting)
76
51
  return if setting.nil? || !setting
77
- content_tag :a, :href => url, :class => "social", :target => "_blank" do
78
- content_tag :i, :class => "foundicon-#{foundicon}" do # using an empty content tag for foundicons to appear. TODO: try to do otherwise and use only tag method
52
+ content_tag :a, href: url, class: "social", target: "_blank" do
53
+ content_tag :i, class: "foundicon-#{foundicon}" do # using an empty content tag for foundicons to appear. TODO: try to do otherwise and use only tag method
79
54
  end
80
55
  end
81
56
  end
82
-
83
- def log_distance_to_min(value, min)
84
- Math.log(value)-Math.log(min)
85
- end
86
-
87
57
  end
88
58
  end
@@ -0,0 +1,35 @@
1
+ module Monologue
2
+ module HtmlHelper
3
+
4
+
5
+ # +li+ tag with the 'active' class added if the url is the current one.
6
+ # Eg.:
7
+ #
8
+ # <%= activable_li_tag users_path do %>
9
+ # <%= link_to "Users", users_path %>
10
+ # <% end %>
11
+ #
12
+ def activable_li_tag(*url, &block)
13
+ content_tag :li, capture(&block), :class => ("active" if url.any?{|u| current_page?(u)})
14
+ end
15
+
16
+ # +li+ tag with the 'active' class added if the url is the current one with a link
17
+ # inside it pointing to that url.
18
+ #
19
+ # <%= activatable_li_tag_with_link "Users", users_path %>
20
+ #
21
+ def activable_li_tag_with_link(title, *url)
22
+ activable_li_tag *url do
23
+ link_to(title, url.first)
24
+ end
25
+ end
26
+
27
+ def sidebar_section_for(title, &block)
28
+ content_tag(:section, class: 'widget') do
29
+ content_tag(:header, content_tag(:h1, title)) +
30
+ capture(&block)
31
+ end
32
+ end
33
+
34
+ end
35
+ end
@@ -1,5 +1,30 @@
1
1
  module Monologue
2
2
  module TagsHelper
3
3
 
4
+ #Number of sizes defined in the css
5
+ NUMBER_OF_LABEL_SIZES = 5
6
+
7
+ def tag_url(tag)
8
+ "#{Monologue::Engine.routes.url_helpers.root_path}tags/#{tag.name.downcase}"
9
+ end
10
+
11
+ def label_for_tag(tag, min, max)
12
+ "label-size-#{size_for_tag(tag, min, max)}"
13
+ end
14
+
15
+ def size_for_tag(tag, min, max)
16
+ #logarithmic scaling based on the number of occurrences of each tag
17
+ if min<max && tag.frequency>0
18
+ 1 + ((NUMBER_OF_LABEL_SIZES-1)*(log_distance_to_min(tag.frequency, min))/log_distance_to_min(max, min)).round
19
+ else
20
+ 1
21
+ end
22
+ end
23
+
24
+ private
25
+
26
+ def log_distance_to_min(value, min)
27
+ Math.log(value)-Math.log(min)
28
+ end
4
29
  end
5
30
  end
@@ -1,46 +1,48 @@
1
1
  class Monologue::Post < ActiveRecord::Base
2
- has_many :posts_revisions, :dependent => :destroy
3
2
  has_many :taggings
4
- has_many :tags, :through => :taggings, :dependent => :destroy
3
+ has_many :tags, through: :taggings, dependent: :destroy
4
+ before_validation :generate_url
5
+ belongs_to :user
5
6
 
6
- accepts_nested_attributes_for :posts_revisions
7
- attr_writer :tag_list
8
- attr_accessible :posts_revisions_attributes, :published, :tag_list
7
+ attr_accessible :title, :content, :url, :published, :published_at, :tag_list
9
8
 
10
- scope :default, includes(:posts_revisions).where("posts_revision_id = monologue_posts_revisions.id").order("published_at DESC, monologue_posts.created_at DESC, monologue_posts.updated_at DESC")
11
- scope :published, lambda { default.where(:published => true).where("published_at <= ?", DateTime.now) }
9
+ scope :default, order("published_at DESC, monologue_posts.created_at DESC, monologue_posts.updated_at DESC")
10
+ scope :published, lambda { default.where(published: true).where("published_at <= ?", DateTime.now) }
12
11
 
13
12
  default_scope includes(:tags)
14
13
 
15
- validates :posts_revision_id, :uniqueness => true
14
+ validates :user_id, presence: true
15
+ validates :title, :content, :url, :published_at, presence: true
16
+ validates :url, uniqueness: true
17
+ validate :url_do_not_start_with_slash
16
18
 
17
- # TODO: move that in a spec helper as it only used by tests
18
- def just_the_revision_one_before
19
- self.posts_revisions.where("post_id = ?", self.id).order("monologue_posts_revisions.updated_at DESC").offset(1).limit(1).first
19
+ def tag_list= tags_attr
20
+ self.tag!(tags_attr.split(","))
20
21
  end
21
22
 
22
- def latest_revision
23
- self.posts_revisions.where("post_id = ?", self.id).order("monologue_posts_revisions.updated_at DESC").limit(1).first
23
+ def tag_list
24
+ self.tags.map { |tag| tag.name }.join(", ") if self.tags
24
25
  end
25
26
 
26
- def active_revision
27
- Monologue::PostsRevision.find(self.posts_revision_id)
27
+ def tag!(tags_attr)
28
+ self.tags = tags_attr.map(&:strip).reject(&:blank?).map do |tag|
29
+ Monologue::Tag.find_or_create_by_name(tag)
30
+ end
28
31
  end
29
32
 
30
- def tag!(tags)
31
- self.tags = tags.select { |t| t.present? }.map do |tag|
32
- tag.strip!
33
- if tag.present?
34
- Monologue::Tag.find_or_create_by_name(tag)
35
- end
36
- end
33
+ def full_url
34
+ "#{Monologue::Engine.routes.url_helpers.root_path}#{self.url}"
35
+ end
36
+
37
+ def published_in_future?
38
+ self.published && self.published_at > DateTime.now
37
39
  end
38
40
 
39
41
  def self.page p
40
42
  per_page = Monologue.posts_per_page || 10
41
43
  set_total_pages(per_page)
42
44
  p = (p.nil? ? 0 : p.to_i - 1)
43
- offset = (p==0 ? 0 : p * per_page)
45
+ offset = p * per_page
44
46
  self.limit(per_page).offset(offset)
45
47
  end
46
48
 
@@ -51,4 +53,17 @@ class Monologue::Post < ActiveRecord::Base
51
53
  def self.set_total_pages per_page
52
54
  @number_of_pages = self.count / per_page + (self.count % per_page == 0 ? 0 : 1)
53
55
  end
56
+
57
+ private
58
+
59
+ def generate_url
60
+ return unless self.url.blank?
61
+ year = self.published_at.class == ActiveSupport::TimeWithZone ? self.published_at.year : DateTime.now.year
62
+ self.url = "#{year}/#{self.title.parameterize}"
63
+ end
64
+
65
+ def url_do_not_start_with_slash
66
+ errors.add(:url, I18n.t("activerecord.errors.models.monologue/post.attributes.url.start_with_slash")) if self.url.start_with?("/")
67
+ end
68
+
54
69
  end
@@ -1,9 +1,9 @@
1
1
  class Monologue::Tag < ActiveRecord::Base
2
2
  attr_accessible :name
3
3
 
4
- validates :name, :uniqueness => true,:presence => true
4
+ validates :name, uniqueness: true,presence: true
5
5
  has_many :taggings
6
- has_many :posts,:through=> :taggings
6
+ has_many :posts,through: :taggings
7
7
 
8
8
  def posts_with_tag
9
9
  self.posts.published
@@ -12,5 +12,4 @@ class Monologue::Tag < ActiveRecord::Base
12
12
  def frequency
13
13
  posts_with_tag.size
14
14
  end
15
-
16
- end
15
+ end
@@ -1,4 +1,6 @@
1
1
  class Monologue::Tagging < ActiveRecord::Base
2
2
  belongs_to :post
3
3
  belongs_to :tag
4
+
5
+ attr_accessible :tag_id
4
6
  end
@@ -1,7 +1,18 @@
1
1
  class Monologue::User < ActiveRecord::Base
2
2
  has_many :posts
3
+
3
4
  attr_accessible :name, :email, :password, :password_confirmation
5
+
4
6
  has_secure_password
5
- validates_presence_of :password, :on => :create
6
- validates_presence_of :name, :email
7
+
8
+ validates_presence_of :password, on: :create
9
+ validates_presence_of :name
10
+ validates :email , presence: true, uniqueness: true
11
+
12
+
13
+ def can_delete?(user)
14
+ return false if self==user
15
+ return false if user.posts.any?
16
+ true
17
+ end
7
18
  end
@@ -15,11 +15,8 @@ class Monologue::PostsSweeper < ActionController::Caching::Sweeper
15
15
  page_cache_directory = Rails.public_path if page_cache_directory.nil? # TODO: we should not need this either...
16
16
 
17
17
  # post
18
- if post.posts_revisions.count > 0
19
- current_post_path = "#{page_cache_directory}#{root_path}#{post.just_the_revision_one_before.url}.html" unless post.just_the_revision_one_before.nil?
20
- current_post_path = "#{page_cache_directory}#{root_path}#{post.posts_revisions.last.url}.html" if post.posts_revisions.count == 1
21
- File.delete current_post_path if File.exists? current_post_path
22
- end
18
+ current_post_path = "#{page_cache_directory}#{root_path}#{post.url}.html"
19
+ File.delete current_post_path if File.exists? current_post_path
23
20
 
24
21
  # tags
25
22
  tags_path = "#{page_cache_directory}#{root_path}tags"
@@ -7,12 +7,12 @@
7
7
  <%= csrf_meta_tags %>
8
8
  </head>
9
9
  <body>
10
- <% if current_user %>
10
+ <% if monologue_current_user %>
11
11
  <%= render "layouts/monologue/admin/nav_bar" %>
12
12
  <% end %>
13
13
  <div class="container">
14
14
  <% flash.each do |name, msg| %>
15
- <%= content_tag :div, msg, :id => "flash_#{name}", :class => (name == :notice ? "alert alert-info" : "alert alert-error") %>
15
+ <%= content_tag :div, msg, id: "flash_#{name}", class: (name == :notice ? "alert alert-info" : "alert alert-error") %>
16
16
  <% end %>
17
17
 
18
18
  <%= yield %>