Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
edx
edx-platform
Commits
e7165306
Commit
e7165306
authored
Mar 25, 2013
by
Brian Talbot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
edx.org - added necessary JS and Sass to disabled login/register button when form is submitting
parent
dc1a7f5d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
24 deletions
+47
-24
lms/static/sass/multicourse/_account.scss
+1
-0
lms/templates/login.html
+16
-6
lms/templates/register.html
+30
-18
No files found.
lms/static/sass/multicourse/_account.scss
View file @
e7165306
...
...
@@ -392,6 +392,7 @@
&
:disabled
{
opacity
:
0
.3
;
cursor
:
default
!
important
;
}
}
...
...
lms/templates/login.html
View file @
e7165306
...
...
@@ -26,16 +26,13 @@
}).
blur
(
function
()
{
$
(
"label"
).
parent
().
removeClass
(
"is-focused"
);
});
});
</script>
<script
type=
"text/javascript"
>
(
function
()
{
$
(
document
).
delegate
(
'#login-form'
,
'ajax:success'
,
function
(
data
,
json
,
xhr
)
{
if
(
json
.
success
)
{
$
(
'.message.submission-error'
).
removeClass
(
'is-shown'
);
toggleSubmitButton
();
var
u
=
decodeURI
(
window
.
location
.
search
);
next
=
u
.
split
(
"next="
)[
1
];
if
(
next
)
{
...
...
@@ -45,12 +42,25 @@
}
}
else
{
$
(
'.message.submission-error'
).
addClass
(
'is-shown'
);
toggleSubmitButton
();
$
(
'.message.submission-error .message-copy'
).
html
(
json
.
value
);
}
});
})(
this
)
</script>
})(
this
);
function
toggleSubmitButton
(
e
)
{
var
$msgError
=
$
(
'form .status.submission-error'
);
var
$submitButton
=
$
(
'form .form-actions #submit'
);
if
(
!
$msgError
.
hasClass
(
'is-shown'
))
{
$submitButton
.
prop
(
'disabled'
,
true
);
}
else
{
$submitButton
.
prop
(
'disabled'
,
false
);
}
}
</script>
</
%
block>
<section
class=
"introduction"
>
...
...
lms/templates/register.html
View file @
e7165306
...
...
@@ -33,6 +33,34 @@
});
});
(
function
()
{
$
(
document
).
delegate
(
'#register-form'
,
'ajax:success'
,
function
(
data
,
json
,
xhr
)
{
if
(
json
.
success
)
{
$
(
'.message.submission-error'
).
removeClass
(
'is-shown'
);
toggleSubmitButton
();
location
.
href
=
"${reverse('dashboard')}"
;
}
else
{
$
(
'.status.message.submission-error'
).
addClass
(
'is-shown'
);
$
(
'.status.message.submission-error .message-copy'
).
html
(
json
.
value
).
stop
().
css
(
"display"
,
"block"
);
$
(
".field-error"
).
removeClass
(
'field-error'
);
$
(
"[data-field='"
+
json
.
field
+
"']"
).
addClass
(
'field-error'
)
}
});
})(
this
);
function
toggleSubmitButton
(
e
)
{
var
$msgError
=
$
(
'form .status.submission-error'
);
var
$submitButton
=
$
(
'form .form-actions #submit'
).
prop
(
'disabled'
,
true
);
if
(
!
$msgError
.
hasClass
(
'is-shown'
))
{
$submitButton
.
prop
(
'disabled'
,
true
);
}
else
{
$submitButton
.
prop
(
'disabled'
,
false
);
}
}
</script>
</
%
block>
...
...
@@ -208,21 +236,4 @@
<p>
Need help in registering with edX?
<a
href=
"#"
>
View our FAQs for answers to commonly asked questions
</a>
. Once registered, most questions can be answered in the course specific discussion forums or through the FAQs.
</p>
</div>
</aside>
</section>
<script
type=
"text/javascript"
>
(
function
()
{
$
(
document
).
delegate
(
'#register-form'
,
'ajax:success'
,
function
(
data
,
json
,
xhr
)
{
if
(
json
.
success
)
{
location
.
href
=
"${reverse('dashboard')}"
;
}
else
{
$
(
'.status.message.submission-error'
).
addClass
(
'is-shown'
);
$
(
'.status.message.submission-error .message-copy'
).
html
(
json
.
value
).
stop
().
css
(
"display"
,
"block"
);
$
(
".field-error"
).
removeClass
(
'field-error'
);
$
(
"[data-field='"
+
json
.
field
+
"']"
).
addClass
(
'field-error'
)
}
});
})(
this
)
</script>
</section>
\ No newline at end of file
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