Skip to content

Commit 19c1a0a

Browse files
author
Josh Walker
committed
Adding back autocomplete throbber, now with extra Bootstrap!
1 parent d2851c9 commit 19c1a0a

File tree

2 files changed

+96
-16
lines changed

2 files changed

+96
-16
lines changed

css/tweaks.css

Lines changed: 51 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -183,10 +183,52 @@ ul.links {
183183
list-style: none outside none;
184184
}
185185

186-
html.js input.form-autocomplete {
186+
/* Handle the FontAwesome throbber */
187+
html.js input[autocomplete],
188+
html.js input.throbbing {
187189
background: transparent;
188190
}
189191

192+
.form-control-feedback {
193+
width: 13px;
194+
height: 13px;
195+
color: #bbb;
196+
top: 60%;
197+
right: 10px;
198+
}
199+
200+
input.throbbing + .form-control-feedback {
201+
-webkit-animation: fa-spin 2s infinite linear;
202+
animation: fa-spin 2s infinite linear;
203+
}
204+
205+
input.throbbing + .form-control-feedback:before {
206+
color: rgba(95, 95, 95, 1);
207+
}
208+
209+
@-webkit-keyframes fa-spin {
210+
0% {
211+
-webkit-transform: rotate(0deg);
212+
transform: rotate(0deg);
213+
}
214+
100% {
215+
-webkit-transform: rotate(359deg);
216+
transform: rotate(359deg);
217+
}
218+
}
219+
220+
@keyframes fa-spin {
221+
0% {
222+
-webkit-transform: rotate(0deg);
223+
transform: rotate(0deg);
224+
}
225+
100% {
226+
-webkit-transform: rotate(359deg);
227+
transform: rotate(359deg);
228+
}
229+
}
230+
231+
190232
form .form-actions .btn {
191233
margin-right: 10px;
192234
}
@@ -279,19 +321,13 @@ ul.panels-ipe-linkbar {
279321
margin-left: 10px;
280322
}
281323

282-
/* Bootstrap 3.2.0 Checkboxes Fix*/
283-
table .radio input[type="radio"],
284-
table .radio-inline input[type="radio"],
285-
table .checkbox input[type="checkbox"],
286-
table .checkbox-inline input[type="checkbox"],
287-
table .checkbox,table .radio{
324+
.features-export-component .radio input[type="radio"],
325+
.features-export-component .radio-inline input[type="radio"],
326+
.features-export-component .checkbox input[type="checkbox"],
327+
.features-export-component .checkbox-inline input[type="checkbox"],
328+
.features-export-list .radio input[type="radio"],
329+
.features-export-list .radio-inline input[type="radio"],
330+
.features-export-list .checkbox input[type="checkbox"],
331+
.features-export-list .checkbox-inline input[type="checkbox"] {
288332
margin-left: 0px;
289-
position:static;
290-
}
291-
292-
293-
/* Module Filter Display*/
294-
#module-filter-left ul li.active{
295-
margin-right:0px;
296-
width:100%;
297333
}

includes/fapi.inc

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ function kalatheme_process_element(&$element, &$form_state) {
5656
function kalatheme_process_input(&$element, &$form_state) {
5757
$types = array(
5858
'textfield',
59+
'textarea',
5960
'password',
6061
'password_confirm',
6162
'select',
@@ -71,9 +72,47 @@ function kalatheme_process_input(&$element, &$form_state) {
7172
if (!empty($element['#type']) && (in_array($element['#type'], $types))) {
7273
$element['#attributes']['class'][] = 'form-control';
7374
}
75+
7476
return $element;
7577
}
7678

79+
/**
80+
* Implements theme_textfield().
81+
*/
82+
function kalatheme_textfield($variables) {
83+
$element = $variables['element'];
84+
$element['#attributes']['type'] = 'text';
85+
element_set_attributes($element, array(
86+
'id',
87+
'name',
88+
'value',
89+
'size',
90+
'maxlength',
91+
));
92+
_form_set_class($element, array('form-text'));
93+
94+
$output = '<input' . drupal_attributes($element['#attributes']) . ' />';
95+
96+
$extra = '';
97+
if (isset($element['#autocomplete_path']) && drupal_valid_path($element['#autocomplete_path'])) {
98+
drupal_add_library('system', 'drupal.autocomplete');
99+
$element ['#attributes']['class'][] = 'form-autocomplete';
100+
101+
$attributes = array();
102+
$attributes ['type'] = 'hidden';
103+
$attributes ['id'] = $element ['#attributes']['id'] . '-autocomplete';
104+
$attributes ['value'] = url($element ['#autocomplete_path'], array('absolute' => TRUE));
105+
$attributes ['disabled'] = 'disabled';
106+
$attributes ['class'][] = 'autocomplete';
107+
$extra = '<input' . drupal_attributes($attributes) . ' />';
108+
109+
// Add form control feedback.
110+
$icon = '<span class="fa fa-circle-o-notch form-control-feedback" aria-hidden="true"></span>';
111+
$output = $output . $icon;
112+
}
113+
114+
return $output . $extra;
115+
}
77116

78117
/**
79118
* Implements theme_form_element().
@@ -121,6 +160,11 @@ function kalatheme_form_element($variables) {
121160
}
122161
else {
123162
$attributes['class'][] = 'form-group';
163+
164+
//
165+
if (isset($element['#autocomplete_path']) && drupal_valid_path($element['#autocomplete_path'])) {
166+
$attributes['class'][] = 'has-feedback';
167+
}
124168
}
125169
}
126170

@@ -248,7 +292,7 @@ function kalatheme_textarea($variables) {
248292
if(isset($element['#rows'])){
249293
$element['#attributes']['rows'] = $element['#rows'];
250294
}
251-
_form_set_class($element, array('form-textarea','form-control'));
295+
_form_set_class($element, array('form-textarea'));
252296

253297
$wrapper_attributes = array(
254298
'class' => array('form-textarea-wrapper'),

0 commit comments

Comments
 (0)