Skip to content

Commit

Permalink
feature(forms): adds input/number view for numeric values input fields
Browse files Browse the repository at this point in the history
  • Loading branch information
iionly committed Sep 4, 2016
1 parent 3ee9a5c commit b796063
Show file tree
Hide file tree
Showing 10 changed files with 54 additions and 0 deletions.
2 changes: 2 additions & 0 deletions install/css/install.css
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ h3 {
}

input[type="text"],
input[type="number"],
input[type="password"],
input[type="email"],
input[type="url"] {
Expand All @@ -192,6 +193,7 @@ input[type="url"] {

input[type="password"]:focus,
input[type="text"]:focus,
input[type="number"]:focus,
input[type="email"]:focus,
input[type="url"]:focus {
background: #e4ecf5;
Expand Down
1 change: 1 addition & 0 deletions mod/aalborg_theme/views/default/aalborg_theme/css.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
margin: 0 10px 15px;
}
.elgg-sidebar input[type=text],
.elgg-sidebar input[type=number],
.elgg-sidebar input[type=password] {
box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.1);
}
Expand Down
1 change: 1 addition & 0 deletions mod/aalborg_theme/views/default/elements/forms.css.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
input[type=email]:focus,
input[type=password]:focus,
input[type=text]:focus,
input[type=number]:focus,
input[type=url]:focus,
textarea:focus {
border: solid 1px #C2C2C2;
Expand Down
1 change: 1 addition & 0 deletions mod/aalborg_theme/views/default/maintenance.css.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@
input[type=email]:focus,
input[type=password]:focus,
input[type=text]:focus,
input[type=number]:focus,
input[type=url]:focus,
textarea:focus {
border: solid 1px #C2C2C2;
Expand Down
10 changes: 10 additions & 0 deletions mod/developers/views/default/theme_sandbox/forms.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,16 @@
'value' => $ipsum,
'label' => 'Long textarea input (.elgg-input-longtext):',
));

echo elgg_view_input('number', array(
'name' => 'f15',
'id' => 'f15',
'value' => 1,
'min' => 1,
'step' => 1,
'label' => 'Number input (.elgg-input-number) with custom options:',
'help' => 'Enter an integer number larger than zero',
));
?>
</fieldset>
</form>
3 changes: 3 additions & 0 deletions views/default/admin.css.php
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,7 @@

/* default elgg core input field classes */
.elgg-input-text,
.elgg-input-number,
.elgg-input-tags,
.elgg-input-url,
.elgg-input-plaintext,
Expand Down Expand Up @@ -588,6 +589,7 @@
}

.elgg-form-useradd input[type=text],
.elgg-form-useradd input[type=number],
.elgg-form-useradd input[type=password],
.elgg-form-useradd input[type=email] {
width: 300px;
Expand Down Expand Up @@ -1887,6 +1889,7 @@
}
@media (max-width: 480px) {
.elgg-form-useradd input[type=text],
.elgg-form-useradd input[type=number],
.elgg-form-useradd input[type=password] {
width: 100%;
}
Expand Down
1 change: 1 addition & 0 deletions views/default/elements/forms.css.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
input[type=email]:focus,
input[type=password]:focus,
input[type=text]:focus,
input[type=number]:focus,
input[type=url]:focus,
textarea:focus {
border: solid 1px #4690d6;
Expand Down
23 changes: 23 additions & 0 deletions views/default/input/number.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php
/**
* Elgg number input
* Displays a number input field
*
* @package Elgg
* @subpackage Core
*
* @uses $vars['class'] Additional CSS class
*/

$vars['class'] = (array) elgg_extract('class', $vars, []);
$vars['class'][] = 'elgg-input-number';

$defaults = array(
'value' => '',
'disabled' => false,
'type' => 'number'
);

$vars = array_merge($defaults, $vars);

echo elgg_format_element('input', $vars);
1 change: 1 addition & 0 deletions views/default/maintenance.css.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@
input[type=email]:focus,
input[type=password]:focus,
input[type=text]:focus,
input[type=number]:focus,
input[type=url]:focus,
textarea:focus {
border: solid 1px #aaa;
Expand Down
11 changes: 11 additions & 0 deletions views/installation/input/number.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php
/**
* Displays a number input field
*/

$vars['class'] = 'elgg-input-number';
$vars['type'] = 'number';

$attrs = elgg_format_attributes($vars);

echo "<input $attrs>";

0 comments on commit b796063

Please sign in to comment.