phcdevworks_press 4.8.2 → 7.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) 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 +8 -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/application.html.erb +0 -7
  27. data/app/views/layouts/phcdevworks_press/components/backend/sidebars/_side_menu.html.erb +75 -58
  28. data/app/views/phcdevworks_press/article/posts/_form.html.erb +16 -12
  29. data/app/views/phcdevworks_press/article/posts/index.html.erb +3 -3
  30. data/app/views/phcdevworks_press/list/items/_form.html.erb +37 -0
  31. data/app/views/phcdevworks_press/{article/categories → list/items}/edit.html.erb +6 -8
  32. data/app/views/phcdevworks_press/list/items/index.html.erb +81 -0
  33. data/app/views/phcdevworks_press/{article/categories → list/items}/new.html.erb +6 -8
  34. data/app/{assets/javascripts/phcdevworks_press/article/categories.coffee → views/phcdevworks_press/list/items/show.html.erb} +0 -0
  35. data/app/views/phcdevworks_press/list/posts/_form.html.erb +88 -0
  36. data/app/views/phcdevworks_press/list/posts/edit.html.erb +23 -0
  37. data/app/views/phcdevworks_press/{article/categories → list/posts}/index.html.erb +16 -13
  38. data/app/views/phcdevworks_press/list/posts/new.html.erb +23 -0
  39. data/app/views/phcdevworks_press/list/posts/show.html.erb +76 -0
  40. data/app/views/phcdevworks_press/review/posts/_form.html.erb +92 -0
  41. data/app/views/phcdevworks_press/review/posts/edit.html.erb +23 -0
  42. data/app/views/phcdevworks_press/review/posts/index.html.erb +83 -0
  43. data/app/views/phcdevworks_press/review/posts/new.html.erb +23 -0
  44. data/app/views/phcdevworks_press/review/posts/show.html.erb +9 -0
  45. data/config/routes.rb +28 -17
  46. data/db/migrate/20170517064030_create_phcdevworks_press_article_post_versions.rb +18 -0
  47. data/db/migrate/20190805232522_create_phcdevworks_press_article_posts.rb +5 -4
  48. data/db/migrate/20191024232406_create_phcdevworks_press_article_categories_posts.rb +10 -0
  49. data/db/migrate/{20170517064427_create_phcdevworks_press_category_versions.rb → 20200708231335_create_phcdevworks_press_list_post_versions.rb} +18 -17
  50. data/db/migrate/20200708231351_create_phcdevworks_press_review_post_versions.rb +18 -0
  51. data/db/migrate/20200712064624_create_phcdevworks_press_list_posts.rb +19 -0
  52. data/db/migrate/20200712064740_create_phcdevworks_press_review_posts.rb +21 -0
  53. data/db/migrate/20200712064920_create_phcdevworks_press_list_items.rb +22 -0
  54. data/db/migrate/{20170517064030_create_phcdevworks_press_post_versions.rb → 20200712065808_create_phcdevworks_press_list_item_versions.rb} +18 -17
  55. data/db/migrate/20200716224648_create_phcdevworks_press_review_categories_posts.rb +10 -0
  56. data/db/migrate/20200716224738_create_phcdevworks_press_list_categories_posts.rb +10 -0
  57. data/lib/phcdevworks_press/engine.rb +1 -0
  58. data/lib/phcdevworks_press/version.rb +1 -1
  59. metadata +79 -33
  60. data/app/assets/stylesheets/phcdevworks_press/article/categories.scss +0 -0
  61. data/app/controllers/phcdevworks_press/article/categories_controller.rb +0 -83
  62. data/app/helpers/phcdevworks_press/article/categories_helper.rb +0 -4
  63. data/app/models/phcdevworks_press/article/category.rb +0 -27
  64. data/app/models/phcdevworks_press/article_category_versions.rb +0 -5
  65. data/app/views/phcdevworks_press/article/categories/_form.html.erb +0 -22
  66. data/db/migrate/20190805232733_create_phcdevworks_press_article_categories.rb +0 -15
  67. 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: eda5e95437b5f5d574b93356455155ba96d91ff2416fdff52eeddc0b667cb6e5
4
- data.tar.gz: adf8b13e59bd265d5dee3bc3f2de71dd05356e0aaa29aa101972b7114ebcde5e
3
+ metadata.gz: b2ddbff0f56b9017d3fcc5168b2e48d254f97d32f8e13388831dfa99f500f292
4
+ data.tar.gz: 34bbdf38976173b04ceb2d99aa63dad6e752b3c806e1afa060e33c4a30a3207b
5
5
  SHA512:
6
- metadata.gz: 5a0dd5d2b9f3b8ca5899254a533afa14d91ba620e751aa58717dc26bf9ab9089bb41c420d9899b098244f67bfdf51e255da0d8474582ba96ddb19b3e8a0d423f
7
- data.tar.gz: 96299727fb016e8c99cc1885fa4ac154b320c090f4c3103b567bc41ff9dbf512a67e60f1637436b5d1206321799f2d95d1331a95f11f7942212ad700ee0e8834
6
+ metadata.gz: 703c5a5ad4a180843a632f6a3ce7d76e799333444796c9524420e8aaaf928b27a6c2fb81cb47efa02cdce8c85b718509ef279b7f662f21aac765afe5e4becdbd
7
+ data.tar.gz: ef7df91493f8cc300d0e8c8bb9bd040140cbe479e452b150623d49d2311dd609a9adf0f58e421ffed1469e3cb1e39ad03ec2f52b43419f7b7e7ac5a91f5f8c62
@@ -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, :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,24 +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
- 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 :post_title,
19
+ validates :article_post_title,
19
20
  presence: true
20
21
 
21
- validates :post_text,
22
+ validates :article_post_text,
22
23
  presence: true
23
24
 
24
25
  # Clean URL Define
25
- friendly_id :phcdev_article_post_nice_urls, use: [:slugged, :finders]
26
+ friendly_id :list_post_imagearticle_post_nice_urls, use: [:slugged, :finders]
26
27
 
27
- def phcdev_article_post_nice_urls
28
- [:post_title]
28
+ def list_post_imagearticle_post_nice_urls
29
+ [:article_post_title]
29
30
  end
30
31
 
31
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