Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpnSense
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
OpnSense
Commits
92042ebb
Commit
92042ebb
authored
Apr 01, 2015
by
Jos Schellevis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
style fixes in javascript
parent
4d00208b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
10 deletions
+12
-10
opnsense.js
src/opnsense/www/js/opnsense.js
+12
-10
No files found.
src/opnsense/www/js/opnsense.js
View file @
92042ebb
...
...
@@ -8,12 +8,12 @@ function getFormData(parent) {
data
=
{};
$
(
"
#
"
+
parent
+
"
input,#
"
+
parent
+
"
select
"
).
each
(
function
(
index
)
{
if
(
$
(
this
).
attr
(
'
id
'
)
==
undefined
)
{
if
(
$
(
this
).
prop
(
'
id
'
)
==
undefined
)
{
// we need an id.
return
;
}
node
=
data
;
keyparts
=
$
(
this
).
attr
(
'
id
'
).
split
(
'
.
'
);
keyparts
=
$
(
this
).
prop
(
'
id
'
).
split
(
'
.
'
);
for
(
var
i
in
keyparts
)
{
if
(
!
(
keyparts
[
i
]
in
node
))
{
node
[
keyparts
[
i
]]
=
{};
...
...
@@ -25,7 +25,9 @@ function getFormData(parent) {
// selectbox, collect selected items
var
tmp_str
=
""
;
$
(
this
).
children
().
each
(
function
(
index
){
if
(
$
(
this
).
prop
(
"
selected
"
)){
// normally this should use prop, but this sometimes seem to return incorrect data....
// maybe replace this with a later version of jquery. tested with 1.11.2
if
(
$
(
this
).
attr
(
"
selected
"
)
!=
undefined
){
if
(
tmp_str
!=
""
)
tmp_str
=
tmp_str
+
"
,
"
;
tmp_str
=
tmp_str
+
$
(
this
).
val
();
}
...
...
@@ -63,12 +65,12 @@ function getFormData(parent) {
*/
function
setFormData
(
parent
,
data
)
{
$
(
"
#
"
+
parent
+
"
input,#
"
+
parent
+
"
select
"
).
each
(
function
(
index
)
{
if
(
$
(
this
).
attr
(
'
id
'
)
==
undefined
)
{
if
(
$
(
this
).
prop
(
'
id
'
)
==
undefined
)
{
// we need an id.
return
;
}
node
=
data
;
keyparts
=
$
(
this
).
attr
(
'
id
'
).
split
(
'
.
'
);
keyparts
=
$
(
this
).
prop
(
'
id
'
).
split
(
'
.
'
);
for
(
var
i
in
keyparts
)
{
if
(
!
(
keyparts
[
i
]
in
node
))
{
break
;
...
...
@@ -111,12 +113,12 @@ function setFormData(parent,data) {
*/
function
handleFormValidation
(
parent
,
validationErrors
)
{
$
(
"
#
"
+
parent
+
"
input
"
).
each
(
function
(
index
)
{
if
(
validationErrors
!=
undefined
&&
$
(
this
).
attr
(
'
id
'
)
in
validationErrors
)
{
$
(
"
*[for='
"
+
$
(
this
).
attr
(
'
id
'
)
+
"
']
"
).
addClass
(
"
has-error
"
);
$
(
"
span[for='
"
+
$
(
this
).
attr
(
'
id
'
)
+
"
']
"
).
text
(
validationErrors
[
$
(
this
).
attr
(
'
id
'
)]);
if
(
validationErrors
!=
undefined
&&
$
(
this
).
prop
(
'
id
'
)
in
validationErrors
)
{
$
(
"
*[for='
"
+
$
(
this
).
prop
(
'
id
'
)
+
"
']
"
).
addClass
(
"
has-error
"
);
$
(
"
span[for='
"
+
$
(
this
).
prop
(
'
id
'
)
+
"
']
"
).
text
(
validationErrors
[
$
(
this
).
prop
(
'
id
'
)]);
}
else
{
$
(
"
*[for='
"
+
$
(
this
).
attr
(
'
id
'
)
+
"
']
"
).
removeClass
(
"
has-error
"
);
$
(
"
span[for='
"
+
$
(
this
).
attr
(
'
id
'
)
+
"
']
"
).
text
(
""
);
$
(
"
*[for='
"
+
$
(
this
).
prop
(
'
id
'
)
+
"
']
"
).
removeClass
(
"
has-error
"
);
$
(
"
span[for='
"
+
$
(
this
).
prop
(
'
id
'
)
+
"
']
"
).
text
(
""
);
}
});
}
...
...
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