Improvements to field views and minor updates
This commit is contained in:
parent
2b48dde8f7
commit
68d96ca85f
4
classes/Arr.php
Normal file
4
classes/Arr.php
Normal file
@ -0,0 +1,4 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
class Arr extends lnApp_Arr {}
|
||||
?>
|
20
classes/lnApp/Arr.php
Normal file
20
classes/lnApp/Arr.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* This class extends Kohana's Arr
|
||||
*
|
||||
* @package lnApp
|
||||
* @category Modifications
|
||||
* @author Deon George
|
||||
* @copyright (c) 2010 Deon George
|
||||
* @license http://dev.leenooks.net/license.html
|
||||
*/
|
||||
abstract class lnApp_Arr extends Kohana_Arr {
|
||||
/**
|
||||
* Convert an array into a string with key=value
|
||||
*/
|
||||
public static function convert(array $array) {
|
||||
return implode(' ',array_map(function ($v, $k) { return sprintf('%s="%s"', $k, $v); },$array,array_keys($array)));
|
||||
}
|
||||
}
|
||||
?>
|
@ -13,8 +13,8 @@ abstract class lnApp_Controller_User_Account extends Controller_Account {
|
||||
protected $auth_required = TRUE;
|
||||
|
||||
protected $secure_actions = array(
|
||||
'edit'=>0,
|
||||
'resetpassword'=>0,
|
||||
'edit'=>TRUE,
|
||||
'resetpassword'=>TRUE,
|
||||
);
|
||||
|
||||
/**
|
||||
@ -58,9 +58,8 @@ abstract class lnApp_Controller_User_Account extends Controller_Account {
|
||||
// Log the password reset
|
||||
$this->ao->log('Password reset');
|
||||
|
||||
HTTP::redirect('login');
|
||||
}
|
||||
|
||||
HTTP::redirect('login');
|
||||
}
|
||||
|
||||
Block::factory()
|
||||
|
@ -54,7 +54,7 @@ abstract class lnApp_SystemMessage extends HTMLRender {
|
||||
|
||||
$output = '';
|
||||
|
||||
$output .= sprintf('<div class="alert %s">',empty($record['type']) ? '' : 'alert-'.$record['type']);
|
||||
$output .= sprintf('<div class="alert %s">',empty($record['type']) ? '' : 'alert-'.($record['type'] == 'error' ? 'danger' : $record['type']));
|
||||
$output .= '<button type="button" class="close" data-dismiss="alert">×</button>';
|
||||
switch ($record['type']) {
|
||||
case 'error':
|
||||
|
File diff suppressed because one or more lines are too long
@ -1,12 +1,14 @@
|
||||
<fieldset>
|
||||
<legend>Reset Password</legend>
|
||||
<div class="col-md-12">
|
||||
<div class="row">
|
||||
<fieldset class="col-md-5">
|
||||
<legend>Reset Password</legend>
|
||||
|
||||
<?php echo Form::input('password','',array('label'=>'Password','divclass'=>'col-md-3','placeholder'=>'Login Password','type'=>'password','required','id'=>'password','data-minlength'=>8)); ?>
|
||||
<?php echo Form::input('password_confirm','',array('label'=>'Confirm','divclass'=>'col-md-3','placeholder'=>'Confirm Password','type'=>'password','required','data-match'=>'#password','data-match-error'=>'Whoops, these don\'t match!')); ?>
|
||||
</fieldset>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-offset-1">
|
||||
<button type="submit" class="btn btn-primary">Save changes</button>
|
||||
<?php
|
||||
echo View::factory('field/password')->set('data',['field'=>'password','value'=>'','text'=>'Password','class'=>'col-md-9','classlabelnum'=>'3','attr'=>['required'=>'required','data-minlength'=>8]]);
|
||||
echo View::factory('field/password')->set('data',['field'=>'password_confirm','value'=>'','text'=>'Confirm ','class'=>'col-md-9','classlabelnum'=>'3','attr'=>['required'=>'required','data-match'=>'#password_label','data-match-error'=>'They dont match!']]);
|
||||
?>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
<?php echo View::factory('field/submit'); ?>
|
||||
</div>
|
||||
|
@ -4,12 +4,13 @@
|
||||
<!-- name = account name -->
|
||||
<!-- ajaxurl = ajax URL -->
|
||||
<div class="form-group">
|
||||
<label for="<?php echo $data['field']; ?>_label" class="col-md-2 control-label"><?php echo $data['text']; ?></label>
|
||||
<div class="input-group col-md-4">
|
||||
<input type="text" id="<?php echo $data['field']; ?>_label" value="<?php echo $data['name']; ?>" class="form-control" autocomplete="off" placeholder="<?php echo $data['text']; ?>">
|
||||
<label for="<?php echo Arr::get($data,'field'); ?>_label" class="col-md-<?php echo Arr::get($data,'classlabelnum',2); ?> control-label"><?php echo Arr::get($data,'text'); ?></label>
|
||||
<div class="input-group <?php echo Arr::get($data,'class','col-md-5'); ?>">
|
||||
<input type="text" id="<?php echo Arr::get($data,'field'); ?>_label" value="<?php echo Arr::get($data,'name'); ?>" class="form-control" placeholder="<?php echo Arr::get($data,'text'); ?>" autocomplete="off" <?php echo Arr::convert(Arr::get($data,'attr',[])); ?>>
|
||||
<span class="input-group-addon"><i class="fa fa-refresh" name="account_lookup"></i></span>
|
||||
</div>
|
||||
<input type="hidden" name="<?php echo $data['field']; ?>" value="<?php echo $data['value']; ?>">
|
||||
<span class="col-md-offset-<?php echo Arr::get($data,'classlabelnum',2); ?> help-block with-errors"></span>
|
||||
<input type="hidden" name="<?php echo Arr::get($data,'field'); ?>" value="<?php echo Arr::get($data,'value'); ?>">
|
||||
</div>
|
||||
|
||||
<?php
|
||||
@ -20,7 +21,7 @@ $(document).ready(function() {
|
||||
$("input[id=account_id_label]").typeahead({
|
||||
minLength: 2,
|
||||
source: function (query,process) {
|
||||
search("'.$data['ajaxurl'].'",query,process,"account_lookup");
|
||||
search("'.Arr::get($data,'ajaxurl').'",query,process,"account_lookup");
|
||||
},
|
||||
|
||||
matcher: function () { return true; },
|
||||
|
@ -3,12 +3,13 @@
|
||||
<!-- value = value -->
|
||||
<!-- enddate = js value -->
|
||||
<div class="form-group">
|
||||
<label for="<?php echo $data['field']; ?>_label" class="col-md-2 control-label"><?php echo $data['text']; ?></label>
|
||||
<div class="input-group col-md-2">
|
||||
<input type="text" id="<?php echo $data['field']; ?>_label" value="<?php echo Site::date($data['value']); ?>" class="form-control" placeholder="<?php echo $data['text']; ?>">
|
||||
<label for="<?php echo Arr::get($data,'field'); ?>_label" class="col-md-<?php echo Arr::get($data,'classlabelnum',2); ?> control-label"><?php echo Arr::get($data,'text'); ?></label>
|
||||
<div class="input-group <?php echo Arr::get($data,'class','col-md-2'); ?>">
|
||||
<input type="text" id="<?php echo Arr::get($data,'field'); ?>_label" value="<?php echo Site::date(Arr::get($data,'value',time())); ?>" class="form-control" placeholder="<?php echo Arr::get($data,'text'); ?>" <?php echo Arr::convert(Arr::get($data,'attr',[])); ?>>
|
||||
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
|
||||
</div>
|
||||
<input type="hidden" name="<?php echo $data['field']; ?>" value="<?php echo $data['value']; ?>">
|
||||
<span class="col-md-offset-<?php echo Arr::get($data,'classlabelnum',2); ?> help-block with-errors"></span>
|
||||
<input type="hidden" name="<?php echo Arr::get($data,'field'); ?>" value="<?php echo Arr::get($data,'value'); ?>">
|
||||
</div>
|
||||
|
||||
<?php
|
||||
|
@ -1,10 +1,11 @@
|
||||
<!-- field = field_name -->
|
||||
<!-- text = field_text -->
|
||||
<!-- field = field name -->
|
||||
<!-- text = field text -->
|
||||
<!-- value = value -->
|
||||
<div class="form-group">
|
||||
<label for="<?php echo $data['field']; ?>_label" class="col-md-2 control-label"><?php echo $data['text']; ?></label>
|
||||
<div class="input-group col-md-2">
|
||||
<label for="<?php echo Arr::get($data,'field'); ?>_label" class="col-md-<?php echo Arr::get($data,'classlabelnum',2); ?> control-label"><?php echo Arr::get($data,'text'); ?></label>
|
||||
<div class="input-group <?php echo Arr::get($data,'class','col-md-2'); ?>">
|
||||
<div class="input-group-addon"><i class="fa fa-dollar"></i></div>
|
||||
<input type="text" id="<?php echo $data['field']; ?>_label" name="<?php echo $data['field']; ?>" value="<?php echo $data['value']; ?>" class="form-control" placeholder="<?php echo $data['text']; ?>">
|
||||
<input type="text" id="<?php echo Arr::get($data,'field'); ?>_label" name="<?php echo Arr::get($data,'field'); ?>" value="<?php echo Arr::get($data,'value'); ?>" class="form-control" placeholder="<?php echo Arr::get($data,'text'); ?>" autocomplete="off" <?php echo Arr::convert(Arr::get($data,'attr',[])); ?>>
|
||||
</div>
|
||||
<span class="col-md-offset-<?php echo Arr::get($data,'classlabelnum',2); ?> help-block with-errors"></span>
|
||||
</div>
|
||||
|
@ -1,10 +1,11 @@
|
||||
<!-- field = field_name -->
|
||||
<!-- text = field_text -->
|
||||
<!-- field = field name -->
|
||||
<!-- text = field text -->
|
||||
<!-- value = value -->
|
||||
<div class="form-group">
|
||||
<label for="<?php echo $data['field']; ?>_label" class="col-md-2 control-label"><?php echo $data['text']; ?></label>
|
||||
<div class="input-group col-md-2">
|
||||
<label for="<?php echo Arr::get($data,'field'); ?>_label" class="col-md-<?php echo Arr::get($data,'classlabelnum',2); ?> control-label"><?php echo Arr::get($data,'text'); ?></label>
|
||||
<div class="input-group <?php echo Arr::get($data,'class','col-md-2'); ?>">
|
||||
<div class="input-group-addon"><i class="fa fa-sliders"></i></div>
|
||||
<input type="text" id="<?php echo $data['field']; ?>_label" name="<?php echo $data['field']; ?>" value="<?php echo $data['value']; ?>" class="form-control" placeholder="<?php echo $data['text']; ?>">
|
||||
<input type="text" id="<?php echo Arr::get($data,'field'); ?>_label" name="<?php echo Arr::get($data,'field'); ?>" value="<?php echo Arr::get($data,'value'); ?>" class="form-control" placeholder="<?php echo Arr::get($data,'text'); ?>" autocomplete="off" <?php echo Arr::convert(Arr::get($data,'attr',[])); ?>>
|
||||
</div>
|
||||
<span class="col-md-offset-<?php echo Arr::get($data,'classlabelnum',2); ?> help-block with-errors"></span>
|
||||
</div>
|
||||
|
10
views/field/password.php
Normal file
10
views/field/password.php
Normal file
@ -0,0 +1,10 @@
|
||||
<!-- field = field name -->
|
||||
<!-- text = field text -->
|
||||
<!-- value = value -->
|
||||
<div class="form-group">
|
||||
<label for="<?php echo Arr::get($data,'field'); ?>_label" class="col-md-<?php echo Arr::get($data,'classlabelnum',2); ?> control-label"><?php echo Arr::get($data,'text'); ?></label>
|
||||
<div class="<?php echo Arr::get($data,'class','col-md-9'); ?>">
|
||||
<input type="password" id="<?php echo Arr::get($data,'field'); ?>_label" name="<?php echo Arr::get($data,'field'); ?>" value="<?php echo Arr::get($data,'value'); ?>" class="form-control" placeholder="<?php echo Arr::get($data,'text'); ?>" <?php echo Arr::convert(Arr::get($data,'attr',[])); ?>>
|
||||
</div>
|
||||
<span class="col-md-offset-<?php echo Arr::get($data,'classlabelnum',2); ?> help-block with-errors"></span>
|
||||
</div>
|
@ -2,10 +2,10 @@
|
||||
<!-- text = field text -->
|
||||
<!-- value = array of values -->
|
||||
<!-- default = value -->
|
||||
<!-- class = col-md class -->
|
||||
<div class="form-group">
|
||||
<label for="<?php echo $data['field']; ?>_label" class="col-md-2 control-label"><?php echo $data['text']; ?></label>
|
||||
<div class="input-group <?php echo $data['class']; ?>">
|
||||
<label for="<?php echo Arr::get($data,'field'); ?>_label" class="col-md-<?php echo Arr::get($data,'classlabelnum',2); ?> control-label"><?php echo Arr::get($data,'text'); ?></label>
|
||||
<div class="input-group <?php echo Arr::get($data,'class','col-md-2'); ?>">
|
||||
<?php echo Form::select($data['field'],$data['value'],$data['default'],array('class'=>'form-control','placeholder'=>$data['text'])); ?>
|
||||
</div>
|
||||
<span class="col-md-offset-<?php echo Arr::get($data,'classlabelnum',2); ?> help-block with-errors"></span>
|
||||
</div>
|
||||
|
@ -1,9 +1,10 @@
|
||||
<!-- field = field_name -->
|
||||
<!-- text = field_text -->
|
||||
<!-- field = field name -->
|
||||
<!-- text = field text -->
|
||||
<!-- value = value -->
|
||||
<div class="form-group">
|
||||
<label for="cert" class="col-md-2 control-label"><?php echo $data['text']; ?></label>
|
||||
<div class="<?php echo $data['class']; ?>" style="padding-left: 0px">
|
||||
<input type="text" class="form-control" id="cert" name="<?php echo $data['field']; ?>" placeholder="<?php echo $data['text']; ?>" value="<?php echo $data['value']; ?>" >
|
||||
<label for="<?php echo Arr::get($data,'field'); ?>_label" class="col-md-<?php echo Arr::get($data,'classlabelnum',2); ?> control-label"><?php echo Arr::get($data,'text'); ?></label>
|
||||
<div class="<?php echo Arr::get($data,'class','col-md-6'); ?>" style="padding-left: 0px">
|
||||
<input type="text" id="<?php echo Arr::get($data,'field'); ?>_label" name="<?php echo Arr::get($data,'field'); ?>" value="<?php echo Arr::get($data,'value'); ?>" class="form-control" placeholder="<?php echo Arr::get($data,'text'); ?>" autocomplete="off" <?php echo Arr::convert(Arr::get($data,'attr',[])); ?>>
|
||||
</div>
|
||||
<span class="col-md-offset-<?php echo Arr::get($data,'classlabelnum',2); ?> help-block with-errors"></span>
|
||||
</div>
|
||||
|
@ -1,7 +1,8 @@
|
||||
<!-- field = field_name -->
|
||||
<!-- text = field_text -->
|
||||
<!-- field = field name -->
|
||||
<!-- text = field text -->
|
||||
<!-- value = value -->
|
||||
<div class="form-group" style="margin-left: 0px">
|
||||
<label for="cert"><?php echo $data['text']; ?></label>
|
||||
<textarea class="form-control" id="cert" name="<?php echo $data['field']; ?>" placeholder="<?php echo $data['text']; ?>" style="font-family: monospace; width: auto; resize: none;" rows="<?php echo Form::textarea_rows($data['value']); ?>" cols="<?php echo Form::textarea_cols($data['value'],78); ?>"><?php echo $data['value']; ?></textarea>
|
||||
<label for="<?php echo Arr::get($data,'field'); ?>_label" class="col-md-<?php echo Arr::get($data,'classlabelnum',2); ?> control-label"><?php echo Arr::get($data,'text'); ?></label>
|
||||
<textarea id="<?php echo Arr::get($data,'field'); ?>_label" name="<?php echo Arr::get($data,'field'); ?>" class="form-control" placeholder="<?php echo Arr::get($data,'text'); ?>" style="font-family: monospace; width: auto; resize: none;" rows="<?php echo Form::textarea_rows(Arr::get($data,'value')); ?>" cols="<?php echo Form::textarea_cols(Arr::get($data,'value'),78); ?>" <?php echo Arr::convert(Arr::get($data,'attr',[])); ?>><?php echo Arr::get($data,'value'); ?></textarea>
|
||||
<span class="col-md-offset-<?php echo Arr::get($data,'classlabelnum',2); ?> help-block with-errors"></span>
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user