phcscriptcdnpro 2.1.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/phcscriptcdnpro/application.js +2 -5
- data/app/assets/stylesheets/phcscriptcdnpro/application.scss +15 -20
- data/app/controllers/phcscriptcdnpro/application_controller.rb +1 -19
- data/app/controllers/phcscriptcdnpro/script/authors_controller.rb +74 -0
- data/app/controllers/phcscriptcdnpro/script/extensions_controller.rb +65 -0
- data/app/controllers/phcscriptcdnpro/script/licences_controller.rb +65 -0
- data/app/controllers/phcscriptcdnpro/script/listings_controller.rb +65 -0
- data/app/controllers/phcscriptcdnpro/script/urls_controller.rb +74 -0
- data/app/controllers/phcscriptcdnpro/script/versions_controller.rb +65 -0
- data/app/models/phcscriptcdnpro/application_record.rb +2 -0
- data/app/models/phcscriptcdnpro/{scriptcdn.rb → script.rb} +4 -2
- data/app/models/phcscriptcdnpro/script/author.rb +10 -0
- data/app/models/phcscriptcdnpro/script/extension.rb +8 -0
- data/app/models/phcscriptcdnpro/script/licence.rb +4 -0
- data/app/models/phcscriptcdnpro/script/listing.rb +17 -0
- data/app/models/phcscriptcdnpro/script/url.rb +16 -0
- data/app/models/phcscriptcdnpro/script/version.rb +13 -0
- data/app/views/phcscriptcdnpro/{scriptcdn → script}/authors/_form.html.erb +14 -11
- data/app/views/phcscriptcdnpro/script/authors/edit.html.erb +32 -0
- data/app/views/phcscriptcdnpro/script/authors/index.html.erb +55 -0
- data/app/views/phcscriptcdnpro/script/authors/new.html.erb +32 -0
- data/app/views/phcscriptcdnpro/script/authors/show.html.erb +4 -0
- data/app/views/phcscriptcdnpro/script/extensions/_form.html.erb +22 -0
- data/app/views/phcscriptcdnpro/script/extensions/edit.html.erb +32 -0
- data/app/views/phcscriptcdnpro/script/extensions/index.html.erb +49 -0
- data/app/views/phcscriptcdnpro/script/extensions/new.html.erb +32 -0
- data/app/views/phcscriptcdnpro/script/extensions/show.html.erb +4 -0
- data/app/views/phcscriptcdnpro/script/licences/_form.html.erb +42 -0
- data/app/views/phcscriptcdnpro/script/licences/edit.html.erb +32 -0
- data/app/views/phcscriptcdnpro/script/licences/index.html.erb +59 -0
- data/app/views/phcscriptcdnpro/script/licences/new.html.erb +32 -0
- data/app/views/phcscriptcdnpro/script/licences/show.html.erb +4 -0
- data/app/views/phcscriptcdnpro/{scriptcdn/informations → script/listings}/_form.html.erb +20 -10
- data/app/views/phcscriptcdnpro/script/listings/edit.html.erb +31 -0
- data/app/views/phcscriptcdnpro/script/listings/index.html.erb +54 -0
- data/app/views/phcscriptcdnpro/script/listings/new.html.erb +31 -0
- data/app/views/phcscriptcdnpro/script/listings/show.html.erb +27 -0
- data/app/views/phcscriptcdnpro/script/urls/_form.html.erb +32 -0
- data/app/views/phcscriptcdnpro/script/urls/edit.html.erb +32 -0
- data/app/views/phcscriptcdnpro/script/urls/index.html.erb +51 -0
- data/app/views/phcscriptcdnpro/script/urls/new.html.erb +32 -0
- data/app/views/phcscriptcdnpro/script/urls/show.html.erb +4 -0
- data/app/views/phcscriptcdnpro/script/versions/_form.html.erb +12 -0
- data/app/views/phcscriptcdnpro/script/versions/edit.html.erb +32 -0
- data/app/views/phcscriptcdnpro/script/versions/index.html.erb +47 -0
- data/app/views/phcscriptcdnpro/script/versions/new.html.erb +32 -0
- data/app/views/phcscriptcdnpro/script/versions/show.html.erb +4 -0
- data/config/routes.rb +14 -16
- data/db/migrate/{20160704185337_create_phcscriptcdnpro_scriptcdn_information.rb → 20160821183652_create_phcscriptcdnpro_script_listings.rb} +14 -8
- data/db/migrate/{20160704185254_create_phcscriptcdnpro_scriptcdn_authors.rb → 20160821183714_create_phcscriptcdnpro_script_authors.rb} +6 -6
- data/db/migrate/20160821183735_create_phcscriptcdnpro_script_extensions.rb +19 -0
- data/db/migrate/20160821183805_create_phcscriptcdnpro_script_licences.rb +25 -0
- data/db/migrate/20160821183830_create_phcscriptcdnpro_script_urls.rb +23 -0
- data/db/migrate/20160821183946_create_phcscriptcdnpro_script_versions.rb +17 -0
- data/lib/phcscriptcdnpro/engine.rb +2 -0
- data/lib/phcscriptcdnpro/version.rb +1 -1
- metadata +73 -84
- data/app/assets/javascripts/phcscriptcdnpro/api/mains.js +0 -2
- data/app/assets/javascripts/phcscriptcdnpro/cdnsite/cdnpages.js +0 -2
- data/app/assets/javascripts/phcscriptcdnpro/scriptcdn/authors.js +0 -2
- data/app/assets/javascripts/phcscriptcdnpro/scriptcdn/information.js +0 -2
- data/app/assets/javascripts/phcscriptcdnpro/scriptcdn/mains.js +0 -2
- data/app/assets/javascripts/phcscriptcdnpro/scriptcdn/urls.js +0 -2
- data/app/assets/javascripts/phcscriptcdnpro/scriptcdn/versions.js +0 -2
- data/app/assets/stylesheets/phcscriptcdnpro/api/mains.scss +0 -3
- data/app/assets/stylesheets/phcscriptcdnpro/cdnsite/cdnpages.scss +0 -3
- data/app/assets/stylesheets/phcscriptcdnpro/custom.scss +0 -0
- data/app/assets/stylesheets/phcscriptcdnpro/scriptcdn/authors.scss +0 -3
- data/app/assets/stylesheets/phcscriptcdnpro/scriptcdn/information.scss +0 -3
- data/app/assets/stylesheets/phcscriptcdnpro/scriptcdn/mains.scss +0 -3
- data/app/assets/stylesheets/phcscriptcdnpro/scriptcdn/urls.scss +0 -3
- data/app/assets/stylesheets/phcscriptcdnpro/scriptcdn/versions.scss +0 -3
- data/app/assets/stylesheets/scaffolds.scss +0 -89
- data/app/controllers/phcscriptcdnpro/api/mains_controller.rb +0 -17
- data/app/controllers/phcscriptcdnpro/scriptcdn/authors_controller.rb +0 -70
- data/app/controllers/phcscriptcdnpro/scriptcdn/informations_controller.rb +0 -70
- data/app/controllers/phcscriptcdnpro/scriptcdn/mains_controller.rb +0 -63
- data/app/controllers/phcscriptcdnpro/scriptcdn/urls_controller.rb +0 -70
- data/app/controllers/phcscriptcdnpro/scriptcdn/versions_controller.rb +0 -70
- data/app/helpers/phcscriptcdnpro/api/mains_helper.rb +0 -4
- data/app/helpers/phcscriptcdnpro/cdnsite/cdnpages_helper.rb +0 -4
- data/app/helpers/phcscriptcdnpro/scriptcdn/authors_helper.rb +0 -4
- data/app/helpers/phcscriptcdnpro/scriptcdn/information_helper.rb +0 -4
- data/app/helpers/phcscriptcdnpro/scriptcdn/mains_helper.rb +0 -4
- data/app/helpers/phcscriptcdnpro/scriptcdn/urls_helper.rb +0 -4
- data/app/helpers/phcscriptcdnpro/scriptcdn/versions_helper.rb +0 -4
- data/app/models/phcscriptcdnpro/scriptcdn/author.rb +0 -8
- data/app/models/phcscriptcdnpro/scriptcdn/information.rb +0 -8
- data/app/models/phcscriptcdnpro/scriptcdn/main.rb +0 -11
- data/app/models/phcscriptcdnpro/scriptcdn/url.rb +0 -8
- data/app/models/phcscriptcdnpro/scriptcdn/version.rb +0 -8
- data/app/views/phcscriptcdnpro/api/mains/index.json.rabl +0 -18
- data/app/views/phcscriptcdnpro/api/mains/show.json.rabl +0 -18
- data/app/views/phcscriptcdnpro/scriptcdn/authors/_formpatch.html.erb +0 -29
- data/app/views/phcscriptcdnpro/scriptcdn/authors/edit.html.erb +0 -43
- data/app/views/phcscriptcdnpro/scriptcdn/authors/index.html.erb +0 -65
- data/app/views/phcscriptcdnpro/scriptcdn/authors/new.html.erb +0 -43
- data/app/views/phcscriptcdnpro/scriptcdn/informations/_formpatch.html.erb +0 -49
- data/app/views/phcscriptcdnpro/scriptcdn/informations/edit.html.erb +0 -43
- data/app/views/phcscriptcdnpro/scriptcdn/informations/index.html.erb +0 -69
- data/app/views/phcscriptcdnpro/scriptcdn/informations/new.html.erb +0 -43
- data/app/views/phcscriptcdnpro/scriptcdn/mains/_form.html.erb +0 -13
- data/app/views/phcscriptcdnpro/scriptcdn/mains/edit.html.erb +0 -42
- data/app/views/phcscriptcdnpro/scriptcdn/mains/index.html.erb +0 -61
- data/app/views/phcscriptcdnpro/scriptcdn/mains/new.html.erb +0 -42
- data/app/views/phcscriptcdnpro/scriptcdn/urls/_form.html.erb +0 -17
- data/app/views/phcscriptcdnpro/scriptcdn/urls/_formpatch.html.erb +0 -17
- data/app/views/phcscriptcdnpro/scriptcdn/urls/edit.html.erb +0 -43
- data/app/views/phcscriptcdnpro/scriptcdn/urls/index.html.erb +0 -62
- data/app/views/phcscriptcdnpro/scriptcdn/urls/new.html.erb +0 -43
- data/app/views/phcscriptcdnpro/scriptcdn/versions/_form.html.erb +0 -13
- data/app/views/phcscriptcdnpro/scriptcdn/versions/_formpatch.html.erb +0 -13
- data/app/views/phcscriptcdnpro/scriptcdn/versions/edit.html.erb +0 -43
- data/app/views/phcscriptcdnpro/scriptcdn/versions/index.html.erb +0 -63
- data/app/views/phcscriptcdnpro/scriptcdn/versions/new.html.erb +0 -43
- data/db/migrate/20160704185441_create_phcscriptcdnpro_scriptcdn_urls.rb +0 -19
- data/db/migrate/20160704185454_create_phcscriptcdnpro_scriptcdn_versions.rb +0 -17
- data/db/migrate/20160704190509_create_phcscriptcdnpro_scriptcdn_mains.rb +0 -17
@@ -1,17 +0,0 @@
|
|
1
|
-
require_dependency "phcscriptcdnpro/application_controller"
|
2
|
-
|
3
|
-
module Phcscriptcdnpro
|
4
|
-
class Api::MainsController < ApplicationController
|
5
|
-
|
6
|
-
# Script List API
|
7
|
-
def index
|
8
|
-
@scriptcdn_mains = Scriptcdn::Main.all
|
9
|
-
end
|
10
|
-
|
11
|
-
# Script Show API
|
12
|
-
def show
|
13
|
-
@scriptcdn_main = Scriptcdn::Main.find(params[:id])
|
14
|
-
end
|
15
|
-
|
16
|
-
end
|
17
|
-
end
|
@@ -1,70 +0,0 @@
|
|
1
|
-
require_dependency "phcscriptcdnpro/application_controller"
|
2
|
-
|
3
|
-
module Phcscriptcdnpro
|
4
|
-
class Scriptcdn::AuthorsController < ApplicationController
|
5
|
-
|
6
|
-
# Security & Action Filters
|
7
|
-
before_action :require_user
|
8
|
-
layout '/layouts/phcscriptcdnpro/application.html.erb'
|
9
|
-
before_action :set_scriptcdn_author, only: [:edit, :update, :destroy]
|
10
|
-
|
11
|
-
# Author Index
|
12
|
-
def index
|
13
|
-
scriptcdn_main = Scriptcdn::Main.find(params[:main_id])
|
14
|
-
@scriptcdn_authors = scriptcdn_main.authors
|
15
|
-
end
|
16
|
-
|
17
|
-
# New Author
|
18
|
-
def new
|
19
|
-
scriptcdn_main = Scriptcdn::Main.find(params[:main_id])
|
20
|
-
@scriptcdn_author = scriptcdn_main.authors.build
|
21
|
-
end
|
22
|
-
|
23
|
-
# Edit Author
|
24
|
-
def edit
|
25
|
-
scriptcdn_main = Scriptcdn::Main.find(params[:main_id])
|
26
|
-
@scriptcdn_author = scriptcdn_main.authors.find(params[:id])
|
27
|
-
end
|
28
|
-
|
29
|
-
# POST Author
|
30
|
-
def create
|
31
|
-
@scriptcdn_main = Scriptcdn::Main.find(params[:main_id])
|
32
|
-
@scriptcdn_author = @scriptcdn_main.authors.create(scriptcdn_author_params)
|
33
|
-
if @scriptcdn_author.save
|
34
|
-
redirect_to scriptcdn_main_authors_path, notice: 'Author was successfully created.'
|
35
|
-
else
|
36
|
-
render :new
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
# PATCH/PUT Author
|
41
|
-
def update
|
42
|
-
if @scriptcdn_author.update(scriptcdn_author_params)
|
43
|
-
redirect_to scriptcdn_main_authors_path, notice: 'Author was successfully updated.'
|
44
|
-
else
|
45
|
-
render :edit
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
# DELETE Author
|
50
|
-
def destroy
|
51
|
-
@scriptcdn_main = Scriptcdn::Main.find(params[:main_id])
|
52
|
-
@scriptcdn_author = @scriptcdn_main.authors.find(params[:id])
|
53
|
-
@scriptcdn_author.destroy
|
54
|
-
redirect_to scriptcdn_main_authors_path, notice: 'Author was successfully destroyed.'
|
55
|
-
end
|
56
|
-
|
57
|
-
private
|
58
|
-
|
59
|
-
# Common Callbacks
|
60
|
-
def set_scriptcdn_author
|
61
|
-
@scriptcdn_author = Scriptcdn::Author.find(params[:id])
|
62
|
-
end
|
63
|
-
|
64
|
-
# Whitelist
|
65
|
-
def scriptcdn_author_params
|
66
|
-
params.require(:scriptcdn_author).permit(:authorfirstname, :authorlastname, :authorwebsite, :authorgithub, :authortwitter, :main_id)
|
67
|
-
end
|
68
|
-
|
69
|
-
end
|
70
|
-
end
|
@@ -1,70 +0,0 @@
|
|
1
|
-
require_dependency "phcscriptcdnpro/application_controller"
|
2
|
-
|
3
|
-
module Phcscriptcdnpro
|
4
|
-
class Scriptcdn::InformationsController < ApplicationController
|
5
|
-
|
6
|
-
# Security & Action Filters
|
7
|
-
before_action :require_user
|
8
|
-
layout '/layouts/phcscriptcdnpro/application.html.erb'
|
9
|
-
before_action :set_scriptcdn_information, only: [:edit, :update, :destroy]
|
10
|
-
|
11
|
-
# Script Information Index
|
12
|
-
def index
|
13
|
-
scriptcdn_main = Scriptcdn::Main.find(params[:main_id])
|
14
|
-
@scriptcdn_informations = scriptcdn_main.informations
|
15
|
-
end
|
16
|
-
|
17
|
-
# New Script Information
|
18
|
-
def new
|
19
|
-
scriptcdn_main = Scriptcdn::Main.find(params[:main_id])
|
20
|
-
@scriptcdn_information = scriptcdn_main.informations.build
|
21
|
-
end
|
22
|
-
|
23
|
-
# Edit Script Information
|
24
|
-
def edit
|
25
|
-
scriptcdn_main = Scriptcdn::Main.find(params[:main_id])
|
26
|
-
@scriptcdn_information = scriptcdn_main.informations.find(params[:id])
|
27
|
-
end
|
28
|
-
|
29
|
-
# POST Script Information
|
30
|
-
def create
|
31
|
-
@scriptcdn_main = Scriptcdn::Main.find(params[:main_id])
|
32
|
-
@scriptcdn_information = @scriptcdn_main.informations.create(scriptcdn_information_params)
|
33
|
-
if @scriptcdn_information.save
|
34
|
-
redirect_to scriptcdn_main_informations_path, notice: 'Information was successfully created.'
|
35
|
-
else
|
36
|
-
render :new
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
# PATCH/PUT Script Information
|
41
|
-
def update
|
42
|
-
if @scriptcdn_information.update(scriptcdn_information_params)
|
43
|
-
redirect_to scriptcdn_main_informations_path, notice: 'Information was successfully updated.'
|
44
|
-
else
|
45
|
-
render :edit
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
# DELETE Script Information
|
50
|
-
def destroy
|
51
|
-
@scriptcdn_main = Scriptcdn::Main.find(params[:main_id])
|
52
|
-
@scriptcdn_information = @scriptcdn_main.informations.find(params[:id])
|
53
|
-
@scriptcdn_information.destroy
|
54
|
-
redirect_to scriptcdn_main_informations_path, notice: 'Information was successfully destroyed.'
|
55
|
-
end
|
56
|
-
|
57
|
-
private
|
58
|
-
|
59
|
-
# Common Callbacks
|
60
|
-
def set_scriptcdn_information
|
61
|
-
@scriptcdn_information = Scriptcdn::Information.find(params[:id])
|
62
|
-
end
|
63
|
-
|
64
|
-
# Whitelist
|
65
|
-
def scriptcdn_information_params
|
66
|
-
params.require(:scriptcdn_information).permit(:scripttitle, :scriptdescription, :scriptcategory, :scriptwebsite, :scripttwitter, :scriptgithub, :scriptinitialrelease, :scriptlicence, :scriptplatform, :scriptstatus, :main_id)
|
67
|
-
end
|
68
|
-
|
69
|
-
end
|
70
|
-
end
|
@@ -1,63 +0,0 @@
|
|
1
|
-
require_dependency "phcscriptcdnpro/application_controller"
|
2
|
-
|
3
|
-
module Phcscriptcdnpro
|
4
|
-
class Scriptcdn::MainsController < ApplicationController
|
5
|
-
|
6
|
-
# Security & Action Filters
|
7
|
-
before_action :require_user
|
8
|
-
layout '/layouts/phcscriptcdnpro/application.html.erb'
|
9
|
-
before_action :set_scriptcdn_main, only: [:edit, :update, :destroy]
|
10
|
-
|
11
|
-
# Script CDN Backend Index
|
12
|
-
def index
|
13
|
-
@scriptcdn_mains = Scriptcdn::Main.all
|
14
|
-
end
|
15
|
-
|
16
|
-
# New Script Listing
|
17
|
-
def new
|
18
|
-
@scriptcdn_main = Scriptcdn::Main.new
|
19
|
-
end
|
20
|
-
|
21
|
-
# Edit Script Listing
|
22
|
-
def edit
|
23
|
-
end
|
24
|
-
|
25
|
-
# POST Script CDN
|
26
|
-
def create
|
27
|
-
@scriptcdn_main = Scriptcdn::Main.new(scriptcdn_main_params)
|
28
|
-
if @scriptcdn_main.save
|
29
|
-
redirect_to scriptcdn_mains_path, notice: 'Script was successfully created.'
|
30
|
-
else
|
31
|
-
render :new
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
# PATCH/PUT Script
|
36
|
-
def update
|
37
|
-
if @scriptcdn_main.update(scriptcdn_main_params)
|
38
|
-
redirect_to scriptcdn_mains_path, notice: 'Script was successfully updated.'
|
39
|
-
else
|
40
|
-
render :edit
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
# DELETE Script
|
45
|
-
def destroy
|
46
|
-
@scriptcdn_main.destroy
|
47
|
-
redirect_to scriptcdn_mains_path, notice: 'Main was successfully destroyed.'
|
48
|
-
end
|
49
|
-
|
50
|
-
private
|
51
|
-
|
52
|
-
# Common Callbacks
|
53
|
-
def set_scriptcdn_main
|
54
|
-
@scriptcdn_main = Scriptcdn::Main.find(params[:id])
|
55
|
-
end
|
56
|
-
|
57
|
-
# Whitelist
|
58
|
-
def scriptcdn_main_params
|
59
|
-
params.require(:scriptcdn_main).permit(:scriptname)
|
60
|
-
end
|
61
|
-
|
62
|
-
end
|
63
|
-
end
|
@@ -1,70 +0,0 @@
|
|
1
|
-
require_dependency "phcscriptcdnpro/application_controller"
|
2
|
-
|
3
|
-
module Phcscriptcdnpro
|
4
|
-
class Scriptcdn::UrlsController < ApplicationController
|
5
|
-
|
6
|
-
# Security & Action Filters
|
7
|
-
before_action :require_user
|
8
|
-
layout '/layouts/phcscriptcdnpro/application.html.erb'
|
9
|
-
before_action :set_scriptcdn_url, only: [:edit, :update, :destroy]
|
10
|
-
|
11
|
-
# Index for Script URL
|
12
|
-
def index
|
13
|
-
scriptcdn_main = Scriptcdn::Main.find(params[:main_id])
|
14
|
-
@scriptcdn_urls = scriptcdn_main.urls
|
15
|
-
end
|
16
|
-
|
17
|
-
# New Script URL
|
18
|
-
def new
|
19
|
-
scriptcdn_main = Scriptcdn::Main.find(params[:main_id])
|
20
|
-
@scriptcdn_url = scriptcdn_main.urls.build
|
21
|
-
end
|
22
|
-
|
23
|
-
# Edit Script URL
|
24
|
-
def edit
|
25
|
-
scriptcdn_main = Scriptcdn::Main.find(params[:main_id])
|
26
|
-
@scriptcdn_url = scriptcdn_main.urls.find(params[:id])
|
27
|
-
end
|
28
|
-
|
29
|
-
# POST Script URL
|
30
|
-
def create
|
31
|
-
@scriptcdn_main = Scriptcdn::Main.find(params[:main_id])
|
32
|
-
@scriptcdn_url = @scriptcdn_main.urls.create(scriptcdn_url_params)
|
33
|
-
if @scriptcdn_url.save
|
34
|
-
redirect_to scriptcdn_main_urls_path, notice: 'Script URL was successfully created.'
|
35
|
-
else
|
36
|
-
render :new
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
# PATCH/PUT Script URL
|
41
|
-
def update
|
42
|
-
if @scriptcdn_url.update(scriptcdn_url_params)
|
43
|
-
redirect_to scriptcdn_main_urls_path, notice: 'Script URL was successfully updated.'
|
44
|
-
else
|
45
|
-
render :edit
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
# Delete Script URL
|
50
|
-
def destroy
|
51
|
-
@scriptcdn_main = Scriptcdn::Main.find(params[:main_id])
|
52
|
-
@scriptcdn_url = @scriptcdn_main.urls.find(params[:id])
|
53
|
-
@scriptcdn_url.destroy
|
54
|
-
redirect_to scriptcdn_main_urls_path, notice: 'Script url was successfully destroyed.'
|
55
|
-
end
|
56
|
-
|
57
|
-
private
|
58
|
-
|
59
|
-
# Common Callbacks
|
60
|
-
def set_scriptcdn_url
|
61
|
-
@scriptcdn_url = Scriptcdn::Url.find(params[:id])
|
62
|
-
end
|
63
|
-
|
64
|
-
# Whitelist
|
65
|
-
def scriptcdn_url_params
|
66
|
-
params.require(:scriptcdn_url).permit(:scripturl, :scripturlext, :main_id)
|
67
|
-
end
|
68
|
-
|
69
|
-
end
|
70
|
-
end
|
@@ -1,70 +0,0 @@
|
|
1
|
-
require_dependency "phcscriptcdnpro/application_controller"
|
2
|
-
|
3
|
-
module Phcscriptcdnpro
|
4
|
-
class Scriptcdn::VersionsController < ApplicationController
|
5
|
-
|
6
|
-
# Security & Action Filters
|
7
|
-
before_action :require_user
|
8
|
-
layout '/layouts/phcscriptcdnpro/application.html.erb'
|
9
|
-
before_action :set_scriptcdn_version, only: [:edit, :update, :destroy]
|
10
|
-
|
11
|
-
# Script Version Index
|
12
|
-
def index
|
13
|
-
scriptcdn_main = Scriptcdn::Main.find(params[:main_id])
|
14
|
-
@scriptcdn_versions = scriptcdn_main.versions
|
15
|
-
end
|
16
|
-
|
17
|
-
# New Script Version
|
18
|
-
def new
|
19
|
-
scriptcdn_main = Scriptcdn::Main.find(params[:main_id])
|
20
|
-
@scriptcdn_version = scriptcdn_main.versions.build
|
21
|
-
end
|
22
|
-
|
23
|
-
# Edit Script Version
|
24
|
-
def edit
|
25
|
-
scriptcdn_main = Scriptcdn::Main.find(params[:main_id])
|
26
|
-
@scriptcdn_version = scriptcdn_main.versions.find(params[:id])
|
27
|
-
end
|
28
|
-
|
29
|
-
# POST Script Version
|
30
|
-
def create
|
31
|
-
@scriptcdn_main = Scriptcdn::Main.find(params[:main_id])
|
32
|
-
@scriptcdn_version = @scriptcdn_main.versions.create(scriptcdn_version_params)
|
33
|
-
if @scriptcdn_version.save
|
34
|
-
redirect_to scriptcdn_main_versions_path, notice: 'Script version was successfully created.'
|
35
|
-
else
|
36
|
-
render :new
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
# PATCH/PUT Script Version
|
41
|
-
def update
|
42
|
-
if @scriptcdn_version.update(scriptcdn_version_params)
|
43
|
-
redirect_to scriptcdn_main_versions_path, notice: 'Script version was successfully updated.'
|
44
|
-
else
|
45
|
-
render :edit
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
# DELETE Script Version
|
50
|
-
def destroy
|
51
|
-
@scriptcdn_main = Scriptcdn::Main.find(params[:main_id])
|
52
|
-
@scriptcdn_version = @scriptcdn_main.versions.find(params[:id])
|
53
|
-
@scriptcdn_version.destroy
|
54
|
-
redirect_to scriptcdn_main_versions_path, notice: 'Script version was successfully destroyed.'
|
55
|
-
end
|
56
|
-
|
57
|
-
private
|
58
|
-
|
59
|
-
# Callbacks
|
60
|
-
def set_scriptcdn_version
|
61
|
-
@scriptcdn_version = Scriptcdn::Version.find(params[:id])
|
62
|
-
end
|
63
|
-
|
64
|
-
# Whitelist
|
65
|
-
def scriptcdn_version_params
|
66
|
-
params.require(:scriptcdn_version).permit(:versionnumber, :main_id)
|
67
|
-
end
|
68
|
-
|
69
|
-
end
|
70
|
-
end
|
@@ -1,11 +0,0 @@
|
|
1
|
-
module Phcscriptcdnpro
|
2
|
-
class Scriptcdn::Main < ActiveRecord::Base
|
3
|
-
|
4
|
-
# Relationships
|
5
|
-
has_many :versions, class_name: 'Scriptcdn::Version'
|
6
|
-
has_many :informations, class_name: 'Scriptcdn::Information'
|
7
|
-
has_many :urls, class_name: 'Scriptcdn::Url'
|
8
|
-
has_many :authors, class_name: 'Scriptcdn::Author'
|
9
|
-
|
10
|
-
end
|
11
|
-
end
|