notee 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/notee/application.js +206 -90
- data/app/models/notee/category.rb +1 -1
- data/lib/notee/helper.rb +21 -19
- data/lib/notee/version.rb +1 -1
- data/lib/notee/view_helper.rb +1 -1
- metadata +1 -1
data/lib/notee/helper.rb
CHANGED
@@ -1,31 +1,33 @@
|
|
1
1
|
module Notee
|
2
2
|
module Helper
|
3
|
-
def
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
3
|
+
def notees(search_txt)
|
4
|
+
if search_txt.nil?
|
5
|
+
# all_notees
|
6
|
+
@notees = Notee::Post.where(status: 1)
|
7
|
+
else
|
8
|
+
# search_by_category_slug
|
9
|
+
category_id = Notee::Category.find_by(slug: search_txt)
|
10
|
+
category_id = Notee::Category.find_by(name: search_txt) unless category_id
|
11
|
+
return false unless category_id
|
10
12
|
|
11
|
-
|
13
|
+
@notees = Notee::Post.where(category_id: category_id, status: 1)
|
14
|
+
end
|
12
15
|
|
13
|
-
|
14
|
-
category_id = Notee::Category.find_by(name: category_slug)
|
15
|
-
return false unless category_id
|
16
|
+
@notees
|
16
17
|
|
17
|
-
@notees = Notee::Post.where(category_id: category_id, status: 1)
|
18
18
|
end
|
19
19
|
|
20
|
-
def
|
21
|
-
|
22
|
-
@notee = Notee::Post.find_by(id: id, status: 1)
|
20
|
+
def secret_notees
|
21
|
+
@notees = Notee::Post.where(status: 2)
|
23
22
|
end
|
24
23
|
|
25
|
-
def get_notee_by_slug(slug)
|
26
|
-
return false unless slug
|
27
|
-
@notee = Notee::Post.find_by(slug: slug, status: 1)
|
28
|
-
end
|
29
24
|
|
25
|
+
def notee(search_txt)
|
26
|
+
return false unless search_txt
|
27
|
+
@notee = Notee::Post.find_by(id: search_txt, status: 1)
|
28
|
+
@notee = Notee::Post.find_by(slug: search_txt, status: 1) unless @notee
|
29
|
+
|
30
|
+
@notee
|
31
|
+
end
|
30
32
|
end
|
31
33
|
end
|
data/lib/notee/version.rb
CHANGED
data/lib/notee/view_helper.rb
CHANGED