phcdevworks_core_modules 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +28 -0
- data/Rakefile +32 -0
- data/app/assets/config/phcdevworks_core_modules_manifest.js +2 -0
- data/app/assets/javascripts/phcdevworks_core_modules/application.js +2 -0
- data/app/assets/stylesheets/phcdevworks_core_modules/application.scss +2 -0
- data/app/controllers/phcdevworks_core_modules/application_controller.rb +13 -0
- data/app/controllers/phcdevworks_core_modules/modules/categories_controller.rb +81 -0
- data/app/helpers/phcdevworks_core_modules/application_helper.rb +4 -0
- data/app/helpers/phcdevworks_core_modules/modules/categories_helper.rb +4 -0
- data/app/jobs/phcdevworks_core_modules/application_job.rb +4 -0
- data/app/mailers/phcdevworks_core_modules/application_mailer.rb +6 -0
- data/app/models/phcdevworks_core_modules/application_record.rb +5 -0
- data/app/models/phcdevworks_core_modules/core_category_versions.rb +5 -0
- data/app/models/phcdevworks_core_modules/modules.rb +7 -0
- data/app/models/phcdevworks_core_modules/modules/category.rb +27 -0
- data/app/views/layouts/phcdevworks_core_modules/application.html.erb +136 -0
- data/app/views/layouts/phcdevworks_core_modules/components/backend/footer/_footer.html.erb +16 -0
- data/app/views/layouts/phcdevworks_core_modules/components/backend/navigation/_top_menu.html.erb +40 -0
- data/app/views/layouts/phcdevworks_core_modules/components/backend/sidebars/_side_menu.html.erb +291 -0
- data/app/views/phcdevworks_core_modules/modules/categories/_form.html.erb +22 -0
- data/app/views/phcdevworks_core_modules/modules/categories/edit.html.erb +47 -0
- data/app/views/phcdevworks_core_modules/modules/categories/index.html.erb +80 -0
- data/app/views/phcdevworks_core_modules/modules/categories/new.html.erb +47 -0
- data/app/views/phcdevworks_core_modules/modules/categories/show.html.erb +9 -0
- data/config/routes.rb +11 -0
- data/db/migrate/20170517064427_create_phcdevworks_core_category_versions.rb +17 -0
- data/db/migrate/20200629113153_create_phcdevworks_core_modules_modules_categories.rb +15 -0
- data/lib/phcdevworks_core_modules.rb +5 -0
- data/lib/phcdevworks_core_modules/engine.rb +36 -0
- data/lib/phcdevworks_core_modules/version.rb +3 -0
- data/lib/tasks/phcdevworks_core_modules_tasks.rake +4 -0
- metadata +319 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: f9499b528618ff07b54241e476d118997171a4fe3c0f65013412066a4879a375
|
4
|
+
data.tar.gz: 9217ba7d816ca88bc00f3e324fba47e8ccc07dccf31fefc6f9937b9332714f0e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 3e8f85c82a5588b7291aa904191084070b85a7d7b5c3a14dac2bfba7b5bd7c6f1b4cf493ac80d62b5ac0abd27bd198cd9924e92c957449aebc44d37e7c0ba662
|
7
|
+
data.tar.gz: 27ccaf7a4e540678d7628c1182586f52ebecf51d131833fdfc1a682a59f819613990aa245e5071a1f31ef097f39cabfe11e58f6b0495b962697cc6a0c9720755
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2020 BradPotts
|
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
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# PhcdevworksCoreModules
|
2
|
+
Short description and motivation.
|
3
|
+
|
4
|
+
## Usage
|
5
|
+
How to use my plugin.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
Add this line to your application's Gemfile:
|
9
|
+
|
10
|
+
```ruby
|
11
|
+
gem 'phcdevworks_core_modules'
|
12
|
+
```
|
13
|
+
|
14
|
+
And then execute:
|
15
|
+
```bash
|
16
|
+
$ bundle
|
17
|
+
```
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
```bash
|
21
|
+
$ gem install phcdevworks_core_modules
|
22
|
+
```
|
23
|
+
|
24
|
+
## Contributing
|
25
|
+
Contribution directions go here.
|
26
|
+
|
27
|
+
## License
|
28
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
@@ -0,0 +1,32 @@
|
|
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 = 'PhcdevworksCoreModules'
|
12
|
+
rdoc.options << '--line-numbers'
|
13
|
+
rdoc.rdoc_files.include('README.md')
|
14
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
|
+
end
|
16
|
+
|
17
|
+
APP_RAKEFILE = File.expand_path("test/test_app/Rakefile", __dir__)
|
18
|
+
load 'rails/tasks/engine.rake'
|
19
|
+
|
20
|
+
load 'rails/tasks/statistics.rake'
|
21
|
+
|
22
|
+
require 'bundler/gem_tasks'
|
23
|
+
|
24
|
+
require 'rake/testtask'
|
25
|
+
|
26
|
+
Rake::TestTask.new(:test) do |t|
|
27
|
+
t.libs << 'test'
|
28
|
+
t.pattern = 'test/**/*_test.rb'
|
29
|
+
t.verbose = false
|
30
|
+
end
|
31
|
+
|
32
|
+
task default: :test
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module PhcdevworksCoreModules
|
2
|
+
class ApplicationController < ActionController::Base
|
3
|
+
|
4
|
+
# Security Filters
|
5
|
+
protect_from_forgery with: :exception
|
6
|
+
|
7
|
+
# Load Requried Helper Files
|
8
|
+
helper PhcdevworksActiveMenus::Engine.helpers
|
9
|
+
helper PhcdevworksNotifications::Engine.helpers
|
10
|
+
helper PhcdevworksTitleseo::Engine.helpers
|
11
|
+
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,81 @@
|
|
1
|
+
require_dependency "phcdevworks_core_modules/application_controller"
|
2
|
+
|
3
|
+
module PhcdevworksCoreModules
|
4
|
+
class Modules::CategoriesController < ApplicationController
|
5
|
+
|
6
|
+
# Filters & Security
|
7
|
+
#include PhcdevworksCore::PhcpluginsHelper
|
8
|
+
before_action :authenticate_user!
|
9
|
+
before_action :set_paper_trail_whodunnit
|
10
|
+
before_action :set_modules_category, only: [:show, :edit, :update, :destroy]
|
11
|
+
|
12
|
+
# GET /modules/categories
|
13
|
+
def index
|
14
|
+
@modules_categories = Modules::Category.all
|
15
|
+
end
|
16
|
+
|
17
|
+
# GET /modules/categories/1
|
18
|
+
def show
|
19
|
+
end
|
20
|
+
|
21
|
+
# GET /modules/categories/new
|
22
|
+
def new
|
23
|
+
@modules_category = Modules::Category.new
|
24
|
+
end
|
25
|
+
|
26
|
+
# GET /modules/categories/1/edit
|
27
|
+
def edit
|
28
|
+
end
|
29
|
+
|
30
|
+
# POST /modules/categories
|
31
|
+
def create
|
32
|
+
@modules_category = Modules::Category.new(modules_category_params)
|
33
|
+
@modules_category.user_id = current_user.id
|
34
|
+
@modules_category.org_id = current_user.org_id
|
35
|
+
respond_to do |format|
|
36
|
+
if @modules_category.save
|
37
|
+
format.html { redirect_to modules_categories_path, :flash => { :success => 'Category has been Added.' }}
|
38
|
+
format.json { render :show, status: :created, location: @modules_category }
|
39
|
+
else
|
40
|
+
format.html { render :new }
|
41
|
+
format.json { render json: @modules_category.errors, status: :unprocessable_entity }
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
# PATCH/PUT /modules/categories/1
|
47
|
+
def update
|
48
|
+
respond_to do |format|
|
49
|
+
if @modules_category.update(modules_category_params)
|
50
|
+
format.html { redirect_to modules_categories_path, :flash => { :notice => 'Tutorial has been Updated.' }}
|
51
|
+
format.json { render :show, status: :ok, location: @modules_category }
|
52
|
+
else
|
53
|
+
format.html { render :edit }
|
54
|
+
format.json { render json: @modules_category.errors, status: :unprocessable_entity }
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
# DELETE /modules/categories/1
|
60
|
+
def destroy
|
61
|
+
@modules_category.destroy
|
62
|
+
respond_to do |format|
|
63
|
+
format.html { redirect_to modules_categories_path, :flash => { :error => 'Categories and Category Connections have all been Removed.' }}
|
64
|
+
format.json { head :no_content }
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
private
|
69
|
+
|
70
|
+
# Common Callbacks
|
71
|
+
def set_modules_category
|
72
|
+
@modules_category = Modules::Category.find(params[:id])
|
73
|
+
end
|
74
|
+
|
75
|
+
# Whitelist
|
76
|
+
def modules_category_params
|
77
|
+
params.require(:modules_category).permit(:category_name)
|
78
|
+
end
|
79
|
+
|
80
|
+
end
|
81
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module PhcdevworksCoreModules
|
2
|
+
class Modules::Category < ApplicationRecord
|
3
|
+
|
4
|
+
# Clean URL Initialize
|
5
|
+
extend FriendlyId
|
6
|
+
|
7
|
+
# Paper Trail Initialize
|
8
|
+
has_paper_trail :class_name => "PhcdevworksCoreModules::CoreCategoryVersions"
|
9
|
+
|
10
|
+
# Relationships
|
11
|
+
has_and_belongs_to_many :posts, class_name: "Article::Post", :join_table => "phcdevworks_press_categories_posts", :dependent => :destroy
|
12
|
+
belongs_to :user, class_name: "PhcdevworksAccounts::User"
|
13
|
+
|
14
|
+
# Form Fields Validation
|
15
|
+
validates :category_name,
|
16
|
+
presence: true,
|
17
|
+
uniqueness: true
|
18
|
+
|
19
|
+
# Clean URL Define
|
20
|
+
friendly_id :phcdev_core_category_nice_urls, use: [:slugged, :finders]
|
21
|
+
|
22
|
+
def phcdev_core_category_nice_urls
|
23
|
+
[:category_name]
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,136 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
|
5
|
+
<!-- SEO System -->
|
6
|
+
<% phc_seo_title "PHCDevworks Categories" %>
|
7
|
+
<% phc_seo_description "Core Category Manager for PHCDevworks Plugins" %>
|
8
|
+
<!-- SEO System -->
|
9
|
+
|
10
|
+
<!-- SEO and Site Description -->
|
11
|
+
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
12
|
+
<title><%= yield(:phc_seo_title) %></title>
|
13
|
+
<meta name="description" content="<%= yield(:phc_seo_description) %>">
|
14
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" >
|
15
|
+
<link rel="canonical" href="http://phcdevworks.com">
|
16
|
+
<!-- SEO and Site Description -->
|
17
|
+
|
18
|
+
<!-- Rails Security Tags -->
|
19
|
+
<%= csrf_meta_tags %>
|
20
|
+
<%= csp_meta_tag %>
|
21
|
+
<!-- Rails Security Tags -->
|
22
|
+
|
23
|
+
<!-- CSS Styles -->
|
24
|
+
<%= stylesheet_link_tag "phcdevworks_core_modules/application", media: "all" %>
|
25
|
+
<!-- CSS Styles -->
|
26
|
+
|
27
|
+
<!-- Font -->
|
28
|
+
<link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=Open+Sans:300,400%7CRaleway:300,400,500,600,700%7CLato:300,400,400italic,600,700"/>
|
29
|
+
<!-- Font -->
|
30
|
+
|
31
|
+
</head>
|
32
|
+
<body>
|
33
|
+
|
34
|
+
<!-- Page Container -->
|
35
|
+
<div id="page-container" class="fade page-sidebar-fixed page-header-fixed">
|
36
|
+
|
37
|
+
<!-- Page Header -->
|
38
|
+
<div id="header" class="header navbar-default">
|
39
|
+
<%= render "layouts/phcdevworks_core_modules/components/backend/navigation/top_menu" %>
|
40
|
+
</div>
|
41
|
+
<!-- Page Header -->
|
42
|
+
|
43
|
+
<!-- Page Sidebar -->
|
44
|
+
<div id="sidebar" class="sidebar">
|
45
|
+
<%= render "layouts/phcdevworks_core_modules/components/backend/sidebars/side_menu" %>
|
46
|
+
</div>
|
47
|
+
<div class="sidebar-bg"></div>
|
48
|
+
<!-- Page Sidebar -->
|
49
|
+
|
50
|
+
<!-- Page Content -->
|
51
|
+
<div id="content" class="content">
|
52
|
+
<%= render "phcdevworks_notifications/bootstrap/notifications" %>
|
53
|
+
<%= yield %>
|
54
|
+
</div>
|
55
|
+
<!-- Page Content -->
|
56
|
+
|
57
|
+
<!-- Footer Content -->
|
58
|
+
<div id="footer" class="footer mb-4">
|
59
|
+
<%= render "layouts/phcdevworks_core_modules/components/backend/footer/footer" %>
|
60
|
+
</div>
|
61
|
+
<!-- Footer Content -->
|
62
|
+
|
63
|
+
</div>
|
64
|
+
<!-- Page Container -->
|
65
|
+
|
66
|
+
<!-- JavaScript -->
|
67
|
+
<%= javascript_include_tag "phcdevworks_core_modules/application", "data-turbolinks-track": "reload" %>
|
68
|
+
<!-- JavaScript -->
|
69
|
+
|
70
|
+
<!-- JavaScript CKEditor -->
|
71
|
+
<script>ClassicEditor
|
72
|
+
.create( document.querySelector( '.editor' ), {
|
73
|
+
toolbar: {
|
74
|
+
items: [
|
75
|
+
'heading',
|
76
|
+
'|',
|
77
|
+
'fontBackgroundColor',
|
78
|
+
'fontColor',
|
79
|
+
'horizontalLine',
|
80
|
+
'fontSize',
|
81
|
+
'fontFamily',
|
82
|
+
'highlight',
|
83
|
+
'|',
|
84
|
+
'bold',
|
85
|
+
'underline',
|
86
|
+
'italic',
|
87
|
+
'strikethrough',
|
88
|
+
'link',
|
89
|
+
'removeFormat',
|
90
|
+
'|',
|
91
|
+
'alignment',
|
92
|
+
'indent',
|
93
|
+
'outdent',
|
94
|
+
'|',
|
95
|
+
'blockQuote',
|
96
|
+
'insertTable',
|
97
|
+
'undo',
|
98
|
+
'redo',
|
99
|
+
'|',
|
100
|
+
'subscript',
|
101
|
+
'superscript',
|
102
|
+
'|',
|
103
|
+
'codeBlock',
|
104
|
+
'code',
|
105
|
+
'|',
|
106
|
+
'MathType',
|
107
|
+
'ChemType',
|
108
|
+
'specialCharacters'
|
109
|
+
]
|
110
|
+
},
|
111
|
+
language: 'en',
|
112
|
+
table: {
|
113
|
+
contentToolbar: [
|
114
|
+
'tableColumn',
|
115
|
+
'tableRow',
|
116
|
+
'mergeTableCells',
|
117
|
+
'tableCellProperties',
|
118
|
+
'tableProperties'
|
119
|
+
]
|
120
|
+
},
|
121
|
+
licenseKey: '',
|
122
|
+
} )
|
123
|
+
.then( editor => {
|
124
|
+
window.editor = editor;
|
125
|
+
} )
|
126
|
+
.catch( error => {
|
127
|
+
console.error( 'Oops, something gone wrong!' );
|
128
|
+
console.error( 'Please, report the following error in the https://github.com/ckeditor/ckeditor5 with the build id and the error stack trace:' );
|
129
|
+
console.warn( 'Build id: ulhl6ym1zxhr-qh8kt6relt0l' );
|
130
|
+
console.error( error );
|
131
|
+
} );
|
132
|
+
</script>
|
133
|
+
<!-- JavaScript CKEditor -->
|
134
|
+
|
135
|
+
</body>
|
136
|
+
</html>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<!-- Footer Content - Left -->
|
2
|
+
<span>
|
3
|
+
<!-- Footer Content - Left - Time in Production -->
|
4
|
+
<i class="fab fa-osi font-weight-bolder"></i> 2012-<%= Time.now.year %> -
|
5
|
+
<span class="font-weight-bold">PHC</span>Devworks Core -
|
6
|
+
Engine v<%= Gem.loaded_specs["phcdevworks_core_modules"].version.to_s %>
|
7
|
+
<!-- Footer Content - Left - Time in Production -->
|
8
|
+
</span>
|
9
|
+
<!-- Footer Content - Left -->
|
10
|
+
|
11
|
+
<!-- Footer Content - Right -->
|
12
|
+
<span class="float-right">
|
13
|
+
Developed with <i class="fas fa-heart hanna_hearts"></i> by
|
14
|
+
<a class="phcnet_copyright text-dark" href="https://phcdevworks.com/"><u><span class="font-weight-bold">PHC</span>Devworks</u></a>
|
15
|
+
</span>
|
16
|
+
<!-- Footer Content - Right -->
|
data/app/views/layouts/phcdevworks_core_modules/components/backend/navigation/_top_menu.html.erb
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
<!-- -PHC- Topbar - Navigation Header -->
|
2
|
+
<div class="navbar-header">
|
3
|
+
|
4
|
+
<%= link_to phcdevworks_core_modules.modules_categories_path, class: "navbar-brand" do %>
|
5
|
+
<strong>PHCDevworks</strong>Press
|
6
|
+
<% end %>
|
7
|
+
|
8
|
+
<button type="button" class="navbar-toggle" data-click="sidebar-toggled">
|
9
|
+
<span class="icon-bar"></span>
|
10
|
+
<span class="icon-bar"></span>
|
11
|
+
<span class="icon-bar"></span>
|
12
|
+
</button>
|
13
|
+
|
14
|
+
</div>
|
15
|
+
<!-- -PHC- Topbar - Navigation Header -->
|
16
|
+
|
17
|
+
<!-- -PHC- Topbar - Navigation Main -->
|
18
|
+
<% if current_user %>
|
19
|
+
<ul class="navbar-nav navbar-right">
|
20
|
+
|
21
|
+
<!-- -PHC- Topbar - Navigation Main - User Menu -->
|
22
|
+
<li class="dropdown navbar-user">
|
23
|
+
<a href="javascript:;" class="dropdown-toggle" data-toggle="dropdown">
|
24
|
+
<%= image_tag current_user.gravatar_url %>
|
25
|
+
<span class="d-none d-md-inline"><%= current_user.firstname + " " + current_user.lastname %></span> <b class="caret"></b>
|
26
|
+
</a>
|
27
|
+
<div class="dropdown-menu dropdown-menu-right">
|
28
|
+
<%= link_to phcdevworks_accounts.edit_user_registration_path, class: "dropdown-item" do %>
|
29
|
+
<i class="fad fa-cogs"></i> Account Settings
|
30
|
+
<% end %>
|
31
|
+
<%= link_to phcdevworks_accounts.destroy_user_session_path, method: :delete, class: "dropdown-item" do %>
|
32
|
+
<i class="fad fa-sign-out-alt"></i> Logout
|
33
|
+
<% end %>
|
34
|
+
</div>
|
35
|
+
</li>
|
36
|
+
<!-- -PHC- Topbar - Navigation Main - User Menu -->
|
37
|
+
|
38
|
+
</ul>
|
39
|
+
<% end %>
|
40
|
+
<!-- -PHC- Topbar - Navigation Main -->
|