Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
dream
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
dream
Commits
8aa5e465
Commit
8aa5e465
authored
Jun 18, 2014
by
Romain Courteaud
🐙
Committed by
Jérome Perrin
Aug 11, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add number field gadget.
parent
54af62b4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
0 deletions
+49
-0
dream/platform/src2/number_field/index.html
dream/platform/src2/number_field/index.html
+18
-0
dream/platform/src2/number_field/numberfield.js
dream/platform/src2/number_field/numberfield.js
+31
-0
No files found.
dream/platform/src2/number_field/index.html
0 → 100644
View file @
8aa5e465
<!DOCTYPE html>
<html>
<head>
<meta
http-equiv=
"Content-type"
content=
"text/html; charset=utf-8"
/>
<meta
name=
"viewport"
content=
"width=device-width, user-scalable=no"
/>
<title>
Number field
</title>
<!-- renderjs -->
<script
src=
"../<%= copy.rsvp.relative_dest %>"
></script>
<script
src=
"../<%= copy.renderjs.relative_dest %>"
></script>
<!-- custom script -->
<script
src=
"numberfield.js"
type=
"text/javascript"
></script>
</head>
<body>
<input
type=
'number'
step=
"any"
data-mini=
"true"
/>
</body>
</html>
dream/platform/src2/number_field/numberfield.js
0 → 100644
View file @
8aa5e465
/*global window, rJS */
(
function
(
window
,
rJS
)
{
"
use strict
"
;
rJS
(
window
)
.
ready
(
function
(
gadget
)
{
return
gadget
.
getElement
()
.
push
(
function
(
element
)
{
gadget
.
element
=
element
;
});
})
.
declareMethod
(
'
render
'
,
function
(
options
)
{
var
input
=
this
.
element
.
querySelector
(
'
input
'
),
field_json
=
options
.
field_json
||
{};
input
.
setAttribute
(
'
value
'
,
field_json
.
value
);
input
.
setAttribute
(
'
name
'
,
field_json
.
key
);
input
.
setAttribute
(
'
title
'
,
field_json
.
title
);
})
.
declareMethod
(
'
getContent
'
,
function
()
{
var
input
=
this
.
element
.
querySelector
(
'
input
'
),
result
=
{};
if
(
input
.
value
!==
""
)
{
result
[
input
.
getAttribute
(
'
name
'
)]
=
parseFloat
(
input
.
value
);
}
else
{
result
[
input
.
getAttribute
(
'
name
'
)]
=
null
;
}
return
result
;
});
}(
window
,
rJS
));
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment