phcdevworks_scripts 8.1.1 → 9.0.1
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 +3 -28
- data/app/assets/config/phcdevworks_scripts_manifest.js +2 -3
- data/app/controllers/phcdevworks_scripts/application_controller.rb +13 -13
- data/app/controllers/phcdevworks_scripts/script/authors_controller.rb +83 -83
- data/app/controllers/phcdevworks_scripts/script/extensions_controller.rb +83 -83
- data/app/controllers/phcdevworks_scripts/script/listings_controller.rb +83 -83
- data/app/controllers/phcdevworks_scripts/script/urls_controller.rb +78 -78
- data/app/controllers/phcdevworks_scripts/script/versions_controller.rb +83 -83
- data/app/controllers/phcdevworks_scripts/snippet/posts_controller.rb +82 -82
- data/app/controllers/phcdevworks_scripts/snippet/urls_controller.rb +77 -77
- data/app/helpers/phcdevworks_scripts/application_helper.rb +4 -4
- data/app/helpers/phcdevworks_scripts/script/authors_helper.rb +4 -4
- data/app/helpers/phcdevworks_scripts/script/extensions_helper.rb +4 -4
- data/app/helpers/phcdevworks_scripts/script/listings_helper.rb +4 -4
- data/app/helpers/phcdevworks_scripts/script/urls_helper.rb +4 -4
- data/app/helpers/phcdevworks_scripts/script/versions_helper.rb +4 -4
- data/app/helpers/phcdevworks_scripts/snippet/posts_helper.rb +4 -4
- data/app/helpers/phcdevworks_scripts/snippet/urls_helper.rb +4 -4
- data/app/jobs/phcdevworks_scripts/application_job.rb +4 -4
- data/app/mailers/phcdevworks_scripts/application_mailer.rb +6 -6
- data/app/models/phcdevworks_scripts/application_record.rb +5 -5
- data/app/models/phcdevworks_scripts/script/author.rb +33 -33
- data/app/models/phcdevworks_scripts/script/extension.rb +32 -32
- data/app/models/phcdevworks_scripts/script/listing.rb +38 -38
- data/app/models/phcdevworks_scripts/script/url.rb +24 -24
- data/app/models/phcdevworks_scripts/script/version.rb +26 -26
- data/app/models/phcdevworks_scripts/script.rb +7 -7
- data/app/models/phcdevworks_scripts/snippet/post.rb +28 -28
- data/app/models/phcdevworks_scripts/snippet/url.rb +19 -19
- data/app/models/phcdevworks_scripts/snippet.rb +7 -7
- data/app/models/phcdevworks_scripts/snippet_post_versions.rb +5 -5
- data/app/models/phcdevworks_scripts/snippet_url_versions.rb +5 -5
- data/app/views/layouts/phcdevworks_scripts/application.html.erb +58 -116
- data/app/views/layouts/phcdevworks_scripts/components/backend/footer/_footer.html.erb +10 -9
- data/app/views/layouts/phcdevworks_scripts/components/backend/navigation/_top_menu.html.erb +26 -25
- data/app/views/layouts/phcdevworks_scripts/components/backend/sidebars/_side_menu.html.erb +491 -349
- data/app/views/phcdevworks_scripts/script/authors/_form.html.erb +37 -37
- data/app/views/phcdevworks_scripts/script/authors/edit.html.erb +41 -49
- data/app/views/phcdevworks_scripts/script/authors/index.html.erb +70 -78
- data/app/views/phcdevworks_scripts/script/authors/new.html.erb +41 -49
- data/app/views/phcdevworks_scripts/script/authors/show.html.erb +49 -49
- data/app/views/phcdevworks_scripts/script/extensions/_form.html.erb +32 -32
- data/app/views/phcdevworks_scripts/script/extensions/edit.html.erb +41 -49
- data/app/views/phcdevworks_scripts/script/extensions/index.html.erb +65 -73
- data/app/views/phcdevworks_scripts/script/extensions/new.html.erb +41 -49
- data/app/views/phcdevworks_scripts/script/extensions/show.html.erb +49 -49
- data/app/views/phcdevworks_scripts/script/listings/_form.html.erb +73 -73
- data/app/views/phcdevworks_scripts/script/listings/edit.html.erb +39 -47
- data/app/views/phcdevworks_scripts/script/listings/index.html.erb +68 -76
- data/app/views/phcdevworks_scripts/script/listings/new.html.erb +39 -47
- data/app/views/phcdevworks_scripts/script/listings/show.html.erb +48 -48
- data/app/views/phcdevworks_scripts/script/urls/_form.html.erb +42 -42
- data/app/views/phcdevworks_scripts/script/urls/edit.html.erb +52 -60
- data/app/views/phcdevworks_scripts/script/urls/index.html.erb +68 -76
- data/app/views/phcdevworks_scripts/script/urls/new.html.erb +41 -49
- data/app/views/phcdevworks_scripts/script/urls/show.html.erb +49 -49
- data/app/views/phcdevworks_scripts/script/versions/_form.html.erb +22 -22
- data/app/views/phcdevworks_scripts/script/versions/edit.html.erb +41 -49
- data/app/views/phcdevworks_scripts/script/versions/index.html.erb +64 -72
- data/app/views/phcdevworks_scripts/script/versions/new.html.erb +41 -49
- data/app/views/phcdevworks_scripts/script/versions/show.html.erb +49 -49
- data/app/views/phcdevworks_scripts/snippet/posts/_form.html.erb +28 -28
- data/app/views/phcdevworks_scripts/snippet/posts/edit.html.erb +39 -47
- data/app/views/phcdevworks_scripts/snippet/posts/index.html.erb +74 -82
- data/app/views/phcdevworks_scripts/snippet/posts/new.html.erb +39 -47
- data/app/views/phcdevworks_scripts/snippet/posts/show.html.erb +71 -71
- data/app/views/phcdevworks_scripts/snippet/urls/_form.html.erb +22 -22
- data/app/views/phcdevworks_scripts/snippet/urls/edit.html.erb +39 -47
- data/app/views/phcdevworks_scripts/snippet/urls/index.html.erb +72 -80
- data/app/views/phcdevworks_scripts/snippet/urls/new.html.erb +39 -47
- data/app/views/phcdevworks_scripts/snippet/urls/show.html.erb +71 -71
- data/config/routes.rb +29 -33
- data/config/spring.rb +1 -1
- data/db/migrate/20170517064030_create_phcdevworks_scripts_script_extension_versions.rb +1 -1
- data/db/migrate/20170517064049_create_phcdevworks_scripts_script_listing_versions.rb +18 -18
- data/db/migrate/20170517064114_create_phcdevworks_scripts_script_version_versions.rb +18 -18
- data/db/migrate/20170517064150_create_phcdevworks_scripts_script_url_versions.rb +1 -1
- data/db/migrate/20170517064208_create_phcdevworks_scripts_script_author_versions.rb +18 -18
- data/db/migrate/20190818022002_create_phcdevworks_scripts_snippet_posts.rb +18 -18
- data/db/migrate/20190818022024_create_phcdevworks_scripts_snippet_urls.rb +17 -17
- data/db/migrate/20190818022939_create_phcdevworks_scripts_script_authors.rb +18 -18
- data/db/migrate/20190818023353_create_phcdevworks_scripts_script_listings.rb +29 -29
- data/db/migrate/20190818023709_create_phcdevworks_scripts_script_extensions.rb +17 -17
- data/db/migrate/20190818023911_create_phcdevworks_scripts_script_urls.rb +21 -21
- data/db/migrate/20190818031653_create_phcdevworks_scripts_script_versions.rb +15 -15
- data/db/migrate/20191102092649_create_phcdevworks_scripts_snippet_url_versions.rb +18 -18
- data/db/migrate/20191102092711_create_phcdevworks_scripts_snippet_post_versions.rb +18 -18
- data/lib/phcdevworks_scripts/engine.rb +45 -45
- data/lib/phcdevworks_scripts/version.rb +3 -3
- metadata +36 -87
- data/app/assets/stylesheets/phcdevworks_scripts/application.scss +0 -15
- data/app/assets/stylesheets/phcdevworks_scripts/script/authors.scss +0 -3
- data/app/assets/stylesheets/phcdevworks_scripts/script/extensions.scss +0 -3
- data/app/assets/stylesheets/phcdevworks_scripts/script/listings.scss +0 -3
- data/app/assets/stylesheets/phcdevworks_scripts/script/urls.scss +0 -3
- data/app/assets/stylesheets/phcdevworks_scripts/script/versions.scss +0 -3
- data/app/assets/stylesheets/phcdevworks_scripts/snippet/posts.scss +0 -3
- data/app/assets/stylesheets/phcdevworks_scripts/snippet/urls.scss +0 -3
@@ -1,78 +1,78 @@
|
|
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
|
-
@script_url.org_id = current_user.org_id
|
37
|
-
if @script_url.save
|
38
|
-
redirect_to script_listing_urls_path, :flash => { :success => 'Author was successfully created.' }
|
39
|
-
else
|
40
|
-
render :new
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
# UPDATE
|
45
|
-
def update
|
46
|
-
@script_listing = Script::Listing.friendly.find(params[:listing_id])
|
47
|
-
if @script_url.update(script_url_params)
|
48
|
-
redirect_to script_listing_urls_path, :flash => { :success => 'Author was successfully updated.' }
|
49
|
-
else
|
50
|
-
render :edit
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
# DELETE
|
55
|
-
def destroy
|
56
|
-
@script_url = script_listing.urls.find(params[:id])
|
57
|
-
@script_url.destroy
|
58
|
-
redirect_to script_listing_urls_path, :flash => { :error => 'Author was successfully destroyed.' }
|
59
|
-
end
|
60
|
-
|
61
|
-
private
|
62
|
-
|
63
|
-
# Callback
|
64
|
-
def set_script_url
|
65
|
-
@script_url = Script::Url.find(params[:id])
|
66
|
-
end
|
67
|
-
|
68
|
-
def script_listing
|
69
|
-
@script_listing = Script::Listing.friendly.find(params[:listing_id])
|
70
|
-
end
|
71
|
-
|
72
|
-
# Whitelist
|
73
|
-
def script_url_params
|
74
|
-
params.require(:script_url).permit(:script_cdn_url, :script_cdn_url_release, :script_cdn_url_cdn_update, :version_id, :extension_id, :slug, :user_id, :org_id)
|
75
|
-
end
|
76
|
-
|
77
|
-
end
|
78
|
-
end
|
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
|
+
@script_url.org_id = current_user.org_id
|
37
|
+
if @script_url.save
|
38
|
+
redirect_to script_listing_urls_path, :flash => { :success => 'Author was successfully created.' }
|
39
|
+
else
|
40
|
+
render :new
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
# UPDATE
|
45
|
+
def update
|
46
|
+
@script_listing = Script::Listing.friendly.find(params[:listing_id])
|
47
|
+
if @script_url.update(script_url_params)
|
48
|
+
redirect_to script_listing_urls_path, :flash => { :success => 'Author was successfully updated.' }
|
49
|
+
else
|
50
|
+
render :edit
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
# DELETE
|
55
|
+
def destroy
|
56
|
+
@script_url = script_listing.urls.find(params[:id])
|
57
|
+
@script_url.destroy
|
58
|
+
redirect_to script_listing_urls_path, :flash => { :error => 'Author was successfully destroyed.' }
|
59
|
+
end
|
60
|
+
|
61
|
+
private
|
62
|
+
|
63
|
+
# Callback
|
64
|
+
def set_script_url
|
65
|
+
@script_url = Script::Url.find(params[:id])
|
66
|
+
end
|
67
|
+
|
68
|
+
def script_listing
|
69
|
+
@script_listing = Script::Listing.friendly.find(params[:listing_id])
|
70
|
+
end
|
71
|
+
|
72
|
+
# Whitelist
|
73
|
+
def script_url_params
|
74
|
+
params.require(:script_url).permit(:script_cdn_url, :script_cdn_url_release, :script_cdn_url_cdn_update, :version_id, :extension_id, :slug, :user_id, :org_id)
|
75
|
+
end
|
76
|
+
|
77
|
+
end
|
78
|
+
end
|
@@ -1,83 +1,83 @@
|
|
1
|
-
require_dependency "phcdevworks_scripts/application_controller"
|
2
|
-
|
3
|
-
module PhcdevworksScripts
|
4
|
-
class Script::VersionsController < 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_version, only: [:show, :edit, :update, :destroy]
|
11
|
-
|
12
|
-
# GET /script/versions
|
13
|
-
def index
|
14
|
-
@script_versions = Script::Version.all
|
15
|
-
end
|
16
|
-
|
17
|
-
# GET /script/versions/1
|
18
|
-
def show
|
19
|
-
@script_versions = Script::Version.friendly.find(params[:id])
|
20
|
-
@versions = PhcdevworksScripts::ScriptVersionVersions.where(item_id: params[:id], item_type: 'PhcdevworksScripts::Script::Version')
|
21
|
-
end
|
22
|
-
|
23
|
-
# GET /script/versions/new
|
24
|
-
def new
|
25
|
-
@script_version = Script::Version.new
|
26
|
-
end
|
27
|
-
|
28
|
-
# GET /script/versions/1/edit
|
29
|
-
def edit
|
30
|
-
end
|
31
|
-
|
32
|
-
# POST /script/versions
|
33
|
-
def create
|
34
|
-
@script_version = Script::Version.new(script_version_params)
|
35
|
-
@script_version.user_id = current_user.id
|
36
|
-
@script_version.org_id = current_user.org_id
|
37
|
-
respond_to do |format|
|
38
|
-
if @script_version.save
|
39
|
-
format.html { redirect_to script_versions_path, :flash => { :success => 'Script Version has been Added.' }}
|
40
|
-
format.json { render :show, status: :created, location: @script_version }
|
41
|
-
else
|
42
|
-
format.html { render :new }
|
43
|
-
format.json { render json: @script_version.errors, status: :unprocessable_entity }
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
# PATCH/PUT /script/versions/1
|
49
|
-
def update
|
50
|
-
respond_to do |format|
|
51
|
-
if @script_version.update(script_version_params)
|
52
|
-
format.html { redirect_to script_versions_path, :flash => { :notice => 'Script Version Name has been Updated.' }}
|
53
|
-
format.json { render :show, status: :ok, location: @script_version }
|
54
|
-
else
|
55
|
-
format.html { render :edit }
|
56
|
-
format.json { render json: @script_version.errors, status: :unprocessable_entity }
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
# DELETE /script/versions/1
|
62
|
-
def destroy
|
63
|
-
@script_version.destroy
|
64
|
-
respond_to do |format|
|
65
|
-
format.html { redirect_to script_versions_path, :flash => { :error => 'Script Version and Connections have all been Removed.' }}
|
66
|
-
format.json { head :no_content }
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
private
|
71
|
-
|
72
|
-
# Callback
|
73
|
-
def set_script_version
|
74
|
-
@script_version = Script::Version.find(params[:id])
|
75
|
-
end
|
76
|
-
|
77
|
-
# Whitelist
|
78
|
-
def script_version_params
|
79
|
-
params.require(:script_version).permit(:script_version_number, :slug, :user_id, :org_id)
|
80
|
-
end
|
81
|
-
|
82
|
-
end
|
83
|
-
end
|
1
|
+
require_dependency "phcdevworks_scripts/application_controller"
|
2
|
+
|
3
|
+
module PhcdevworksScripts
|
4
|
+
class Script::VersionsController < 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_version, only: [:show, :edit, :update, :destroy]
|
11
|
+
|
12
|
+
# GET /script/versions
|
13
|
+
def index
|
14
|
+
@script_versions = Script::Version.all
|
15
|
+
end
|
16
|
+
|
17
|
+
# GET /script/versions/1
|
18
|
+
def show
|
19
|
+
@script_versions = Script::Version.friendly.find(params[:id])
|
20
|
+
@versions = PhcdevworksScripts::ScriptVersionVersions.where(item_id: params[:id], item_type: 'PhcdevworksScripts::Script::Version')
|
21
|
+
end
|
22
|
+
|
23
|
+
# GET /script/versions/new
|
24
|
+
def new
|
25
|
+
@script_version = Script::Version.new
|
26
|
+
end
|
27
|
+
|
28
|
+
# GET /script/versions/1/edit
|
29
|
+
def edit
|
30
|
+
end
|
31
|
+
|
32
|
+
# POST /script/versions
|
33
|
+
def create
|
34
|
+
@script_version = Script::Version.new(script_version_params)
|
35
|
+
@script_version.user_id = current_user.id
|
36
|
+
@script_version.org_id = current_user.org_id
|
37
|
+
respond_to do |format|
|
38
|
+
if @script_version.save
|
39
|
+
format.html { redirect_to script_versions_path, :flash => { :success => 'Script Version has been Added.' }}
|
40
|
+
format.json { render :show, status: :created, location: @script_version }
|
41
|
+
else
|
42
|
+
format.html { render :new }
|
43
|
+
format.json { render json: @script_version.errors, status: :unprocessable_entity }
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
# PATCH/PUT /script/versions/1
|
49
|
+
def update
|
50
|
+
respond_to do |format|
|
51
|
+
if @script_version.update(script_version_params)
|
52
|
+
format.html { redirect_to script_versions_path, :flash => { :notice => 'Script Version Name has been Updated.' }}
|
53
|
+
format.json { render :show, status: :ok, location: @script_version }
|
54
|
+
else
|
55
|
+
format.html { render :edit }
|
56
|
+
format.json { render json: @script_version.errors, status: :unprocessable_entity }
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
# DELETE /script/versions/1
|
62
|
+
def destroy
|
63
|
+
@script_version.destroy
|
64
|
+
respond_to do |format|
|
65
|
+
format.html { redirect_to script_versions_path, :flash => { :error => 'Script Version and Connections have all been Removed.' }}
|
66
|
+
format.json { head :no_content }
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
private
|
71
|
+
|
72
|
+
# Callback
|
73
|
+
def set_script_version
|
74
|
+
@script_version = Script::Version.find(params[:id])
|
75
|
+
end
|
76
|
+
|
77
|
+
# Whitelist
|
78
|
+
def script_version_params
|
79
|
+
params.require(:script_version).permit(:script_version_number, :slug, :user_id, :org_id)
|
80
|
+
end
|
81
|
+
|
82
|
+
end
|
83
|
+
end
|
@@ -1,82 +1,82 @@
|
|
1
|
-
require_dependency "phcdevworks_scripts/application_controller"
|
2
|
-
|
3
|
-
module PhcdevworksScripts
|
4
|
-
class Snippet::PostsController < 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_snippet_post, only: [:show, :edit, :update, :destroy]
|
11
|
-
|
12
|
-
# GET /snippet/posts
|
13
|
-
def index
|
14
|
-
@snippet_posts = Snippet::Post.all
|
15
|
-
end
|
16
|
-
|
17
|
-
# GET /snippet/posts/1
|
18
|
-
def show
|
19
|
-
@snippet_post = Snippet::Post.friendly.find(params[:id])
|
20
|
-
end
|
21
|
-
|
22
|
-
# GET /snippet/posts/new
|
23
|
-
def new
|
24
|
-
@snippet_post = Snippet::Post.new
|
25
|
-
end
|
26
|
-
|
27
|
-
# GET /snippet/posts/1/edit
|
28
|
-
def edit
|
29
|
-
end
|
30
|
-
|
31
|
-
# POST /snippet/posts
|
32
|
-
def create
|
33
|
-
@snippet_post = Snippet::Post.new(snippet_post_params)
|
34
|
-
@snippet_post.user_id = current_user.id
|
35
|
-
@snippet_post.org_id = current_user.org_id
|
36
|
-
respond_to do |format|
|
37
|
-
if @snippet_post.save
|
38
|
-
format.html { redirect_to snippet_posts_path, :flash => { :success => 'Script Snippet has been Added.' }}
|
39
|
-
format.json { render :show, status: :created, location: @snippet_post }
|
40
|
-
else
|
41
|
-
format.html { render :new }
|
42
|
-
format.json { render json: @snippet_post.errors, status: :unprocessable_entity }
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
# PATCH/PUT /snippet/posts/1
|
48
|
-
def update
|
49
|
-
respond_to do |format|
|
50
|
-
if @snippet_post.update(snippet_post_params)
|
51
|
-
format.html { redirect_to snippet_posts_path, :flash => { :notice => 'Script Snippet Name has been Updated.' }}
|
52
|
-
format.json { render :show, status: :ok, location: @snippet_post }
|
53
|
-
else
|
54
|
-
format.html { render :edit }
|
55
|
-
format.json { render json: @snippet_post.errors, status: :unprocessable_entity }
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
# DELETE /snippet/posts/1
|
61
|
-
def destroy
|
62
|
-
@snippet_post.destroy
|
63
|
-
respond_to do |format|
|
64
|
-
format.html { redirect_to snippet_posts_path, :flash => { :error => 'Script Snippet and Connections have all been Removed.' }}
|
65
|
-
format.json { head :no_content }
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
private
|
70
|
-
|
71
|
-
# Common Callbacks
|
72
|
-
def set_snippet_post
|
73
|
-
@snippet_post = Snippet::Post.friendly.find(params[:id])
|
74
|
-
end
|
75
|
-
|
76
|
-
# Whitelist
|
77
|
-
def snippet_post_params
|
78
|
-
params.require(:snippet_post).permit(:snippet_post_title, :snippet_post_code, :slug, :user_id, :org_id)
|
79
|
-
end
|
80
|
-
|
81
|
-
end
|
82
|
-
end
|
1
|
+
require_dependency "phcdevworks_scripts/application_controller"
|
2
|
+
|
3
|
+
module PhcdevworksScripts
|
4
|
+
class Snippet::PostsController < 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_snippet_post, only: [:show, :edit, :update, :destroy]
|
11
|
+
|
12
|
+
# GET /snippet/posts
|
13
|
+
def index
|
14
|
+
@snippet_posts = Snippet::Post.all
|
15
|
+
end
|
16
|
+
|
17
|
+
# GET /snippet/posts/1
|
18
|
+
def show
|
19
|
+
@snippet_post = Snippet::Post.friendly.find(params[:id])
|
20
|
+
end
|
21
|
+
|
22
|
+
# GET /snippet/posts/new
|
23
|
+
def new
|
24
|
+
@snippet_post = Snippet::Post.new
|
25
|
+
end
|
26
|
+
|
27
|
+
# GET /snippet/posts/1/edit
|
28
|
+
def edit
|
29
|
+
end
|
30
|
+
|
31
|
+
# POST /snippet/posts
|
32
|
+
def create
|
33
|
+
@snippet_post = Snippet::Post.new(snippet_post_params)
|
34
|
+
@snippet_post.user_id = current_user.id
|
35
|
+
@snippet_post.org_id = current_user.org_id
|
36
|
+
respond_to do |format|
|
37
|
+
if @snippet_post.save
|
38
|
+
format.html { redirect_to snippet_posts_path, :flash => { :success => 'Script Snippet has been Added.' }}
|
39
|
+
format.json { render :show, status: :created, location: @snippet_post }
|
40
|
+
else
|
41
|
+
format.html { render :new }
|
42
|
+
format.json { render json: @snippet_post.errors, status: :unprocessable_entity }
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
# PATCH/PUT /snippet/posts/1
|
48
|
+
def update
|
49
|
+
respond_to do |format|
|
50
|
+
if @snippet_post.update(snippet_post_params)
|
51
|
+
format.html { redirect_to snippet_posts_path, :flash => { :notice => 'Script Snippet Name has been Updated.' }}
|
52
|
+
format.json { render :show, status: :ok, location: @snippet_post }
|
53
|
+
else
|
54
|
+
format.html { render :edit }
|
55
|
+
format.json { render json: @snippet_post.errors, status: :unprocessable_entity }
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
# DELETE /snippet/posts/1
|
61
|
+
def destroy
|
62
|
+
@snippet_post.destroy
|
63
|
+
respond_to do |format|
|
64
|
+
format.html { redirect_to snippet_posts_path, :flash => { :error => 'Script Snippet and Connections have all been Removed.' }}
|
65
|
+
format.json { head :no_content }
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
private
|
70
|
+
|
71
|
+
# Common Callbacks
|
72
|
+
def set_snippet_post
|
73
|
+
@snippet_post = Snippet::Post.friendly.find(params[:id])
|
74
|
+
end
|
75
|
+
|
76
|
+
# Whitelist
|
77
|
+
def snippet_post_params
|
78
|
+
params.require(:snippet_post).permit(:snippet_post_title, :snippet_post_code, :slug, :user_id, :org_id)
|
79
|
+
end
|
80
|
+
|
81
|
+
end
|
82
|
+
end
|
@@ -1,77 +1,77 @@
|
|
1
|
-
require_dependency "phcdevworks_scripts/application_controller"
|
2
|
-
|
3
|
-
module PhcdevworksScripts
|
4
|
-
class Snippet::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_snippet_url, only: [:show, :edit, :update, :destroy]
|
11
|
-
|
12
|
-
# INDEX
|
13
|
-
def index
|
14
|
-
@snippet_urls = snippet_post.urls.all
|
15
|
-
end
|
16
|
-
|
17
|
-
# SHOW
|
18
|
-
def show
|
19
|
-
@snippet_url = snippet_post.urls.find(params[:id])
|
20
|
-
end
|
21
|
-
|
22
|
-
# NEW
|
23
|
-
def new
|
24
|
-
@snippet_url = snippet_post.urls.build
|
25
|
-
end
|
26
|
-
|
27
|
-
# EDIT
|
28
|
-
def edit
|
29
|
-
end
|
30
|
-
|
31
|
-
# CREATE
|
32
|
-
def create
|
33
|
-
@snippet_url = snippet_post.urls.create(snippet_url_params)
|
34
|
-
@snippet_url.user_id = current_user.id
|
35
|
-
@snippet_url.org_id = current_user.org_id
|
36
|
-
if @snippet_url.save
|
37
|
-
redirect_to snippet_post_urls_path, :flash => { :success => 'Script url was successfully created.' }
|
38
|
-
else
|
39
|
-
render :new
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
# UPDATE
|
44
|
-
def update
|
45
|
-
@snippet_post = Snippet::Post.friendly.find(params[:post_id])
|
46
|
-
if @snippet_url.update(snippet_url_params)
|
47
|
-
redirect_to snippet_post_urls_path, :flash => { :success => 'Script url was successfully updated.' }
|
48
|
-
else
|
49
|
-
render :edit
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
# DELETE
|
54
|
-
def destroy
|
55
|
-
@snippet_url = snippet_post.urls.find(params[:id])
|
56
|
-
@snippet_url.destroy
|
57
|
-
redirect_to snippet_post_urls_path, :flash => { :error => 'Script url was successfully destroyed.' }
|
58
|
-
end
|
59
|
-
|
60
|
-
private
|
61
|
-
|
62
|
-
# Common Callbacks
|
63
|
-
def set_snippet_url
|
64
|
-
@snippet_url = Snippet::Url.find(params[:id])
|
65
|
-
end
|
66
|
-
|
67
|
-
def snippet_post
|
68
|
-
@snippet_post = Snippet::Post.friendly.find(params[:post_id])
|
69
|
-
end
|
70
|
-
|
71
|
-
# Whitelist
|
72
|
-
def snippet_url_params
|
73
|
-
params.require(:snippet_url).permit(:snippet_post_url, :post_id, :slug, :user_id, :org_id)
|
74
|
-
end
|
75
|
-
|
76
|
-
end
|
77
|
-
end
|
1
|
+
require_dependency "phcdevworks_scripts/application_controller"
|
2
|
+
|
3
|
+
module PhcdevworksScripts
|
4
|
+
class Snippet::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_snippet_url, only: [:show, :edit, :update, :destroy]
|
11
|
+
|
12
|
+
# INDEX
|
13
|
+
def index
|
14
|
+
@snippet_urls = snippet_post.urls.all
|
15
|
+
end
|
16
|
+
|
17
|
+
# SHOW
|
18
|
+
def show
|
19
|
+
@snippet_url = snippet_post.urls.find(params[:id])
|
20
|
+
end
|
21
|
+
|
22
|
+
# NEW
|
23
|
+
def new
|
24
|
+
@snippet_url = snippet_post.urls.build
|
25
|
+
end
|
26
|
+
|
27
|
+
# EDIT
|
28
|
+
def edit
|
29
|
+
end
|
30
|
+
|
31
|
+
# CREATE
|
32
|
+
def create
|
33
|
+
@snippet_url = snippet_post.urls.create(snippet_url_params)
|
34
|
+
@snippet_url.user_id = current_user.id
|
35
|
+
@snippet_url.org_id = current_user.org_id
|
36
|
+
if @snippet_url.save
|
37
|
+
redirect_to snippet_post_urls_path, :flash => { :success => 'Script url was successfully created.' }
|
38
|
+
else
|
39
|
+
render :new
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
# UPDATE
|
44
|
+
def update
|
45
|
+
@snippet_post = Snippet::Post.friendly.find(params[:post_id])
|
46
|
+
if @snippet_url.update(snippet_url_params)
|
47
|
+
redirect_to snippet_post_urls_path, :flash => { :success => 'Script url was successfully updated.' }
|
48
|
+
else
|
49
|
+
render :edit
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
# DELETE
|
54
|
+
def destroy
|
55
|
+
@snippet_url = snippet_post.urls.find(params[:id])
|
56
|
+
@snippet_url.destroy
|
57
|
+
redirect_to snippet_post_urls_path, :flash => { :error => 'Script url was successfully destroyed.' }
|
58
|
+
end
|
59
|
+
|
60
|
+
private
|
61
|
+
|
62
|
+
# Common Callbacks
|
63
|
+
def set_snippet_url
|
64
|
+
@snippet_url = Snippet::Url.find(params[:id])
|
65
|
+
end
|
66
|
+
|
67
|
+
def snippet_post
|
68
|
+
@snippet_post = Snippet::Post.friendly.find(params[:post_id])
|
69
|
+
end
|
70
|
+
|
71
|
+
# Whitelist
|
72
|
+
def snippet_url_params
|
73
|
+
params.require(:snippet_url).permit(:snippet_post_url, :post_id, :slug, :user_id, :org_id)
|
74
|
+
end
|
75
|
+
|
76
|
+
end
|
77
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module PhcdevworksScripts
|
2
|
-
module ApplicationHelper
|
3
|
-
end
|
4
|
-
end
|
1
|
+
module PhcdevworksScripts
|
2
|
+
module ApplicationHelper
|
3
|
+
end
|
4
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module PhcdevworksScripts
|
2
|
-
module Script::AuthorsHelper
|
3
|
-
end
|
4
|
-
end
|
1
|
+
module PhcdevworksScripts
|
2
|
+
module Script::AuthorsHelper
|
3
|
+
end
|
4
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module PhcdevworksScripts
|
2
|
-
module Script::ExtensionsHelper
|
3
|
-
end
|
4
|
-
end
|
1
|
+
module PhcdevworksScripts
|
2
|
+
module Script::ExtensionsHelper
|
3
|
+
end
|
4
|
+
end
|