-
-
Notifications
You must be signed in to change notification settings - Fork 485
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of github.com:sarvaiyanidhi/casa into display-ass…
…igned-volunteer
- Loading branch information
Showing
22 changed files
with
741 additions
and
259 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
@use "../base/breakpoints.scss" as screen-sizes; | ||
|
||
.header { | ||
.header-left { | ||
.menu-toggle-btn { | ||
display: none; | ||
|
||
.main-btn { | ||
border-radius: 4px !important; | ||
} | ||
} | ||
} | ||
} | ||
|
||
@media only screen and (max-width: screen-sizes.$mobile) { | ||
.header { | ||
.header-left { | ||
.menu-toggle-btn { | ||
display: block; | ||
} | ||
} | ||
} | ||
} |
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,29 @@ | ||
import { Controller } from '@hotwired/stimulus' | ||
|
||
export default class extends Controller { | ||
static targets = ['submitButton', 'input'] | ||
static values = { | ||
unallowed: { type: Array } | ||
} | ||
|
||
static classes = ['disabled', 'enabled'] | ||
|
||
validate () { | ||
let invalid = false | ||
this.inputTargets.forEach(input => { | ||
if (this.unallowedValue.includes(input.value)) { | ||
invalid = true | ||
} | ||
}) | ||
|
||
if (invalid) { | ||
this.submitButtonTarget.disabled = true | ||
this.submitButtonTarget.classList.add(this.disabledClass) | ||
this.submitButtonTarget.classList.remove(...this.enabledClasses) | ||
} else { | ||
this.submitButtonTarget.disabled = false | ||
this.submitButtonTarget.classList.remove(this.disabledClass) | ||
this.submitButtonTarget.classList.add(...this.enabledClasses) | ||
} | ||
} | ||
} |
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,75 @@ | ||
import { Controller } from '@hotwired/stimulus' | ||
|
||
// Connects to data-controller="select-all" | ||
export default class extends Controller { | ||
static targets = ['checkboxAll', 'checkbox', 'button', 'buttonLabel'] | ||
static values = { | ||
allChecked: { type: Boolean, default: false }, | ||
buttonLabel: { type: String } | ||
} | ||
|
||
static classes = ['hidden'] | ||
|
||
toggleAll () { | ||
this.allCheckedValue = !this.allCheckedValue | ||
|
||
this.checkboxTargets.forEach(checkbox => { | ||
checkbox.checked = this.allCheckedValue | ||
}) | ||
|
||
this.toggleButton() | ||
} | ||
|
||
toggleSingle () { | ||
this.toggleCheckedAll() | ||
this.toggleButton() | ||
} | ||
|
||
toggleCheckedAll () { | ||
const numChecked = this.getNumberChecked() | ||
const numTotal = this.getTotalCheckboxes() | ||
|
||
this.allCheckedValue = numChecked === numTotal | ||
this.checkboxAllTarget.checked = this.allCheckedValue | ||
|
||
if (numChecked === 0) { | ||
this.checkboxAllTarget.indeterminate = false | ||
} else { | ||
this.checkboxAllTarget.indeterminate = numChecked < numTotal | ||
} | ||
} | ||
|
||
toggleButton () { | ||
if (this.hasButtonTarget) { | ||
const numChecked = this.getNumberChecked() | ||
if (numChecked > 0) { | ||
this.setButtonLabel(numChecked) | ||
|
||
this.buttonTarget.classList.remove(this.hiddenClass) | ||
} else { | ||
this.buttonTarget.classList.add(this.hiddenClass) | ||
} | ||
} | ||
} | ||
|
||
setButtonLabel (numChecked) { | ||
if (this.hasButtonLabelTarget) { | ||
let label = this.buttonLabelValue | ||
|
||
if (numChecked > 1) { | ||
label += 's' | ||
} | ||
label += ' (' + numChecked + ')' | ||
|
||
this.buttonLabelTarget.innerHTML = label | ||
} | ||
} | ||
|
||
getNumberChecked () { | ||
return this.checkboxTargets.filter((checkbox) => checkbox.checked).length | ||
} | ||
|
||
getTotalCheckboxes () { | ||
return this.checkboxTargets.length | ||
} | ||
} |
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.