blog-gem 0.1.12 → 0.1.13

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c13dbbbacc33de8b40e4870ce5d6ee8267829da2
4
- data.tar.gz: 6730d87d9fc54c987927ad1eaca05632f8a5783c
3
+ metadata.gz: 38449679ae0d6501c190aefdb57c78969b70a1f3
4
+ data.tar.gz: a8c86cafae81561a4fa007b1e0574277bdc6544c
5
5
  SHA512:
6
- metadata.gz: 763f3620feb60d3b0c84d28a0ac02f2d7e73dfa3d5c20103caa4a2d1f3e476ec438312dbfa610100892ca88058a4c5d3beca5e3fc9548b290d277c248d0a758a
7
- data.tar.gz: 64691e16e1a3ebfe1c054b2376dfd0eba31379356406521ebf6e7e61d1934ea39de8e854e22fa9d61cfdc1276af741a9a9fd62d075df6e3dae4283ecf1ac026b
6
+ metadata.gz: 94fdfefc523cd8296febc9dc7aa3266f4d6ce1a72cb2560f0ebcf2cce86e3b3dc9e982e70b0d71d12ccbc0a485329adca1676eaeab89ed58fcb3a6690ef47e88
7
+ data.tar.gz: e303cb09ca8ccee6276197cac05ae4b3f16d025629daf97712179dd01f3b23a9aac13cef3434d4abec444d4bd376cd3d68843e9c6db62bc959f6c56605afd846
@@ -51,26 +51,9 @@
51
51
  font-size: 16px
52
52
  margin-top: 0
53
53
  h5
54
- margin-top: 10px
55
- .date
56
- margin-top: 5px
57
- padding: 10px 8px
58
- background: $brand-primary
59
- >span
60
- display: block
61
- text-align: center
62
- font-family: sans-serif
63
- color: #fff
64
- &.month
65
- font-size: 13px
66
- line-height: 13px
67
- font-weight: 700
68
- text-transform: uppercase
69
- &.day
70
- margin-top: 5px
71
- font-size: 18px
72
- line-height: 18px
73
- font-weight: 700
54
+ font-size: 16px
55
+ margin-top: 2px
56
+ margin-bottom: 10px
74
57
  .btn-lg-group
75
58
  .btn.btn-large
76
59
  height: 50px
@@ -36,7 +36,7 @@ class Blog::Gem::BlogController < Blog::Gem::ApplicationController
36
36
  end
37
37
  format.json do
38
38
  @posts = posts.published.limit(params[:limit]||Blog::Gem.per_page).offset(params[:offset]||0)
39
- render json: @posts.map{|x| {id: x.id, title: x.title, teaser: x.teaser, url: x.url, tags: x.tags, category: x.category, author: x.author_name, thumbnail: x.image_url, published_at: x.published_at}}
39
+ render json: @posts.map{|x| {id: x.id, title: x.title, teaser: x.teaser, url: x.to_url, tags: x.tags, category: x.category, author: x.author_name, thumbnail: x.image_url, published_at: x.published_at, square: x.image_url(:square)}}
40
40
  end
41
41
  format.html do
42
42
  @current_path = blogs_path
@@ -62,7 +62,7 @@ class Blog::Gem::BlogController < Blog::Gem::ApplicationController
62
62
  def api
63
63
  @post = Blog::Gem::Post.find_by_id(params[:id])
64
64
  if @post.present? && @post.published_at <= Time.now
65
- render json: {status: 200, id: @post.id, title: @post.title, teaser: @post.teaser, url: @post.url, tags: @post.tags, category: @post.category, author: @post.author_name, thumbnail: @post.image_url, body: @post.body, published_at: @post.published_at}
65
+ render json: {status: 200, id: @post.id, title: @post.title, teaser: @post.teaser, url: @post.to_url, tags: @post.tags, category: @post.category, author: @post.author_name, thumbnail: @post.image_url, square: @post.image_url(:square), body: @post.body, published_at: @post.published_at}
66
66
  else
67
67
  render json: {status: 404}
68
68
  end
@@ -5,7 +5,7 @@ class Blog::Gem::Post < Blog::Gem::ApplicationRecord
5
5
 
6
6
  acts_as_taggable
7
7
 
8
- has_attached_file :thumbnail, styles: { medium: "750x300#"}, path: ":rails_root/public#{Blog::Gem.image_path}/posts/:id/:style.:extension", url: "#{Blog::Gem.image_path}/posts/:id/:style.:extension"
8
+ has_attached_file :thumbnail, styles: { medium: "750x300#", square: "80x80#"}, path: ":rails_root/public#{Blog::Gem.image_path}/posts/:id/:style.:extension", url: "#{Blog::Gem.image_path}/posts/:id/:style.:extension"
9
9
  validates_attachment_content_type :thumbnail, content_type: /\Aimage\/.*\Z/
10
10
 
11
11
  acts_as_url :title
@@ -25,8 +25,8 @@ class Blog::Gem::Post < Blog::Gem::ApplicationRecord
25
25
  end
26
26
  end
27
27
 
28
- def image_url
29
- "#{Blog::Gem.url}#{thumbnail.url(:medium)}"
28
+ def image_url(type=:medium)
29
+ "#{Blog::Gem.url}#{thumbnail.url(type)}"
30
30
  end
31
31
 
32
32
  def to_path
@@ -11,13 +11,15 @@ aside.col-sm-4.well
11
11
  - @all_posts.first(Blog::Gem.widget_posts_count).each do |post|
12
12
  .widget-blog-item.media
13
13
  .pull-left
14
- = link_to post.to_path, title: l(post.published_at)
15
- .date
16
- span.month = l(post.published_at, format: :month)
17
- span.day = post.published_at.day
14
+ = link_to post.to_path
15
+ = image_tag(post.thumbnail.url(:square), class: "img-responsive img-thumbnail")
18
16
  .media-body
19
17
  = link_to post.to_path
20
18
  h5 = post.title
19
+ p
20
+ = raw "#{icon('calendar')} #{l(post.published_at)}"
21
+ br
22
+ = raw "#{icon('folder')} #{t("blog.category_label")}: #{link_to post.category[:name].html_safe, post.category[:link]}"
21
23
  - if @all_posts.count > Blog::Gem.widget_posts_count
22
24
  .pull-right
23
25
  = link_to t("blog.all_posts"), blogs_path
@@ -1,5 +1,5 @@
1
1
  module Blog
2
2
  module Gem
3
- VERSION = '0.1.12'
3
+ VERSION = '0.1.13'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blog-gem
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.12
4
+ version: 0.1.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vincent Thelang
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-10-26 00:00:00.000000000 Z
12
+ date: 2017-11-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails