Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
typo3
qfq
Commits
27586412
Commit
27586412
authored
Mar 23, 2016
by
Rafael Ostertag
Browse files
FormGroup.js: tweaked readonly/enabled state display.
parent
447298dd
Changes
1
Hide whitespace changes
Inline
Side-by-side
javascript/src/Element/FormGroup.js
View file @
27586412
...
...
@@ -92,12 +92,48 @@ if (!QfqNS.Element) {
};
n
.
FormGroup
.
prototype
.
setEnabled
=
function
(
enabled
)
{
this
.
$formGroup
.
data
(
"
enabled
"
,
enabled
);
this
.
$element
.
prop
(
'
disabled
'
,
!
enabled
);
// Test if we're not readonly, if so set classes. This is required because we share `text-muted` with the
// readonly-state
if
(
this
.
$formGroup
.
data
(
"
readonly
"
)
!==
true
)
{
if
(
enabled
)
{
this
.
$formGroup
.
removeClass
(
"
text-muted
"
);
}
else
{
this
.
$formGroup
.
addClass
(
"
text-muted
"
);
}
}
if
(
enabled
)
{
this
.
$label
.
removeClass
(
"
disabled
"
);
this
.
$element
.
parents
(
"
div[class=radio]
"
).
removeClass
(
"
disabled
"
);
}
else
{
this
.
$label
.
addClass
(
"
disabled
"
);
this
.
$element
.
parents
(
"
div[class=radio]
"
).
addClass
(
"
disabled
"
);
}
};
n
.
FormGroup
.
prototype
.
setReadOnly
=
function
(
readonly
)
{
this
.
$formGroup
.
data
(
"
readonly
"
,
readonly
);
this
.
$element
.
prop
(
'
readonly
'
,
readonly
);
this
.
handleReadOnlyEmulationIfRequired
(
readonly
);
// Test if we're enabled, if so set classes. This is required because we share `text-muted` with the
// enabled-state
if
(
this
.
$formGroup
.
data
(
"
enabled
"
)
!==
false
)
{
if
(
readonly
)
{
this
.
$formGroup
.
addClass
(
"
text-muted
"
);
}
else
{
this
.
$formGroup
.
removeClass
(
"
text-muted
"
);
}
}
if
(
readonly
)
{
this
.
$label
.
addClass
(
"
readonly
"
);
}
else
{
this
.
$formGroup
.
removeClass
(
"
readonly
"
);
}
};
/**
...
...
Write
Preview
Supports
Markdown
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