phcdevworks_press 8.3.0 → 9.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (75) hide show
  1. checksums.yaml +4 -4
  2. data/MIT-LICENSE +1 -1
  3. data/README.md +34 -33
  4. data/app/assets/config/phcdevworks_press_manifest.js +2 -3
  5. data/app/controllers/phcdevworks_press/application_controller.rb +13 -13
  6. data/app/controllers/phcdevworks_press/article/posts_controller.rb +83 -83
  7. data/app/controllers/phcdevworks_press/blog/articles_controller.rb +29 -29
  8. data/app/controllers/phcdevworks_press/blog/lists_controller.rb +29 -29
  9. data/app/controllers/phcdevworks_press/blog/reviews_controller.rb +29 -29
  10. data/app/controllers/phcdevworks_press/list/items_controller.rb +89 -89
  11. data/app/controllers/phcdevworks_press/list/posts_controller.rb +82 -82
  12. data/app/controllers/phcdevworks_press/review/posts_controller.rb +82 -82
  13. data/app/helpers/phcdevworks_press/application_helper.rb +4 -4
  14. data/app/helpers/phcdevworks_press/article/posts_helper.rb +4 -4
  15. data/app/helpers/phcdevworks_press/blog/articles_helper.rb +4 -4
  16. data/app/helpers/phcdevworks_press/list/items_helper.rb +4 -4
  17. data/app/helpers/phcdevworks_press/list/posts_helper.rb +4 -4
  18. data/app/helpers/phcdevworks_press/review/posts_helper.rb +4 -4
  19. data/app/jobs/phcdevworks_press/application_job.rb +4 -4
  20. data/app/mailers/phcdevworks_press/application_mailer.rb +6 -6
  21. data/app/models/phcdevworks_press/application_record.rb +5 -5
  22. data/app/models/phcdevworks_press/article/post.rb +34 -34
  23. data/app/models/phcdevworks_press/article.rb +7 -7
  24. data/app/models/phcdevworks_press/list/item.rb +33 -33
  25. data/app/models/phcdevworks_press/list/post.rb +34 -34
  26. data/app/models/phcdevworks_press/list.rb +7 -7
  27. data/app/models/phcdevworks_press/review/post.rb +33 -33
  28. data/app/models/phcdevworks_press/review.rb +7 -7
  29. data/app/views/layouts/phcdevworks_press/application.html.erb +34 -92
  30. data/app/views/layouts/phcdevworks_press/components/backend/footer/_footer.html.erb +10 -9
  31. data/app/views/layouts/phcdevworks_press/components/backend/navigation/_top_menu.html.erb +26 -25
  32. data/app/views/layouts/phcdevworks_press/components/backend/sidebars/_side_menu.html.erb +491 -287
  33. data/app/views/phcdevworks_press/article/posts/_form.html.erb +102 -105
  34. data/app/views/phcdevworks_press/article/posts/edit.html.erb +23 -23
  35. data/app/views/phcdevworks_press/article/posts/index.html.erb +75 -83
  36. data/app/views/phcdevworks_press/article/posts/new.html.erb +23 -23
  37. data/app/views/phcdevworks_press/blog/articles/index.html.erb +69 -69
  38. data/app/views/phcdevworks_press/list/items/_form.html.erb +37 -37
  39. data/app/views/phcdevworks_press/list/items/edit.html.erb +39 -47
  40. data/app/views/phcdevworks_press/list/items/index.html.erb +73 -81
  41. data/app/views/phcdevworks_press/list/items/new.html.erb +40 -48
  42. data/app/views/phcdevworks_press/list/posts/_form.html.erb +86 -86
  43. data/app/views/phcdevworks_press/list/posts/edit.html.erb +23 -23
  44. data/app/views/phcdevworks_press/list/posts/index.html.erb +76 -84
  45. data/app/views/phcdevworks_press/list/posts/new.html.erb +23 -23
  46. data/app/views/phcdevworks_press/list/posts/show.html.erb +68 -76
  47. data/app/views/phcdevworks_press/review/posts/_form.html.erb +90 -90
  48. data/app/views/phcdevworks_press/review/posts/edit.html.erb +23 -23
  49. data/app/views/phcdevworks_press/review/posts/index.html.erb +75 -83
  50. data/app/views/phcdevworks_press/review/posts/new.html.erb +23 -23
  51. data/app/views/phcdevworks_press/review/posts/show.html.erb +9 -9
  52. data/config/routes.rb +0 -5
  53. data/config/spring.rb +1 -1
  54. data/db/migrate/20170517064030_create_phcdevworks_press_article_post_versions.rb +1 -1
  55. data/db/migrate/20190805232522_create_phcdevworks_press_article_posts.rb +19 -19
  56. data/db/migrate/20191024232406_create_phcdevworks_press_article_categories_posts.rb +10 -10
  57. data/db/migrate/20200708231335_create_phcdevworks_press_list_post_versions.rb +18 -18
  58. data/db/migrate/20200708231351_create_phcdevworks_press_review_post_versions.rb +18 -18
  59. data/db/migrate/20200712064624_create_phcdevworks_press_list_posts.rb +19 -19
  60. data/db/migrate/20200712064740_create_phcdevworks_press_review_posts.rb +21 -21
  61. data/db/migrate/20200712064920_create_phcdevworks_press_list_items.rb +22 -22
  62. data/db/migrate/20200712065808_create_phcdevworks_press_list_item_versions.rb +18 -18
  63. data/db/migrate/20200716224648_create_phcdevworks_press_review_categories_posts.rb +10 -10
  64. data/db/migrate/20200716224738_create_phcdevworks_press_list_categories_posts.rb +10 -10
  65. data/db/migrate/20210213025633_add_affiliatelink_to_article_posts.rb +5 -5
  66. data/lib/phcdevworks_press/engine.rb +29 -30
  67. data/lib/phcdevworks_press/version.rb +1 -1
  68. metadata +36 -86
  69. data/app/assets/stylesheets/phcdevworks_press/application.scss +0 -0
  70. data/app/assets/stylesheets/phcdevworks_press/article/posts.scss +0 -0
  71. data/app/assets/stylesheets/phcdevworks_press/blog/articles.scss +0 -0
  72. data/app/assets/stylesheets/phcdevworks_press/list/items.scss +0 -3
  73. data/app/assets/stylesheets/phcdevworks_press/list/posts.scss +0 -3
  74. data/app/assets/stylesheets/phcdevworks_press/review/posts.scss +0 -3
  75. data/app/views/layouts/phcdevworks_press/frontend.html.erb +0 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bb20dc9a6e0c51d9d854398221557dc9f7829834a3d255ca8261b0339865b602
4
- data.tar.gz: b1d038bd2618999fe8f0262e8406cf9906b386b2d5e5630f94dce22702f3c601
3
+ metadata.gz: c07bbf90817317e11e8e8c330fb9a80863d0ee8846bbe8b2867177c7e595244a
4
+ data.tar.gz: 2f846622b604eb2952a30431f15abe06d4a68c8365ce273a84b5a503ac8effe0
5
5
  SHA512:
6
- metadata.gz: 47de361eaff7fc1430d5825250c78198ab46db0f5cd905ca35548ae795ccc2905a263b8ab7b6df7bd47c0f87ac5e740817a5551a6e1115854c42598959b3f18b
7
- data.tar.gz: 1fd11f4a4f94f46336f08d0e45f09bd8703126c89ee74c607211a858e0f966ed4e100b24896b4e14eb5afa9bd1486f3c7bc9ba097738802da4cc2ee26d247aa7
6
+ metadata.gz: 822e22b7a4f1807799f49bf3d58f3f8f94ff770a6fd108b7b0c6eaf2cd51998f991b22e17f339c7f9f89659c4afdbab0cd1e07a1b190c8bb44e8216244023a09
7
+ data.tar.gz: da7cc65cc03bd7d0169dbf325a78910f7e8850306add0c5e79e8b9ab3fb004558fd8f1bac9019b867b26228d0ceba3d86f33b5e7d96323e594add00e800cfc7e
data/MIT-LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright 2020 BradPotts
1
+ Copyright 2022 PHCDevworks
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -1,34 +1,35 @@
1
- ### Phcdevworks Press (News/Blog Engine) Documentation
2
- Phcdevworks Press rails CMS engine to manage your website's articles, categories and media.
3
-
4
- * Website article posts with WYSIWYG editor.
5
- * Upload images locally or use any popular cloud service.
6
- * Customizable article categories module included.
7
-
8
- #### Step 1 - Add Phcdevworks Press to your gemfile and run command
9
-
10
- gem 'phcdevworks_press'
11
- bundle install
12
-
13
- #### Step 2 - Copy Phcdevworks Press Database Tables
14
- To copy Phcdevworks Press' requried database migrations, copy each command individually to your terminal's command line.
15
-
16
- rails phcdevworks_press:install:migrations
17
- rails db:migrate
18
-
19
- #### Step 3 - Mount Phcdevworks Press & Add Routes
20
- Mount Phcdevworks Press by adding code below to your routes file.
21
-
22
- mount PhcdevworksPress::Engine, :at => '/'
23
-
24
- #### Step 4 - Recompile Assets
25
- To properly function re-compile your application's assets to copy over required files.
26
-
27
- rails assets:clobber
28
- rails assets:precompile
29
-
30
- #### Step 5 - Generate Contact Form View (Customization)
31
- All Phcdevworks Press views and layouts can be overwritten by copying files to your application.
32
-
33
- rails generate phcdevworks_press:views
1
+ ### Phcdevworks Press (News/Blog Engine) Documentation [![Gem Version](https://badge.fury.io/rb/phcdevworks_press.svg)](https://badge.fury.io/rb/phcdevworks_press)
2
+
3
+ Phcdevworks Press rails CMS engine to manage your website's articles, categories and media.
4
+
5
+ * Website article posts with WYSIWYG editor.
6
+ * Upload images locally or use any popular cloud service.
7
+ * Customizable article categories module included.
8
+
9
+ #### Step 1 - Add Phcdevworks Press to your gemfile and run command
10
+
11
+ gem 'phcdevworks_press'
12
+ bundle install
13
+
14
+ #### Step 2 - Copy Phcdevworks Press Database Tables
15
+ To copy Phcdevworks Press' requried database migrations, copy each command individually to your terminal's command line.
16
+
17
+ rails phcdevworks_press:install:migrations
18
+ rails db:migrate
19
+
20
+ #### Step 3 - Mount Phcdevworks Press & Add Routes
21
+ Mount Phcdevworks Press by adding code below to your routes file.
22
+
23
+ mount PhcdevworksPress::Engine, :at => '/'
24
+
25
+ #### Step 4 - Recompile Assets
26
+ To properly function re-compile your application's assets to copy over required files.
27
+
28
+ rails assets:clobber
29
+ rails assets:precompile
30
+
31
+ #### Step 5 - Generate Contact Form View (Customization)
32
+ All Phcdevworks Press views and layouts can be overwritten by copying files to your application.
33
+
34
+ rails generate phcdevworks_press:views
34
35
 
@@ -1,3 +1,2 @@
1
- //= link_directory ../stylesheets/phcdevworks_press .scss
2
- //= link phcthemes_admin_panel_pack_coloradmin.css
3
- //= link phcthemes_admin_panel_pack_coloradmin.js
1
+ //= link coloradmin/default/phcthemes_admin_panel_pack_coloradmin.css
2
+ //= link coloradmin/phcthemes_admin_panel_pack_coloradmin.js
@@ -1,13 +1,13 @@
1
- module PhcdevworksPress
2
- class ApplicationController < ActionController::Base
3
-
4
- # Security Filters
5
- protect_from_forgery with: :exception
6
-
7
- # Load Requried Helper Files
8
- helper PhcdevworksActiveMenus::Engine.helpers
9
- helper PhcdevworksNotifications::Engine.helpers
10
- helper PhcdevworksTitleseo::Engine.helpers
11
-
12
- end
13
- end
1
+ module PhcdevworksPress
2
+ class ApplicationController < ActionController::Base
3
+
4
+ # Security Filters
5
+ protect_from_forgery with: :exception
6
+
7
+ # Load Requried Helper Files
8
+ helper PhcdevworksActiveMenus::Engine.helpers
9
+ helper PhcdevworksNotifications::Engine.helpers
10
+ helper PhcdevworksTitleseo::Engine.helpers
11
+
12
+ end
13
+ end
@@ -1,83 +1,83 @@
1
- require_dependency "phcdevworks_press/application_controller"
2
-
3
- module PhcdevworksPress
4
- class Article::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_article_post, only: [:show, :edit, :update, :destroy]
11
-
12
- # GET /article/posts
13
- def index
14
- @article_posts = Article::Post.all
15
- end
16
-
17
- # GET /article/posts/1
18
- def show
19
- @article_post = Article::Post.friendly.find(params[:id])
20
- @versions = PhcdevworksPress::ArticlePostVersions.where(item_id: params[:id], item_type: 'PhcdevworksPress::Article::Post')
21
- end
22
-
23
- # GET /article/posts/new
24
- def new
25
- @article_post = Article::Post.new
26
- end
27
-
28
- # GET /article/posts/1/edit
29
- def edit
30
- end
31
-
32
- # POST /article/posts
33
- def create
34
- @article_post = Article::Post.new(article_post_params)
35
- @article_post.user_id = current_user.id
36
- @article_post.org_id = current_user.org_id
37
- respond_to do |format|
38
- if @article_post.save
39
- format.html { redirect_to article_posts_path, :flash => { :success => 'Article has been Added.' }}
40
- format.json { render :show, status: :created, location: @article_post }
41
- else
42
- format.html { render :new }
43
- format.json { render json: @article_post.errors, status: :unprocessable_entity }
44
- end
45
- end
46
- end
47
-
48
- # PATCH/PUT /article/posts/1
49
- def update
50
- respond_to do |format|
51
- if @article_post.update(article_post_params)
52
- format.html { redirect_to article_posts_path, :flash => { :notice => 'Article has been Updated.' }}
53
- format.json { render :show, status: :ok, location: @article_post }
54
- else
55
- format.html { render :edit }
56
- format.json { render json: @article_post.errors, status: :unprocessable_entity }
57
- end
58
- end
59
- end
60
-
61
- # DELETE /article/posts/1
62
- def destroy
63
- @article_post.destroy
64
- respond_to do |format|
65
- format.html { redirect_to article_posts_path, :flash => { :error => 'Article has been Removed.' }}
66
- format.json { head :no_content }
67
- end
68
- end
69
-
70
- private
71
-
72
- # Common Callbacks
73
- def set_article_post
74
- @article_post = Article::Post.friendly.find(params[:id])
75
- end
76
-
77
- # Whitelist
78
- def article_post_params
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, :link_id, :org_id, :user_id, category_ids: [])
80
- end
81
-
82
- end
83
- end
1
+ require_dependency "phcdevworks_press/application_controller"
2
+
3
+ module PhcdevworksPress
4
+ class Article::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_article_post, only: [:show, :edit, :update, :destroy]
11
+
12
+ # GET /article/posts
13
+ def index
14
+ @article_posts = Article::Post.all
15
+ end
16
+
17
+ # GET /article/posts/1
18
+ def show
19
+ @article_post = Article::Post.friendly.find(params[:id])
20
+ @versions = PhcdevworksPress::ArticlePostVersions.where(item_id: params[:id], item_type: 'PhcdevworksPress::Article::Post')
21
+ end
22
+
23
+ # GET /article/posts/new
24
+ def new
25
+ @article_post = Article::Post.new
26
+ end
27
+
28
+ # GET /article/posts/1/edit
29
+ def edit
30
+ end
31
+
32
+ # POST /article/posts
33
+ def create
34
+ @article_post = Article::Post.new(article_post_params)
35
+ @article_post.user_id = current_user.id
36
+ @article_post.org_id = current_user.org_id
37
+ respond_to do |format|
38
+ if @article_post.save
39
+ format.html { redirect_to article_posts_path, :flash => { :success => 'Article has been Added.' }}
40
+ format.json { render :show, status: :created, location: @article_post }
41
+ else
42
+ format.html { render :new }
43
+ format.json { render json: @article_post.errors, status: :unprocessable_entity }
44
+ end
45
+ end
46
+ end
47
+
48
+ # PATCH/PUT /article/posts/1
49
+ def update
50
+ respond_to do |format|
51
+ if @article_post.update(article_post_params)
52
+ format.html { redirect_to article_posts_path, :flash => { :notice => 'Article has been Updated.' }}
53
+ format.json { render :show, status: :ok, location: @article_post }
54
+ else
55
+ format.html { render :edit }
56
+ format.json { render json: @article_post.errors, status: :unprocessable_entity }
57
+ end
58
+ end
59
+ end
60
+
61
+ # DELETE /article/posts/1
62
+ def destroy
63
+ @article_post.destroy
64
+ respond_to do |format|
65
+ format.html { redirect_to article_posts_path, :flash => { :error => 'Article has been Removed.' }}
66
+ format.json { head :no_content }
67
+ end
68
+ end
69
+
70
+ private
71
+
72
+ # Common Callbacks
73
+ def set_article_post
74
+ @article_post = Article::Post.friendly.find(params[:id])
75
+ end
76
+
77
+ # Whitelist
78
+ def article_post_params
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, :link_id, :org_id, :user_id, category_ids: [])
80
+ end
81
+
82
+ end
83
+ end
@@ -1,29 +1,29 @@
1
- require_dependency "phcdevworks_press/application_controller"
2
-
3
- module PhcdevworksPress
4
- class Blog::ArticlesController < ApplicationController
5
-
6
- # Filters
7
- before_action :phc_blog_index_all
8
-
9
- # Layout
10
- layout "phcdevworks_press/frontend"
11
-
12
- # INDEX
13
- def index
14
- end
15
-
16
- # SHOW
17
- def show
18
- @phcdevworks_cms_press_article_single = Article::Post.friendly.find(params[:id])
19
- end
20
-
21
- # Index All for Blog
22
- def phc_blog_index_all
23
- @phcdevworks_cms_press_article_index = Article::Post.where(article_post_status: "published").order("created_at DESC")
24
- @phcdevworks_cms_press_list_index = List::Post.where(list_post_status: "published").order("created_at DESC")
25
- @phcdevworks_cms_press_review_index = Review::Post.where(review_post_status: "published").order("created_at DESC")
26
- end
27
-
28
- end
29
- end
1
+ require_dependency "phcdevworks_press/application_controller"
2
+
3
+ module PhcdevworksPress
4
+ class Blog::ArticlesController < ApplicationController
5
+
6
+ # Filters
7
+ before_action :phc_blog_index_all
8
+
9
+ # Layout
10
+ layout "phcdevworks_press/frontend"
11
+
12
+ # INDEX
13
+ def index
14
+ end
15
+
16
+ # SHOW
17
+ def show
18
+ @phcdevworks_cms_press_article_single = Article::Post.friendly.find(params[:id])
19
+ end
20
+
21
+ # Index All for Blog
22
+ def phc_blog_index_all
23
+ @phcdevworks_cms_press_article_index = Article::Post.where(article_post_status: "published").order("created_at DESC")
24
+ @phcdevworks_cms_press_list_index = List::Post.where(list_post_status: "published").order("created_at DESC")
25
+ @phcdevworks_cms_press_review_index = Review::Post.where(review_post_status: "published").order("created_at DESC")
26
+ end
27
+
28
+ end
29
+ end
@@ -1,29 +1,29 @@
1
- require_dependency "phcdevworks_press/application_controller"
2
-
3
- module PhcdevworksPress
4
- class Blog::ListsController < ApplicationController
5
-
6
- # Filters
7
- before_action :phc_blog_index_all
8
-
9
- # Layout
10
- layout "phcdevworks_press/frontend"
11
-
12
- # INDEX
13
- def index
14
- end
15
-
16
- # SHOW
17
- def show
18
- @phcdevworks_cms_press_list_single = List::Post.friendly.find(params[:id])
19
- end
20
-
21
- # Index All for Blog
22
- def phc_blog_index_all
23
- @phcdevworks_cms_press_article_index = Article::Post.where(article_post_status: "published").order("created_at DESC")
24
- @phcdevworks_cms_press_list_index = List::Post.where(list_post_status: "published").order("created_at DESC")
25
- @phcdevworks_cms_press_review_index = Review::Post.where(review_post_status: "published").order("created_at DESC")
26
- end
27
-
28
- end
29
- end
1
+ require_dependency "phcdevworks_press/application_controller"
2
+
3
+ module PhcdevworksPress
4
+ class Blog::ListsController < ApplicationController
5
+
6
+ # Filters
7
+ before_action :phc_blog_index_all
8
+
9
+ # Layout
10
+ layout "phcdevworks_press/frontend"
11
+
12
+ # INDEX
13
+ def index
14
+ end
15
+
16
+ # SHOW
17
+ def show
18
+ @phcdevworks_cms_press_list_single = List::Post.friendly.find(params[:id])
19
+ end
20
+
21
+ # Index All for Blog
22
+ def phc_blog_index_all
23
+ @phcdevworks_cms_press_article_index = Article::Post.where(article_post_status: "published").order("created_at DESC")
24
+ @phcdevworks_cms_press_list_index = List::Post.where(list_post_status: "published").order("created_at DESC")
25
+ @phcdevworks_cms_press_review_index = Review::Post.where(review_post_status: "published").order("created_at DESC")
26
+ end
27
+
28
+ end
29
+ end
@@ -1,29 +1,29 @@
1
- require_dependency "phcdevworks_press/application_controller"
2
-
3
- module PhcdevworksPress
4
- class Blog::ReviewsController < ApplicationController
5
-
6
- # Filters
7
- before_action :phc_blog_index_all
8
-
9
- # Layout
10
- layout "phcdevworks_press/frontend"
11
-
12
- # INDEX
13
- def index
14
- end
15
-
16
- # SHOW
17
- def show
18
- @phcdevworks_cms_press_review_single = Review::Post.friendly.find(params[:id])
19
- end
20
-
21
- # Index All for Blog
22
- def phc_blog_index_all
23
- @phcdevworks_cms_press_article_index = Article::Post.where(article_post_status: "published").order("created_at DESC")
24
- @phcdevworks_cms_press_list_index = List::Post.where(list_post_status: "published").order("created_at DESC")
25
- @phcdevworks_cms_press_review_index = Review::Post.where(review_post_status: "published").order("created_at DESC")
26
- end
27
-
28
- end
29
- end
1
+ require_dependency "phcdevworks_press/application_controller"
2
+
3
+ module PhcdevworksPress
4
+ class Blog::ReviewsController < ApplicationController
5
+
6
+ # Filters
7
+ before_action :phc_blog_index_all
8
+
9
+ # Layout
10
+ layout "phcdevworks_press/frontend"
11
+
12
+ # INDEX
13
+ def index
14
+ end
15
+
16
+ # SHOW
17
+ def show
18
+ @phcdevworks_cms_press_review_single = Review::Post.friendly.find(params[:id])
19
+ end
20
+
21
+ # Index All for Blog
22
+ def phc_blog_index_all
23
+ @phcdevworks_cms_press_article_index = Article::Post.where(article_post_status: "published").order("created_at DESC")
24
+ @phcdevworks_cms_press_list_index = List::Post.where(list_post_status: "published").order("created_at DESC")
25
+ @phcdevworks_cms_press_review_index = Review::Post.where(review_post_status: "published").order("created_at DESC")
26
+ end
27
+
28
+ end
29
+ end
@@ -1,89 +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, :link_id, :org_id, :user_id, category_ids: [])
86
- end
87
-
88
- end
89
- end
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, :link_id, :org_id, :user_id, category_ids: [])
86
+ end
87
+
88
+ end
89
+ end