phcdevworks_tutorials 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +28 -0
  4. data/Rakefile +32 -0
  5. data/app/assets/config/phcdevworks_tutorials_manifest.js +2 -0
  6. data/app/assets/javascripts/phcdevworks_tutorials/application.js +2 -0
  7. data/app/assets/javascripts/phcdevworks_tutorials/tutorial/categories.coffee +3 -0
  8. data/app/assets/javascripts/phcdevworks_tutorials/tutorial/posts.coffee +3 -0
  9. data/app/assets/stylesheets/phcdevworks_tutorials/application.scss +2 -0
  10. data/app/assets/stylesheets/phcdevworks_tutorials/tutorial/categories.scss +3 -0
  11. data/app/assets/stylesheets/phcdevworks_tutorials/tutorial/posts.scss +3 -0
  12. data/app/controllers/phcdevworks_tutorials/application_controller.rb +13 -0
  13. data/app/controllers/phcdevworks_tutorials/tutorial/categories_controller.rb +79 -0
  14. data/app/controllers/phcdevworks_tutorials/tutorial/posts_controller.rb +79 -0
  15. data/app/helpers/phcdevworks_tutorials/application_helper.rb +4 -0
  16. data/app/helpers/phcdevworks_tutorials/tutorial/categories_helper.rb +4 -0
  17. data/app/helpers/phcdevworks_tutorials/tutorial/posts_helper.rb +4 -0
  18. data/app/jobs/phcdevworks_tutorials/application_job.rb +4 -0
  19. data/app/mailers/phcdevworks_tutorials/application_mailer.rb +6 -0
  20. data/app/models/phcdevworks_tutorials/application_record.rb +5 -0
  21. data/app/models/phcdevworks_tutorials/tutorial.rb +7 -0
  22. data/app/models/phcdevworks_tutorials/tutorial/category.rb +4 -0
  23. data/app/models/phcdevworks_tutorials/tutorial/post.rb +5 -0
  24. data/app/views/layouts/phcdevworks_tutorials/application.html.erb +94 -0
  25. data/app/views/layouts/phcdevworks_tutorials/components/backend/footer/_footer.html.erb +16 -0
  26. data/app/views/layouts/phcdevworks_tutorials/components/backend/navigation/_top_menu.html.erb +37 -0
  27. data/app/views/layouts/phcdevworks_tutorials/components/backend/sidebars/_side_menu.html.erb +239 -0
  28. data/app/views/phcdevworks_tutorials/tutorial/categories/_form.html.erb +16 -0
  29. data/app/views/phcdevworks_tutorials/tutorial/categories/edit.html.erb +39 -0
  30. data/app/views/phcdevworks_tutorials/tutorial/categories/index.html.erb +69 -0
  31. data/app/views/phcdevworks_tutorials/tutorial/categories/new.html.erb +39 -0
  32. data/app/views/phcdevworks_tutorials/tutorial/categories/show.html.erb +9 -0
  33. data/app/views/phcdevworks_tutorials/tutorial/posts/_form.html.erb +32 -0
  34. data/app/views/phcdevworks_tutorials/tutorial/posts/edit.html.erb +39 -0
  35. data/app/views/phcdevworks_tutorials/tutorial/posts/index.html.erb +75 -0
  36. data/app/views/phcdevworks_tutorials/tutorial/posts/new.html.erb +39 -0
  37. data/app/views/phcdevworks_tutorials/tutorial/posts/show.html.erb +19 -0
  38. data/config/routes.rb +12 -0
  39. data/db/migrate/20190911225813_create_phcdevworks_tutorials_tutorial_posts.rb +19 -0
  40. data/db/migrate/20190911225925_create_phcdevworks_tutorials_tutorial_categories.rb +15 -0
  41. data/lib/phcdevworks_tutorials.rb +5 -0
  42. data/lib/phcdevworks_tutorials/engine.rb +33 -0
  43. data/lib/phcdevworks_tutorials/version.rb +3 -0
  44. data/lib/tasks/phcdevworks_tutorials_tasks.rake +4 -0
  45. metadata +302 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 28b9d3366f784b55eb37f4867424ef54839f7bf132a44025634fe48656f99a7d
4
+ data.tar.gz: 227d8db5940c96e022304ffcd3de81987cd042dfd516ee338bab999b70c992c2
5
+ SHA512:
6
+ metadata.gz: 366692f9dc6da7c1f56088e5b8cff5b4844b698ea66495c595b34cc48eeb80370d4f16e772b2bd06344121eb26410e9ec56bab84e68453e073573c55d6482c20
7
+ data.tar.gz: 3aeddc2495c318d75b21338f790c23a33b10f9363c0faa87943313869a1ef4d6b2b829ec5f82da0fb251564c7ed3d6030c11fedf109e5de3140533e3249b4118
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2019 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
+ # PhcdevworksTutorials
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_tutorials'
12
+ ```
13
+
14
+ And then execute:
15
+ ```bash
16
+ $ bundle
17
+ ```
18
+
19
+ Or install it yourself as:
20
+ ```bash
21
+ $ gem install phcdevworks_tutorials
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 = 'PhcdevworksTutorials'
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,2 @@
1
+ //= link_directory ../javascripts/phcdevworks_tutorials .js
2
+ //= link_directory ../stylesheets/phcdevworks_tutorials .scss
@@ -0,0 +1,2 @@
1
+ // Load Admin Theme
2
+ //= require phcthemes_admin_panel_pack_coloradmin
@@ -0,0 +1,3 @@
1
+ # Place all the behaviors and hooks related to the matching controller here.
2
+ # All this logic will automatically be available in application.js.
3
+ # You can use CoffeeScript in this file: http://coffeescript.org/
@@ -0,0 +1,3 @@
1
+ # Place all the behaviors and hooks related to the matching controller here.
2
+ # All this logic will automatically be available in application.js.
3
+ # You can use CoffeeScript in this file: http://coffeescript.org/
@@ -0,0 +1,2 @@
1
+ // Load Admin Theme
2
+ @import "phcthemes_admin_panel_pack_coloradmin";
@@ -0,0 +1,3 @@
1
+ // Place all the styles related to the tutorial::categories controller here.
2
+ // They will automatically be included in application.css.
3
+ // You can use Sass (SCSS) here: https://sass-lang.com/
@@ -0,0 +1,3 @@
1
+ // Place all the styles related to the tutorial::posts controller here.
2
+ // They will automatically be included in application.css.
3
+ // You can use Sass (SCSS) here: https://sass-lang.com/
@@ -0,0 +1,13 @@
1
+ module PhcdevworksTutorials
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,79 @@
1
+ require_dependency "phcdevworks_tutorials/application_controller"
2
+
3
+ module PhcdevworksTutorials
4
+ class Tutorial::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_tutorial_category, only: [:show, :edit, :update, :destroy]
11
+
12
+ # GET /tutorial/categories
13
+ def index
14
+ @tutorial_categories = Tutorial::Category.all
15
+ end
16
+
17
+ # GET /tutorial/categories/1
18
+ def show
19
+ end
20
+
21
+ # GET /tutorial/categories/new
22
+ def new
23
+ @tutorial_category = Tutorial::Category.new
24
+ end
25
+
26
+ # GET /tutorial/categories/1/edit
27
+ def edit
28
+ end
29
+
30
+ # POST /tutorial/categories
31
+ def create
32
+ @tutorial_category = Tutorial::Category.new(tutorial_category_params)
33
+ respond_to do |format|
34
+ if @tutorial_category.save
35
+ format.html { redirect_to tutorial_categories_path, :flash => { :success => 'Tutorial has been Added.' }}
36
+ format.json { render :show, status: :created, location: @tutorial_category }
37
+ else
38
+ format.html { render :new }
39
+ format.json { render json: @tutorial_category.errors, status: :unprocessable_entity }
40
+ end
41
+ end
42
+ end
43
+
44
+ # PATCH/PUT /tutorial/categories/1
45
+ def update
46
+ respond_to do |format|
47
+ if @tutorial_category.update(tutorial_category_params)
48
+ format.html { redirect_to tutorial_categories_path, :flash => { :notice => 'Tutorial has been Updated.' }}
49
+ format.json { render :show, status: :ok, location: @tutorial_category }
50
+ else
51
+ format.html { render :edit }
52
+ format.json { render json: @tutorial_category.errors, status: :unprocessable_entity }
53
+ end
54
+ end
55
+ end
56
+
57
+ # DELETE /tutorial/categories/1
58
+ def destroy
59
+ @tutorial_category.destroy
60
+ respond_to do |format|
61
+ format.html { redirect_to tutorial_categories_path, :flash => { :error => 'Categories and Connections have all been Removed.' }}
62
+ format.json { head :no_content }
63
+ end
64
+ end
65
+
66
+ private
67
+
68
+ # Common Callbacks
69
+ def set_tutorial_category
70
+ @tutorial_category = Tutorial::Category.find(params[:id])
71
+ end
72
+
73
+ # Whitelist
74
+ def tutorial_category_params
75
+ params.require(:tutorial_category).permit(:tutorial_category_name)
76
+ end
77
+
78
+ end
79
+ end
@@ -0,0 +1,79 @@
1
+ require_dependency "phcdevworks_tutorials/application_controller"
2
+
3
+ module PhcdevworksTutorials
4
+ class Tutorial::PostsController < 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_tutorial_post, only: [:show, :edit, :update, :destroy]
11
+
12
+ # GET /tutorial/posts
13
+ def index
14
+ @tutorial_posts = Tutorial::Post.all
15
+ end
16
+
17
+ # GET /tutorial/posts/1
18
+ def show
19
+ end
20
+
21
+ # GET /tutorial/posts/new
22
+ def new
23
+ @tutorial_post = Tutorial::Post.new
24
+ end
25
+
26
+ # GET /tutorial/posts/1/edit
27
+ def edit
28
+ end
29
+
30
+ # POST /tutorial/posts
31
+ def create
32
+ @tutorial_post = Tutorial::Post.new(tutorial_post_params)
33
+ respond_to do |format|
34
+ if @tutorial_post.save
35
+ format.html { redirect_to tutorial_posts_path, :flash => { :success => 'Tutorial has been Added.' }}
36
+ format.json { render :show, status: :created, location: @tutorial_post }
37
+ else
38
+ format.html { render :new }
39
+ format.json { render json: @tutorial_post.errors, status: :unprocessable_entity }
40
+ end
41
+ end
42
+ end
43
+
44
+ # PATCH/PUT /tutorial/posts/1
45
+ def update
46
+ respond_to do |format|
47
+ if @tutorial_post.update(tutorial_post_params)
48
+ format.html { redirect_to tutorial_posts_path, :flash => { :notice => 'Tutorial has been Updated.' }}
49
+ format.json { render :show, status: :ok, location: @tutorial_post }
50
+ else
51
+ format.html { render :edit }
52
+ format.json { render json: @tutorial_post.errors, status: :unprocessable_entity }
53
+ end
54
+ end
55
+ end
56
+
57
+ # DELETE /tutorial/posts/1
58
+ def destroy
59
+ @tutorial_post.destroy
60
+ respond_to do |format|
61
+ format.html { redirect_to tutorial_posts_path, :flash => { :error => 'Tutorial has been Removed.' }}
62
+ format.json { head :no_content }
63
+ end
64
+ end
65
+
66
+ private
67
+
68
+ # Common Callbacks
69
+ def set_tutorial_post
70
+ @tutorial_post = Tutorial::Post.find(params[:id])
71
+ end
72
+
73
+ # Whitelist
74
+ def tutorial_post_params
75
+ params.require(:tutorial_post).permit(:tutorial_post_step, :tutorial_post_title, :tutorial_post_text, :category_id)
76
+ end
77
+
78
+ end
79
+ end
@@ -0,0 +1,4 @@
1
+ module PhcdevworksTutorials
2
+ module ApplicationHelper
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module PhcdevworksTutorials
2
+ module Tutorial::CategoriesHelper
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module PhcdevworksTutorials
2
+ module Tutorial::PostsHelper
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module PhcdevworksTutorials
2
+ class ApplicationJob < ActiveJob::Base
3
+ end
4
+ end
@@ -0,0 +1,6 @@
1
+ module PhcdevworksTutorials
2
+ class ApplicationMailer < ActionMailer::Base
3
+ default from: 'from@example.com'
4
+ layout 'mailer'
5
+ end
6
+ end
@@ -0,0 +1,5 @@
1
+ module PhcdevworksTutorials
2
+ class ApplicationRecord < ActiveRecord::Base
3
+ self.abstract_class = true
4
+ end
5
+ end
@@ -0,0 +1,7 @@
1
+ module PhcdevworksTutorials
2
+ module Tutorial
3
+ def self.table_name_prefix
4
+ 'phcdevworks_tutorials_tutorial_'
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,4 @@
1
+ module PhcdevworksTutorials
2
+ class Tutorial::Category < ApplicationRecord
3
+ end
4
+ end
@@ -0,0 +1,5 @@
1
+ module PhcdevworksTutorials
2
+ class Tutorial::Post < ApplicationRecord
3
+ belongs_to :category
4
+ end
5
+ end
@@ -0,0 +1,94 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+
5
+ <!-- SEO System -->
6
+ <% phc_seo_title "PHCTutorials by PHCDevworks" %>
7
+ <% phc_seo_description "Ruby on Rails 6 Tutorial engine to manage and post tutorials." %>
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_tutorials/application', media: 'all', 'data-turbolinks-track': 'reload' %>
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_tutorials/components/backend/navigation/top_menu' %>
40
+ </div>
41
+ <!-- Page Header -->
42
+
43
+ <!-- Page Sidebar -->
44
+ <div id="sidebar" class="sidebar">
45
+ <%= render 'layouts/phcdevworks_tutorials/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_tutorials/components/backend/footer/footer' %>
60
+ </div>
61
+ <!-- Footer Content -->
62
+
63
+ </div>
64
+ <!-- Page Container -->
65
+
66
+ <!-- JavaScript -->
67
+ <%= javascript_include_tag "phcdevworks_tutorials/application", 'data-turbolinks-track': 'reload' %>
68
+ <!-- JavaScript -->
69
+
70
+ <!-- JavaScript CKEditor -->
71
+ <script>
72
+ ClassicEditor.create( document.querySelector( '#editor' ) )
73
+ .then( editor => {
74
+ window.editor = editor;
75
+ const wordCountPlugin = editor.plugins.get( 'WordCount' );
76
+ const wordCountWrapper = document.getElementById( 'word-count' );
77
+ wordCountWrapper.appendChild( wordCountPlugin.wordCountContainer );
78
+ } )
79
+ .catch( err => {
80
+ console.error( err.stack );
81
+ } );
82
+ </script>
83
+ <!-- JavaScript CKEditor -->
84
+
85
+ <!-- JavaScript Loader -->
86
+ <script>
87
+ $(document).ready(function() {
88
+ App.init();
89
+ });
90
+ </script>
91
+ <!-- JavaScript Loader -->
92
+
93
+ </body>
94
+ </html>