bullet_train-super_scaffolding-templates 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +28 -0
  4. data/Rakefile +8 -0
  5. data/app/assets/config/bullet_train_super_scaffolding_templates_manifest.js +0 -0
  6. data/app/controllers/account/scaffolding/absolutely_abstract/creative_concepts/collaborators_controller.rb +81 -0
  7. data/app/controllers/account/scaffolding/absolutely_abstract/creative_concepts_controller.rb +84 -0
  8. data/app/controllers/account/scaffolding/completely_concrete/tangible_things_controller.rb +107 -0
  9. data/app/controllers/concerns/scaffolding/absolutely_abstract/creative_concepts/controller_support.rb +11 -0
  10. data/app/models/scaffolding/absolutely_abstract/creative_concept.rb +42 -0
  11. data/app/models/scaffolding/absolutely_abstract/creative_concepts/collaborator.rb +39 -0
  12. data/app/models/scaffolding/absolutely_abstract/creative_concepts.rb +5 -0
  13. data/app/models/scaffolding/absolutely_abstract.rb +5 -0
  14. data/app/models/scaffolding/completely_concrete/tangible_thing.rb +42 -0
  15. data/app/models/scaffolding/completely_concrete/tangible_things/assignment.rb +22 -0
  16. data/app/models/scaffolding/completely_concrete/tangible_things.rb +5 -0
  17. data/app/models/scaffolding/completely_concrete.rb +5 -0
  18. data/app/serializers/api/v1/scaffolding/absolutely_abstract/creative_concept_serializer.rb +14 -0
  19. data/app/serializers/api/v1/scaffolding/completely_concrete/tangible_thing_serializer.rb +30 -0
  20. data/app/views/account/scaffolding/absolutely_abstract/creative_concepts/_breadcrumbs.html.erb +8 -0
  21. data/app/views/account/scaffolding/absolutely_abstract/creative_concepts/_creative_concept.json.jbuilder +8 -0
  22. data/app/views/account/scaffolding/absolutely_abstract/creative_concepts/_form.html.erb +18 -0
  23. data/app/views/account/scaffolding/absolutely_abstract/creative_concepts/_index.html.erb +56 -0
  24. data/app/views/account/scaffolding/absolutely_abstract/creative_concepts/_menu_item.html.erb +10 -0
  25. data/app/views/account/scaffolding/absolutely_abstract/creative_concepts/collaborators/_breadcrumbs.html.erb +8 -0
  26. data/app/views/account/scaffolding/absolutely_abstract/creative_concepts/collaborators/_collaborator.json.jbuilder +9 -0
  27. data/app/views/account/scaffolding/absolutely_abstract/creative_concepts/collaborators/_form.html.erb +19 -0
  28. data/app/views/account/scaffolding/absolutely_abstract/creative_concepts/collaborators/_index.html.erb +69 -0
  29. data/app/views/account/scaffolding/absolutely_abstract/creative_concepts/collaborators/_menu_item.html.erb +10 -0
  30. data/app/views/account/scaffolding/absolutely_abstract/creative_concepts/collaborators/edit.html.erb +12 -0
  31. data/app/views/account/scaffolding/absolutely_abstract/creative_concepts/collaborators/index.html.erb +6 -0
  32. data/app/views/account/scaffolding/absolutely_abstract/creative_concepts/collaborators/index.json.jbuilder +1 -0
  33. data/app/views/account/scaffolding/absolutely_abstract/creative_concepts/collaborators/new.html.erb +12 -0
  34. data/app/views/account/scaffolding/absolutely_abstract/creative_concepts/collaborators/show.html.erb +31 -0
  35. data/app/views/account/scaffolding/absolutely_abstract/creative_concepts/collaborators/show.json.jbuilder +1 -0
  36. data/app/views/account/scaffolding/absolutely_abstract/creative_concepts/edit.html.erb +12 -0
  37. data/app/views/account/scaffolding/absolutely_abstract/creative_concepts/index.html.erb +6 -0
  38. data/app/views/account/scaffolding/absolutely_abstract/creative_concepts/index.json.jbuilder +1 -0
  39. data/app/views/account/scaffolding/absolutely_abstract/creative_concepts/new.html.erb +12 -0
  40. data/app/views/account/scaffolding/absolutely_abstract/creative_concepts/show.html.erb +65 -0
  41. data/app/views/account/scaffolding/absolutely_abstract/creative_concepts/show.json.jbuilder +1 -0
  42. data/app/views/account/scaffolding/completely_concrete/tangible_things/_breadcrumbs.html.erb +8 -0
  43. data/app/views/account/scaffolding/completely_concrete/tangible_things/_form.html.erb +66 -0
  44. data/app/views/account/scaffolding/completely_concrete/tangible_things/_index.html.erb +72 -0
  45. data/app/views/account/scaffolding/completely_concrete/tangible_things/_menu_item.html.erb +10 -0
  46. data/app/views/account/scaffolding/completely_concrete/tangible_things/_tangible_thing.json.jbuilder +23 -0
  47. data/app/views/account/scaffolding/completely_concrete/tangible_things/edit.html.erb +12 -0
  48. data/app/views/account/scaffolding/completely_concrete/tangible_things/index.html.erb +6 -0
  49. data/app/views/account/scaffolding/completely_concrete/tangible_things/index.json.jbuilder +1 -0
  50. data/app/views/account/scaffolding/completely_concrete/tangible_things/new.html.erb +12 -0
  51. data/app/views/account/scaffolding/completely_concrete/tangible_things/show.html.erb +45 -0
  52. data/app/views/account/scaffolding/completely_concrete/tangible_things/show.json.jbuilder +1 -0
  53. data/config/locales/en/scaffolding/absolutely_abstract/creative_concepts/collaborators.en.yml +98 -0
  54. data/config/locales/en/scaffolding/absolutely_abstract/creative_concepts.en.yml +111 -0
  55. data/config/locales/en/scaffolding/completely_concrete/tangible_things.en.yml +229 -0
  56. data/config/routes.rb +2 -0
  57. data/db/migrate/20190124040656_add_csv_import_to_scaffolding_things.rb +5 -0
  58. data/db/migrate/20191021215724_add_example_fields_to_scaffolding_things.rb +14 -0
  59. data/db/migrate/20191021233425_add_ckeditor_value_to_scaffolding_things.rb +5 -0
  60. data/db/migrate/20191204020251_create_scaffolding_absolutely_abstract_creative_concepts.rb +11 -0
  61. data/db/migrate/20191204020913_create_scaffolding_completely_concrete_tangible_things.rb +21 -0
  62. data/db/migrate/20191225224034_add_sort_order_to_scaffolding_completely_concrete_tangible_things.rb +5 -0
  63. data/db/migrate/20200101203645_drop_scaffolding_things.rb +9 -0
  64. data/db/migrate/20210101210524_create_scaffolding_absolutely_abstract_creative_concepts_collaborators.rb +10 -0
  65. data/db/migrate/20210101231429_add_roles_to_scaffolding_absolutely_abstract_creative_concepts_collaborators.rb +5 -0
  66. data/db/migrate/20210224234445_remove_select_value_from_scaffolding_completely_concrete_tangible_things.rb +5 -0
  67. data/db/migrate/20210513013030_add_color_value_to_scaffolding_completely_concrete_tangible_things.rb +5 -0
  68. data/db/migrate/20210602230736_add_option_fields_to_scaffolding_completely_concrete_tangible_things.rb +6 -0
  69. data/lib/bullet_train/super_scaffolding/templates/engine.rb +8 -0
  70. data/lib/bullet_train/super_scaffolding/templates/version.rb +7 -0
  71. data/lib/bullet_train/super_scaffolding/templates.rb +10 -0
  72. data/lib/tasks/bullet_train/super_scaffolding/templates_tasks.rake +4 -0
  73. metadata +130 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 799004993a3b6d6944ac0b938360c4403aac4c73a3475e53e16aa5dc26f57f6a
4
+ data.tar.gz: d7b253fd1d5a88a62e6973fb6ea48f8a5d4b240819b466106c0a920869429395
5
+ SHA512:
6
+ metadata.gz: 919ece0a94a00faabca72f04d6e19d3eb2463576fe8918aebff47564d8c0b45a291234c59fca51d3ae7d36c88fa98814621bfe19d2c9d89f3d59935a64dc38d5
7
+ data.tar.gz: '03865ca5306ec1640839ffed47870b46211c8f03cd9c67de28a5fe20ba17a4b88cdf88ee266389acf2a83b2ad49a8ec89620adcf29f5a9b97a2ec6286d3f41ca'
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2022 Andrew Culver
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,28 @@
1
+ # BulletTrain::SuperScaffolding::Templates
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 "bullet_train-super_scaffolding-templates"
12
+ ```
13
+
14
+ And then execute:
15
+ ```bash
16
+ $ bundle
17
+ ```
18
+
19
+ Or install it yourself as:
20
+ ```bash
21
+ $ gem install bullet_train-super_scaffolding-templates
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).
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ require "bundler/setup"
2
+
3
+ APP_RAKEFILE = File.expand_path("test/dummy/Rakefile", __dir__)
4
+ load "rails/tasks/engine.rake"
5
+
6
+ load "rails/tasks/statistics.rake"
7
+
8
+ require "bundler/gem_tasks"
@@ -0,0 +1,81 @@
1
+ class Account::Scaffolding::AbsolutelyAbstract::CreativeConcepts::CollaboratorsController < Account::ApplicationController
2
+ account_load_and_authorize_resource :collaborator, through: :creative_concept, through_association: :collaborators
3
+
4
+ # GET /account/scaffolding/absolutely_abstract/creative_concepts/:creative_concept_id/collaborators
5
+ # GET /account/scaffolding/absolutely_abstract/creative_concepts/:creative_concept_id/collaborators.json
6
+ def index
7
+ redirect_to [:account, @creative_concept]
8
+ end
9
+
10
+ # GET /account/scaffolding/absolutely_abstract/creative_concepts/collaborators/:id
11
+ # GET /account/scaffolding/absolutely_abstract/creative_concepts/collaborators/:id.json
12
+ def show
13
+ redirect_to [:account, @creative_concept]
14
+ end
15
+
16
+ # GET /account/scaffolding/absolutely_abstract/creative_concepts/:creative_concept_id/collaborators/new
17
+ def new
18
+ end
19
+
20
+ # GET /account/scaffolding/absolutely_abstract/creative_concepts/collaborators/:id/edit
21
+ def edit
22
+ end
23
+
24
+ # POST /account/scaffolding/absolutely_abstract/creative_concepts/:creative_concept_id/collaborators
25
+ # POST /account/scaffolding/absolutely_abstract/creative_concepts/:creative_concept_id/collaborators.json
26
+ def create
27
+ respond_to do |format|
28
+ if @collaborator.save
29
+ format.html { redirect_to [:account, @creative_concept, :collaborators], notice: I18n.t("scaffolding/absolutely_abstract/creative_concepts/collaborators.notifications.created") }
30
+ format.json { render :show, status: :created, location: [:account, @collaborator] }
31
+ else
32
+ format.html { render :new, status: :unprocessable_entity }
33
+ format.json { render json: @collaborator.errors, status: :unprocessable_entity }
34
+ end
35
+ end
36
+ end
37
+
38
+ # PATCH/PUT /account/scaffolding/absolutely_abstract/creative_concepts/collaborators/:id
39
+ # PATCH/PUT /account/scaffolding/absolutely_abstract/creative_concepts/collaborators/:id.json
40
+ def update
41
+ respond_to do |format|
42
+ if @collaborator.update(collaborator_params)
43
+ format.html { redirect_to [:account, @collaborator], notice: I18n.t("scaffolding/absolutely_abstract/creative_concepts/collaborators.notifications.updated") }
44
+ format.json { render :show, status: :ok, location: [:account, @collaborator] }
45
+ else
46
+ format.html { render :edit, status: :unprocessable_entity }
47
+ format.json { render json: @collaborator.errors, status: :unprocessable_entity }
48
+ end
49
+ end
50
+ end
51
+
52
+ # DELETE /account/scaffolding/absolutely_abstract/creative_concepts/collaborators/:id
53
+ # DELETE /account/scaffolding/absolutely_abstract/creative_concepts/collaborators/:id.json
54
+ def destroy
55
+ @collaborator.destroy
56
+ respond_to do |format|
57
+ format.html { redirect_to [:account, @creative_concept, :collaborators], notice: I18n.t("scaffolding/absolutely_abstract/creative_concepts/collaborators.notifications.destroyed") }
58
+ format.json { head :no_content }
59
+ end
60
+ end
61
+
62
+ private
63
+
64
+ # Never trust parameters from the scary internet, only allow the white list through.
65
+ def collaborator_params
66
+ role_ids = params.dig(:scaffolding_absolutely_abstract_creative_concepts_collaborator, :role_ids)
67
+ role_ids = [role_ids] unless role_ids.is_a?(Array)
68
+ params[:scaffolding_absolutely_abstract_creative_concepts_collaborator][:role_ids] = role_ids
69
+ strong_params = params.require(:scaffolding_absolutely_abstract_creative_concepts_collaborator).permit(
70
+ :membership_id,
71
+ # 🚅 super scaffolding will insert new fields above this line.
72
+ role_ids: [],
73
+ # 🚅 super scaffolding will insert new arrays above this line.
74
+ )
75
+
76
+ assign_checkboxes(strong_params, :roles)
77
+ # 🚅 super scaffolding will insert processing for new fields above this line.
78
+
79
+ strong_params
80
+ end
81
+ end
@@ -0,0 +1,84 @@
1
+ class Account::Scaffolding::AbsolutelyAbstract::CreativeConceptsController < Account::ApplicationController
2
+ include Scaffolding::AbsolutelyAbstract::CreativeConcepts::ControllerSupport
3
+
4
+ account_load_and_authorize_resource :creative_concept, through: :team, through_association: :scaffolding_absolutely_abstract_creative_concepts
5
+
6
+ # GET /account/teams/:team_id/scaffolding/absolutely_abstract/creative_concepts
7
+ # GET /account/teams/:team_id/scaffolding/absolutely_abstract/creative_concepts.json
8
+ def index
9
+ # since we're showing creative_concepts on the team show page by default,
10
+ # we might as well just go there.
11
+ # redirect_to [:account, @team]
12
+ end
13
+
14
+ # GET /account/scaffolding/absolutely_abstract/creative_concepts/:id
15
+ # GET /account/scaffolding/absolutely_abstract/creative_concepts/:id.json
16
+ def show
17
+ end
18
+
19
+ # GET /account/teams/:team_id/scaffolding/absolutely_abstract/creative_concepts/new
20
+ def new
21
+ end
22
+
23
+ # GET /account/scaffolding/absolutely_abstract/creative_concepts/:id/edit
24
+ def edit
25
+ end
26
+
27
+ # POST /account/teams/:team_id/scaffolding/absolutely_abstract/creative_concepts
28
+ # POST /account/teams/:team_id/scaffolding/absolutely_abstract/creative_concepts.json
29
+ def create
30
+ respond_to do |format|
31
+ if @creative_concept.save
32
+
33
+ # any user adding a creative concept should be able to manage it.
34
+ ensure_current_user_can_manage_creative_concept @creative_concept
35
+
36
+ format.html { redirect_to [:account, @creative_concept], notice: I18n.t("scaffolding/absolutely_abstract/creative_concepts.notifications.created") }
37
+ format.json { render :show, status: :created, location: [:account, @team, @creative_concept] }
38
+ else
39
+ format.html { render :new, status: :unprocessable_entity }
40
+ format.json { render json: @creative_concept.errors, status: :unprocessable_entity }
41
+ end
42
+ end
43
+ end
44
+
45
+ # PATCH/PUT /account/scaffolding/absolutely_abstract/creative_concepts/:id
46
+ # PATCH/PUT /account/scaffolding/absolutely_abstract/creative_concepts/:id.json
47
+ def update
48
+ respond_to do |format|
49
+ if @creative_concept.update(creative_concept_params)
50
+ format.html { redirect_to [:account, @creative_concept], notice: I18n.t("scaffolding/absolutely_abstract/creative_concepts.notifications.updated") }
51
+ format.json { render :show, status: :ok, location: [:account, @creative_concept] }
52
+ else
53
+ format.html { render :edit, status: :unprocessable_entity }
54
+ format.json { render json: @creative_concept.errors, status: :unprocessable_entity }
55
+ end
56
+ end
57
+ end
58
+
59
+ # DELETE /account/scaffolding/absolutely_abstract/creative_concepts/:id
60
+ # DELETE /account/scaffolding/absolutely_abstract/creative_concepts/:id.json
61
+ def destroy
62
+ @creative_concept.destroy
63
+ respond_to do |format|
64
+ format.html { redirect_to [:account, @team, :scaffolding, :absolutely_abstract, :creative_concepts], notice: I18n.t("scaffolding/absolutely_abstract/creative_concepts.notifications.destroyed") }
65
+ format.json { head :no_content }
66
+ end
67
+ end
68
+
69
+ private
70
+
71
+ # Never trust parameters from the scary internet, only allow the white list through.
72
+ def creative_concept_params
73
+ strong_params = params.require(:scaffolding_absolutely_abstract_creative_concept).permit(
74
+ :name,
75
+ :description,
76
+ # 🚅 super scaffolding will insert new fields above this line.
77
+ # 🚅 super scaffolding will insert new arrays above this line.
78
+ )
79
+
80
+ # 🚅 super scaffolding will insert processing for new fields above this line.
81
+
82
+ strong_params
83
+ end
84
+ end
@@ -0,0 +1,107 @@
1
+ class Account::Scaffolding::CompletelyConcrete::TangibleThingsController < Account::ApplicationController
2
+ account_load_and_authorize_resource :tangible_thing, through: :absolutely_abstract_creative_concept, through_association: :completely_concrete_tangible_things
3
+
4
+ # GET /account/scaffolding/absolutely_abstract/creative_concepts/:absolutely_abstract_creative_concept_id/completely_concrete/tangible_things
5
+ # GET /account/scaffolding/absolutely_abstract/creative_concepts/:absolutely_abstract_creative_concept_id/completely_concrete/tangible_things.json
6
+ def index
7
+ # if you only want these objects shown on their parent's show page, uncomment this:
8
+ # redirect_to [:account, @absolutely_abstract_creative_concept]
9
+ end
10
+
11
+ # GET /account/scaffolding/completely_concrete/tangible_things/:id
12
+ # GET /account/scaffolding/completely_concrete/tangible_things/:id.json
13
+ def show
14
+ end
15
+
16
+ # GET /account/scaffolding/absolutely_abstract/creative_concepts/:absolutely_abstract_creative_concept_id/completely_concrete/tangible_things/new
17
+ def new
18
+ end
19
+
20
+ # GET /account/scaffolding/completely_concrete/tangible_things/:id/edit
21
+ def edit
22
+ end
23
+
24
+ # POST /account/scaffolding/absolutely_abstract/creative_concepts/:absolutely_abstract_creative_concept_id/completely_concrete/tangible_things
25
+ # POST /account/scaffolding/absolutely_abstract/creative_concepts/:absolutely_abstract_creative_concept_id/completely_concrete/tangible_things.json
26
+ def create
27
+ respond_to do |format|
28
+ if @tangible_thing.save
29
+ format.html { redirect_to [:account, @absolutely_abstract_creative_concept, :completely_concrete_tangible_things], notice: I18n.t("scaffolding/completely_concrete/tangible_things.notifications.created") }
30
+ format.json { render :show, status: :created, location: [:account, @tangible_thing] }
31
+ else
32
+ format.html { render :new, status: :unprocessable_entity }
33
+ format.json { render json: @tangible_thing.errors, status: :unprocessable_entity }
34
+ end
35
+ end
36
+ end
37
+
38
+ # PATCH/PUT /account/scaffolding/completely_concrete/tangible_things/:id
39
+ # PATCH/PUT /account/scaffolding/completely_concrete/tangible_things/:id.json
40
+ def update
41
+ respond_to do |format|
42
+ if @tangible_thing.update(tangible_thing_params)
43
+ format.html { redirect_to [:account, @tangible_thing], notice: I18n.t("scaffolding/completely_concrete/tangible_things.notifications.updated") }
44
+ format.json { render :show, status: :ok, location: [:account, @tangible_thing] }
45
+ else
46
+ format.html { render :edit, status: :unprocessable_entity }
47
+ format.json { render json: @tangible_thing.errors, status: :unprocessable_entity }
48
+ end
49
+ end
50
+ end
51
+
52
+ # DELETE /account/scaffolding/completely_concrete/tangible_things/:id
53
+ # DELETE /account/scaffolding/completely_concrete/tangible_things/:id.json
54
+ def destroy
55
+ @tangible_thing.destroy
56
+ respond_to do |format|
57
+ format.html { redirect_to [:account, @absolutely_abstract_creative_concept, :completely_concrete_tangible_things], notice: I18n.t("scaffolding/completely_concrete/tangible_things.notifications.destroyed") }
58
+ format.json { head :no_content }
59
+ end
60
+ end
61
+
62
+ private
63
+
64
+ # Never trust parameters from the scary internet, only allow the white list through.
65
+ def tangible_thing_params
66
+ strong_params = params.require(:scaffolding_completely_concrete_tangible_thing).permit(
67
+ # 🚅 skip this section when scaffolding.
68
+ :text_field_value,
69
+ :action_text_value,
70
+ :boolean_button_value,
71
+ :button_value,
72
+ :color_picker_value,
73
+ :ckeditor_value,
74
+ :cloudinary_image_value,
75
+ :date_field_value,
76
+ :date_and_time_field_value,
77
+ :date_and_time_field_value_time_zone,
78
+ :email_field_value,
79
+ :file_field_value,
80
+ :file_field_value_removal,
81
+ :option_value,
82
+ :password_field_value,
83
+ :phone_field_value,
84
+ :super_select_value,
85
+ :text_area_value,
86
+ # 🚅 stop any skipping we're doing now.
87
+ # 🚅 super scaffolding will insert new fields above this line.
88
+ # 🚅 skip this section when scaffolding.
89
+ multiple_button_values: [],
90
+ multiple_option_values: [],
91
+ multiple_super_select_values: [],
92
+ # 🚅 stop any skipping we're doing now.
93
+ # 🚅 super scaffolding will insert new arrays above this line.
94
+ )
95
+
96
+ # 🚅 skip this section when scaffolding.
97
+ assign_boolean(strong_params, :boolean_button_value)
98
+ assign_date_and_time(strong_params, :date_and_time_field_value)
99
+ assign_checkboxes(strong_params, :multiple_button_values)
100
+ assign_checkboxes(strong_params, :multiple_option_values)
101
+ assign_select_options(strong_params, :multiple_super_select_values)
102
+ # 🚅 stop any skipping we're doing now.
103
+ # 🚅 super scaffolding will insert processing for new fields above this line.
104
+
105
+ strong_params
106
+ end
107
+ end
@@ -0,0 +1,11 @@
1
+ module Scaffolding::AbsolutelyAbstract::CreativeConcepts::ControllerSupport
2
+ extend ActiveSupport::Concern
3
+
4
+ def ensure_current_user_can_manage_creative_concept(creative_concept)
5
+ unless can? :manage, creative_concept
6
+ collaborator = creative_concept.collaborators.find_or_create_by(membership: current_membership)
7
+ collaborator.roles << :admin
8
+ collaborator.save
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,42 @@
1
+ class Scaffolding::AbsolutelyAbstract::CreativeConcept < ApplicationRecord
2
+ # 🚅 add concerns above.
3
+
4
+ belongs_to :team
5
+ # 🚅 add belongs_to associations above.
6
+
7
+ has_many :completely_concrete_tangible_things, class_name: "Scaffolding::CompletelyConcrete::TangibleThing", foreign_key: :absolutely_abstract_creative_concept_id, dependent: :destroy
8
+ has_many :collaborators, class_name: "Scaffolding::AbsolutelyAbstract::CreativeConcepts::Collaborator", dependent: :destroy, foreign_key: :creative_concept_id
9
+ has_many :memberships, through: :collaborators
10
+ # 🚅 add has_many associations above.
11
+
12
+ # 🚅 add oauth providers above.
13
+
14
+ # 🚅 add has_one associations above.
15
+
16
+ # 🚅 add scopes above.
17
+
18
+ validates :name, presence: true
19
+ # 🚅 add validations above.
20
+
21
+ # 🚅 add callbacks above.
22
+
23
+ # 🚅 add delegations above.
24
+
25
+ def admins
26
+ collaborators.admins.map(&:membership)
27
+ end
28
+
29
+ def editors
30
+ collaborators.editors.map(&:membership)
31
+ end
32
+
33
+ def viewers
34
+ collaborators.viewers.map(&:membership)
35
+ end
36
+
37
+ def all_collaborators
38
+ team.admins.or(Membership.where(id: memberships.pluck(:id)))
39
+ end
40
+
41
+ # 🚅 add methods above.
42
+ end
@@ -0,0 +1,39 @@
1
+ class Scaffolding::AbsolutelyAbstract::CreativeConcepts::Collaborator < ApplicationRecord
2
+ include Roles::Support
3
+ # 🚅 add concerns above.
4
+
5
+ belongs_to :creative_concept
6
+ belongs_to :membership
7
+ # 🚅 add belongs_to associations above.
8
+
9
+ # 🚅 add has_many associations above.
10
+
11
+ has_one :team, through: :creative_concept
12
+ has_one :user, through: :membership
13
+ # 🚅 add has_one associations above.
14
+
15
+ # 🚅 add scopes above.
16
+
17
+ validates :membership_id, presence: true
18
+ validate :validate_membership
19
+ # 🚅 add validations above.
20
+
21
+ # 🚅 add callbacks above.
22
+
23
+ # 🚅 add delegations above.
24
+
25
+ def valid_memberships
26
+ team.memberships.current_and_invited
27
+ end
28
+
29
+ def validate_membership
30
+ if membership_id.present?
31
+ # don't allow users to assign the ids of other teams' or users' resources to this attribute.
32
+ unless valid_memberships.ids.include?(membership_id)
33
+ errors.add(:membership_id, :invalid)
34
+ end
35
+ end
36
+ end
37
+
38
+ # 🚅 add methods above.
39
+ end
@@ -0,0 +1,5 @@
1
+ module Scaffolding::AbsolutelyAbstract::CreativeConcepts
2
+ def self.table_name_prefix
3
+ "scaffolding_absolutely_abstract_creative_concepts_"
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ module Scaffolding::AbsolutelyAbstract
2
+ def self.table_name_prefix
3
+ "scaffolding_absolutely_abstract_"
4
+ end
5
+ end
@@ -0,0 +1,42 @@
1
+ class Scaffolding::CompletelyConcrete::TangibleThing < ApplicationRecord
2
+ # 🚅 add concerns above.
3
+
4
+ belongs_to :absolutely_abstract_creative_concept, class_name: "Scaffolding::AbsolutelyAbstract::CreativeConcept"
5
+ # 🚅 add belongs_to associations above.
6
+
7
+ has_many :assignments, class_name: "Scaffolding::CompletelyConcrete::TangibleThings::Assignment", dependent: :destroy
8
+ has_many :memberships, through: :assignments
9
+ # 🚅 add has_many associations above.
10
+
11
+ # 🚅 add oauth providers above.
12
+
13
+ has_one_attached :file_field_value
14
+ has_one :team, through: :absolutely_abstract_creative_concept
15
+ # 🚅 add has_one associations above.
16
+
17
+ # 🚅 add scopes above.
18
+
19
+ validates :text_field_value, presence: true
20
+ # 🚅 add validations above.
21
+
22
+ after_validation :remove_file_field_value, if: :file_field_value_removal?
23
+ # 🚅 add callbacks above.
24
+
25
+ # 🚅 add delegations above.
26
+
27
+ has_rich_text :action_text_value
28
+ attr_accessor :file_field_value_removal
29
+
30
+ def collection
31
+ absolutely_abstract_creative_concept.completely_concrete_tangible_things
32
+ end
33
+
34
+ def file_field_value_removal?
35
+ file_field_value_removal.present?
36
+ end
37
+
38
+ def remove_file_field_value
39
+ file_field_value.purge
40
+ end
41
+ # 🚅 add methods above.
42
+ end
@@ -0,0 +1,22 @@
1
+ class Scaffolding::CompletelyConcrete::TangibleThings::Assignment < ApplicationRecord
2
+ # 🚅 add concerns above.
3
+
4
+ belongs_to :tangible_thing, class_name: "Scaffolding::CompletelyConcrete::TangibleThing"
5
+ belongs_to :membership, class_name: "Membership"
6
+ # 🚅 add belongs_to associations above.
7
+
8
+ # 🚅 add has_many associations above.
9
+
10
+ has_one :team, through: :tangible_thing
11
+ # 🚅 add has_one associations above.
12
+
13
+ # 🚅 add scopes above.
14
+
15
+ # 🚅 add validations above.
16
+
17
+ # 🚅 add callbacks above.
18
+
19
+ # 🚅 add delegations above.
20
+
21
+ # 🚅 add methods above.
22
+ end
@@ -0,0 +1,5 @@
1
+ module Scaffolding::CompletelyConcrete::TangibleThings
2
+ def self.table_name_prefix
3
+ "scaffolding_completely_concrete_tangible_things_"
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ module Scaffolding::CompletelyConcrete
2
+ def self.table_name_prefix
3
+ "scaffolding_completely_concrete_"
4
+ end
5
+ end
@@ -0,0 +1,14 @@
1
+ class Api::V1::Scaffolding::AbsolutelyAbstract::CreativeConceptSerializer < Api::V1::ApplicationSerializer
2
+ set_type "scaffolding/absolutely_abstract/creative_concept"
3
+
4
+ attributes :id,
5
+ :team_id,
6
+ :name,
7
+ :description,
8
+ # 🚅 super scaffolding will insert new fields above this line.
9
+ :created_at,
10
+ :updated_at
11
+
12
+ belongs_to :team, serializer: Api::V1::TeamSerializer
13
+ has_many :completely_concrete_tangible_things, serializer: Api::V1::Scaffolding::CompletelyConcrete::TangibleThingSerializer
14
+ end
@@ -0,0 +1,30 @@
1
+ class Api::V1::Scaffolding::CompletelyConcrete::TangibleThingSerializer < Api::V1::ApplicationSerializer
2
+ set_type "scaffolding/completely_concrete/tangible_thing"
3
+
4
+ attributes :id,
5
+ :absolutely_abstract_creative_concept_id,
6
+ # 🚅 skip this section when scaffolding.
7
+ :text_field_value,
8
+ :button_value,
9
+ :multiple_button_values,
10
+ :color_picker_value,
11
+ :cloudinary_image_value,
12
+ :date_field_value,
13
+ :date_and_time_field_value,
14
+ :email_field_value,
15
+ :password_field_value,
16
+ :phone_field_value,
17
+ :option_value,
18
+ # :multiple_option_values,
19
+ :super_select_value,
20
+ # :multiple_super_select_values,
21
+ # :text_area_value,
22
+ # :action_text_value,
23
+ # :ckeditor_value,
24
+ # 🚅 stop any skipping we're doing now.
25
+ # 🚅 super scaffolding will insert new fields above this line.
26
+ :created_at,
27
+ :updated_at
28
+
29
+ belongs_to :absolutely_abstract_creative_concept, serializer: Api::V1::Scaffolding::AbsolutelyAbstract::CreativeConceptSerializer
30
+ end
@@ -0,0 +1,8 @@
1
+ <% creative_concept ||= @creative_concept %>
2
+ <% team ||= @team || creative_concept&.team %>
3
+ <%= render 'account/teams/breadcrumbs', team: team %>
4
+ <%= render 'account/shared/breadcrumb', label: t('.label'), url: [:account, team, :scaffolding_absolutely_abstract_creative_concepts] %>
5
+ <% if creative_concept&.persisted? %>
6
+ <%= render 'account/shared/breadcrumb', label: creative_concept.label_string, url: [:account, creative_concept] %>
7
+ <% end %>
8
+ <%= render 'account/shared/breadcrumbs/actions', only_for: 'scaffolding/absolutely_abstract/creative_concepts' %>
@@ -0,0 +1,8 @@
1
+ json.extract! creative_concept,
2
+ :id,
3
+ :name,
4
+ :description,
5
+ # 🚅 super scaffolding will insert new fields above this line.
6
+ :created_at,
7
+ :updated_at
8
+ json.url account_scaffolding_absolutely_abstract_creative_concept_url(creative_concept, format: :json)
@@ -0,0 +1,18 @@
1
+ <%= form_with model: [:account, (@team unless creative_concept.persisted?), creative_concept], local: true, class: 'form' do |form| %>
2
+ <%= render 'account/shared/forms/errors', form: form %>
3
+
4
+ <% with_field_settings form: form do %>
5
+ <%= render 'shared/fields/text_field', method: :name, options: {autofocus: true} %>
6
+ <%= render 'shared/fields/text_area', method: :description %>
7
+ <%# 🚅 super scaffolding will insert new fields above this line. %>
8
+ <% end %>
9
+
10
+ <div class="buttons">
11
+ <%= form.submit (form.object.persisted? ? t('.buttons.update') : t('.buttons.create')), class: "button" %>
12
+ <% if form.object.persisted? %>
13
+ <%= link_to t('global.buttons.cancel'), [:account, creative_concept], class: "button-secondary" %>
14
+ <% else %>
15
+ <%= link_to t('global.buttons.cancel'), [:account, @team, :scaffolding, :absolutely_abstract, :creative_concepts], class: "button-secondary" %>
16
+ <% end %>
17
+ </div>
18
+ <% end %>