notifications 0.0.3 → 0.0.4

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: 360b52b19fc6b46692cfbeea0bd424b9223ee49c
4
- data.tar.gz: 134df5d86d843cab2ace62ae0d444112ba9d6015
3
+ metadata.gz: cffadc0f064a8af337efc15ff1785d0f899b1db8
4
+ data.tar.gz: 560ab10dcbaf32cb0a592c38bcf319407532eaed
5
5
  SHA512:
6
- metadata.gz: b1ccdd276d0dc2c5110feabd589b046e4edd65e15a4c289f331db65a15a2f0bd2fd7338bd5aa8e3717dceb2d8d1b49bf9888f105de7791a8a46278c19cf9cb40
7
- data.tar.gz: 3f26d6cafec750b63e40cf299c49e9ee72d4f7c7ab706af2268beff2d640d7a7f88c900a5ab990ceffa803f9b970fa344cefeeec44e268acf61441553008a478
6
+ metadata.gz: 93f88e81fa12af6f7a80009f85a93fb0deb738934a39da3fd6acf7703147f964bfba88e19134c35acf1a411ac829d30956f1cfc0d3ae2845497e47b0f82594e8
7
+ data.tar.gz: 829ee50a228eae89a67554574a365786c8a87dc55ff9c92dc9b92afd7c16493eafc6d3db5bd4ece7f590a3bb298bcb71f44d167e50898f93244504060a7a7786
data/README.md CHANGED
@@ -4,6 +4,10 @@ Rails mountable Notification for any applications.
4
4
 
5
5
  [![Gem Version](https://badge.fury.io/rb/notifications.svg)](https://badge.fury.io/rb/notifications) [![Build Status](https://travis-ci.org/rails-engine/notifications.svg)](https://travis-ci.org/rails-engine/notifications) [![Code Climate](https://codeclimate.com/github/rails-engine/notifications/badges/gpa.svg)](https://codeclimate.com/github/rails-engine/notifications) [![codecov.io](https://codecov.io/github/rails-engine/notifications/coverage.svg?branch=master)](https://codecov.io/github/rails-engine/notifications?branch=master) [![](http://inch-ci.org/github/rails-engine/notifications.svg?branch=master)](http://inch-ci.org/github/rails-engine/notifications?branch=master)
6
6
 
7
+ ## Example:
8
+
9
+ <img width="650" alt="2016-03-29 10 48 16" src="https://cloud.githubusercontent.com/assets/5518/14096499/d7555aaa-f59b-11e5-87f0-e4728db903c8.png">
10
+
7
11
  ## Installation
8
12
 
9
13
  ```ruby
@@ -37,7 +37,7 @@
37
37
  }
38
38
 
39
39
  .user-avatar {
40
- img { width: 24px; height: 24px; border-radius: 120px; }
40
+ img { width: 32px; height: 32px; border-radius: 120px; }
41
41
  }
42
42
 
43
43
  .media-right {
@@ -1,7 +1,7 @@
1
1
  module Notifications
2
2
  class NotificationsController < Notifications::ApplicationController
3
3
  def index
4
- @notifications = current_user.notifications.includes(:actor).order('id desc')
4
+ @notifications = current_user.notifications.includes(:actor).order('id desc').page(params[:page])
5
5
 
6
6
  unread_ids = []
7
7
  @notifications.each do |n|
@@ -2,5 +2,7 @@
2
2
  class Notification < ActiveRecord::Base
3
3
  include Notifications::Model
4
4
 
5
+ self.per_page = 20
6
+
5
7
  # Write your custom methods...
6
8
  end
@@ -1,6 +1,7 @@
1
+ <%= cache(['notifications', Notifications::VERSION, notification]) do %>
1
2
  <div id="notification-<%= notification.id %>"
2
3
  data-id="<%= notification.id %>"
3
- class="media notification<%= ' unread' if !notification.read? %>">
4
+ class="media notification notification-<%= notification.notify_type %><%= ' unread' if !notification.read? %>">
4
5
  <div class="media-left">
5
6
  <%= link_to image_tag(notification.actor_avatar_url), notification.actor_profile_url, title: notification.actor_name, class: 'user-avatar' %>
6
7
  </div>
@@ -11,3 +12,4 @@
11
12
  <%= l notification.created_at, format: :short %>
12
13
  </div>
13
14
  </div>
15
+ <% end %>
@@ -3,10 +3,11 @@
3
3
  <%= t('notifications.all_notifications') %>
4
4
 
5
5
  <span class="pull-xs-right">
6
- <%= link_to t('notifications.clean_all'), notifications.clean_notifications_path, class: 'btn btn-danger', method: 'delete' %>
6
+ <%= link_to t('notifications.clean_all'), notifications.clean_notifications_path, class: 'btn btn-sm btn-secondary', method: 'delete' %>
7
7
  </span>
8
8
  </div>
9
9
  <div class="list">
10
10
  <%= render @notifications %>
11
11
  </div>
12
+ <%= will_paginate @notifications %>
12
13
  </div>
@@ -2,6 +2,8 @@ require "notifications/model"
2
2
  require "notifications/engine"
3
3
  require "notifications/configuration"
4
4
  require "notifications/version"
5
+ require 'will_paginate'
6
+ require 'will_paginate/active_record'
5
7
 
6
8
  module Notifications
7
9
  class << self
@@ -1,3 +1,3 @@
1
1
  module Notifications
2
- VERSION = '0.0.3'
2
+ VERSION = '0.0.4'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: notifications
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
  - Jason Lee
@@ -30,6 +30,20 @@ dependencies:
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
32
  version: '5.1'
33
+ - !ruby/object:Gem::Dependency
34
+ name: will_paginate
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: 3.0.0
40
+ type: :runtime
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: 3.0.0
33
47
  description: Rails mountable Notification for any applications.
34
48
  email:
35
49
  - huacnlee@gmail.com