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
@@ -0,0 +1,42 @@
|
|
1
|
+
<!-- Main Content -->
|
2
|
+
<div class="wrapper wrapper-content">
|
3
|
+
<div class="panel panel-primary">
|
4
|
+
|
5
|
+
<div class="panel-heading">
|
6
|
+
<i class="fa fa-pencil-square-o"></i> Article List
|
7
|
+
</div>
|
8
|
+
|
9
|
+
<div class="panel-body">
|
10
|
+
|
11
|
+
<table class="table table-bordered table-striped table-hover">
|
12
|
+
|
13
|
+
<thead>
|
14
|
+
<tr>
|
15
|
+
<th>Title</th>
|
16
|
+
<th>Text Preview</th>
|
17
|
+
<th>Article Status</th>
|
18
|
+
<th></th>
|
19
|
+
</tr>
|
20
|
+
</thead>
|
21
|
+
|
22
|
+
<tbody>
|
23
|
+
<% @articles_posts.each do |articles_post| %>
|
24
|
+
<tr>
|
25
|
+
<td><%= articles_post.psttitle %></td>
|
26
|
+
<td><%= truncate(articles_post.psttext, :length => 80) %></td>
|
27
|
+
<td><%= articles_post.pststatus %></td>
|
28
|
+
<td><div class="btn-group" role="group" aria-label="Blog Articles">
|
29
|
+
<%= link_to 'Edit', edit_articles_post_path(articles_post), class: "btn btn-primary btn-xs" %>
|
30
|
+
<%= link_to 'Trash', articles_post, class: "btn btn-danger btn-xs", method: :delete, data: { confirm: 'Are you sure?' } %>
|
31
|
+
</div></td>
|
32
|
+
</tr>
|
33
|
+
<% end %>
|
34
|
+
</tbody>
|
35
|
+
|
36
|
+
</table>
|
37
|
+
|
38
|
+
<%= link_to 'New Blog Post', new_articles_post_path, class: "btn btn-primary" %>
|
39
|
+
</div>
|
40
|
+
|
41
|
+
</div>
|
42
|
+
</div>
|
@@ -17,11 +17,11 @@
|
|
17
17
|
</thead>
|
18
18
|
|
19
19
|
<tbody>
|
20
|
-
<% @
|
20
|
+
<% @modules_categories.each do |modules_category| %>
|
21
21
|
<tr>
|
22
22
|
<td><%= modules_category.catname %></td>
|
23
23
|
<td><div class="btn-group" role="group" aria-label="Blog Articles">
|
24
|
-
<%= link_to 'Edit', edit_modules_category_path(
|
24
|
+
<%= link_to 'Edit', edit_modules_category_path(modules_category) , class: "btn btn-primary btn-xs" %>
|
25
25
|
<%= link_to 'Trash', modules_category, class: "btn btn-danger btn-xs", method: :delete, data: { confirm: 'Are you sure?' } %>
|
26
26
|
</div>
|
27
27
|
</td>
|
@@ -0,0 +1,27 @@
|
|
1
|
+
<%= form_for(modules_connection) do |f| %>
|
2
|
+
<% if modules_connection.errors.any? %>
|
3
|
+
<div id="error_explanation">
|
4
|
+
<h2><%= pluralize(modules_connection.errors.count, "error") %> prohibited this modules_connection from being saved:</h2>
|
5
|
+
|
6
|
+
<ul>
|
7
|
+
<% modules_connection.errors.full_messages.each do |message| %>
|
8
|
+
<li><%= message %></li>
|
9
|
+
<% end %>
|
10
|
+
</ul>
|
11
|
+
</div>
|
12
|
+
<% end %>
|
13
|
+
|
14
|
+
<div class="field">
|
15
|
+
<%= f.label :post_id %>
|
16
|
+
<%= f.text_field :post_id %>
|
17
|
+
</div>
|
18
|
+
|
19
|
+
<div class="field">
|
20
|
+
<%= f.label :category_id %>
|
21
|
+
<%= f.text_field :category_id %>
|
22
|
+
</div>
|
23
|
+
|
24
|
+
<div class="actions">
|
25
|
+
<%= f.submit %>
|
26
|
+
</div>
|
27
|
+
<% end %>
|
@@ -0,0 +1,29 @@
|
|
1
|
+
<p id="notice"><%= notice %></p>
|
2
|
+
|
3
|
+
<h1>Modules Connections</h1>
|
4
|
+
|
5
|
+
<table>
|
6
|
+
<thead>
|
7
|
+
<tr>
|
8
|
+
<th>Post</th>
|
9
|
+
<th>Category</th>
|
10
|
+
<th colspan="3"></th>
|
11
|
+
</tr>
|
12
|
+
</thead>
|
13
|
+
|
14
|
+
<tbody>
|
15
|
+
<% @modules_connections.each do |modules_connection| %>
|
16
|
+
<tr>
|
17
|
+
<td><%= modules_connection.post %></td>
|
18
|
+
<td><%= modules_connection.category %></td>
|
19
|
+
<td><%= link_to 'Show', modules_connection %></td>
|
20
|
+
<td><%= link_to 'Edit', edit_modules_connection_path(modules_connection) %></td>
|
21
|
+
<td><%= link_to 'Destroy', modules_connection, method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
22
|
+
</tr>
|
23
|
+
<% end %>
|
24
|
+
</tbody>
|
25
|
+
</table>
|
26
|
+
|
27
|
+
<br>
|
28
|
+
|
29
|
+
<%= link_to 'New Modules Connection', new_modules_connection_path %>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<p id="notice"><%= notice %></p>
|
2
|
+
|
3
|
+
<p>
|
4
|
+
<strong>Post:</strong>
|
5
|
+
<%= @modules_connection.post %>
|
6
|
+
</p>
|
7
|
+
|
8
|
+
<p>
|
9
|
+
<strong>Category:</strong>
|
10
|
+
<%= @modules_connection.category %>
|
11
|
+
</p>
|
12
|
+
|
13
|
+
<%= link_to 'Edit', edit_modules_connection_path(@modules_connection) %> |
|
14
|
+
<%= link_to 'Back', modules_connections_path %>
|
data/config/routes.rb
CHANGED
@@ -1,16 +1,14 @@
|
|
1
1
|
Phcpress::Engine.routes.draw do
|
2
2
|
|
3
|
-
#
|
4
|
-
namespace :
|
5
|
-
resources :posts, class_name: '
|
3
|
+
# Article Routes
|
4
|
+
namespace :articles do
|
5
|
+
resources :posts, class_name: 'Articles::Post'
|
6
6
|
end
|
7
7
|
|
8
|
-
#
|
9
|
-
namespace :
|
10
|
-
resources :
|
8
|
+
# Module Routes
|
9
|
+
namespace :modules do
|
10
|
+
resources :connections, class_name: 'Modules::Connection'
|
11
|
+
resources :categories, class_name: 'Modules::Category'
|
11
12
|
end
|
12
13
|
|
13
|
-
# Categories
|
14
|
-
resources :categories, class_name: 'Phcpress::Modules::Category'
|
15
|
-
|
16
14
|
end
|
@@ -1,11 +1,11 @@
|
|
1
1
|
class CreatePhcpressModulesCategories < ActiveRecord::Migration[5.0]
|
2
|
-
|
3
|
-
|
2
|
+
def change
|
3
|
+
create_table :phcpress_modules_categories do |t|
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
t.timestamps null: false
|
5
|
+
t.string :catname
|
8
6
|
|
9
|
-
|
10
|
-
|
11
|
-
end
|
7
|
+
t.timestamps
|
8
|
+
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class CreatePhcpressArticlesPosts < ActiveRecord::Migration[5.0]
|
2
|
+
def change
|
3
|
+
create_table :phcpress_articles_posts do |t|
|
4
|
+
|
5
|
+
t.string :psttitle
|
6
|
+
t.text :psttext
|
7
|
+
t.string :pststatus
|
8
|
+
t.text :pstexcerpts
|
9
|
+
t.string :pstimage
|
10
|
+
|
11
|
+
t.timestamps
|
12
|
+
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
data/lib/phcpress/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: phcpress
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 5.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- BradPotts
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-07-
|
11
|
+
date: 2016-07-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -500,7 +500,7 @@ dependencies:
|
|
500
500
|
- - ">="
|
501
501
|
- !ruby/object:Gem::Version
|
502
502
|
version: 2.53.4
|
503
|
-
description: PHCPress(
|
503
|
+
description: PHCPress(5) is a basic open source news & blog engine.
|
504
504
|
email:
|
505
505
|
- developers@phcnetworks.net
|
506
506
|
executables: []
|
@@ -512,43 +512,46 @@ files:
|
|
512
512
|
- Rakefile
|
513
513
|
- app/assets/config/phcpress_manifest.js
|
514
514
|
- app/assets/javascripts/phcpress/application.js
|
515
|
+
- app/assets/javascripts/phcpress/modules/connections.js
|
515
516
|
- app/assets/stylesheets/phcpress/_custom.scss
|
516
517
|
- app/assets/stylesheets/phcpress/application.scss
|
518
|
+
- app/assets/stylesheets/phcpress/modules/connections.scss
|
519
|
+
- app/assets/stylesheets/scaffolds.scss
|
517
520
|
- app/controllers/phcpress/application_controller.rb
|
518
|
-
- app/controllers/phcpress/
|
521
|
+
- app/controllers/phcpress/articles/posts_controller.rb
|
519
522
|
- app/controllers/phcpress/modules/categories_controller.rb
|
520
|
-
- app/controllers/phcpress/
|
523
|
+
- app/controllers/phcpress/modules/connections_controller.rb
|
521
524
|
- app/helpers/phcpress/application_helper.rb
|
525
|
+
- app/helpers/phcpress/modules/connections_helper.rb
|
522
526
|
- app/jobs/phcpress/application_job.rb
|
523
527
|
- app/mailers/phcpress/application_mailer.rb
|
524
528
|
- app/models/phcpress/application_record.rb
|
525
|
-
- app/models/phcpress/
|
526
|
-
- app/models/phcpress/
|
529
|
+
- app/models/phcpress/articles.rb
|
530
|
+
- app/models/phcpress/articles/post.rb
|
527
531
|
- app/models/phcpress/modules.rb
|
528
532
|
- app/models/phcpress/modules/category.rb
|
529
|
-
- app/models/phcpress/
|
530
|
-
- app/models/phcpress/news/post.rb
|
533
|
+
- app/models/phcpress/modules/connection.rb
|
531
534
|
- app/uploaders/phcpress/pstimage_uploader.rb
|
532
535
|
- app/views/layouts/phcpress/application.html.erb
|
533
|
-
- app/views/phcpress/
|
534
|
-
- app/views/phcpress/
|
535
|
-
- app/views/phcpress/
|
536
|
-
- app/views/phcpress/
|
537
|
-
- app/views/phcpress/
|
536
|
+
- app/views/phcpress/articles/posts/_form.html.erb
|
537
|
+
- app/views/phcpress/articles/posts/edit.html.erb
|
538
|
+
- app/views/phcpress/articles/posts/index.html.erb
|
539
|
+
- app/views/phcpress/articles/posts/new.html.erb
|
540
|
+
- app/views/phcpress/articles/posts/show.html.erb
|
538
541
|
- app/views/phcpress/modules/categories/_form.html.erb
|
539
542
|
- app/views/phcpress/modules/categories/edit.html.erb
|
540
543
|
- app/views/phcpress/modules/categories/index.html.erb
|
541
544
|
- app/views/phcpress/modules/categories/new.html.erb
|
542
545
|
- app/views/phcpress/modules/categories/show.html.erb
|
543
|
-
- app/views/phcpress/
|
544
|
-
- app/views/phcpress/
|
545
|
-
- app/views/phcpress/
|
546
|
-
- app/views/phcpress/
|
547
|
-
- app/views/phcpress/
|
546
|
+
- app/views/phcpress/modules/connections/_form.html.erb
|
547
|
+
- app/views/phcpress/modules/connections/edit.html.erb
|
548
|
+
- app/views/phcpress/modules/connections/index.html.erb
|
549
|
+
- app/views/phcpress/modules/connections/new.html.erb
|
550
|
+
- app/views/phcpress/modules/connections/show.html.erb
|
548
551
|
- config/routes.rb
|
549
|
-
- db/migrate/20160716182441_create_phcpress_news_posts.rb
|
550
|
-
- db/migrate/20160716182510_create_phcpress_blog_posts.rb
|
551
552
|
- db/migrate/20160716182848_create_phcpress_modules_categories.rb
|
553
|
+
- db/migrate/20160720181307_create_phcpress_articles_posts.rb
|
554
|
+
- db/migrate/20160720235314_create_phcpress_modules_connections.rb
|
552
555
|
- lib/phcpress.rb
|
553
556
|
- lib/phcpress/engine.rb
|
554
557
|
- lib/phcpress/version.rb
|
@@ -1,75 +0,0 @@
|
|
1
|
-
# Load General Controller for Engine
|
2
|
-
require_dependency "phcpress/application_controller"
|
3
|
-
|
4
|
-
# Code for Blog Posting
|
5
|
-
module Phcpress
|
6
|
-
class Blog::PostsController < ApplicationController
|
7
|
-
|
8
|
-
# Filters & Security
|
9
|
-
#layout 'layouts/phcpress/blogpost/blog_layout'
|
10
|
-
#before_action :authenticate_user!
|
11
|
-
before_action :set_blog_post, only: [:edit, :update, :destroy]
|
12
|
-
|
13
|
-
# Blog Post Index (/blog/posts)
|
14
|
-
def index
|
15
|
-
@blog_posts = Blog::Post.all
|
16
|
-
end
|
17
|
-
|
18
|
-
# Single Blog Post (/blog/posts/1)
|
19
|
-
#def show
|
20
|
-
#end
|
21
|
-
|
22
|
-
# Create a New Blog Post (/blog/posts/new)
|
23
|
-
def new
|
24
|
-
@blog_post = Blog::Post.new
|
25
|
-
end
|
26
|
-
|
27
|
-
# Edit Blog Post (/blog/posts/1/edit)
|
28
|
-
def edit
|
29
|
-
end
|
30
|
-
|
31
|
-
# Create News Post /news/posts/new
|
32
|
-
def create
|
33
|
-
@blog_post = Blog::Post.new(blog_post_params)
|
34
|
-
if @blog_post.save
|
35
|
-
redirect_to blog_posts_path, notice: 'Blog post was successfully created.'
|
36
|
-
else
|
37
|
-
render 'new'
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
# PATCH/PUT
|
42
|
-
def update
|
43
|
-
if @blog_post.update(blog_post_params)
|
44
|
-
redirect_to blog_posts_path, notice: 'Blog post was successfully updated.'
|
45
|
-
else
|
46
|
-
render :edit
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
# DELETE
|
51
|
-
def destroy
|
52
|
-
@blog_post.destroy
|
53
|
-
redirect_to blog_posts_path, notice: 'Blog post was successfully destroyed.'
|
54
|
-
end
|
55
|
-
|
56
|
-
private
|
57
|
-
|
58
|
-
# Common Callbacks
|
59
|
-
def set_blog_post
|
60
|
-
@blog_post = Blog::Post.find(params[:id])
|
61
|
-
end
|
62
|
-
|
63
|
-
# Whitelist on what can be posted
|
64
|
-
def blog_post_params
|
65
|
-
params.require(:blog_post).permit(:blogpsttitle, :blogpsttext, :blogpstexcerpts, :pststatus, :pstimage, :remove_pstimage, category_id, :user_id)
|
66
|
-
end
|
67
|
-
|
68
|
-
# Current User
|
69
|
-
def current_user
|
70
|
-
return unless session[:user_id]
|
71
|
-
@current_user ||= User.find(session[:user_id])
|
72
|
-
end
|
73
|
-
|
74
|
-
end
|
75
|
-
end
|
@@ -1,70 +0,0 @@
|
|
1
|
-
require_dependency "phcpress/application_controller"
|
2
|
-
|
3
|
-
module Phcpress
|
4
|
-
class News::PostsController < ApplicationController
|
5
|
-
|
6
|
-
# Filters & Security
|
7
|
-
#layout 'layouts/phcpress/newspost/news_layout'
|
8
|
-
#before_action :authenticate_user!
|
9
|
-
before_action :set_news_post, only: [:edit, :update, :destroy]
|
10
|
-
|
11
|
-
# News Post Index
|
12
|
-
def index
|
13
|
-
@news_posts = News::Post.all
|
14
|
-
end
|
15
|
-
|
16
|
-
# New News Article
|
17
|
-
def new
|
18
|
-
@news_post = News::Post.new
|
19
|
-
end
|
20
|
-
|
21
|
-
# Edit News Article
|
22
|
-
def edit
|
23
|
-
end
|
24
|
-
|
25
|
-
# Create News Article
|
26
|
-
def create
|
27
|
-
@news_post = News::Post.new(news_post_params)
|
28
|
-
#@news_post.user_id = current_user
|
29
|
-
if @news_post.save
|
30
|
-
redirect_to news_posts_path, notice: 'News Article was Successfully Created.'
|
31
|
-
else
|
32
|
-
render 'new'
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
# Update News Article
|
37
|
-
def update
|
38
|
-
if @news_post.update(news_post_params)
|
39
|
-
redirect_to news_posts_path, notice: 'News Article was Successfully Updated.'
|
40
|
-
else
|
41
|
-
render :edit
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
# Delete News Destroy
|
46
|
-
def destroy
|
47
|
-
@news_post.destroy
|
48
|
-
redirect_to news_posts_path, notice: 'News Article was Successfully Destroyed.'
|
49
|
-
end
|
50
|
-
|
51
|
-
private
|
52
|
-
|
53
|
-
# Common Callbacks
|
54
|
-
def set_news_post
|
55
|
-
@news_post = News::Post.find(params[:id])
|
56
|
-
end
|
57
|
-
|
58
|
-
# Whitelist
|
59
|
-
def news_post_params
|
60
|
-
params.require(:news_post).permit(:newspsttitle, :newspsttext, :newspstexcerpts, :pststatus, :pstimage, :remove_pstimage, :category_id, :user_id)
|
61
|
-
end
|
62
|
-
|
63
|
-
# Current User
|
64
|
-
def current_user
|
65
|
-
return unless session[:user_id]
|
66
|
-
@current_user ||= User.find(session[:user_id])
|
67
|
-
end
|
68
|
-
|
69
|
-
end
|
70
|
-
end
|