-
-
Notifications
You must be signed in to change notification settings - Fork 494
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
4396 packs 1 add custom request units at organizational level #4415
Closed
Eccatoe
wants to merge
8
commits into
main
from
4396-PACKS-1-add-custom-request-units-at-organizational-level
Closed
Changes from 4 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
3a2ed8b
WIP Added Custom request units at ogranizational level
Eccatoe ba7d8dd
Add unique validation to custom organization unit name
Eccatoe c299fa6
Added flipper conditionals and specs
Eccatoe f9b13f7
Fixed the button name and delete issue
srinikotla 506392b
Updated to allow organizations to delete units
Eccatoe 58ca320
Clean out some lint!
awwaiid 67f88f3
Merge remote-tracking branch 'origin/main' into 4396-PACKS-1-add-cust…
awwaiid 94b9360
Merge branch 'main' into 4396-PACKS-1-add-custom-request-units-at-org…
awwaiid File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<table class='table'> | ||
<thead> | ||
<tr> | ||
<th>Custom request units used (please use singular form -- e.g. pack, not packs)</th> | ||
</tr> | ||
</thead> | ||
<tbody id='request-fields'> | ||
<%= render 'units/unit_line_item' , f: f, object: :request_units %> | ||
</tbody> | ||
</table> | ||
<div> | ||
<%= add_element_button('Add Another Unit', container_selector: '#request-fields' ) do %> | ||
<%= render 'units/unit_line_item' , f: f, object: Unit.new %> | ||
<% end %> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<%= f.fields_for :request_units, defined?(object) ? object : nil do |field| %> | ||
<tr data-form-input-target="removeContainer" data-controller="form-input" id = "td-remove" > | ||
<td> | ||
<%= field.input_field :name, class: "form-control" %> | ||
</td> | ||
<td> | ||
<%= remove_element_button "Remove" , container_selector: '#td-remove'%> | ||
</td> | ||
</tr> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# == Schema Information | ||
# | ||
# Table name: units | ||
# | ||
# id :bigint not null, primary key | ||
# name :string not null | ||
# created_at :datetime not null | ||
# updated_at :datetime not null | ||
# organization_id :bigint | ||
# | ||
require "rails_helper" | ||
|
||
RSpec.describe Unit, type: :model do | ||
let!(:organization) { create(:organization)} | ||
let!(:unit_1) { create(:unit, name: "WolfPack", organization: organization)} | ||
|
||
describe "Validations" do | ||
it "validates uniqueness of name in context of organization" do | ||
expect { described_class.create!(name: "WolfPack", organization: organization) }.to raise_exception(ActiveRecord::RecordInvalid).with_message("Validation failed: Name has already been taken") | ||
end | ||
end | ||
|
||
describe "Associations" do | ||
it { should belong_to(:organization) } | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO deleting all units - needs fix