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
piks3l
Respect My Net
Commits
2905e87d
Commit
2905e87d
authored
Apr 30, 2011
by
stef
Browse files
[enh] bound form is not hidden
parent
8ad073fa
Changes
2
Hide whitespace changes
Inline
Side-by-side
media/js/form.js
View file @
2905e87d
$
(
document
).
ready
(
function
(){
$
(
"
.fieldWrapper
"
).
hide
();
$
(
'
.help_text
'
).
hide
();
$
(
"
.fieldWrapper
"
).
hover
(
function
(
event
)
{
$
(
this
).
find
(
'
.help_text
'
).
toggle
();});
$
(
"
#show_optionals
"
).
hide
();
$
(
"
#id_country
"
).
parent
().
show
();
$
(
"
#save_button
"
).
hide
();
$
(
"
#id_contractual
"
).
click
(
function
(
event
)
{
$
(
"
#id_contract_excerpt_parent
"
).
parent
().
toggle
();
});
$
(
"
#show_optionals
"
).
click
(
function
(
event
)
{
$
(
this
).
hide
();
$
(
"
#optional .fieldWrapper
"
).
show
();
$
(
"
#id_contract_excerpt_parent
"
).
parent
().
hide
();
});
$
(
'
#id_country
'
).
change
(
function
()
{
var
country
=
$
(
this
).
attr
(
'
value
'
);
if
(
country
.
length
>
0
)
{
$
(
'
#id_operator
'
).
parent
().
show
();
$
.
getJSON
(
'
/ajax/
'
+
country
,
function
(
data
)
{
$
(
"
#id_operator
"
).
autocomplete
(
data
,
{
minChars
:
0
,
autoFill
:
true
,
});
});
}
});
$
(
'
#id_operator
'
).
change
(
function
()
{
var
country
=
$
(
'
#id_country
'
).
attr
(
'
value
'
);
var
operator
=
$
(
this
).
val
();
if
(
operator
.
length
>
0
)
{
$
(
'
#id_contract
'
).
parent
().
show
();
$
.
getJSON
(
'
/ajax/
'
+
country
+
'
/
'
+
operator
,
function
(
data
)
{
$
(
"
#id_contract
"
).
autocomplete
(
data
,{
minChars
:
0
,
});
});
}
});
$
(
'
#id_contract
'
).
change
(
function
()
{
if
(
$
(
this
).
val
().
length
>
0
)
{
$
(
'
#id_comment
'
).
parent
().
show
();
$
(
'
#id_email
'
).
parent
().
show
();
$
(
'
#id_attachments0
'
).
parent
().
show
();
$
(
'
#id_captcha_0
'
).
parent
().
show
();
$
(
'
#save_button
'
).
show
();
$
(
"
#show_optionals
"
).
show
();
}
});
});
function
init_form
()
{
$
(
'
.help_text
'
).
hide
();
$
(
"
.fieldWrapper
"
).
hover
(
function
(
event
)
{
$
(
this
).
find
(
'
.help_text
'
).
toggle
();});
$
(
"
#show_optionals
"
).
hide
();
$
(
"
#id_contractual
"
).
click
(
function
(
event
)
{
$
(
"
#id_contract_excerpt_parent
"
).
parent
().
toggle
();
});
$
(
"
#show_optionals
"
).
click
(
function
(
event
)
{
$
(
this
).
hide
();
$
(
"
#optional .fieldWrapper
"
).
show
();
$
(
"
#id_contract_excerpt_parent
"
).
parent
().
hide
();
});
$
(
'
#id_country
'
).
change
(
function
()
{
var
country
=
$
(
this
).
attr
(
'
value
'
);
if
(
country
.
length
>
0
)
{
$
(
'
#id_operator
'
).
parent
().
show
();
$
.
getJSON
(
'
/ajax/
'
+
country
,
function
(
data
)
{
$
(
"
#id_operator
"
).
autocomplete
(
data
,
{
minChars
:
0
,
autoFill
:
true
,
});
});
}
});
$
(
'
#id_operator
'
).
change
(
function
()
{
var
country
=
$
(
'
#id_country
'
).
attr
(
'
value
'
);
var
operator
=
$
(
this
).
val
();
if
(
operator
.
length
>
0
)
{
$
(
'
#id_contract
'
).
parent
().
show
();
$
.
getJSON
(
'
/ajax/
'
+
country
+
'
/
'
+
operator
,
function
(
data
)
{
$
(
"
#id_contract
"
).
autocomplete
(
data
,{
minChars
:
0
,
});
});
}
});
$
(
'
#id_contract
'
).
change
(
function
()
{
if
(
$
(
this
).
val
().
length
>
0
)
{
$
(
'
#id_comment
'
).
parent
().
show
();
$
(
'
#id_email
'
).
parent
().
show
();
$
(
'
#id_attachments0
'
).
parent
().
show
();
}
});
$
(
'
#id_email
'
).
change
(
function
()
{
if
(
$
(
this
).
val
().
length
>
0
)
{
$
(
'
#id_captcha_0
'
).
parent
().
show
();
$
(
'
#save_button
'
).
show
();
$
(
"
#show_optionals
"
).
show
();
}
});
}
templates/add.html
View file @
2905e87d
...
...
@@ -10,6 +10,20 @@
<script
type=
"text/javascript"
src=
"{%media_url%}/js/jquery.1.4.2.min.js"
></script>
<script
type=
"text/javascript"
src=
"{%media_url%}/js/jquery.autocomplete.js"
></script>
<script
type=
"text/javascript"
src=
"{%media_url%}/js/form.js"
></script>
<script
type=
"text/javascript"
>
$
(
document
).
ready
(
function
(){
init_form
();
{
%
if
not
form
.
is_bound
%
}
$
(
"
.fieldWrapper
"
).
hide
();
$
(
"
#id_country
"
).
parent
().
show
();
$
(
"
#save_button
"
).
hide
();
{
%
else
%
}
if
(
$
(
"
#id_contractual
"
).
attr
(
'
checked
'
)
==
false
)
{
$
(
"
#id_contract_excerpt
"
).
parent
().
hide
();
}
{
%
endif
%
}
});
</script>
{% endblock %}
{%block content%}
...
...
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