phcdevworks_press 4.9.0 → 7.1.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/phcdevworks_press/list/items.coffee +3 -0
- data/app/assets/javascripts/phcdevworks_press/list/posts.coffee +3 -0
- data/app/assets/javascripts/phcdevworks_press/review/posts.coffee +3 -0
- data/app/assets/stylesheets/phcdevworks_press/list/items.scss +3 -0
- data/app/assets/stylesheets/phcdevworks_press/list/posts.scss +3 -0
- data/app/assets/stylesheets/phcdevworks_press/review/posts.scss +3 -0
- data/app/assets/stylesheets/scaffolds.scss +65 -0
- data/app/controllers/phcdevworks_press/article/posts_controller.rb +1 -1
- data/app/controllers/phcdevworks_press/blog/articles_controller.rb +1 -1
- data/app/controllers/phcdevworks_press/list/items_controller.rb +89 -0
- data/app/controllers/phcdevworks_press/list/posts_controller.rb +82 -0
- data/app/controllers/phcdevworks_press/review/posts_controller.rb +82 -0
- data/app/helpers/phcdevworks_press/list/items_helper.rb +4 -0
- data/app/helpers/phcdevworks_press/list/posts_helper.rb +4 -0
- data/app/helpers/phcdevworks_press/review/posts_helper.rb +4 -0
- data/app/models/phcdevworks_press/article/post.rb +8 -7
- data/app/models/phcdevworks_press/article_post_versions.rb +1 -1
- data/app/models/phcdevworks_press/list.rb +7 -0
- data/app/models/phcdevworks_press/list/item.rb +33 -0
- data/app/models/phcdevworks_press/list/post.rb +34 -0
- data/app/models/phcdevworks_press/list_item_versions.rb +5 -0
- data/app/models/phcdevworks_press/list_post_versions.rb +5 -0
- data/app/models/phcdevworks_press/review.rb +7 -0
- data/app/models/phcdevworks_press/review/post.rb +33 -0
- data/app/models/phcdevworks_press/review_post_versions.rb +5 -0
- data/app/views/layouts/phcdevworks_press/components/backend/sidebars/_side_menu.html.erb +75 -58
- data/app/views/phcdevworks_press/article/posts/_form.html.erb +16 -12
- data/app/views/phcdevworks_press/article/posts/index.html.erb +3 -3
- data/app/views/phcdevworks_press/list/items/_form.html.erb +37 -0
- data/app/views/phcdevworks_press/{article/categories → list/items}/edit.html.erb +6 -8
- data/app/views/phcdevworks_press/list/items/index.html.erb +81 -0
- data/app/views/phcdevworks_press/{article/categories → list/items}/new.html.erb +6 -8
- data/app/{assets/javascripts/phcdevworks_press/article/categories.coffee → views/phcdevworks_press/list/items/show.html.erb} +0 -0
- data/app/views/phcdevworks_press/list/posts/_form.html.erb +88 -0
- data/app/views/phcdevworks_press/list/posts/edit.html.erb +23 -0
- data/app/views/phcdevworks_press/{article/categories → list/posts}/index.html.erb +16 -13
- data/app/views/phcdevworks_press/list/posts/new.html.erb +23 -0
- data/app/views/phcdevworks_press/list/posts/show.html.erb +76 -0
- data/app/views/phcdevworks_press/review/posts/_form.html.erb +92 -0
- data/app/views/phcdevworks_press/review/posts/edit.html.erb +23 -0
- data/app/views/phcdevworks_press/review/posts/index.html.erb +83 -0
- data/app/views/phcdevworks_press/review/posts/new.html.erb +23 -0
- data/app/views/phcdevworks_press/review/posts/show.html.erb +9 -0
- data/config/routes.rb +28 -17
- data/db/migrate/20170517064030_create_phcdevworks_press_article_post_versions.rb +18 -0
- data/db/migrate/20190805232522_create_phcdevworks_press_article_posts.rb +5 -4
- data/db/migrate/20191024232406_create_phcdevworks_press_article_categories_posts.rb +10 -0
- data/db/migrate/{20170517064427_create_phcdevworks_press_category_versions.rb → 20200708231335_create_phcdevworks_press_list_post_versions.rb} +18 -17
- data/db/migrate/20200708231351_create_phcdevworks_press_review_post_versions.rb +18 -0
- data/db/migrate/20200712064624_create_phcdevworks_press_list_posts.rb +19 -0
- data/db/migrate/20200712064740_create_phcdevworks_press_review_posts.rb +21 -0
- data/db/migrate/20200712064920_create_phcdevworks_press_list_items.rb +22 -0
- data/db/migrate/{20170517064030_create_phcdevworks_press_post_versions.rb → 20200712065808_create_phcdevworks_press_list_item_versions.rb} +18 -17
- data/db/migrate/20200716224648_create_phcdevworks_press_review_categories_posts.rb +10 -0
- data/db/migrate/20200716224738_create_phcdevworks_press_list_categories_posts.rb +10 -0
- data/lib/phcdevworks_press/engine.rb +1 -0
- data/lib/phcdevworks_press/version.rb +1 -1
- metadata +79 -33
- data/app/assets/stylesheets/phcdevworks_press/article/categories.scss +0 -0
- data/app/controllers/phcdevworks_press/article/categories_controller.rb +0 -83
- data/app/helpers/phcdevworks_press/article/categories_helper.rb +0 -4
- data/app/models/phcdevworks_press/article/category.rb +0 -27
- data/app/models/phcdevworks_press/article_category_versions.rb +0 -5
- data/app/views/phcdevworks_press/article/categories/_form.html.erb +0 -22
- data/db/migrate/20190805232733_create_phcdevworks_press_article_categories.rb +0 -15
- data/db/migrate/20191024232406_create_phcdevworks_press_categories_posts.rb +0 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '078d5403fcd30451558d715f48e464223a8e26b259d3122f8dfdf3d0185904c3'
|
4
|
+
data.tar.gz: 8329ad8cf61ec0915a11fe4ce4512ca2d2cab4341956aadd987a01d21a08e9b7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 398b8a4f5d8f64da050a16f7887423dc0eeae8cf1ebe55af9a41d433465bc0c2dbf1b9ac9b849a22c6409339912842e1c28140b382f9e0adf16e1f01b724435b
|
7
|
+
data.tar.gz: fd920e792fb2c0aff70452bfea9f64b77da25d61c45358698bea6db67570ccb981b467a4376dc93a5514cee2436513e841501e785671a553261fe6dab17e1eb2
|
@@ -0,0 +1,65 @@
|
|
1
|
+
body {
|
2
|
+
background-color: #fff;
|
3
|
+
color: #333;
|
4
|
+
margin: 33px; }
|
5
|
+
|
6
|
+
body, p, ol, ul, td {
|
7
|
+
font-family: verdana, arial, helvetica, sans-serif;
|
8
|
+
font-size: 13px;
|
9
|
+
line-height: 18px; }
|
10
|
+
|
11
|
+
pre {
|
12
|
+
background-color: #eee;
|
13
|
+
padding: 10px;
|
14
|
+
font-size: 11px; }
|
15
|
+
|
16
|
+
a {
|
17
|
+
color: #000; }
|
18
|
+
|
19
|
+
a:visited {
|
20
|
+
color: #666; }
|
21
|
+
|
22
|
+
a:hover {
|
23
|
+
color: #fff;
|
24
|
+
background-color: #000; }
|
25
|
+
|
26
|
+
th {
|
27
|
+
padding-bottom: 5px; }
|
28
|
+
|
29
|
+
td {
|
30
|
+
padding: 0 5px 7px; }
|
31
|
+
|
32
|
+
div.field,
|
33
|
+
div.actions {
|
34
|
+
margin-bottom: 10px; }
|
35
|
+
|
36
|
+
#notice {
|
37
|
+
color: green; }
|
38
|
+
|
39
|
+
.field_with_errors {
|
40
|
+
padding: 2px;
|
41
|
+
background-color: red;
|
42
|
+
display: table; }
|
43
|
+
|
44
|
+
#error_explanation {
|
45
|
+
width: 450px;
|
46
|
+
border: 2px solid red;
|
47
|
+
padding: 7px 7px 0;
|
48
|
+
margin-bottom: 20px;
|
49
|
+
background-color: #f0f0f0; }
|
50
|
+
|
51
|
+
#error_explanation h2 {
|
52
|
+
text-align: left;
|
53
|
+
font-weight: bold;
|
54
|
+
padding: 5px 5px 5px 15px;
|
55
|
+
font-size: 12px;
|
56
|
+
margin: -7px -7px 0;
|
57
|
+
background-color: #c00;
|
58
|
+
color: #fff; }
|
59
|
+
|
60
|
+
#error_explanation ul li {
|
61
|
+
font-size: 12px;
|
62
|
+
list-style: square; }
|
63
|
+
|
64
|
+
label {
|
65
|
+
display: block; }
|
@@ -76,7 +76,7 @@ module PhcdevworksPress
|
|
76
76
|
|
77
77
|
# Whitelist
|
78
78
|
def article_post_params
|
79
|
-
params.require(:article_post).permit(:
|
79
|
+
params.require(:article_post).permit(:article_post_title, :article_post_text, :article_post_status, :article_post_image, :remove_article_post_image, :slug, :optimization_id, :org_id, :user_id, category_ids: [])
|
80
80
|
end
|
81
81
|
|
82
82
|
end
|
@@ -8,7 +8,7 @@ module PhcdevworksPress
|
|
8
8
|
|
9
9
|
# INDEX
|
10
10
|
def index
|
11
|
-
@phcdevworks_cms_press_index = Article::Post.where(
|
11
|
+
@phcdevworks_cms_press_index = Article::Post.where(article_post_status: "published").order("created_at DESC")
|
12
12
|
@phcdevworks_cms_press_randomizer = Article::Post.order('RANDOM()').limit(1)
|
13
13
|
end
|
14
14
|
|
@@ -0,0 +1,89 @@
|
|
1
|
+
require_dependency "phcdevworks_press/application_controller"
|
2
|
+
|
3
|
+
module PhcdevworksPress
|
4
|
+
class List::ItemsController < ApplicationController
|
5
|
+
|
6
|
+
# Filters & Security
|
7
|
+
#include PhcdevworksCore::PhcpluginsHelper
|
8
|
+
before_action :authenticate_user!
|
9
|
+
before_action :set_paper_trail_whodunnit
|
10
|
+
before_action :set_list_item, only: [:show, :edit, :update, :destroy]
|
11
|
+
|
12
|
+
# GET /list/items
|
13
|
+
def index
|
14
|
+
@list_items = list_post.items.all
|
15
|
+
end
|
16
|
+
|
17
|
+
# GET /list/items/1
|
18
|
+
def show
|
19
|
+
@list_item = list_post.items.find(params[:id])
|
20
|
+
end
|
21
|
+
|
22
|
+
# GET /list/items/new
|
23
|
+
def new
|
24
|
+
@list_item = list_post.items.build
|
25
|
+
end
|
26
|
+
|
27
|
+
# GET /list/items/1/edit
|
28
|
+
def edit
|
29
|
+
@list_post = List::Post.friendly.find(params[:post_id])
|
30
|
+
end
|
31
|
+
|
32
|
+
# POST /list/items
|
33
|
+
def create
|
34
|
+
@list_item = list_post.items.create(list_item_params)
|
35
|
+
@list_item.user_id = current_user.id
|
36
|
+
@list_item.org_id = current_user.org_id
|
37
|
+
respond_to do |format|
|
38
|
+
if @list_item.save
|
39
|
+
format.html { redirect_to list_post_items_url, :flash => { :success => 'List Item has been Added' }}
|
40
|
+
format.json { render :show, status: :created, location: @list_item }
|
41
|
+
else
|
42
|
+
format.html { render :new }
|
43
|
+
format.json { render json: @list_item.errors, status: :unprocessable_entity }
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
# PATCH/PUT /list/items/1
|
49
|
+
def update
|
50
|
+
@list_item = List::Item.friendly.find(params[:post_id])
|
51
|
+
respond_to do |format|
|
52
|
+
if @list_item.update(list_item_params)
|
53
|
+
format.html { redirect_to list_post_items_url, :flash => { :notice => 'List Item has been Updated.' }}
|
54
|
+
format.json { render :show, status: :ok, location: @list_item }
|
55
|
+
else
|
56
|
+
format.html { render :edit }
|
57
|
+
format.json { render json: @list_item.errors, status: :unprocessable_entity }
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
# DELETE /list/items/1
|
63
|
+
def destroy
|
64
|
+
@list_item = list_post.items.find(params[:id])
|
65
|
+
@list_item.destroy
|
66
|
+
respond_to do |format|
|
67
|
+
format.html { redirect_to list_post_items_url, :flash => { :error => 'Item Listing has been Removed' }}
|
68
|
+
format.json { head :no_content }
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
private
|
73
|
+
|
74
|
+
# Common Callbacks
|
75
|
+
def set_list_item
|
76
|
+
@list_item = List::Item.find(params[:id])
|
77
|
+
end
|
78
|
+
|
79
|
+
def list_post
|
80
|
+
@list_post = List::Post.friendly.find(params[:post_id])
|
81
|
+
end
|
82
|
+
|
83
|
+
# Only allow a trusted parameter "white list" through.
|
84
|
+
def list_item_params
|
85
|
+
params.require(:list_item).permit(:list_item_title, :list_item_text, :list_item_url, :slug, :optimization_id, :org_id, :user_id, category_ids: [])
|
86
|
+
end
|
87
|
+
|
88
|
+
end
|
89
|
+
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
require_dependency "phcdevworks_press/application_controller"
|
2
|
+
|
3
|
+
module PhcdevworksPress
|
4
|
+
class List::PostsController < ApplicationController
|
5
|
+
|
6
|
+
# Filters & Security
|
7
|
+
#include PhcdevworksCore::PhcpluginsHelper
|
8
|
+
before_action :authenticate_user!
|
9
|
+
before_action :set_paper_trail_whodunnit
|
10
|
+
before_action :set_list_post, only: [:show, :edit, :update, :destroy]
|
11
|
+
|
12
|
+
# GET /list/posts
|
13
|
+
def index
|
14
|
+
@list_posts = List::Post.all
|
15
|
+
end
|
16
|
+
|
17
|
+
# GET /list/posts/1
|
18
|
+
def show
|
19
|
+
@list_post = List::Post.friendly.find(params[:id])
|
20
|
+
end
|
21
|
+
|
22
|
+
# GET /list/posts/new
|
23
|
+
def new
|
24
|
+
@list_post = List::Post.new
|
25
|
+
end
|
26
|
+
|
27
|
+
# GET /list/posts/1/edit
|
28
|
+
def edit
|
29
|
+
end
|
30
|
+
|
31
|
+
# POST /list/posts
|
32
|
+
def create
|
33
|
+
@list_post = List::Post.new(list_post_params)
|
34
|
+
@list_post.user_id = current_user.id
|
35
|
+
@list_post.org_id = current_user.org_id
|
36
|
+
respond_to do |format|
|
37
|
+
if @list_post.save
|
38
|
+
format.html { redirect_to list_posts_path, :flash => { :success => 'Article has been Added.' }}
|
39
|
+
format.json { render :show, status: :created, location: @list_post }
|
40
|
+
else
|
41
|
+
format.html { render :new }
|
42
|
+
format.json { render json: @list_post.errors, status: :unprocessable_entity }
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
# PATCH/PUT /list/posts/1
|
48
|
+
def update
|
49
|
+
respond_to do |format|
|
50
|
+
if @list_post.update(list_post_params)
|
51
|
+
format.html { redirect_to list_posts_path, :flash => { :notice => 'Article has been Updated.' }}
|
52
|
+
format.json { render :show, status: :ok, location: @list_post }
|
53
|
+
else
|
54
|
+
format.html { render :edit }
|
55
|
+
format.json { render json: @list_post.errors, status: :unprocessable_entity }
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
# DELETE /list/posts/1
|
61
|
+
def destroy
|
62
|
+
@list_post.destroy
|
63
|
+
respond_to do |format|
|
64
|
+
format.html { redirect_to list_posts_path, :flash => { :error => 'Article has been Removed.' }}
|
65
|
+
format.json { head :no_content }
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
private
|
70
|
+
|
71
|
+
# Common Callbacks
|
72
|
+
def set_list_post
|
73
|
+
@list_post = List::Post.find(params[:id])
|
74
|
+
end
|
75
|
+
|
76
|
+
# Whitelist
|
77
|
+
def list_post_params
|
78
|
+
params.require(:list_post).permit(:list_post_title, :list_post_text, :list_post_status, :slug, :optimization_id, :org_id, :user_id, category_ids: [])
|
79
|
+
end
|
80
|
+
|
81
|
+
end
|
82
|
+
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
require_dependency "phcdevworks_press/application_controller"
|
2
|
+
|
3
|
+
module PhcdevworksPress
|
4
|
+
class Review::PostsController < ApplicationController
|
5
|
+
|
6
|
+
# Filters & Security
|
7
|
+
#include PhcdevworksCore::PhcpluginsHelper
|
8
|
+
before_action :authenticate_user!
|
9
|
+
before_action :set_paper_trail_whodunnit
|
10
|
+
before_action :set_review_post, only: [:show, :edit, :update, :destroy]
|
11
|
+
|
12
|
+
# GET /review/posts
|
13
|
+
def index
|
14
|
+
@review_posts = Review::Post.all
|
15
|
+
end
|
16
|
+
|
17
|
+
# GET /review/posts/1
|
18
|
+
def show
|
19
|
+
@review_post = Review::Post.friendly.find(params[:id])
|
20
|
+
end
|
21
|
+
|
22
|
+
# GET /review/posts/new
|
23
|
+
def new
|
24
|
+
@review_post = Review::Post.new
|
25
|
+
end
|
26
|
+
|
27
|
+
# GET /review/posts/1/edit
|
28
|
+
def edit
|
29
|
+
end
|
30
|
+
|
31
|
+
# POST /review/posts
|
32
|
+
def create
|
33
|
+
@review_post = Review::Post.new(review_post_params)
|
34
|
+
@review_post.user_id = current_user.id
|
35
|
+
@review_post.org_id = current_user.org_id
|
36
|
+
respond_to do |format|
|
37
|
+
if @review_post.save
|
38
|
+
format.html { redirect_to review_posts_path, :flash => { :success => 'Review has been Added.' }}
|
39
|
+
format.json { render :show, status: :created, location: @review_post }
|
40
|
+
else
|
41
|
+
format.html { render :new }
|
42
|
+
format.json { render json: @review_post.errors, status: :unprocessable_entity }
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
# PATCH/PUT /review/posts/1
|
48
|
+
def update
|
49
|
+
respond_to do |format|
|
50
|
+
if @review_post.update(review_post_params)
|
51
|
+
format.html { redirect_to review_posts_path, :flash => { :notice => 'Review has been Updated.' }}
|
52
|
+
format.json { render :show, status: :ok, location: @review_post }
|
53
|
+
else
|
54
|
+
format.html { render :edit }
|
55
|
+
format.json { render json: @review_post.errors, status: :unprocessable_entity }
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
# DELETE /review/posts/1
|
61
|
+
def destroy
|
62
|
+
@review_post.destroy
|
63
|
+
respond_to do |format|
|
64
|
+
format.html { redirect_to review_posts_path, :flash => { :error => 'Review has been Removed.' }}
|
65
|
+
format.json { head :no_content }
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
private
|
70
|
+
|
71
|
+
# Common Callbacks
|
72
|
+
def set_review_post
|
73
|
+
@review_post = Review::Post.find(params[:id])
|
74
|
+
end
|
75
|
+
|
76
|
+
# Whitelist
|
77
|
+
def review_post_params
|
78
|
+
params.require(:review_post).permit(:review_post_title, :review_post_text, :review_post_status, :review_post_rating, :slug, :optimization_id, :org_id, :user_id, category_ids: [])
|
79
|
+
end
|
80
|
+
|
81
|
+
end
|
82
|
+
end
|
@@ -8,24 +8,25 @@ module PhcdevworksPress
|
|
8
8
|
has_paper_trail :class_name => "PhcdevworksPress::ArticlePostVersions"
|
9
9
|
|
10
10
|
# Image Upload
|
11
|
-
has_one_attached :
|
11
|
+
has_one_attached :article_post_image
|
12
12
|
|
13
13
|
# Relationships
|
14
|
-
has_and_belongs_to_many :categories, class_name: "Article::Category", :join_table => "phcdevworks_press_categories_posts"
|
15
14
|
belongs_to :user, class_name: "PhcdevworksAccounts::User"
|
15
|
+
has_and_belongs_to_many :categories, class_name: "PhcdevworksCoreModules::Post::Category", :join_table => "phcdevworks_press_article_categories_posts", :dependent => :destroy
|
16
|
+
belongs_to :optimization, class_name: "PhcdevworksCoreModules::Marketing::Optimization", optional: true
|
16
17
|
|
17
18
|
# Form Fields Validation
|
18
|
-
validates :
|
19
|
+
validates :article_post_title,
|
19
20
|
presence: true
|
20
21
|
|
21
|
-
validates :
|
22
|
+
validates :article_post_text,
|
22
23
|
presence: true
|
23
24
|
|
24
25
|
# Clean URL Define
|
25
|
-
friendly_id :
|
26
|
+
friendly_id :list_post_imagearticle_post_nice_urls, use: [:slugged, :finders]
|
26
27
|
|
27
|
-
def
|
28
|
-
[:
|
28
|
+
def list_post_imagearticle_post_nice_urls
|
29
|
+
[:article_post_title]
|
29
30
|
end
|
30
31
|
|
31
32
|
end
|