phccodesnipper 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +0 -0
  4. data/Rakefile +22 -0
  5. data/app/assets/config/phccodesnipper_manifest.js +2 -0
  6. data/app/assets/javascripts/phccodesnipper/application.js +2 -0
  7. data/app/assets/javascripts/phccodesnipper/script/snippets.coffee +3 -0
  8. data/app/assets/stylesheets/phccodesnipper/application.scss +2 -0
  9. data/app/assets/stylesheets/phccodesnipper/script/snippets.scss +3 -0
  10. data/app/assets/stylesheets/scaffolds.scss +65 -0
  11. data/app/controllers/phccodesnipper/application_controller.rb +22 -0
  12. data/app/controllers/phccodesnipper/script/snippets_controller.rb +66 -0
  13. data/app/controllers/phccodesnipper/script/urls_controller.rb +76 -0
  14. data/app/helpers/phccodesnipper/application_helper.rb +4 -0
  15. data/app/helpers/phccodesnipper/script/snippets_helper.rb +4 -0
  16. data/app/helpers/phccodesnipper/script/urls_helper.rb +4 -0
  17. data/app/jobs/phccodesnipper/application_job.rb +4 -0
  18. data/app/mailers/phccodesnipper/application_mailer.rb +6 -0
  19. data/app/models/phccodesnipper/application_record.rb +5 -0
  20. data/app/models/phccodesnipper/script.rb +7 -0
  21. data/app/models/phccodesnipper/script/snippet.rb +8 -0
  22. data/app/models/phccodesnipper/script/url.rb +8 -0
  23. data/app/views/layouts/phccodesnipper/application.html.erb +78 -0
  24. data/app/views/layouts/phccodesnipper/components/backend/footer/_footer.html.erb +11 -0
  25. data/app/views/layouts/phccodesnipper/components/backend/navigation/_top_menu.html.erb +37 -0
  26. data/app/views/layouts/phccodesnipper/components/backend/sidebars/_side_menu.html.erb +172 -0
  27. data/app/views/phccodesnipper/script/snippets/_form.html.erb +23 -0
  28. data/app/views/phccodesnipper/script/snippets/edit.html.erb +43 -0
  29. data/app/views/phccodesnipper/script/snippets/index.html.erb +75 -0
  30. data/app/views/phccodesnipper/script/snippets/new.html.erb +43 -0
  31. data/app/views/phccodesnipper/script/snippets/show.html.erb +83 -0
  32. data/app/views/phccodesnipper/script/urls/_form.html.erb +18 -0
  33. data/app/views/phccodesnipper/script/urls/edit.html.erb +35 -0
  34. data/app/views/phccodesnipper/script/urls/index.html.erb +74 -0
  35. data/app/views/phccodesnipper/script/urls/new.html.erb +35 -0
  36. data/app/views/phccodesnipper/script/urls/show.html.erb +83 -0
  37. data/config/routes.rb +13 -0
  38. data/db/migrate/20190502060733_create_phccodesnipper_script_urls.rb +17 -0
  39. data/db/migrate/20190508091330_create_phccodesnipper_script_snippets.rb +17 -0
  40. data/lib/phccodesnipper.rb +5 -0
  41. data/lib/phccodesnipper/engine.rb +69 -0
  42. data/lib/phccodesnipper/version.rb +3 -0
  43. data/lib/tasks/phccodesnipper_tasks.rake +4 -0
  44. metadata +699 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: a82f88fa003b9d91a0a7d50ab5f5fe49c67c3402582a36a7b7b9acd5692b63d9
4
+ data.tar.gz: b29e4a7f0274366633c10cd3c1884a05315e8b4a96ee49a0d2319731068670e7
5
+ SHA512:
6
+ metadata.gz: 18127e7df47c31205d89248ae15eb289b94d7005ef4297a14a5a61e8c81f2e906cbaa64c77210981a7b2526d462d65fd79a2b49816634fed9229283b9c9303fc
7
+ data.tar.gz: 8d6b08ff1196717002722e2042742fa71dbd84bee02a8eeff19f7aae092c276bc6a27340b921b9aa486c14379f2440fd33a1fc17fee57ed78fdae44fd49e8f80
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2012-2019 BradPotts - PHCNetco/PHCDevworks/PHCNetworks
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
File without changes
data/Rakefile ADDED
@@ -0,0 +1,22 @@
1
+ begin
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
16
+
17
+ APP_RAKEFILE = File.expand_path("spec/test_app/Rakefile", __dir__)
18
+ load 'rails/tasks/engine.rake'
19
+
20
+ load 'rails/tasks/statistics.rake'
21
+
22
+ require 'bundler/gem_tasks'
@@ -0,0 +1,2 @@
1
+ //= link_directory ../javascripts/phccodesnipper .js
2
+ //= link_directory ../stylesheets/phccodesnipper .scss
@@ -0,0 +1,2 @@
1
+ // Load Admin Theme
2
+ //= require phc_admin_theme_scripts_four
@@ -0,0 +1,3 @@
1
+ # Place all the behaviors and hooks related to the matching controller here.
2
+ # All this logic will automatically be available in application.js.
3
+ # You can use CoffeeScript in this file: http://coffeescript.org/
@@ -0,0 +1,2 @@
1
+ // Load Admin Theme
2
+ @import "phc_admin_theme_styles_four";
@@ -0,0 +1,3 @@
1
+ // Place all the styles related to the script::snippets controller here.
2
+ // They will automatically be included in application.css.
3
+ // You can use Sass (SCSS) here: http://sass-lang.com/
@@ -0,0 +1,65 @@
1
+ body {
2
+ background-color: #fff;
3
+ color: #333;
4
+ margin: 33px; }
5
+
6
+ body, p, ol, ul, td {
7
+ font-family: verdana, arial, helvetica, sans-serif;
8
+ font-size: 13px;
9
+ line-height: 18px; }
10
+
11
+ pre {
12
+ background-color: #eee;
13
+ padding: 10px;
14
+ font-size: 11px; }
15
+
16
+ a {
17
+ color: #000; }
18
+
19
+ a:visited {
20
+ color: #666; }
21
+
22
+ a:hover {
23
+ color: #fff;
24
+ background-color: #000; }
25
+
26
+ th {
27
+ padding-bottom: 5px; }
28
+
29
+ td {
30
+ padding: 0 5px 7px; }
31
+
32
+ div.field,
33
+ div.actions {
34
+ margin-bottom: 10px; }
35
+
36
+ #notice {
37
+ color: green; }
38
+
39
+ .field_with_errors {
40
+ padding: 2px;
41
+ background-color: red;
42
+ display: table; }
43
+
44
+ #error_explanation {
45
+ width: 450px;
46
+ border: 2px solid red;
47
+ padding: 7px 7px 0;
48
+ margin-bottom: 20px;
49
+ background-color: #f0f0f0; }
50
+
51
+ #error_explanation h2 {
52
+ text-align: left;
53
+ font-weight: bold;
54
+ padding: 5px 5px 5px 15px;
55
+ font-size: 12px;
56
+ margin: -7px -7px 0;
57
+ background-color: #c00;
58
+ color: #fff; }
59
+
60
+ #error_explanation ul li {
61
+ font-size: 12px;
62
+ list-style: square; }
63
+
64
+ label {
65
+ display: block; }
@@ -0,0 +1,22 @@
1
+ module Phccodesnipper
2
+ class ApplicationController < ActionController::Base
3
+
4
+ # Security Filters
5
+ protect_from_forgery with: :exception
6
+
7
+ # Load Requried Helper Files
8
+ helper Phccorehelpers::Engine.helpers
9
+ helper Phcmenus::Engine.helpers
10
+ helper Phctitleseo::Engine.helpers
11
+ helper Phcnotifi::Engine.helpers
12
+ helper Phcaccounts::Engine.helpers
13
+
14
+ # Papertrail Whodunnit Username
15
+ def user_for_paper_trail
16
+ current_user ? current_user.username : 'Public user'
17
+ end
18
+
19
+ private
20
+
21
+ end
22
+ end
@@ -0,0 +1,66 @@
1
+ require_dependency "phccodesnipper/application_controller"
2
+
3
+ module Phccodesnipper
4
+ class Script::SnippetsController < ApplicationController
5
+ # Include Core Helpers, Security & Action Filters
6
+ include Phccorehelpers::PhcpluginsHelper
7
+ before_action :authenticate_user!
8
+ before_action :set_script_snippet, only: [:show, :edit, :update, :destroy]
9
+
10
+ # INDEX
11
+ def index
12
+ @script_snippets = Script::Snippet.all
13
+ end
14
+
15
+ # SHOW
16
+ def show
17
+ end
18
+
19
+ # NEW
20
+ def new
21
+ @script_snippet = Script::Snippet.new
22
+ end
23
+
24
+ # EDIT
25
+ def edit
26
+ end
27
+
28
+ # CREATE
29
+ def create
30
+ @script_snippet = Script::Snippet.new(script_snippet_params)
31
+ if @script_snippet.save
32
+ redirect_to @script_snippet, notice: 'Snippet was successfully created.'
33
+ else
34
+ render :new
35
+ end
36
+ end
37
+
38
+ # UPDATE
39
+ def update
40
+ if @script_snippet.update(script_snippet_params)
41
+ redirect_to @script_snippet, notice: 'Snippet was successfully updated.'
42
+ else
43
+ render :edit
44
+ end
45
+ end
46
+
47
+ # DELETE
48
+ def destroy
49
+ @script_snippet.destroy
50
+ redirect_to script_snippets_url, notice: 'Snippet was successfully destroyed.'
51
+ end
52
+
53
+ private
54
+
55
+ # Common Callbacks
56
+ def set_script_snippet
57
+ @script_snippet = Script::Snippet.find(params[:id])
58
+ end
59
+
60
+ # Whitelist
61
+ def script_snippet_params
62
+ params.require(:script_snippet).permit(:snippet_tittle, :snippet_code)
63
+ end
64
+
65
+ end
66
+ end
@@ -0,0 +1,76 @@
1
+ require_dependency "phccodesnipper/application_controller"
2
+
3
+ module Phccodesnipper
4
+ class Script::UrlsController < ApplicationController
5
+
6
+ # Include Core Helpers, Security & Action Filters
7
+ include Phccorehelpers::PhcpluginsHelper
8
+ before_action :authenticate_user!
9
+ before_action :set_script_url, only: [:show, :edit, :update, :destroy]
10
+
11
+ # INDEX
12
+ def index
13
+ snippet = Script::Snippet.find(params[:snippet_id])
14
+ @script_urls = snippet.urls.all
15
+ end
16
+
17
+ # SHOW
18
+ def show
19
+ script_snippet = Script::Snippet.find(params[:snippet_id])
20
+ @script_url = script_snippet.urls.find(params[:id])
21
+ end
22
+
23
+ # NEW
24
+ def new
25
+ script_snippet = Script::Snippet.find(params[:snippet_id])
26
+ @script_url = script_snippet.urls.build
27
+ end
28
+
29
+ # EDIT
30
+ def edit
31
+ end
32
+
33
+ # CREATE
34
+ def create
35
+ @script_snippet = Script::Snippet.find(params[:snippet_id])
36
+ @script_url = @script_snippet.urls.create(script_url_params)
37
+ @script_url.user_id = current_user.id
38
+ if @script_url.save
39
+ redirect_to script_snippet_urls_path, notice: 'Script url was successfully created.'
40
+ else
41
+ render :new
42
+ end
43
+ end
44
+
45
+ # UPDATE
46
+ def update
47
+ @script_snippet = Script::Snippet.find(params[:snippet_id])
48
+ if @script_url.update(script_url_params)
49
+ redirect_to script_snippet_urls_path, notice: 'Script url was successfully updated.'
50
+ else
51
+ render :edit
52
+ end
53
+ end
54
+
55
+ # DELETE
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, notice: 'Script url was successfully destroyed.'
61
+ end
62
+
63
+ private
64
+
65
+ # Common Callbacks
66
+ def set_script_url
67
+ @script_url = Script::Url.find(params[:id])
68
+ end
69
+
70
+ # Whitelist
71
+ def script_url_params
72
+ params.require(:script_url).permit(:script_url, :snippet_id)
73
+ end
74
+
75
+ end
76
+ end
@@ -0,0 +1,4 @@
1
+ module Phccodesnipper
2
+ module ApplicationHelper
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module Phccodesnipper
2
+ module Script::SnippetsHelper
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module Phccodesnipper
2
+ module Script::UrlsHelper
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module Phccodesnipper
2
+ class ApplicationJob < ActiveJob::Base
3
+ end
4
+ end
@@ -0,0 +1,6 @@
1
+ module Phccodesnipper
2
+ class ApplicationMailer < ActionMailer::Base
3
+ default from: 'from@example.com'
4
+ layout 'mailer'
5
+ end
6
+ end
@@ -0,0 +1,5 @@
1
+ module Phccodesnipper
2
+ class ApplicationRecord < ActiveRecord::Base
3
+ self.abstract_class = true
4
+ end
5
+ end
@@ -0,0 +1,7 @@
1
+ module Phccodesnipper
2
+ module Script
3
+ def self.table_name_prefix
4
+ 'phccodesnipper_script_'
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,8 @@
1
+ module Phccodesnipper
2
+ class Script::Snippet < ApplicationRecord
3
+
4
+ # Relationships
5
+ has_many :urls, class_name: 'Phccodesnipper::Script::Url'
6
+
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ module Phccodesnipper
2
+ class Script::Url < ApplicationRecord
3
+
4
+ # Relationships
5
+ belongs_to :snippet, class_name: 'Phccodesnipper::Script::Snippet'
6
+
7
+ end
8
+ end
@@ -0,0 +1,78 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+
5
+ <!-- SEO System -->
6
+ <% phc_seo_title "PHCCodeSnipper by PHCDevworks" %>
7
+ <% phc_seo_description "Application to manage and post code snippets." %>
8
+ <!-- SEO System -->
9
+
10
+ <!-- SEO and Site Description -->
11
+ <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
12
+ <title><%= yield(:phc_seo_title) %></title>
13
+ <meta name="description" content="<%= yield(:phc_seo_description) %>">
14
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" >
15
+ <link rel="canonical" href="http://phcdevworks.com">
16
+ <!-- SEO and Site Description -->
17
+
18
+ <!-- Rails Security Tags -->
19
+ <%= csrf_meta_tags %>
20
+ <%= csp_meta_tag %>
21
+ <!-- Rails Security Tags -->
22
+
23
+ <!-- CSS Styles -->
24
+ <%= stylesheet_link_tag 'phccodesnipper/application', media: 'all', 'data-turbolinks-track': 'reload' %>
25
+ <!-- CSS Styles -->
26
+
27
+ <!-- Font -->
28
+ <link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=Open+Sans:300,400%7CRaleway:300,400,500,600,700%7CLato:300,400,400italic,600,700"/>
29
+ <!-- Font -->
30
+
31
+ </head>
32
+ <body>
33
+
34
+ <!-- Page Container -->
35
+ <div id="page-container" class="page-container fade page-sidebar-fixed page-header-fixed">
36
+
37
+ <!-- Page Header -->
38
+ <div id="header" class="header navbar-default">
39
+ <%= render 'layouts/phccodesnipper/components/backend/navigation/top_menu' %>
40
+ </div>
41
+ <!-- Page Header -->
42
+
43
+ <!-- Page Sidebar -->
44
+ <div id="sidebar" class="sidebar">
45
+ <%= render 'layouts/phccodesnipper/components/backend/sidebars/side_menu' %>
46
+ </div>
47
+ <div class="sidebar-bg"></div>
48
+ <!-- Page Sidebar -->
49
+
50
+ <!-- Page Content -->
51
+ <div id="content" class="content">
52
+ <%= yield %>
53
+ </div>
54
+ <!-- Page Content -->
55
+
56
+ <!-- Footer Content -->
57
+ <div id="footer" class="footer mb-4">
58
+ <%= render 'layouts/phccodesnipper/components/backend/footer/footer' %>
59
+ </div>
60
+ <!-- Footer Content -->
61
+
62
+ </div>
63
+ <!-- Page Container -->
64
+
65
+ <!-- JavaScript -->
66
+ <%= javascript_include_tag "phccodesnipper/application", 'data-turbolinks-track': 'reload' %>
67
+ <!-- JavaScript -->
68
+
69
+ <!-- JavaScript Loader -->
70
+ <script>
71
+ $(document).ready(function() {
72
+ App.init();
73
+ });
74
+ </script>
75
+ <!-- JavaScript Loader -->
76
+
77
+ </body>
78
+ </html>