phcdevworks_scripts 0.1.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 +35 -0
- data/Rakefile +32 -0
- data/app/assets/config/phcdevworks_scripts_manifest.js +1 -0
- data/app/assets/javascripts/phcdevworks_scripts/application.js +2 -0
- data/app/assets/javascripts/phcdevworks_scripts/script/versions.coffee +3 -0
- data/app/assets/stylesheets/phcdevworks_scripts/application.scss +2 -0
- data/app/assets/stylesheets/phcdevworks_scripts/script/authors.css +4 -0
- data/app/assets/stylesheets/phcdevworks_scripts/script/extensions.css +4 -0
- data/app/assets/stylesheets/phcdevworks_scripts/script/listings.css +4 -0
- data/app/assets/stylesheets/phcdevworks_scripts/script/urls.css +4 -0
- data/app/assets/stylesheets/phcdevworks_scripts/script/versions.scss +3 -0
- data/app/assets/stylesheets/phcdevworks_scripts/snippet/posts.css +4 -0
- data/app/assets/stylesheets/phcdevworks_scripts/snippet/urls.css +4 -0
- data/app/controllers/phcdevworks_scripts/application_controller.rb +13 -0
- data/app/controllers/phcdevworks_scripts/script/authors_controller.rb +82 -0
- data/app/controllers/phcdevworks_scripts/script/extensions_controller.rb +82 -0
- data/app/controllers/phcdevworks_scripts/script/listings_controller.rb +82 -0
- data/app/controllers/phcdevworks_scripts/script/urls_controller.rb +77 -0
- data/app/controllers/phcdevworks_scripts/script/versions_controller.rb +82 -0
- data/app/controllers/phcdevworks_scripts/snippet/posts_controller.rb +80 -0
- data/app/controllers/phcdevworks_scripts/snippet/urls_controller.rb +76 -0
- data/app/helpers/phcdevworks_scripts/application_helper.rb +4 -0
- data/app/helpers/phcdevworks_scripts/script/authors_helper.rb +4 -0
- data/app/helpers/phcdevworks_scripts/script/extensions_helper.rb +4 -0
- data/app/helpers/phcdevworks_scripts/script/listings_helper.rb +4 -0
- data/app/helpers/phcdevworks_scripts/script/urls_helper.rb +4 -0
- data/app/helpers/phcdevworks_scripts/script/versions_helper.rb +4 -0
- data/app/helpers/phcdevworks_scripts/snippet/posts_helper.rb +4 -0
- data/app/helpers/phcdevworks_scripts/snippet/urls_helper.rb +4 -0
- data/app/jobs/phcdevworks_scripts/application_job.rb +4 -0
- data/app/mailers/phcdevworks_scripts/application_mailer.rb +6 -0
- data/app/models/phcdevworks_scripts/application_record.rb +5 -0
- data/app/models/phcdevworks_scripts/author_versions.rb +5 -0
- data/app/models/phcdevworks_scripts/extension_versions.rb +5 -0
- data/app/models/phcdevworks_scripts/listing_versions.rb +5 -0
- data/app/models/phcdevworks_scripts/script.rb +7 -0
- data/app/models/phcdevworks_scripts/script/author.rb +33 -0
- data/app/models/phcdevworks_scripts/script/extension.rb +32 -0
- data/app/models/phcdevworks_scripts/script/listing.rb +38 -0
- data/app/models/phcdevworks_scripts/script/url.rb +24 -0
- data/app/models/phcdevworks_scripts/script/version.rb +26 -0
- data/app/models/phcdevworks_scripts/scriptversion_versions.rb +5 -0
- data/app/models/phcdevworks_scripts/snippet.rb +7 -0
- data/app/models/phcdevworks_scripts/snippet/post.rb +25 -0
- data/app/models/phcdevworks_scripts/snippet/url.rb +16 -0
- data/app/models/phcdevworks_scripts/url_versions.rb +5 -0
- data/app/views/layouts/phcdevworks_scripts/application.html.erb +94 -0
- data/app/views/layouts/phcdevworks_scripts/components/backend/footer/_footer.html.erb +16 -0
- data/app/views/layouts/phcdevworks_scripts/components/backend/navigation/_top_menu.html.erb +37 -0
- data/app/views/layouts/phcdevworks_scripts/components/backend/sidebars/_side_menu.html.erb +183 -0
- data/app/views/phcdevworks_scripts/script/authors/_form.html.erb +32 -0
- data/app/views/phcdevworks_scripts/script/authors/edit.html.erb +37 -0
- data/app/views/phcdevworks_scripts/script/authors/index.html.erb +63 -0
- data/app/views/phcdevworks_scripts/script/authors/new.html.erb +37 -0
- data/app/views/phcdevworks_scripts/script/authors/show.html.erb +49 -0
- data/app/views/phcdevworks_scripts/script/extensions/_form.html.erb +28 -0
- data/app/views/phcdevworks_scripts/script/extensions/edit.html.erb +37 -0
- data/app/views/phcdevworks_scripts/script/extensions/index.html.erb +59 -0
- data/app/views/phcdevworks_scripts/script/extensions/new.html.erb +37 -0
- data/app/views/phcdevworks_scripts/script/extensions/show.html.erb +49 -0
- data/app/views/phcdevworks_scripts/script/listings/_form.html.erb +62 -0
- data/app/views/phcdevworks_scripts/script/listings/edit.html.erb +35 -0
- data/app/views/phcdevworks_scripts/script/listings/index.html.erb +62 -0
- data/app/views/phcdevworks_scripts/script/listings/new.html.erb +36 -0
- data/app/views/phcdevworks_scripts/script/listings/show.html.erb +48 -0
- data/app/views/phcdevworks_scripts/script/urls/_form.html.erb +36 -0
- data/app/views/phcdevworks_scripts/script/urls/edit.html.erb +36 -0
- data/app/views/phcdevworks_scripts/script/urls/index.html.erb +61 -0
- data/app/views/phcdevworks_scripts/script/urls/new.html.erb +37 -0
- data/app/views/phcdevworks_scripts/script/urls/show.html.erb +49 -0
- data/app/views/phcdevworks_scripts/script/versions/_form.html.erb +20 -0
- data/app/views/phcdevworks_scripts/script/versions/edit.html.erb +37 -0
- data/app/views/phcdevworks_scripts/script/versions/index.html.erb +57 -0
- data/app/views/phcdevworks_scripts/script/versions/new.html.erb +37 -0
- data/app/views/phcdevworks_scripts/script/versions/show.html.erb +49 -0
- data/app/views/phcdevworks_scripts/snippet/posts/_form.html.erb +26 -0
- data/app/views/phcdevworks_scripts/snippet/posts/edit.html.erb +39 -0
- data/app/views/phcdevworks_scripts/snippet/posts/index.html.erb +68 -0
- data/app/views/phcdevworks_scripts/snippet/posts/new.html.erb +39 -0
- data/app/views/phcdevworks_scripts/snippet/posts/show.html.erb +71 -0
- data/app/views/phcdevworks_scripts/snippet/urls/_form.html.erb +22 -0
- data/app/views/phcdevworks_scripts/snippet/urls/edit.html.erb +39 -0
- data/app/views/phcdevworks_scripts/snippet/urls/index.html.erb +66 -0
- data/app/views/phcdevworks_scripts/snippet/urls/new.html.erb +39 -0
- data/app/views/phcdevworks_scripts/snippet/urls/show.html.erb +71 -0
- data/config/initializers/friendly_id.rb +107 -0
- data/config/routes.rb +32 -0
- data/db/migrate/20170509002355_create_phcdevworks_scripts_friendly_id_slugs.rb +18 -0
- data/db/migrate/20170517064030_create_phcdevworks_scripts_extension_versions.rb +17 -0
- data/db/migrate/20170517064049_create_phcdevworks_scripts_listing_versions.rb +17 -0
- data/db/migrate/20170517064114_create_phcdevworks_scripts_scriptversion_versions.rb +17 -0
- data/db/migrate/20170517064150_create_phcdevworks_scripts_url_versions.rb +17 -0
- data/db/migrate/20170517064208_create_phcdevworks_scripts_author_versions.rb +17 -0
- data/db/migrate/20170517064427_create_phcdevworks_scripts_licence_versions.rb +17 -0
- data/db/migrate/20190818022002_create_phcdevworks_scripts_snippet_posts.rb +16 -0
- data/db/migrate/20190818022024_create_phcdevworks_scripts_snippet_urls.rb +17 -0
- data/db/migrate/20190818022939_create_phcdevworks_scripts_script_authors.rb +18 -0
- data/db/migrate/20190818023353_create_phcdevworks_scripts_script_listings.rb +27 -0
- data/db/migrate/20190818023709_create_phcdevworks_scripts_script_extensions.rb +17 -0
- data/db/migrate/20190818023911_create_phcdevworks_scripts_script_urls.rb +21 -0
- data/db/migrate/20190818031653_create_phcdevworks_scripts_script_versions.rb +15 -0
- data/lib/phcdevworks_scripts.rb +5 -0
- data/lib/phcdevworks_scripts/engine.rb +33 -0
- data/lib/phcdevworks_scripts/version.rb +3 -0
- data/lib/tasks/phcdevworks_scripts_tasks.rake +4 -0
- metadata +352 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 541cd751e5495577fd0f9d09836dcbd1d3a7772a8e78fc57334695de06f868dd
|
4
|
+
data.tar.gz: 1bbf97ae7ff558c124b2c8813e55a3a34ec3b9cd6fdc1e3a8e525bb85fca5f79
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 33547a719b2a6a1a694664c262be27c4c128b52381b35072bfcc47e1c34eee4a069e648b0b9eb50b4f789ebdacc5023f5f735a3138b2a05eb48a3560e2899cb1
|
7
|
+
data.tar.gz: b252585714c67823fccbe75f831138e909b4c4929f564b94762c29b96754ec4967b9b0577b832c09dad7bc064a27022cf832bc69e2bbc1a2a3c4e8db80c51528
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2019 - PHCDEVWORKS
|
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
@@ -0,0 +1,35 @@
|
|
1
|
+
### PHCDevworks Scripts Documentation
|
2
|
+
|
3
|
+
PHCDevworks Scripts Rails 6 script management engine for website script CDN and snippet listings
|
4
|
+
|
5
|
+
- Manage script CDN listings for websites.
|
6
|
+
- Main script title and description.
|
7
|
+
- Script versions and script CDN URLs.
|
8
|
+
- Store script snippets and URLs.
|
9
|
+
|
10
|
+
#### Step 1 - Add PHCDevworks Scripts to your gemfile and run command
|
11
|
+
|
12
|
+
gem 'phcscriptcdnpro'
|
13
|
+
bundle install
|
14
|
+
|
15
|
+
#### Step 2 - Copy PHCDevworks Scripts Database Tables
|
16
|
+
To copy PHCScriptCDN's required database migrations, copy each command individually to your terminal's command line.
|
17
|
+
|
18
|
+
rails phcdevworks_scripts:install:migrations
|
19
|
+
rails db:migrate
|
20
|
+
|
21
|
+
#### Step 3 - Mount PHCDevworks Scripts & Add Routes
|
22
|
+
Mount PHCMembers by adding code below to your routes file.
|
23
|
+
|
24
|
+
mount Phcscriptcdnpro::Engine, :at => '/'
|
25
|
+
|
26
|
+
#### Step 4 - Recompile Assets
|
27
|
+
To properly function re-compile your application's assets to copy over required files.
|
28
|
+
|
29
|
+
rails assets:clobber
|
30
|
+
rails assets:precompile
|
31
|
+
|
32
|
+
#### Step 5 - Generate Contact Form View (Customization)
|
33
|
+
All PHCDevworks Scripts views and layouts can be overwritten by copying files to your application.
|
34
|
+
|
35
|
+
rails generate phcdevworks_scripts:views
|
data/Rakefile
ADDED
@@ -0,0 +1,32 @@
|
|
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 = 'PhcdevworksScripts'
|
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("test/test_app/Rakefile", __dir__)
|
18
|
+
load 'rails/tasks/engine.rake'
|
19
|
+
|
20
|
+
load 'rails/tasks/statistics.rake'
|
21
|
+
|
22
|
+
require 'bundler/gem_tasks'
|
23
|
+
|
24
|
+
require 'rake/testtask'
|
25
|
+
|
26
|
+
Rake::TestTask.new(:test) do |t|
|
27
|
+
t.libs << 'test'
|
28
|
+
t.pattern = 'test/**/*_test.rb'
|
29
|
+
t.verbose = false
|
30
|
+
end
|
31
|
+
|
32
|
+
task default: :test
|
@@ -0,0 +1 @@
|
|
1
|
+
//= link_directory ../stylesheets/phcdevworks_scripts .css
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module PhcdevworksScripts
|
2
|
+
class ApplicationController < ActionController::Base
|
3
|
+
|
4
|
+
# Security Filters
|
5
|
+
protect_from_forgery with: :exception
|
6
|
+
|
7
|
+
# Load Requried Helper Files
|
8
|
+
helper PhcdevworksActiveMenus::Engine.helpers
|
9
|
+
helper PhcdevworksNotifications::Engine.helpers
|
10
|
+
helper PhcdevworksTitleseo::Engine.helpers
|
11
|
+
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
require_dependency "phcdevworks_scripts/application_controller"
|
2
|
+
|
3
|
+
module PhcdevworksScripts
|
4
|
+
class Script::AuthorsController < ApplicationController
|
5
|
+
|
6
|
+
# Filters & Security
|
7
|
+
#include PhcdevworksCore::PhcpluginsHelper
|
8
|
+
before_action :authenticate_user!
|
9
|
+
before_action :set_paper_trail_whodunnit
|
10
|
+
before_action :set_script_author, only: [:show, :edit, :update, :destroy]
|
11
|
+
|
12
|
+
# GET /script/authors
|
13
|
+
def index
|
14
|
+
@script_authors = Script::Author.all
|
15
|
+
end
|
16
|
+
|
17
|
+
# GET /script/authors/1
|
18
|
+
def show
|
19
|
+
@script_authors = Script::Author.friendly.find(params[:id])
|
20
|
+
@versions = PhcdevworksScripts::AuthorVersions.where(item_id: params[:id], item_type: 'PhcdevworksScripts::Script::Author')
|
21
|
+
end
|
22
|
+
|
23
|
+
# GET /script/authors/new
|
24
|
+
def new
|
25
|
+
@script_author = Script::Author.new
|
26
|
+
end
|
27
|
+
|
28
|
+
# GET /script/authors/1/edit
|
29
|
+
def edit
|
30
|
+
end
|
31
|
+
|
32
|
+
# POST /script/authors
|
33
|
+
def create
|
34
|
+
@script_author = Script::Author.new(script_author_params)
|
35
|
+
@script_author.user_id = current_user.id
|
36
|
+
respond_to do |format|
|
37
|
+
if @script_author.save
|
38
|
+
format.html { redirect_to script_authors_path, :flash => { :success => 'Author has been Added.' }}
|
39
|
+
format.json { render :show, status: :created, location: @script_author }
|
40
|
+
else
|
41
|
+
format.html { render :new }
|
42
|
+
format.json { render json: @script_author.errors, status: :unprocessable_entity }
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
# PATCH/PUT /script/authors/1
|
48
|
+
def update
|
49
|
+
respond_to do |format|
|
50
|
+
if @script_author.update(script_author_params)
|
51
|
+
format.html { redirect_to script_authors_path, :flash => { :notice => 'Author Name has been Updated.' }}
|
52
|
+
format.json { render :show, status: :ok, location: @script_author }
|
53
|
+
else
|
54
|
+
format.html { render :edit }
|
55
|
+
format.json { render json: @script_author.errors, status: :unprocessable_entity }
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
# DELETE /script/authors/1
|
61
|
+
def destroy
|
62
|
+
@script_author.destroy
|
63
|
+
respond_to do |format|
|
64
|
+
format.html { redirect_to script_authors_path, :flash => { :error => 'Category and Connections have all been Removed.' }}
|
65
|
+
format.json { head :no_content }
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
private
|
70
|
+
|
71
|
+
# Callback
|
72
|
+
def set_script_author
|
73
|
+
@script_author = Script::Author.friendly.find(params[:id])
|
74
|
+
end
|
75
|
+
|
76
|
+
# Whitelist
|
77
|
+
def script_author_params
|
78
|
+
params.require(:script_author).permit(:author_first_name, :author_last_name, :author_website, :author_github)
|
79
|
+
end
|
80
|
+
|
81
|
+
end
|
82
|
+
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
require_dependency "phcdevworks_scripts/application_controller"
|
2
|
+
|
3
|
+
module PhcdevworksScripts
|
4
|
+
class Script::ExtensionsController < ApplicationController
|
5
|
+
|
6
|
+
# Filters & Security
|
7
|
+
#include PhcdevworksCore::PhcpluginsHelper
|
8
|
+
before_action :authenticate_user!
|
9
|
+
before_action :set_paper_trail_whodunnit
|
10
|
+
before_action :set_script_extension, only: [:show, :edit, :update, :destroy]
|
11
|
+
|
12
|
+
# GET /script/extensions
|
13
|
+
def index
|
14
|
+
@script_extensions = Script::Extension.all
|
15
|
+
end
|
16
|
+
|
17
|
+
# GET /script/extensions/1
|
18
|
+
def show
|
19
|
+
@script_extensions = Script::Extension.friendly.find(params[:id])
|
20
|
+
@versions = PhcdevworksScripts::ExtensionVersions.where(item_id: params[:id], item_type: 'PhcdevworksScripts::Script::Extension')
|
21
|
+
end
|
22
|
+
|
23
|
+
# GET /script/extensions/new
|
24
|
+
def new
|
25
|
+
@script_extension = Script::Extension.new
|
26
|
+
end
|
27
|
+
|
28
|
+
# GET /script/extensions/1/edit
|
29
|
+
def edit
|
30
|
+
end
|
31
|
+
|
32
|
+
# POST /script/extensions
|
33
|
+
def create
|
34
|
+
@script_extension = Script::Extension.new(script_extension_params)
|
35
|
+
@script_extension.user_id = current_user.id
|
36
|
+
respond_to do |format|
|
37
|
+
if @script_extension.save
|
38
|
+
format.html { redirect_to script_extensions_path, :flash => { :success => 'Script Extension has been Added.' }}
|
39
|
+
format.json { render :show, status: :created, location: @script_extension }
|
40
|
+
else
|
41
|
+
format.html { render :new }
|
42
|
+
format.json { render json: @script_extension.errors, status: :unprocessable_entity }
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
# PATCH/PUT /script/extensions/1
|
48
|
+
def update
|
49
|
+
respond_to do |format|
|
50
|
+
if @script_extension.update(script_extension_params)
|
51
|
+
format.html { redirect_to script_extensions_path, :flash => { :notice => 'Script Extension Name has been Updated.' }}
|
52
|
+
format.json { render :show, status: :ok, location: @script_extension }
|
53
|
+
else
|
54
|
+
format.html { render :edit }
|
55
|
+
format.json { render json: @script_extension.errors, status: :unprocessable_entity }
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
# DELETE /script/extensions/1
|
61
|
+
def destroy
|
62
|
+
@script_extension.destroy
|
63
|
+
respond_to do |format|
|
64
|
+
format.html { redirect_to script_extensions_path, :flash => { :error => 'Script Extension and Connections have all been Removed.' }}
|
65
|
+
format.json { head :no_content }
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
private
|
70
|
+
|
71
|
+
# Callback
|
72
|
+
def set_script_extension
|
73
|
+
@script_extension = Script::Extension.friendly.find(params[:id])
|
74
|
+
end
|
75
|
+
|
76
|
+
# Whitelist
|
77
|
+
def script_extension_params
|
78
|
+
params.require(:script_extension).permit(:script_extension_name, :script_extension_description, :script_extension)
|
79
|
+
end
|
80
|
+
|
81
|
+
end
|
82
|
+
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
require_dependency "phcdevworks_scripts/application_controller"
|
2
|
+
|
3
|
+
module PhcdevworksScripts
|
4
|
+
class Script::ListingsController < ApplicationController
|
5
|
+
|
6
|
+
# Filters & Security
|
7
|
+
#include PhcdevworksCore::PhcpluginsHelper
|
8
|
+
before_action :authenticate_user!
|
9
|
+
before_action :set_paper_trail_whodunnit
|
10
|
+
before_action :set_script_listing, only: [:show, :edit, :update, :destroy]
|
11
|
+
|
12
|
+
# GET /script/listings
|
13
|
+
def index
|
14
|
+
@script_listings = Script::Listing.all
|
15
|
+
end
|
16
|
+
|
17
|
+
# GET /script/listings/1
|
18
|
+
def show
|
19
|
+
@script_listings = Script::Listing.friendly.find(params[:id])
|
20
|
+
@versions = PhcdevworksScripts::ListingVersions.where(item_id: params[:id], item_type: 'PhcdevworksScripts::Script_::Listing')
|
21
|
+
end
|
22
|
+
|
23
|
+
# GET /script/listings/new
|
24
|
+
def new
|
25
|
+
@script_listing = Script::Listing.new
|
26
|
+
end
|
27
|
+
|
28
|
+
# GET /script/listings/1/edit
|
29
|
+
def edit
|
30
|
+
end
|
31
|
+
|
32
|
+
# POST /script/listings
|
33
|
+
def create
|
34
|
+
@script_listing = Script::Listing.new(script_listing_params)
|
35
|
+
@script_listing.user_id = current_user.id
|
36
|
+
respond_to do |format|
|
37
|
+
if @script_listing.save
|
38
|
+
format.html { redirect_to script_listings_path, :flash => { :success => 'Script Listing has been Added.' }}
|
39
|
+
format.json { render :show, status: :created, location: @script_listing }
|
40
|
+
else
|
41
|
+
format.html { render :new }
|
42
|
+
format.json { render json: @script_listing.errors, status: :unprocessable_entity }
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
# PATCH/PUT /script/listings/1
|
48
|
+
def update
|
49
|
+
respond_to do |format|
|
50
|
+
if @script_listing.update(script_listing_params)
|
51
|
+
format.html { redirect_to script_listings_path, :flash => { :notice => 'Script Listing has been Updated.' }}
|
52
|
+
format.json { render :show, status: :ok, location: @script_listing }
|
53
|
+
else
|
54
|
+
format.html { render :edit }
|
55
|
+
format.json { render json: @script_listing.errors, status: :unprocessable_entity }
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
# DELETE /script/listings/1
|
61
|
+
def destroy
|
62
|
+
@script_listing.destroy
|
63
|
+
respond_to do |format|
|
64
|
+
format.html { redirect_to script_listings_path, :flash => { :error => 'Script Listing and Connections have all been Removed.' }}
|
65
|
+
format.json { head :no_content }
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
private
|
70
|
+
|
71
|
+
# Callback
|
72
|
+
def set_script_listing
|
73
|
+
@script_listing = Script::Listing.friendly.find(params[:id])
|
74
|
+
end
|
75
|
+
|
76
|
+
# Whitelist
|
77
|
+
def script_listing_params
|
78
|
+
params.require(:script_listing).permit(:listing_title, :listing_description, :listing_script_source, :listing_script_website, :listing_script_repo, :listing_script_initial_release, :listing_script_lastest_release, :listing_script_beta_release, :listing_script_lastest_release_cdn, :listing_script_status, :author_id)
|
79
|
+
end
|
80
|
+
|
81
|
+
end
|
82
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
require_dependency "phcdevworks_scripts/application_controller"
|
2
|
+
|
3
|
+
module PhcdevworksScripts
|
4
|
+
class Script::UrlsController < ApplicationController
|
5
|
+
|
6
|
+
# Filters & Security
|
7
|
+
#include PhcdevworksCore::PhcpluginsHelper
|
8
|
+
before_action :authenticate_user!
|
9
|
+
before_action :set_paper_trail_whodunnit
|
10
|
+
before_action :set_script_url, only: [:show, :edit, :update, :destroy]
|
11
|
+
|
12
|
+
# INDEX
|
13
|
+
def index
|
14
|
+
@script_urls = script_listing.urls
|
15
|
+
end
|
16
|
+
|
17
|
+
# SHOW
|
18
|
+
def show
|
19
|
+
@script_url = script_listing.urls.find(params[:id])
|
20
|
+
end
|
21
|
+
|
22
|
+
# NEW
|
23
|
+
def new
|
24
|
+
@script_url = script_listing.urls.build
|
25
|
+
end
|
26
|
+
|
27
|
+
# EDIT
|
28
|
+
def edit
|
29
|
+
@script_url = script_listing.urls.find(params[:id])
|
30
|
+
end
|
31
|
+
|
32
|
+
# CREATE
|
33
|
+
def create
|
34
|
+
@script_url = script_listing.urls.create(script_url_params)
|
35
|
+
@script_url.user_id = current_user.id
|
36
|
+
if @script_url.save
|
37
|
+
redirect_to script_listing_urls_path, :flash => { :success => 'Author was successfully created.' }
|
38
|
+
else
|
39
|
+
render :new
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
# UPDATE
|
44
|
+
def update
|
45
|
+
@script_listing = Script::Listing.friendly.find(params[:listing_id])
|
46
|
+
if @script_url.update(script_url_params)
|
47
|
+
redirect_to script_listing_urls_path, :flash => { :success => 'Author was successfully updated.' }
|
48
|
+
else
|
49
|
+
render :edit
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
# DELETE
|
54
|
+
def destroy
|
55
|
+
@script_url = script_listing.urls.find(params[:id])
|
56
|
+
@script_url.destroy
|
57
|
+
redirect_to script_listing_urls_path, :flash => { :error => 'Author was successfully destroyed.' }
|
58
|
+
end
|
59
|
+
|
60
|
+
private
|
61
|
+
|
62
|
+
# Callback
|
63
|
+
def set_script_url
|
64
|
+
@script_url = Script::Url.find(params[:id])
|
65
|
+
end
|
66
|
+
|
67
|
+
def script_listing
|
68
|
+
@script_listing = Script::Listing.friendly.find(params[:listing_id])
|
69
|
+
end
|
70
|
+
|
71
|
+
# Whitelist
|
72
|
+
def script_url_params
|
73
|
+
params.require(:script_url).permit(:script_cdn_url, :script_cdn_url_release, :script_cdn_url_cdn_update, :version_id, :extension_id)
|
74
|
+
end
|
75
|
+
|
76
|
+
end
|
77
|
+
end
|