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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 78144021a61eec71206c93d9cc3c10d385fb18b7
4
- data.tar.gz: faab59c2cf4a301610e8d8b7f7bb71e4d16e0f24
3
+ metadata.gz: b18f4e18b36b30cc508a23b4fd901b0b36021a5c
4
+ data.tar.gz: cadab2dc58553c6be388c372e907c445368c31c6
5
5
  SHA512:
6
- metadata.gz: 1da64fded86a2bb6a7e79ada8d27e479c4413d1826ebe575ab76ed41fd8699f34a7748c40131a8bb729ebfed083ce7a9be9ed7837299ceba1ff5508459609a5e
7
- data.tar.gz: 11e453bfd8251bd5361bcc154f8b1f033cd1abc7b0964a4e4a7221b75aeb70117b0f18c9b915b9d72a28f4d637a3f91651cd01943ecb8d5fa5f0b01b445d9220
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
- layout 'layouts/phcpresspro/newspost/news_layout'
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
- # News Post Index
9
+ # Blog Post Index (/blog/posts)
12
10
  def index
13
- @news_posts = News::Post.all
11
+ @blog_posts = Blog::Post.all
14
12
  end
15
13
 
16
- # New News Article
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
- @news_post = News::Post.new
20
+ @blog_post = Blog::Post.new
19
21
  end
20
22
 
21
- # Edit News Article
23
+ # Edit Blog Post (/blog/posts/1/edit)
22
24
  def edit
23
25
  end
24
26
 
25
- # Create News Article
27
+ # Create News Post /news/posts/new
26
28
  def create
27
- @news_post = News::Post.new(news_post_params)
28
- @news_post.user_id = current_user.id
29
- if @news_post.save
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
- # Update News Article
37
+ # PATCH/PUT
37
38
  def update
38
- if @news_post.update(news_post_params)
39
- redirect_to news_posts_path, notice: 'News Article was Successfully Updated.'
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
- # Delete News Destroy
46
+ # DELETE
46
47
  def destroy
47
- @news_post.destroy
48
- redirect_to news_posts_path, notice: 'News Article was Successfully Destroyed.'
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 set_news_post
60
- @news_post = News::Post.find(params[:id])
55
+ def set_blog_post
56
+ @blog_post = Blog::Post.find(params[:id])
61
57
  end
62
58
 
63
- # Whitelist
64
- def news_post_params
65
- params.require(:news_post).permit(:newspsttitle, :newspsttext, :newspstexcerpts, :pststatus, :pstimage, :user_id, :category_id)
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,7 +4,6 @@ module Phcpresspro
4
4
  class Modules::CategoriesController < ApplicationController
5
5
 
6
6
  # Security and Filters
7
- before_action :require_user
8
7
  before_action :set_modules_category, only: [:show, :edit, :update, :destroy]
9
8
 
10
9
  # Categories Index
@@ -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, :user_id, :category_id)
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
- namespace :modules do
3
- resources :categories
4
- end
5
- namespace :blog do
6
- resources :posts
7
- end
8
- namespace :news do
9
- resources :posts
10
- end
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
@@ -14,7 +14,7 @@ class CreatePhcpressproBlogPosts < ActiveRecord::Migration[5.0]
14
14
  t.string :membership_id
15
15
  t.string :oganization_id
16
16
 
17
- t.timestamps null: false
17
+ t.timestamps
18
18
 
19
19
  end
20
20
  end
@@ -1,19 +1,23 @@
1
1
  module Phcpresspro
2
2
  class Engine < ::Rails::Engine
3
3
 
4
- # Load UI Dependecies
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
 
@@ -1,3 +1,3 @@
1
1
  module Phcpresspro
2
- VERSION = "3.0.2"
2
+ VERSION = "3.0.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phcpresspro
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.2
4
+ version: 3.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - BradPotts