phcpresspro 3.0.2 → 3.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/phcpresspro/blog/posts_controller.rb +25 -29
- data/app/controllers/phcpresspro/modules/categories_controller.rb +0 -1
- data/app/controllers/phcpresspro/news/posts_controller.rb +6 -10
- data/config/routes.rb +16 -9
- data/db/migrate/20160716182518_create_phcpresspro_blog_posts.rb +1 -1
- data/lib/phcpresspro/engine.rb +9 -5
- data/lib/phcpresspro/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b18f4e18b36b30cc508a23b4fd901b0b36021a5c
|
4
|
+
data.tar.gz: cadab2dc58553c6be388c372e907c445368c31c6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 80dfa96b8971b6129e5c883f3f38fb7b61d496e82f72fde3c71a8a84b22776eebbfcb21b1f84d464e49070751e2737c7ff0f8904a2e41f10d4110c2bd4534fb2
|
7
|
+
data.tar.gz: 3c242c032e56b22a3844d929bd016318e23015d00ae3e6f7052a019a1d0e67d6c7880e7650535c798c8b0a2fa904520ef7589aeb6b4afc53830512783fbe85b9
|
@@ -4,65 +4,61 @@ module Phcpresspro
|
|
4
4
|
class Blog::PostsController < ApplicationController
|
5
5
|
|
6
6
|
# Filters & Security
|
7
|
-
|
8
|
-
before_action :require_user
|
9
|
-
before_action :set_news_post, only: [:edit, :update, :destroy]
|
7
|
+
before_action :set_blog_post, only: [:edit, :update, :destroy]
|
10
8
|
|
11
|
-
#
|
9
|
+
# Blog Post Index (/blog/posts)
|
12
10
|
def index
|
13
|
-
@
|
11
|
+
@blog_posts = Blog::Post.all
|
14
12
|
end
|
15
13
|
|
16
|
-
#
|
14
|
+
# Single Blog Post (/blog/posts/1)
|
15
|
+
#def show
|
16
|
+
#end
|
17
|
+
|
18
|
+
# Create a New Blog Post (/blog/posts/new)
|
17
19
|
def new
|
18
|
-
@
|
20
|
+
@blog_post = Blog::Post.new
|
19
21
|
end
|
20
22
|
|
21
|
-
# Edit
|
23
|
+
# Edit Blog Post (/blog/posts/1/edit)
|
22
24
|
def edit
|
23
25
|
end
|
24
26
|
|
25
|
-
# Create News
|
27
|
+
# Create News Post /news/posts/new
|
26
28
|
def create
|
27
|
-
@
|
28
|
-
@
|
29
|
-
|
30
|
-
redirect_to news_posts_path, notice: 'News Article was Successfully Created.'
|
29
|
+
@blog_post = Blog::Post.new(blog_post_params)
|
30
|
+
if @blog_post.save
|
31
|
+
redirect_to blog_posts_path, notice: 'Blog post was successfully created.'
|
31
32
|
else
|
32
33
|
render 'new'
|
33
34
|
end
|
34
35
|
end
|
35
36
|
|
36
|
-
#
|
37
|
+
# PATCH/PUT
|
37
38
|
def update
|
38
|
-
if @
|
39
|
-
redirect_to
|
39
|
+
if @blog_post.update(blog_post_params)
|
40
|
+
redirect_to blog_posts_path, notice: 'Blog post was successfully updated.'
|
40
41
|
else
|
41
42
|
render :edit
|
42
43
|
end
|
43
44
|
end
|
44
45
|
|
45
|
-
#
|
46
|
+
# DELETE
|
46
47
|
def destroy
|
47
|
-
@
|
48
|
-
redirect_to
|
48
|
+
@blog_post.destroy
|
49
|
+
redirect_to blog_posts_path, notice: 'Blog post was successfully destroyed.'
|
49
50
|
end
|
50
51
|
|
51
52
|
private
|
52
53
|
|
53
|
-
# Define Current User
|
54
|
-
def current_user
|
55
|
-
@_current_user ||= AuthRocket::Session.from_token(session[:ar_token]).try(:user)
|
56
|
-
end
|
57
|
-
|
58
54
|
# Common Callbacks
|
59
|
-
def
|
60
|
-
@
|
55
|
+
def set_blog_post
|
56
|
+
@blog_post = Blog::Post.find(params[:id])
|
61
57
|
end
|
62
58
|
|
63
|
-
# Whitelist
|
64
|
-
def
|
65
|
-
params.require(:
|
59
|
+
# Whitelist on what can be posted
|
60
|
+
def blog_post_params
|
61
|
+
params.require(:blog_post).permit(:blogpsttitle, :blogpsttext, :blogpstexcerpts, :pststatus, :pstimage, :remove_pstimage, category_id, :user_id)
|
66
62
|
end
|
67
63
|
|
68
64
|
end
|
@@ -4,8 +4,6 @@ module Phcpresspro
|
|
4
4
|
class News::PostsController < ApplicationController
|
5
5
|
|
6
6
|
# Filters & Security
|
7
|
-
layout 'layouts/phcpresspro/newspost/news_layout'
|
8
|
-
before_action :require_user
|
9
7
|
before_action :set_news_post, only: [:edit, :update, :destroy]
|
10
8
|
|
11
9
|
# News Post Index
|
@@ -13,6 +11,10 @@ module Phcpresspro
|
|
13
11
|
@news_posts = News::Post.all
|
14
12
|
end
|
15
13
|
|
14
|
+
# Single News Post (/blog/posts/1)
|
15
|
+
#def show
|
16
|
+
#end
|
17
|
+
|
16
18
|
# New News Article
|
17
19
|
def new
|
18
20
|
@news_post = News::Post.new
|
@@ -25,7 +27,6 @@ module Phcpresspro
|
|
25
27
|
# Create News Article
|
26
28
|
def create
|
27
29
|
@news_post = News::Post.new(news_post_params)
|
28
|
-
@news_post.user_id = current_user.id
|
29
30
|
if @news_post.save
|
30
31
|
redirect_to news_posts_path, notice: 'News Article was Successfully Created.'
|
31
32
|
else
|
@@ -50,11 +51,6 @@ module Phcpresspro
|
|
50
51
|
|
51
52
|
private
|
52
53
|
|
53
|
-
# Define Current User
|
54
|
-
def current_user
|
55
|
-
@_current_user ||= AuthRocket::Session.from_token(session[:ar_token]).try(:user)
|
56
|
-
end
|
57
|
-
|
58
54
|
# Common Callbacks
|
59
55
|
def set_news_post
|
60
56
|
@news_post = News::Post.find(params[:id])
|
@@ -62,8 +58,8 @@ module Phcpresspro
|
|
62
58
|
|
63
59
|
# Whitelist
|
64
60
|
def news_post_params
|
65
|
-
params.require(:news_post).permit(:newspsttitle, :newspsttext, :newspstexcerpts, :pststatus, :pstimage, :
|
61
|
+
params.require(:news_post).permit(:newspsttitle, :newspsttext, :newspstexcerpts, :pststatus, :pstimage, :remove_pstimage, :category_id, :user_id)
|
66
62
|
end
|
67
63
|
|
68
64
|
end
|
69
|
-
end
|
65
|
+
end
|
data/config/routes.rb
CHANGED
@@ -1,11 +1,18 @@
|
|
1
1
|
Phcpresspro::Engine.routes.draw do
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
2
|
+
|
3
|
+
# Blog Routes
|
4
|
+
namespace :blog do
|
5
|
+
resources :posts, class_name: 'Phcpresspro::News::Post'
|
6
|
+
end
|
7
|
+
|
8
|
+
# News Routes
|
9
|
+
namespace :news do
|
10
|
+
resources :posts, class_name: 'Phcpresspro::Blog::Post'
|
11
|
+
end
|
12
|
+
|
13
|
+
# Categories
|
14
|
+
namespace :modules do
|
15
|
+
resources :categories, class_name: 'Phcpresspro::Modules::Category'
|
16
|
+
end
|
17
|
+
|
11
18
|
end
|
data/lib/phcpresspro/engine.rb
CHANGED
@@ -1,19 +1,23 @@
|
|
1
1
|
module Phcpresspro
|
2
2
|
class Engine < ::Rails::Engine
|
3
3
|
|
4
|
-
#
|
4
|
+
# UI Dependencies
|
5
5
|
require 'jquery-rails'
|
6
|
-
require 'phcnotifi'
|
7
|
-
require 'phctitleseo'
|
8
|
-
|
9
6
|
require 'sass-rails'
|
10
7
|
require 'bootstrap-sass'
|
11
8
|
require 'font-awesome-rails'
|
12
|
-
|
9
|
+
|
13
10
|
# Load Image Processing
|
14
11
|
require 'carrierwave'
|
15
12
|
require 'cloudinary'
|
16
13
|
|
14
|
+
# PHCEngines
|
15
|
+
require 'phcnotifi'
|
16
|
+
require 'phctitleseo'
|
17
|
+
|
18
|
+
# Security For PHC Use
|
19
|
+
require 'authrocket'
|
20
|
+
|
17
21
|
# Give Everything a Namespace
|
18
22
|
isolate_namespace Phcpresspro
|
19
23
|
|
data/lib/phcpresspro/version.rb
CHANGED