cackle 0.0.3 → 0.0.4

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: c203cde289fd456717fc18b216f13b58c00bec2b
4
- data.tar.gz: e9981d7f891a64e081047896111e7948aa37315c
3
+ metadata.gz: 844460572c907e5a7458a7adc04514299fdc0f01
4
+ data.tar.gz: 54dc75cd452cece5f05aea8533aea73b96318deb
5
5
  SHA512:
6
- metadata.gz: c6f6567432e1aba96aa01985679660e378528cf33e2d4700b883ee5099a19b5e7680e0d1e26e465bbd50047779b7f2618e7860f5fd0cc901b6248ef35cd5b246
7
- data.tar.gz: 1e22c05051f38bbdaff1066f3938e87d32aa64b7dae097f8c5bbd7ed709ece104185f1e1d471350c11a370d925ac288c9339bf58b70f67db8cde0de90ab41e95
6
+ metadata.gz: 16b8e123afdef37d21a3071be47d1a057c93c6e67833e489eaf37131551ceb011437a7802dd72fedf3d870bb77663effe206b55eb496d1508b791b0525280d99
7
+ data.tar.gz: b5ff68f9e5ea51e398090845f5c1269b4b61c57ecc53f273636b90c9b773ecf69517d26e456c999869f8aef052473ae0828e74f807c9397f414191087d68e570
data/README.md CHANGED
@@ -35,12 +35,6 @@ See http://cackle.me/help/comment-sync to find your keys
35
35
  site_id: 12345 # Site ID
36
36
  site_api_key: blah-blah-blah # Account API Key
37
37
  account_api_key: blah-blah-blah # Site API Key
38
-
39
- recent: # configuretion for recent comments block
40
- mcSize: 10 # how many comments to display
41
- mcAvatarSize: 32 # size of avatar image in pixels
42
- mcTextSize: 150 # length of message block if more shorten with '...'
43
- mcTitleSize: 40 # title length
44
38
  ```
45
39
 
46
40
  Helper methods
@@ -52,7 +46,11 @@ cackle_comments
52
46
  ```
53
47
  Recent comments widget
54
48
  ```ruby
55
- cackle_recent_comments
49
+ cackle_recent_comments
50
+ ```
51
+ You can easily specify ammount of comments to show and other params. For example:
52
+ ```ruby
53
+ cackle_recent_comments 10, avatar_size: 32, text_size: 150, title_size: 40
56
54
  ```
57
55
 
58
56
  Rake tasks
@@ -1,18 +1,15 @@
1
1
  module CackleHelper
2
2
  def cackle_comments
3
- load_config
3
+ @config ||= YAML::load(File.open('config/cackle.yml'))
4
4
  @comments = CackleComment.approved.where("url LIKE ?", "%#{request.path}")
5
5
  render template: 'cackle/comments'
6
6
  end
7
7
 
8
- def cackle_recent_comments
9
- load_config
10
- @comments = CackleComment.approved.limit(@config['recent']['mcSize'])
11
- render template: 'cackle/recent'
12
- end
13
-
14
- private
15
- def load_config
16
- @config ||= YAML::load(File.open('config/cackle.yml'))
8
+ def cackle_recent_comments count=10, options={}
9
+ options[:avatar_size] ||= 32
10
+ options[:text_size] ||= 150
11
+ options[:title_size] ||= 40
12
+ @comments = CackleComment.approved.limit(count)
13
+ render template: 'cackle/recent', locals: { options: options }
17
14
  end
18
15
  end
@@ -1,5 +1,5 @@
1
1
  class CackleComment < ActiveRecord::Base
2
2
  self.primary_key = 'comment_id'
3
- default_scope order: 'created_at DESC'
3
+ default_scope { order('created_at DESC') }
4
4
  scope :approved, -> { where(status: 'approved') }
5
5
  end
@@ -16,8 +16,8 @@
16
16
  #mc-link{color:#555!important;font-size:11px!important;clear:both!important;float:right;text-decoration:none!important}
17
17
  #mc-link:hover{color:#333!important}
18
18
  .mc-recent-thumb img{
19
- width: #{@config['recent']['mcAvatarSize']}px;
20
- height: #{@config['recent']['mcAvatarSize']}px;
19
+ width: #{options[:avatar_size]}px;
20
+ height: #{options[:avatar_size]}px;
21
21
  }
22
22
  #mc-last
23
23
  .mc-last-content
@@ -37,9 +37,9 @@
37
37
  %span.mc-recent-author= comment.author_name
38
38
  - else
39
39
  %span.mc-recent-author= comment.anonym_name
40
- %p.mc-recent-text= link_to comment.message.truncate(@config['recent']['mcTextSize']), comment.url + "#mc-#{comment.id}"
40
+ %p.mc-recent-text= link_to comment.message.truncate(options[:text_size]), comment.url + "#mc-#{comment.id}"
41
41
  %p.mc-recent-meta
42
- = link_to comment.title.truncate(@config['recent']['mcTitleSize']), comment.url, title: comment.title
42
+ = link_to comment.title.truncate(options[:title_size]), comment.url, title: comment.title
43
43
  - unless 1.month.ago > (date = comment.created_at)
44
44
  · #{time_ago_in_words date} назад
45
45
  - else
@@ -1,3 +1,3 @@
1
1
  module Cackle
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cackle
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Artyom Nikolaev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-20 00:00:00.000000000 Z
11
+ date: 2014-01-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: 4.0.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: haml
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: sqlite3
29
43
  requirement: !ruby/object:Gem::Requirement