blogo 0.1.1 → 0.1.2

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: 744dfe7328c7b218faa550e9c49df63ab66f3157
4
- data.tar.gz: 0a53df6b9c7d0800a0f2f2f0921e96a2f1cb8112
3
+ metadata.gz: 5715aba80dd6960ffb8ed60b8da01320dcb2b205
4
+ data.tar.gz: 1c63d06d2610cd758d692183bc66592bf6b96370
5
5
  SHA512:
6
- metadata.gz: b2402e35d4a46e1d6b1f8280f02a7891e38fab9076f051a4d9bcbd25f2f09c3512b7130bcc4f9cea00b9e7ece60387a6f283de2689039ad767c527ca4df1491f
7
- data.tar.gz: c9b414568db8c670f283efbe191cc71a26bd845382a511b99fa53b4f3b62e5de9495bd3219ed8e11e8ddbb1dd6b0dd5c7969c864040de343e0a9a4e4c779aa2d
6
+ metadata.gz: 4c71765f8a7c5d1445dd927f140472a02e2c639b32ea43d9fa3876e759074c73caa612126b69ff2c2e44ae3330177053c7adcef46057d8988cb47e496aebdbb5
7
+ data.tar.gz: 4cb3c36b78691c1000c9964fec7673555912da61e90fe73ddf854619626acf0e5a1d4da090b7ea39c4d21ff88a94b8317d96f0ce796c7696b039fa82a8495616
@@ -1,6 +1,6 @@
1
1
  module Blogo::Admin
2
2
  class BaseController < Blogo::ApplicationController
3
- before_filter :ensure_authenticated!
3
+ before_action :ensure_authenticated!
4
4
 
5
5
  layout 'blogo/admin'
6
6
 
@@ -1,11 +1,9 @@
1
1
  module Blogo::Admin
2
2
  # Does nothing, simply displays Disqus comments, that loaded with JS.
3
3
  class CommentsController < BaseController
4
-
5
4
  # GET /admin/comments
6
5
  #
7
6
  def index
8
7
  end
9
-
10
8
  end
11
9
  end
@@ -1,7 +1,7 @@
1
1
  module Blogo::Admin
2
2
  # Handles image upload with CKeditor.
3
3
  class ImagesController < BaseController
4
- skip_before_filter :verify_authenticity_token
4
+ skip_before_action :verify_authenticity_token
5
5
 
6
6
  layout false
7
7
 
@@ -17,11 +17,11 @@ module Blogo::Admin
17
17
  image_name = upload_io.original_filename
18
18
  file_path = Rails.root.join('public', image_directory, image_name)
19
19
 
20
- if File.exists?(file_path)
20
+ if File.exist?(file_path)
21
21
  @error = I18n.translate('blogo.admin.image_already_exists', image_name: image_name)
22
22
  else
23
23
  dir = File.dirname(file_path)
24
- FileUtils.mkdir_p(dir) unless File.exists?(dir)
24
+ FileUtils.mkdir_p(dir) unless File.exist?(dir)
25
25
  File.binwrite(file_path, upload_io.read)
26
26
  end
27
27
 
@@ -36,7 +36,7 @@ module Blogo::Admin
36
36
  # @return [String]
37
37
  def image_directory
38
38
  @image_directory ||= begin
39
- date_dir = Time.now.strftime('%Y/%m')
39
+ date_dir = Time.zone.now.strftime('%Y/%m')
40
40
  File.join(IMAGE_DIRECTORY, date_dir)
41
41
  end
42
42
  end
@@ -1,7 +1,6 @@
1
1
  module Blogo::Admin
2
2
  # Responsible for posts management: creation, editing, deletion, preview.
3
3
  class PostsController < BaseController
4
-
5
4
  # GET /admin/posts
6
5
  #
7
6
  def index
@@ -4,7 +4,7 @@ module Blogo::Admin
4
4
  # User is logged in if it has set sessions[:blogo_user_id].
5
5
  #
6
6
  class SessionsController < BaseController
7
- skip_before_filter :ensure_authenticated!
7
+ skip_before_action :ensure_authenticated!
8
8
 
9
9
  # GET /admin/login
10
10
  #
@@ -1,6 +1,6 @@
1
1
  module Blogo
2
2
  # Responsible for showing posts and atom feeds to visitors.
3
- class PostsController < ApplicationController
3
+ class PostsController < Blogo::ApplicationController
4
4
  layout 'blogo/blog'
5
5
 
6
6
  # Number of posts shown in feed.
@@ -13,5 +13,4 @@ class Blogo::FormBuilder < ActionView::Helpers::FormBuilder
13
13
  end
14
14
  end
15
15
  end
16
-
17
16
  end
@@ -1,10 +1,8 @@
1
1
  module Blogo::Admin
2
2
  module BaseHelper
3
-
4
3
  def blogo_form_for(object, options = {}, &block)
5
4
  options[:builder] = Blogo::FormBuilder
6
5
  form_for(object, options, &block)
7
6
  end
8
-
9
7
  end
10
8
  end
@@ -8,7 +8,7 @@ class Blogo::Post < ActiveRecord::Base
8
8
  validates :permalink, :title, :raw_content, presence: true
9
9
  validates :permalink, uniqueness: true
10
10
 
11
- scope :published, -> { where(published: true).where("published_at <= ?", Time.now) }
11
+ scope :published, -> { where(published: true).where("published_at <= ?", Time.zone.now) }
12
12
 
13
13
  default_scope { order('published_at DESC') }
14
14
 
@@ -45,11 +45,12 @@ class Blogo::Post < ActiveRecord::Base
45
45
  html = html_overview || html_content
46
46
 
47
47
  self.meta_description =
48
- html.gsub(/<\/?[^>]*>/, ' '). # replace HTML tags with spaces
49
- gsub(/&\w{1,9};|"/, ''). # remove HTML special chars and double quotes
50
- gsub(/\n+/, " "). # remove new lines
51
- gsub(/\s+/, ' '). # remove duplicated spaces
52
- strip[0..200] # strip spaces and get first 200 chars
48
+ html.
49
+ gsub(/<\/?[^>]*>/, ' '). # replace HTML tags with spaces
50
+ gsub(/&\w{1,9};|"/, ''). # remove HTML special chars and double quotes
51
+ gsub(/\n+/, " "). # remove new lines
52
+ gsub(/\s+/, ' '). # remove duplicated spaces
53
+ strip[0..200] # strip spaces and get first 200 chars
53
54
  end
54
55
 
55
56
  # Find first img tag and in content and grab its source.
@@ -1,7 +1,6 @@
1
1
  module Blogo
2
2
  # Creates new model of posts applying post params on it so it can be previewed.
3
3
  class PreviewPostService < BasePostService
4
-
5
4
  # @param user [Blogo::User]
6
5
  # @param params [Hash]
7
6
  def initialize(user, params)
@@ -15,7 +15,7 @@
15
15
 
16
16
  (function () {
17
17
  var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
18
- dsq.src = 'http://' + disqus_shortname + '.disqus.com/' + disqus_script;
18
+ dsq.src = document.location.protocol + '//' + disqus_shortname + '.disqus.com/' + disqus_script;
19
19
  (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
20
20
  }());
21
21
  </script>
@@ -86,8 +86,6 @@ module Blogo
86
86
  def next_page
87
87
  if pages.any? && pages_count > pages.last
88
88
  pages.last + 1
89
- else
90
- nil
91
89
  end
92
90
  end
93
91
 
@@ -4,7 +4,6 @@ require 'blogo/renderer/markdown'
4
4
 
5
5
  module Blogo
6
6
  module Renderer
7
-
8
7
  # Maps format names to renderers.
9
8
  RENDERERS = {
10
9
  :markdown => Blogo::Renderer::Markdown,
@@ -24,6 +23,5 @@ module Blogo
24
23
  raise(Blogo::Error, "Can't find renderer #{format.inspect}")
25
24
  end
26
25
  end
27
-
28
26
  end
29
27
  end
@@ -1,6 +1,5 @@
1
1
  module Blogo::Renderer
2
2
  class Base
3
-
4
3
  class << self
5
4
  # @!attribute [rw] dependencies
6
5
  # @return [Array<Hash>]
@@ -43,6 +42,5 @@ module Blogo::Renderer
43
42
  def render(raw_text)
44
43
  raise AbstractMethodCallError, __method__
45
44
  end
46
-
47
45
  end
48
46
  end
@@ -1,10 +1,8 @@
1
1
  module Blogo::Renderer
2
2
  class Html < Base
3
-
4
3
  # :nodoc:
5
4
  def render(raw_text)
6
5
  raw_text.dup
7
6
  end
8
-
9
7
  end
10
8
  end
@@ -5,7 +5,6 @@ module Blogo
5
5
 
6
6
  context.instance_eval do
7
7
  scope(path: blog_scope, module: 'blogo', as: 'blogo') do
8
-
9
8
  namespace :admin do
10
9
  # blogo_admin_path
11
10
  get "/" => "posts#index", as: ""
@@ -28,9 +27,6 @@ module Blogo
28
27
  get '/tag/:tag/page/:page' => 'posts#index', as: 'tag_page'
29
28
  get '/feed' => 'posts#feed' , as: 'feed', defaults: { format: 'atom' }
30
29
  get ":permalink" => "posts#show" , as: "post"
31
-
32
-
33
-
34
30
  end
35
31
  end
36
32
  end
@@ -1,3 +1,3 @@
1
1
  module Blogo
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blogo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergey Potapov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-29 00:00:00.000000000 Z
11
+ date: 2015-11-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails