phcscriptcdn 48.0.0 → 49.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +0 -2
- data/app/assets/javascripts/phcscriptcdn/application.js +2 -2
- data/app/assets/stylesheets/phcscriptcdn/application.scss +2 -2
- data/app/controllers/phcscriptcdn/application_controller.rb +20 -10
- data/app/controllers/phcscriptcdn/script/authors_controller.rb +19 -8
- data/app/controllers/phcscriptcdn/script/extensions_controller.rb +17 -6
- data/app/controllers/phcscriptcdn/script/licences_controller.rb +16 -5
- data/app/controllers/phcscriptcdn/script/listings_controller.rb +15 -6
- data/app/controllers/phcscriptcdn/script/urls_controller.rb +13 -4
- data/app/controllers/phcscriptcdn/script/versions_controller.rb +15 -4
- data/app/helpers/phcscriptcdn/application_helper.rb +0 -10
- data/app/helpers/phcscriptcdn/script/authors_helper.rb +4 -0
- data/app/helpers/phcscriptcdn/script/extensions_helper.rb +4 -0
- data/app/helpers/phcscriptcdn/script/licences_helper.rb +4 -0
- data/app/helpers/phcscriptcdn/script/listings_helper.rb +4 -0
- data/app/helpers/phcscriptcdn/script/urls_helper.rb +4 -0
- data/app/helpers/phcscriptcdn/script/versions_helper.rb +4 -0
- data/app/jobs/phcscriptcdn/application_job.rb +2 -2
- data/app/mailers/phcscriptcdn/application_mailer.rb +6 -0
- data/app/models/phcscriptcdn/application_record.rb +5 -3
- data/app/models/phcscriptcdn/script.rb +7 -5
- data/app/models/phcscriptcdn/script/author.rb +0 -7
- data/app/models/phcscriptcdn/script/listing.rb +3 -13
- data/app/models/phcscriptcdn/script/url.rb +2 -2
- data/app/models/phcscriptcdn/script/version.rb +1 -1
- data/app/views/layouts/phcscriptcdn/application.html.erb +64 -41
- data/app/views/layouts/phcscriptcdn/components/backend/footer/_footer.html.erb +9 -4
- data/app/views/layouts/phcscriptcdn/components/backend/navigation/_top_menu.html.erb +78 -0
- data/app/views/layouts/phcscriptcdn/components/backend/sidebars/_side_menu.html.erb +154 -0
- data/app/views/phcscriptcdn/script/authors/_form.html.erb +15 -20
- data/app/views/phcscriptcdn/script/authors/edit.html.erb +32 -32
- data/app/views/phcscriptcdn/script/authors/index.html.erb +50 -60
- data/app/views/phcscriptcdn/script/authors/new.html.erb +33 -32
- data/app/views/phcscriptcdn/script/authors/show.html.erb +42 -32
- data/app/views/phcscriptcdn/script/extensions/_form.html.erb +13 -14
- data/app/views/phcscriptcdn/script/extensions/edit.html.erb +32 -31
- data/app/views/phcscriptcdn/script/extensions/index.html.erb +45 -52
- data/app/views/phcscriptcdn/script/extensions/new.html.erb +31 -30
- data/app/views/phcscriptcdn/script/extensions/show.html.erb +41 -31
- data/app/views/phcscriptcdn/script/licences/_form.html.erb +21 -21
- data/app/views/phcscriptcdn/script/licences/edit.html.erb +31 -31
- data/app/views/phcscriptcdn/script/licences/index.html.erb +55 -62
- data/app/views/phcscriptcdn/script/licences/new.html.erb +31 -31
- data/app/views/phcscriptcdn/script/licences/show.html.erb +41 -31
- data/app/views/phcscriptcdn/script/listings/_form.html.erb +27 -28
- data/app/views/phcscriptcdn/script/listings/edit.html.erb +29 -30
- data/app/views/phcscriptcdn/script/listings/index.html.erb +45 -54
- data/app/views/phcscriptcdn/script/listings/new.html.erb +28 -30
- data/app/views/phcscriptcdn/script/listings/show.html.erb +38 -28
- data/app/views/phcscriptcdn/script/urls/_form.html.erb +13 -14
- data/app/views/phcscriptcdn/script/urls/edit.html.erb +17 -30
- data/app/views/phcscriptcdn/script/urls/index.html.erb +47 -54
- data/app/views/phcscriptcdn/script/urls/new.html.erb +31 -31
- data/app/views/phcscriptcdn/script/urls/show.html.erb +41 -30
- data/app/views/phcscriptcdn/script/versions/_form.html.erb +9 -10
- data/app/views/phcscriptcdn/script/versions/edit.html.erb +31 -31
- data/app/views/phcscriptcdn/script/versions/index.html.erb +43 -50
- data/app/views/phcscriptcdn/script/versions/new.html.erb +31 -31
- data/app/views/phcscriptcdn/script/versions/show.html.erb +41 -31
- data/config/routes.rb +19 -22
- data/db/migrate/{20160731205917_create_phcscriptcdn_script_listings.rb → 20160821183652_create_phcscriptcdn_script_listings.rb} +5 -6
- data/db/migrate/{20160731210723_create_phcscriptcdn_script_authors.rb → 20160821183714_create_phcscriptcdn_script_authors.rb} +1 -2
- data/db/migrate/{20160731205205_create_phcscriptcdn_script_extensions.rb → 20160821183735_create_phcscriptcdn_script_extensions.rb} +1 -1
- data/db/migrate/{20160801032225_create_phcscriptcdn_script_licences.rb → 20160821183805_create_phcscriptcdn_script_licences.rb} +1 -1
- data/db/migrate/{20160731210626_create_phcscriptcdn_script_urls.rb → 20160821183830_create_phcscriptcdn_script_urls.rb} +5 -5
- data/db/migrate/{20160731205954_create_phcscriptcdn_script_versions.rb → 20160821183946_create_phcscriptcdn_script_versions.rb} +1 -1
- data/db/migrate/20170517064049_create_phcscriptcdn_listing_versions.rb +1 -0
- data/db/migrate/20170517064114_create_phcscriptcdn_scriptversion_versions.rb +1 -0
- data/db/migrate/20170517064150_create_phcscriptcdn_url_versions.rb +17 -16
- data/db/migrate/20170517064208_create_phcscriptcdn_author_versions.rb +1 -0
- data/db/migrate/20170517064427_create_phcscriptcdn_licence_versions.rb +1 -0
- data/lib/phcscriptcdn/engine.rb +6 -1
- data/lib/phcscriptcdn/version.rb +1 -1
- metadata +100 -116
- data/app/assets/javascripts/phcscriptcdn/frontend/listings.js +0 -2
- data/app/assets/stylesheets/phcscriptcdn/frontend/listings.scss +0 -3
- data/app/controllers/phcscriptcdn/frontend/listings_controller.rb +0 -20
- data/app/helpers/phcscriptcdn/frontend/listings_helper.rb +0 -4
- data/app/models/phcscriptcdn/frontend/listing.rb +0 -8
- data/app/views/layouts/phcscriptcdn/components/backend/navigation/_navigation.html.erb +0 -56
- data/app/views/layouts/phcscriptcdn/components/backend/topbar/_topbar.html.erb +0 -5
- data/app/views/layouts/phcscriptcdn/components/backend/topbar/_topbar_links.html.erb +0 -0
- data/app/views/layouts/phcscriptcdn/frontend.html.erb +0 -22
- data/app/views/phcscriptcdn/frontend/listings/index.html.erb +0 -46
- data/app/views/phcscriptcdn/frontend/listings/show.html.erb +0 -59
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 544e9ea892cf2ef14ea1f76468ab26ef0cbc1a079a861938eb02bf2e1929703e
|
4
|
+
data.tar.gz: 244aa5773babb504ca06cd021b099f433145ed1e6a0517aa80c8d97b9f70c105
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 506b7f7513c1affee5923575a1638a74659a125e72391e96d86284c65fdbaa3b94b05eea640d1c2ff0d26bdbede20a7717d98e100a5f920aaa633576e9dcfcc6
|
7
|
+
data.tar.gz: b610b14f4f130654ed6c6b457374a71a19a18856d458fa01c783bafcc445e577d206598f35c9a4dea78390700d5bb54a15094b3fcd9e62f02ee0c1b6b1d61510
|
data/README.md
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
// Load
|
2
|
-
//= require
|
1
|
+
// Load Admin Theme
|
2
|
+
//= require phc_admin_theme_scripts_four
|
@@ -1,2 +1,2 @@
|
|
1
|
-
// Load
|
2
|
-
@import "
|
1
|
+
// Load Admin Theme
|
2
|
+
@import "phc_admin_theme_styles_four";
|
@@ -1,12 +1,22 @@
|
|
1
1
|
module Phcscriptcdn
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
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
|
12
22
|
end
|
@@ -3,21 +3,28 @@ require_dependency "phcscriptcdn/application_controller"
|
|
3
3
|
module Phcscriptcdn
|
4
4
|
class Script::AuthorsController < ApplicationController
|
5
5
|
|
6
|
-
#
|
6
|
+
# Include Core Helpers, Security & Action Filters
|
7
|
+
include Phccorehelpers::PhcpluginsproHelper
|
8
|
+
before_action :authenticate_user!
|
9
|
+
before_action :set_paper_trail_whodunnit
|
7
10
|
before_action :set_script_author, only: [:show, :edit, :update, :destroy]
|
8
11
|
|
9
12
|
# INDEX - Script Author
|
10
13
|
def index
|
11
|
-
@script_authors = Script::Author.
|
14
|
+
@script_authors = Script::Author.where(org_id: current_user.org_id)
|
12
15
|
end
|
13
16
|
|
14
17
|
# DETAILS - Script Author
|
15
18
|
def show
|
19
|
+
@script_authors = Script::Author.friendly.find(params[:id])
|
20
|
+
@versions = Phcscriptcdn::AuthorVersions.where(item_id: params[:id], item_type: 'Phcscriptcdn::Script::Author')
|
16
21
|
end
|
17
22
|
|
18
23
|
# NEW - Script Author
|
19
24
|
def new
|
20
25
|
@script_author = Script::Author.new
|
26
|
+
@script_author.user_id = current_user.id
|
27
|
+
@script_author.org_id = current_user.org_id
|
21
28
|
end
|
22
29
|
|
23
30
|
# EDIT - Script Author
|
@@ -27,19 +34,23 @@ module Phcscriptcdn
|
|
27
34
|
# CREATE - Script Author
|
28
35
|
def create
|
29
36
|
@script_author = Script::Author.new(script_author_params)
|
37
|
+
@script_author.user_id = current_user.id
|
38
|
+
@script_author.org_id = current_user.org_id
|
30
39
|
if @script_author.save
|
31
40
|
redirect_to script_authors_url, notice: 'Author was successfully created.'
|
32
41
|
else
|
33
|
-
|
42
|
+
render :new
|
34
43
|
end
|
35
44
|
end
|
36
45
|
|
37
46
|
# PATCH/PUT - Script Author
|
38
47
|
def update
|
48
|
+
@script_author.user_id = current_user.id
|
49
|
+
@script_author.org_id = current_user.org_id
|
39
50
|
if @script_author.update(script_author_params)
|
40
|
-
|
41
|
-
|
42
|
-
|
51
|
+
redirect_to script_authors_url, notice: 'Author was successfully updated.'
|
52
|
+
else
|
53
|
+
render :edit
|
43
54
|
end
|
44
55
|
end
|
45
56
|
|
@@ -53,12 +64,12 @@ module Phcscriptcdn
|
|
53
64
|
|
54
65
|
# Common Callbacks
|
55
66
|
def set_script_author
|
56
|
-
@script_author = Script::Author.find(params[:id])
|
67
|
+
@script_author = Script::Author.friendly.find(params[:id])
|
57
68
|
end
|
58
69
|
|
59
70
|
# Whitelist
|
60
71
|
def script_author_params
|
61
|
-
params.require(:script_author).permit(:authorfirstname, :authorlastname, :authorwebsite, :authorgithub, :
|
72
|
+
params.require(:script_author).permit(:authorfirstname, :authorlastname, :authorwebsite, :authorgithub, :slug, :user_id, :org_id, :listing_id)
|
62
73
|
end
|
63
74
|
|
64
75
|
end
|
@@ -3,21 +3,28 @@ require_dependency "phcscriptcdn/application_controller"
|
|
3
3
|
module Phcscriptcdn
|
4
4
|
class Script::ExtensionsController < ApplicationController
|
5
5
|
|
6
|
-
#
|
6
|
+
# Include Core Helpers, Security & Action Filters
|
7
|
+
include Phccorehelpers::PhcpluginsproHelper
|
8
|
+
before_action :authenticate_user!
|
9
|
+
before_action :set_paper_trail_whodunnit
|
7
10
|
before_action :set_script_extension, only: [:show, :edit, :update, :destroy]
|
8
11
|
|
9
12
|
# INDEX - Script Extension
|
10
13
|
def index
|
11
|
-
@script_extensions = Script::Extension.
|
14
|
+
@script_extensions = Script::Extension.where(org_id: current_user.org_id)
|
12
15
|
end
|
13
16
|
|
14
17
|
# DETAILS - Script Extension
|
15
18
|
def show
|
19
|
+
@script_extensions = Script::Extension.friendly.find(params[:id])
|
20
|
+
@versions = Phcscriptcdn::ExtensionVersions.where(item_id: params[:id], item_type: 'Phcscriptcdn::Script::Extension')
|
16
21
|
end
|
17
22
|
|
18
23
|
# NEW - Script Extension
|
19
24
|
def new
|
20
25
|
@script_extension = Script::Extension.new
|
26
|
+
@script_extension.user_id = current_user.id
|
27
|
+
@script_extension.org_id = current_user.org_id
|
21
28
|
end
|
22
29
|
|
23
30
|
# EDIT - Script Extension
|
@@ -27,15 +34,19 @@ module Phcscriptcdn
|
|
27
34
|
# CREATE - Script Extension
|
28
35
|
def create
|
29
36
|
@script_extension = Script::Extension.new(script_extension_params)
|
37
|
+
@script_extension.user_id = current_user.id
|
38
|
+
@script_extension.org_id = current_user.org_id
|
30
39
|
if @script_extension.save
|
31
40
|
redirect_to script_extensions_url, notice: 'Extension was successfully created.'
|
32
41
|
else
|
33
|
-
|
42
|
+
render :new
|
34
43
|
end
|
35
44
|
end
|
36
45
|
|
37
46
|
# PATCH/PUT - Script Extension
|
38
47
|
def update
|
48
|
+
@script_extension.user_id = current_user.id
|
49
|
+
@script_extension.org_id = current_user.org_id
|
39
50
|
if @script_extension.update(script_extension_params)
|
40
51
|
redirect_to script_extensions_url, notice: 'Extension was successfully updated.'
|
41
52
|
else
|
@@ -45,7 +56,7 @@ module Phcscriptcdn
|
|
45
56
|
|
46
57
|
# DELETE - Script Extension
|
47
58
|
def destroy
|
48
|
-
|
59
|
+
@script_extension.destroy
|
49
60
|
redirect_to script_extensions_url, notice: 'Extension was successfully destroyed.'
|
50
61
|
end
|
51
62
|
|
@@ -53,12 +64,12 @@ module Phcscriptcdn
|
|
53
64
|
|
54
65
|
# Common Callbacks
|
55
66
|
def set_script_extension
|
56
|
-
@script_extension = Script::Extension.find(params[:id])
|
67
|
+
@script_extension = Script::Extension.friendly.find(params[:id])
|
57
68
|
end
|
58
69
|
|
59
70
|
# Whitelists
|
60
71
|
def script_extension_params
|
61
|
-
params.require(:script_extension).permit(:scriptextensionname, :scriptextensiondes, :scriptextension, :slug, :user_id, :
|
72
|
+
params.require(:script_extension).permit(:scriptextensionname, :scriptextensiondes, :scriptextension, :slug, :user_id, :org_id, :listing_id)
|
62
73
|
end
|
63
74
|
|
64
75
|
end
|
@@ -3,21 +3,28 @@ require_dependency "phcscriptcdn/application_controller"
|
|
3
3
|
module Phcscriptcdn
|
4
4
|
class Script::LicencesController < ApplicationController
|
5
5
|
|
6
|
-
#
|
6
|
+
# Include Core Helpers, Security & Action Filters
|
7
|
+
include Phccorehelpers::PhcpluginsproHelper
|
8
|
+
before_action :authenticate_user!
|
9
|
+
before_action :set_paper_trail_whodunnit
|
7
10
|
before_action :set_script_licence, only: [:show, :edit, :update, :destroy]
|
8
11
|
|
9
12
|
# INDEX - Script Licences
|
10
13
|
def index
|
11
|
-
@script_licences = Script::Licence.
|
14
|
+
@script_licences = Script::Licence.where(org_id: current_user.org_id)
|
12
15
|
end
|
13
16
|
|
14
17
|
# DETAILS - Script Licences
|
15
18
|
def show
|
19
|
+
@script_licences = Script::Licence.friendly.find(params[:id])
|
20
|
+
@versions = Phcscriptcdn::LicenceVersions.where(item_id: params[:id], item_type: 'Phcscriptcdn::Script::Licence')
|
16
21
|
end
|
17
22
|
|
18
23
|
# NEW - Script Licences
|
19
24
|
def new
|
20
25
|
@script_licence = Script::Licence.new
|
26
|
+
@script_licence.user_id = current_user.id
|
27
|
+
@script_licence.org_id = current_user.org_id
|
21
28
|
end
|
22
29
|
|
23
30
|
# EDIT - Script Licences
|
@@ -27,15 +34,19 @@ module Phcscriptcdn
|
|
27
34
|
# POST - Script Licences
|
28
35
|
def create
|
29
36
|
@script_licence = Script::Licence.new(script_licence_params)
|
37
|
+
@script_licence.user_id = current_user.id
|
38
|
+
@script_licence.org_id = current_user.org_id
|
30
39
|
if @script_licence.save
|
31
40
|
redirect_to script_licences_url, notice: 'Licence was successfully created.'
|
32
41
|
else
|
33
|
-
|
42
|
+
render :new
|
34
43
|
end
|
35
44
|
end
|
36
45
|
|
37
46
|
# PATCH/PUT - Script Licences
|
38
47
|
def update
|
48
|
+
@script_licence.user_id = current_user.id
|
49
|
+
@script_licence.org_id = current_user.org_id
|
39
50
|
if @script_licence.update(script_licence_params)
|
40
51
|
redirect_to script_licences_url, notice: 'Licence was successfully updated.'
|
41
52
|
else
|
@@ -53,12 +64,12 @@ module Phcscriptcdn
|
|
53
64
|
|
54
65
|
# Common Callbacks
|
55
66
|
def set_script_licence
|
56
|
-
@script_licence = Script::Licence.find(params[:id])
|
67
|
+
@script_licence = Script::Licence.friendly.find(params[:id])
|
57
68
|
end
|
58
69
|
|
59
70
|
# Whitelists
|
60
71
|
def script_licence_params
|
61
|
-
params.require(:script_licence).permit(:lcncname, :lcncdescription, :lcncdescript, :lcnccomgpl, :lcncarvlfsf, :lcncarvlosi, :lcncarvlcopyfree, :lcncarvldebian, :lcncarvlfedora, :slug, :user_id, :
|
72
|
+
params.require(:script_licence).permit(:lcncname, :lcncdescription, :lcncdescript, :lcnccomgpl, :lcncarvlfsf, :lcncarvlosi, :lcncarvlcopyfree, :lcncarvldebian, :lcncarvlfedora, :slug, :user_id, :org_id, :listing_id)
|
62
73
|
end
|
63
74
|
|
64
75
|
end
|
@@ -3,16 +3,21 @@ require_dependency "phcscriptcdn/application_controller"
|
|
3
3
|
module Phcscriptcdn
|
4
4
|
class Script::ListingsController < ApplicationController
|
5
5
|
|
6
|
-
#
|
6
|
+
# Include Core Helpers, Security & Action Filters
|
7
|
+
include Phccorehelpers::PhcpluginsproHelper
|
8
|
+
before_action :authenticate_user!
|
9
|
+
before_action :set_paper_trail_whodunnit
|
7
10
|
before_action :set_script_listing, only: [:show, :edit, :update, :destroy]
|
8
11
|
|
9
12
|
# INDEX - Script Listings
|
10
13
|
def index
|
11
|
-
@script_listings = Script::Listing.
|
14
|
+
@script_listings = Script::Listing.where(org_id: current_user.org_id)
|
12
15
|
end
|
13
16
|
|
14
17
|
# DETAILS - Script Listings
|
15
18
|
def show
|
19
|
+
@script_listings = Script::Listing.friendly.find(params[:id])
|
20
|
+
@versions = Phcscriptcdn::ListingVersions.where(item_id: params[:id], item_type: 'Phcscriptcdn::Script::Listing')
|
16
21
|
end
|
17
22
|
|
18
23
|
# NEW - Script Listings
|
@@ -27,6 +32,8 @@ module Phcscriptcdn
|
|
27
32
|
# POST - Script Listings
|
28
33
|
def create
|
29
34
|
@script_listing = Script::Listing.new(script_listing_params)
|
35
|
+
@script_listing.user_id = current_user.id
|
36
|
+
@script_listing.org_id = current_user.org_id
|
30
37
|
if @script_listing.save
|
31
38
|
redirect_to script_listings_path, notice: 'Listing was successfully created.'
|
32
39
|
else
|
@@ -36,10 +43,12 @@ module Phcscriptcdn
|
|
36
43
|
|
37
44
|
# PATCH/PUT - Script Listings
|
38
45
|
def update
|
46
|
+
@script_listing.user_id = current_user.id
|
47
|
+
@script_listing.org_id = current_user.org_id
|
39
48
|
if @script_listing.update(script_listing_params)
|
40
49
|
redirect_to script_listings_path, notice: 'Listing was successfully updated.'
|
41
|
-
|
42
|
-
|
50
|
+
else
|
51
|
+
render :edit
|
43
52
|
end
|
44
53
|
end
|
45
54
|
|
@@ -53,12 +62,12 @@ module Phcscriptcdn
|
|
53
62
|
|
54
63
|
# Common Callbacks
|
55
64
|
def set_script_listing
|
56
|
-
@script_listing = Script::Listing.find(params[:id])
|
65
|
+
@script_listing = Script::Listing.friendly.find(params[:id])
|
57
66
|
end
|
58
67
|
|
59
68
|
# Whitelist
|
60
69
|
def script_listing_params
|
61
|
-
params.require(:script_listing).permit(:scripttitle, :scriptdescription, :descriptionsource, :scriptwebsite, :
|
70
|
+
params.require(:script_listing).permit(:scripttitle, :scriptdescription, :descriptionsource, :scriptwebsite, :scriptgithub, :scriptinitialrelease, :scriptlastestrelease, :scriptbetarelease, :scriptlastestreleasecdn, :scriptstatus, :slug, :user_id, :org_id, :version_id, :author_id, :licence_id)
|
62
71
|
end
|
63
72
|
|
64
73
|
end
|
@@ -3,7 +3,10 @@ require_dependency "phcscriptcdn/application_controller"
|
|
3
3
|
module Phcscriptcdn
|
4
4
|
class Script::UrlsController < ApplicationController
|
5
5
|
|
6
|
-
#
|
6
|
+
# Include Core Helpers, Security & Action Filters
|
7
|
+
include Phccorehelpers::PhcpluginsproHelper
|
8
|
+
before_action :authenticate_user!
|
9
|
+
before_action :set_paper_trail_whodunnit
|
7
10
|
before_action :set_script_url, only: [:show, :edit, :update, :destroy]
|
8
11
|
|
9
12
|
# INDEX - Script Authors
|
@@ -15,13 +18,15 @@ module Phcscriptcdn
|
|
15
18
|
# DETAILED PROFILE - Script Authors
|
16
19
|
def show
|
17
20
|
script_listing = Script::Listing.find(params[:listing_id])
|
18
|
-
@script_url = script_listing.urls.find(params[:id])
|
21
|
+
@script_url = script_listing.urls.friendly.find(params[:id])
|
19
22
|
end
|
20
23
|
|
21
24
|
# NEW - Script Athors
|
22
25
|
def new
|
23
26
|
script_listing = Script::Listing.find(params[:listing_id])
|
24
27
|
@script_url = script_listing.urls.build
|
28
|
+
@script_url.user_id = current_user.id
|
29
|
+
@script_url.org_id = current_user.org_id
|
25
30
|
end
|
26
31
|
|
27
32
|
# EDIT - Script Athors
|
@@ -34,6 +39,8 @@ module Phcscriptcdn
|
|
34
39
|
def create
|
35
40
|
@script_listing = Script::Listing.find(params[:listing_id])
|
36
41
|
@script_url = @script_listing.urls.create(script_url_params)
|
42
|
+
@script_url.user_id = current_user.id
|
43
|
+
@script_url.org_id = current_user.org_id
|
37
44
|
if @script_url.save
|
38
45
|
redirect_to script_listing_urls_path, notice: 'Author was successfully created.'
|
39
46
|
else
|
@@ -43,6 +50,8 @@ module Phcscriptcdn
|
|
43
50
|
|
44
51
|
# PATCH/PUT - Script Athors
|
45
52
|
def update
|
53
|
+
@script_url.user_id = current_user.id
|
54
|
+
@script_url.org_id = current_user.org_id
|
46
55
|
if @script_url.update(script_url_params)
|
47
56
|
redirect_to script_listing_urls_path, notice: 'Author was successfully updated.'
|
48
57
|
else
|
@@ -62,12 +71,12 @@ module Phcscriptcdn
|
|
62
71
|
|
63
72
|
# Common Callbacks
|
64
73
|
def set_script_url
|
65
|
-
@script_url = Script::Url.find(params[:id])
|
74
|
+
@script_url = Script::Url.friendly.find(params[:id])
|
66
75
|
end
|
67
76
|
|
68
77
|
# Whitelists
|
69
78
|
def script_url_params
|
70
|
-
params.require(:script_url).permit(:scripturl, :scripturlrelease, :scripturlcdnupdate, :slug, :user_id, :
|
79
|
+
params.require(:script_url).permit(:scripturl, :scripturlrelease, :scripturlcdnupdate, :slug, :user_id, :org_id, :listing_id, :version_id, :extension_id)
|
71
80
|
end
|
72
81
|
|
73
82
|
end
|
@@ -3,21 +3,28 @@ require_dependency "phcscriptcdn/application_controller"
|
|
3
3
|
module Phcscriptcdn
|
4
4
|
class Script::VersionsController < ApplicationController
|
5
5
|
|
6
|
-
#
|
6
|
+
# Include Core Helpers, Security & Action Filters
|
7
|
+
include Phccorehelpers::PhcpluginsproHelper
|
8
|
+
before_action :authenticate_user!
|
9
|
+
before_action :set_paper_trail_whodunnit
|
7
10
|
before_action :set_script_version, only: [:show, :edit, :update, :destroy]
|
8
11
|
|
9
12
|
# INDEX - Script Versions
|
10
13
|
def index
|
11
|
-
|
14
|
+
@script_versions = Script::Version.where(org_id: current_user.org_id)
|
12
15
|
end
|
13
16
|
|
14
17
|
# DETAILS - Script Versions
|
15
18
|
def show
|
19
|
+
@script_versions = Script::Version.friendly.find(params[:id])
|
20
|
+
@versions = Phcscriptcdn::ScriptversionVersions.where(item_id: params[:id], item_type: 'Phcscriptcdn::Script::Version')
|
16
21
|
end
|
17
22
|
|
18
23
|
# NEW - Script Versions
|
19
24
|
def new
|
20
25
|
@script_version = Script::Version.new
|
26
|
+
@script_version.user_id = current_user.id
|
27
|
+
@script_version.org_id = current_user.org_id
|
21
28
|
end
|
22
29
|
|
23
30
|
# EDIT - Script Versions
|
@@ -27,6 +34,8 @@ module Phcscriptcdn
|
|
27
34
|
# POST - Script Versions
|
28
35
|
def create
|
29
36
|
@script_version = Script::Version.new(script_version_params)
|
37
|
+
@script_version.user_id = current_user.id
|
38
|
+
@script_version.org_id = current_user.org_id
|
30
39
|
if @script_version.save
|
31
40
|
redirect_to script_versions_url, notice: 'Version was successfully created.'
|
32
41
|
else
|
@@ -36,6 +45,8 @@ module Phcscriptcdn
|
|
36
45
|
|
37
46
|
# PATCH/PUT - Script Versions
|
38
47
|
def update
|
48
|
+
@script_version.user_id = current_user.id
|
49
|
+
@script_version.org_id = current_user.org_id
|
39
50
|
if @script_version.update(script_version_params)
|
40
51
|
redirect_to script_versions_url, notice: 'Version was successfully updated.'
|
41
52
|
else
|
@@ -53,12 +64,12 @@ module Phcscriptcdn
|
|
53
64
|
|
54
65
|
# Common Callbacks
|
55
66
|
def set_script_version
|
56
|
-
@script_version = Script::Version.find(params[:id])
|
67
|
+
@script_version = Script::Version.friendly.find(params[:id])
|
57
68
|
end
|
58
69
|
|
59
70
|
# Only allow a trusted parameter "white list" through.
|
60
71
|
def script_version_params
|
61
|
-
params.require(:script_version).permit(:scriptversion, :slug, :user_id, :
|
72
|
+
params.require(:script_version).permit(:scriptversion, :slug, :user_id, :org_id, :listing_id)
|
62
73
|
end
|
63
74
|
|
64
75
|
end
|