Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion app/Livewire/CategoryEditForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function render()
return view('livewire.category-edit-form');
}

public function updated($property, $value)
public function updated($property, $value) //this is what's throwing us off i think. not quite sure what this is doing.
{
if (! in_array($property, ['eulaText', 'useDefaultEula'])) {
return;
Expand All @@ -41,6 +41,13 @@ public function updated($property, $value)
$this->sendCheckInEmail = $this->eulaText || $this->useDefaultEula ? 1 : $this->originalSendCheckInEmailValue;
}

public function shouldUncheckDefaultEulaBox()
{
if($this->eulaText!='' && $this->defaultEulaText=='') {
return $this->useDefaultEula = false;
}
}

public function getShouldDisplayEmailMessageProperty(): bool
{
return $this->eulaText || $this->useDefaultEula;
Expand Down
18 changes: 14 additions & 4 deletions resources/views/livewire/category-edit-form.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,11 @@
name="eula_text"
wire:model.live="eulaText"
aria-label="eula_text"
:disabled="$this->eulaTextDisabled"
/>
<p class="help-block">{!! trans('admin/categories/general.eula_text_help') !!} </p>
<p class="help-block">{!! trans('admin/settings/general.eula_markdown') !!} </p>
{!! $errors->first('eula_text', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
</div>
@if ($this->eulaTextDisabled)
<input type="hidden" name="eula_text" wire:model.live="eulaText" />
@endif
</div>

<!-- Use default checkbox -->
Expand All @@ -32,7 +28,21 @@
/>
<span>{!! trans('admin/categories/general.use_default_eula') !!}</span>
</label>
@elseif ($eulaText!='')
<label class="form-control form-control--disabled">

<input
type="checkbox"
name="use_default_eula"
value="0"
wire:="shouldUncheckDefaultEulaBox"
aria-label="use_default_eula"
/>
<span>{!! trans('admin/categories/general.use_default_eula_disabled') !!}</span>
</label>
@else
{{--so if we delete the eula text, then it will skip the one above, and then get to this.
Putting us back where we started--}}
<label class="form-control form-control--disabled">
<input
type="checkbox"
Expand Down
Loading