Overhaul exceptions, rename triggerapi display -> show
This commit is contained in:
parent
afc5ede330
commit
7b52e07b65
File diff suppressed because one or more lines are too long
|
|
@ -85,7 +85,7 @@ self.onConditionChanged()})
|
|||
self.onConditionChanged()}
|
||||
TriggerOn.prototype.onConditionChanged=function(){if(this.triggerCondition=='checked'){this.updateTarget($(this.options.trigger+':checked').length>0)}
|
||||
else if(this.triggerCondition=='value'){this.updateTarget($(this.options.trigger).val()==this.triggerConditionValue)}}
|
||||
TriggerOn.prototype.updateTarget=function(status){if(this.options.triggerType=='display')
|
||||
TriggerOn.prototype.updateTarget=function(status){if(this.options.triggerType=='show')
|
||||
this.$el.toggleClass('hide',!status).trigger('hide',[!status])
|
||||
else if(this.options.triggerType=='hide')
|
||||
this.$el.toggleClass('hide',status).trigger('hide',[status])
|
||||
|
|
@ -95,7 +95,7 @@ else if(this.options.triggerType=='disable')
|
|||
this.$el.prop('disabled',status).trigger('disable',[status]).toggleClass('control-disabled',status)
|
||||
else if(this.options.triggerType=='empty'&&status)
|
||||
this.$el.trigger('empty').val('')
|
||||
if(this.options.triggerType=='display'||this.options.triggerType=='hide')
|
||||
if(this.options.triggerType=='show'||this.options.triggerType=='hide')
|
||||
this.fixButtonClasses()
|
||||
$(window).trigger('resize')}
|
||||
TriggerOn.prototype.fixButtonClasses=function(){var group=this.$el.closest('.btn-group')
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
* element is checked.
|
||||
*
|
||||
* Supported data attributes:
|
||||
* - data-trigger-type, values: display, hide, enable, disable, empty
|
||||
* - data-trigger-type, values: show, hide, enable, disable, empty
|
||||
* - data-trigger: a CSS selector for elements that trigger the action (checkboxes)
|
||||
* - data-trigger-condition, values:
|
||||
* - checked: determines the condition the elements specified in the data-trigger
|
||||
|
|
@ -75,7 +75,7 @@
|
|||
}
|
||||
|
||||
TriggerOn.prototype.updateTarget = function(status) {
|
||||
if (this.options.triggerType == 'display')
|
||||
if (this.options.triggerType == 'show')
|
||||
this.$el.toggleClass('hide', !status).trigger('hide', [!status])
|
||||
else if (this.options.triggerType == 'hide')
|
||||
this.$el.toggleClass('hide', status).trigger('hide', [status])
|
||||
|
|
@ -86,7 +86,7 @@
|
|||
else if (this.options.triggerType == 'empty' && status)
|
||||
this.$el.trigger('empty').val('')
|
||||
|
||||
if (this.options.triggerType == 'display' || this.options.triggerType == 'hide')
|
||||
if (this.options.triggerType == 'show' || this.options.triggerType == 'hide')
|
||||
this.fixButtonClasses()
|
||||
|
||||
$(window).trigger('resize')
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ use Exception;
|
|||
use BackendAuth;
|
||||
use Backend\Models\UserPreferences;
|
||||
use Backend\Models\BackendPreferences;
|
||||
use System\Classes\ErrorHandler;
|
||||
use October\Rain\Exception\SystemException;
|
||||
use October\Rain\Exception\ValidationException;
|
||||
use October\Rain\Exception\ApplicationException;
|
||||
|
|
@ -434,7 +435,7 @@ class Controller extends Extendable
|
|||
);
|
||||
}
|
||||
catch (Exception $ex) {
|
||||
return Response::make(ApplicationException::getDetailedMessage($ex), 500);
|
||||
throw $ex;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -536,7 +537,7 @@ class Controller extends Extendable
|
|||
*/
|
||||
public function handleError($exception)
|
||||
{
|
||||
$errorMessage = ApplicationException::getDetailedMessage($exception);
|
||||
$errorMessage = ErrorHandler::getDetailedMessage($exception);
|
||||
$this->fatalError = $errorMessage;
|
||||
$this->vars['fatalError'] = $errorMessage;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -537,7 +537,7 @@ class Controller
|
|||
return Response::make($responseContents, 406);
|
||||
}
|
||||
catch (Exception $ex) {
|
||||
return Response::make(ApplicationException::getDetailedMessage($ex), 500);
|
||||
throw $ex;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -26,10 +26,10 @@
|
|||
|
||||
<div class="dropdown hide"
|
||||
id="<?= $this->getId('tools-button') ?>"
|
||||
data-trigger-type="display"
|
||||
data-trigger="<?= '#'.$this->getId('asset-list') ?> input[type=checkbox]"
|
||||
data-trigger-type="show"
|
||||
data-trigger="<?= '#'.$this->getId('asset-list') ?> input[type=checkbox]"
|
||||
data-trigger-condition="checked">
|
||||
<button type="button" class="btn btn-primary empty oc-icon-wrench last"
|
||||
<button type="button" class="btn btn-primary empty oc-icon-wrench last"
|
||||
data-toggle="dropdown"
|
||||
data-control="asset-tools"
|
||||
></button>
|
||||
|
|
|
|||
|
|
@ -6,12 +6,12 @@
|
|||
<button type="button" class="btn btn-primary oc-icon-plus last"
|
||||
data-control="create-template"
|
||||
><?= e(trans('cms::lang.sidebar.add')) ?></button>
|
||||
<button type="button" class="btn btn-primary empty oc-icon-trash-o hide"
|
||||
<button type="button" class="btn btn-primary empty oc-icon-trash-o hide"
|
||||
id="<?= $this->getId('delete-button') ?>"
|
||||
data-control="delete-template"
|
||||
data-confirmation="<?= e(trans($this->deleteConfirmation)) ?>"
|
||||
data-trigger-type="display"
|
||||
data-trigger="<?= '#'.$this->getId('template-list') ?> input[type=checkbox]"
|
||||
data-trigger-type="show"
|
||||
data-trigger="<?= '#'.$this->getId('template-list') ?> input[type=checkbox]"
|
||||
data-trigger-condition="checked"></button>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ class ServiceProvider extends ModuleServiceProvider
|
|||
*/
|
||||
Event::listen('exception.beforeRender', function ($exception, $httpCode, $request){
|
||||
$handler = new ErrorHandler;
|
||||
return $handler->handleException($exception, $httpCode);
|
||||
return $handler->handleException($exception);
|
||||
});
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -1,11 +1,13 @@
|
|||
<?php namespace System\Classes;
|
||||
|
||||
use Log;
|
||||
use View;
|
||||
use Config;
|
||||
use Cms\Classes\Theme;
|
||||
use Cms\Classes\Router;
|
||||
use Cms\Classes\Controller;
|
||||
use October\Rain\Exception\ErrorHandler as ErrorHandlerBase;
|
||||
use October\Rain\Exception\ApplcationException;
|
||||
|
||||
/**
|
||||
* System Error Handler, this class handles application exception events.
|
||||
|
|
@ -15,6 +17,18 @@ use October\Rain\Exception\ErrorHandler as ErrorHandlerBase;
|
|||
*/
|
||||
class ErrorHandler extends ErrorHandlerBase
|
||||
{
|
||||
/**
|
||||
* We are about to display an error page to the user,
|
||||
* if it is an ApplcationException, this event should be logged.
|
||||
* @return void
|
||||
*/
|
||||
public function beforeHandleError($exception)
|
||||
{
|
||||
if ($exception instanceof ApplcationException) {
|
||||
Log::error($exception);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Looks up an error page using the CMS route "/error". If the route does not
|
||||
* exist, this function will use the error view found in the Cms module.
|
||||
|
|
|
|||
Loading…
Reference in New Issue