Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
drupal.org
better_formats
Commits
85961a0f
Commit
85961a0f
authored
Dec 23, 2008
by
dragonwize
Browse files
fixed bug with allowed formats per node type javascript helper
parent
840425d5
Changes
1
Hide whitespace changes
Inline
Side-by-side
better_formats_node_type_form.js
View file @
85961a0f
...
...
@@ -9,24 +9,44 @@
* Also hides formats that are not available per the Allowed checkboxes.
*/
function
better_formats_toggle_formats
(
el
)
{
$
(
'
select.bf-default-formats option
'
).
each
(
function
()
{
var
option
=
$
(
this
);
if
(
option
.
val
()
==
el
.
val
())
{
if
(
el
.
attr
(
'
checked
'
))
{
// hide all formats except site default when the first box is checked
if
(
Drupal
.
settings
.
better_formats
.
num_checked
===
0
)
{
$
(
'
select.bf-default-formats option[value != "0"]
'
).
hide
();
}
Drupal
.
settings
.
better_formats
.
num_checked
+=
1
;
option
.
show
();
}
else
{
option
.
removeAttr
(
'
selected
'
).
hide
();
// keep num_checked from going below zero
if
(
Drupal
.
settings
.
better_formats
.
num_checked
>
0
)
{
Drupal
.
settings
.
better_formats
.
num_checked
-=
1
;
}
// show all globally allowed formats if no boxes are checked
if
(
Drupal
.
settings
.
better_formats
.
num_checked
===
0
)
{
// show global formats available to roles
// because no format allowed boxes are checked
$
(
'
select.bf-default-formats option
'
).
show
();
}
}
}
});
}
function
better_formats_show_global_formats
()
{
$
(
'
select.bf-default-formats option
'
).
show
();
}
$
(
document
).
ready
(
function
()
{
// set default settings check for use of global allowed formats
Drupal
.
settings
.
better_formats
=
{
"
num_checked
"
:
0
};
// collapsing the input format setting after the weight columns have been hidden
$
(
'
.input-format-settings > legend > a
'
).
click
();
//
//
add hide/show events for allowed formats
$
(
'
input.bf-allowed-formats
'
).
click
(
function
()
{
better_formats_toggle_formats
(
$
(
this
));
}).
each
(
function
()
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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