phccodesnipper 6.0.1 → 6.1.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/phccodesnipper/script/snippets_controller.rb +51 -51
- data/app/controllers/phccodesnipper/script/urls_controller.rb +55 -61
- data/app/views/layouts/phccodesnipper/components/frontend/header/_main_nav.html.erb +30 -0
- data/app/views/phccodesnipper/script/snippets/show.html.erb +3 -0
- data/app/views/phccodesnipper/script/urls/index.html.erb +2 -3
- data/app/views/phccodesnipper/script/urls/show.html.erb +1 -4
- data/lib/phccodesnipper/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5e756162ca4dfb2a7482dee54c9c90f6a2d5717a8830c39e48c7836781416d5d
|
4
|
+
data.tar.gz: 6003240931a596f8f815dc939ee77b246fcd00841229509c3b00792c4b5550df
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 83655f448bd20efcfd6990270de1f726a24b7d7bccd00f2b702d2324110b9dfee01a0bfe80a52f6676a984e1d41172ac9d234d3544f10a9642d24ae7bfecc459
|
7
|
+
data.tar.gz: dd3c3712bf429317c35cd6168c1c88fecbd46f3e7c11ccd22aec306a7cf670a865bb2c0aa3cc060152a0de836c23bca5e68f9ad9fc7b04b21de085663cebf252
|
@@ -1,67 +1,67 @@
|
|
1
1
|
require_dependency "phccodesnipper/application_controller"
|
2
2
|
|
3
3
|
module Phccodesnipper
|
4
|
-
|
4
|
+
class Script::SnippetsController < ApplicationController
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
6
|
+
# Include Core Helpers, Security & Action Filters
|
7
|
+
include PhcdevworksCore::PhcdevPluginsHelper
|
8
|
+
before_action :authenticate_user!
|
9
|
+
before_action :set_script_snippet, only: [:show, :edit, :update, :destroy]
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
11
|
+
# INDEX
|
12
|
+
def index
|
13
|
+
@script_snippets = Script::Snippet.all
|
14
|
+
end
|
15
15
|
|
16
|
-
|
17
|
-
|
18
|
-
|
16
|
+
# SHOW
|
17
|
+
def show
|
18
|
+
end
|
19
19
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
20
|
+
# NEW
|
21
|
+
def new
|
22
|
+
@script_snippet = Script::Snippet.new
|
23
|
+
end
|
24
24
|
|
25
|
-
|
26
|
-
|
27
|
-
|
25
|
+
# EDIT
|
26
|
+
def edit
|
27
|
+
end
|
28
28
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
29
|
+
# CREATE
|
30
|
+
def create
|
31
|
+
@script_snippet = Script::Snippet.new(script_snippet_params)
|
32
|
+
if @script_snippet.save
|
33
|
+
redirect_to @script_snippet, :flash => { :success => 'Code snippet was successfully created.' }
|
34
|
+
else
|
35
|
+
render :new
|
36
|
+
end
|
37
|
+
end
|
38
38
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
39
|
+
# UPDATE
|
40
|
+
def update
|
41
|
+
if @script_snippet.update(script_snippet_params)
|
42
|
+
redirect_to @script_snippet, :flash => { :success => 'Code snippet was successfully updated.' }
|
43
|
+
else
|
44
|
+
render :edit
|
45
|
+
end
|
46
|
+
end
|
47
47
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
48
|
+
# DELETE
|
49
|
+
def destroy
|
50
|
+
@script_snippet.destroy
|
51
|
+
redirect_to script_snippets_url, :flash => { :error => 'Code snippet was successfully destroyed.' }
|
52
|
+
end
|
53
53
|
|
54
|
-
|
54
|
+
private
|
55
55
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
56
|
+
# Common Callbacks
|
57
|
+
def set_script_snippet
|
58
|
+
@script_snippet = Script::Snippet.find(params[:id])
|
59
|
+
end
|
60
60
|
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
61
|
+
# Whitelist
|
62
|
+
def script_snippet_params
|
63
|
+
params.require(:script_snippet).permit(:snippet_title, :snippet_code)
|
64
|
+
end
|
65
65
|
|
66
|
-
|
66
|
+
end
|
67
67
|
end
|
@@ -1,76 +1,70 @@
|
|
1
1
|
require_dependency "phccodesnipper/application_controller"
|
2
2
|
|
3
3
|
module Phccodesnipper
|
4
|
-
|
4
|
+
class Script::UrlsController < ApplicationController
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
6
|
+
# Include Core Helpers, Security & Action Filters
|
7
|
+
include PhcdevworksCore::PhcdevPluginsHelper
|
8
|
+
before_action :authenticate_user!
|
9
|
+
before_action :set_script_url, only: [:show, :edit, :update, :destroy]
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
11
|
+
# INDEX
|
12
|
+
def index
|
13
|
+
snippet = Script::Snippet.find(params[:snippet_id])
|
14
|
+
@script_urls = snippet.urls.all
|
15
|
+
end
|
16
16
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
17
|
+
# NEW
|
18
|
+
def new
|
19
|
+
script_snippet = Script::Snippet.find(params[:snippet_id])
|
20
|
+
@script_url = script_snippet.urls.build
|
21
|
+
end
|
22
22
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
@script_url = script_snippet.urls.build
|
27
|
-
end
|
23
|
+
# EDIT
|
24
|
+
def edit
|
25
|
+
end
|
28
26
|
|
29
|
-
|
30
|
-
|
31
|
-
|
27
|
+
# CREATE
|
28
|
+
def create
|
29
|
+
@script_snippet = Script::Snippet.find(params[:snippet_id])
|
30
|
+
@script_url = @script_snippet.urls.create(script_url_params)
|
31
|
+
@script_url.user_id = current_user.id
|
32
|
+
if @script_url.save
|
33
|
+
redirect_to script_snippet_urls_path, :flash => { :success => 'Script URL was successfully created.' }
|
34
|
+
else
|
35
|
+
render :new
|
36
|
+
end
|
37
|
+
end
|
32
38
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
end
|
43
|
-
end
|
39
|
+
# UPDATE
|
40
|
+
def update
|
41
|
+
@script_snippet = Script::Snippet.find(params[:snippet_id])
|
42
|
+
if @script_url.update(script_url_params)
|
43
|
+
redirect_to script_snippet_urls_path, :flash => { :success => 'Script URL was successfully updated.' }
|
44
|
+
else
|
45
|
+
render :edit
|
46
|
+
end
|
47
|
+
end
|
44
48
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
end
|
53
|
-
end
|
49
|
+
# DELETE
|
50
|
+
def destroy
|
51
|
+
@script_snippet = Script::Snippet.find(params[:snippet_id])
|
52
|
+
@script_url = @script_snippet.urls.find(params[:id])
|
53
|
+
@script_url.destroy
|
54
|
+
redirect_to script_snippet_urls_path, :flash => { :error => 'Script URL was successfully removed.' }
|
55
|
+
end
|
54
56
|
|
55
|
-
|
56
|
-
def destroy
|
57
|
-
@script_snippet = Script::Snippet.find(params[:snippet_id])
|
58
|
-
@script_url = @script_snippet.urls.find(params[:id])
|
59
|
-
@script_url.destroy
|
60
|
-
redirect_to script_snippet_urls_path, :flash => { :error => 'Script url was successfully destroyed.' }
|
61
|
-
end
|
57
|
+
private
|
62
58
|
|
63
|
-
|
59
|
+
# Common Callbacks
|
60
|
+
def set_script_url
|
61
|
+
@script_url = Script::Url.find(params[:id])
|
62
|
+
end
|
64
63
|
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
64
|
+
# Whitelist
|
65
|
+
def script_url_params
|
66
|
+
params.require(:script_url).permit(:script_url, :snippet_id)
|
67
|
+
end
|
69
68
|
|
70
|
-
|
71
|
-
def script_url_params
|
72
|
-
params.require(:script_url).permit(:script_url, :snippet_id)
|
73
|
-
end
|
74
|
-
|
75
|
-
end
|
69
|
+
end
|
76
70
|
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
<!-- -PHCDEV- Main Wrapper - Header - Navbar - Container -->
|
2
|
+
<div class="container">
|
3
|
+
|
4
|
+
<!-- -PHCDEV- Main Wrapper - Header - Navbar - Container - Branding -->
|
5
|
+
<a href="index.html" class="navbar-brand">
|
6
|
+
<span class="brand-logo"></span>
|
7
|
+
<span class="brand-text">
|
8
|
+
<span class="text-theme">PHC</span>CodeSnipper
|
9
|
+
</span>
|
10
|
+
</a>
|
11
|
+
<!-- -PHCDEV- Main Wrapper - Header - Navbar - Container - Branding -->
|
12
|
+
|
13
|
+
<!-- -PHCDEV- Main Wrapper - Header - Navbar - Container - Mobile Button -->
|
14
|
+
<button type="button" class="navbar-toggle collapsed" data-bs-toggle="collapse" data-bs-target="#header-navbar">
|
15
|
+
<span class="icon-bar"></span>
|
16
|
+
<span class="icon-bar"></span>
|
17
|
+
<span class="icon-bar"></span>
|
18
|
+
</button>
|
19
|
+
<!-- -PHCDEV- Main Wrapper - Header - Navbar - Container - Mobile Button -->
|
20
|
+
|
21
|
+
<!-- -PHCDEV- Main Wrapper - Header - Navbar - Container - Navigation -->
|
22
|
+
<div class="collapse navbar-collapse" id="header-navbar">
|
23
|
+
<ul class="nav navbar-nav navbar-end">
|
24
|
+
<li class="nav-item"><%= link_to "Code Snippets", phccodesnipper.script_snippets_path, class: "nav-link" %></li>
|
25
|
+
</ul>
|
26
|
+
</div>
|
27
|
+
<!-- -PHCDEV- Main Wrapper - Header - Navbar - Container - Navigation -->
|
28
|
+
|
29
|
+
</div>
|
30
|
+
<!-- -PHCDEV- Main Wrapper - Header - Navbar - Container -->
|
@@ -37,6 +37,9 @@
|
|
37
37
|
<%= link_to "Update", phccodesnipper.edit_script_snippet_path, class: "btn btn-primary" %>
|
38
38
|
<%= link_to "Remove", phccodesnipper.script_snippet_path, method: :delete, data: { confirm: "Are you sure?" }, class: "btn btn-danger" %>
|
39
39
|
</div>
|
40
|
+
<div class="btn-group d-flex" role="group">
|
41
|
+
<%= link_to "Add URL", phccodesnipper.script_snippet_urls_path(@script_snippet), class: "btn btn-succss" %>
|
42
|
+
</div>
|
40
43
|
</div>
|
41
44
|
<!-- -PHCDEV- Panel - Body -->
|
42
45
|
|
@@ -43,9 +43,8 @@
|
|
43
43
|
<td><%= script_url.script_url %></td>
|
44
44
|
<td>
|
45
45
|
<div class="btn-group d-flex" role="group">
|
46
|
-
<%= link_to "
|
47
|
-
<%= link_to "
|
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" %>
|
46
|
+
<%= link_to "Update URL", edit_script_snippet_url_path(script_url.snippet, script_url), class: "btn btn-primary btn-xs" %>
|
47
|
+
<%= link_to "Remove URL", 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
48
|
</div>
|
50
49
|
</td>
|
51
50
|
</tr>
|
@@ -33,10 +33,7 @@
|
|
33
33
|
|
34
34
|
<!-- -PHCDEV- Panel - Body -->
|
35
35
|
<div class="panel-body">
|
36
|
-
|
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>
|
36
|
+
<%= link_to "Update", phccodesnipper.edit_script_snippet_url_path, class: "btn btn-primary" %>
|
40
37
|
</div>
|
41
38
|
<!-- -PHCDEV- Panel - Body -->
|
42
39
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: phccodesnipper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.0
|
4
|
+
version: 6.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- BradPotts
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-04-
|
11
|
+
date: 2022-04-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -317,6 +317,7 @@ files:
|
|
317
317
|
- app/views/layouts/phccodesnipper/components/backend/footer/_footer.html.erb
|
318
318
|
- app/views/layouts/phccodesnipper/components/backend/navigation/_top_menu.html.erb
|
319
319
|
- app/views/layouts/phccodesnipper/components/backend/sidebars/_side_menu.html.erb
|
320
|
+
- app/views/layouts/phccodesnipper/components/frontend/header/_main_nav.html.erb
|
320
321
|
- app/views/phccodesnipper/script/snippets/_form.html.erb
|
321
322
|
- app/views/phccodesnipper/script/snippets/edit.html.erb
|
322
323
|
- app/views/phccodesnipper/script/snippets/index.html.erb
|