phcpress 4.0.0 → 5.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -4
  3. data/app/assets/javascripts/phcpress/modules/connections.js +2 -0
  4. data/app/assets/stylesheets/phcpress/_custom.scss +4 -0
  5. data/app/assets/stylesheets/phcpress/modules/connections.scss +3 -0
  6. data/app/assets/stylesheets/scaffolds.scss +89 -0
  7. data/app/controllers/phcpress/application_controller.rb +0 -7
  8. data/app/controllers/phcpress/articles/posts_controller.rb +68 -0
  9. data/app/controllers/phcpress/modules/categories_controller.rb +7 -9
  10. data/app/controllers/phcpress/modules/connections_controller.rb +66 -0
  11. data/app/helpers/phcpress/modules/connections_helper.rb +4 -0
  12. data/app/models/phcpress/{news.rb → articles.rb} +2 -2
  13. data/app/models/phcpress/articles/post.rb +12 -0
  14. data/app/models/phcpress/modules/category.rb +4 -0
  15. data/app/models/phcpress/modules/connection.rb +9 -0
  16. data/app/views/layouts/phcpress/application.html.erb +1 -3
  17. data/app/views/phcpress/{blog → articles}/posts/_form.html.erb +24 -14
  18. data/app/views/phcpress/articles/posts/edit.html.erb +2 -0
  19. data/app/views/phcpress/articles/posts/index.html.erb +42 -0
  20. data/app/views/phcpress/articles/posts/new.html.erb +2 -0
  21. data/app/views/phcpress/articles/posts/show.html.erb +4 -0
  22. data/app/views/phcpress/modules/categories/index.html.erb +2 -2
  23. data/app/views/phcpress/modules/connections/_form.html.erb +27 -0
  24. data/app/views/phcpress/modules/connections/edit.html.erb +6 -0
  25. data/app/views/phcpress/modules/connections/index.html.erb +29 -0
  26. data/app/views/phcpress/modules/connections/new.html.erb +5 -0
  27. data/app/views/phcpress/modules/connections/show.html.erb +14 -0
  28. data/config/routes.rb +7 -9
  29. data/db/migrate/20160716182848_create_phcpress_modules_categories.rb +8 -8
  30. data/db/migrate/20160720181307_create_phcpress_articles_posts.rb +15 -0
  31. data/db/migrate/20160720235314_create_phcpress_modules_connections.rb +10 -0
  32. data/lib/phcpress/version.rb +1 -1
  33. metadata +24 -21
  34. data/app/controllers/phcpress/blog/posts_controller.rb +0 -75
  35. data/app/controllers/phcpress/news/posts_controller.rb +0 -70
  36. data/app/models/phcpress/blog.rb +0 -7
  37. data/app/models/phcpress/blog/post.rb +0 -8
  38. data/app/models/phcpress/news/post.rb +0 -10
  39. data/app/views/phcpress/blog/posts/edit.html.erb +0 -12
  40. data/app/views/phcpress/blog/posts/index.html.erb +0 -42
  41. data/app/views/phcpress/blog/posts/new.html.erb +0 -12
  42. data/app/views/phcpress/blog/posts/show.html.erb +0 -4
  43. data/app/views/phcpress/news/posts/_form.html.erb +0 -72
  44. data/app/views/phcpress/news/posts/edit.html.erb +0 -12
  45. data/app/views/phcpress/news/posts/index.html.erb +0 -37
  46. data/app/views/phcpress/news/posts/new.html.erb +0 -12
  47. data/app/views/phcpress/news/posts/show.html.erb +0 -4
  48. data/db/migrate/20160716182441_create_phcpress_news_posts.rb +0 -18
  49. data/db/migrate/20160716182510_create_phcpress_blog_posts.rb +0 -18
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f51ee17fa7b7216e9d8acee8cf62dd32e5e0050e
4
- data.tar.gz: 62595f2af30b49c4437e0139c6fc18bfc6e472f5
3
+ metadata.gz: bbc269366d81527369f7b9587a583cda84c973f8
4
+ data.tar.gz: 594aeff4503c50fabe4ce714c61c03b88c994229
5
5
  SHA512:
6
- metadata.gz: 7e641049a74ba00b09807b55a05b53d303eb01c815dcbe97b412313d688f230e0ae17fd5658c346efd8756b5312ecb7dde7e5367ab5f8ef1e9f1e052e2a00d29
7
- data.tar.gz: 79bd5162c729e5bfe1ae6a6df892eb7a5984adcc75abca37013a57b0a3f787dc78b2620c46c64255fe4e1e87a38d6e81e128d92d9ea55286c78628e8b91b5a32
6
+ metadata.gz: de9aeece950c6456fc9c797151a071bec57a50de375468b8a5654af7d5f0064a63e51856a4d01ee40aafae3a039558f1107ce5fd60f87d8ed91755861694f201
7
+ data.tar.gz: 8b25b3934796402f5bc18cb4590f159f2f2e239637560395f6f1ef879c1c42b9b904cd75f3b1b16dd322ba513d66260fdd560935715705fe303a73af5ed8394a
data/README.md CHANGED
@@ -3,12 +3,12 @@
3
3
  [![Issue Count](https://codeclimate.com/github/PHCNetworks/phc-press/badges/issue_count.svg)](https://codeclimate.com/github/PHCNetworks/phc-press)
4
4
  [![Gem Version](https://badge.fury.io/rb/phcpress.svg)](https://badge.fury.io/rb/phcpress)
5
5
 
6
- ### PHCPress(4) (Blog & News Post Engine) Documentation
6
+ ### PHCPress(5) (Blog & News Post Engine) Documentation
7
7
  PHCPress is a basic open source news & blog engine.
8
8
 
9
9
  #### Step 1 - Add PHCPress Engine to your gemfile
10
10
 
11
- gem 'phcpress', '~> 3.8', '>= 3.8.5'
11
+ gem 'phcpress', '~> 4.0'
12
12
  bundle exec install
13
13
 
14
14
  #### Step 2 - Copy over database migration files
@@ -17,7 +17,7 @@ PHCPress is a basic open source news & blog engine.
17
17
  rake db:migrate
18
18
 
19
19
  #### Step 3 - Recompile Assets
20
- PHCPress included Virws & UI requires bootstrap and fontawesome.
20
+ PHCPress included Views & UI requires bootstrap and FontAwesome.
21
21
 
22
22
  rake assets:clobber
23
23
  rake assets:precompile
@@ -27,4 +27,3 @@ PHCPress default Carrierwave settings can be overwritten (suggested).
27
27
 
28
28
  - [How to Override PHCPress Uploader](https://github.com/PHCNetworks/phc-press/wiki/Image-Uploader---Override)
29
29
  - [How to Override - Cloudinary Example](https://github.com/PHCNetworks/phc-press/wiki/Image-Uploader-(Cloudinary))
30
- -
@@ -0,0 +1,2 @@
1
+ // Place all the behaviors and hooks related to the matching controller here.
2
+ // All this logic will automatically be available in application.js.
@@ -0,0 +1,4 @@
1
+ // Top Padding Override
2
+ .container {
3
+ padding-top:40px;
4
+ }
@@ -0,0 +1,3 @@
1
+ // Place all the styles related to the modules::connections controller here.
2
+ // They will automatically be included in application.css.
3
+ // You can use Sass (SCSS) here: http://sass-lang.com/
@@ -0,0 +1,89 @@
1
+ body {
2
+ background-color: #fff;
3
+ color: #333;
4
+ font-family: verdana, arial, helvetica, sans-serif;
5
+ font-size: 13px;
6
+ line-height: 18px;
7
+ margin: 33px;
8
+ }
9
+
10
+ p, ol, ul, td {
11
+ font-family: verdana, arial, helvetica, sans-serif;
12
+ font-size: 13px;
13
+ line-height: 18px;
14
+ margin: 33px;
15
+ }
16
+
17
+ pre {
18
+ background-color: #eee;
19
+ padding: 10px;
20
+ font-size: 11px;
21
+ }
22
+
23
+ a {
24
+ color: #000;
25
+
26
+ &:visited {
27
+ color: #666;
28
+ }
29
+
30
+ &:hover {
31
+ color: #fff;
32
+ background-color: #000;
33
+ }
34
+ }
35
+
36
+ th {
37
+ padding-bottom: 5px;
38
+ }
39
+
40
+ td {
41
+ padding-bottom: 7px;
42
+ padding-left: 5px;
43
+ padding-right: 5px;
44
+ }
45
+
46
+ div {
47
+ &.field, &.actions {
48
+ margin-bottom: 10px;
49
+ }
50
+ }
51
+
52
+ #notice {
53
+ color: green;
54
+ }
55
+
56
+ .field_with_errors {
57
+ padding: 2px;
58
+ background-color: red;
59
+ display: table;
60
+ }
61
+
62
+ #error_explanation {
63
+ width: 450px;
64
+ border: 2px solid red;
65
+ padding: 7px;
66
+ padding-bottom: 0;
67
+ margin-bottom: 20px;
68
+ background-color: #f0f0f0;
69
+
70
+ h2 {
71
+ text-align: left;
72
+ font-weight: bold;
73
+ padding: 5px 5px 5px 15px;
74
+ font-size: 12px;
75
+ margin: -7px;
76
+ margin-bottom: 0;
77
+ background-color: #c00;
78
+ color: #fff;
79
+ }
80
+
81
+ ul li {
82
+ font-size: 12px;
83
+ list-style: square;
84
+ }
85
+ }
86
+
87
+ label {
88
+ display: block;
89
+ }
@@ -2,14 +2,7 @@ module Phcpress
2
2
  class ApplicationController < ActionController::Base
3
3
 
4
4
  # Prevent CSRF attacks by raising an exception.
5
- before_action :authenticate_user!, if: -> { defined?(Devise) }
6
5
  protect_from_forgery with: :exception
7
-
8
- # Current User
9
- def current_user
10
- return unless session[:user_id]
11
- @current_user ||= User.find(session[:user_id])
12
- end
13
6
 
14
7
  # Load Helpers
15
8
  helper Phctitleseo::Engine.helpers
@@ -0,0 +1,68 @@
1
+ require_dependency "phcpress/application_controller"
2
+
3
+ module Phcpress
4
+ class Articles::PostsController < ApplicationController
5
+
6
+ # Filters & Security
7
+ before_action :set_articles_post, only: [:show, :edit, :update, :destroy]
8
+
9
+ # Article Index
10
+ def index
11
+ @articles_posts = Articles::Post.all
12
+ end
13
+
14
+ # Article Show
15
+ def show
16
+ end
17
+
18
+ # Article New
19
+ def new
20
+ @articles_post = Articles::Post.new
21
+
22
+ end
23
+
24
+ # Article Edit
25
+ def edit
26
+ end
27
+
28
+ # POST
29
+ def create
30
+ @articles_post = Articles::Post.new(articles_post_params)
31
+ if @articles_post.save
32
+ @articles_post.connections.build
33
+ redirect_to articles_posts_url, notice: 'Post was successfully created.'
34
+ else
35
+ render :new
36
+ end
37
+ end
38
+
39
+ # PATCH/PUT
40
+ def update
41
+ if @articles_post.update(articles_post_params)
42
+ @articles_post.connections.build
43
+ redirect_to articles_posts_url, notice: 'Post was successfully updated.'
44
+ else
45
+ render :edit
46
+ end
47
+ end
48
+
49
+ # DELETE
50
+ def destroy
51
+ @articles_post.destroy
52
+ redirect_to articles_posts_url, notice: 'Post was successfully destroyed.'
53
+ end
54
+
55
+ private
56
+
57
+ # Common Callbacks
58
+ def set_articles_post
59
+ @articles_post = Articles::Post.find(params[:id])
60
+ end
61
+
62
+ # Params Whitelist
63
+ def articles_post_params
64
+ params.require(:articles_post).permit(:psttitle, :psttext, :pstexcerpts, :pststatus, :pstimage, :remove_pstimage, category_ids: [])
65
+ end
66
+
67
+ end
68
+ end
@@ -4,8 +4,6 @@ module Phcpress
4
4
  class Modules::CategoriesController < ApplicationController
5
5
 
6
6
  # Security and Filters
7
- layout 'layouts/phcpress/category/category_layout'
8
- before_action :authenticate_user!
9
7
  before_action :set_modules_category, only: [:show, :edit, :update, :destroy]
10
8
 
11
9
  # Categories Index
@@ -13,20 +11,20 @@ module Phcpress
13
11
  @modules_categories = Modules::Category.all
14
12
  end
15
13
 
16
- # Detail News/Blog Category
14
+ # Categories Show
17
15
  def show
18
16
  end
19
17
 
20
- # New News/Blog Category
18
+ # Categories New
21
19
  def new
22
20
  @modules_category = Modules::Category.new
23
21
  end
24
22
 
25
- # Edit News/Blog Category
23
+ # Categories Edit
26
24
  def edit
27
25
  end
28
26
 
29
- # Create News/Blog Category
27
+ # POST
30
28
  def create
31
29
  @modules_category = Modules::Category.new(modules_category_params)
32
30
 
@@ -37,7 +35,7 @@ module Phcpress
37
35
  end
38
36
  end
39
37
 
40
- # Update News/Blog Category
38
+ # PATCH/PUT
41
39
  def update
42
40
  if @modules_category.update(modules_category_params)
43
41
  redirect_to modules_categories_url, notice: 'Category was successfully updated.'
@@ -46,7 +44,7 @@ module Phcpress
46
44
  end
47
45
  end
48
46
 
49
- # Delete News/Blog Category
47
+ # DELETE
50
48
  def destroy
51
49
  @modules_category.destroy
52
50
  redirect_to modules_categories_url, notice: 'Category was successfully destroyed.'
@@ -61,7 +59,7 @@ module Phcpress
61
59
 
62
60
  # Whitelist
63
61
  def modules_category_params
64
- params.require(:modules_category).permit(:catname, :user_id)
62
+ params.require(:modules_category).permit(:catname)
65
63
  end
66
64
 
67
65
  end
@@ -0,0 +1,66 @@
1
+ require_dependency "phcpress/application_controller"
2
+
3
+ module Phcpress
4
+ class Modules::ConnectionsController < ApplicationController
5
+
6
+ # Security and Filters
7
+ before_action :set_modules_connection, only: [:show, :edit, :update, :destroy]
8
+
9
+ # Connections Index
10
+ def index
11
+ @modules_connections = Modules::Connection.all
12
+ end
13
+
14
+ # Connections Show
15
+ def show
16
+ end
17
+
18
+ # Connections New
19
+ def new
20
+ @modules_connection = Modules::Connection.new
21
+ end
22
+
23
+ # Connections Edit
24
+ def edit
25
+ end
26
+
27
+ # POST
28
+ def create
29
+ @modules_connection = Modules::Connection.new(modules_connection_params)
30
+
31
+ if @modules_connection.save
32
+ redirect_to modules_connections_url, notice: 'Connection was successfully created.'
33
+ else
34
+ render :new
35
+ end
36
+ end
37
+
38
+ # PATCH/PUT
39
+ def update
40
+ if @modules_connection.update(modules_connection_params)
41
+ redirect_to modules_connections_url, notice: 'Connection was successfully updated.'
42
+ else
43
+ render :edit
44
+ end
45
+ end
46
+
47
+ # DELETE
48
+ def destroy
49
+ @modules_connection.destroy
50
+ redirect_to modules_connections_url, notice: 'Connection was successfully destroyed.'
51
+ end
52
+
53
+ private
54
+
55
+ # Use callbacks to share common setup or constraints between actions.
56
+ def set_modules_connection
57
+ @modules_connection = Modules::Connection.find(params[:id])
58
+ end
59
+
60
+ # Only allow a trusted parameter "white list" through.
61
+ def modules_connection_params
62
+ params.require(:modules_connection).permit(:post_id, :category_id)
63
+ end
64
+
65
+ end
66
+ end
@@ -0,0 +1,4 @@
1
+ module Phcpress
2
+ module Modules::ConnectionsHelper
3
+ end
4
+ end
@@ -1,7 +1,7 @@
1
1
  module Phcpress
2
- module News
2
+ module Articles
3
3
  def self.table_name_prefix
4
- 'phcpress_news_'
4
+ 'phcpress_articles_'
5
5
  end
6
6
  end
7
7
  end
@@ -0,0 +1,12 @@
1
+ module Phcpress
2
+ class Articles::Post < ApplicationRecord
3
+
4
+ # For Image Uploads
5
+ mount_uploader :pstimage, Phcpress::PstimageUploader
6
+
7
+ # Relationships
8
+ has_many :connections, class_name: 'Modules::Connection'
9
+ has_many :categories, class_name: 'Modules::Category', :through => :connections
10
+
11
+ end
12
+ end
@@ -1,5 +1,9 @@
1
1
  module Phcpress
2
2
  class Modules::Category < ApplicationRecord
3
3
 
4
+ # Relationships
5
+ has_many :connections, class_name: 'Modules::Connection'
6
+ has_many :posts, class_name: 'Modules::Category', :through => :connections
7
+
4
8
  end
5
9
  end
@@ -0,0 +1,9 @@
1
+ module Phcpress
2
+ class Modules::Connection < ApplicationRecord
3
+
4
+ # Relationships
5
+ belongs_to :post, class_name: 'Articles::Post'
6
+ belongs_to :category, class_name: 'Modules::Category'
7
+
8
+ end
9
+ end
@@ -12,9 +12,7 @@
12
12
 
13
13
  <body>
14
14
  <div class="container">
15
- <div class="row">
16
- <%= yield %>
17
- </div>
15
+ <%= yield %>
18
16
  </div>
19
17
  </body>
20
18
 
@@ -1,8 +1,8 @@
1
1
  <div class="row">
2
- <%= form_for(@blog_post, :html => {:multipart => true}) do |f| %>
2
+ <%= form_for(@articles_post, :html => {:multipart => true}) do |f| %>
3
3
 
4
4
  <!-- PHC-Notifi Render Validation -->
5
- <%= render 'phcnotifi/validations', :object => @blog_post %>
5
+ <%= render 'phcnotifi/validations', :object => @articles_post %>
6
6
 
7
7
  <div class="col-md-3">
8
8
 
@@ -15,12 +15,8 @@
15
15
  <%= f.label :pststatus, "Post Status" %>
16
16
  <%= f.select( :pststatus, [['Draft','draft'],['Publish','publish'],['Review','review']], {}, {class: "form-control form-control-sm"}) %>
17
17
  </div>
18
- <div class="form-group">
19
- <%= f.label :pstcategory, "Post Category" %>
20
- <%= collection_select(:pstcategory, :pstcategory_id, Phcpress::Modules::Category.order('catname'), :id, :catname, {}, {class: "form-control form-control-sm"}) %>
21
- </div>
22
18
  <div class="actions">
23
- <%= f.submit "Publish Blog Article", class: "btn btn-primary btn-sm" %>
19
+ <%= f.submit "Publish", class: "btn btn-primary btn-sm" %>
24
20
  </div>
25
21
  </div>
26
22
  </div>
@@ -31,7 +27,7 @@
31
27
  </div>
32
28
  <div class="panel-body">
33
29
  <div class="form-group">
34
- <label><%= f.label :pstimage, "Featured Image" %></label>
30
+ <%= f.label :pstimage, "Featured Image" %>
35
31
  <%= f.file_field :pstimage, class: "form-control" %>
36
32
  </div>
37
33
  <% if f.object.pstimage? %>
@@ -42,6 +38,20 @@
42
38
  </div>
43
39
  </div>
44
40
 
41
+ <div class="panel panel-primary">
42
+ <div class="panel-heading">
43
+ <i class="fa fa-sitemap"></i> Post Categories & Tags
44
+ </div>
45
+ <div class="panel-body">
46
+ <div class="form-group">
47
+ <%= f.collection_check_boxes :category_ids, Phcpress::Modules::Category.all, :id, :catname do |post_category| %>
48
+ <%= post_category.check_box %>
49
+ <%= post_category.label %></br>
50
+ <% end %>
51
+ </div>
52
+ </div>
53
+ </div>
54
+
45
55
  </div>
46
56
 
47
57
  <div class="col-md-9 ">
@@ -52,16 +62,16 @@
52
62
  </div>
53
63
  <div class="panel-body">
54
64
  <div class="form-group">
55
- <label><%= f.label :blogpsttitle, "Title" %></label>
56
- <%= f.text_field :blogpsttitle, class: "form-control" %>
65
+ <%= f.label :psttitle, "Title" %>
66
+ <%= f.text_field :psttitle, class: "form-control" %>
57
67
  </div>
58
68
  <div class="form-group">
59
- <label><%= f.label :blogpsttext, "Text" %></label>
60
- <%= f.text_area :blogpsttext, class: "form-control" %>
69
+ <%= f.label :psttext, "Text" %>
70
+ <%= f.text_area :psttext, class: "form-control" %>
61
71
  </div>
62
72
  <div class="form-group">
63
- <label><%= f.label :blogpstexcerpts, "Excerpts/Text Leads" %></label>
64
- <%= f.text_area :blogpstexcerpts, class: "form-control" %>
73
+ <%= f.label :pstexcerpts, "Excerpts/Text Leads" %>
74
+ <%= f.text_area :pstexcerpts, class: "form-control" %>
65
75
  </div>
66
76
  </div>
67
77
  </div>