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
57b38969
Commit
57b38969
authored
Oct 01, 2013
by
Julian Arni
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move import-related js to import.js
parent
7b3c4945
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
134 additions
and
1 deletions
+134
-1
cms/djangoapps/contentstore/tests/test_import_export.py
+0
-1
cms/envs/common.py
+19
-0
cms/static/js/views/import.js
+115
-0
No files found.
cms/djangoapps/contentstore/tests/test_import_export.py
View file @
57b38969
...
@@ -16,7 +16,6 @@ from uuid import uuid4
...
@@ -16,7 +16,6 @@ from uuid import uuid4
from
pymongo
import
MongoClient
from
pymongo
import
MongoClient
from
.utils
import
CourseTestCase
from
.utils
import
CourseTestCase
from
django.contrib.auth.models
import
User
from
django.core.urlresolvers
import
reverse
from
django.core.urlresolvers
import
reverse
from
django.test.utils
import
override_settings
from
django.test.utils
import
override_settings
from
django.conf
import
settings
from
django.conf
import
settings
...
...
cms/envs/common.py
View file @
57b38969
...
@@ -250,6 +250,25 @@ PIPELINE_CSS = {
...
@@ -250,6 +250,25 @@ PIPELINE_CSS = {
# test_order: Determines the position of this chunk of javascript on
# test_order: Determines the position of this chunk of javascript on
# the jasmine test page
# the jasmine test page
PIPELINE_JS
=
{
PIPELINE_JS
=
{
'main'
:
{
'source_filenames'
:
sorted
(
rooted_glob
(
COMMON_ROOT
/
'static/'
,
'coffee/src/**/*.js'
)
+
rooted_glob
(
PROJECT_ROOT
/
'static/'
,
'coffee/src/**/*.js'
)
)
+
[
'js/hesitate.js'
,
'js/base.js'
,
'js/views/feedback.js'
,
'js/models/course.js'
,
'js/models/section.js'
,
'js/views/section.js'
,
'js/models/metadata_model.js'
,
'js/views/metadata_editor_view.js'
,
'js/models/uploads.js'
,
'js/views/uploads.js'
,
'js/models/textbook.js'
,
'js/views/textbook.js'
,
'js/src/utility.js'
,
'js/models/settings/course_grading_policy.js'
,
'js/models/asset.js'
,
'js/models/assets.js'
,
'js/views/assets.js'
,
'js/views/import.js'
,
'js/views/assets_view.js'
,
'js/views/asset_view.js'
],
'output_filename'
:
'js/cms-application.js'
,
'test_order'
:
0
},
'module-js'
:
{
'module-js'
:
{
'source_filenames'
:
(
'source_filenames'
:
(
rooted_glob
(
COMMON_ROOT
/
'static/'
,
'xmodule/descriptors/js/*.js'
)
+
rooted_glob
(
COMMON_ROOT
/
'static/'
,
'xmodule/descriptors/js/*.js'
)
+
...
...
cms/static/js/views/import.js
0 → 100644
View file @
57b38969
/**
* Course import-related js.
*/
"use strict"
;
/**
* Entry point for server feedback. Makes status list visible and starts
* sending requests to the server for status updates.
* @param {string} url The url to send Ajax GET requests for updates.
*/
var
startServerFeedback
=
function
(
url
){
$
(
'div.wrapper-status'
).
removeClass
(
'is-hidden'
);
$
(
'.status-info'
).
show
();
getStatus
(
url
,
500
);
};
/**
* Toggle the spin on the progress cog.
* @param {boolean} isSpinning Turns cog spin on if true, off otherwise.
*/
var
updateCog
=
function
(
elem
,
isSpinning
)
{
var
cogI
=
elem
.
find
(
'i.icon-cog'
);
if
(
isSpinning
)
{
cogI
.
addClass
(
"icon-spin"
);}
else
{
cogI
.
removeClass
(
"icon-spin"
);}
};
/**
* Manipulate the DOM to reflect current status of upload.
* @param {int} stageNo Current stage.
*/
var
updateStage
=
function
(
stageNo
){
var
all
=
$
(
'ol.status-progress'
).
children
();
var
prevList
=
all
.
slice
(
0
,
stageNo
);
_
.
map
(
prevList
,
function
(
elem
){
$
(
elem
).
removeClass
(
"is-not-started"
).
removeClass
(
"is-started"
).
addClass
(
"is-complete"
);
updateCog
(
$
(
elem
),
false
);
});
var
curList
=
all
.
eq
(
stageNo
);
curList
.
removeClass
(
"is-not-started"
).
addClass
(
"is-started"
);
updateCog
(
curList
,
true
);
};
/**
* Give error message at the list element that corresponds to the stage where
* the error occurred.
* @param {int} stageNo Stage of import process at which error occured.
* @param {string} msg Error message to display.
*/
var
stageError
=
function
(
stageNo
,
msg
)
{
var
all
=
$
(
'ol.status-progress'
).
children
();
// Make all stages up to, and including, the error stage 'complete'.
var
prevList
=
all
.
slice
(
0
,
stageNo
+
1
);
_
.
map
(
prevList
,
function
(
elem
){
$
(
elem
).
removeClass
(
"is-not-started"
).
removeClass
(
"is-started"
).
addClass
(
"is-complete"
);
updateCog
(
$
(
elem
),
false
);
});
var
message
=
msg
||
"There was an error with the upload"
;
var
elem
=
$
(
'ol.status-progress'
).
children
().
eq
(
stageNo
);
elem
.
removeClass
(
'is-started'
).
addClass
(
'has-error'
);
elem
.
find
(
'p.copy'
).
hide
().
after
(
"<p class='copy error'>"
+
message
+
"</p>"
);
};
/**
* Check for import status updates every `timemout` milliseconds, and update
* the page accordingly.
* @param {string} url Url to call for status updates.
* @param {int} timeout Number of milliseconds to wait in between ajax calls
* for new updates.
* @param {int} stage Starting stage.
*/
var
getStatus
=
function
(
url
,
timeout
,
stage
)
{
if
(
currentStage
==
3
)
{
return
;}
if
(
window
.
stopGetStatus
)
{
return
;}
var
currentStage
=
stage
||
0
;
updateStage
(
currentStage
);
var
time
=
timeout
||
1000
;
$
.
getJSON
(
url
,
function
(
data
)
{
setTimeout
(
function
()
{
getStatus
(
url
,
time
,
data
[
"ImportStatus"
]);
},
time
);
}
);
};
/**
* Update DOM to set all stages as complete, and stop asking for status
* updates.
*/
var
displayFinishedImport
=
function
()
{
window
.
stopGetStatus
=
true
;
var
all
=
$
(
'ol.status-progress'
).
children
();
_
.
map
(
all
,
function
(
elem
){
$
(
elem
).
removeClass
(
"is-not-started"
).
removeClass
(
"is-started"
).
addClass
(
"is-complete"
);
updateCog
(
$
(
elem
),
false
);
});
};
/**
* Update DOM to set all stages as not-started (for retrying an upload that
* failed).
*/
var
clearImportDisplay
=
function
()
{
var
all
=
$
(
'ol.status-progress'
).
children
();
_
.
map
(
all
,
function
(
elem
){
$
(
elem
).
removeClass
(
"is-complete"
).
removeClass
(
"is-started"
).
removeClass
(
"has-error"
).
addClass
(
"is-not-started"
);
$
(
elem
).
find
(
'p.error'
).
remove
();
// remove error messages
$
(
elem
).
find
(
'p.copy'
).
show
();
updateCog
(
$
(
elem
),
false
);
});
window
.
stopGetStatus
=
false
;
};
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