phcdevworks_tutorials 6.10.0 → 8.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/phcdevworks_tutorials/command/items_controller.rb +5 -5
- data/app/controllers/phcdevworks_tutorials/command/posts_controller.rb +21 -10
- data/app/controllers/phcdevworks_tutorials/tutorial/posts_controller.rb +1 -1
- data/app/controllers/phcdevworks_tutorials/tutorial/steps_controller.rb +4 -4
- data/app/models/phcdevworks_tutorials/command/item.rb +2 -1
- data/app/models/phcdevworks_tutorials/command/post.rb +3 -2
- data/app/models/phcdevworks_tutorials/tutorial/post.rb +3 -2
- data/app/models/phcdevworks_tutorials/tutorial/step.rb +3 -1
- data/app/views/layouts/phcdevworks_tutorials/components/backend/sidebars/_side_menu.html.erb +75 -80
- data/app/views/phcdevworks_tutorials/command/items/_form.html.erb +5 -0
- data/app/views/phcdevworks_tutorials/command/items/index.html.erb +1 -3
- data/app/views/phcdevworks_tutorials/command/posts/_form.html.erb +7 -2
- data/app/views/phcdevworks_tutorials/command/posts/index.html.erb +1 -1
- data/app/views/phcdevworks_tutorials/command/posts/show.html.erb +71 -11
- data/app/views/phcdevworks_tutorials/tutorial/posts/_form.html.erb +7 -2
- data/app/views/phcdevworks_tutorials/tutorial/posts/index.html.erb +1 -1
- data/app/views/phcdevworks_tutorials/tutorial/steps/_form.html.erb +5 -1
- data/app/views/phcdevworks_tutorials/tutorial/steps/index.html.erb +1 -0
- data/config/routes.rb +2 -2
- data/db/migrate/20200702121306_remove_images_cols_from_phcdevworks_tutorials.rb +10 -0
- data/db/migrate/20200707115652_create_phcdevworks_tutorials_add_seo.rb +10 -0
- data/lib/phcdevworks_tutorials/engine.rb +27 -26
- data/lib/phcdevworks_tutorials/version.rb +1 -1
- metadata +32 -30
- data/app/assets/javascripts/phcdevworks_tutorials/tutorial/categories.coffee +0 -3
- data/app/assets/stylesheets/phcdevworks_tutorials/category/posts.css +0 -4
- data/app/assets/stylesheets/phcdevworks_tutorials/tutorial/categories.scss +0 -3
- data/app/controllers/phcdevworks_tutorials/tutorial/categories_controller.rb +0 -81
- data/app/helpers/phcdevworks_tutorials/tutorial/categories_helper.rb +0 -4
- data/app/models/phcdevworks_tutorials/tutorial/category.rb +0 -27
- data/app/models/phcdevworks_tutorials/tutorial_category_versions.rb +0 -5
- data/app/views/phcdevworks_tutorials/tutorial/categories/_form.html.erb +0 -22
- data/app/views/phcdevworks_tutorials/tutorial/categories/edit.html.erb +0 -47
- data/app/views/phcdevworks_tutorials/tutorial/categories/index.html.erb +0 -80
- data/app/views/phcdevworks_tutorials/tutorial/categories/new.html.erb +0 -47
- data/app/views/phcdevworks_tutorials/tutorial/categories/show.html.erb +0 -9
- data/db/migrate/20191018124910_create_phcdevworks_tutorials_tutorial_categories.rb +0 -15
- data/db/migrate/20191102093157_create_phcdevworks_tutorials_tutorial_category_versions.rb +0 -16
@@ -1,81 +0,0 @@
|
|
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
|
-
@tutorial_category.user_id = current_user.id
|
34
|
-
@tutorial_category.org_id = current_user.org_id
|
35
|
-
respond_to do |format|
|
36
|
-
if @tutorial_category.save
|
37
|
-
format.html { redirect_to tutorial_categories_path, :flash => { :success => 'Tutorial has been Added.' }}
|
38
|
-
format.json { render :show, status: :created, location: @tutorial_category }
|
39
|
-
else
|
40
|
-
format.html { render :new }
|
41
|
-
format.json { render json: @tutorial_category.errors, status: :unprocessable_entity }
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
# PATCH/PUT /tutorial/categories/1
|
47
|
-
def update
|
48
|
-
respond_to do |format|
|
49
|
-
if @tutorial_category.update(tutorial_category_params)
|
50
|
-
format.html { redirect_to tutorial_categories_path, :flash => { :notice => 'Tutorial has been Updated.' }}
|
51
|
-
format.json { render :show, status: :ok, location: @tutorial_category }
|
52
|
-
else
|
53
|
-
format.html { render :edit }
|
54
|
-
format.json { render json: @tutorial_category.errors, status: :unprocessable_entity }
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
# DELETE /tutorial/categories/1
|
60
|
-
def destroy
|
61
|
-
@tutorial_category.destroy
|
62
|
-
respond_to do |format|
|
63
|
-
format.html { redirect_to tutorial_categories_path, :flash => { :error => 'Categories and 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_tutorial_category
|
72
|
-
@tutorial_category = Tutorial::Category.find(params[:id])
|
73
|
-
end
|
74
|
-
|
75
|
-
# Whitelist
|
76
|
-
def tutorial_category_params
|
77
|
-
params.require(:tutorial_category).permit(:category_name, :slug, :user_id, :org_id)
|
78
|
-
end
|
79
|
-
|
80
|
-
end
|
81
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
module PhcdevworksTutorials
|
2
|
-
class Tutorial::Category < ApplicationRecord
|
3
|
-
|
4
|
-
# Clean URL Initialize
|
5
|
-
extend FriendlyId
|
6
|
-
|
7
|
-
# Paper Trail Initialize
|
8
|
-
has_paper_trail :class_name => 'PhcdevworksTutorials::TutorialCategoryVersions'
|
9
|
-
|
10
|
-
#Relationships
|
11
|
-
has_and_belongs_to_many :posts, class_name: "Tutorial::Post", :join_table => "phcdevworks_tutorials_categories_posts", :dependent => :destroy
|
12
|
-
has_and_belongs_to_many :posts, class_name: "Command::Post", :join_table => "phcdevworks_tutorials_categories_commands", :dependent => :destroy
|
13
|
-
|
14
|
-
# Form Fields Validation
|
15
|
-
validates :category_name,
|
16
|
-
presence: true,
|
17
|
-
uniqueness: true
|
18
|
-
|
19
|
-
# Clean URL Define
|
20
|
-
friendly_id :phcdev_tutorials_category_nice_urls, use: [:slugged, :finders]
|
21
|
-
|
22
|
-
def phcdev_tutorials_category_nice_urls
|
23
|
-
[:category_name]
|
24
|
-
end
|
25
|
-
|
26
|
-
end
|
27
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
<!-- Form - Tutorial - Category -->
|
2
|
-
<%= form_with(model: tutorial_category, local: true) do |form| %>
|
3
|
-
|
4
|
-
<!-- PHCNotifi Render Validation -->
|
5
|
-
<%= render "phcdevworks_notifications/bootstrap/validations", :object => @tutorial_category %>
|
6
|
-
<!-- PHCNotifi Render Validation -->
|
7
|
-
|
8
|
-
<!-- Form Input Fields -->
|
9
|
-
<div class="form-group">
|
10
|
-
<%= form.label :category_name, "Tutorial Category" %>
|
11
|
-
<%= form.text_field :category_name, placeholder: "Category Name", class: "form-control" %>
|
12
|
-
</div>
|
13
|
-
<!-- Form Input Fields -->
|
14
|
-
|
15
|
-
<!-- Form Submition Button -->
|
16
|
-
<div class="actions">
|
17
|
-
<%= form.submit class: "btn btn-primary" %>
|
18
|
-
</div>
|
19
|
-
<!-- For Submition Button -->
|
20
|
-
|
21
|
-
<% end %>
|
22
|
-
<!-- Form - Tutorial - Category -->
|
@@ -1,47 +0,0 @@
|
|
1
|
-
<!-- PHCTitleSEO Title Variables -->
|
2
|
-
<% phc_title "Tutorial Post Manager" %>
|
3
|
-
<% phc_title_tagline "Update Tutorial Category" %>
|
4
|
-
<% phc_breadcrumb_one yield(:phc_title_tagline) %>
|
5
|
-
<% phc_breadcrumb_two link_to "Category Index", phcdevworks_tutorials.tutorial_categories_path %>
|
6
|
-
<!-- PHCTitleSEO Title Variables -->
|
7
|
-
|
8
|
-
<!-- Page Bradcrumbs -->
|
9
|
-
<ol class="breadcrumb pull-right">
|
10
|
-
<li class="breadcrumb-item"><%= yield(:phc_breadcrumb_one) %></li>
|
11
|
-
<li class="breadcrumb-item active"><%= yield(:phc_breadcrumb_two) %></li>
|
12
|
-
</ol>
|
13
|
-
<!-- Page Bradcrumbs -->
|
14
|
-
|
15
|
-
<!-- Page Header -->
|
16
|
-
<h2 class="page-header"><%= yield(:phc_title) %></h2>
|
17
|
-
<!-- Page Header -->
|
18
|
-
|
19
|
-
<!-- Page Content -->
|
20
|
-
<div class="row">
|
21
|
-
<div class="col-lg-12">
|
22
|
-
|
23
|
-
<!-- Panel -->
|
24
|
-
<div class="panel panel-inverse">
|
25
|
-
|
26
|
-
<!-- Panel - Heading -->
|
27
|
-
<div class="panel-heading">
|
28
|
-
<h4 class="panel-title"><%= yield(:phc_title) %></h4>
|
29
|
-
</div>
|
30
|
-
<!-- Panel - Heading -->
|
31
|
-
|
32
|
-
<!-- Panel - Body -->
|
33
|
-
<div class="panel-body">
|
34
|
-
|
35
|
-
<!-- Edit Form -->
|
36
|
-
<%= render "form", tutorial_category: @tutorial_category %>
|
37
|
-
<!-- Edit Form -->
|
38
|
-
|
39
|
-
</div>
|
40
|
-
<!-- Panel - Body -->
|
41
|
-
|
42
|
-
</div>
|
43
|
-
<!-- Panel -->
|
44
|
-
|
45
|
-
</div>
|
46
|
-
</div>
|
47
|
-
<!-- Page Content -->
|
@@ -1,80 +0,0 @@
|
|
1
|
-
<!-- PHCTitleSEO Title Variables -->
|
2
|
-
<% phc_title "Tutorial Post Manager" %>
|
3
|
-
<% phc_title_tagline "Category Index" %>
|
4
|
-
<% phc_breadcrumb_one yield(:phc_title_tagline) %>
|
5
|
-
<% phc_breadcrumb_two link_to "Category Index", phcdevworks_tutorials.tutorial_categories_path %>
|
6
|
-
<!-- PHCTitleSEO Title Variables -->
|
7
|
-
|
8
|
-
<!-- Page Bradcrumbs -->
|
9
|
-
<ol class="breadcrumb pull-right">
|
10
|
-
<li class="breadcrumb-item"><%= yield(:phc_breadcrumb_one) %></li>
|
11
|
-
<li class="breadcrumb-item active"><%= yield(:phc_breadcrumb_two) %></li>
|
12
|
-
</ol>
|
13
|
-
<!-- Page Bradcrumbs -->
|
14
|
-
|
15
|
-
<!-- Page Header -->
|
16
|
-
<h2 class="page-header"><%= yield(:phc_title) %></h2>
|
17
|
-
<!-- Page Header -->
|
18
|
-
|
19
|
-
<!-- Page Content -->
|
20
|
-
<div class="row">
|
21
|
-
<div class="col-lg-12">
|
22
|
-
|
23
|
-
<!-- Panel -->
|
24
|
-
<div class="panel panel-inverse">
|
25
|
-
|
26
|
-
<!-- Panel - Heading -->
|
27
|
-
<div class="panel-heading">
|
28
|
-
<h4 class="panel-title"><%= yield(:phc_title) %></h4>
|
29
|
-
</div>
|
30
|
-
<!-- Panel - Heading -->
|
31
|
-
|
32
|
-
<!-- Panel - Body -->
|
33
|
-
<div class="panel-body">
|
34
|
-
|
35
|
-
<!-- Index - Table -->
|
36
|
-
<div class="table-responsive">
|
37
|
-
<table class="table table-striped table-bordered">
|
38
|
-
|
39
|
-
<thead>
|
40
|
-
<tr>
|
41
|
-
<th>Category</th>
|
42
|
-
<th></th>
|
43
|
-
</tr>
|
44
|
-
</thead>
|
45
|
-
|
46
|
-
<tbody>
|
47
|
-
<% @tutorial_categories.each do |tutorial_category| %>
|
48
|
-
<tr>
|
49
|
-
<td><%= tutorial_category.category_name %></td>
|
50
|
-
<td>
|
51
|
-
<div class="btn-group d-flex" role="group">
|
52
|
-
<%= link_to "Category Details", tutorial_category, class: "btn btn-purple btn-xs" %>
|
53
|
-
<%= link_to "Update Category", edit_tutorial_category_path(tutorial_category), class: "btn btn-primary btn-xs" %>
|
54
|
-
<%= link_to "Remove Category", tutorial_category, method: :delete, data: { confirm: "Are you sure? This action cannot be reversed." }, class: "btn btn-danger btn-xs" %>
|
55
|
-
</div>
|
56
|
-
</td>
|
57
|
-
</tr>
|
58
|
-
<% end %>
|
59
|
-
</tbody>
|
60
|
-
|
61
|
-
</table>
|
62
|
-
</div>
|
63
|
-
<!-- Index - Table -->
|
64
|
-
|
65
|
-
<!-- New Button -->
|
66
|
-
<%= link_to phcdevworks_tutorials.new_tutorial_category_path, class: "btn btn-primary btn-sm" do %>
|
67
|
-
<i class="fad fa-plus-circle"></i>
|
68
|
-
Add a New Category
|
69
|
-
<% end %>
|
70
|
-
<!-- New Button -->
|
71
|
-
|
72
|
-
</div>
|
73
|
-
<!-- Panel - Body -->
|
74
|
-
|
75
|
-
</div>
|
76
|
-
<!-- Panel -->
|
77
|
-
|
78
|
-
</div>
|
79
|
-
</div>
|
80
|
-
<!-- Page Content -->
|
@@ -1,47 +0,0 @@
|
|
1
|
-
<!-- PHCTitleSEO Title Variables -->
|
2
|
-
<% phc_title "Tutorial Post Manager" %>
|
3
|
-
<% phc_title_tagline "Add a New Tutorial Category" %>
|
4
|
-
<% phc_breadcrumb_one yield(:phc_title_tagline) %>
|
5
|
-
<% phc_breadcrumb_two link_to "Category Index", phcdevworks_tutorials.tutorial_categories_path %>
|
6
|
-
<!-- PHCTitleSEO Title Variables -->
|
7
|
-
|
8
|
-
<!-- Page Bradcrumbs -->
|
9
|
-
<ol class="breadcrumb pull-right">
|
10
|
-
<li class="breadcrumb-item"><%= yield(:phc_breadcrumb_one) %></li>
|
11
|
-
<li class="breadcrumb-item active"><%= yield(:phc_breadcrumb_two) %></li>
|
12
|
-
</ol>
|
13
|
-
<!-- Page Bradcrumbs -->
|
14
|
-
|
15
|
-
<!-- Page Header -->
|
16
|
-
<h2 class="page-header"><%= yield(:phc_title) %></h2>
|
17
|
-
<!-- Page Header -->
|
18
|
-
|
19
|
-
<!-- Page Content -->
|
20
|
-
<div class="row">
|
21
|
-
<div class="col-lg-12">
|
22
|
-
|
23
|
-
<!-- Panel -->
|
24
|
-
<div class="panel panel-inverse">
|
25
|
-
|
26
|
-
<!-- Panel - Heading -->
|
27
|
-
<div class="panel-heading">
|
28
|
-
<h4 class="panel-title"><%= yield(:phc_title) %></h4>
|
29
|
-
</div>
|
30
|
-
<!-- Panel - Heading -->
|
31
|
-
|
32
|
-
<!-- Panel - Body -->
|
33
|
-
<div class="panel-body">
|
34
|
-
|
35
|
-
<!-- New Form -->
|
36
|
-
<%= render "form", tutorial_category: @tutorial_category %>
|
37
|
-
<!-- New Form -->
|
38
|
-
|
39
|
-
</div>
|
40
|
-
<!-- Panel - Body -->
|
41
|
-
|
42
|
-
</div>
|
43
|
-
<!-- Panel -->
|
44
|
-
|
45
|
-
</div>
|
46
|
-
</div>
|
47
|
-
<!-- Page Content -->
|
@@ -1,15 +0,0 @@
|
|
1
|
-
class CreatePhcdevworksTutorialsTutorialCategories < ActiveRecord::Migration[6.0]
|
2
|
-
def change
|
3
|
-
create_table :phcdevworks_tutorials_tutorial_categories do |t|
|
4
|
-
|
5
|
-
t.string :category_name
|
6
|
-
|
7
|
-
t.string :slug
|
8
|
-
t.string :user_id
|
9
|
-
t.string :org_id
|
10
|
-
|
11
|
-
t.timestamps
|
12
|
-
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
class CreatePhcdevworksTutorialsTutorialCategoryVersions < ActiveRecord::Migration[6.0]
|
2
|
-
TEXT_BYTES = 1_073_741_823
|
3
|
-
def change
|
4
|
-
create_table :phcdevworks_tutorials_tutorial_category_versions do |t|
|
5
|
-
|
6
|
-
t.string :item_type, {:null=>false}
|
7
|
-
t.integer :item_id, null: false
|
8
|
-
t.string :event, null: false
|
9
|
-
t.string :whodunnit
|
10
|
-
t.text :object, limit: TEXT_BYTES
|
11
|
-
t.datetime :created_at
|
12
|
-
|
13
|
-
end
|
14
|
-
add_index :phcdevworks_tutorials_tutorial_category_versions, %i(item_type item_id), :name => 'tutorial_category_versions'
|
15
|
-
end
|
16
|
-
end
|