phcpress 9.0.0 → 9.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/MIT-LICENSE +20 -20
- data/README.md +46 -46
- data/Rakefile +33 -33
- data/app/assets/config/phcpress_manifest.js +2 -2
- data/app/assets/javascripts/phcpress/application.js +2 -2
- data/app/assets/stylesheets/phcpress/application.scss +2 -2
- data/app/controllers/phcpress/api/v1/categories_controller.rb +15 -15
- data/app/controllers/phcpress/api/v1/posts_controller.rb +15 -15
- data/app/controllers/phcpress/application_controller.rb +12 -12
- data/app/controllers/phcpress/articles/posts_controller.rb +67 -67
- data/app/controllers/phcpress/frontend/articles_controller.rb +20 -20
- data/app/controllers/phcpress/modules/categories_controller.rb +65 -65
- data/app/controllers/phcpress/modules/connections_controller.rb +65 -65
- data/app/helpers/phcpress/application_helper.rb +14 -14
- data/app/jobs/phcpress/application_job.rb +4 -4
- data/app/mailers/phcpress/application_mailer.rb +6 -6
- data/app/models/phcpress/api/v1/category.rb +4 -4
- data/app/models/phcpress/api/v1/post.rb +4 -4
- data/app/models/phcpress/application_record.rb +5 -5
- data/app/models/phcpress/articles.rb +7 -7
- data/app/models/phcpress/articles/post.rb +30 -30
- data/app/models/phcpress/frontend.rb +7 -7
- data/app/models/phcpress/frontend/article.rb +4 -4
- data/app/models/phcpress/modules.rb +7 -7
- data/app/models/phcpress/modules/category.rb +20 -20
- data/app/models/phcpress/modules/connection.rb +15 -15
- data/app/uploaders/phcpress/pstimage_uploader.rb +30 -30
- data/app/views/layouts/components/backend/footer/_footer.html.erb +4 -4
- data/app/views/layouts/components/backend/navigation/_navigation.html.erb +48 -48
- data/app/views/layouts/components/backend/topbar/_topbar.html.erb +5 -5
- data/app/views/layouts/components/backend/topbar/_topbar_links.html.erb +0 -0
- data/app/views/layouts/phcpress/application.html.erb +57 -57
- data/app/views/layouts/phcpress/frontend.html.erb +24 -24
- data/app/views/phcpress/api/v1/categories/index.json.rabl +2 -2
- data/app/views/phcpress/api/v1/posts/index.json.rabl +2 -2
- data/app/views/phcpress/articles/posts/_form.html.erb +84 -84
- data/app/views/phcpress/articles/posts/edit.html.erb +32 -32
- data/app/views/phcpress/articles/posts/index.html.erb +69 -69
- data/app/views/phcpress/articles/posts/new.html.erb +32 -32
- data/app/views/phcpress/articles/posts/show.html.erb +40 -40
- data/app/views/phcpress/frontend/articles/index.html.erb +76 -76
- data/app/views/phcpress/frontend/articles/show.html.erb +72 -72
- data/app/views/phcpress/modules/categories/_form.html.erb +20 -20
- data/app/views/phcpress/modules/categories/edit.html.erb +39 -39
- data/app/views/phcpress/modules/categories/index.html.erb +66 -66
- data/app/views/phcpress/modules/categories/new.html.erb +39 -39
- data/app/views/phcpress/modules/categories/show.html.erb +40 -40
- data/app/views/phcpress/modules/connections/_form.html.erb +24 -24
- data/app/views/phcpress/modules/connections/edit.html.erb +39 -39
- data/app/views/phcpress/modules/connections/index.html.erb +66 -66
- data/app/views/phcpress/modules/connections/new.html.erb +39 -39
- data/app/views/phcpress/modules/connections/show.html.erb +50 -50
- data/config/initializers/friendly_id.rb +92 -92
- data/config/routes.rb +27 -27
- data/config/tinymce.yml +5 -5
- data/db/migrate/20160716182848_create_phcpress_modules_categories.rb +18 -18
- data/db/migrate/20160720181307_create_phcpress_articles_posts.rb +21 -21
- data/db/migrate/20160720235314_create_phcpress_modules_connections.rb +19 -19
- data/db/migrate/20170509180858_create_friendly_id_slugs.rb +15 -15
- data/lib/phcpress.rb +4 -4
- data/lib/phcpress/engine.rb +68 -68
- data/lib/phcpress/version.rb +3 -3
- data/lib/tasks/phcpress_tasks.rake +4 -4
- metadata +47 -5
@@ -1,20 +1,20 @@
|
|
1
|
-
require_dependency "phcpress/application_controller"
|
2
|
-
|
3
|
-
module Phcpress
|
4
|
-
class Frontend::ArticlesController < ApplicationController
|
5
|
-
|
6
|
-
# Security & Filters
|
7
|
-
layout '/layouts/phcpress/frontend.html.erb'
|
8
|
-
|
9
|
-
# Article Index
|
10
|
-
def index
|
11
|
-
@articles_index = Articles::Post.all
|
12
|
-
end
|
13
|
-
|
14
|
-
# Single Article Post
|
15
|
-
def show
|
16
|
-
@articles_single = Articles::Post.find(params[:id])
|
17
|
-
end
|
18
|
-
|
19
|
-
end
|
20
|
-
end
|
1
|
+
require_dependency "phcpress/application_controller"
|
2
|
+
|
3
|
+
module Phcpress
|
4
|
+
class Frontend::ArticlesController < ApplicationController
|
5
|
+
|
6
|
+
# Security & Filters
|
7
|
+
layout '/layouts/phcpress/frontend.html.erb'
|
8
|
+
|
9
|
+
# Article Index
|
10
|
+
def index
|
11
|
+
@articles_index = Articles::Post.all
|
12
|
+
end
|
13
|
+
|
14
|
+
# Single Article Post
|
15
|
+
def show
|
16
|
+
@articles_single = Articles::Post.find(params[:id])
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
@@ -1,65 +1,65 @@
|
|
1
|
-
require_dependency "phcpress/application_controller"
|
2
|
-
|
3
|
-
module Phcpress
|
4
|
-
class Modules::CategoriesController < ApplicationController
|
5
|
-
|
6
|
-
# Security and Filters
|
7
|
-
before_action :set_modules_category, only: [:show, :edit, :update, :destroy]
|
8
|
-
|
9
|
-
# Categories Index
|
10
|
-
def index
|
11
|
-
@modules_categories = Modules::Category.all
|
12
|
-
end
|
13
|
-
|
14
|
-
# Categories Show
|
15
|
-
def show
|
16
|
-
end
|
17
|
-
|
18
|
-
# Categories New
|
19
|
-
def new
|
20
|
-
@modules_category = Modules::Category.new
|
21
|
-
end
|
22
|
-
|
23
|
-
# Categories Edit
|
24
|
-
def edit
|
25
|
-
end
|
26
|
-
|
27
|
-
# POST
|
28
|
-
def create
|
29
|
-
@modules_category = Modules::Category.new(modules_category_params)
|
30
|
-
if @modules_category.save
|
31
|
-
redirect_to modules_categories_url, notice: 'Category was successfully created.'
|
32
|
-
else
|
33
|
-
render :new
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
# PATCH/PUT
|
38
|
-
def update
|
39
|
-
if @modules_category.update(modules_category_params)
|
40
|
-
redirect_to modules_categories_url, notice: 'Category was successfully updated.'
|
41
|
-
else
|
42
|
-
render :edit
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
# DELETE
|
47
|
-
def destroy
|
48
|
-
@modules_category.destroy
|
49
|
-
redirect_to modules_categories_url, notice: 'Category was successfully destroyed.'
|
50
|
-
end
|
51
|
-
|
52
|
-
private
|
53
|
-
|
54
|
-
# Common Callbacks
|
55
|
-
def set_modules_category
|
56
|
-
@modules_category = Modules::Category.find(params[:id])
|
57
|
-
end
|
58
|
-
|
59
|
-
# Whitelist
|
60
|
-
def modules_category_params
|
61
|
-
params.require(:modules_category).permit(:catname)
|
62
|
-
end
|
63
|
-
|
64
|
-
end
|
65
|
-
end
|
1
|
+
require_dependency "phcpress/application_controller"
|
2
|
+
|
3
|
+
module Phcpress
|
4
|
+
class Modules::CategoriesController < ApplicationController
|
5
|
+
|
6
|
+
# Security and Filters
|
7
|
+
before_action :set_modules_category, only: [:show, :edit, :update, :destroy]
|
8
|
+
|
9
|
+
# Categories Index
|
10
|
+
def index
|
11
|
+
@modules_categories = Modules::Category.all
|
12
|
+
end
|
13
|
+
|
14
|
+
# Categories Show
|
15
|
+
def show
|
16
|
+
end
|
17
|
+
|
18
|
+
# Categories New
|
19
|
+
def new
|
20
|
+
@modules_category = Modules::Category.new
|
21
|
+
end
|
22
|
+
|
23
|
+
# Categories Edit
|
24
|
+
def edit
|
25
|
+
end
|
26
|
+
|
27
|
+
# POST
|
28
|
+
def create
|
29
|
+
@modules_category = Modules::Category.new(modules_category_params)
|
30
|
+
if @modules_category.save
|
31
|
+
redirect_to modules_categories_url, notice: 'Category was successfully created.'
|
32
|
+
else
|
33
|
+
render :new
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
# PATCH/PUT
|
38
|
+
def update
|
39
|
+
if @modules_category.update(modules_category_params)
|
40
|
+
redirect_to modules_categories_url, notice: 'Category was successfully updated.'
|
41
|
+
else
|
42
|
+
render :edit
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
# DELETE
|
47
|
+
def destroy
|
48
|
+
@modules_category.destroy
|
49
|
+
redirect_to modules_categories_url, notice: 'Category was successfully destroyed.'
|
50
|
+
end
|
51
|
+
|
52
|
+
private
|
53
|
+
|
54
|
+
# Common Callbacks
|
55
|
+
def set_modules_category
|
56
|
+
@modules_category = Modules::Category.find(params[:id])
|
57
|
+
end
|
58
|
+
|
59
|
+
# Whitelist
|
60
|
+
def modules_category_params
|
61
|
+
params.require(:modules_category).permit(:catname)
|
62
|
+
end
|
63
|
+
|
64
|
+
end
|
65
|
+
end
|
@@ -1,65 +1,65 @@
|
|
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
|
-
if @modules_connection.save
|
31
|
-
redirect_to modules_connections_url, notice: 'Connection was successfully created.'
|
32
|
-
else
|
33
|
-
render :new
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
# PATCH/PUT
|
38
|
-
def update
|
39
|
-
if @modules_connection.update(modules_connection_params)
|
40
|
-
redirect_to modules_connections_url, notice: 'Connection was successfully updated.'
|
41
|
-
else
|
42
|
-
årender :edit
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
# DELETE
|
47
|
-
def destroy
|
48
|
-
@modules_connection.destroy
|
49
|
-
redirect_to modules_connections_url, notice: 'Connection was successfully destroyed.'
|
50
|
-
end
|
51
|
-
|
52
|
-
private
|
53
|
-
|
54
|
-
# Common Callbacks
|
55
|
-
def set_modules_connection
|
56
|
-
@modules_connection = Modules::Connection.find(params[:id])
|
57
|
-
end
|
58
|
-
|
59
|
-
# Whitelist
|
60
|
-
def modules_connection_params
|
61
|
-
params.require(:modules_connection).permit(:post_id, :category_id)
|
62
|
-
end
|
63
|
-
|
64
|
-
end
|
65
|
-
end
|
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
|
+
if @modules_connection.save
|
31
|
+
redirect_to modules_connections_url, notice: 'Connection was successfully created.'
|
32
|
+
else
|
33
|
+
render :new
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
# PATCH/PUT
|
38
|
+
def update
|
39
|
+
if @modules_connection.update(modules_connection_params)
|
40
|
+
redirect_to modules_connections_url, notice: 'Connection was successfully updated.'
|
41
|
+
else
|
42
|
+
årender :edit
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
# DELETE
|
47
|
+
def destroy
|
48
|
+
@modules_connection.destroy
|
49
|
+
redirect_to modules_connections_url, notice: 'Connection was successfully destroyed.'
|
50
|
+
end
|
51
|
+
|
52
|
+
private
|
53
|
+
|
54
|
+
# Common Callbacks
|
55
|
+
def set_modules_connection
|
56
|
+
@modules_connection = Modules::Connection.find(params[:id])
|
57
|
+
end
|
58
|
+
|
59
|
+
# Whitelist
|
60
|
+
def modules_connection_params
|
61
|
+
params.require(:modules_connection).permit(:post_id, :category_id)
|
62
|
+
end
|
63
|
+
|
64
|
+
end
|
65
|
+
end
|
@@ -1,14 +1,14 @@
|
|
1
|
-
module Phcpress
|
2
|
-
module ApplicationHelper
|
3
|
-
|
4
|
-
# Add Active to Menu
|
5
|
-
def is_active_controller(controller_name)
|
6
|
-
params[:controller] == controller_name ? "active open selected" : nil
|
7
|
-
end
|
8
|
-
|
9
|
-
def is_active_action(action_name)
|
10
|
-
params[:action] == action_name ? "active" : nil
|
11
|
-
end
|
12
|
-
|
13
|
-
end
|
14
|
-
end
|
1
|
+
module Phcpress
|
2
|
+
module ApplicationHelper
|
3
|
+
|
4
|
+
# Add Active to Menu
|
5
|
+
def is_active_controller(controller_name)
|
6
|
+
params[:controller] == controller_name ? "active open selected" : nil
|
7
|
+
end
|
8
|
+
|
9
|
+
def is_active_action(action_name)
|
10
|
+
params[:action] == action_name ? "active" : nil
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
14
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module Phcpress
|
2
|
-
class ApplicationJob < ActiveJob::Base
|
3
|
-
end
|
4
|
-
end
|
1
|
+
module Phcpress
|
2
|
+
class ApplicationJob < ActiveJob::Base
|
3
|
+
end
|
4
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
|
-
module Phcpress
|
2
|
-
class ApplicationMailer < ActionMailer::Base
|
3
|
-
default from: 'info@example.com'
|
4
|
-
layout 'mailer'
|
5
|
-
end
|
6
|
-
end
|
1
|
+
module Phcpress
|
2
|
+
class ApplicationMailer < ActionMailer::Base
|
3
|
+
default from: 'info@example.com'
|
4
|
+
layout 'mailer'
|
5
|
+
end
|
6
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module Phcpress
|
2
|
-
class Api::V1::Category < ApplicationRecord
|
3
|
-
end
|
4
|
-
end
|
1
|
+
module Phcpress
|
2
|
+
class Api::V1::Category < ApplicationRecord
|
3
|
+
end
|
4
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module Phcpress
|
2
|
-
class Api::V1::Post < ApplicationRecord
|
3
|
-
end
|
4
|
-
end
|
1
|
+
module Phcpress
|
2
|
+
class Api::V1::Post < ApplicationRecord
|
3
|
+
end
|
4
|
+
end
|
@@ -1,5 +1,5 @@
|
|
1
|
-
module Phcpress
|
2
|
-
class ApplicationRecord < ActiveRecord::Base
|
3
|
-
self.abstract_class = true
|
4
|
-
end
|
5
|
-
end
|
1
|
+
module Phcpress
|
2
|
+
class ApplicationRecord < ActiveRecord::Base
|
3
|
+
self.abstract_class = true
|
4
|
+
end
|
5
|
+
end
|
@@ -1,7 +1,7 @@
|
|
1
|
-
module Phcpress
|
2
|
-
module Articles
|
3
|
-
def self.table_name_prefix
|
4
|
-
'phcpress_articles_'
|
5
|
-
end
|
6
|
-
end
|
7
|
-
end
|
1
|
+
module Phcpress
|
2
|
+
module Articles
|
3
|
+
def self.table_name_prefix
|
4
|
+
'phcpress_articles_'
|
5
|
+
end
|
6
|
+
end
|
7
|
+
end
|
@@ -1,30 +1,30 @@
|
|
1
|
-
module Phcpress
|
2
|
-
class Articles::Post < ApplicationRecord
|
3
|
-
|
4
|
-
# Image Upload Initialize
|
5
|
-
mount_uploader :pstimage, Phcpress::PstimageUploader
|
6
|
-
|
7
|
-
# Clean URL Initialize
|
8
|
-
extend FriendlyId
|
9
|
-
|
10
|
-
# Paper_tail Initialize
|
11
|
-
has_paper_trail
|
12
|
-
|
13
|
-
# Model Relationships
|
14
|
-
has_many :connections, class_name: 'Phcpress::Modules::Connection', dependent: :destroy
|
15
|
-
has_many :categories, class_name: 'Phcpress::Modules::Category', :through => :connections
|
16
|
-
|
17
|
-
# Validation for Form Fields
|
18
|
-
validates :psttitle,
|
19
|
-
presence: true,
|
20
|
-
length: { minimum: 3 }
|
21
|
-
|
22
|
-
validates :psttext,
|
23
|
-
presence: true,
|
24
|
-
length: { minimum: 3 }
|
25
|
-
|
26
|
-
validates :pststatus,
|
27
|
-
presence: true
|
28
|
-
|
29
|
-
end
|
30
|
-
end
|
1
|
+
module Phcpress
|
2
|
+
class Articles::Post < ApplicationRecord
|
3
|
+
|
4
|
+
# Image Upload Initialize
|
5
|
+
mount_uploader :pstimage, Phcpress::PstimageUploader
|
6
|
+
|
7
|
+
# Clean URL Initialize
|
8
|
+
extend FriendlyId
|
9
|
+
|
10
|
+
# Paper_tail Initialize
|
11
|
+
has_paper_trail
|
12
|
+
|
13
|
+
# Model Relationships
|
14
|
+
has_many :connections, class_name: 'Phcpress::Modules::Connection', dependent: :destroy
|
15
|
+
has_many :categories, class_name: 'Phcpress::Modules::Category', :through => :connections
|
16
|
+
|
17
|
+
# Validation for Form Fields
|
18
|
+
validates :psttitle,
|
19
|
+
presence: true,
|
20
|
+
length: { minimum: 3 }
|
21
|
+
|
22
|
+
validates :psttext,
|
23
|
+
presence: true,
|
24
|
+
length: { minimum: 3 }
|
25
|
+
|
26
|
+
validates :pststatus,
|
27
|
+
presence: true
|
28
|
+
|
29
|
+
end
|
30
|
+
end
|