-
Notifications
You must be signed in to change notification settings - Fork 3
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
Feature/litigation sides edit #9
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
7063d00
litigation sides dynamic list
tsubik b339e13
fix select2 initialization after adding dynamic row
tsubik da835f8
connect litigation sides with location or company
tsubik 5c5b83f
update litigation side decorator
tsubik 41e602a
SAVEPOINT
tsubik a117d40
I think this is much clearer
tsubik 3d99501
litigation sides: nice default select
tsubik 4ead99d
polymorphic association instead of two columns
tsubik d578e68
adding missing specs
tsubik 0d14dc4
testing document uploads
tsubik 76461a4
fix import
tsubik 4290b48
add jurisdiction to litigation show
tsubik f2fde7b
fix styles
tsubik 44bf6aa
changing menu structure
tsubik 1fad9cc
addressing review comments
tsubik 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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
ActiveAdmin.register Document do | ||
menu priority: 3 | ||
menu priority: 6 | ||
|
||
decorate_with DocumentDecorator | ||
|
||
|
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
ActiveAdmin.register Location do | ||
menu priority: 3 | ||
menu priority: 1 | ||
|
||
decorate_with LocationDecorator | ||
|
||
|
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,17 @@ | ||
@mixin tablet { | ||
@media (min-width: $breakpoint-tablet) { | ||
@content; | ||
} | ||
} | ||
|
||
@mixin desktop { | ||
@media (min-width: $breakpoint-desktop) { | ||
@content; | ||
} | ||
} | ||
|
||
@mixin desktop-large { | ||
@media (min-width: $breakpoint-desktop-large) { | ||
@content; | ||
} | ||
} |
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 |
---|---|---|
@@ -1,11 +1,24 @@ | ||
class LitigationSideDecorator < Draper::Decorator | ||
delegate_all | ||
|
||
def name | ||
return h.link_to model.name, connected_entity_url if connected_entity.present? | ||
|
||
model.name | ||
end | ||
|
||
def party_type | ||
model.party_type&.humanize | ||
end | ||
|
||
def side_type | ||
model.side_type&.humanize | ||
end | ||
|
||
private | ||
|
||
def connected_entity_url | ||
return h.admin_company_path(connected_entity) if connected_entity.is_a?(Company) | ||
return h.admin_location_path(connected_entity) if connected_entity.is_a?(Location) | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { Controller } from 'stimulus'; | ||
|
||
const ENTITY_TYPE_PARTY_TYPE_MAP = { | ||
'Company': 'corporation', | ||
'Location': 'government' | ||
}; | ||
|
||
export default class extends Controller { | ||
connect() { | ||
$(this.connectedWithSelect).on('change', this._setDefaults.bind(this)); | ||
} | ||
|
||
_setDefaults() { | ||
if (this.connectedWithSelectedOption) { | ||
const entityType = this.connectedWithSelectedOption.value.split('-')[0]; | ||
const partyType = ENTITY_TYPE_PARTY_TYPE_MAP[entityType]; | ||
|
||
if (partyType) { | ||
$(this.partyTypeSelect).val(partyType); | ||
$(this.partyTypeSelect).trigger('change'); | ||
} | ||
|
||
this.nameInput.value = this.connectedWithSelectedOption.text; | ||
} | ||
} | ||
|
||
get connectedWithSelect () { | ||
return this.element.querySelector('select[id*="_connected_with"'); | ||
} | ||
|
||
get connectedWithSelectedOption () { | ||
return this.connectedWithSelect.selectedOptions && | ||
this.connectedWithSelect.selectedOptions.length && | ||
this.connectedWithSelect.selectedOptions[0]; | ||
} | ||
|
||
get nameInput() { | ||
return this.element.querySelector('input[id*="_name"'); | ||
} | ||
|
||
get partyTypeSelect() { | ||
return this.element.querySelector('select[id*="_party_type"'); | ||
} | ||
} |
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,24 @@ | ||
import { Controller } from 'stimulus'; | ||
|
||
export default class extends Controller { | ||
static targets = ['activeTab'] | ||
|
||
connect() { | ||
$(this.element).tabs(); | ||
|
||
$(this.element.querySelectorAll('.nav-tabs a')).on('click', (event) => { | ||
event.preventDefault(); | ||
this._changeActiveTabTo(event.target.hash); | ||
}); | ||
|
||
const activeTab = this.activeTabTarget.value; | ||
if (activeTab) { | ||
$(this.element).find(`.nav-tabs a[href="${activeTab}"]`).click(); | ||
} | ||
} | ||
|
||
_changeActiveTabTo(hash) { | ||
window.location.hash = hash; | ||
this.activeTabTarget.value = hash; | ||
} | ||
} |
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.
is this used anywhere? I can't see any
assigns
orassert_template
.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.
Right, I've been debugging failed test and I needed
assigns
. Maybe it can stay for debugging.