phcpress 3.8.5 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +3 -2
  4. data/Rakefile +17 -10
  5. data/app/assets/config/phcpress_manifest.js +2 -0
  6. data/app/assets/javascripts/phcpress/application.js +2 -2
  7. data/app/assets/stylesheets/phcpress/_custom.scss +0 -0
  8. data/app/assets/stylesheets/phcpress/application.scss +17 -4
  9. data/app/controllers/phcpress/application_controller.rb +2 -3
  10. data/app/controllers/phcpress/blog/posts_controller.rb +3 -4
  11. data/app/controllers/phcpress/modules/categories_controller.rb +68 -0
  12. data/app/controllers/phcpress/news/posts_controller.rb +4 -4
  13. data/app/helpers/phcpress/application_helper.rb +2 -2
  14. data/app/jobs/phcpress/application_job.rb +4 -0
  15. data/app/mailers/phcpress/application_mailer.rb +6 -0
  16. data/app/models/phcpress/application_record.rb +5 -0
  17. data/app/models/phcpress/blog/post.rb +0 -3
  18. data/app/models/phcpress/modules.rb +7 -0
  19. data/app/models/phcpress/modules/category.rb +5 -0
  20. data/app/models/phcpress/news/post.rb +1 -2
  21. data/app/views/layouts/phcpress/application.html.erb +1 -1
  22. data/app/views/phcpress/blog/posts/_form.html.erb +12 -2
  23. data/app/views/phcpress/{categories → modules/categories}/_form.html.erb +2 -2
  24. data/app/views/phcpress/{categories → modules/categories}/edit.html.erb +0 -0
  25. data/app/views/phcpress/{categories → modules/categories}/index.html.erb +5 -5
  26. data/app/views/phcpress/{categories → modules/categories}/new.html.erb +0 -0
  27. data/app/views/phcpress/modules/categories/show.html.erb +4 -0
  28. data/app/views/phcpress/news/posts/_form.html.erb +7 -3
  29. data/config/routes.rb +1 -1
  30. data/db/migrate/{20160316131626_create_phcpress_news_posts.rb → 20160716182441_create_phcpress_news_posts.rb} +3 -2
  31. data/db/migrate/{20160316131650_create_phcpress_blog_posts.rb → 20160716182510_create_phcpress_blog_posts.rb} +3 -2
  32. data/db/migrate/20160716182848_create_phcpress_modules_categories.rb +11 -0
  33. data/lib/phcpress/engine.rb +0 -1
  34. data/lib/phcpress/version.rb +1 -1
  35. metadata +161 -111
  36. data/LICENSE +0 -238
  37. data/app/assets/javascripts/phcpress/categories.js +0 -2
  38. data/app/assets/stylesheets/phcpress/categories.scss +0 -3
  39. data/app/assets/stylesheets/phcpress/custom.scss +0 -4
  40. data/app/assets/stylesheets/scaffolds.scss +0 -73
  41. data/app/controllers/phcpress/categories_controller.rb +0 -63
  42. data/app/helpers/phcpress/categories_helper.rb +0 -4
  43. data/app/models/phcpress/category.rb +0 -4
  44. data/app/views/layouts/phcpress/blogpost/blog_layout.html.erb +0 -22
  45. data/app/views/layouts/phcpress/newspost/news_layout.html.erb +0 -22
  46. data/db/migrate/20160424211134_create_phcpress_categories.rb +0 -9
  47. data/db/migrate/20160425194021_add_phcpress_category_to_phcpress_blog_posts.rb +0 -7
  48. data/db/migrate/20160425194321_add_phcpress_category_to_phcpress_news_post.rb +0 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b6bd984764253256558f0569953525bed6dad220
4
- data.tar.gz: 93fbef55a0a7f9dfd26de80b283b67f0feea119f
3
+ metadata.gz: f51ee17fa7b7216e9d8acee8cf62dd32e5e0050e
4
+ data.tar.gz: 62595f2af30b49c4437e0139c6fc18bfc6e472f5
5
5
  SHA512:
6
- metadata.gz: d6224de366106564f075f5f28e47c1c528218538bc994b3feb509ccb863b1e0d2dee4b789d5d4488fb7f8bc9892e4d8e9498720f5d46f6078518325cd1b9c3bd
7
- data.tar.gz: 76716b30b5198a1b64c2c214cef620469231d10785db7638209e7f0ca935bf243d1a47e547c4799899f2826c48827d0fb04dbb302d70f1db69028c992a31f10d
6
+ metadata.gz: 7e641049a74ba00b09807b55a05b53d303eb01c815dcbe97b412313d688f230e0ae17fd5658c346efd8756b5312ecb7dde7e5367ab5f8ef1e9f1e052e2a00d29
7
+ data.tar.gz: 79bd5162c729e5bfe1ae6a6df892eb7a5984adcc75abca37013a57b0a3f787dc78b2620c46c64255fe4e1e87a38d6e81e128d92d9ea55286c78628e8b91b5a32
@@ -0,0 +1,20 @@
1
+ Copyright 2016 BradPotts - PHCNetworks
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/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(3) (Blog & News Post Engine) Documentation
6
+ ### PHCPress(4) (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.1'
11
+ gem 'phcpress', '~> 3.8', '>= 3.8.5'
12
12
  bundle exec install
13
13
 
14
14
  #### Step 2 - Copy over database migration files
@@ -27,3 +27,4 @@ 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
+ -
data/Rakefile CHANGED
@@ -1,26 +1,33 @@
1
1
  begin
2
- require 'bundler/setup'
2
+ require 'bundler/setup'
3
3
  rescue LoadError
4
- puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
5
  end
6
6
 
7
7
  require 'rdoc/task'
8
8
 
9
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')
10
+ rdoc.rdoc_dir = 'rdoc'
11
+ rdoc.title = 'Phcpress'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('README.md')
14
+ rdoc.rdoc_files.include('lib/**/*.rb')
15
15
  end
16
16
 
17
- APP_RAKEFILE = File.expand_path("../spec/test_app/Rakefile", __FILE__)
17
+ APP_RAKEFILE = File.expand_path("../spec/testapp/Rakefile", __FILE__)
18
18
  load 'rails/tasks/engine.rake'
19
19
 
20
-
21
20
  load 'rails/tasks/statistics.rake'
22
21
 
22
+ require 'bundler/gem_tasks'
23
23
 
24
+ require 'rake/testtask'
24
25
 
25
- Bundler::GemHelper.install_tasks
26
+ Rake::TestTask.new(:test) do |t|
27
+ t.libs << 'lib'
28
+ t.libs << 'test'
29
+ t.pattern = 'test/**/*_test.rb'
30
+ t.verbose = false
31
+ end
26
32
 
33
+ task default: :test
@@ -0,0 +1,2 @@
1
+ //= link_directory ../javascripts/phcpress .js
2
+ //= link_directory ../stylesheets/phcpress .scss
@@ -5,12 +5,12 @@
5
5
  // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
6
6
  //
7
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.
8
+ // compiled file. JavaScript code in this file should be added after the last require_* statement.
9
9
  //
10
10
  // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
11
11
  // about supported directives.
12
12
  //
13
- //= require_tree .
14
13
  //= require jquery
15
14
  //= require jquery_ujs
16
15
  //= require bootstrap-sprockets
16
+ //= require_tree .
@@ -1,10 +1,23 @@
1
1
  /*
2
- *= require_self
3
- */
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
+ * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
10
+ * files in this directory. Styles in this file should be added after the last require_* statement.
11
+ * It is generally better to create a new file per style scope.
12
+ *
13
+ *= require_tree .
14
+ *= require_self
15
+ */
4
16
 
5
- // Load Standard
17
+ // Bootstrap & Font Awesome
18
+ @import "bootstrap-sprockets";
6
19
  @import "bootstrap";
7
20
  @import "font-awesome";
8
21
 
9
- // Load Custom
22
+ // Custom Alterations
10
23
  @import "custom";
@@ -2,11 +2,10 @@ module Phcpress
2
2
  class ApplicationController < ActionController::Base
3
3
 
4
4
  # Prevent CSRF attacks by raising an exception.
5
- # For APIs, you may want to use :null_session instead.
6
5
  before_action :authenticate_user!, if: -> { defined?(Devise) }
7
6
  protect_from_forgery with: :exception
8
7
 
9
- # Make Current User Sitewide
8
+ # Current User
10
9
  def current_user
11
10
  return unless session[:user_id]
12
11
  @current_user ||= User.find(session[:user_id])
@@ -17,4 +16,4 @@ module Phcpress
17
16
  helper Phcnotifi::Engine.helpers
18
17
 
19
18
  end
20
- end
19
+ end
@@ -6,8 +6,8 @@ module Phcpress
6
6
  class Blog::PostsController < ApplicationController
7
7
 
8
8
  # Filters & Security
9
- layout 'layouts/phcpress/blogpost/blog_layout'
10
- before_action :authenticate_user!, if: -> { defined?(Devise) }
9
+ #layout 'layouts/phcpress/blogpost/blog_layout'
10
+ #before_action :authenticate_user!
11
11
  before_action :set_blog_post, only: [:edit, :update, :destroy]
12
12
 
13
13
  # Blog Post Index (/blog/posts)
@@ -31,7 +31,6 @@ module Phcpress
31
31
  # Create News Post /news/posts/new
32
32
  def create
33
33
  @blog_post = Blog::Post.new(blog_post_params)
34
- @blog_post.user_id = current_user.id
35
34
  if @blog_post.save
36
35
  redirect_to blog_posts_path, notice: 'Blog post was successfully created.'
37
36
  else
@@ -63,7 +62,7 @@ module Phcpress
63
62
 
64
63
  # Whitelist on what can be posted
65
64
  def blog_post_params
66
- params.require(:blog_post).permit(:blogpsttitle, :blogpsttext, :blogpstexcerpts, :pststatus, :pstimage, :user_id)
65
+ params.require(:blog_post).permit(:blogpsttitle, :blogpsttext, :blogpstexcerpts, :pststatus, :pstimage, :remove_pstimage, category_id, :user_id)
67
66
  end
68
67
 
69
68
  # Current User
@@ -0,0 +1,68 @@
1
+ require_dependency "phcpress/application_controller"
2
+
3
+ module Phcpress
4
+ class Modules::CategoriesController < ApplicationController
5
+
6
+ # Security and Filters
7
+ layout 'layouts/phcpress/category/category_layout'
8
+ before_action :authenticate_user!
9
+ before_action :set_modules_category, only: [:show, :edit, :update, :destroy]
10
+
11
+ # Categories Index
12
+ def index
13
+ @modules_categories = Modules::Category.all
14
+ end
15
+
16
+ # Detail News/Blog Category
17
+ def show
18
+ end
19
+
20
+ # New News/Blog Category
21
+ def new
22
+ @modules_category = Modules::Category.new
23
+ end
24
+
25
+ # Edit News/Blog Category
26
+ def edit
27
+ end
28
+
29
+ # Create News/Blog Category
30
+ def create
31
+ @modules_category = Modules::Category.new(modules_category_params)
32
+
33
+ if @modules_category.save
34
+ redirect_to modules_categories_url, notice: 'Category was successfully created.'
35
+ else
36
+ render :new
37
+ end
38
+ end
39
+
40
+ # Update News/Blog Category
41
+ def update
42
+ if @modules_category.update(modules_category_params)
43
+ redirect_to modules_categories_url, notice: 'Category was successfully updated.'
44
+ else
45
+ render :edit
46
+ end
47
+ end
48
+
49
+ # Delete News/Blog Category
50
+ def destroy
51
+ @modules_category.destroy
52
+ redirect_to modules_categories_url, notice: 'Category was successfully destroyed.'
53
+ end
54
+
55
+ private
56
+
57
+ # Common Callbacks
58
+ def set_modules_category
59
+ @modules_category = Modules::Category.find(params[:id])
60
+ end
61
+
62
+ # Whitelist
63
+ def modules_category_params
64
+ params.require(:modules_category).permit(:catname, :user_id)
65
+ end
66
+
67
+ end
68
+ end
@@ -4,8 +4,8 @@ module Phcpress
4
4
  class News::PostsController < ApplicationController
5
5
 
6
6
  # Filters & Security
7
- layout 'layouts/phcpress/newspost/news_layout'
8
- before_action :authenticate_user!, if: -> { defined?(Devise) }
7
+ #layout 'layouts/phcpress/newspost/news_layout'
8
+ #before_action :authenticate_user!
9
9
  before_action :set_news_post, only: [:edit, :update, :destroy]
10
10
 
11
11
  # News Post Index
@@ -25,7 +25,7 @@ module Phcpress
25
25
  # Create News Article
26
26
  def create
27
27
  @news_post = News::Post.new(news_post_params)
28
- @news_post.user_id = current_user
28
+ #@news_post.user_id = current_user
29
29
  if @news_post.save
30
30
  redirect_to news_posts_path, notice: 'News Article was Successfully Created.'
31
31
  else
@@ -57,7 +57,7 @@ module Phcpress
57
57
 
58
58
  # Whitelist
59
59
  def news_post_params
60
- params.require(:news_post).permit(:newspsttitle, :newspsttext, :newspstexcerpts, :pststatus, :pstimage, :user_id, :category_id)
60
+ params.require(:news_post).permit(:newspsttitle, :newspsttext, :newspstexcerpts, :pststatus, :pstimage, :remove_pstimage, :category_id, :user_id)
61
61
  end
62
62
 
63
63
  # Current User
@@ -1,4 +1,4 @@
1
1
  module Phcpress
2
- module ApplicationHelper
3
- end
2
+ module ApplicationHelper
3
+ end
4
4
  end
@@ -0,0 +1,4 @@
1
+ module Phcpress
2
+ class ApplicationJob < ActiveJob::Base
3
+ end
4
+ end
@@ -0,0 +1,6 @@
1
+ module Phcpress
2
+ class ApplicationMailer < ActionMailer::Base
3
+ default from: 'no-reply@phcnetworks.net'
4
+ layout 'mailer'
5
+ end
6
+ end
@@ -0,0 +1,5 @@
1
+ module Phcpress
2
+ class ApplicationRecord < ActiveRecord::Base
3
+ self.abstract_class = true
4
+ end
5
+ end
@@ -4,8 +4,5 @@ module Phcpress
4
4
  # For Image Uploads
5
5
  mount_uploader :pstimage, Phcpress::PstimageUploader
6
6
 
7
- # Associate Post Authour to User
8
- belongs_to :user, class_name: 'Phcengine::User'
9
-
10
7
  end
11
8
  end
@@ -0,0 +1,7 @@
1
+ module Phcpress
2
+ module Modules
3
+ def self.table_name_prefix
4
+ 'phcpress_modules_'
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,5 @@
1
+ module Phcpress
2
+ class Modules::Category < ApplicationRecord
3
+
4
+ end
5
+ end
@@ -4,8 +4,7 @@ module Phcpress
4
4
  # For Image Uploads
5
5
  mount_uploader :pstimage, Phcpress::PstimageUploader
6
6
 
7
- # Associate Post Authour to User
8
- belongs_to :user, class_name: 'Phcengine::User'
7
+
9
8
 
10
9
  end
11
10
  end
@@ -2,7 +2,7 @@
2
2
  <html>
3
3
  <head>
4
4
 
5
- <title>PHCPress - News Post & Blogging System</title>
5
+ <title>PHCPress SSO - Blog & News Engine</title>
6
6
 
7
7
  <%= stylesheet_link_tag "phcpress/application", media: "all" %>
8
8
  <%= javascript_include_tag "phcpress/application" %>
@@ -5,6 +5,7 @@
5
5
  <%= render 'phcnotifi/validations', :object => @blog_post %>
6
6
 
7
7
  <div class="col-md-3">
8
+
8
9
  <div class="panel panel-primary">
9
10
  <div class="panel-heading">
10
11
  <i class="fa fa-paper-plane-o"></i> Publish Panel
@@ -16,13 +17,14 @@
16
17
  </div>
17
18
  <div class="form-group">
18
19
  <%= f.label :pstcategory, "Post Category" %>
19
- <%= collection_select(:pstcategory, :pstcategory_id, Phcpress::Category.order('catname'), :id, :catname, {}, {class: "form-control form-control-sm"}) %>
20
+ <%= collection_select(:pstcategory, :pstcategory_id, Phcpress::Modules::Category.order('catname'), :id, :catname, {}, {class: "form-control form-control-sm"}) %>
20
21
  </div>
21
22
  <div class="actions">
22
23
  <%= f.submit "Publish Blog Article", class: "btn btn-primary btn-sm" %>
23
24
  </div>
24
25
  </div>
25
26
  </div>
27
+
26
28
  <div class="panel panel-primary">
27
29
  <div class="panel-heading">
28
30
  <i class="fa fa-camera-retro"></i> Post Images
@@ -32,11 +34,18 @@
32
34
  <label><%= f.label :pstimage, "Featured Image" %></label>
33
35
  <%= f.file_field :pstimage, class: "form-control" %>
34
36
  </div>
35
- <%= image_tag(@blog_post.pstimage_url, class: "img-responsive img-thumbnail") %>
37
+ <% if f.object.pstimage? %>
38
+ <%= image_tag f.object.pstimage, class: "img-responsive img-thumbnail" %>
39
+ <%= f.label :remove_pstimage %>
40
+ <%= f.check_box :remove_pstimage %>
41
+ <% end %>
36
42
  </div>
37
43
  </div>
44
+
38
45
  </div>
46
+
39
47
  <div class="col-md-9 ">
48
+
40
49
  <div class="panel panel-primary">
41
50
  <div class="panel-heading">
42
51
  <i class="fa fa-pencil-square-o"></i> Blog Post Publisher
@@ -56,6 +65,7 @@
56
65
  </div>
57
66
  </div>
58
67
  </div>
68
+
59
69
  </div>
60
70
 
61
71
  <% end %>
@@ -1,9 +1,9 @@
1
1
  <div class="row">
2
2
  <div class="col-lg-12">
3
- <%= form_for(@category) do |f| %>
3
+ <%= form_for(@modules_category) do |f| %>
4
4
 
5
5
  <!-- PHC-Notifi Render Validation -->
6
- <%= render 'phcnotifi/validations', :object => @category %>
6
+ <%= render 'phcnotifi/validations', :object => @modules_category %>
7
7
 
8
8
  <div class="form-group">
9
9
  <label><%= f.label :catname, "Category Name" %></label>
@@ -17,19 +17,19 @@
17
17
  </thead>
18
18
 
19
19
  <tbody>
20
- <% @categories.each do |category| %>
20
+ <% @categories.each do |modules_category| %>
21
21
  <tr>
22
- <td><%= category.catname %></td>
22
+ <td><%= modules_category.catname %></td>
23
23
  <td><div class="btn-group" role="group" aria-label="Blog Articles">
24
- <%= link_to 'Edit', edit_category_path(category) , class: "btn btn-primary btn-xs" %>
25
- <%= link_to 'Trash', category, class: "btn btn-danger btn-xs", method: :delete, data: { confirm: 'Are you sure?' } %>
24
+ <%= link_to 'Edit', edit_modules_category_path(category) , class: "btn btn-primary btn-xs" %>
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>
28
28
  </tr>
29
29
  <% end %>
30
30
  </tbody>
31
31
  </table>
32
- <%= link_to 'New Category', new_category_path, class: "btn btn-primary" %>
32
+ <%= link_to 'New Category', new_modules_category_path, class: "btn btn-primary" %>
33
33
  </div>
34
34
 
35
35
  </div>