phcpress 4.0.0 → 5.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -4
- data/app/assets/javascripts/phcpress/modules/connections.js +2 -0
- data/app/assets/stylesheets/phcpress/_custom.scss +4 -0
- data/app/assets/stylesheets/phcpress/modules/connections.scss +3 -0
- data/app/assets/stylesheets/scaffolds.scss +89 -0
- data/app/controllers/phcpress/application_controller.rb +0 -7
- data/app/controllers/phcpress/articles/posts_controller.rb +68 -0
- data/app/controllers/phcpress/modules/categories_controller.rb +7 -9
- data/app/controllers/phcpress/modules/connections_controller.rb +66 -0
- data/app/helpers/phcpress/modules/connections_helper.rb +4 -0
- data/app/models/phcpress/{news.rb → articles.rb} +2 -2
- data/app/models/phcpress/articles/post.rb +12 -0
- data/app/models/phcpress/modules/category.rb +4 -0
- data/app/models/phcpress/modules/connection.rb +9 -0
- data/app/views/layouts/phcpress/application.html.erb +1 -3
- data/app/views/phcpress/{blog → articles}/posts/_form.html.erb +24 -14
- data/app/views/phcpress/articles/posts/edit.html.erb +2 -0
- data/app/views/phcpress/articles/posts/index.html.erb +42 -0
- data/app/views/phcpress/articles/posts/new.html.erb +2 -0
- data/app/views/phcpress/articles/posts/show.html.erb +4 -0
- data/app/views/phcpress/modules/categories/index.html.erb +2 -2
- data/app/views/phcpress/modules/connections/_form.html.erb +27 -0
- data/app/views/phcpress/modules/connections/edit.html.erb +6 -0
- data/app/views/phcpress/modules/connections/index.html.erb +29 -0
- data/app/views/phcpress/modules/connections/new.html.erb +5 -0
- data/app/views/phcpress/modules/connections/show.html.erb +14 -0
- data/config/routes.rb +7 -9
- data/db/migrate/20160716182848_create_phcpress_modules_categories.rb +8 -8
- data/db/migrate/20160720181307_create_phcpress_articles_posts.rb +15 -0
- data/db/migrate/20160720235314_create_phcpress_modules_connections.rb +10 -0
- data/lib/phcpress/version.rb +1 -1
- metadata +24 -21
- data/app/controllers/phcpress/blog/posts_controller.rb +0 -75
- data/app/controllers/phcpress/news/posts_controller.rb +0 -70
- data/app/models/phcpress/blog.rb +0 -7
- data/app/models/phcpress/blog/post.rb +0 -8
- data/app/models/phcpress/news/post.rb +0 -10
- data/app/views/phcpress/blog/posts/edit.html.erb +0 -12
- data/app/views/phcpress/blog/posts/index.html.erb +0 -42
- data/app/views/phcpress/blog/posts/new.html.erb +0 -12
- data/app/views/phcpress/blog/posts/show.html.erb +0 -4
- data/app/views/phcpress/news/posts/_form.html.erb +0 -72
- data/app/views/phcpress/news/posts/edit.html.erb +0 -12
- data/app/views/phcpress/news/posts/index.html.erb +0 -37
- data/app/views/phcpress/news/posts/new.html.erb +0 -12
- data/app/views/phcpress/news/posts/show.html.erb +0 -4
- data/db/migrate/20160716182441_create_phcpress_news_posts.rb +0 -18
- 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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bbc269366d81527369f7b9587a583cda84c973f8
|
4
|
+
data.tar.gz: 594aeff4503c50fabe4ce714c61c03b88c994229
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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(
|
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', '~>
|
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
|
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,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
|
-
#
|
14
|
+
# Categories Show
|
17
15
|
def show
|
18
16
|
end
|
19
17
|
|
20
|
-
# New
|
18
|
+
# Categories New
|
21
19
|
def new
|
22
20
|
@modules_category = Modules::Category.new
|
23
21
|
end
|
24
22
|
|
25
|
-
# Edit
|
23
|
+
# Categories Edit
|
26
24
|
def edit
|
27
25
|
end
|
28
26
|
|
29
|
-
#
|
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
|
-
#
|
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
|
-
#
|
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
|
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,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,8 +1,8 @@
|
|
1
1
|
<div class="row">
|
2
|
-
<%= form_for(@
|
2
|
+
<%= form_for(@articles_post, :html => {:multipart => true}) do |f| %>
|
3
3
|
|
4
4
|
<!-- PHC-Notifi Render Validation -->
|
5
|
-
<%= render 'phcnotifi/validations', :object => @
|
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
|
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
|
-
|
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
|
-
|
56
|
-
<%= f.text_field :
|
65
|
+
<%= f.label :psttitle, "Title" %>
|
66
|
+
<%= f.text_field :psttitle, class: "form-control" %>
|
57
67
|
</div>
|
58
68
|
<div class="form-group">
|
59
|
-
|
60
|
-
<%= f.text_area :
|
69
|
+
<%= f.label :psttext, "Text" %>
|
70
|
+
<%= f.text_area :psttext, class: "form-control" %>
|
61
71
|
</div>
|
62
72
|
<div class="form-group">
|
63
|
-
|
64
|
-
<%= f.text_area :
|
73
|
+
<%= f.label :pstexcerpts, "Excerpts/Text Leads" %>
|
74
|
+
<%= f.text_area :pstexcerpts, class: "form-control" %>
|
65
75
|
</div>
|
66
76
|
</div>
|
67
77
|
</div>
|