Show/Hide Pswd + Update position menu in manage page

Position page menu not working, just a idea
This commit is contained in:
Frédéric K 2015-09-14 10:37:08 +02:00
parent 7e9be455a4
commit c022af2bf5
2 changed files with 61 additions and 5 deletions

View File

@ -2,11 +2,13 @@
<?php makeNavbar('manage'); ?> <?php makeNavbar('manage'); ?>
<form id="jsformposition" method="post" action="" class="forms">
<table class="table-bordered table-stripped"> <table class="table-bordered table-stripped">
<thead> <thead>
<tr> <tr>
<th><?php $Language->p('Title') ?></th> <th style="width: 30%"><?php $Language->p('Title') ?></th>
<th><?php $Language->p('Parent') ?></th> <th style="width: 40%"><?php $Language->p('Parent') ?></th>
<th style="width: 30%"><?php $Language->p('Position') ?></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -26,10 +28,19 @@
echo '<tr>'; echo '<tr>';
echo '<td>'.($Page->parentKey()?NO_PARENT_CHAR:'').'<a href="'.HTML_PATH_ADMIN_ROOT.'edit-page/'.$Page->key().'">'.($Page->published()?'':'<span class="label label-outline label-red smaller">'.$Language->g('Draft').'</span> ').($Page->title()?$Page->title():'<span class="label label-outline label-blue smaller">'.$Language->g('Empty title').'</span> ').'</a></td>'; echo '<td>'.($Page->parentKey()?NO_PARENT_CHAR:'').'<a href="'.HTML_PATH_ADMIN_ROOT.'edit-page/'.$Page->key().'">'.($Page->published()?'':'<span class="label label-outline label-red smaller">'.$Language->g('Draft').'</span> ').($Page->title()?$Page->title():'<span class="label label-outline label-blue smaller">'.$Language->g('Empty title').'</span> ').'</a></td>';
echo '<td>'.$parentTitle.'</td>'; echo '<td>'.$parentTitle.'</td>';
echo '<td><input id="jsposition" name="position" type="text" class="width-20" value="' .$Page->position(). '"></td>';
echo '</tr>'; echo '</tr>';
} }
} }
?> ?>
</tbody> </tbody>
<tfoot>
<tr>
<th style="width: 30%">&nbsp;</th>
<th style="width: 40%">&nbsp;</th>
<th style="width: 30%"><button class="btn btn-blue" name="publish"><?php //echo $Language->p('Update') ?>Update</button></th>
</tr>
</tfoot>
</table> </table>
</form>

View File

@ -495,8 +495,11 @@ if( $_SERVER['REQUEST_METHOD'] == 'POST' )
<input type="text" value="admin" disabled="disabled" class="width-100"> <input type="text" value="admin" disabled="disabled" class="width-100">
</label> </label>
<label> <label class="input-groups">
<input type="text" name="password" id="jspassword" placeholder="<?php echo $Language->get('Password visible field') ?>" class="width-100" autocomplete="off" maxlength="100" value="<?php echo isset($_POST['password'])?$_POST['password']:'' ?>"> <input type="password" name="password" id="jspassword" placeholder="<?php echo $Language->get('Password visible field') ?>" class="width-100" autocomplete="off" maxlength="100" value="<?php echo isset($_POST['password'])?$_POST['password']:'' ?>">
<span class="btn-append">
<button class="btn" title="Mask/Unmask password to check content">Show</button>
</span>
</label> </label>
<label> <label>
@ -550,6 +553,48 @@ $(document).ready(function()
} }
}); });
}); });
$('.btn-append').on('click', function () {
if ($(this).prev('input').attr('type') == 'password')
changeType($(this).prev('input'), 'text');
else
changeType($(this).prev('input'), 'password');
return false;
});
function changeType(x, type) {
if (x.prop('type') == type)
return x;
try {
return x.prop('type', type);
} catch (e) {
var html = $('<div>').append(x.clone()).html();
var regex = /type=(\")?([^\"\s]+)(\")?/;
var tmp = $(html.match(regex) == null ? html.replace('>', ' type="' + type + '">') : html.replace(regex, 'type="' + type + '"'));
tmp.data('type', x.data('type'));
var events = x.data('events');
var cb = function (events) {
return function () {
for (i in events) {
if (window.CP.shouldStopExecution(2)) {
break;
}
var y = events[i];
for (j in y) {
if (window.CP.shouldStopExecution(1)) {
break;
}
tmp.bind(i, y[j].handler);
}
window.CP.exitedLoop(1);
}
window.CP.exitedLoop(2);
};
}(events);
x.replaceWith(tmp);
setTimeout(cb, 10);
return tmp;
}
}
//@ sourceURL= http://codepen.io/CreativeJuiz/pen/cvyEi
</script> </script>
</div> </div>