notee 0.3.3 → 0.3.4
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 +16081 -15995
- data/app/controllers/notee/categories_controller.rb +7 -2
- data/app/controllers/notee/notees_controller.rb +1 -0
- data/app/controllers/notee/statuses_controller.rb +19 -0
- data/config/routes.rb +1 -0
- data/db/migrate/20160605141510_create_notee_categories.rb +1 -1
- data/lib/notee.rb +1 -0
- data/lib/notee/helper.rb +5 -5
- data/lib/notee/status.rb +11 -0
- data/lib/notee/version.rb +1 -1
- metadata +3 -1
@@ -3,13 +3,18 @@ require_dependency "notee/application_controller"
|
|
3
3
|
|
4
4
|
module Notee
|
5
5
|
class CategoriesController < ApplicationController
|
6
|
-
before_action :set_category, only: [:update, :destroy]
|
6
|
+
before_action :set_category, only: [:show, :update, :destroy]
|
7
7
|
|
8
8
|
def index
|
9
9
|
@categories = Category.all
|
10
10
|
render json: { status: 'success', categories: @categories}
|
11
11
|
end
|
12
12
|
|
13
|
+
def show
|
14
|
+
p @category
|
15
|
+
render json: { status: 'success', category: @category}
|
16
|
+
end
|
17
|
+
|
13
18
|
def create
|
14
19
|
@category = Category.new(category_params)
|
15
20
|
respond_to do |format|
|
@@ -44,7 +49,7 @@ module Notee
|
|
44
49
|
private
|
45
50
|
|
46
51
|
def category_params
|
47
|
-
params.require(:category).permit(:name, :slug, :parent_id, :
|
52
|
+
params.require(:category).permit(:name, :slug, :parent_id, :is_private)
|
48
53
|
end
|
49
54
|
|
50
55
|
def set_category
|
@@ -0,0 +1,19 @@
|
|
1
|
+
|
2
|
+
require_dependency "notee/application_controller"
|
3
|
+
|
4
|
+
module Notee
|
5
|
+
class StatusesController < ApplicationController
|
6
|
+
|
7
|
+
def index
|
8
|
+
@statuses = Notee::STATUS
|
9
|
+
render json: { status: 'success', statuses: @statuses}
|
10
|
+
end
|
11
|
+
|
12
|
+
def show
|
13
|
+
statuses = Notee::STATUS
|
14
|
+
@status = statuses.key(params[:status].to_i)
|
15
|
+
render json: { status: 'success', name: @status}
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
data/config/routes.rb
CHANGED
@@ -13,5 +13,6 @@ Notee::Engine.routes.draw do
|
|
13
13
|
resources :posts, only: [:index, :show, :create, :update, :destroy]
|
14
14
|
resources :images, only: [:index, :show, :create, :destroy]
|
15
15
|
resources :categories, only: [:index, :show, :create, :update, :destroy]
|
16
|
+
resources :statuses, only: [:index, :show]
|
16
17
|
end
|
17
18
|
end
|
@@ -7,7 +7,7 @@ class CreateNoteeCategories < ActiveRecord::Migration
|
|
7
7
|
t.string :name, null: false, default: "category_name"
|
8
8
|
t.string :slug, null: false, uniqueness: true
|
9
9
|
t.integer :parent_id
|
10
|
-
t.
|
10
|
+
t.boolean :is_private, null: false, default: false
|
11
11
|
|
12
12
|
t.timestamps null: false
|
13
13
|
end
|
data/lib/notee.rb
CHANGED
data/lib/notee/helper.rb
CHANGED
@@ -3,14 +3,14 @@ module Notee
|
|
3
3
|
def notees(search_txt)
|
4
4
|
if search_txt.nil?
|
5
5
|
# all_notees
|
6
|
-
@notees = Notee::Post.where(status:
|
6
|
+
@notees = Notee::Post.where(status: Notee::STATUS[:published]).order(published_at: :desc)
|
7
7
|
else
|
8
8
|
# search_by_category_slug
|
9
9
|
category_id = Notee::Category.find_by(slug: search_txt)
|
10
10
|
category_id = Notee::Category.find_by(name: search_txt) unless category_id
|
11
11
|
return false unless category_id
|
12
12
|
|
13
|
-
@notees = Notee::Post.where(category_id: category_id, status:
|
13
|
+
@notees = Notee::Post.where(category_id: category_id, status: Notee::STATUS[:published]).order(published_at: :desc)
|
14
14
|
end
|
15
15
|
|
16
16
|
@notees
|
@@ -18,14 +18,14 @@ module Notee
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def secret_notees
|
21
|
-
@notees = Notee::Post.where(status:
|
21
|
+
@notees = Notee::Post.where(status: Notee::STATUS[:secret_published]).order(published_at: :desc)
|
22
22
|
end
|
23
23
|
|
24
24
|
|
25
25
|
def notee(search_txt)
|
26
26
|
return false unless search_txt
|
27
|
-
@notee = Notee::Post.find_by(id: search_txt, status:
|
28
|
-
@notee = Notee::Post.find_by(slug: search_txt, status:
|
27
|
+
@notee = Notee::Post.find_by(id: search_txt, status: Notee::STATUS[:published])
|
28
|
+
@notee = Notee::Post.find_by(slug: search_txt, status: Notee::STATUS[:published]) unless @notee
|
29
29
|
|
30
30
|
@notee
|
31
31
|
end
|
data/lib/notee/status.rb
ADDED
data/lib/notee/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: notee
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- takujifunao
|
@@ -145,6 +145,7 @@ files:
|
|
145
145
|
- app/controllers/notee/images_controller.rb
|
146
146
|
- app/controllers/notee/notees_controller.rb
|
147
147
|
- app/controllers/notee/posts_controller.rb
|
148
|
+
- app/controllers/notee/statuses_controller.rb
|
148
149
|
- app/controllers/notee/tokens_controller.rb
|
149
150
|
- app/helpers/notee/application_helper.rb
|
150
151
|
- app/helpers/notee/categories_helper.rb
|
@@ -166,6 +167,7 @@ files:
|
|
166
167
|
- lib/notee/configuration.rb
|
167
168
|
- lib/notee/engine.rb
|
168
169
|
- lib/notee/helper.rb
|
170
|
+
- lib/notee/status.rb
|
169
171
|
- lib/notee/version.rb
|
170
172
|
- lib/notee/view_helper.rb
|
171
173
|
- lib/tasks/images/default.png
|