Skip to content

Commit

Permalink
#400 WIP always apply pull gradient checkbox.
Browse files Browse the repository at this point in the history
  • Loading branch information
Wotuu committed Jul 24, 2020
1 parent 69da8c1 commit a3304c5
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 15 deletions.
12 changes: 12 additions & 0 deletions resources/assets/js/custom/inline/common/maps/editsidebar.js
Expand Up @@ -112,6 +112,18 @@ class CommonMapsEditsidebar extends InlineCode {

killZoneMapObjectGroup.saveAll(['color']);
});

let $alwaysApplyPullGradient = $('#pull_gradient_apply_always');
let alwaysApplyPullGradient = Cookies.get('pull_gradient_apply_always');
if (typeof alwaysApplyPullGradient !== 'undefined' && alwaysApplyPullGradient === '1') {
$alwaysApplyPullGradient.attr('checked', 'checked');
} else {
$alwaysApplyPullGradient.removeAttr('checked');
}
$alwaysApplyPullGradient.bind('change', function () {
console.log('change', $(this).is(':checked'));
Cookies.set('pull_gradient_apply_always', $(this).is(':checked') ? '1' : '0');
});
}

/**
Expand Down
35 changes: 20 additions & 15 deletions resources/views/common/maps/editsidebar.blade.php
Expand Up @@ -222,25 +222,30 @@ class="btn btn-primary mt-1 w-100" role="button">
{{ __('Pull gradient') }}:
</div>
</div>
<div class="row no-gutters view_dungeonroute_details_row mt-3">
<div id="edit_route_freedraw_options_gradient" class="col">
<div class="row view_dungeonroute_details_row mt-3">
<div id="edit_route_freedraw_options_gradient" class="col-10">

</div>
<div class="col-2">
<button id="edit_route_freedraw_options_gradient_apply_to_pulls" class="btn btn-success"
data-toggle="tooltip" title="{{ __('Apply to current pulls') }}">
<i class="fas fa-check-circle"></i>
</button>
</div>
</div>
<div class="row no-gutters view_dungeonroute_details_row mt-3">
<div class="col">
{!! Form::label('pull_gradient_apply_always', __('Active')) !!}
{!! Form::checkbox('pull_gradient_apply_always', $_COOKIE['pull_gradient_apply_always'], isset($model) ? $model->active : 1, ['class' => 'form-control left_checkbox']) !!}
<button id="edit_route_freedraw_options_gradient_apply_to_pulls" class="btn btn-info w-100">
<i class="fas fa-palette"></i> {{ __('Apply gradient to pulls') }}
</button>
</div>

<div class="row view_dungeonroute_details_row mt-3">
<div class="col-2">
{!! Form::checkbox('pull_gradient_apply_always', 1,
isset($_COOKIE['pull_gradient_apply_always']) ? $_COOKIE['pull_gradient_apply_always'] === '1' : false,
['id' => 'pull_gradient_apply_always', 'class' => 'form-control left_checkbox'])
!!}

</div>
<div class="row no-gutters view_dungeonroute_details_row mt-3">
<div class="col">
<button id="edit_route_freedraw_options_gradient_apply_to_pulls" class="btn btn-info w-100">
<i class="fas fa-palette"></i> {{ __('Apply gradient to pulls') }}
</button>
<div class="col-10">
<label for="pull_gradient_apply_always">
{{ __('Always apply when I change pulls') }}
</label>
</div>
</div>
</div>
Expand Down

0 comments on commit a3304c5

Please sign in to comment.