phcdevworks_press 6.0.0 → 7.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/phcdevworks_press/list/items.coffee +3 -0
  3. data/app/assets/javascripts/phcdevworks_press/list/posts.coffee +3 -0
  4. data/app/assets/javascripts/phcdevworks_press/review/posts.coffee +3 -0
  5. data/app/assets/stylesheets/phcdevworks_press/list/items.scss +3 -0
  6. data/app/assets/stylesheets/phcdevworks_press/list/posts.scss +3 -0
  7. data/app/assets/stylesheets/phcdevworks_press/review/posts.scss +3 -0
  8. data/app/assets/stylesheets/scaffolds.scss +65 -0
  9. data/app/controllers/phcdevworks_press/article/posts_controller.rb +1 -1
  10. data/app/controllers/phcdevworks_press/list/items_controller.rb +89 -0
  11. data/app/controllers/phcdevworks_press/list/posts_controller.rb +82 -0
  12. data/app/controllers/phcdevworks_press/review/posts_controller.rb +82 -0
  13. data/app/helpers/phcdevworks_press/list/items_helper.rb +4 -0
  14. data/app/helpers/phcdevworks_press/list/posts_helper.rb +4 -0
  15. data/app/helpers/phcdevworks_press/review/posts_helper.rb +4 -0
  16. data/app/models/phcdevworks_press/article/post.rb +7 -7
  17. data/app/models/phcdevworks_press/article_post_versions.rb +1 -1
  18. data/app/models/phcdevworks_press/list.rb +7 -0
  19. data/app/models/phcdevworks_press/list/item.rb +33 -0
  20. data/app/models/phcdevworks_press/list/post.rb +34 -0
  21. data/app/models/phcdevworks_press/list_item_versions.rb +5 -0
  22. data/app/models/phcdevworks_press/list_post_versions.rb +5 -0
  23. data/app/models/phcdevworks_press/review.rb +7 -0
  24. data/app/models/phcdevworks_press/review/post.rb +33 -0
  25. data/app/models/phcdevworks_press/review_post_versions.rb +5 -0
  26. data/app/views/layouts/phcdevworks_press/components/backend/sidebars/_side_menu.html.erb +54 -32
  27. data/app/views/phcdevworks_press/article/posts/_form.html.erb +12 -12
  28. data/app/views/phcdevworks_press/article/posts/index.html.erb +3 -3
  29. data/app/views/phcdevworks_press/list/items/_form.html.erb +37 -0
  30. data/app/views/phcdevworks_press/list/items/edit.html.erb +47 -0
  31. data/app/views/phcdevworks_press/list/items/index.html.erb +81 -0
  32. data/app/views/phcdevworks_press/list/items/new.html.erb +48 -0
  33. data/app/views/phcdevworks_press/list/items/show.html.erb +0 -0
  34. data/app/views/phcdevworks_press/list/posts/_form.html.erb +88 -0
  35. data/app/views/phcdevworks_press/list/posts/edit.html.erb +23 -0
  36. data/app/views/phcdevworks_press/list/posts/index.html.erb +84 -0
  37. data/app/views/phcdevworks_press/list/posts/new.html.erb +23 -0
  38. data/app/views/phcdevworks_press/list/posts/show.html.erb +76 -0
  39. data/app/views/phcdevworks_press/review/posts/_form.html.erb +92 -0
  40. data/app/views/phcdevworks_press/review/posts/edit.html.erb +23 -0
  41. data/app/views/phcdevworks_press/review/posts/index.html.erb +83 -0
  42. data/app/views/phcdevworks_press/review/posts/new.html.erb +23 -0
  43. data/app/views/phcdevworks_press/review/posts/show.html.erb +9 -0
  44. data/config/routes.rb +28 -16
  45. data/db/migrate/20170517064030_create_phcdevworks_press_article_post_versions.rb +18 -0
  46. data/db/migrate/20190805232522_create_phcdevworks_press_article_posts.rb +5 -4
  47. data/db/migrate/20191024232406_create_phcdevworks_press_article_categories_posts.rb +10 -0
  48. data/db/migrate/{20170517064030_create_phcdevworks_press_post_versions.rb → 20200708231335_create_phcdevworks_press_list_post_versions.rb} +18 -17
  49. data/db/migrate/20200708231351_create_phcdevworks_press_review_post_versions.rb +18 -0
  50. data/db/migrate/20200712064624_create_phcdevworks_press_list_posts.rb +19 -0
  51. data/db/migrate/20200712064740_create_phcdevworks_press_review_posts.rb +20 -0
  52. data/db/migrate/20200712064920_create_phcdevworks_press_list_items.rb +22 -0
  53. data/db/migrate/20200712065808_create_phcdevworks_press_list_item_versions.rb +18 -0
  54. data/db/migrate/20200716224648_create_phcdevworks_press_review_categories_posts.rb +10 -0
  55. data/db/migrate/20200716224738_create_phcdevworks_press_list_categories_posts.rb +10 -0
  56. data/lib/phcdevworks_press/version.rb +1 -1
  57. metadata +70 -28
  58. data/db/migrate/20191024232406_create_phcdevworks_press_categories_posts.rb +0 -10
  59. data/db/migrate/20200702121306_remove_images_cols_from_phcdevworks_press.rb +0 -7
  60. data/db/migrate/20200707115652_create_phcdevworks_press_add_seo.rb +0 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0eb45274799479459031d5695f8c87ac74436810aefe10c8671379f7486793e8
4
- data.tar.gz: f1f21bf0dd61cffa2a2c71443b5257aa68a6f8c71a0fc95d007fe4d7bc95119f
3
+ metadata.gz: 85a0f6a18c8299021a364f8d200a429cf553d8eeb2b354a0b62aac10ff94a5e5
4
+ data.tar.gz: 3afa96ed4bfcabf86ed0fdc07c73ddf87c7afdca4dbe972f64b43e59def5396a
5
5
  SHA512:
6
- metadata.gz: 64a01da52b3250a1b79686d3748a66dde68b61c58b3d0aa0c56b421c4687f967042c79e1742a72e385b1c96a2e910b3386e6ce0f9b8bd8e35a317d8248309d93
7
- data.tar.gz: fdb41e6617637d23dfd8b7112b5dda9337d8c8c8a688340fcbfb4e6073a798565cc8e54e59325e36b0ad57423ca03468ea48828f98aca951bbc8d62ccd1dbb75
6
+ metadata.gz: 2a9e005c88cace253c039f59098fa007e141ab5f08ab40443b5fc3402c80f8400df5458ad189a328e918ce4ae178d53c4e8b8c33320e7a9e45229d076766071e
7
+ data.tar.gz: 0b756b4b4a200c6150eddfdaf74d43bdce1f993704571aeec0623d350e6ad4b4870becdd3881a51f05b1a3011374e53cdea23e5c5082923d8c45e0882b54b051
@@ -0,0 +1,3 @@
1
+ # Place all the behaviors and hooks related to the matching controller here.
2
+ # All this logic will automatically be available in application.js.
3
+ # You can use CoffeeScript in this file: http://coffeescript.org/
@@ -0,0 +1,3 @@
1
+ # Place all the behaviors and hooks related to the matching controller here.
2
+ # All this logic will automatically be available in application.js.
3
+ # You can use CoffeeScript in this file: http://coffeescript.org/
@@ -0,0 +1,3 @@
1
+ # Place all the behaviors and hooks related to the matching controller here.
2
+ # All this logic will automatically be available in application.js.
3
+ # You can use CoffeeScript in this file: http://coffeescript.org/
@@ -0,0 +1,3 @@
1
+ // Place all the styles related to the list::items controller here.
2
+ // They will automatically be included in application.css.
3
+ // You can use Sass (SCSS) here: https://sass-lang.com/
@@ -0,0 +1,3 @@
1
+ // Place all the styles related to the list::posts controller here.
2
+ // They will automatically be included in application.css.
3
+ // You can use Sass (SCSS) here: https://sass-lang.com/
@@ -0,0 +1,3 @@
1
+ // Place all the styles related to the review::posts controller here.
2
+ // They will automatically be included in application.css.
3
+ // You can use Sass (SCSS) here: https://sass-lang.com/
@@ -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(:post_title, :post_text, :post_status, :post_image, :remove_post_image, :slug, :optimization_id, :org_id, :user_id, category_ids: [])
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
@@ -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
@@ -0,0 +1,4 @@
1
+ module PhcdevworksPress
2
+ module List::ItemsHelper
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module PhcdevworksPress
2
+ module List::PostsHelper
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module PhcdevworksPress
2
+ module Review::PostsHelper
3
+ end
4
+ end
@@ -8,25 +8,25 @@ module PhcdevworksPress
8
8
  has_paper_trail :class_name => "PhcdevworksPress::ArticlePostVersions"
9
9
 
10
10
  # Image Upload
11
- has_one_attached :post_image
11
+ has_one_attached :article_post_image
12
12
 
13
13
  # Relationships
14
14
  belongs_to :user, class_name: "PhcdevworksAccounts::User"
15
- has_and_belongs_to_many :categories, class_name: "PhcdevworksCoreModules::Post::Category", :join_table => "phcdevworks_press_categories_posts"
15
+ has_and_belongs_to_many :categories, class_name: "PhcdevworksCoreModules::Post::Category", :join_table => "phcdevworks_press_article_categories_posts", :dependent => :destroy
16
16
  belongs_to :optimization, class_name: "PhcdevworksCoreModules::Marketing::Optimization", optional: true
17
17
 
18
18
  # Form Fields Validation
19
- validates :post_title,
19
+ validates :article_post_title,
20
20
  presence: true
21
21
 
22
- validates :post_text,
22
+ validates :article_post_text,
23
23
  presence: true
24
24
 
25
25
  # Clean URL Define
26
- friendly_id :phcdev_article_post_nice_urls, use: [:slugged, :finders]
26
+ friendly_id :list_post_imagearticle_post_nice_urls, use: [:slugged, :finders]
27
27
 
28
- def phcdev_article_post_nice_urls
29
- [:post_title]
28
+ def list_post_imagearticle_post_nice_urls
29
+ [:article_post_title]
30
30
  end
31
31
 
32
32
  end
@@ -1,5 +1,5 @@
1
1
  module PhcdevworksPress
2
2
  class ArticlePostVersions < PaperTrail::Version
3
- self.table_name = :phcdevworks_press_post_versions
3
+ self.table_name = :phcdevworks_press_article_post_versions
4
4
  end
5
5
  end
@@ -0,0 +1,7 @@
1
+ module PhcdevworksPress
2
+ module List
3
+ def self.table_name_prefix
4
+ 'phcdevworks_press_list_'
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,33 @@
1
+ module PhcdevworksPress
2
+ class List::Item < ApplicationRecord
3
+
4
+ # Clean URL Initialize
5
+ extend FriendlyId
6
+
7
+ # Paper Trail Initialize
8
+ has_paper_trail :class_name => "PhcdevworksPress::ListItemVersions"
9
+
10
+ # Image Upload
11
+ has_one_attached :list_item_image
12
+
13
+ # Relationships
14
+ belongs_to :user, class_name: "PhcdevworksAccounts::User"
15
+ belongs_to :post, class_name: "PhcdevworksPress::List::Post"
16
+ belongs_to :optimization, class_name: "PhcdevworksCoreModules::Marketing::Optimization", optional: true
17
+
18
+ # Form Fields Validation
19
+ validates :list_item_title,
20
+ presence: true
21
+
22
+ validates :list_item_text,
23
+ presence: true
24
+
25
+ # Clean URL Define
26
+ friendly_id :list_item_nice_urls, use: [:slugged, :finders]
27
+
28
+ def list_item_nice_urls
29
+ [:list_item_title]
30
+ end
31
+
32
+ end
33
+ end