phccodesnipperpro 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +0 -0
- data/Rakefile +22 -0
- data/app/assets/config/phccodesnipperpro_manifest.js +2 -0
- data/app/assets/javascripts/phccodesnipperpro/application.js +2 -0
- data/app/assets/stylesheets/phccodesnipperpro/application.scss +2 -0
- data/app/controllers/phccodesnipperpro/application_controller.rb +22 -0
- data/app/controllers/phccodesnipperpro/script/snippets_controller.rb +67 -0
- data/app/controllers/phccodesnipperpro/script/urls_controller.rb +76 -0
- data/app/helpers/phccodesnipperpro/application_helper.rb +4 -0
- data/app/helpers/phccodesnipperpro/script/snippets_helper.rb +4 -0
- data/app/helpers/phccodesnipperpro/script/urls_helper.rb +4 -0
- data/app/jobs/phccodesnipperpro/application_job.rb +4 -0
- data/app/mailers/phccodesnipperpro/application_mailer.rb +6 -0
- data/app/models/phccodesnipperpro/application_record.rb +5 -0
- data/app/models/phccodesnipperpro/script/snippet.rb +30 -0
- data/app/models/phccodesnipperpro/script/url.rb +16 -0
- data/app/models/phccodesnipperpro/script.rb +7 -0
- data/app/views/layouts/phccodesnipperpro/application.html.erb +79 -0
- data/app/views/layouts/phccodesnipperpro/components/backend/footer/_footer.html.erb +11 -0
- data/app/views/layouts/phccodesnipperpro/components/backend/navigation/_top_menu.html.erb +37 -0
- data/app/views/layouts/phccodesnipperpro/components/backend/sidebars/_side_menu.html.erb +189 -0
- data/app/views/phccodesnipperpro/script/snippets/_form.html.erb +26 -0
- data/app/views/phccodesnipperpro/script/snippets/edit.html.erb +39 -0
- data/app/views/phccodesnipperpro/script/snippets/index.html.erb +68 -0
- data/app/views/phccodesnipperpro/script/snippets/new.html.erb +39 -0
- data/app/views/phccodesnipperpro/script/snippets/show.html.erb +71 -0
- data/app/views/phccodesnipperpro/script/urls/_form.html.erb +22 -0
- data/app/views/phccodesnipperpro/script/urls/edit.html.erb +39 -0
- data/app/views/phccodesnipperpro/script/urls/index.html.erb +66 -0
- data/app/views/phccodesnipperpro/script/urls/new.html.erb +39 -0
- data/app/views/phccodesnipperpro/script/urls/show.html.erb +71 -0
- data/config/initializers/friendly_id.rb +107 -0
- data/config/routes.rb +13 -0
- data/db/migrate/20190504104048_create_phccodesnipperpro_script_urls.rb +19 -0
- data/db/migrate/20190504104101_create_phccodesnipperpro_script_snippets.rb +19 -0
- data/lib/phccodesnipperpro/engine.rb +70 -0
- data/lib/phccodesnipperpro/version.rb +3 -0
- data/lib/phccodesnipperpro.rb +4 -0
- data/lib/tasks/phccodesnipperpro_tasks.rake +4 -0
- metadata +697 -0
@@ -0,0 +1,26 @@
|
|
1
|
+
<!-- Form - Script - Snippets -->
|
2
|
+
<%= form_with(model: script_snippet, local: true) do |form| %>
|
3
|
+
|
4
|
+
<!-- PHCNotifi Render Validation -->
|
5
|
+
<%= render 'phcnotifi/default/validations', :object => @script_snippet %>
|
6
|
+
<!-- PHCNotifi Render Validation -->
|
7
|
+
|
8
|
+
<!-- Form Input Fields -->
|
9
|
+
<div class="form-group field_with_errors">
|
10
|
+
<%= form.label :snippet_title, "Snippet Title" %>
|
11
|
+
<%= form.text_field :snippet_title, class: 'form-control', placeholder: 'Snippet Title' %>
|
12
|
+
</div>
|
13
|
+
<div class="form-group field_with_errors">
|
14
|
+
<%= form.label :snippet_code, "Code Snippet" %>
|
15
|
+
<%= form.text_area :snippet_code, class: 'form-control', placeholder: 'Code Snippet', rows: '10' %>
|
16
|
+
</div>
|
17
|
+
<!-- Form Input Fields -->
|
18
|
+
|
19
|
+
<!-- Form Submition Button -->
|
20
|
+
<div class="actions">
|
21
|
+
<%= form.submit class: "btn btn-primary" %>
|
22
|
+
</div>
|
23
|
+
<!-- For Submition Button -->
|
24
|
+
|
25
|
+
<% end %>
|
26
|
+
<!-- Form - Script - Snippets -->
|
@@ -0,0 +1,39 @@
|
|
1
|
+
<!-- Title System -->
|
2
|
+
<% phc_title "Code Snippet Manager" %>
|
3
|
+
<% phc_title_tagline "Update Code Snippet" %>
|
4
|
+
<% phc_breadcrumb_one link_to "Code Snippet Index", phccodesnipperpro.script_snippets_path %>
|
5
|
+
<% phc_breadcrumb_two yield(:phc_title_tagline) %>
|
6
|
+
<!-- Title System -->
|
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
|
+
<h1 class="page-header"><%= yield(:phc_title) %></h1>
|
17
|
+
<!-- Page Header -->
|
18
|
+
|
19
|
+
<!-- Page & Panel Content -->
|
20
|
+
<div class="panel panel-inverse">
|
21
|
+
<!-- Panel Heading -->
|
22
|
+
<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
|
+
<h4 class="panel-title"><%= yield(:phc_title_tagline) %></h4>
|
29
|
+
</div>
|
30
|
+
<!-- Panel Heading -->
|
31
|
+
<!-- Panel Body -->
|
32
|
+
<div class="panel-body">
|
33
|
+
<!-- Form to Edit Script Snippet -->
|
34
|
+
<%= render 'form', script_snippet: @script_snippet %>
|
35
|
+
<!-- Form to Edit Script Snippet -->
|
36
|
+
</div>
|
37
|
+
<!-- Panel Body -->
|
38
|
+
</div>
|
39
|
+
<!-- Page & Panel Content -->
|
@@ -0,0 +1,68 @@
|
|
1
|
+
<!-- Title System -->
|
2
|
+
<% phc_title "Code Snippet Manager" %>
|
3
|
+
<% phc_title_tagline "Code Snippet Index" %>
|
4
|
+
<% phc_breadcrumb_one yield(:phc_title_tagline) %>
|
5
|
+
<% phc_breadcrumb_two link_to "Code Snippet Index", phccodesnipperpro.script_snippets_path %>
|
6
|
+
<!-- Title System -->
|
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
|
+
<h1 class="page-header"><%= yield(:phc_title) %></h1>
|
17
|
+
<!-- Page Header -->
|
18
|
+
|
19
|
+
<!-- Page & Panel Content -->
|
20
|
+
<div class="panel panel-inverse">
|
21
|
+
<!-- Panel Heading -->
|
22
|
+
<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
|
+
<h4 class="panel-title"><%= yield(:phc_title_tagline) %></h4>
|
29
|
+
</div>
|
30
|
+
<!-- Panel Heading -->
|
31
|
+
<!-- Panel Body -->
|
32
|
+
<div class="panel-body">
|
33
|
+
<!-- Table - Snippet Index -->
|
34
|
+
<div class="table-responsive">
|
35
|
+
<table class="table table-striped table-bordered">
|
36
|
+
<thead>
|
37
|
+
<tr>
|
38
|
+
<th>Snippet Title</th>
|
39
|
+
<th>Snippet Summary</th>
|
40
|
+
<th></th>
|
41
|
+
</tr>
|
42
|
+
</thead>
|
43
|
+
<tbody>
|
44
|
+
<% @script_snippets.each do |script_snippet| %>
|
45
|
+
<tr>
|
46
|
+
<td><%= script_snippet.snippet_title %></td>
|
47
|
+
<td><%= truncate(script_snippet.snippet_code, :length => 80) %></td>
|
48
|
+
<td>
|
49
|
+
<div class="btn-group d-flex" role="group">
|
50
|
+
<%= link_to 'Details', script_snippet, class: "btn btn-purple btn-xs" %>
|
51
|
+
<%= link_to 'Update', edit_script_snippet_path(script_snippet), class: "btn btn-primary btn-xs" %>
|
52
|
+
<%= link_to 'Remmove', script_snippet, method: :delete, data: { confirm: 'Are you sure? This will aslo delte the snippet urls.' }, class: "btn btn-danger btn-xs" %>
|
53
|
+
</div>
|
54
|
+
</td>
|
55
|
+
</tr>
|
56
|
+
<% end %>
|
57
|
+
</tbody>
|
58
|
+
</table>
|
59
|
+
<%= link_to phccodesnipperpro.new_script_snippet_path, class: "btn btn-primary btn-sm" do %>
|
60
|
+
<i class="fas fa-plus-circle"></i>
|
61
|
+
Add a New Code Snippet
|
62
|
+
<% end %>
|
63
|
+
</div>
|
64
|
+
<!-- Table - Snippet Index -->
|
65
|
+
</div>
|
66
|
+
<!-- Panel Body -->
|
67
|
+
</div>
|
68
|
+
<!-- Page & Panel Content -->
|
@@ -0,0 +1,39 @@
|
|
1
|
+
<!-- Title System -->
|
2
|
+
<% phc_title "Code Snippet Manager" %>
|
3
|
+
<% phc_title_tagline "Create a New Code Snippet" %>
|
4
|
+
<% phc_breadcrumb_one link_to "Code Snippet Index", phccodesnipperpro.script_snippets_path %>
|
5
|
+
<% phc_breadcrumb_two yield(:phc_title_tagline) %>
|
6
|
+
<!-- Title System -->
|
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
|
+
<h1 class="page-header"><%= yield(:phc_title) %></h1>
|
17
|
+
<!-- Page Header -->
|
18
|
+
|
19
|
+
<!-- Page & Panel Content -->
|
20
|
+
<div class="panel panel-inverse">
|
21
|
+
<!-- Panel Heading -->
|
22
|
+
<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
|
+
<h4 class="panel-title"><%= yield(:phc_title_tagline) %></h4>
|
29
|
+
</div>
|
30
|
+
<!-- Panel Heading -->
|
31
|
+
<!-- Panel Body -->
|
32
|
+
<div class="panel-body">
|
33
|
+
<!-- Form for New Script Snippet -->
|
34
|
+
<%= render 'form', script_snippet: @script_snippet %>
|
35
|
+
<!-- Form for New Script Snippet -->
|
36
|
+
</div>
|
37
|
+
<!-- Panel Body -->
|
38
|
+
</div>
|
39
|
+
<!-- Page & Panel Content -->
|
@@ -0,0 +1,71 @@
|
|
1
|
+
<!-- Title System -->
|
2
|
+
<% phc_title "Code Snippet Manager" %>
|
3
|
+
<% phc_title_tagline "Code Snippet Details" %>
|
4
|
+
<% phc_breadcrumb_one link_to "Code Snippet Index", phccodesnipperpro.script_snippets_path %>
|
5
|
+
<% phc_breadcrumb_two yield(:phc_title_tagline) %>
|
6
|
+
<!-- Title System -->
|
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
|
+
<h1 class="page-header"><%= yield(:phc_title) %></h1>
|
17
|
+
<!-- Page Header -->
|
18
|
+
|
19
|
+
<!-- Page Content -->
|
20
|
+
<div class="row">
|
21
|
+
|
22
|
+
<!-- Button Area -->
|
23
|
+
<div class="col-lg-4">
|
24
|
+
<!-- Button Panel -->
|
25
|
+
<div class="panel panel-inverse">
|
26
|
+
<!-- Panel Heading -->
|
27
|
+
<div class="panel-heading">
|
28
|
+
<h4 class="panel-title">Options Panel</h4>
|
29
|
+
</div>
|
30
|
+
<!-- Panel Heading -->
|
31
|
+
<!-- Panel Body -->
|
32
|
+
<div class="panel-body">
|
33
|
+
<div class="btn-group d-flex" role="group">
|
34
|
+
<%= link_to 'Update', phccodesnipperpro.edit_script_snippet_path, class: "btn btn-primary" %>
|
35
|
+
<%= link_to 'Remove', phccodesnipperpro.script_snippet_path, method: :delete, data: { confirm: 'Are you sure?' }, class: "btn btn-danger" %>
|
36
|
+
</div>
|
37
|
+
</div>
|
38
|
+
<!-- Panel Body -->
|
39
|
+
</div>
|
40
|
+
<!-- Button Panel -->
|
41
|
+
</div>
|
42
|
+
<!-- Button Area -->
|
43
|
+
|
44
|
+
<!-- Main Area -->
|
45
|
+
<div class="col-lg-8">
|
46
|
+
<!-- Main Panel -->
|
47
|
+
<div class="panel panel-inverse">
|
48
|
+
<!-- Panel Heading -->
|
49
|
+
<div class="panel-heading">
|
50
|
+
<div class="panel-heading-btn">
|
51
|
+
<a href="javascript:;" class="btn btn-xs btn-icon btn-circle btn-default" data-click="panel-expand"><i class="fa fa-expand"></i></a>
|
52
|
+
<a href="javascript:;" class="btn btn-xs btn-icon btn-circle btn-success" data-click="panel-reload"><i class="fa fa-redo"></i></a>
|
53
|
+
<a href="javascript:;" class="btn btn-xs btn-icon btn-circle btn-warning" data-click="panel-collapse"><i class="fa fa-minus"></i></a>
|
54
|
+
</div>
|
55
|
+
<h4 class="panel-title"><%= yield(:phc_title_tagline) %></h4>
|
56
|
+
</div>
|
57
|
+
<!-- Panel Heading -->
|
58
|
+
<!-- Panel Body -->
|
59
|
+
<div class="panel-body">
|
60
|
+
<p class="h3"><%= @script_snippet.snippet_title %></p>
|
61
|
+
<hr>
|
62
|
+
<pre><code><%= @script_snippet.snippet_code %></code></pre>
|
63
|
+
</div>
|
64
|
+
<!-- Panel Body -->
|
65
|
+
</div>
|
66
|
+
<!-- Main Panel -->
|
67
|
+
</div>
|
68
|
+
<!-- Main Area -->
|
69
|
+
|
70
|
+
</div>
|
71
|
+
<!-- Page Content -->
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<!-- Form - Script - Url -->
|
2
|
+
<%= form_with(model: [ @script_snippet, @script_url], url: form_url, local: true) do |form| %>
|
3
|
+
|
4
|
+
<!-- PHCNotifi Render Validation -->
|
5
|
+
<%= render 'phcnotifi/default/validations', :object => @script_url %>
|
6
|
+
<!-- PHCNotifi Render Validation -->
|
7
|
+
|
8
|
+
<!-- Form Input Fields -->
|
9
|
+
<div class="form-group field_with_errors">
|
10
|
+
<%= form.label :script_url %>
|
11
|
+
<%= form.text_field :script_url, class: 'form-control', placeholder: 'Script Url' %>
|
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 - Script - Url -->
|
@@ -0,0 +1,39 @@
|
|
1
|
+
<!-- Title System -->
|
2
|
+
<% phc_title "Code Snippet Manager" %>
|
3
|
+
<% phc_title_tagline "Update Asset URL" %>
|
4
|
+
<% phc_breadcrumb_one link_to "Code Snippet Index", phccodesnipperpro.script_snippets_path %>
|
5
|
+
<% phc_breadcrumb_two yield(:phc_title_tagline) %>
|
6
|
+
<!-- Title System -->
|
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
|
+
<h1 class="page-header"><%= yield(:phc_title) %></h1>
|
17
|
+
<!-- Page Header -->
|
18
|
+
|
19
|
+
<!-- Page & Panel Content -->
|
20
|
+
<div class="panel panel-inverse">
|
21
|
+
<!-- Panel Heading -->
|
22
|
+
<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
|
+
<h4 class="panel-title"><%= yield(:phc_title_tagline) %></h4>
|
29
|
+
</div>
|
30
|
+
<!-- Panel Heading -->
|
31
|
+
<!-- Panel Body -->
|
32
|
+
<div class="panel-body">
|
33
|
+
<!-- Form to Edit Script Snippet Asset URLS -->
|
34
|
+
<%= render 'form', { form_url: script_snippet_url_path } %>
|
35
|
+
<!-- Form to Edit Script Snippet Asset URLS -->
|
36
|
+
</div>
|
37
|
+
<!-- Panel Body -->
|
38
|
+
</div>
|
39
|
+
<!-- Page & Panel Content -->
|
@@ -0,0 +1,66 @@
|
|
1
|
+
<!-- Title System -->
|
2
|
+
<% phc_title "Code Snippet Manager" %>
|
3
|
+
<% phc_title_tagline "Update Asset Index" %>
|
4
|
+
<% phc_breadcrumb_one yield(:phc_title_tagline) %>
|
5
|
+
<% phc_breadcrumb_two link_to "Code Snippet Index", phccodesnipperpro.script_snippets_path %>
|
6
|
+
<!-- Title System -->
|
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
|
+
<h1 class="page-header"><%= yield(:phc_title) %></h1>
|
17
|
+
<!-- Page Header -->
|
18
|
+
|
19
|
+
<!-- Page & Panel Content -->
|
20
|
+
<div class="panel panel-inverse">
|
21
|
+
<!-- Panel Heading -->
|
22
|
+
<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
|
+
<h4 class="panel-title"><%= yield(:phc_title_tagline) %></h4>
|
29
|
+
</div>
|
30
|
+
<!-- Panel Heading -->
|
31
|
+
<!-- Panel Body -->
|
32
|
+
<div class="panel-body">
|
33
|
+
<!-- Table - Snippet Index -->
|
34
|
+
<div class="table-responsive">
|
35
|
+
<table class="table table-striped table-bordered">
|
36
|
+
<thead>
|
37
|
+
<tr>
|
38
|
+
<th>Script Url</th>
|
39
|
+
<th colspan="3"></th>
|
40
|
+
</tr>
|
41
|
+
</thead>
|
42
|
+
<tbody>
|
43
|
+
<% @script_urls.each do |script_url| %>
|
44
|
+
<tr>
|
45
|
+
<td><%= script_url.script_url %></td>
|
46
|
+
<td>
|
47
|
+
<div class="btn-group d-flex" role="group">
|
48
|
+
<%= link_to 'Details', script_snippet_url_path(script_url.snippet, script_url), class: "btn btn-purple btn-xs" %>
|
49
|
+
<%= link_to 'Update', edit_script_snippet_url_path(script_url.snippet, script_url), class: "btn btn-primary btn-xs" %>
|
50
|
+
<%= 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" %>
|
51
|
+
</div>
|
52
|
+
</td>
|
53
|
+
</tr>
|
54
|
+
<% end %>
|
55
|
+
</tbody>
|
56
|
+
</table>
|
57
|
+
<%= link_to phccodesnipperpro.new_script_snippet_url_path, class: "btn btn-primary btn-sm" do %>
|
58
|
+
<i class="fas fa-plus-circle"></i>
|
59
|
+
Add a New Script URL
|
60
|
+
<% end %>
|
61
|
+
</div>
|
62
|
+
<!-- Table - Snippet Index -->
|
63
|
+
</div>
|
64
|
+
<!-- Panel Body -->
|
65
|
+
</div>
|
66
|
+
<!-- Page & Panel Content -->
|
@@ -0,0 +1,39 @@
|
|
1
|
+
<!-- Title System -->
|
2
|
+
<% phc_title "Code Snippet Manager" %>
|
3
|
+
<% phc_title_tagline "Create a New Asset URL" %>
|
4
|
+
<% phc_breadcrumb_one link_to "Code Snippet Index", phccodesnipperpro.script_snippets_path %>
|
5
|
+
<% phc_breadcrumb_two yield(:phc_title_tagline) %>
|
6
|
+
<!-- Title System -->
|
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
|
+
<h1 class="page-header"><%= yield(:phc_title) %></h1>
|
17
|
+
<!-- Page Header -->
|
18
|
+
|
19
|
+
<!-- Page & Panel Content -->
|
20
|
+
<div class="panel panel-inverse">
|
21
|
+
<!-- Panel Heading -->
|
22
|
+
<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
|
+
<h4 class="panel-title"><%= yield(:phc_title_tagline) %></h4>
|
29
|
+
</div>
|
30
|
+
<!-- Panel Heading -->
|
31
|
+
<!-- Panel Body -->
|
32
|
+
<div class="panel-body">
|
33
|
+
<!-- Form for New Script Asset URL -->
|
34
|
+
<%= render 'form', { form_url: script_snippet_urls_path } %>
|
35
|
+
<!-- Form for New Script Asset URL -->
|
36
|
+
</div>
|
37
|
+
<!-- Panel Body -->
|
38
|
+
</div>
|
39
|
+
<!-- Page & Panel Content -->
|
@@ -0,0 +1,71 @@
|
|
1
|
+
<!-- Title System -->
|
2
|
+
<% phc_title "Code Snippet Manager" %>
|
3
|
+
<% phc_title_tagline "Asset URL Details" %>
|
4
|
+
<% phc_breadcrumb_one link_to "Code Snippet Index", phccodesnipperpro.script_snippets_path %>
|
5
|
+
<% phc_breadcrumb_two yield(:phc_title_tagline) %>
|
6
|
+
<!-- Title System -->
|
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
|
+
<h1 class="page-header"><%= yield(:phc_title) %></h1>
|
17
|
+
<!-- Page Header -->
|
18
|
+
|
19
|
+
<!-- Page Content -->
|
20
|
+
<div class="row">
|
21
|
+
|
22
|
+
<!-- Button Area -->
|
23
|
+
<div class="col-lg-4">
|
24
|
+
<!-- Button Panel -->
|
25
|
+
<div class="panel panel-inverse">
|
26
|
+
<!-- Panel Heading -->
|
27
|
+
<div class="panel-heading">
|
28
|
+
<h4 class="panel-title">Options Panel</h4>
|
29
|
+
</div>
|
30
|
+
<!-- Panel Heading -->
|
31
|
+
<!-- Panel Body -->
|
32
|
+
<div class="panel-body">
|
33
|
+
<div class="btn-group d-flex" role="group">
|
34
|
+
<%= link_to 'Update', phccodesnipperpro.edit_script_snippet_url_path, class: "btn btn-primary" %>
|
35
|
+
<%= link_to 'Remove', phccodesnipperpro.script_snippet_urls_path, method: :delete, data: { confirm: 'Are you sure?' }, class: "btn btn-danger" %>
|
36
|
+
</div>
|
37
|
+
</div>
|
38
|
+
<!-- Panel Body -->
|
39
|
+
</div>
|
40
|
+
<!-- Button Panel -->
|
41
|
+
</div>
|
42
|
+
<!-- Button Area -->
|
43
|
+
|
44
|
+
<!-- Main Area -->
|
45
|
+
<div class="col-lg-8">
|
46
|
+
<!-- Main Panel -->
|
47
|
+
<div class="panel panel-inverse">
|
48
|
+
<!-- Panel Heading -->
|
49
|
+
<div class="panel-heading">
|
50
|
+
<div class="panel-heading-btn">
|
51
|
+
<a href="javascript:;" class="btn btn-xs btn-icon btn-circle btn-default" data-click="panel-expand"><i class="fa fa-expand"></i></a>
|
52
|
+
<a href="javascript:;" class="btn btn-xs btn-icon btn-circle btn-success" data-click="panel-reload"><i class="fa fa-redo"></i></a>
|
53
|
+
<a href="javascript:;" class="btn btn-xs btn-icon btn-circle btn-warning" data-click="panel-collapse"><i class="fa fa-minus"></i></a>
|
54
|
+
</div>
|
55
|
+
<h4 class="panel-title"><%= yield(:phc_title_tagline) %></h4>
|
56
|
+
</div>
|
57
|
+
<!-- Panel Heading -->
|
58
|
+
<!-- Panel Body -->
|
59
|
+
<div class="panel-body">
|
60
|
+
<p class="h3">Script Snippet URL</p>
|
61
|
+
<hr>
|
62
|
+
<p><%= @script_url.script_url %></p>
|
63
|
+
</div>
|
64
|
+
<!-- Panel Body -->
|
65
|
+
</div>
|
66
|
+
<!-- Main Panel -->
|
67
|
+
</div>
|
68
|
+
<!-- Main Area -->
|
69
|
+
|
70
|
+
</div>
|
71
|
+
<!-- Page Content -->
|
@@ -0,0 +1,107 @@
|
|
1
|
+
# FriendlyId Global Configuration
|
2
|
+
#
|
3
|
+
# Use this to set up shared configuration options for your entire application.
|
4
|
+
# Any of the configuration options shown here can also be applied to single
|
5
|
+
# models by passing arguments to the `friendly_id` class method or defining
|
6
|
+
# methods in your model.
|
7
|
+
#
|
8
|
+
# To learn more, check out the guide:
|
9
|
+
#
|
10
|
+
# http://norman.github.io/friendly_id/file.Guide.html
|
11
|
+
|
12
|
+
FriendlyId.defaults do |config|
|
13
|
+
# ## Reserved Words
|
14
|
+
#
|
15
|
+
# Some words could conflict with Rails's routes when used as slugs, or are
|
16
|
+
# undesirable to allow as slugs. Edit this list as needed for your app.
|
17
|
+
config.use :reserved
|
18
|
+
|
19
|
+
config.reserved_words = %w(new edit index session login logout users admin
|
20
|
+
stylesheets assets javascripts images)
|
21
|
+
|
22
|
+
# This adds an option to treat reserved words as conflicts rather than exceptions.
|
23
|
+
# When there is no good candidate, a UUID will be appended, matching the existing
|
24
|
+
# conflict behavior.
|
25
|
+
|
26
|
+
# config.treat_reserved_as_conflict = true
|
27
|
+
|
28
|
+
# ## Friendly Finders
|
29
|
+
#
|
30
|
+
# Uncomment this to use friendly finders in all models. By default, if
|
31
|
+
# you wish to find a record by its friendly id, you must do:
|
32
|
+
#
|
33
|
+
# MyModel.friendly.find('foo')
|
34
|
+
#
|
35
|
+
# If you uncomment this, you can do:
|
36
|
+
#
|
37
|
+
# MyModel.find('foo')
|
38
|
+
#
|
39
|
+
# This is significantly more convenient but may not be appropriate for
|
40
|
+
# all applications, so you must explicity opt-in to this behavior. You can
|
41
|
+
# always also configure it on a per-model basis if you prefer.
|
42
|
+
#
|
43
|
+
# Something else to consider is that using the :finders addon boosts
|
44
|
+
# performance because it will avoid Rails-internal code that makes runtime
|
45
|
+
# calls to `Module.extend`.
|
46
|
+
#
|
47
|
+
# config.use :finders
|
48
|
+
#
|
49
|
+
# ## Slugs
|
50
|
+
#
|
51
|
+
# Most applications will use the :slugged module everywhere. If you wish
|
52
|
+
# to do so, uncomment the following line.
|
53
|
+
#
|
54
|
+
# config.use :slugged
|
55
|
+
#
|
56
|
+
# By default, FriendlyId's :slugged addon expects the slug column to be named
|
57
|
+
# 'slug', but you can change it if you wish.
|
58
|
+
#
|
59
|
+
# config.slug_column = 'slug'
|
60
|
+
#
|
61
|
+
# By default, slug has no size limit, but you can change it if you wish.
|
62
|
+
#
|
63
|
+
# config.slug_limit = 255
|
64
|
+
#
|
65
|
+
# When FriendlyId can not generate a unique ID from your base method, it appends
|
66
|
+
# a UUID, separated by a single dash. You can configure the character used as the
|
67
|
+
# separator. If you're upgrading from FriendlyId 4, you may wish to replace this
|
68
|
+
# with two dashes.
|
69
|
+
#
|
70
|
+
# config.sequence_separator = '-'
|
71
|
+
#
|
72
|
+
# Note that you must use the :slugged addon **prior** to the line which
|
73
|
+
# configures the sequence separator, or else FriendlyId will raise an undefined
|
74
|
+
# method error.
|
75
|
+
#
|
76
|
+
# ## Tips and Tricks
|
77
|
+
#
|
78
|
+
# ### Controlling when slugs are generated
|
79
|
+
#
|
80
|
+
# As of FriendlyId 5.0, new slugs are generated only when the slug field is
|
81
|
+
# nil, but if you're using a column as your base method can change this
|
82
|
+
# behavior by overriding the `should_generate_new_friendly_id?` method that
|
83
|
+
# FriendlyId adds to your model. The change below makes FriendlyId 5.0 behave
|
84
|
+
# more like 4.0.
|
85
|
+
# Note: Use(include) Slugged module in the config if using the anonymous module.
|
86
|
+
# If you have `friendly_id :name, use: slugged` in the model, Slugged module
|
87
|
+
# is included after the anonymous module defined in the initializer, so it
|
88
|
+
# overrides the `should_generate_new_friendly_id?` method from the anonymous module.
|
89
|
+
#
|
90
|
+
# config.use :slugged
|
91
|
+
# config.use Module.new {
|
92
|
+
# def should_generate_new_friendly_id?
|
93
|
+
# slug.blank? || <your_column_name_here>_changed?
|
94
|
+
# end
|
95
|
+
# }
|
96
|
+
#
|
97
|
+
# FriendlyId uses Rails's `parameterize` method to generate slugs, but for
|
98
|
+
# languages that don't use the Roman alphabet, that's not usually sufficient.
|
99
|
+
# Here we use the Babosa library to transliterate Russian Cyrillic slugs to
|
100
|
+
# ASCII. If you use this, don't forget to add "babosa" to your Gemfile.
|
101
|
+
#
|
102
|
+
# config.use Module.new {
|
103
|
+
# def normalize_friendly_id(text)
|
104
|
+
# text.to_slug.normalize! :transliterations => [:russian, :latin]
|
105
|
+
# end
|
106
|
+
# }
|
107
|
+
end
|
data/config/routes.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
Phccodesnipperpro::Engine.routes.draw do
|
2
|
+
|
3
|
+
# Script Snippet Routes
|
4
|
+
namespace :script do
|
5
|
+
resources :snippets, class_name: 'Phccodesnipperpro::Script::Snippet' do
|
6
|
+
resources :urls, class_name: 'Phccodesnipperpro::Script::Url'
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
# PHCAccounts Routes
|
11
|
+
mount Phcaccountspro::Engine, :at => '/'
|
12
|
+
|
13
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
class CreatePhccodesnipperproScriptUrls < ActiveRecord::Migration[5.2]
|
2
|
+
def change
|
3
|
+
|
4
|
+
create_table :phccodesnipperpro_script_urls do |t|
|
5
|
+
|
6
|
+
t.string :script_url
|
7
|
+
|
8
|
+
t.string :slug
|
9
|
+
|
10
|
+
t.string :user_id
|
11
|
+
t.string :org_id
|
12
|
+
|
13
|
+
t.references :snippet
|
14
|
+
t.timestamps
|
15
|
+
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
class CreatePhccodesnipperproScriptSnippets < ActiveRecord::Migration[5.2]
|
2
|
+
def change
|
3
|
+
|
4
|
+
create_table :phccodesnipperpro_script_snippets do |t|
|
5
|
+
|
6
|
+
t.string :snippet_title
|
7
|
+
t.text :snippet_code
|
8
|
+
|
9
|
+
t.string :slug
|
10
|
+
|
11
|
+
t.string :user_id
|
12
|
+
t.string :org_id
|
13
|
+
|
14
|
+
t.timestamps
|
15
|
+
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|