notee 1.0.5 → 1.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/notee/category.rb +1 -0
- data/lib/notee/helpers/notee_helper.rb +18 -4
- data/lib/notee/version.rb +1 -1
- data/lib/tasks/views/notee/archives.html.erb +3 -4
- data/lib/tasks/views/notee/categories.html.erb +2 -2
- data/lib/tasks/views/notee/partials/_sidebar.html.erb +5 -6
- 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: 70f31773687978bde09f4cad39620863730a3b75
|
4
|
+
data.tar.gz: 5a7a6e5313fba0e4c4fced6ee78c7f8e54a095aa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 88b1b57a8136b57f514d7f6e5c2b2562e5bbf78bc762459af177df22f535a42f333e2ddaf4a01996150dc855dcec5bef3ce915469dc2dc349a1f67d8cc56c8f4
|
7
|
+
data.tar.gz: 2506dcd50f49351cec98c5b3901bf2490e59b699b593ce9ec1e44c22eb8050853616358890ca054b11c10d9b456c1a27dc41a83e550029633ed78aea91016a45
|
@@ -61,14 +61,28 @@ module Notee
|
|
61
61
|
|
62
62
|
|
63
63
|
def notee_categories
|
64
|
-
|
65
|
-
|
64
|
+
categories = Notee::Category.where(is_deleted: false)
|
65
|
+
published_categories = categories.select { |category| category if category.posts.count > 0 }.map { |category| category }
|
66
|
+
|
67
|
+
published_categories
|
66
68
|
end
|
67
69
|
|
68
70
|
|
69
71
|
def notee_archives
|
70
|
-
|
71
|
-
|
72
|
+
posts = Notee::Post.select(:published_at).where(status: 1, is_deleted: false).order(created_at: :desc)
|
73
|
+
|
74
|
+
notee_archives = {}
|
75
|
+
posts.each do |post|
|
76
|
+
month_str = post.published_at.strftime("%Y/%m")
|
77
|
+
if notee_archives.has_key?(month_str)
|
78
|
+
notee_archives[month_str] = notee_archives[month_str] + 1
|
79
|
+
else
|
80
|
+
notee_archives.store(month_str, 1)
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
notee_archives
|
85
|
+
# Notee::Post.find_by_sql("SELECT DATE_FORMAT(published_at, '%Y-%m') as time, count(*) as count FROM notee_posts WHERE status=1 and is_deleted=false GROUP BY DATE_FORMAT(published_at, '%Y-%m') ORDER BY time DESC;")
|
72
86
|
end
|
73
87
|
|
74
88
|
|
data/lib/notee/version.rb
CHANGED
@@ -2,11 +2,10 @@
|
|
2
2
|
<div class="notee_wrapper">
|
3
3
|
<div class="notee_main">
|
4
4
|
<h2>Archive List</h2>
|
5
|
-
<% @archives.each do |
|
6
|
-
<% slash_time = archive.time.gsub("-","/") %>
|
5
|
+
<% @archives.each do |key, count| %>
|
7
6
|
<div class="notee_list">
|
8
|
-
<a href="/archives/<%=
|
9
|
-
<h3><%=
|
7
|
+
<a href="/archives/<%= key %>">
|
8
|
+
<h3><%= key %> (<%= count %>)</h3>
|
10
9
|
</a>
|
11
10
|
</div>
|
12
11
|
<% end %>
|
@@ -4,8 +4,8 @@
|
|
4
4
|
<h2>Category List</h2>
|
5
5
|
<% @categories.each do |category| %>
|
6
6
|
<div class="notee_list">
|
7
|
-
<a href="/categories/<%= category.
|
8
|
-
<h3><%= category.
|
7
|
+
<a href="/categories/<%= category.name %>">
|
8
|
+
<h3><%= category.name %> (<%= category.posts.count %>)</h3>
|
9
9
|
</a>
|
10
10
|
</div>
|
11
11
|
<% end %>
|
@@ -3,19 +3,18 @@
|
|
3
3
|
<div class="notee_sidebar_content">
|
4
4
|
<ul class="notee_sidebar_ul">
|
5
5
|
<% notee_categories.each do |category| %>
|
6
|
-
<a href="/categories/<%= category.
|
7
|
-
<li><%= category.
|
6
|
+
<a href="/categories/<%= category.name %>">
|
7
|
+
<li><%= category.name %> (<%= category.posts.count %>)</li>
|
8
8
|
</a>
|
9
9
|
<% end %>
|
10
10
|
</ul>
|
11
11
|
</div>
|
12
12
|
<h3>Archive</h3>
|
13
13
|
<div class="notee_sidebar_content">
|
14
|
-
<% notee_archives.each do |
|
15
|
-
<% slash_time = archive.time.gsub("-","/") %>
|
14
|
+
<% notee_archives.each do |key, count| %>
|
16
15
|
<ul class="notee_sidebar_ul">
|
17
|
-
<a href="/archives/<%=
|
18
|
-
<li><%=
|
16
|
+
<a href="/archives/<%= key %>">
|
17
|
+
<li><%= key %> (<%= count %>)</li>
|
19
18
|
</a>
|
20
19
|
</ul>
|
21
20
|
<% end %>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: notee
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- funaota
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-12-
|
11
|
+
date: 2016-12-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|