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 +4 -4
- data/app/controllers/blogo/admin/base_controller.rb +1 -1
- data/app/controllers/blogo/admin/comments_controller.rb +0 -2
- data/app/controllers/blogo/admin/images_controller.rb +4 -4
- data/app/controllers/blogo/admin/posts_controller.rb +0 -1
- data/app/controllers/blogo/admin/sessions_controller.rb +1 -1
- data/app/controllers/blogo/posts_controller.rb +1 -1
- data/app/form_builders/blogo/form_builder.rb +0 -1
- data/app/helpers/blogo/admin/base_helper.rb +0 -2
- data/app/models/blogo/post.rb +7 -6
- data/app/services/blogo/preview_post_service.rb +0 -1
- data/app/views/blogo/posts/_disqus_comments.html.erb +1 -1
- data/lib/blogo/paginator.rb +0 -2
- data/lib/blogo/renderer.rb +0 -2
- data/lib/blogo/renderer/base.rb +0 -2
- data/lib/blogo/renderer/html.rb +0 -2
- data/lib/blogo/routes.rb +0 -4
- data/lib/blogo/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5715aba80dd6960ffb8ed60b8da01320dcb2b205
|
4
|
+
data.tar.gz: 1c63d06d2610cd758d692183bc66592bf6b96370
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4c71765f8a7c5d1445dd927f140472a02e2c639b32ea43d9fa3876e759074c73caa612126b69ff2c2e44ae3330177053c7adcef46057d8988cb47e496aebdbb5
|
7
|
+
data.tar.gz: 4cb3c36b78691c1000c9964fec7673555912da61e90fe73ddf854619626acf0e5a1d4da090b7ea39c4d21ff88a94b8317d96f0ce796c7696b039fa82a8495616
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Blogo::Admin
|
2
2
|
# Handles image upload with CKeditor.
|
3
3
|
class ImagesController < BaseController
|
4
|
-
|
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.
|
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.
|
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
|
data/app/models/blogo/post.rb
CHANGED
@@ -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.
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
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.
|
@@ -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 = '
|
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>
|
data/lib/blogo/paginator.rb
CHANGED
data/lib/blogo/renderer.rb
CHANGED
@@ -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
|
data/lib/blogo/renderer/base.rb
CHANGED
data/lib/blogo/renderer/html.rb
CHANGED
data/lib/blogo/routes.rb
CHANGED
@@ -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
|
data/lib/blogo/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2015-11-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|