phcpress 0.1.5b
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/Rakefile +31 -0
- data/app/assets/javascripts/phcpress/application.js +16 -0
- data/app/assets/javascripts/phcpress/blog/posts.js +0 -0
- data/app/assets/javascripts/phcpress/news/posts.js +0 -0
- data/app/assets/stylesheets/phcpress/application.css.scss +10 -0
- data/app/assets/stylesheets/phcpress/blog/posts.css +0 -0
- data/app/assets/stylesheets/phcpress/news/posts.css +0 -0
- data/app/assets/stylesheets/scaffolds.scss +73 -0
- data/app/controllers/phcpress/application_controller.rb +4 -0
- data/app/controllers/phcpress/blog/posts_controller.rb +68 -0
- data/app/controllers/phcpress/news/posts_controller.rb +68 -0
- data/app/helpers/phcpress/application_helper.rb +15 -0
- data/app/helpers/phcpress/blog/posts_helper.rb +4 -0
- data/app/helpers/phcpress/news/posts_helper.rb +4 -0
- data/app/models/phcpress/blog.rb +7 -0
- data/app/models/phcpress/blog/post.rb +4 -0
- data/app/models/phcpress/mews.rb +7 -0
- data/app/models/phcpress/news.rb +7 -0
- data/app/models/phcpress/news/post.rb +4 -0
- data/app/views/layouts/phcpress/_notifications.html.erb +11 -0
- data/app/views/layouts/phcpress/application.html.erb +22 -0
- data/app/views/phcpress/blog/posts/_form.html.erb +34 -0
- data/app/views/phcpress/blog/posts/edit.html.erb +10 -0
- data/app/views/phcpress/blog/posts/index.html.erb +45 -0
- data/app/views/phcpress/blog/posts/new.html.erb +10 -0
- data/app/views/phcpress/blog/posts/show.html.erb +19 -0
- data/app/views/phcpress/news/posts/_form.html.erb +32 -0
- data/app/views/phcpress/news/posts/edit.html.erb +10 -0
- data/app/views/phcpress/news/posts/index.html.erb +40 -0
- data/app/views/phcpress/news/posts/new.html.erb +10 -0
- data/app/views/phcpress/news/posts/show.html.erb +19 -0
- data/config/routes.rb +13 -0
- data/db/migrate/20160219213259_create_phcpress_news_posts.rb +13 -0
- data/db/migrate/20160219213313_create_phcpress_blog_posts.rb +13 -0
- data/lib/generators/views_generator.rb +57 -0
- data/lib/phcpress.rb +5 -0
- data/lib/phcpress/engine.rb +24 -0
- data/lib/phcpress/version.rb +3 -0
- data/lib/tasks/phcpress_tasks.rake +4 -0
- metadata +304 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: a5a8a630fe7093ac9175b261ea64ff64a61f0b29
|
4
|
+
data.tar.gz: 889f398eed53031126db311e9e653469440f35ab
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 81b1bf5051d75a3edf42a808f7883c0f0ce1ded399725fb17c90b7a9fabd96e96e3767f8966d4d302a1dd097f4f7dfc08b90bb87a2e0122b8eb889b41e2c502e
|
7
|
+
data.tar.gz: aa5d4e7554dbd3b5a604edeb2ff72bf070b722e0b06ee261ea295c6fb1dc7c08a1e7068b1209056e8704d07b0caf5f1ef6209977b4b9c390613be40e83c152ad
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2016 Brad Potts
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
begin
|
2
|
+
require 'bundler/setup'
|
3
|
+
rescue LoadError
|
4
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
|
+
end
|
6
|
+
|
7
|
+
require 'rdoc/task'
|
8
|
+
|
9
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
10
|
+
rdoc.rdoc_dir = 'rdoc'
|
11
|
+
rdoc.title = 'Phcpress'
|
12
|
+
rdoc.options << '--line-numbers'
|
13
|
+
rdoc.rdoc_files.include('README.rdoc')
|
14
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
|
+
end
|
16
|
+
|
17
|
+
APP_RAKEFILE = File.expand_path("../spec/test_app/Rakefile", __FILE__)
|
18
|
+
load 'rails/tasks/engine.rake'
|
19
|
+
load 'rails/tasks/statistics.rake'
|
20
|
+
|
21
|
+
Bundler::GemHelper.install_tasks
|
22
|
+
|
23
|
+
require 'rake'
|
24
|
+
# require 'rake/rdoctask'
|
25
|
+
require 'rspec/core'
|
26
|
+
require 'rspec/core/rake_task'
|
27
|
+
|
28
|
+
desc "Run all specs in spec directory (excluding plugin specs)"
|
29
|
+
RSpec::Core::RakeTask.new(:spec => 'app:db:test:prepare')
|
30
|
+
# RSpec::Core::RakeTask.new(:spec)
|
31
|
+
task :default => :spec
|
@@ -0,0 +1,16 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
+
// listed below.
|
3
|
+
//
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
+
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
|
6
|
+
//
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
+
// compiled file.
|
9
|
+
//
|
10
|
+
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
|
11
|
+
// about supported directives.
|
12
|
+
//
|
13
|
+
//= require_tree .
|
14
|
+
//= require jquery
|
15
|
+
//= require jquery_ujs
|
16
|
+
//= require bootstrap-sprockets
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,73 @@
|
|
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
|
+
}
|
8
|
+
|
9
|
+
p, ol, ul, td {
|
10
|
+
font-family: verdana, arial, helvetica, sans-serif;
|
11
|
+
font-size: 13px;
|
12
|
+
line-height: 18px;
|
13
|
+
}
|
14
|
+
|
15
|
+
pre {
|
16
|
+
background-color: #eee;
|
17
|
+
padding: 10px;
|
18
|
+
font-size: 11px;
|
19
|
+
}
|
20
|
+
|
21
|
+
a {
|
22
|
+
color: #000;
|
23
|
+
|
24
|
+
&:visited {
|
25
|
+
color: #666;
|
26
|
+
}
|
27
|
+
|
28
|
+
&:hover {
|
29
|
+
color: #fff;
|
30
|
+
background-color: #000;
|
31
|
+
}
|
32
|
+
}
|
33
|
+
|
34
|
+
div {
|
35
|
+
&.field, &.actions {
|
36
|
+
margin-bottom: 10px;
|
37
|
+
}
|
38
|
+
}
|
39
|
+
|
40
|
+
#notice {
|
41
|
+
color: green;
|
42
|
+
}
|
43
|
+
|
44
|
+
.field_with_errors {
|
45
|
+
padding: 2px;
|
46
|
+
background-color: red;
|
47
|
+
display: table;
|
48
|
+
}
|
49
|
+
|
50
|
+
#error_explanation {
|
51
|
+
width: 450px;
|
52
|
+
border: 2px solid red;
|
53
|
+
padding: 7px;
|
54
|
+
padding-bottom: 0;
|
55
|
+
margin-bottom: 20px;
|
56
|
+
background-color: #f0f0f0;
|
57
|
+
|
58
|
+
h2 {
|
59
|
+
text-align: left;
|
60
|
+
font-weight: bold;
|
61
|
+
padding: 5px 5px 5px 15px;
|
62
|
+
font-size: 12px;
|
63
|
+
margin: -7px;
|
64
|
+
margin-bottom: 0px;
|
65
|
+
background-color: #c00;
|
66
|
+
color: #fff;
|
67
|
+
}
|
68
|
+
|
69
|
+
ul li {
|
70
|
+
font-size: 12px;
|
71
|
+
list-style: square;
|
72
|
+
}
|
73
|
+
}
|
@@ -0,0 +1,68 @@
|
|
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
|
+
before_action :set_blog_post, only: [:show, :edit, :update, :destroy]
|
10
|
+
|
11
|
+
# Blog Post Index (/blog/posts)
|
12
|
+
def index
|
13
|
+
@blog_posts = Blog::Post.all
|
14
|
+
end
|
15
|
+
|
16
|
+
# Single Blog Post (/blog/posts/1)
|
17
|
+
def show
|
18
|
+
end
|
19
|
+
|
20
|
+
# Create a New Blog Post (/blog/posts/new)
|
21
|
+
def new
|
22
|
+
@blog_post = Blog::Post.new
|
23
|
+
end
|
24
|
+
|
25
|
+
# Edit Blog Post (/blog/posts/1/edit)
|
26
|
+
def edit
|
27
|
+
end
|
28
|
+
|
29
|
+
# POST
|
30
|
+
def create
|
31
|
+
@blog_post = Blog::Post.new(blog_post_params)
|
32
|
+
|
33
|
+
if @blog_post.save
|
34
|
+
redirect_to blog_posts, notice: 'Post was successfully created.'
|
35
|
+
else
|
36
|
+
render :new
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
# PATCH/PUT
|
41
|
+
def update
|
42
|
+
if @blog_post.update(blog_post_params)
|
43
|
+
redirect_to blog_posts, notice: 'Post was successfully updated.'
|
44
|
+
else
|
45
|
+
render :edit
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
# DELETE
|
50
|
+
def destroy
|
51
|
+
@blog_post.destroy
|
52
|
+
redirect_to blog_posts, notice: 'Post was successfully destroyed.'
|
53
|
+
end
|
54
|
+
|
55
|
+
private
|
56
|
+
|
57
|
+
# Common Callbacks
|
58
|
+
def set_blog_post
|
59
|
+
@blog_post = Blog::Post.find(params[:id])
|
60
|
+
end
|
61
|
+
|
62
|
+
# Whitelist on what can be posted
|
63
|
+
def blog_post_params
|
64
|
+
params.require(:blog_post).permit(:blogpsttitle, :blogpsttext, :pststatus)
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|
68
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
# Load General Controller for Engine
|
2
|
+
require_dependency "phcpress/application_controller"
|
3
|
+
|
4
|
+
# Code for News Posting
|
5
|
+
module Phcpress
|
6
|
+
class News::PostsController < ApplicationController
|
7
|
+
|
8
|
+
# Filters & Security
|
9
|
+
before_action :set_news_post, only: [:show, :edit, :update, :destroy]
|
10
|
+
|
11
|
+
# News Post Index (/news/posts)
|
12
|
+
def index
|
13
|
+
@news_posts = News::Post.all
|
14
|
+
end
|
15
|
+
|
16
|
+
# Single News Post (/news/posts/1)
|
17
|
+
def show
|
18
|
+
end
|
19
|
+
|
20
|
+
# Create a New News Post (/news/posts/new)
|
21
|
+
def new
|
22
|
+
@news_post = News::Post.new
|
23
|
+
end
|
24
|
+
|
25
|
+
# Edit News Post /news/posts/1/edit
|
26
|
+
def edit
|
27
|
+
end
|
28
|
+
|
29
|
+
# POST
|
30
|
+
def create
|
31
|
+
@news_post = News::Post.new(news_post_params)
|
32
|
+
|
33
|
+
if @news_post.save
|
34
|
+
redirect_to news_posts, notice: 'Post was successfully created.'
|
35
|
+
else
|
36
|
+
render :new
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
# PATCH/PUT
|
41
|
+
def update
|
42
|
+
if @news_post.update(news_post_params)
|
43
|
+
redirect_to news_posts, notice: 'Post was successfully updated.'
|
44
|
+
else
|
45
|
+
render :edit
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
# DELETE
|
50
|
+
def destroy
|
51
|
+
@news_post.destroy
|
52
|
+
redirect_to news_posts, notice: 'Post was successfully destroyed.'
|
53
|
+
end
|
54
|
+
|
55
|
+
private
|
56
|
+
|
57
|
+
# Common Callbacks
|
58
|
+
def set_news_post
|
59
|
+
@news_post = News::Post.find(params[:id])
|
60
|
+
end
|
61
|
+
|
62
|
+
# Whitelist on what can be posted
|
63
|
+
def news_post_params
|
64
|
+
params.require(:news_post).permit(:newspsttitle, :newspsttext, :pststatus)
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|
68
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Phcpress
|
2
|
+
module ApplicationHelper
|
3
|
+
|
4
|
+
# Bootstrap Notification System
|
5
|
+
def flash_class(level)
|
6
|
+
case level.to_sym
|
7
|
+
when :notice then "alert alert-info"
|
8
|
+
when :success then "alert alert-success"
|
9
|
+
when :error then "alert alert-danger"
|
10
|
+
when :alert then "alert alert-warning"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<div class="container">
|
2
|
+
<div class="alert alert-dismissible alert-warning hidden alert-please-update" role="alert">
|
3
|
+
<button aria-label="Close" class="close" data-dismiss="alert" type="button"><span aria-hidden="true"> ×</span></button><strong>Please update</strong>Despite the fact that the record doens't show on your screen you must save it to delete it!
|
4
|
+
</div>
|
5
|
+
<% flash.each do |key, value| %>
|
6
|
+
<div class="<%= flash_class(key) %> fade in">
|
7
|
+
<a href="#" data-dismiss="alert" class="close">×</a>
|
8
|
+
<%= value %>
|
9
|
+
</div>
|
10
|
+
<% end %>
|
11
|
+
</div>
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
|
5
|
+
<title>PHCPress - News Post & Blogging System</title>
|
6
|
+
|
7
|
+
<%= stylesheet_link_tag "phcpress/application", media: "all" %>
|
8
|
+
<%= javascript_include_tag "phcpress/application" %>
|
9
|
+
<%= csrf_meta_tags %>
|
10
|
+
|
11
|
+
</head>
|
12
|
+
|
13
|
+
<body>
|
14
|
+
<%= render 'layouts/phcpress/notifications' %>
|
15
|
+
<div class="container">
|
16
|
+
<div class="row">
|
17
|
+
<%= yield %>
|
18
|
+
</div>
|
19
|
+
</div>
|
20
|
+
</body>
|
21
|
+
|
22
|
+
</html>
|
@@ -0,0 +1,34 @@
|
|
1
|
+
<%= form_for(@blog_post) do |f| %>
|
2
|
+
|
3
|
+
<% if @blog_post.errors.any? %>
|
4
|
+
<div id="error_explanation">
|
5
|
+
<h2><%= pluralize(@blog_post.errors.count, "error") %> prohibited this blog_post from being saved:</h2>
|
6
|
+
|
7
|
+
<ul>
|
8
|
+
<% @blog_post.errors.full_messages.each do |message| %>
|
9
|
+
<li><%= message %></li>
|
10
|
+
<% end %>
|
11
|
+
</ul>
|
12
|
+
</div>
|
13
|
+
<% end %>
|
14
|
+
|
15
|
+
<div class="form-group">
|
16
|
+
<label><%= f.label :blogpsttitle, "Title" %></label>
|
17
|
+
<%= f.text_field :blogpsttitle, class: "form-control" %>
|
18
|
+
</div>
|
19
|
+
|
20
|
+
<div class="form-group">
|
21
|
+
<label><%= f.label :blogpsttext, "Text" %></label>
|
22
|
+
<%= f.text_area :blogpsttext, class: "form-control" %>
|
23
|
+
</div>
|
24
|
+
|
25
|
+
<div class="form-group">
|
26
|
+
<label><%= f.label :pststatus, "Post Status" %></label>
|
27
|
+
<%= f.select :pststatus, [['Draft','draft'],['Publish','publish'],['Review','review']], class: "form-control" %>
|
28
|
+
</div>
|
29
|
+
|
30
|
+
<div class="actions">
|
31
|
+
<%= f.submit "Submit", class: "btn btn-primary btn-sm" %>
|
32
|
+
</div>
|
33
|
+
|
34
|
+
<% end %>
|
@@ -0,0 +1,45 @@
|
|
1
|
+
<p id="notice"><%= notice %></p>
|
2
|
+
|
3
|
+
<!-- Main Content -->
|
4
|
+
<div class="wrapper wrapper-content">
|
5
|
+
<div class="panel panel-default">
|
6
|
+
|
7
|
+
<div class="panel-heading">
|
8
|
+
<i class="fa fa-newspaper-o"></i> Blog Post List
|
9
|
+
</div>
|
10
|
+
|
11
|
+
<div class="panel-body">
|
12
|
+
|
13
|
+
<table class="table table-bordered table-striped table-hover">
|
14
|
+
|
15
|
+
<thead>
|
16
|
+
<tr>
|
17
|
+
<th>Blog Title</th>
|
18
|
+
<th>Blog Text</th>
|
19
|
+
<th>Post Status</th>
|
20
|
+
<th></th>
|
21
|
+
</tr>
|
22
|
+
</thead>
|
23
|
+
|
24
|
+
<tbody>
|
25
|
+
<% @blog_posts.each do |blog_post| %>
|
26
|
+
<tr>
|
27
|
+
<td><%= blog_post.blogpsttitle %></td>
|
28
|
+
<td><%= blog_post.blogpsttext %></td>
|
29
|
+
<td><%= blog_post.pststatus %></td>
|
30
|
+
<td><div class="btn-group" role="group" aria-label="Blog Articles">
|
31
|
+
<%= link_to 'Show', blog_post, class: "btn btn-primary btn-xs" %>
|
32
|
+
<%= link_to 'Edit', edit_blog_post_path(blog_post), class: "btn btn-primary btn-xs" %>
|
33
|
+
<%= link_to 'Destroy', blog_post, class: "btn btn-danger btn-xs", method: :delete, data: { confirm: 'Are you sure?' } %>
|
34
|
+
</div></td>
|
35
|
+
</tr>
|
36
|
+
<% end %>
|
37
|
+
</tbody>
|
38
|
+
|
39
|
+
</table>
|
40
|
+
|
41
|
+
<%= link_to 'New Post', new_blog_post_path, class: "btn btn-primary" %>
|
42
|
+
</div>
|
43
|
+
|
44
|
+
</div>
|
45
|
+
</div>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<p id="notice"><%= notice %></p>
|
2
|
+
|
3
|
+
<p>
|
4
|
+
<strong>Blog Title:</strong>
|
5
|
+
<%= @blog_post.blogpsttitle %>
|
6
|
+
</p>
|
7
|
+
|
8
|
+
<p>
|
9
|
+
<strong>Blog Text:</strong>
|
10
|
+
<%= @blog_post.blogpsttext %>
|
11
|
+
</p>
|
12
|
+
|
13
|
+
<p>
|
14
|
+
<strong>Post Status:</strong>
|
15
|
+
<%= @blog_post.pststatus %>
|
16
|
+
</p>
|
17
|
+
|
18
|
+
<%= link_to 'Edit', edit_blog_post_path(@blog_post) %> |
|
19
|
+
<%= link_to 'Back', blog_posts_path %>
|
@@ -0,0 +1,32 @@
|
|
1
|
+
<%= form_for(@news_post) do |f| %>
|
2
|
+
|
3
|
+
<% if @news_post.errors.any? %>
|
4
|
+
<div id="error_explanation">
|
5
|
+
<h2><%= pluralize(@news_post.errors.count, "error") %> prohibited this news_post from being saved:</h2>
|
6
|
+
|
7
|
+
<ul>
|
8
|
+
<% @news_post.errors.full_messages.each do |message| %>
|
9
|
+
<li><%= message %></li>
|
10
|
+
<% end %>
|
11
|
+
</ul>
|
12
|
+
</div>
|
13
|
+
<% end %>
|
14
|
+
|
15
|
+
<div class="form-group">
|
16
|
+
<label><%= f.label :newspsttitle, "Post Name" %></label>
|
17
|
+
<%= f.text_field :newspsttitle, class: "form-control" %>
|
18
|
+
</div>
|
19
|
+
<div class="form-group">
|
20
|
+
<label><%= f.label :newspsttext, "Post Text" %></label>
|
21
|
+
<%= f.text_area :newspsttext, class: "form-control" %>
|
22
|
+
</div>
|
23
|
+
<div class="form-group">
|
24
|
+
<label><%= f.label :pststatus, "Post Status" %></label>
|
25
|
+
<%= f.select :pststatus, [['Draft','draft'],['Publish','publish'],['Review','review']], class: "form-control" %>
|
26
|
+
</div>
|
27
|
+
|
28
|
+
<div class="actions">
|
29
|
+
<%= f.submit "Submit", class: "btn btn-primary btn-sm" %>
|
30
|
+
</div>
|
31
|
+
|
32
|
+
<% end %>
|
@@ -0,0 +1,40 @@
|
|
1
|
+
<p id="notice"><%= notice %></p>
|
2
|
+
|
3
|
+
<!-- Main Content -->
|
4
|
+
<div class="wrapper wrapper-content">
|
5
|
+
<div class="panel panel-default">
|
6
|
+
<div class="panel-heading">
|
7
|
+
<i class="fa fa-newspaper-o"></i> News Post List
|
8
|
+
</div>
|
9
|
+
<div class="panel-body">
|
10
|
+
<table class="table table-bordered table-striped table-hover">
|
11
|
+
|
12
|
+
<thead>
|
13
|
+
<tr>
|
14
|
+
<th>Post Name</th>
|
15
|
+
<th>Post Text</th>
|
16
|
+
<th>Post Status</th>
|
17
|
+
<th></th>
|
18
|
+
</tr>
|
19
|
+
</thead>
|
20
|
+
|
21
|
+
<tbody>
|
22
|
+
<% @news_posts.each do |news_post| %>
|
23
|
+
<tr>
|
24
|
+
<td><%= news_post.newspsttitle %></td>
|
25
|
+
<td><%= news_post.newspsttext %></td>
|
26
|
+
<td><%= news_post.pststatus %></td>
|
27
|
+
<td><div class="btn-group" role="group" aria-label="News Articles">
|
28
|
+
<%= link_to 'Show', news_post, class: "btn btn-primary btn-xs" %>
|
29
|
+
<%= link_to 'Edit', edit_news_post_path(news_post), class: "btn btn-primary btn-xs" %>
|
30
|
+
<%= link_to 'Destroy', news_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
|
+
<%= link_to 'New Post', new_news_post_path, class: "btn btn-default" %>
|
38
|
+
</div>
|
39
|
+
</div>
|
40
|
+
</div>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<p id="notice"><%= notice %></p>
|
2
|
+
|
3
|
+
<p>
|
4
|
+
<strong>Newspsttitle:</strong>
|
5
|
+
<%= @news_post.newspsttitle %>
|
6
|
+
</p>
|
7
|
+
|
8
|
+
<p>
|
9
|
+
<strong>Newspsttext:</strong>
|
10
|
+
<%= @news_post.newspsttext %>
|
11
|
+
</p>
|
12
|
+
|
13
|
+
<p>
|
14
|
+
<strong>Pststatus:</strong>
|
15
|
+
<%= @news_post.pststatus %>
|
16
|
+
</p>
|
17
|
+
|
18
|
+
<%= link_to 'Edit', edit_news_post_path(@news_post) %> |
|
19
|
+
<%= link_to 'Back', news_posts_path %>
|
data/config/routes.rb
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
require 'rails/generators/base'
|
2
|
+
|
3
|
+
module phcpress
|
4
|
+
module Generators
|
5
|
+
|
6
|
+
module ViewPathTemplates
|
7
|
+
extend ActiveSupport::Concern
|
8
|
+
|
9
|
+
included do
|
10
|
+
class_option :views, aliases: "-v", type: :array, desc: "Select specific view directories to generate (layouts, phcpress)"
|
11
|
+
|
12
|
+
public_task :copy_views
|
13
|
+
end
|
14
|
+
|
15
|
+
# module ClassMethods
|
16
|
+
# def hide!
|
17
|
+
# Rails::Generators.hide_namespace self.namespace
|
18
|
+
# end
|
19
|
+
# end
|
20
|
+
|
21
|
+
def copy_views
|
22
|
+
if options[:views]
|
23
|
+
options[:views].each do |directory|
|
24
|
+
view_directory directory.to_sym
|
25
|
+
end
|
26
|
+
else
|
27
|
+
view_directory :layouts
|
28
|
+
view_directory :phcpress
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
protected
|
33
|
+
|
34
|
+
def view_directory(name, _target_path = nil)
|
35
|
+
directory name.to_s, _target_path || "#{target_path}/#{name}" do |content|
|
36
|
+
content
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def target_path
|
41
|
+
@target_path ||= "app/views"
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
class SharedViewsGenerator < Rails::Generators::Base
|
46
|
+
include ViewPathTemplates
|
47
|
+
source_root File.expand_path("../../../../app/views", __FILE__)
|
48
|
+
desc "Copies phcpress views to your application."
|
49
|
+
hide!
|
50
|
+
end
|
51
|
+
|
52
|
+
class ViewsGenerator < Rails::Generators::Base
|
53
|
+
desc "Copies phcpress views to your application."
|
54
|
+
invoke SharedViewsGenerator
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
data/lib/phcpress.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# Load Requried Dependecies
|
2
|
+
require 'jquery-rails'
|
3
|
+
require 'sass-rails'
|
4
|
+
require 'bootstrap-sass'
|
5
|
+
require 'font-awesome-rails'
|
6
|
+
|
7
|
+
module Phcpress
|
8
|
+
class Engine < ::Rails::Engine
|
9
|
+
isolate_namespace Phcpress
|
10
|
+
|
11
|
+
config.generators do |g|
|
12
|
+
g.test_framework :rspec,
|
13
|
+
fixtures: true,
|
14
|
+
view_specs: false,
|
15
|
+
helper_specs: false,
|
16
|
+
routing_specs: false,
|
17
|
+
controller_specs: true,
|
18
|
+
request_specs: false
|
19
|
+
g.fixture_replacement :factory_girl, dir: "spec/factories"
|
20
|
+
end
|
21
|
+
|
22
|
+
|
23
|
+
end
|
24
|
+
end
|
metadata
ADDED
@@ -0,0 +1,304 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: phcpress
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.5b
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- BradPotts
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-02-21 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: pg
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.18.4
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.18.4
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rails
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '4.2'
|
34
|
+
- - ">="
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: 4.2.5.1
|
37
|
+
type: :runtime
|
38
|
+
prerelease: false
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - "~>"
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '4.2'
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 4.2.5.1
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: jquery-rails
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - "~>"
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '4.0'
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: 4.0.5
|
57
|
+
type: :runtime
|
58
|
+
prerelease: false
|
59
|
+
version_requirements: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - "~>"
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: '4.0'
|
64
|
+
- - ">="
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: 4.0.5
|
67
|
+
- !ruby/object:Gem::Dependency
|
68
|
+
name: bootstrap-sass
|
69
|
+
requirement: !ruby/object:Gem::Requirement
|
70
|
+
requirements:
|
71
|
+
- - "~>"
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: '3.3'
|
74
|
+
- - ">="
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: 3.3.6
|
77
|
+
type: :runtime
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - "~>"
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '3.3'
|
84
|
+
- - ">="
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: 3.3.6
|
87
|
+
- !ruby/object:Gem::Dependency
|
88
|
+
name: font-awesome-rails
|
89
|
+
requirement: !ruby/object:Gem::Requirement
|
90
|
+
requirements:
|
91
|
+
- - "~>"
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '4.5'
|
94
|
+
type: :runtime
|
95
|
+
prerelease: false
|
96
|
+
version_requirements: !ruby/object:Gem::Requirement
|
97
|
+
requirements:
|
98
|
+
- - "~>"
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
version: '4.5'
|
101
|
+
- !ruby/object:Gem::Dependency
|
102
|
+
name: sass-rails
|
103
|
+
requirement: !ruby/object:Gem::Requirement
|
104
|
+
requirements:
|
105
|
+
- - "~>"
|
106
|
+
- !ruby/object:Gem::Version
|
107
|
+
version: '5.0'
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 5.0.4
|
111
|
+
type: :runtime
|
112
|
+
prerelease: false
|
113
|
+
version_requirements: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '5.0'
|
118
|
+
- - ">="
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
version: 5.0.4
|
121
|
+
- !ruby/object:Gem::Dependency
|
122
|
+
name: sqlite3
|
123
|
+
requirement: !ruby/object:Gem::Requirement
|
124
|
+
requirements:
|
125
|
+
- - "~>"
|
126
|
+
- !ruby/object:Gem::Version
|
127
|
+
version: '1.3'
|
128
|
+
type: :development
|
129
|
+
prerelease: false
|
130
|
+
version_requirements: !ruby/object:Gem::Requirement
|
131
|
+
requirements:
|
132
|
+
- - "~>"
|
133
|
+
- !ruby/object:Gem::Version
|
134
|
+
version: '1.3'
|
135
|
+
- !ruby/object:Gem::Dependency
|
136
|
+
name: database_cleaner
|
137
|
+
requirement: !ruby/object:Gem::Requirement
|
138
|
+
requirements:
|
139
|
+
- - "~>"
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: '1.5'
|
142
|
+
type: :development
|
143
|
+
prerelease: false
|
144
|
+
version_requirements: !ruby/object:Gem::Requirement
|
145
|
+
requirements:
|
146
|
+
- - "~>"
|
147
|
+
- !ruby/object:Gem::Version
|
148
|
+
version: '1.5'
|
149
|
+
- !ruby/object:Gem::Dependency
|
150
|
+
name: laundry
|
151
|
+
requirement: !ruby/object:Gem::Requirement
|
152
|
+
requirements:
|
153
|
+
- - "~>"
|
154
|
+
- !ruby/object:Gem::Version
|
155
|
+
version: 0.0.8
|
156
|
+
type: :development
|
157
|
+
prerelease: false
|
158
|
+
version_requirements: !ruby/object:Gem::Requirement
|
159
|
+
requirements:
|
160
|
+
- - "~>"
|
161
|
+
- !ruby/object:Gem::Version
|
162
|
+
version: 0.0.8
|
163
|
+
- !ruby/object:Gem::Dependency
|
164
|
+
name: factory_girl_rails
|
165
|
+
requirement: !ruby/object:Gem::Requirement
|
166
|
+
requirements:
|
167
|
+
- - "~>"
|
168
|
+
- !ruby/object:Gem::Version
|
169
|
+
version: 4.4.1
|
170
|
+
type: :development
|
171
|
+
prerelease: false
|
172
|
+
version_requirements: !ruby/object:Gem::Requirement
|
173
|
+
requirements:
|
174
|
+
- - "~>"
|
175
|
+
- !ruby/object:Gem::Version
|
176
|
+
version: 4.4.1
|
177
|
+
- !ruby/object:Gem::Dependency
|
178
|
+
name: rspec-rails
|
179
|
+
requirement: !ruby/object:Gem::Requirement
|
180
|
+
requirements:
|
181
|
+
- - "~>"
|
182
|
+
- !ruby/object:Gem::Version
|
183
|
+
version: '3.4'
|
184
|
+
type: :development
|
185
|
+
prerelease: false
|
186
|
+
version_requirements: !ruby/object:Gem::Requirement
|
187
|
+
requirements:
|
188
|
+
- - "~>"
|
189
|
+
- !ruby/object:Gem::Version
|
190
|
+
version: '3.4'
|
191
|
+
- !ruby/object:Gem::Dependency
|
192
|
+
name: capybara
|
193
|
+
requirement: !ruby/object:Gem::Requirement
|
194
|
+
requirements:
|
195
|
+
- - "~>"
|
196
|
+
- !ruby/object:Gem::Version
|
197
|
+
version: '2.6'
|
198
|
+
type: :development
|
199
|
+
prerelease: false
|
200
|
+
version_requirements: !ruby/object:Gem::Requirement
|
201
|
+
requirements:
|
202
|
+
- - "~>"
|
203
|
+
- !ruby/object:Gem::Version
|
204
|
+
version: '2.6'
|
205
|
+
- !ruby/object:Gem::Dependency
|
206
|
+
name: faker
|
207
|
+
requirement: !ruby/object:Gem::Requirement
|
208
|
+
requirements:
|
209
|
+
- - "~>"
|
210
|
+
- !ruby/object:Gem::Version
|
211
|
+
version: '1.6'
|
212
|
+
type: :development
|
213
|
+
prerelease: false
|
214
|
+
version_requirements: !ruby/object:Gem::Requirement
|
215
|
+
requirements:
|
216
|
+
- - "~>"
|
217
|
+
- !ruby/object:Gem::Version
|
218
|
+
version: '1.6'
|
219
|
+
- !ruby/object:Gem::Dependency
|
220
|
+
name: selenium-webdriver
|
221
|
+
requirement: !ruby/object:Gem::Requirement
|
222
|
+
requirements:
|
223
|
+
- - "~>"
|
224
|
+
- !ruby/object:Gem::Version
|
225
|
+
version: '2.52'
|
226
|
+
type: :development
|
227
|
+
prerelease: false
|
228
|
+
version_requirements: !ruby/object:Gem::Requirement
|
229
|
+
requirements:
|
230
|
+
- - "~>"
|
231
|
+
- !ruby/object:Gem::Version
|
232
|
+
version: '2.52'
|
233
|
+
description: "(UNDER DEVELOPMENT) A customizable engine for simple news and blog posts."
|
234
|
+
email:
|
235
|
+
- brad.potts@phcnetworks.net
|
236
|
+
executables: []
|
237
|
+
extensions: []
|
238
|
+
extra_rdoc_files: []
|
239
|
+
files:
|
240
|
+
- MIT-LICENSE
|
241
|
+
- Rakefile
|
242
|
+
- app/assets/javascripts/phcpress/application.js
|
243
|
+
- app/assets/javascripts/phcpress/blog/posts.js
|
244
|
+
- app/assets/javascripts/phcpress/news/posts.js
|
245
|
+
- app/assets/stylesheets/phcpress/application.css.scss
|
246
|
+
- app/assets/stylesheets/phcpress/blog/posts.css
|
247
|
+
- app/assets/stylesheets/phcpress/news/posts.css
|
248
|
+
- app/assets/stylesheets/scaffolds.scss
|
249
|
+
- app/controllers/phcpress/application_controller.rb
|
250
|
+
- app/controllers/phcpress/blog/posts_controller.rb
|
251
|
+
- app/controllers/phcpress/news/posts_controller.rb
|
252
|
+
- app/helpers/phcpress/application_helper.rb
|
253
|
+
- app/helpers/phcpress/blog/posts_helper.rb
|
254
|
+
- app/helpers/phcpress/news/posts_helper.rb
|
255
|
+
- app/models/phcpress/blog.rb
|
256
|
+
- app/models/phcpress/blog/post.rb
|
257
|
+
- app/models/phcpress/mews.rb
|
258
|
+
- app/models/phcpress/news.rb
|
259
|
+
- app/models/phcpress/news/post.rb
|
260
|
+
- app/views/layouts/phcpress/_notifications.html.erb
|
261
|
+
- app/views/layouts/phcpress/application.html.erb
|
262
|
+
- app/views/phcpress/blog/posts/_form.html.erb
|
263
|
+
- app/views/phcpress/blog/posts/edit.html.erb
|
264
|
+
- app/views/phcpress/blog/posts/index.html.erb
|
265
|
+
- app/views/phcpress/blog/posts/new.html.erb
|
266
|
+
- app/views/phcpress/blog/posts/show.html.erb
|
267
|
+
- app/views/phcpress/news/posts/_form.html.erb
|
268
|
+
- app/views/phcpress/news/posts/edit.html.erb
|
269
|
+
- app/views/phcpress/news/posts/index.html.erb
|
270
|
+
- app/views/phcpress/news/posts/new.html.erb
|
271
|
+
- app/views/phcpress/news/posts/show.html.erb
|
272
|
+
- config/routes.rb
|
273
|
+
- db/migrate/20160219213259_create_phcpress_news_posts.rb
|
274
|
+
- db/migrate/20160219213313_create_phcpress_blog_posts.rb
|
275
|
+
- lib/generators/views_generator.rb
|
276
|
+
- lib/phcpress.rb
|
277
|
+
- lib/phcpress/engine.rb
|
278
|
+
- lib/phcpress/version.rb
|
279
|
+
- lib/tasks/phcpress_tasks.rake
|
280
|
+
homepage: http://www.phcnetworks.net
|
281
|
+
licenses:
|
282
|
+
- MIT
|
283
|
+
metadata: {}
|
284
|
+
post_install_message:
|
285
|
+
rdoc_options: []
|
286
|
+
require_paths:
|
287
|
+
- lib
|
288
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
289
|
+
requirements:
|
290
|
+
- - ">="
|
291
|
+
- !ruby/object:Gem::Version
|
292
|
+
version: '0'
|
293
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
294
|
+
requirements:
|
295
|
+
- - ">"
|
296
|
+
- !ruby/object:Gem::Version
|
297
|
+
version: 1.3.1
|
298
|
+
requirements: []
|
299
|
+
rubyforge_project:
|
300
|
+
rubygems_version: 2.5.1
|
301
|
+
signing_key:
|
302
|
+
specification_version: 4
|
303
|
+
summary: News & Blog Posts Engine for Ruby on Rails
|
304
|
+
test_files: []
|