phcdevworks_scripts 8.1.1 → 8.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (108) hide show
  1. checksums.yaml +4 -4
  2. data/MIT-LICENSE +20 -20
  3. data/README.md +1 -28
  4. data/Rakefile +8 -8
  5. data/app/assets/config/phcdevworks_scripts_manifest.js +3 -3
  6. data/app/assets/stylesheets/phcdevworks_scripts/application.scss +15 -15
  7. data/app/assets/stylesheets/phcdevworks_scripts/script/authors.scss +3 -3
  8. data/app/assets/stylesheets/phcdevworks_scripts/script/extensions.scss +3 -3
  9. data/app/assets/stylesheets/phcdevworks_scripts/script/listings.scss +3 -3
  10. data/app/assets/stylesheets/phcdevworks_scripts/script/urls.scss +3 -3
  11. data/app/assets/stylesheets/phcdevworks_scripts/script/versions.scss +3 -3
  12. data/app/assets/stylesheets/phcdevworks_scripts/snippet/posts.scss +3 -3
  13. data/app/assets/stylesheets/phcdevworks_scripts/snippet/urls.scss +3 -3
  14. data/app/controllers/phcdevworks_scripts/application_controller.rb +13 -13
  15. data/app/controllers/phcdevworks_scripts/script/authors_controller.rb +83 -83
  16. data/app/controllers/phcdevworks_scripts/script/extensions_controller.rb +83 -83
  17. data/app/controllers/phcdevworks_scripts/script/listings_controller.rb +83 -83
  18. data/app/controllers/phcdevworks_scripts/script/urls_controller.rb +78 -78
  19. data/app/controllers/phcdevworks_scripts/script/versions_controller.rb +83 -83
  20. data/app/controllers/phcdevworks_scripts/snippet/posts_controller.rb +82 -82
  21. data/app/controllers/phcdevworks_scripts/snippet/urls_controller.rb +77 -77
  22. data/app/helpers/phcdevworks_scripts/application_helper.rb +4 -4
  23. data/app/helpers/phcdevworks_scripts/script/authors_helper.rb +4 -4
  24. data/app/helpers/phcdevworks_scripts/script/extensions_helper.rb +4 -4
  25. data/app/helpers/phcdevworks_scripts/script/listings_helper.rb +4 -4
  26. data/app/helpers/phcdevworks_scripts/script/urls_helper.rb +4 -4
  27. data/app/helpers/phcdevworks_scripts/script/versions_helper.rb +4 -4
  28. data/app/helpers/phcdevworks_scripts/snippet/posts_helper.rb +4 -4
  29. data/app/helpers/phcdevworks_scripts/snippet/urls_helper.rb +4 -4
  30. data/app/jobs/phcdevworks_scripts/application_job.rb +4 -4
  31. data/app/mailers/phcdevworks_scripts/application_mailer.rb +6 -6
  32. data/app/models/phcdevworks_scripts/application_record.rb +5 -5
  33. data/app/models/phcdevworks_scripts/script/author.rb +33 -33
  34. data/app/models/phcdevworks_scripts/script/extension.rb +32 -32
  35. data/app/models/phcdevworks_scripts/script/listing.rb +38 -38
  36. data/app/models/phcdevworks_scripts/script/url.rb +24 -24
  37. data/app/models/phcdevworks_scripts/script/version.rb +26 -26
  38. data/app/models/phcdevworks_scripts/script.rb +7 -7
  39. data/app/models/phcdevworks_scripts/script_author_versions.rb +0 -0
  40. data/app/models/phcdevworks_scripts/script_extension_versions.rb +0 -0
  41. data/app/models/phcdevworks_scripts/script_listing_versions.rb +0 -0
  42. data/app/models/phcdevworks_scripts/script_url_versions.rb +0 -0
  43. data/app/models/phcdevworks_scripts/script_version_versions.rb +0 -0
  44. data/app/models/phcdevworks_scripts/snippet/post.rb +28 -28
  45. data/app/models/phcdevworks_scripts/snippet/url.rb +19 -19
  46. data/app/models/phcdevworks_scripts/snippet.rb +7 -7
  47. data/app/models/phcdevworks_scripts/snippet_post_versions.rb +5 -5
  48. data/app/models/phcdevworks_scripts/snippet_url_versions.rb +5 -5
  49. data/app/views/layouts/phcdevworks_scripts/application.html.erb +131 -131
  50. data/app/views/layouts/phcdevworks_scripts/components/backend/footer/_footer.html.erb +0 -0
  51. data/app/views/layouts/phcdevworks_scripts/components/backend/navigation/_top_menu.html.erb +0 -0
  52. data/app/views/layouts/phcdevworks_scripts/components/backend/sidebars/_side_menu.html.erb +0 -0
  53. data/app/views/phcdevworks_scripts/script/authors/_form.html.erb +37 -37
  54. data/app/views/phcdevworks_scripts/script/authors/edit.html.erb +49 -49
  55. data/app/views/phcdevworks_scripts/script/authors/index.html.erb +78 -78
  56. data/app/views/phcdevworks_scripts/script/authors/new.html.erb +49 -49
  57. data/app/views/phcdevworks_scripts/script/authors/show.html.erb +49 -49
  58. data/app/views/phcdevworks_scripts/script/extensions/_form.html.erb +32 -32
  59. data/app/views/phcdevworks_scripts/script/extensions/edit.html.erb +49 -49
  60. data/app/views/phcdevworks_scripts/script/extensions/index.html.erb +73 -73
  61. data/app/views/phcdevworks_scripts/script/extensions/new.html.erb +49 -49
  62. data/app/views/phcdevworks_scripts/script/extensions/show.html.erb +49 -49
  63. data/app/views/phcdevworks_scripts/script/listings/_form.html.erb +73 -73
  64. data/app/views/phcdevworks_scripts/script/listings/edit.html.erb +47 -47
  65. data/app/views/phcdevworks_scripts/script/listings/index.html.erb +76 -76
  66. data/app/views/phcdevworks_scripts/script/listings/new.html.erb +47 -47
  67. data/app/views/phcdevworks_scripts/script/listings/show.html.erb +48 -48
  68. data/app/views/phcdevworks_scripts/script/urls/_form.html.erb +42 -42
  69. data/app/views/phcdevworks_scripts/script/urls/edit.html.erb +60 -60
  70. data/app/views/phcdevworks_scripts/script/urls/index.html.erb +76 -76
  71. data/app/views/phcdevworks_scripts/script/urls/new.html.erb +49 -49
  72. data/app/views/phcdevworks_scripts/script/urls/show.html.erb +49 -49
  73. data/app/views/phcdevworks_scripts/script/versions/_form.html.erb +22 -22
  74. data/app/views/phcdevworks_scripts/script/versions/edit.html.erb +49 -49
  75. data/app/views/phcdevworks_scripts/script/versions/index.html.erb +72 -72
  76. data/app/views/phcdevworks_scripts/script/versions/new.html.erb +49 -49
  77. data/app/views/phcdevworks_scripts/script/versions/show.html.erb +49 -49
  78. data/app/views/phcdevworks_scripts/snippet/posts/_form.html.erb +28 -28
  79. data/app/views/phcdevworks_scripts/snippet/posts/edit.html.erb +47 -47
  80. data/app/views/phcdevworks_scripts/snippet/posts/index.html.erb +82 -82
  81. data/app/views/phcdevworks_scripts/snippet/posts/new.html.erb +47 -47
  82. data/app/views/phcdevworks_scripts/snippet/posts/show.html.erb +71 -71
  83. data/app/views/phcdevworks_scripts/snippet/urls/_form.html.erb +22 -22
  84. data/app/views/phcdevworks_scripts/snippet/urls/edit.html.erb +47 -47
  85. data/app/views/phcdevworks_scripts/snippet/urls/index.html.erb +80 -80
  86. data/app/views/phcdevworks_scripts/snippet/urls/new.html.erb +47 -47
  87. data/app/views/phcdevworks_scripts/snippet/urls/show.html.erb +71 -71
  88. data/config/routes.rb +33 -33
  89. data/config/spring.rb +1 -1
  90. data/db/migrate/20170517064030_create_phcdevworks_scripts_script_extension_versions.rb +0 -0
  91. data/db/migrate/20170517064049_create_phcdevworks_scripts_script_listing_versions.rb +18 -18
  92. data/db/migrate/20170517064114_create_phcdevworks_scripts_script_version_versions.rb +18 -18
  93. data/db/migrate/20170517064150_create_phcdevworks_scripts_script_url_versions.rb +0 -0
  94. data/db/migrate/20170517064208_create_phcdevworks_scripts_script_author_versions.rb +18 -18
  95. data/db/migrate/20190818022002_create_phcdevworks_scripts_snippet_posts.rb +18 -18
  96. data/db/migrate/20190818022024_create_phcdevworks_scripts_snippet_urls.rb +17 -17
  97. data/db/migrate/20190818022939_create_phcdevworks_scripts_script_authors.rb +18 -18
  98. data/db/migrate/20190818023353_create_phcdevworks_scripts_script_listings.rb +29 -29
  99. data/db/migrate/20190818023709_create_phcdevworks_scripts_script_extensions.rb +17 -17
  100. data/db/migrate/20190818023911_create_phcdevworks_scripts_script_urls.rb +21 -21
  101. data/db/migrate/20190818031653_create_phcdevworks_scripts_script_versions.rb +15 -15
  102. data/db/migrate/20191102092649_create_phcdevworks_scripts_snippet_url_versions.rb +18 -18
  103. data/db/migrate/20191102092711_create_phcdevworks_scripts_snippet_post_versions.rb +18 -18
  104. data/lib/phcdevworks_scripts/engine.rb +47 -47
  105. data/lib/phcdevworks_scripts/version.rb +3 -3
  106. data/lib/phcdevworks_scripts.rb +6 -6
  107. data/lib/tasks/phcdevworks_scripts_tasks.rake +4 -4
  108. metadata +33 -33
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0bb7867fd34f9c0342413dd7c0829a5ab8d6a6d07a1820f3936def8b3d4581db
4
- data.tar.gz: 36bde19abea1e898cabee92397e1fa84c03dafc59996b1e6783b742065071eaa
3
+ metadata.gz: ca0fce49c21a7be6d21170424b91cb7593abff3787f2e852bca23cbdf94856df
4
+ data.tar.gz: ba32e66d3f2cbc8eec0bd9d1db9d846a4155981f3d22e76d9fe0be4e55e151e7
5
5
  SHA512:
6
- metadata.gz: f3139b3f23a62dba73f1752d8214e4a888a9fcc1b488c52b0e31ac5f0ca894d36b602fa32c781fc2c120a01431bd9b13a4cd99dc4ea31e5a078fadf8ad208314
7
- data.tar.gz: 6c7b6150c1887b7b2559611e254ffbcea41835acce31422ff574e4fe0cab8809d53f487eea880961af1bfacf81454f6e01b0d5a7b6cc79b4cf37d04b01c68c59
6
+ metadata.gz: 561d695bc93cbdaeb69bfa6dca4f4c859afb0ad291194e3a4830fa7a6d41b91e4d15d23ef21453180ebb134e087eb858d02b1bf24b6ec9e0d01406ea5511edfa
7
+ data.tar.gz: 88a076961f18efb99f24cbcb66b96cf44be5c6f3111646c945bc9073c089052595cdb9152c2a92c2bb1a22bcc2f3e38da94907920713c04737a858f524406b2c
data/MIT-LICENSE CHANGED
@@ -1,20 +1,20 @@
1
- Copyright 2020 BradPotts
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.
1
+ Copyright 2020 BradPotts
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 CHANGED
@@ -1,28 +1 @@
1
- # PhcdevworksScripts
2
- Short description and motivation.
3
-
4
- ## Usage
5
- How to use my plugin.
6
-
7
- ## Installation
8
- Add this line to your application's Gemfile:
9
-
10
- ```ruby
11
- gem 'phcdevworks_scripts'
12
- ```
13
-
14
- And then execute:
15
- ```bash
16
- $ bundle
17
- ```
18
-
19
- Or install it yourself as:
20
- ```bash
21
- $ gem install phcdevworks_scripts
22
- ```
23
-
24
- ## Contributing
25
- Contribution directions go here.
26
-
27
- ## License
28
- The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
1
+ [![Gem Version](https://badge.fury.io/rb/phcdevworks_scripts.svg)](https://badge.fury.io/rb/phcdevworks_scripts)
data/Rakefile CHANGED
@@ -1,8 +1,8 @@
1
- require "bundler/setup"
2
-
3
- APP_RAKEFILE = File.expand_path("spec/test_app/Rakefile", __dir__)
4
- load "rails/tasks/engine.rake"
5
-
6
- load "rails/tasks/statistics.rake"
7
-
8
- require "bundler/gem_tasks"
1
+ require "bundler/setup"
2
+
3
+ APP_RAKEFILE = File.expand_path("spec/test_app/Rakefile", __dir__)
4
+ load "rails/tasks/engine.rake"
5
+
6
+ load "rails/tasks/statistics.rake"
7
+
8
+ require "bundler/gem_tasks"
@@ -1,3 +1,3 @@
1
- //= link_directory ../stylesheets/phcdevworks_scripts .scss
2
- //= link phcthemes_admin_panel_pack_coloradmin.css
3
- //= link phcthemes_admin_panel_pack_coloradmin.js
1
+ //= link_directory ../stylesheets/phcdevworks_scripts .scss
2
+ //= link phcthemes_admin_panel_pack_coloradmin.css
3
+ //= link phcthemes_admin_panel_pack_coloradmin.js
@@ -1,15 +1,15 @@
1
- /*
2
- * This is a manifest file that'll be compiled into application.css, which will include all the files
3
- * listed below.
4
- *
5
- * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
- * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
7
- *
8
- * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
- * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
10
- * files in this directory. Styles in this file should be added after the last require_* statement.
11
- * It is generally better to create a new file per style scope.
12
- *
13
- *= require_tree .
14
- *= require_self
15
- */
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
+ * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
10
+ * files in this directory. Styles in this file should be added after the last require_* statement.
11
+ * It is generally better to create a new file per style scope.
12
+ *
13
+ *= require_tree .
14
+ *= require_self
15
+ */
@@ -1,3 +1,3 @@
1
- // Place all the styles related to the script::authors controller here.
2
- // They will automatically be included in application.css.
3
- // You can use Sass (SCSS) here: https://sass-lang.com/
1
+ // Place all the styles related to the script::authors controller here.
2
+ // They will automatically be included in application.css.
3
+ // You can use Sass (SCSS) here: https://sass-lang.com/
@@ -1,3 +1,3 @@
1
- // Place all the styles related to the script::extensions controller here.
2
- // They will automatically be included in application.css.
3
- // You can use Sass (SCSS) here: https://sass-lang.com/
1
+ // Place all the styles related to the script::extensions controller here.
2
+ // They will automatically be included in application.css.
3
+ // You can use Sass (SCSS) here: https://sass-lang.com/
@@ -1,3 +1,3 @@
1
- // Place all the styles related to the script::listings controller here.
2
- // They will automatically be included in application.css.
3
- // You can use Sass (SCSS) here: https://sass-lang.com/
1
+ // Place all the styles related to the script::listings controller here.
2
+ // They will automatically be included in application.css.
3
+ // You can use Sass (SCSS) here: https://sass-lang.com/
@@ -1,3 +1,3 @@
1
- // Place all the styles related to the script::urls controller here.
2
- // They will automatically be included in application.css.
3
- // You can use Sass (SCSS) here: https://sass-lang.com/
1
+ // Place all the styles related to the script::urls controller here.
2
+ // They will automatically be included in application.css.
3
+ // You can use Sass (SCSS) here: https://sass-lang.com/
@@ -1,3 +1,3 @@
1
- // Place all the styles related to the script::versions controller here.
2
- // They will automatically be included in application.css.
3
- // You can use Sass (SCSS) here: https://sass-lang.com/
1
+ // Place all the styles related to the script::versions controller here.
2
+ // They will automatically be included in application.css.
3
+ // You can use Sass (SCSS) here: https://sass-lang.com/
@@ -1,3 +1,3 @@
1
- // Place all the styles related to the snippet::posts controller here.
2
- // They will automatically be included in application.css.
3
- // You can use Sass (SCSS) here: https://sass-lang.com/
1
+ // Place all the styles related to the snippet::posts controller here.
2
+ // They will automatically be included in application.css.
3
+ // You can use Sass (SCSS) here: https://sass-lang.com/
@@ -1,3 +1,3 @@
1
- // Place all the styles related to the snippet::urls controller here.
2
- // They will automatically be included in application.css.
3
- // You can use Sass (SCSS) here: https://sass-lang.com/
1
+ // Place all the styles related to the snippet::urls controller here.
2
+ // They will automatically be included in application.css.
3
+ // You can use Sass (SCSS) here: https://sass-lang.com/
@@ -1,13 +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
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
@@ -1,83 +1,83 @@
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::ScriptAuthorVersions.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
- @script_author.org_id = current_user.org_id
37
- respond_to do |format|
38
- if @script_author.save
39
- format.html { redirect_to script_authors_path, :flash => { :success => 'Author has been Added.' }}
40
- format.json { render :show, status: :created, location: @script_author }
41
- else
42
- format.html { render :new }
43
- format.json { render json: @script_author.errors, status: :unprocessable_entity }
44
- end
45
- end
46
- end
47
-
48
- # PATCH/PUT /script/authors/1
49
- def update
50
- respond_to do |format|
51
- if @script_author.update(script_author_params)
52
- format.html { redirect_to script_authors_path, :flash => { :notice => 'Author Name has been Updated.' }}
53
- format.json { render :show, status: :ok, location: @script_author }
54
- else
55
- format.html { render :edit }
56
- format.json { render json: @script_author.errors, status: :unprocessable_entity }
57
- end
58
- end
59
- end
60
-
61
- # DELETE /script/authors/1
62
- def destroy
63
- @script_author.destroy
64
- respond_to do |format|
65
- format.html { redirect_to script_authors_path, :flash => { :error => 'Category 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_author
74
- @script_author = Script::Author.friendly.find(params[:id])
75
- end
76
-
77
- # Whitelist
78
- def script_author_params
79
- params.require(:script_author).permit(:script_author_first_name, :script_author_last_name, :script_author_website, :script_author_github, :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::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::ScriptAuthorVersions.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
+ @script_author.org_id = current_user.org_id
37
+ respond_to do |format|
38
+ if @script_author.save
39
+ format.html { redirect_to script_authors_path, :flash => { :success => 'Author has been Added.' }}
40
+ format.json { render :show, status: :created, location: @script_author }
41
+ else
42
+ format.html { render :new }
43
+ format.json { render json: @script_author.errors, status: :unprocessable_entity }
44
+ end
45
+ end
46
+ end
47
+
48
+ # PATCH/PUT /script/authors/1
49
+ def update
50
+ respond_to do |format|
51
+ if @script_author.update(script_author_params)
52
+ format.html { redirect_to script_authors_path, :flash => { :notice => 'Author Name has been Updated.' }}
53
+ format.json { render :show, status: :ok, location: @script_author }
54
+ else
55
+ format.html { render :edit }
56
+ format.json { render json: @script_author.errors, status: :unprocessable_entity }
57
+ end
58
+ end
59
+ end
60
+
61
+ # DELETE /script/authors/1
62
+ def destroy
63
+ @script_author.destroy
64
+ respond_to do |format|
65
+ format.html { redirect_to script_authors_path, :flash => { :error => 'Category 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_author
74
+ @script_author = Script::Author.friendly.find(params[:id])
75
+ end
76
+
77
+ # Whitelist
78
+ def script_author_params
79
+ params.require(:script_author).permit(:script_author_first_name, :script_author_last_name, :script_author_website, :script_author_github, :slug, :user_id, :org_id)
80
+ end
81
+
82
+ end
83
+ end
@@ -1,83 +1,83 @@
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::ScriptExtensionVersions.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
- @script_extension.org_id = current_user.org_id
37
- respond_to do |format|
38
- if @script_extension.save
39
- format.html { redirect_to script_extensions_path, :flash => { :success => 'Script Extension has been Added.' }}
40
- format.json { render :show, status: :created, location: @script_extension }
41
- else
42
- format.html { render :new }
43
- format.json { render json: @script_extension.errors, status: :unprocessable_entity }
44
- end
45
- end
46
- end
47
-
48
- # PATCH/PUT /script/extensions/1
49
- def update
50
- respond_to do |format|
51
- if @script_extension.update(script_extension_params)
52
- format.html { redirect_to script_extensions_path, :flash => { :notice => 'Script Extension Name has been Updated.' }}
53
- format.json { render :show, status: :ok, location: @script_extension }
54
- else
55
- format.html { render :edit }
56
- format.json { render json: @script_extension.errors, status: :unprocessable_entity }
57
- end
58
- end
59
- end
60
-
61
- # DELETE /script/extensions/1
62
- def destroy
63
- @script_extension.destroy
64
- respond_to do |format|
65
- format.html { redirect_to script_extensions_path, :flash => { :error => 'Script Extension 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_extension
74
- @script_extension = Script::Extension.friendly.find(params[:id])
75
- end
76
-
77
- # Whitelist
78
- def script_extension_params
79
- params.require(:script_extension).permit(:script_extension_name, :script_extension_description, :script_extension, :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::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::ScriptExtensionVersions.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
+ @script_extension.org_id = current_user.org_id
37
+ respond_to do |format|
38
+ if @script_extension.save
39
+ format.html { redirect_to script_extensions_path, :flash => { :success => 'Script Extension has been Added.' }}
40
+ format.json { render :show, status: :created, location: @script_extension }
41
+ else
42
+ format.html { render :new }
43
+ format.json { render json: @script_extension.errors, status: :unprocessable_entity }
44
+ end
45
+ end
46
+ end
47
+
48
+ # PATCH/PUT /script/extensions/1
49
+ def update
50
+ respond_to do |format|
51
+ if @script_extension.update(script_extension_params)
52
+ format.html { redirect_to script_extensions_path, :flash => { :notice => 'Script Extension Name has been Updated.' }}
53
+ format.json { render :show, status: :ok, location: @script_extension }
54
+ else
55
+ format.html { render :edit }
56
+ format.json { render json: @script_extension.errors, status: :unprocessable_entity }
57
+ end
58
+ end
59
+ end
60
+
61
+ # DELETE /script/extensions/1
62
+ def destroy
63
+ @script_extension.destroy
64
+ respond_to do |format|
65
+ format.html { redirect_to script_extensions_path, :flash => { :error => 'Script Extension 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_extension
74
+ @script_extension = Script::Extension.friendly.find(params[:id])
75
+ end
76
+
77
+ # Whitelist
78
+ def script_extension_params
79
+ params.require(:script_extension).permit(:script_extension_name, :script_extension_description, :script_extension, :slug, :user_id, :org_id)
80
+ end
81
+
82
+ end
83
+ end