Browse Source

Add colorpicker for categories and statuses

tags/2.6.0
Mike Koch 3 years ago
parent
commit
51720f17a8

+ 7
- 3
admin/manage_categories.php View File

@@ -163,7 +163,7 @@ while ($mycat = hesk_dbFetchAssoc($res)) {
data-content="<?php echo htmlspecialchars($hesklang['category_color_help']); ?>"></i>
</label>
<div class="col-sm-8">
<input class="form-control"
<input class="form-control colorpicker"
placeholder="<?php echo htmlspecialchars($hesklang['category_color']); ?>" type="text"
name="color" maxlength="7">
</div>
@@ -391,7 +391,7 @@ while ($mycat = hesk_dbFetchAssoc($res)) {
<div class="form-group">
<label for="color" class="col-sm-3 control-label">Color</label>
<div class="col-sm-9">
<input type="text" name="color" class="form-control" placeholder="Color">
<input type="text" name="color" class="form-control category-colorpicker" placeholder="Color">
<div class="help-block with-errors"></div>
</div>
</div>
@@ -465,13 +465,17 @@ while ($mycat = hesk_dbFetchAssoc($res)) {

var $modal = $('#edit-category-modal');
$modal.find('input[name="name"]').val(name).end()
.find('input[name="color"]').val(color).end()
.find('input[name="color"]').val(color).colorpicker({format:'hex', color: color}).end()
.find('select[name="priority"]').val(priority).end()
.find('select[name="manager"]').val(manager).end()
.find('input[name="id"]').val(id).end()
.find('select[name="usage"]').val(usage).end()
.modal('show');
});

$('.cancel-callback').click(function() {
$('#edit-category-modal').find('input[name="color"]').colorpicker('destroy');
});
});
</script>


+ 3
- 2
admin/manage_statuses.php View File

@@ -492,7 +492,8 @@ function buildCreateModal()
</label>

<div class="col-sm-8">
<input type="text" name="text-color" class="form-control"
<input type="text" name="text-color" class="form-control colorpicker"
data-color=""
data-error="<?php echo htmlspecialchars($hesklang['this_field_is_required']); ?>"
placeholder="<?php echo htmlspecialchars($hesklang['textColor']); ?>" required>
<div class="help-block with-errors"></div>
@@ -639,7 +640,7 @@ function buildEditModal($statusId)
</label>

<div class="col-sm-8">
<input type="text" name="text-color" class="form-control"
<input type="text" name="text-color" class="form-control colorpicker"
value="<?php echo $status['TextColor']; ?>"
data-error="<?php echo htmlspecialchars($hesklang['this_field_is_required']); ?>"
placeholder="<?php echo htmlspecialchars($hesklang['textColor']); ?>" required>

+ 10
- 0
css/bootstrap-colorpicker.min.css View File

@@ -0,0 +1,10 @@
/*!
* Bootstrap Colorpicker v2.3.3
* http://mjolnic.github.io/bootstrap-colorpicker/
*
* Originally written by (c) 2012 Stefan Petre
* Licensed under the Apache License v2.0
* http://www.apache.org/licenses/LICENSE-2.0.txt
*
*/.colorpicker-saturation{width:100px;height:100px;background-image:url(../img/bootstrap-colorpicker/saturation.png);cursor:crosshair;float:left}.colorpicker-saturation i{display:block;height:5px;width:5px;border:1px solid #000;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px;position:absolute;top:0;left:0;margin:-4px 0 0 -4px}.colorpicker-saturation i b{display:block;height:5px;width:5px;border:1px solid #fff;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px}.colorpicker-alpha,.colorpicker-hue{width:15px;height:100px;float:left;cursor:row-resize;margin-left:4px;margin-bottom:4px}.colorpicker-alpha i,.colorpicker-hue i{display:block;height:1px;background:#000;border-top:1px solid #fff;position:absolute;top:0;left:0;width:100%;margin-top:-1px}.colorpicker-hue{background-image:url(../img/bootstrap-colorpicker/hue.png)}.colorpicker-alpha{background-image:url(../img/bootstrap-colorpicker/alpha.png);display:none}.colorpicker-alpha,.colorpicker-hue,.colorpicker-saturation{background-size:contain}.colorpicker{padding:4px;min-width:130px;margin-top:1px;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;z-index:2500}.colorpicker:after,.colorpicker:before{display:table;content:"";line-height:0}.colorpicker:after{clear:both}.colorpicker:before{content:'';display:inline-block;border-left:7px solid transparent;border-right:7px solid transparent;border-bottom:7px solid #ccc;border-bottom-color:rgba(0,0,0,.2);position:absolute;top:-7px;left:6px}.colorpicker:after{content:'';display:inline-block;border-left:6px solid transparent;border-right:6px solid transparent;border-bottom:6px solid #fff;position:absolute;top:-6px;left:7px}.colorpicker div{position:relative}.colorpicker.colorpicker-with-alpha{min-width:140px}.colorpicker.colorpicker-with-alpha .colorpicker-alpha{display:block}.colorpicker-color{height:10px;margin-top:5px;clear:both;background-image:url(../img/bootstrap-colorpicker/alpha.png);background-position:0 100%}.colorpicker-color div{height:10px}.colorpicker-selectors{display:none;height:10px;margin-top:5px;clear:both}.colorpicker-selectors i{cursor:pointer;float:left;height:10px;width:10px}.colorpicker-selectors i+i{margin-left:3px}.colorpicker-element .add-on i,.colorpicker-element .input-group-addon i{display:inline-block;cursor:pointer;height:16px;vertical-align:text-top;width:16px}.colorpicker.colorpicker-inline{position:relative;display:inline-block;float:none;z-index:auto}.colorpicker.colorpicker-horizontal{width:110px;min-width:110px;height:auto}.colorpicker.colorpicker-horizontal .colorpicker-saturation{margin-bottom:4px}.colorpicker.colorpicker-horizontal .colorpicker-color{width:100px}.colorpicker.colorpicker-horizontal .colorpicker-alpha,.colorpicker.colorpicker-horizontal .colorpicker-hue{width:100px;height:15px;float:left;cursor:col-resize;margin-left:0;margin-bottom:4px}.colorpicker.colorpicker-horizontal .colorpicker-alpha i,.colorpicker.colorpicker-horizontal .colorpicker-hue i{display:block;height:15px;background:#fff;position:absolute;top:0;left:0;width:1px;border:none;margin-top:0}.colorpicker.colorpicker-horizontal .colorpicker-hue{background-image:url(../img/bootstrap-colorpicker/hue-horizontal.png)}.colorpicker.colorpicker-horizontal .colorpicker-alpha{background-image:url(../img/bootstrap-colorpicker/alpha-horizontal.png)}.colorpicker.colorpicker-hidden{display:none}.colorpicker.colorpicker-visible{display:block}.colorpicker-inline.colorpicker-visible{display:inline-block}.colorpicker-right:before{left:auto;right:6px}.colorpicker-right:after{left:auto;right:7px}.colorpicker-no-arrow:before{border-right:0;border-left:0}.colorpicker-no-arrow:after{border-right:0;border-left:0}
/*# sourceMappingURL=bootstrap-colorpicker.min.css.map */

BIN
img/bootstrap-colorpicker/alpha-horizontal.png View File


BIN
img/bootstrap-colorpicker/alpha.png View File


BIN
img/bootstrap-colorpicker/hue-horizontal.png View File


BIN
img/bootstrap-colorpicker/hue.png View File


BIN
img/bootstrap-colorpicker/saturation.png View File


+ 2
- 0
inc/headerAdmin.inc.php View File

@@ -80,6 +80,7 @@ $modsForHesk_settings = mfh_getSettings();
<link rel="stylesheet" href="<?php echo HESK_PATH; ?>css/fullcalendar.min.css">
<link rel="stylesheet" href="<?php echo HESK_PATH; ?>css/bootstrap-clockpicker.min.css">
<link rel="stylesheet" href="<?php echo HESK_PATH; ?>css/jquery.jgrowl.min.css">
<link rel="stylesheet" href="<?php echo HESK_PATH; ?>css/bootstrap-colorpicker.min.css">
<script src="<?php echo HESK_PATH; ?>js/jquery-1.10.2.min.js"></script>
<script language="Javascript" type="text/javascript" src="<?php echo HESK_PATH; ?>hesk_javascript.js"></script>
<script language="Javascript" type="text/javascript" src="<?php echo HESK_PATH; ?>js/bootstrap.min.js"></script>
@@ -97,6 +98,7 @@ $modsForHesk_settings = mfh_getSettings();
<script type="text/javascript" src="<?php echo HESK_PATH; ?>js/bootstrap-validator.min.js"></script>
<script type="text/javascript" src="<?php echo HESK_PATH; ?>internal-api/js/core-admin.php"></script>
<script type="text/javascript" src="<?php echo HESK_PATH; ?>js/jquery.jgrowl.min.js"></script>
<script type="text/javascript" src="<?php echo HESK_PATH; ?>js/bootstrap-colorpicker.min.js"></script>
<?php
if (defined('EXTRA_JS')) {
echo EXTRA_JS;

+ 5
- 0
js/bootstrap-colorpicker.min.js
File diff suppressed because it is too large
View File


+ 5
- 0
js/modsForHesk-javascript.js View File

@@ -65,6 +65,11 @@ var loadJquery = function()
}
}
});

// Initialize colorpicker
$('.colorpicker').colorpicker({
format: 'hex'
});
};

function calculateGrayCount(background) {

Loading…
Cancel
Save