phccodesnipper 5.4.0 → 6.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/MIT-LICENSE +1 -1
- data/README.md +28 -0
- data/Rakefile +4 -18
- data/app/assets/config/phccodesnipper_manifest.js +2 -2
- data/app/controllers/phccodesnipper/application_controller.rb +14 -15
- data/app/controllers/phccodesnipper/script/snippets_controller.rb +1 -1
- data/app/controllers/phccodesnipper/script/urls_controller.rb +1 -1
- data/app/models/phccodesnipper/script/snippet.rb +0 -3
- data/app/views/layouts/phccodesnipper/application.html.erb +73 -79
- data/app/views/layouts/phccodesnipper/components/backend/footer/_footer.html.erb +14 -8
- data/app/views/layouts/phccodesnipper/components/backend/navigation/_top_menu.html.erb +41 -37
- data/app/views/layouts/phccodesnipper/components/backend/sidebars/_side_menu.html.erb +921 -189
- data/app/views/phccodesnipper/script/snippets/_form.html.erb +15 -15
- data/app/views/phccodesnipper/script/snippets/edit.html.erb +21 -21
- data/app/views/phccodesnipper/script/snippets/index.html.erb +57 -57
- data/app/views/phccodesnipper/script/snippets/new.html.erb +21 -21
- data/app/views/phccodesnipper/script/snippets/show.html.erb +63 -58
- data/app/views/phccodesnipper/script/urls/_form.html.erb +12 -12
- data/app/views/phccodesnipper/script/urls/edit.html.erb +16 -21
- data/app/views/phccodesnipper/script/urls/index.html.erb +55 -55
- data/app/views/phccodesnipper/script/urls/new.html.erb +21 -21
- data/app/views/phccodesnipper/script/urls/show.html.erb +63 -58
- data/config/routes.rb +5 -8
- data/db/migrate/20190502060733_create_phccodesnipper_script_urls.rb +17 -0
- data/db/migrate/20190508091330_create_phccodesnipper_script_snippets.rb +17 -0
- data/db/migrate/20190513040626_create_friendly_id_slugs.rb +21 -0
- data/lib/phccodesnipper/engine.rb +30 -56
- data/lib/phccodesnipper/version.rb +1 -1
- data/lib/phccodesnipper.rb +2 -0
- metadata +64 -391
- data/app/assets/javascripts/phccodesnipper/application.js +0 -2
- data/app/assets/stylesheets/phccodesnipper/application.scss +0 -2
- data/config/initializers/friendly_id.rb +0 -107
@@ -1,66 +1,66 @@
|
|
1
|
-
<!-- Title
|
1
|
+
<!-- -PHCDEV- Title Variables -->
|
2
2
|
<% phc_title "Code Snippet Manager" %>
|
3
3
|
<% phc_title_tagline "Update Asset Index" %>
|
4
4
|
<% phc_breadcrumb_one yield(:phc_title_tagline) %>
|
5
5
|
<% phc_breadcrumb_two link_to "Code Snippet Index", phccodesnipper.script_snippets_path %>
|
6
|
-
<!-- Title
|
6
|
+
<!-- -PHCDEV- Title Variables -->
|
7
7
|
|
8
|
-
<!--
|
9
|
-
<ol class="breadcrumb
|
10
|
-
|
11
|
-
|
8
|
+
<!-- -PHCDEV- Bradcrumbs -->
|
9
|
+
<ol class="breadcrumb float-xl-end">
|
10
|
+
<li class="breadcrumb-item"><%= yield(:phc_breadcrumb_one) %></li>
|
11
|
+
<li class="breadcrumb-item active"><%= yield(:phc_breadcrumb_two) %></li>
|
12
12
|
</ol>
|
13
|
-
<!--
|
13
|
+
<!-- -PHCDEV- Bradcrumbs -->
|
14
14
|
|
15
|
-
<!--
|
15
|
+
<!-- -PHCDEV- Header -->
|
16
16
|
<h1 class="page-header"><%= yield(:phc_title) %></h1>
|
17
|
-
<!--
|
17
|
+
<!-- -PHCDEV- Header -->
|
18
18
|
|
19
|
-
<!--
|
19
|
+
<!-- -PHCDEV- Panel -->
|
20
20
|
<div class="panel panel-inverse">
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
21
|
+
|
22
|
+
<!-- -PHCDEV- Panel - Heading -->
|
23
|
+
<div class="panel-heading">
|
24
|
+
<h4 class="panel-title"><%= yield(:phc_title_tagline) %></h4>
|
25
|
+
</div>
|
26
|
+
<!-- -PHCDEV- Panel - Heading -->
|
27
|
+
|
28
|
+
<!-- -PHCDEV- Panel - Body -->
|
29
|
+
<div class="panel-body">
|
30
|
+
|
31
|
+
<!-- -PHCDEV- Table - Snippet Index -->
|
32
|
+
<div class="table-responsive">
|
33
|
+
<table class="table table-striped table-bordered">
|
34
|
+
<thead>
|
35
|
+
<tr>
|
36
|
+
<th>Script Url</th>
|
37
|
+
<th colspan="3"></th>
|
38
|
+
</tr>
|
39
|
+
</thead>
|
40
|
+
<tbody>
|
41
|
+
<% @script_urls.each do |script_url| %>
|
42
|
+
<tr>
|
43
|
+
<td><%= script_url.script_url %></td>
|
44
|
+
<td>
|
45
|
+
<div class="btn-group d-flex" role="group">
|
46
|
+
<%= link_to "Details", script_snippet_url_path(script_url.snippet, script_url), class: "btn btn-purple btn-xs" %>
|
47
|
+
<%= link_to "Update", edit_script_snippet_url_path(script_url.snippet, script_url), class: "btn btn-primary btn-xs" %>
|
48
|
+
<%= link_to "Remove", script_snippet_url_path(script_url.snippet, script_url), method: :delete, data: { confirm: "Are you sure? This action cannot be reversed." }, class: "btn btn-danger btn-xs" %>
|
49
|
+
</div>
|
50
|
+
</td>
|
51
|
+
</tr>
|
52
|
+
<% end %>
|
53
|
+
</tbody>
|
54
|
+
</table>
|
55
|
+
<%= link_to phccodesnipper.new_script_snippet_url_path, class: "btn btn-primary btn-sm" do %>
|
56
|
+
<i class="fas fa-plus-circle"></i>
|
57
|
+
Add a New Script URL
|
58
|
+
<% end %>
|
59
|
+
</div>
|
60
|
+
<!-- -PHCDEV- Table - Snippet Index -->
|
61
|
+
|
62
|
+
</div>
|
63
|
+
<!-- -PHCDEV- Panel - Body -->
|
64
|
+
|
65
65
|
</div>
|
66
|
-
<!--
|
66
|
+
<!-- -PHCDEV- Panel -->
|
@@ -1,39 +1,39 @@
|
|
1
|
-
<!-- Title
|
1
|
+
<!-- -PHCDEV- Title Variables -->
|
2
2
|
<% phc_title "Code Snippet Manager" %>
|
3
3
|
<% phc_title_tagline "Create a New Asset URL" %>
|
4
4
|
<% phc_breadcrumb_one link_to "Code Snippet Index", phccodesnipper.script_snippets_path %>
|
5
5
|
<% phc_breadcrumb_two yield(:phc_title_tagline) %>
|
6
|
-
<!-- Title
|
6
|
+
<!-- -PHCDEV- Title Variables -->
|
7
7
|
|
8
|
-
<!--
|
9
|
-
<ol class="breadcrumb
|
8
|
+
<!-- -PHCDEV- Bradcrumbs -->
|
9
|
+
<ol class="breadcrumb float-xl-end">
|
10
10
|
<li class="breadcrumb-item"><%= yield(:phc_breadcrumb_one) %></li>
|
11
11
|
<li class="breadcrumb-item active"><%= yield(:phc_breadcrumb_two) %></li>
|
12
12
|
</ol>
|
13
|
-
<!--
|
13
|
+
<!-- -PHCDEV- Bradcrumbs -->
|
14
14
|
|
15
|
-
<!--
|
15
|
+
<!-- -PHCDEV- Header -->
|
16
16
|
<h1 class="page-header"><%= yield(:phc_title) %></h1>
|
17
|
-
<!--
|
17
|
+
<!-- -PHCDEV- Header -->
|
18
18
|
|
19
|
-
<!--
|
19
|
+
<!-- -PHCDEV- Panel -->
|
20
20
|
<div class="panel panel-inverse">
|
21
|
-
|
21
|
+
|
22
|
+
<!-- -PHCDEV- Panel - Heading -->
|
22
23
|
<div class="panel-heading">
|
23
|
-
<div class="panel-heading-btn">
|
24
|
-
<a href="javascript:;" class="btn btn-xs btn-icon btn-circle btn-default" data-click="panel-expand"><i class="fa fa-expand"></i></a>
|
25
|
-
<a href="javascript:;" class="btn btn-xs btn-icon btn-circle btn-success" data-click="panel-reload"><i class="fa fa-redo"></i></a>
|
26
|
-
<a href="javascript:;" class="btn btn-xs btn-icon btn-circle btn-warning" data-click="panel-collapse"><i class="fa fa-minus"></i></a>
|
27
|
-
</div>
|
28
24
|
<h4 class="panel-title"><%= yield(:phc_title_tagline) %></h4>
|
29
25
|
</div>
|
30
|
-
<!-- Panel Heading -->
|
31
|
-
|
26
|
+
<!-- -PHCDEV- Panel - Heading -->
|
27
|
+
|
28
|
+
<!-- -PHCDEV- Panel - Body -->
|
32
29
|
<div class="panel-body">
|
33
|
-
|
34
|
-
|
35
|
-
|
30
|
+
|
31
|
+
<!-- -PHCDEV- Form for New Script Asset URL -->
|
32
|
+
<%= render "form", { form_url: script_snippet_urls_path } %>
|
33
|
+
<!-- -PHCDEV- Form for New Script Asset URL -->
|
34
|
+
|
36
35
|
</div>
|
37
|
-
<!-- Panel Body -->
|
36
|
+
<!-- -PHCDEV- Panel - Body -->
|
37
|
+
|
38
38
|
</div>
|
39
|
-
<!--
|
39
|
+
<!-- -PHCDEV- Panel -->
|
@@ -1,71 +1,76 @@
|
|
1
|
-
<!-- Title
|
1
|
+
<!-- -PHCDEV- Title Variables -->
|
2
2
|
<% phc_title "Code Snippet Manager" %>
|
3
3
|
<% phc_title_tagline "Asset URL Details" %>
|
4
4
|
<% phc_breadcrumb_one link_to "Code Snippet Index", phccodesnipper.script_snippets_path %>
|
5
5
|
<% phc_breadcrumb_two yield(:phc_title_tagline) %>
|
6
|
-
<!-- Title
|
6
|
+
<!-- -PHCDEV- Title Variables -->
|
7
7
|
|
8
|
-
<!--
|
9
|
-
<ol class="breadcrumb
|
10
|
-
|
11
|
-
|
8
|
+
<!-- -PHCDEV- Bradcrumbs -->
|
9
|
+
<ol class="breadcrumb float-xl-end">
|
10
|
+
<li class="breadcrumb-item"><%= yield(:phc_breadcrumb_one) %></li>
|
11
|
+
<li class="breadcrumb-item active"><%= yield(:phc_breadcrumb_two) %></li>
|
12
12
|
</ol>
|
13
|
-
<!--
|
13
|
+
<!-- -PHCDEV- Bradcrumbs -->
|
14
14
|
|
15
|
-
<!--
|
15
|
+
<!-- -PHCDEV- Header -->
|
16
16
|
<h1 class="page-header"><%= yield(:phc_title) %></h1>
|
17
|
-
<!--
|
17
|
+
<!-- -PHCDEV- Bradcrumbs -->
|
18
18
|
|
19
|
-
<!--
|
19
|
+
<!-- -PHCDEV- Panel -->
|
20
20
|
<div class="row">
|
21
21
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
22
|
+
<!-- -PHCDEV- Button Area -->
|
23
|
+
<div class="col-lg-4">
|
24
|
+
|
25
|
+
<!-- -PHCDEV- Button Panel -->
|
26
|
+
<div class="panel panel-inverse">
|
27
|
+
|
28
|
+
<!-- -PHCDEV- Panel - Heading -->
|
29
|
+
<div class="panel-heading">
|
30
|
+
<h4 class="panel-title">Options Panel</h4>
|
31
|
+
</div>
|
32
|
+
<!-- -PHCDEV- Panel - Heading -->
|
33
|
+
|
34
|
+
<!-- -PHCDEV- Panel - Body -->
|
35
|
+
<div class="panel-body">
|
36
|
+
<div class="btn-group d-flex" role="group">
|
37
|
+
<%= link_to "Update", phccodesnipper.edit_script_snippet_url_path, class: "btn btn-primary" %>
|
38
|
+
<%= link_to "Remove", phccodesnipper.script_snippet_url_path(@script_url), method: :delete, data: { confirm: "Are you sure?" }, class: "btn btn-danger" %>
|
39
|
+
</div>
|
40
|
+
</div>
|
41
|
+
<!-- -PHCDEV- Panel - Body -->
|
42
|
+
|
43
|
+
</div>
|
44
|
+
<!-- -PHCDEV- Button Panel -->
|
45
|
+
|
46
|
+
</div>
|
47
|
+
<!-- -PHCDEV- Button Area -->
|
48
|
+
|
49
|
+
<!-- -PHCDEV- Main Area -->
|
50
|
+
<div class="col-lg-8">
|
51
|
+
|
52
|
+
<!-- -PHCDEV- Main Panel -->
|
53
|
+
<div class="panel panel-inverse">
|
54
|
+
|
55
|
+
<!-- -PHCDEV- Panel - Heading -->
|
56
|
+
<div class="panel-heading">
|
57
|
+
<h4 class="panel-title"><%= yield(:phc_title_tagline) %></h4>
|
58
|
+
</div>
|
59
|
+
<!-- -PHCDEV- Panel - Heading -->
|
60
|
+
|
61
|
+
<!-- -PHCDEV- Panel - Body -->
|
62
|
+
<div class="panel-body">
|
63
|
+
<p class="h3">Script Snippet URL</p>
|
64
|
+
<hr>
|
65
|
+
<pre><code><%= @script_url.script_url %></code></pre>
|
66
|
+
</div>
|
67
|
+
<!-- -PHCDEV- Panel - Body -->
|
68
|
+
|
69
|
+
</div>
|
70
|
+
<!-- -PHCDEV- Main Panel -->
|
71
|
+
|
72
|
+
</div>
|
73
|
+
<!-- -PHCDEV- Main Area -->
|
69
74
|
|
70
75
|
</div>
|
71
|
-
<!--
|
76
|
+
<!-- -PHCDEV- Panel -->
|
data/config/routes.rb
CHANGED
@@ -1,13 +1,10 @@
|
|
1
1
|
Phccodesnipper::Engine.routes.draw do
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
# Script Snippet Routes
|
4
|
+
namespace :script do
|
5
|
+
resources :snippets, class_name: "Phccodesnipper::Script::Snippet" do
|
6
|
+
resources :urls, class_name: "Phccodesnipper::Script::Url"
|
7
|
+
end
|
7
8
|
end
|
8
|
-
end
|
9
|
-
|
10
|
-
# PHCAccounts Routes
|
11
|
-
mount Phcaccounts::Engine, :at => '/'
|
12
9
|
|
13
10
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
class CreatePhccodesnipperScriptUrls < ActiveRecord::Migration[7.0]
|
2
|
+
def change
|
3
|
+
|
4
|
+
create_table :phccodesnipper_script_urls do |t|
|
5
|
+
|
6
|
+
t.string :script_url
|
7
|
+
|
8
|
+
t.string :slug
|
9
|
+
t.string :user_id
|
10
|
+
|
11
|
+
t.references :snippet
|
12
|
+
t.timestamps
|
13
|
+
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
class CreatePhccodesnipperScriptSnippets < ActiveRecord::Migration[7.0]
|
2
|
+
def change
|
3
|
+
|
4
|
+
create_table :phccodesnipper_script_snippets do |t|
|
5
|
+
|
6
|
+
t.string :snippet_title
|
7
|
+
t.text :snippet_code
|
8
|
+
|
9
|
+
t.string :slug
|
10
|
+
t.string :user_id
|
11
|
+
|
12
|
+
t.timestamps
|
13
|
+
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
MIGRATION_CLASS =
|
2
|
+
if ActiveRecord::VERSION::MAJOR >= 5
|
3
|
+
ActiveRecord::Migration["#{ActiveRecord::VERSION::MAJOR}.#{ActiveRecord::VERSION::MINOR}"]
|
4
|
+
else
|
5
|
+
ActiveRecord::Migration
|
6
|
+
end
|
7
|
+
|
8
|
+
class CreateFriendlyIdSlugs < MIGRATION_CLASS
|
9
|
+
def change
|
10
|
+
create_table :friendly_id_slugs do |t|
|
11
|
+
t.string :slug, :null => false
|
12
|
+
t.integer :sluggable_id, :null => false
|
13
|
+
t.string :sluggable_type, :limit => 50
|
14
|
+
t.string :scope
|
15
|
+
t.datetime :created_at
|
16
|
+
end
|
17
|
+
add_index :friendly_id_slugs, [:sluggable_type, :sluggable_id]
|
18
|
+
add_index :friendly_id_slugs, [:slug, :sluggable_type], length: { slug: 140, sluggable_type: 50 }
|
19
|
+
add_index :friendly_id_slugs, [:slug, :sluggable_type, :scope], length: { slug: 70, sluggable_type: 50, scope: 70 }, unique: true
|
20
|
+
end
|
21
|
+
end
|
@@ -1,69 +1,43 @@
|
|
1
1
|
module Phccodesnipper
|
2
2
|
class Engine < ::Rails::Engine
|
3
3
|
|
4
|
-
#
|
5
|
-
require
|
6
|
-
require
|
7
|
-
require
|
8
|
-
|
9
|
-
|
10
|
-
require
|
11
|
-
require
|
12
|
-
|
13
|
-
#
|
14
|
-
require
|
15
|
-
require
|
16
|
-
require
|
17
|
-
require
|
18
|
-
|
19
|
-
|
20
|
-
require
|
21
|
-
|
22
|
-
|
23
|
-
require 'phccorehelpers'
|
24
|
-
require 'phcmenus'
|
25
|
-
require 'phcnotifi'
|
26
|
-
require 'phctitleseo'
|
4
|
+
# Load Main Dependencies
|
5
|
+
require "jbuilder"
|
6
|
+
require "paper_trail"
|
7
|
+
require "friendly_id"
|
8
|
+
|
9
|
+
# Load Theme Dependencies
|
10
|
+
require "phcthemes_admin_panel_pack"
|
11
|
+
require "phcthemes_web_theme_pack"
|
12
|
+
|
13
|
+
# Load Helper Dependencies
|
14
|
+
require "phcdevworks_core"
|
15
|
+
require "phcdevworks_active_menus"
|
16
|
+
require "phcdevworks_notifications"
|
17
|
+
require "phcdevworks_titleseo"
|
18
|
+
|
19
|
+
# Load Upload Dependencies
|
20
|
+
require "aws-sdk-s3"
|
21
|
+
require "google-cloud-storage"
|
22
|
+
require "mini_magick"
|
27
23
|
|
28
24
|
# Frontend Dependencies
|
29
|
-
require
|
30
|
-
require
|
31
|
-
|
32
|
-
# Upload Dependencies
|
33
|
-
require 'aws-sdk-s3'
|
34
|
-
require 'google-cloud-storage'
|
35
|
-
require 'mini_magick'
|
25
|
+
require "wicked"
|
26
|
+
require "gravtastic"
|
27
|
+
require "friendly_id"
|
36
28
|
|
37
|
-
#
|
38
|
-
require
|
39
|
-
require 'pg'
|
29
|
+
# Mailer Dependencies
|
30
|
+
require "mail_form"
|
40
31
|
|
41
|
-
#
|
42
|
-
require 'phcaccounts'
|
43
|
-
|
44
|
-
# Isolate Namespace
|
32
|
+
# Engine Namespace
|
45
33
|
isolate_namespace Phccodesnipper
|
46
34
|
|
47
|
-
#
|
35
|
+
# Rspec Generators
|
48
36
|
config.generators do |g|
|
49
|
-
g.test_framework :rspec
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
routing_specs: false,
|
54
|
-
controller_specs: true,
|
55
|
-
request_specs: false
|
56
|
-
g.fixture_replacement :factory_bot,
|
57
|
-
dir: "spec/factories"
|
58
|
-
end
|
59
|
-
|
60
|
-
# Load Requried Helper Files
|
61
|
-
config.to_prepare do
|
62
|
-
Phcaccounts::ApplicationController.helper(ApplicationHelper)
|
63
|
-
Phccorehelpers::ApplicationController.helper(ApplicationHelper)
|
64
|
-
Phcmenus::ApplicationController.helper(ApplicationHelper)
|
65
|
-
Phcnotifi::ApplicationController.helper(ApplicationHelper)
|
66
|
-
Phctitleseo::ApplicationController.helper(ApplicationHelper)
|
37
|
+
g.test_framework :rspec
|
38
|
+
g.fixture_replacement :factory_bot
|
39
|
+
g.factory_bot dir: 'spec/factories'
|
40
|
+
g.factory_bot suffix: "factory"
|
67
41
|
end
|
68
42
|
|
69
43
|
end
|