Fixed URI redirect for normal/expert

This commit is contained in:
Djamil Legato
2014-09-18 17:35:05 -07:00
parent 359351adf2
commit ddaa85b3e4
2 changed files with 5 additions and 4 deletions

View File

@@ -44,11 +44,12 @@ $(function(){
}); });
$("#admin-mode-toggle input[name=mode-switch]").on('change', function(e){ $("#admin-mode-toggle input[name=mode-switch]").on('change', function(e){
var value = $(this).val(); var value = $(this).val(),
uri = $(this).data('leave-url');
if (currentValues == getState()) { if (currentValues == getState()) {
setTimeout(function(){ setTimeout(function(){
window.location.href = '{{ uri.route(true) }}' + ((value == 'expert') ? '/expert:1' : ''); window.location.href = uri;
}, 200) }, 200)
return true; return true;

View File

@@ -98,9 +98,9 @@
{% if context.blueprints.fields %} {% if context.blueprints.fields %}
<form id="admin-mode-toggle"> <form id="admin-mode-toggle">
<div class="switch-toggle switch-grav"> <div class="switch-toggle switch-grav">
<input type="radio" value="normal" id="normal" name="mode-switch" class="highlight" {% if not uri.param('expert') %} checked="checked"{% endif %}> <input type="radio" value="normal" data-leave-url="{{ uri.route(true) }}" id="normal" name="mode-switch" class="highlight" {% if not uri.param('expert') %} checked="checked"{% endif %}>
<label for="normal">Normal</label> <label for="normal">Normal</label>
<input type="radio" value="expert" id="expert" name="mode-switch" class="highlight" {% if uri.param('expert') %} checked="checked"{% endif %}> <input type="radio" value="expert" data-leave-url="{{ uri.route(true) }}/expert:1" id="expert" name="mode-switch" class="highlight" {% if uri.param('expert') %} checked="checked"{% endif %}>
<label for="expert">Expert</label> <label for="expert">Expert</label>
<a></a> <a></a>
</div> </div>