use data attribute instead of deselect class for select boxes

This commit is contained in:
Uwe Steinmann 2018-06-22 16:38:52 +02:00
parent 60035385e2
commit 080ef272b1
6 changed files with 15 additions and 23 deletions

View File

@ -35,18 +35,10 @@ $(document).ready( function() {
$(ev.currentTarget).datepicker('hide'); $(ev.currentTarget).datepicker('hide');
}); });
// $(".chzn-select").chosen({width: "95%"});
// $(".chzn-select-deselect").chosen({allow_single_deselect:true});
$(".chzn-select").select2({ $(".chzn-select").select2({
width: '100%', width: '100%',
templateResult: chzn_template_func templateResult: chzn_template_func
}); });
$(".chzn-select-deselect").select2({
allowClear:true,
width: '100%',
templateResult: chzn_template_func
});
/* change the color and length of the bar graph showing the password /* change the color and length of the bar graph showing the password
* strength on each change to the passwod field. * strength on each change to the passwod field.
@ -376,7 +368,6 @@ $(document).ready( function() {
element.prepend('<div style="position: _absolute; overflow: hidden; background: #f7f7f7; z-index: 1000; height: 200px; width: '+element.width()+'px; opacity: 0.7; display: table;"><div style="display: table-cell;text-align: center; vertical-align: middle; "><img src="../views/bootstrap/images/ajax-loader.gif"></div>'); element.prepend('<div style="position: _absolute; overflow: hidden; background: #f7f7f7; z-index: 1000; height: 200px; width: '+element.width()+'px; opacity: 0.7; display: table;"><div style="display: table-cell;text-align: center; vertical-align: middle; "><img src="../views/bootstrap/images/ajax-loader.gif"></div>');
$.get(url, function(data) { $.get(url, function(data) {
element.html(data); element.html(data);
// $(".chzn-select").chosen();
$(".chzn-select").select2({ $(".chzn-select").select2({
width: '100%', width: '100%',
templateResult: chzn_template_func templateResult: chzn_template_func
@ -424,7 +415,6 @@ $(document).ready( function() {
element.prepend('<div style="position: absolute; overflow: hidden; background: #f7f7f7; z-index: 1000; height: '+element.height()+'px; width: '+element.width()+'px; opacity: 0.7; display: table;"><div style="display: table-cell;text-align: center; vertical-align: middle; "><img src="../views/bootstrap/images/ajax-loader.gif"></div>'); element.prepend('<div style="position: absolute; overflow: hidden; background: #f7f7f7; z-index: 1000; height: '+element.height()+'px; width: '+element.width()+'px; opacity: 0.7; display: table;"><div style="display: table-cell;text-align: center; vertical-align: middle; "><img src="../views/bootstrap/images/ajax-loader.gif"></div>');
$.get(url, function(data) { $.get(url, function(data) {
element.html(data); element.html(data);
// $(".chzn-select").chosen();
$(".chzn-select").select2({ $(".chzn-select").select2({
width: '100%', width: '100%',
templateResult: chzn_template_func templateResult: chzn_template_func

View File

@ -372,8 +372,8 @@ $(document).ready(function() {
'element'=>'select', 'element'=>'select',
'id'=>'workflow', 'id'=>'workflow',
'name'=>'workflow', 'name'=>'workflow',
'class'=>'chzn-select-deselect', 'class'=>'chzn-select',
'attributes'=>array(array('data-placeholder', getMLText('select_workflow'))), 'attributes'=>array(array('data-allow-clear', 'true'), array('data-placeholder', getMLText('select_workflow'))),
'options'=>$options 'options'=>$options
) )
); );
@ -390,8 +390,8 @@ $(document).ready(function() {
'element'=>'select', 'element'=>'select',
'id'=>'workflow', 'id'=>'workflow',
'name'=>'workflow', 'name'=>'workflow',
'class'=>'chzn-select-deselect', 'class'=>'chzn-select',
'attributes'=>array(array('data-placeholder', getMLText('select_workflow'))), 'attributes'=>array(array('data-allow-clear', 'true'), array('data-placeholder', getMLText('select_workflow'))),
'options'=>$options 'options'=>$options
) )
); );

View File

@ -200,7 +200,9 @@ $(document).ready(function() {
array( array(
'element'=>'select', 'element'=>'select',
'name'=>'userid', 'name'=>'userid',
'id'=>'userid',
'class'=>'chzn-select', 'class'=>'chzn-select',
'attributes'=>array(array('data-allow-clear', 'true'), array('data-placeholder',getMLText('select_user'))),
'options'=>$options 'options'=>$options
) )
); );
@ -215,7 +217,7 @@ $(document).ready(function() {
'element'=>'select', 'element'=>'select',
'name'=>'groupid', 'name'=>'groupid',
'class'=>'chzn-select', 'class'=>'chzn-select',
'attributes'=>array(array('data-placeholder', getMLText('select_group'))), 'attributes'=>array(array('data-allow-clear', 'true'), array('data-placeholder', getMLText('select_group'))),
'options'=>$options 'options'=>$options
) )
); );

View File

@ -150,7 +150,7 @@ class SeedDMS_View_Search extends SeedDMS_Bootstrap_Style {
<tr> <tr>
<td><?php printMLText("owner");?>:</td> <td><?php printMLText("owner");?>:</td>
<td> <td>
<select class="chzn-select-deselect" name="ownerid" data-placeholder="<?php printMLText('select_users'); ?>" data-no_results_text="<?php printMLText('unknown_owner'); ?>"> <select class="chzn-select" name="ownerid" data-allow-clear="true" data-placeholder="<?php printMLText('select_users'); ?>" data-no_results_text="<?php printMLText('unknown_owner'); ?>">
<option value="-1"></option> <option value="-1"></option>
<?php <?php
foreach ($allUsers as $userObj) { foreach ($allUsers as $userObj) {
@ -393,7 +393,7 @@ class SeedDMS_View_Search extends SeedDMS_Bootstrap_Style {
<tr> <tr>
<td><?php printMLText("owner");?>:</td> <td><?php printMLText("owner");?>:</td>
<td> <td>
<select class="chzn-select-deselect" name="ownerid" data-placeholder="<?php printMLText('select_users'); ?>" data-no_results_text="<?php printMLText('unknown_owner'); ?>"> <select class="chzn-select" name="ownerid" data-allow-clear="true" data-placeholder="<?php printMLText('select_users'); ?>" data-no_results_text="<?php printMLText('unknown_owner'); ?>">
<option value="-1"></option> <option value="-1"></option>
<?php <?php
foreach ($allUsers as $userObj) { foreach ($allUsers as $userObj) {

View File

@ -481,7 +481,7 @@ $this->showStartPaneContent('site', (!$currenttab || $currenttab == 'site'));
case "categories": case "categories":
$categories = $dms->getDocumentCategories(); $categories = $dms->getDocumentCategories();
if($categories) { if($categories) {
echo "<select class=\"chzn-select".($allowempty ? "-deselect" : "")."\" name=\"extensions[".$extname."][".$confkey."][]\"".(!empty($conf['multiple']) ? " multiple" : "").(!empty($conf['size']) ? " size=\"".$conf['size']."\"" : "")." data-placeholder=\"".getMLText("select_category")."\">"; echo "<select class=\"chzn-select".($allowempty ? " data-allow-clear=\"true\"" : "")."\" name=\"extensions[".$extname."][".$confkey."][]\"".(!empty($conf['multiple']) ? " multiple" : "").(!empty($conf['size']) ? " size=\"".$conf['size']."\"" : "")." data-placeholder=\"".getMLText("select_category")."\">";
if($allowempty) if($allowempty)
echo "<option value=\"\"></option>"; echo "<option value=\"\"></option>";
foreach($categories as $category) { foreach($categories as $category) {
@ -496,7 +496,7 @@ $this->showStartPaneContent('site', (!$currenttab || $currenttab == 'site'));
case "users": case "users":
$users = $dms->getAllUsers(); $users = $dms->getAllUsers();
if($users) { if($users) {
echo "<select class=\"chzn-select".($allowempty ? "-deselect" : "")."\" name=\"extensions[".$extname."][".$confkey."][]\"".(!empty($conf['multiple']) ? " multiple" : "").(!empty($conf['size']) ? " size=\"".$conf['size']."\"" : "")." data-placeholder=\"".getMLText("select_user")."\">"; echo "<select class=\"chzn-select".($allowempty ? " data-allow-clear=\"true\"" : "")."\" name=\"extensions[".$extname."][".$confkey."][]\"".(!empty($conf['multiple']) ? " multiple" : "").(!empty($conf['size']) ? " size=\"".$conf['size']."\"" : "")." data-placeholder=\"".getMLText("select_user")."\">";
if($allowempty) if($allowempty)
echo "<option value=\"\"></option>"; echo "<option value=\"\"></option>";
foreach($users as $curuser) { foreach($users as $curuser) {
@ -511,7 +511,7 @@ $this->showStartPaneContent('site', (!$currenttab || $currenttab == 'site'));
case "groups": case "groups":
$recs = $dms->getAllGroups(); $recs = $dms->getAllGroups();
if($recs) { if($recs) {
echo "<select class=\"chzn-select".($allowempty ? "-deselect" : "")."\" name=\"extensions[".$extname."][".$confkey."][]\"".(!empty($conf['multiple']) ? " multiple" : "").(!empty($conf['size']) ? " size=\"".$conf['size']."\"" : "")." data-placeholder=\"".getMLText("select_group")."\">"; echo "<select class=\"chzn-select".($allowempty ? " data-allow-clear=\"true\"" : "")."\" name=\"extensions[".$extname."][".$confkey."][]\"".(!empty($conf['multiple']) ? " multiple" : "").(!empty($conf['size']) ? " size=\"".$conf['size']."\"" : "")." data-placeholder=\"".getMLText("select_group")."\">";
if($allowempty) if($allowempty)
echo "<option value=\"\"></option>"; echo "<option value=\"\"></option>";
foreach($recs as $rec) { foreach($recs as $rec) {
@ -526,7 +526,7 @@ $this->showStartPaneContent('site', (!$currenttab || $currenttab == 'site'));
case "attributedefinitions": case "attributedefinitions":
$recs = $dms->getAllAttributeDefinitions(); $recs = $dms->getAllAttributeDefinitions();
if($recs) { if($recs) {
echo "<select class=\"chzn-select".($allowempty ? "-deselect" : "")."\" name=\"extensions[".$extname."][".$confkey."][]\"".(!empty($conf['multiple']) ? " multiple" : "").(!empty($conf['size']) ? " size=\"".$conf['size']."\"" : "")." data-placeholder=\"".getMLText("select_attribute_value")."\">"; echo "<select class=\"chzn-select".($allowempty ? " data-allow-clear=\"true\"" : "")."\" name=\"extensions[".$extname."][".$confkey."][]\"".(!empty($conf['multiple']) ? " multiple" : "").(!empty($conf['size']) ? " size=\"".$conf['size']."\"" : "")." data-placeholder=\"".getMLText("select_attribute_value")."\">";
if($allowempty) if($allowempty)
echo "<option value=\"\"></option>"; echo "<option value=\"\"></option>";
foreach($recs as $rec) { foreach($recs as $rec) {

View File

@ -642,7 +642,7 @@ console.log(element);
<?php <?php
} else { } else {
?> ?>
<select class="_chzn-select-deselect span9" name="workflow" data-placeholder="<?php printMLText('select_workflow'); ?>"> <select class="_chzn-select span9" _data-allow-clear="true" name="workflow" data-placeholder="<?php printMLText('select_workflow'); ?>">
<?php <?php
$curworkflow = $latestContent->getWorkflow(); $curworkflow = $latestContent->getWorkflow();
foreach ($mandatoryworkflows as $workflow) { foreach ($mandatoryworkflows as $workflow) {
@ -657,7 +657,7 @@ console.log(element);
} }
} else { } else {
?> ?>
<select class="_chzn-select-deselect span9" name="workflow" data-placeholder="<?php printMLText('select_workflow'); ?>"> <select class="_chzn-select span9" _data-allow-clear="true" name="workflow" data-placeholder="<?php printMLText('select_workflow'); ?>">
<?php <?php
$workflows=$dms->getAllWorkflows(); $workflows=$dms->getAllWorkflows();
print "<option value=\"\">"."</option>"; print "<option value=\"\">"."</option>";