phccodesnipper 5.4.0 → 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/MIT-LICENSE +1 -1
- data/README.md +36 -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 +51 -51
- data/app/controllers/phccodesnipper/script/urls_controller.rb +55 -61
- 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/layouts/phccodesnipper/components/frontend/header/_main_nav.html.erb +30 -0
- 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 +66 -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 +54 -55
- data/app/views/phccodesnipper/script/urls/new.html.erb +21 -21
- data/app/views/phccodesnipper/script/urls/show.html.erb +60 -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 +69 -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
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
|
data/MIT-LICENSE
CHANGED
data/README.md
CHANGED
@@ -0,0 +1,36 @@
|
|
1
|
+
#### PHCCodeSnipper Documentation
|
2
|
+
Ruby on Rails 7 engine to manage member information and business directory listings.
|
3
|
+
|
4
|
+
- Fast setup of membership management and web directory modules.
|
5
|
+
- Directory and listings manager with a web directory API.
|
6
|
+
- Member's list, contact information, and listings manager.
|
7
|
+
- Easy app integration with views that can be customized.
|
8
|
+
- [Pro version](https://bradpotts.github.io/phccodesnipperpro/) has multi-tenancy capabilities.
|
9
|
+
|
10
|
+
#### Step 1 - Add PHCCodeSnipper to your gemfile and run the install command
|
11
|
+
|
12
|
+
gem 'phccodesnipper'
|
13
|
+
bundle install
|
14
|
+
|
15
|
+
#### Step 2 - Add [PHCDevworks Accounts Devise](https://github.com/phcdevworks/phcdevworks_accounts_devise) to your gemfile
|
16
|
+
This plugin is optimized for PHCDevworks Accounts which uses Devise.
|
17
|
+
|
18
|
+
gem 'phcdevworks_accounts_devise'
|
19
|
+
bundle install
|
20
|
+
|
21
|
+
#### Step 3 - Mount PHCCodeSnipper & Add Routes
|
22
|
+
Mount PHCCodeSnipper by adding code below to your routes file.
|
23
|
+
|
24
|
+
mount PhcdevworksAccountsDevise::Engine, :at => '/'
|
25
|
+
mount Phccodesnipper::Engine, :at => '/'
|
26
|
+
|
27
|
+
#### Step 4 - Copy All Required Database Tables
|
28
|
+
To copy PHCCodeSnipper and PHCDevworks Accounts Devise database migrations.
|
29
|
+
|
30
|
+
rails railties:install:migrations
|
31
|
+
|
32
|
+
#### Step 5 - Recompile Assets
|
33
|
+
To ensure proper function re-compile your application's assets.
|
34
|
+
|
35
|
+
rails assets:clobber && rails assets:precompile
|
36
|
+
|
data/Rakefile
CHANGED
@@ -1,22 +1,8 @@
|
|
1
|
-
|
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 = 'Phccodesnipper'
|
12
|
-
rdoc.options << '--line-numbers'
|
13
|
-
rdoc.rdoc_files.include('README.md')
|
14
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
|
-
end
|
1
|
+
require "bundler/setup"
|
16
2
|
|
17
3
|
APP_RAKEFILE = File.expand_path("spec/test_app/Rakefile", __dir__)
|
18
|
-
load
|
4
|
+
load "rails/tasks/engine.rake"
|
19
5
|
|
20
|
-
load
|
6
|
+
load "rails/tasks/statistics.rake"
|
21
7
|
|
22
|
-
require
|
8
|
+
require "bundler/gem_tasks"
|
@@ -1,2 +1,2 @@
|
|
1
|
-
//=
|
2
|
-
//=
|
1
|
+
//= link coloradmin/default/phcthemes_admin_panel_pack_coloradmin.css
|
2
|
+
//= link coloradmin/phcthemes_admin_panel_pack_coloradmin.js
|
@@ -1,22 +1,21 @@
|
|
1
1
|
module Phccodesnipper
|
2
|
-
|
2
|
+
class ApplicationController < ActionController::Base
|
3
3
|
|
4
|
-
|
5
|
-
|
4
|
+
# Security Filters
|
5
|
+
protect_from_forgery with: :exception
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
helper Phcaccounts::Engine.helpers
|
7
|
+
# Load Requried Helper Files
|
8
|
+
helper PhcdevworksActiveMenus::Engine.helpers
|
9
|
+
helper PhcdevworksNotifications::Engine.helpers
|
10
|
+
helper PhcdevworksTitleseo::Engine.helpers
|
11
|
+
helper PhcdevworksCore::Engine.helpers
|
13
12
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
13
|
+
# Papertrail Whodunnit Username
|
14
|
+
def user_for_paper_trail
|
15
|
+
current_user ? current_user.username : 'Public user'
|
16
|
+
end
|
18
17
|
|
19
|
-
|
18
|
+
private
|
20
19
|
|
21
|
-
|
20
|
+
end
|
22
21
|
end
|
@@ -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
|
@@ -1,79 +1,73 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
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
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
});
|
75
|
-
</script>
|
76
|
-
<!-- JavaScript Loader -->
|
77
|
-
|
78
|
-
</body>
|
79
|
-
</html>
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
|
5
|
+
<!-- SEO System -->
|
6
|
+
<% phc_seo_title "BradPotts - PHCCodeSnipper" %>
|
7
|
+
<% phc_seo_description "Ruby on Rails 7 engine to manage script and post code snippets." %>
|
8
|
+
<!-- SEO System -->
|
9
|
+
|
10
|
+
<!-- SEO and Site Description -->
|
11
|
+
<meta charset="utf-8">
|
12
|
+
<title><%= yield(:phc_seo_title) %></title>
|
13
|
+
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" name="viewport" />
|
14
|
+
<meta name="description" content="<%= yield(:phc_seo_description) %>">
|
15
|
+
<!-- SEO and Site Description -->
|
16
|
+
|
17
|
+
<!-- Rails Security Tags -->
|
18
|
+
<%= csrf_meta_tags %>
|
19
|
+
<%= csp_meta_tag %>
|
20
|
+
<!-- Rails Security Tags -->
|
21
|
+
|
22
|
+
<!-- CSS Styles -->
|
23
|
+
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet" />
|
24
|
+
<%= stylesheet_link_tag "coloradmin/default/phcthemes_admin_panel_pack_coloradmin", media: "all" %>
|
25
|
+
<!-- CSS Styles -->
|
26
|
+
|
27
|
+
</head>
|
28
|
+
<body>
|
29
|
+
|
30
|
+
<!-- -PHCDEV- Page Container -->
|
31
|
+
<div id="app" class="app app-header-fixed app-sidebar-fixed app-with-wide-sidebar">
|
32
|
+
|
33
|
+
<!-- -PHCDEV- Page Container - Header -->
|
34
|
+
<div id="header" class="app-header">
|
35
|
+
<%= render "layouts/phccodesnipper/components/backend/navigation/top_menu" %>
|
36
|
+
</div>
|
37
|
+
<!-- -PHCDEV- Page Container - Header -->
|
38
|
+
|
39
|
+
<!-- -PHCDEV- Page Container - Sidebar -->
|
40
|
+
<div id="sidebar" class="app-sidebar" data-disable-slide-animation="true">
|
41
|
+
<%= render "layouts/phccodesnipper/components/backend/sidebars/side_menu" %>
|
42
|
+
</div>
|
43
|
+
<div class="app-sidebar-bg"></div>
|
44
|
+
<div class="app-sidebar-mobile-backdrop"><a href="#" data-dismiss="app-sidebar-mobile" class="stretched-link"></a></div>
|
45
|
+
<!-- -PHCDEV- Page Container - Sidebar -->
|
46
|
+
|
47
|
+
<!-- -PHCDEV- Page Container - Content -->
|
48
|
+
<div id="app" class="app app-content-full-height">
|
49
|
+
<div id="content" class="app-content d-flex flex-column p-0">
|
50
|
+
<!-- -PHCDEV- Page Container - Main -->
|
51
|
+
<div class="app-content-padding flex-grow-1 overflow-hidden" data-scrollbar="true" data-height="100%">
|
52
|
+
<%= render "phcdevworks_notifications/bootstrap/notifications" %>
|
53
|
+
<%= yield %>
|
54
|
+
</div>
|
55
|
+
<!-- -PHCDEV- Page Container - Main -->
|
56
|
+
<!-- -PHCDEV- Page Container - Footer -->
|
57
|
+
<div id="footer" class="app-footer m-0">
|
58
|
+
<%= render "layouts/phccodesnipper/components/backend/footer/footer" %>
|
59
|
+
</div>
|
60
|
+
<!-- -PHCDEV- Page Container - Footer -->
|
61
|
+
</div>
|
62
|
+
</div>
|
63
|
+
<!-- -PHCDEV- Page Container - Content -->
|
64
|
+
|
65
|
+
</div>
|
66
|
+
<!-- -PHCDEV- Page Container -->
|
67
|
+
|
68
|
+
<!-- JavaScript -->
|
69
|
+
<%= javascript_include_tag "coloradmin/phcthemes_admin_panel_pack_coloradmin" %>
|
70
|
+
<!-- JavaScript -->
|
71
|
+
|
72
|
+
</body>
|
73
|
+
</html>
|
@@ -1,11 +1,17 @@
|
|
1
|
-
<!-- Footer -->
|
2
|
-
<span
|
3
|
-
|
4
|
-
|
5
|
-
|
1
|
+
<!-- -PHCDEV- Page Container - Footer - Left -->
|
2
|
+
<span>
|
3
|
+
<!-- -PHCDEV- Page Container - Footer - Left - Copyright -->
|
4
|
+
<i class="fab fa-osi font-weight-bolder"></i> <%= Time.now.year %>
|
5
|
+
<span class="phc_dev_strong_plugin">PHC</span><span class="phc_dev_light_plugin">Code Snipper</span> - Engine v<%= Gem.loaded_specs["phccodesnipper"].version.to_s %>
|
6
|
+
<!-- -PHCDEV- Page Container - Footer - Left - Copyright -->
|
6
7
|
</span>
|
8
|
+
<!-- -PHCDEV- Page Container - Footer - Left -->
|
9
|
+
|
10
|
+
<!-- -PHCDEV- Page Container - Footer - Right -->
|
7
11
|
<span class="float-right">
|
8
|
-
|
9
|
-
|
12
|
+
<!-- -PHCDEV- Page Container - Footer - Right - Developed -->
|
13
|
+
Developed with <i class="fas fa-heart hanna_hearts"></i> by
|
14
|
+
<a class="phcnet_copyright text-dark" href="https://rubygems.org/profiles/bradpotts" target="_blank"><u><span class="phc_dev_strong_plugin">Brad</span><span class="phc_dev_light_plugin">Potts</span></u></a>
|
15
|
+
<!-- -PHCDEV- Page Container - Footer - Right - Developed -->
|
10
16
|
</span>
|
11
|
-
<!-- Footer -->
|
17
|
+
<!-- -PHCDEV- Page Container - Footer - Right -->
|