Create a common paginated list view
TNL-2384 Refactored Studio's PagingView to use RequireJS Text and moved it to common so that it can also be used by LMS.
This commit is contained in:
@@ -118,7 +118,7 @@
|
||||
* As of 1.0.3, this value can also be a string that is converted to a
|
||||
* RegExp via new RegExp().
|
||||
*/
|
||||
fileExclusionRegExp: /^\.|spec/,
|
||||
fileExclusionRegExp: /^\.|spec|spec_helpers/,
|
||||
/**
|
||||
* Allow CSS optimizations. Allowed values:
|
||||
* - "standard": @import inlining and removal of comments, unnecessary
|
||||
@@ -153,6 +153,6 @@
|
||||
* SILENT: 4
|
||||
* Default is 0.
|
||||
*/
|
||||
logLevel: 4
|
||||
logLevel: 1
|
||||
};
|
||||
} ())
|
||||
|
||||
@@ -23,6 +23,7 @@ requirejs.config({
|
||||
"jquery.simulate": "xmodule_js/common_static/js/vendor/jquery.simulate",
|
||||
"datepair": "xmodule_js/common_static/js/vendor/timepicker/datepair",
|
||||
"date": "xmodule_js/common_static/js/vendor/date",
|
||||
"text": "xmodule_js/common_static/js/vendor/requirejs/text",
|
||||
"underscore": "xmodule_js/common_static/js/vendor/underscore-min",
|
||||
"underscore.string": "xmodule_js/common_static/js/vendor/underscore.string.min",
|
||||
"backbone": "xmodule_js/common_static/js/vendor/backbone-min",
|
||||
@@ -240,13 +241,11 @@ define([
|
||||
"js/spec/views/active_video_upload_list_spec",
|
||||
"js/spec/views/previous_video_upload_spec",
|
||||
"js/spec/views/previous_video_upload_list_spec",
|
||||
"js/spec/views/paging_spec",
|
||||
"js/spec/views/assets_spec",
|
||||
"js/spec/views/baseview_spec",
|
||||
"js/spec/views/container_spec",
|
||||
"js/spec/views/paged_container_spec",
|
||||
"js/spec/views/group_configuration_spec",
|
||||
"js/spec/views/paging_spec",
|
||||
"js/spec/views/unit_outline_spec",
|
||||
"js/spec/views/xblock_spec",
|
||||
"js/spec/views/xblock_editor_spec",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
require ["jquery", "backbone", "coffee/src/main", "js/common_helpers/ajax_helpers", "jasmine-stealth", "jquery.cookie"],
|
||||
require ["jquery", "backbone", "coffee/src/main", "common/js/spec_helpers/ajax_helpers", "jasmine-stealth", "jquery.cookie"],
|
||||
($, Backbone, main, AjaxHelpers) ->
|
||||
describe "CMS", ->
|
||||
it "should initialize URL", ->
|
||||
|
||||
@@ -21,6 +21,7 @@ requirejs.config({
|
||||
"jquery.immediateDescendents": "xmodule_js/common_static/coffee/src/jquery.immediateDescendents",
|
||||
"datepair": "xmodule_js/common_static/js/vendor/timepicker/datepair",
|
||||
"date": "xmodule_js/common_static/js/vendor/date",
|
||||
"text": "xmodule_js/common_static/js/vendor/requirejs/text",
|
||||
"underscore": "xmodule_js/common_static/js/vendor/underscore-min",
|
||||
"underscore.string": "xmodule_js/common_static/js/vendor/underscore.string.min",
|
||||
"backbone": "xmodule_js/common_static/js/vendor/backbone-min",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
define ["js/models/section", "js/common_helpers/ajax_helpers", "js/utils/module"], (Section, AjaxHelpers, ModuleUtils) ->
|
||||
define ["js/models/section", "common/js/spec_helpers/ajax_helpers", "js/utils/module"], (Section, AjaxHelpers, ModuleUtils) ->
|
||||
describe "Section", ->
|
||||
describe "basic", ->
|
||||
beforeEach ->
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
define ["jquery", "jasmine", "js/common_helpers/ajax_helpers", "squire"],
|
||||
define ["jquery", "jasmine", "common/js/spec_helpers/ajax_helpers", "squire"],
|
||||
($, jasmine, AjaxHelpers, Squire) ->
|
||||
|
||||
feedbackTpl = readFixtures('system-feedback.underscore')
|
||||
assetLibraryTpl = readFixtures('asset-library.underscore')
|
||||
assetTpl = readFixtures('asset.underscore')
|
||||
pagingHeaderTpl = readFixtures('paging-header.underscore')
|
||||
pagingFooterTpl = readFixtures('paging-footer.underscore')
|
||||
|
||||
describe "Asset view", ->
|
||||
beforeEach ->
|
||||
@@ -141,8 +139,6 @@ define ["jquery", "jasmine", "js/common_helpers/ajax_helpers", "squire"],
|
||||
beforeEach ->
|
||||
setFixtures($("<script>", {id: "asset-library-tpl", type: "text/template"}).text(assetLibraryTpl))
|
||||
appendSetFixtures($("<script>", {id: "asset-tpl", type: "text/template"}).text(assetTpl))
|
||||
appendSetFixtures($("<script>", {id: "paging-header-tpl", type: "text/template"}).text(pagingHeaderTpl))
|
||||
appendSetFixtures($("<script>", {id: "paging-footer-tpl", type: "text/template"}).text(pagingFooterTpl))
|
||||
appendSetFixtures($("<script>", {id: "system-feedback-tpl", type: "text/template"}).text(feedbackTpl))
|
||||
window.analytics = jasmine.createSpyObj('analytics', ['track'])
|
||||
window.course_location_analytics = jasmine.createSpy()
|
||||
@@ -241,7 +237,7 @@ define ["jquery", "jasmine", "js/common_helpers/ajax_helpers", "squire"],
|
||||
describe "Basic", ->
|
||||
# Separate setup method to work-around mis-parenting of beforeEach methods
|
||||
setup = (requests) ->
|
||||
@view.setPage(0)
|
||||
@view.pagingView.setPage(0)
|
||||
AjaxHelpers.respondWithJson(requests, @mockAssetsResponse)
|
||||
|
||||
$.fn.fileupload = ->
|
||||
@@ -285,7 +281,7 @@ define ["jquery", "jasmine", "js/common_helpers/ajax_helpers", "squire"],
|
||||
{view: @view, requests: requests} = @createAssetsView(this)
|
||||
appendSetFixtures('<div class="ui-loading"/>')
|
||||
expect($('.ui-loading').is(':visible')).toBe(true)
|
||||
@view.setPage(0)
|
||||
@view.pagingView.setPage(0)
|
||||
AjaxHelpers.respondWithError(requests)
|
||||
expect($('.ui-loading').is(':visible')).toBe(false)
|
||||
|
||||
@@ -333,27 +329,27 @@ define ["jquery", "jasmine", "js/common_helpers/ajax_helpers", "squire"],
|
||||
describe "Sorting", ->
|
||||
# Separate setup method to work-around mis-parenting of beforeEach methods
|
||||
setup = (requests) ->
|
||||
@view.setPage(0)
|
||||
@view.pagingView.setPage(0)
|
||||
AjaxHelpers.respondWithJson(requests, @mockAssetsResponse)
|
||||
|
||||
it "should have the correct default sort order", ->
|
||||
{view: @view, requests: requests} = @createAssetsView(this)
|
||||
setup.call(this, requests)
|
||||
expect(@view.sortDisplayName()).toBe("Date Added")
|
||||
expect(@view.pagingView.sortDisplayName()).toBe("Date Added")
|
||||
expect(@view.collection.sortDirection).toBe("desc")
|
||||
|
||||
it "should toggle the sort order when clicking on the currently sorted column", ->
|
||||
{view: @view, requests: requests} = @createAssetsView(this)
|
||||
setup.call(this, requests)
|
||||
expect(@view.sortDisplayName()).toBe("Date Added")
|
||||
expect(@view.pagingView.sortDisplayName()).toBe("Date Added")
|
||||
expect(@view.collection.sortDirection).toBe("desc")
|
||||
@view.$("#js-asset-date-col").click()
|
||||
AjaxHelpers.respondWithJson(requests, @mockAssetsResponse)
|
||||
expect(@view.sortDisplayName()).toBe("Date Added")
|
||||
expect(@view.pagingView.sortDisplayName()).toBe("Date Added")
|
||||
expect(@view.collection.sortDirection).toBe("asc")
|
||||
@view.$("#js-asset-date-col").click()
|
||||
AjaxHelpers.respondWithJson(requests, @mockAssetsResponse)
|
||||
expect(@view.sortDisplayName()).toBe("Date Added")
|
||||
expect(@view.pagingView.sortDisplayName()).toBe("Date Added")
|
||||
expect(@view.collection.sortDirection).toBe("desc")
|
||||
|
||||
it "should switch the sort order when clicking on a different column", ->
|
||||
@@ -361,11 +357,11 @@ define ["jquery", "jasmine", "js/common_helpers/ajax_helpers", "squire"],
|
||||
setup.call(this, requests)
|
||||
@view.$("#js-asset-name-col").click()
|
||||
AjaxHelpers.respondWithJson(requests, @mockAssetsResponse)
|
||||
expect(@view.sortDisplayName()).toBe("Name")
|
||||
expect(@view.pagingView.sortDisplayName()).toBe("Name")
|
||||
expect(@view.collection.sortDirection).toBe("asc")
|
||||
@view.$("#js-asset-name-col").click()
|
||||
AjaxHelpers.respondWithJson(requests, @mockAssetsResponse)
|
||||
expect(@view.sortDisplayName()).toBe("Name")
|
||||
expect(@view.pagingView.sortDisplayName()).toBe("Name")
|
||||
expect(@view.collection.sortDirection).toBe("desc")
|
||||
|
||||
it "should switch sort to most recent date added when a new asset is added", ->
|
||||
@@ -375,5 +371,5 @@ define ["jquery", "jasmine", "js/common_helpers/ajax_helpers", "squire"],
|
||||
AjaxHelpers.respondWithJson(requests, @mockAssetsResponse)
|
||||
addMockAsset.call(this, requests)
|
||||
AjaxHelpers.respondWithJson(requests, @mockAssetsResponse)
|
||||
expect(@view.sortDisplayName()).toBe("Date Added")
|
||||
expect(@view.pagingView.sortDisplayName()).toBe("Date Added")
|
||||
expect(@view.collection.sortDirection).toBe("desc")
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
define ["js/views/course_info_handout", "js/views/course_info_update", "js/models/module_info", "js/collections/course_update", "js/common_helpers/ajax_helpers"],
|
||||
define ["js/views/course_info_handout", "js/views/course_info_update", "js/models/module_info", "js/collections/course_update", "common/js/spec_helpers/ajax_helpers"],
|
||||
(CourseInfoHandoutsView, CourseInfoUpdateView, ModuleInfo, CourseUpdateCollection, AjaxHelpers) ->
|
||||
|
||||
describe "Course Updates and Handouts", ->
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
define ["js/models/textbook", "js/models/chapter", "js/collections/chapter", "js/models/course",
|
||||
"js/collections/textbook", "js/views/show_textbook", "js/views/edit_textbook", "js/views/list_textbooks",
|
||||
"js/views/edit_chapter", "js/views/feedback_prompt", "js/views/feedback_notification", "js/views/utils/view_utils",
|
||||
"js/common_helpers/ajax_helpers", "js/spec_helpers/modal_helpers", "jasmine-stealth"],
|
||||
"common/js/spec_helpers/ajax_helpers", "js/spec_helpers/modal_helpers", "jasmine-stealth"],
|
||||
(Textbook, Chapter, ChapterSet, Course, TextbookSet, ShowTextbook, EditTextbook, ListTextbooks, EditChapter, Prompt, Notification, ViewUtils, AjaxHelpers, modal_helpers) ->
|
||||
feedbackTpl = readFixtures('system-feedback.underscore')
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
define ["js/models/uploads", "js/views/uploads", "js/models/chapter", "js/common_helpers/ajax_helpers", "js/spec_helpers/modal_helpers"], (FileUpload, UploadDialog, Chapter, AjaxHelpers, modal_helpers) ->
|
||||
define ["js/models/uploads", "js/views/uploads", "js/models/chapter", "common/js/spec_helpers/ajax_helpers", "js/spec_helpers/modal_helpers"], (FileUpload, UploadDialog, Chapter, AjaxHelpers, modal_helpers) ->
|
||||
|
||||
feedbackTpl = readFixtures('system-feedback.underscore')
|
||||
|
||||
|
||||
1
cms/static/common
Symbolic link
1
cms/static/common
Symbolic link
@@ -0,0 +1 @@
|
||||
../../common/static/common
|
||||
@@ -8,8 +8,8 @@ define([ // jshint ignore:line
|
||||
'js/certificates/views/certificate_details',
|
||||
'js/certificates/views/certificate_preview',
|
||||
'js/views/feedback_notification',
|
||||
'js/common_helpers/ajax_helpers',
|
||||
'js/common_helpers/template_helpers',
|
||||
'common/js/spec_helpers/ajax_helpers',
|
||||
'common/js/spec_helpers/template_helpers',
|
||||
'js/spec_helpers/view_helpers',
|
||||
'js/spec_helpers/validation_helpers',
|
||||
'js/certificates/spec/custom_matchers'
|
||||
|
||||
@@ -8,8 +8,8 @@ define([ // jshint ignore:line
|
||||
'js/certificates/collections/certificates',
|
||||
'js/certificates/views/certificate_editor',
|
||||
'js/views/feedback_notification',
|
||||
'js/common_helpers/ajax_helpers',
|
||||
'js/common_helpers/template_helpers',
|
||||
'common/js/spec_helpers/ajax_helpers',
|
||||
'common/js/spec_helpers/template_helpers',
|
||||
'js/spec_helpers/view_helpers',
|
||||
'js/spec_helpers/validation_helpers',
|
||||
'js/certificates/spec/custom_matchers'
|
||||
|
||||
@@ -11,8 +11,8 @@ define([ // jshint ignore:line
|
||||
'js/certificates/views/certificates_list',
|
||||
'js/certificates/views/certificate_preview',
|
||||
'js/views/feedback_notification',
|
||||
'js/common_helpers/ajax_helpers',
|
||||
'js/common_helpers/template_helpers',
|
||||
'common/js/spec_helpers/ajax_helpers',
|
||||
'common/js/spec_helpers/template_helpers',
|
||||
'js/certificates/spec/custom_matchers'
|
||||
],
|
||||
function(_, Course, CertificatesCollection, CertificateModel, CertificateDetailsView, CertificateEditorView,
|
||||
|
||||
@@ -4,11 +4,10 @@ define([ // jshint ignore:line
|
||||
'jquery',
|
||||
'underscore',
|
||||
'gettext',
|
||||
'js/common_helpers/page_helpers',
|
||||
'js/views/pages/base_page',
|
||||
'js/certificates/views/certificates_list'
|
||||
],
|
||||
function ($, _, gettext, PageHelpers, BasePage, CertificatesListView) {
|
||||
function ($, _, gettext, BasePage, CertificatesListView) {
|
||||
'use strict';
|
||||
var CertificatesPage = BasePage.extend({
|
||||
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
../../../common/static/js/spec_helpers
|
||||
@@ -1 +1 @@
|
||||
define(['domReady!', 'jquery', 'backbone', 'underscore', 'gettext']);
|
||||
define(['domReady!', 'jquery', 'backbone', 'underscore', 'gettext', 'text']);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
define(['jquery', 'js/factories/xblock_validation', 'js/common_helpers/template_helpers'],
|
||||
define(['jquery', 'js/factories/xblock_validation', 'common/js/spec_helpers/template_helpers'],
|
||||
function($, XBlockValidationFactory, TemplateHelpers) {
|
||||
|
||||
describe('XBlockValidationFactory', function() {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
define(["js/utils/drag_and_drop", "js/views/feedback_notification", "js/common_helpers/ajax_helpers", "jquery", "underscore"],
|
||||
define(["js/utils/drag_and_drop", "js/views/feedback_notification", "common/js/spec_helpers/ajax_helpers", "jquery", "underscore"],
|
||||
function (ContentDragger, Notification, AjaxHelpers, $, _) {
|
||||
describe("Overview drag and drop functionality", function () {
|
||||
beforeEach(function () {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
define(
|
||||
[
|
||||
'jquery', 'underscore', 'js/common_helpers/ajax_helpers', 'squire'
|
||||
'jquery', 'underscore', 'common/js/spec_helpers/ajax_helpers', 'squire'
|
||||
],
|
||||
function ($, _, AjaxHelpers, Squire) {
|
||||
'use strict';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
define(
|
||||
[
|
||||
'jquery', 'underscore', 'js/common_helpers/ajax_helpers', 'squire'
|
||||
'jquery', 'underscore', 'common/js/spec_helpers/ajax_helpers', 'squire'
|
||||
],
|
||||
function ($, _, AjaxHelpers, Squire) {
|
||||
'use strict';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
define(
|
||||
["jquery", "js/models/active_video_upload", "js/views/active_video_upload_list", "js/common_helpers/template_helpers", "mock-ajax", "jasmine-jquery"],
|
||||
["jquery", "js/models/active_video_upload", "js/views/active_video_upload_list", "common/js/spec_helpers/template_helpers", "mock-ajax", "jasmine-jquery"],
|
||||
function($, ActiveVideoUpload, ActiveVideoUploadListView, TemplateHelpers) {
|
||||
"use strict";
|
||||
var concurrentUploadLimit = 2;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
define([ "jquery", "js/common_helpers/ajax_helpers", "URI", "js/views/asset", "js/views/assets",
|
||||
define([ "jquery", "common/js/spec_helpers/ajax_helpers", "URI", "js/views/asset", "js/views/assets",
|
||||
"js/models/asset", "js/collections/asset", "js/spec_helpers/view_helpers"],
|
||||
function ($, AjaxHelpers, URI, AssetView, AssetsView, AssetModel, AssetCollection, ViewHelpers) {
|
||||
|
||||
@@ -8,15 +8,11 @@ define([ "jquery", "js/common_helpers/ajax_helpers", "URI", "js/views/asset", "j
|
||||
|
||||
assetLibraryTpl = readFixtures('asset-library.underscore');
|
||||
assetTpl = readFixtures('asset.underscore');
|
||||
pagingHeaderTpl = readFixtures('paging-header.underscore');
|
||||
pagingFooterTpl = readFixtures('paging-footer.underscore');
|
||||
uploadModalTpl = readFixtures('asset-upload-modal.underscore');
|
||||
|
||||
beforeEach(function () {
|
||||
setFixtures($("<script>", { id: "asset-library-tpl", type: "text/template" }).text(assetLibraryTpl));
|
||||
appendSetFixtures($("<script>", { id: "asset-tpl", type: "text/template" }).text(assetTpl));
|
||||
appendSetFixtures($("<script>", { id: "paging-header-tpl", type: "text/template" }).text(pagingHeaderTpl));
|
||||
appendSetFixtures($("<script>", { id: "paging-footer-tpl", type: "text/template" }).text(pagingFooterTpl));
|
||||
appendSetFixtures(uploadModalTpl);
|
||||
appendSetFixtures(sandbox({ id: "asset_table_body" }));
|
||||
|
||||
@@ -139,7 +135,7 @@ define([ "jquery", "js/common_helpers/ajax_helpers", "URI", "js/views/asset", "j
|
||||
var setup;
|
||||
setup = function(responseData) {
|
||||
var requests = AjaxHelpers.requests(this);
|
||||
assetsView.setPage(0);
|
||||
assetsView.pagingView.setPage(0);
|
||||
if (!responseData){
|
||||
AjaxHelpers.respondWithJson(requests, mockEmptyAssetsResponse);
|
||||
}
|
||||
@@ -188,8 +184,8 @@ define([ "jquery", "js/common_helpers/ajax_helpers", "URI", "js/views/asset", "j
|
||||
expect(assetsView).toBeDefined();
|
||||
spyOn(assetsView, "addAsset").andCallFake(function () {
|
||||
assetsView.collection.add(mockAssetUploadResponse.asset);
|
||||
assetsView.renderPageItems();
|
||||
assetsView.setPage(0);
|
||||
assetsView.pagingView.renderPageItems();
|
||||
assetsView.pagingView.setPage(0);
|
||||
});
|
||||
|
||||
$('a:contains("Upload your first asset")').click();
|
||||
@@ -248,9 +244,9 @@ define([ "jquery", "js/common_helpers/ajax_helpers", "URI", "js/views/asset", "j
|
||||
});
|
||||
|
||||
it('returns the registered info for a filter column', function () {
|
||||
assetsView.registerSortableColumn('test-col', 'Test Column', 'testField', 'asc');
|
||||
assetsView.registerFilterableColumn('js-asset-type-col', 'Type', 'asset_type');
|
||||
var filterInfo = assetsView.filterableColumnInfo('js-asset-type-col');
|
||||
assetsView.pagingView.registerSortableColumn('test-col', 'Test Column', 'testField', 'asc');
|
||||
assetsView.pagingView.registerFilterableColumn('js-asset-type-col', 'Type', 'asset_type');
|
||||
var filterInfo = assetsView.pagingView.filterableColumnInfo('js-asset-type-col');
|
||||
expect(filterInfo.displayName).toBe('Type');
|
||||
expect(filterInfo.fieldName).toBe('asset_type');
|
||||
});
|
||||
@@ -265,16 +261,16 @@ define([ "jquery", "js/common_helpers/ajax_helpers", "URI", "js/views/asset", "j
|
||||
it('make sure selectFilter sets collection filter if undefined', function () {
|
||||
expect(assetsView).toBeDefined();
|
||||
assetsView.collection.filterField = '';
|
||||
assetsView.selectFilter('js-asset-type-col');
|
||||
assetsView.pagingView.selectFilter('js-asset-type-col');
|
||||
expect(assetsView.collection.filterField).toEqual('asset_type');
|
||||
});
|
||||
|
||||
it('make sure _toggleFilterColumn filters asset list', function () {
|
||||
expect(assetsView).toBeDefined();
|
||||
var requests = AjaxHelpers.requests(this);
|
||||
$.each(assetsView.filterableColumns, function(columnID, columnData){
|
||||
$.each(assetsView.pagingView.filterableColumns, function(columnID, columnData){
|
||||
var $typeColumn = $('#' + columnID);
|
||||
assetsView.setPage(0);
|
||||
assetsView.pagingView.setPage(0);
|
||||
respondWithMockAssets(requests);
|
||||
var assetsNumber = assetsView.collection.length;
|
||||
assetsView._toggleFilterColumn('Images', 'Images');
|
||||
@@ -288,7 +284,7 @@ define([ "jquery", "js/common_helpers/ajax_helpers", "URI", "js/views/asset", "j
|
||||
it('opens and closes select type menu', function () {
|
||||
expect(assetsView).toBeDefined();
|
||||
setup.call(this, mockExampleAssetsResponse);
|
||||
$.each(assetsView.filterableColumns, function(columnID, columnData){
|
||||
$.each(assetsView.pagingView.filterableColumns, function(columnID, columnData){
|
||||
var $typeColumn = $('#' + columnID);
|
||||
expect($typeColumn).toBeVisible();
|
||||
var assetsNumber = $('#asset-table-body .type-col').length;
|
||||
@@ -304,12 +300,12 @@ define([ "jquery", "js/common_helpers/ajax_helpers", "URI", "js/views/asset", "j
|
||||
it('check filtering works with sorting by column on', function () {
|
||||
expect(assetsView).toBeDefined();
|
||||
var requests = AjaxHelpers.requests(this);
|
||||
assetsView.registerSortableColumn('name-col', 'Name Column', 'nameField', 'asc');
|
||||
assetsView.registerFilterableColumn('js-asset-type-col', gettext('Type'), 'asset_type');
|
||||
assetsView.setInitialSortColumn('name-col');
|
||||
assetsView.setPage(0);
|
||||
assetsView.pagingView.registerSortableColumn('name-col', 'Name Column', 'nameField', 'asc');
|
||||
assetsView.pagingView.registerFilterableColumn('js-asset-type-col', gettext('Type'), 'asset_type');
|
||||
assetsView.pagingView.setInitialSortColumn('name-col');
|
||||
assetsView.pagingView.setPage(0);
|
||||
respondWithMockAssets(requests);
|
||||
var sortInfo = assetsView.sortableColumnInfo('name-col');
|
||||
var sortInfo = assetsView.pagingView.sortableColumnInfo('name-col');
|
||||
expect(sortInfo.defaultSortDirection).toBe('asc');
|
||||
var $firstFilter = $($('#js-asset-type-col').find('li.nav-item a')[1]);
|
||||
$firstFilter.trigger('click');
|
||||
@@ -322,8 +318,8 @@ define([ "jquery", "js/common_helpers/ajax_helpers", "URI", "js/views/asset", "j
|
||||
it('shows type select menu, selects type, and filters results', function () {
|
||||
expect(assetsView).toBeDefined();
|
||||
var requests = AjaxHelpers.requests(this);
|
||||
$.each(assetsView.filterableColumns, function(columnID, columnData) {
|
||||
assetsView.setPage(0);
|
||||
$.each(assetsView.pagingView.filterableColumns, function(columnID, columnData) {
|
||||
assetsView.pagingView.setPage(0);
|
||||
respondWithMockAssets(requests);
|
||||
var $typeColumn = $('#' + columnID);
|
||||
expect($typeColumn).toBeVisible();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
define([ "jquery", "js/common_helpers/ajax_helpers", "js/spec_helpers/edit_helpers",
|
||||
define([ "jquery", "common/js/spec_helpers/ajax_helpers", "js/spec_helpers/edit_helpers",
|
||||
"js/views/container", "js/models/xblock_info", "jquery.simulate",
|
||||
"xmodule", "coffee/src/main", "xblock/cms.runtime.v1"],
|
||||
function ($, AjaxHelpers, EditHelpers, ContainerView, XBlockInfo) {
|
||||
|
||||
@@ -4,7 +4,7 @@ define([
|
||||
'js/views/group_configuration_details', 'js/views/group_configurations_list', 'js/views/group_configuration_editor',
|
||||
'js/views/group_configuration_item', 'js/views/experiment_group_edit', 'js/views/content_group_list',
|
||||
'js/views/content_group_details', 'js/views/content_group_editor', 'js/views/content_group_item',
|
||||
'js/views/feedback_notification', 'js/common_helpers/ajax_helpers', 'js/common_helpers/template_helpers',
|
||||
'js/views/feedback_notification', 'common/js/spec_helpers/ajax_helpers', 'common/js/spec_helpers/template_helpers',
|
||||
'js/spec_helpers/view_helpers', 'jasmine-stealth'
|
||||
], function(
|
||||
_, Course, GroupConfigurationModel, GroupModel, GroupConfigurationCollection, GroupCollection,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
define(["js/views/license", "js/models/license", "js/common_helpers/template_helpers"],
|
||||
define(["js/views/license", "js/models/license", "common/js/spec_helpers/template_helpers"],
|
||||
function(LicenseView, LicenseModel, TemplateHelpers) {
|
||||
describe("License view", function() {
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
define(["jquery", "underscore", "js/common_helpers/ajax_helpers", "js/spec_helpers/edit_helpers",
|
||||
define(["jquery", "underscore", "common/js/spec_helpers/ajax_helpers", "js/spec_helpers/edit_helpers",
|
||||
"js/views/modals/edit_xblock", "js/models/xblock_info"],
|
||||
function ($, _, AjaxHelpers, EditHelpers, EditXBlockModal, XBlockInfo) {
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
define([ "jquery", "underscore", "js/common_helpers/ajax_helpers", "URI", "js/models/xblock_info",
|
||||
"js/views/paged_container", "js/views/paging_header", "js/views/paging_footer", "js/views/xblock"],
|
||||
define(["jquery", "underscore", "common/js/spec_helpers/ajax_helpers", "URI", "js/models/xblock_info",
|
||||
"js/views/paged_container", "common/js/components/views/paging_header",
|
||||
"common/js/components/views/paging_footer", "js/views/xblock"],
|
||||
function ($, _, AjaxHelpers, URI, XBlockInfo, PagedContainer, PagingHeader, PagingFooter, XBlockView) {
|
||||
|
||||
var htmlResponseTpl = _.template('' +
|
||||
@@ -175,11 +176,6 @@ define([ "jquery", "underscore", "js/common_helpers/ajax_helpers", "URI", "js/mo
|
||||
});
|
||||
|
||||
describe("PagingHeader", function () {
|
||||
beforeEach(function () {
|
||||
var pagingFooterTpl = readFixtures('paging-header.underscore');
|
||||
appendSetFixtures($("<script>", { id: "paging-header-tpl", type: "text/template" }).text(pagingFooterTpl));
|
||||
});
|
||||
|
||||
describe("Next page button", function () {
|
||||
beforeEach(function () {
|
||||
pagingContainer.render();
|
||||
@@ -331,11 +327,6 @@ define([ "jquery", "underscore", "js/common_helpers/ajax_helpers", "URI", "js/mo
|
||||
});
|
||||
|
||||
describe("PagingFooter", function () {
|
||||
beforeEach(function () {
|
||||
var pagingFooterTpl = readFixtures('paging-footer.underscore');
|
||||
appendSetFixtures($("<script>", { id: "paging-footer-tpl", type: "text/template" }).text(pagingFooterTpl));
|
||||
});
|
||||
|
||||
describe("Next page button", function () {
|
||||
beforeEach(function () {
|
||||
// Render the page and header so that they can react to events
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
define(["jquery", "underscore", "underscore.string", "js/common_helpers/ajax_helpers",
|
||||
"js/common_helpers/template_helpers", "js/spec_helpers/edit_helpers",
|
||||
define(["jquery", "underscore", "underscore.string", "common/js/spec_helpers/ajax_helpers",
|
||||
"common/js/spec_helpers/template_helpers", "js/spec_helpers/edit_helpers",
|
||||
"js/views/pages/container", "js/views/pages/paged_container", "js/models/xblock_info", "jquery.simulate"],
|
||||
function ($, _, str, AjaxHelpers, TemplateHelpers, EditHelpers, ContainerPage, PagedContainerPage, XBlockInfo) {
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
define(["jquery", "underscore", "underscore.string", "js/common_helpers/ajax_helpers",
|
||||
"js/common_helpers/template_helpers", "js/spec_helpers/edit_helpers",
|
||||
define(["jquery", "underscore", "underscore.string", "common/js/spec_helpers/ajax_helpers",
|
||||
"common/js/spec_helpers/template_helpers", "js/spec_helpers/edit_helpers",
|
||||
"js/views/feedback_prompt", "js/views/pages/container", "js/views/pages/container_subviews",
|
||||
"js/models/xblock_info", "js/views/utils/xblock_utils"],
|
||||
function ($, _, str, AjaxHelpers, TemplateHelpers, EditHelpers, Prompt, ContainerPage, ContainerSubviews,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
define(["jquery", "sinon", "js/common_helpers/ajax_helpers", "js/views/utils/view_utils", "js/views/pages/course_outline",
|
||||
define(["jquery", "sinon", "common/js/spec_helpers/ajax_helpers", "js/views/utils/view_utils", "js/views/pages/course_outline",
|
||||
"js/models/xblock_outline_info", "js/utils/date_utils", "js/spec_helpers/edit_helpers",
|
||||
"js/common_helpers/template_helpers"],
|
||||
"common/js/spec_helpers/template_helpers"],
|
||||
function($, Sinon, AjaxHelpers, ViewUtils, CourseOutlinePage, XBlockOutlineInfo, DateUtils, EditHelpers, TemplateHelpers) {
|
||||
|
||||
describe("CourseOutlinePage", function() {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
define(["jquery", "js/common_helpers/ajax_helpers", "js/spec_helpers/view_helpers", "js/views/course_rerun",
|
||||
define(["jquery", "common/js/spec_helpers/ajax_helpers", "js/spec_helpers/view_helpers", "js/views/course_rerun",
|
||||
"js/views/utils/create_course_utils", "js/views/utils/view_utils", "jquery.simulate"],
|
||||
function ($, AjaxHelpers, ViewHelpers, CourseRerunUtils, CreateCourseUtilsFactory, ViewUtils) {
|
||||
describe("Create course rerun page", function () {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
define([
|
||||
'jquery', 'underscore', 'js/views/pages/group_configurations',
|
||||
'js/models/group_configuration', 'js/collections/group_configuration',
|
||||
'js/common_helpers/template_helpers'
|
||||
'common/js/spec_helpers/template_helpers'
|
||||
], function ($, _, GroupConfigurationsPage, GroupConfigurationModel, GroupConfigurationCollection, TemplateHelpers) {
|
||||
'use strict';
|
||||
describe('GroupConfigurationsPage', function() {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
define(["jquery", "js/common_helpers/ajax_helpers", "js/spec_helpers/view_helpers", "js/index",
|
||||
define(["jquery", "common/js/spec_helpers/ajax_helpers", "js/spec_helpers/view_helpers", "js/index",
|
||||
"js/views/utils/view_utils"],
|
||||
function ($, AjaxHelpers, ViewHelpers, IndexUtils, ViewUtils) {
|
||||
describe("Course listing page", function () {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
define([
|
||||
"jquery", "js/common_helpers/ajax_helpers", "js/spec_helpers/view_helpers",
|
||||
"jquery", "common/js/spec_helpers/ajax_helpers", "js/spec_helpers/view_helpers",
|
||||
"js/factories/manage_users_lib", "js/views/utils/view_utils"
|
||||
],
|
||||
function ($, AjaxHelpers, ViewHelpers, ManageUsersFactory, ViewUtils) {
|
||||
|
||||
@@ -1,584 +0,0 @@
|
||||
define([ "jquery", "js/common_helpers/ajax_helpers", "URI",
|
||||
"js/views/paging", "js/views/paging_header", "js/views/paging_footer",
|
||||
"js/models/asset", "js/collections/asset" ],
|
||||
function ($, AjaxHelpers, URI, PagingView, PagingHeader, PagingFooter, AssetModel, AssetCollection) {
|
||||
|
||||
var createMockAsset = function(index) {
|
||||
var id = 'asset_' + index;
|
||||
return {
|
||||
id: id,
|
||||
display_name: id,
|
||||
url: id
|
||||
};
|
||||
};
|
||||
|
||||
var mockFirstPage = {
|
||||
assets: [
|
||||
createMockAsset(1),
|
||||
createMockAsset(2),
|
||||
createMockAsset(3)
|
||||
],
|
||||
pageSize: 3,
|
||||
totalCount: 4,
|
||||
page: 0,
|
||||
start: 0,
|
||||
end: 2
|
||||
};
|
||||
var mockSecondPage = {
|
||||
assets: [
|
||||
createMockAsset(4)
|
||||
],
|
||||
pageSize: 3,
|
||||
totalCount: 4,
|
||||
page: 1,
|
||||
start: 3,
|
||||
end: 4
|
||||
};
|
||||
var mockEmptyPage = {
|
||||
assets: [],
|
||||
pageSize: 3,
|
||||
totalCount: 0,
|
||||
page: 0,
|
||||
start: 0,
|
||||
end: 0
|
||||
};
|
||||
|
||||
var respondWithMockAssets = function(requests) {
|
||||
var requestIndex = requests.length - 1;
|
||||
var request = requests[requestIndex];
|
||||
var url = new URI(request.url);
|
||||
var queryParameters = url.query(true); // Returns an object with each query parameter stored as a value
|
||||
var page = queryParameters.page;
|
||||
var response = page === "0" ? mockFirstPage : mockSecondPage;
|
||||
AjaxHelpers.respondWithJson(requests, response, requestIndex);
|
||||
};
|
||||
|
||||
var MockPagingView = PagingView.extend({
|
||||
renderPageItems: function() {},
|
||||
initialize : function() {
|
||||
this.registerSortableColumn('name-col', 'Name', 'name', 'asc');
|
||||
this.registerSortableColumn('date-col', 'Date', 'date', 'desc');
|
||||
this.registerFilterableColumn('js-asset-type-col', gettext('Type'), 'asset_type');
|
||||
this.setInitialSortColumn('date-col');
|
||||
this.setInitialFilterColumn('js-asset-type-col');
|
||||
}
|
||||
});
|
||||
|
||||
describe("Paging", function() {
|
||||
var pagingView;
|
||||
|
||||
beforeEach(function () {
|
||||
var assets = new AssetCollection();
|
||||
assets.url = "assets_url";
|
||||
var feedbackTpl = readFixtures('system-feedback.underscore');
|
||||
setFixtures($("<script>", { id: "system-feedback-tpl", type: "text/template" }).text(feedbackTpl));
|
||||
pagingView = new MockPagingView({collection: assets});
|
||||
});
|
||||
|
||||
|
||||
describe("PagingView", function () {
|
||||
describe("setPage", function () {
|
||||
it('can set the current page', function () {
|
||||
var requests = AjaxHelpers.requests(this);
|
||||
pagingView.setPage(0);
|
||||
respondWithMockAssets(requests);
|
||||
expect(pagingView.collection.currentPage).toBe(0);
|
||||
pagingView.setPage(1);
|
||||
respondWithMockAssets(requests);
|
||||
expect(pagingView.collection.currentPage).toBe(1);
|
||||
});
|
||||
|
||||
it('should not change page after a server error', function () {
|
||||
var requests = AjaxHelpers.requests(this);
|
||||
pagingView.setPage(0);
|
||||
respondWithMockAssets(requests);
|
||||
pagingView.setPage(1);
|
||||
requests[1].respond(500);
|
||||
expect(pagingView.collection.currentPage).toBe(0);
|
||||
});
|
||||
});
|
||||
|
||||
describe("nextPage", function () {
|
||||
it('does not move forward after a server error', function () {
|
||||
var requests = AjaxHelpers.requests(this);
|
||||
pagingView.setPage(0);
|
||||
respondWithMockAssets(requests);
|
||||
pagingView.nextPage();
|
||||
requests[1].respond(500);
|
||||
expect(pagingView.collection.currentPage).toBe(0);
|
||||
});
|
||||
|
||||
it('can move to the next page', function () {
|
||||
var requests = AjaxHelpers.requests(this);
|
||||
pagingView.setPage(0);
|
||||
respondWithMockAssets(requests);
|
||||
pagingView.nextPage();
|
||||
respondWithMockAssets(requests);
|
||||
expect(pagingView.collection.currentPage).toBe(1);
|
||||
});
|
||||
|
||||
it('can not move forward from the final page', function () {
|
||||
var requests = AjaxHelpers.requests(this);
|
||||
pagingView.setPage(1);
|
||||
respondWithMockAssets(requests);
|
||||
pagingView.nextPage();
|
||||
expect(requests.length).toBe(1);
|
||||
});
|
||||
});
|
||||
|
||||
describe("previousPage", function () {
|
||||
|
||||
it('can move back a page', function () {
|
||||
var requests = AjaxHelpers.requests(this);
|
||||
pagingView.setPage(1);
|
||||
respondWithMockAssets(requests);
|
||||
pagingView.previousPage();
|
||||
respondWithMockAssets(requests);
|
||||
expect(pagingView.collection.currentPage).toBe(0);
|
||||
});
|
||||
|
||||
it('can not move back from the first page', function () {
|
||||
var requests = AjaxHelpers.requests(this);
|
||||
pagingView.setPage(0);
|
||||
respondWithMockAssets(requests);
|
||||
pagingView.previousPage();
|
||||
expect(requests.length).toBe(1);
|
||||
});
|
||||
|
||||
it('does not move back after a server error', function () {
|
||||
var requests = AjaxHelpers.requests(this);
|
||||
pagingView.setPage(1);
|
||||
respondWithMockAssets(requests);
|
||||
pagingView.previousPage();
|
||||
requests[1].respond(500);
|
||||
expect(pagingView.collection.currentPage).toBe(1);
|
||||
});
|
||||
});
|
||||
|
||||
describe("toggleSortOrder", function () {
|
||||
|
||||
it('can toggle direction of the current sort', function () {
|
||||
var requests = AjaxHelpers.requests(this);
|
||||
expect(pagingView.collection.sortDirection).toBe('desc');
|
||||
pagingView.toggleSortOrder('date-col');
|
||||
respondWithMockAssets(requests);
|
||||
expect(pagingView.collection.sortDirection).toBe('asc');
|
||||
pagingView.toggleSortOrder('date-col');
|
||||
respondWithMockAssets(requests);
|
||||
expect(pagingView.collection.sortDirection).toBe('desc');
|
||||
});
|
||||
|
||||
it('sets the correct default sort direction for a column', function () {
|
||||
var requests = AjaxHelpers.requests(this);
|
||||
pagingView.toggleSortOrder('name-col');
|
||||
respondWithMockAssets(requests);
|
||||
expect(pagingView.sortDisplayName()).toBe('Name');
|
||||
expect(pagingView.collection.sortDirection).toBe('asc');
|
||||
pagingView.toggleSortOrder('date-col');
|
||||
respondWithMockAssets(requests);
|
||||
expect(pagingView.sortDisplayName()).toBe('Date');
|
||||
expect(pagingView.collection.sortDirection).toBe('desc');
|
||||
});
|
||||
});
|
||||
|
||||
describe("sortableColumnInfo", function () {
|
||||
|
||||
it('returns the registered info for a column', function () {
|
||||
pagingView.registerSortableColumn('test-col', 'Test Column', 'testField', 'asc');
|
||||
pagingView.registerFilterableColumn('js-asset-type-col', gettext('Type'), 'asset_type');
|
||||
var sortInfo = pagingView.sortableColumnInfo('test-col');
|
||||
expect(sortInfo.displayName).toBe('Test Column');
|
||||
expect(sortInfo.fieldName).toBe('testField');
|
||||
expect(sortInfo.defaultSortDirection).toBe('asc');
|
||||
});
|
||||
|
||||
it('throws an exception for an unregistered column', function () {
|
||||
expect(function() {
|
||||
pagingView.sortableColumnInfo('no-such-column');
|
||||
}).toThrow();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("PagingHeader", function () {
|
||||
var pagingHeader;
|
||||
|
||||
beforeEach(function () {
|
||||
var pagingHeaderTpl = readFixtures('paging-header.underscore');
|
||||
appendSetFixtures($("<script>", { id: "paging-header-tpl", type: "text/template" }).text(pagingHeaderTpl));
|
||||
pagingHeader = new PagingHeader({view: pagingView});
|
||||
});
|
||||
|
||||
describe("Next page button", function () {
|
||||
beforeEach(function () {
|
||||
// Render the page and header so that they can react to events
|
||||
pagingView.render();
|
||||
pagingHeader.render();
|
||||
});
|
||||
|
||||
it('does not move forward if a server error occurs', function () {
|
||||
var requests = AjaxHelpers.requests(this);
|
||||
pagingView.setPage(0);
|
||||
respondWithMockAssets(requests);
|
||||
pagingHeader.$('.next-page-link').click();
|
||||
requests[1].respond(500);
|
||||
expect(pagingView.collection.currentPage).toBe(0);
|
||||
});
|
||||
|
||||
it('can move to the next page', function () {
|
||||
var requests = AjaxHelpers.requests(this);
|
||||
pagingView.setPage(0);
|
||||
respondWithMockAssets(requests);
|
||||
pagingHeader.$('.next-page-link').click();
|
||||
respondWithMockAssets(requests);
|
||||
expect(pagingView.collection.currentPage).toBe(1);
|
||||
});
|
||||
|
||||
it('should be enabled when there is at least one more page', function () {
|
||||
var requests = AjaxHelpers.requests(this);
|
||||
pagingView.setPage(0);
|
||||
respondWithMockAssets(requests);
|
||||
expect(pagingHeader.$('.next-page-link')).not.toHaveClass('is-disabled');
|
||||
});
|
||||
|
||||
it('should be disabled on the final page', function () {
|
||||
var requests = AjaxHelpers.requests(this);
|
||||
pagingView.setPage(1);
|
||||
respondWithMockAssets(requests);
|
||||
expect(pagingHeader.$('.next-page-link')).toHaveClass('is-disabled');
|
||||
});
|
||||
|
||||
it('should be disabled on an empty page', function () {
|
||||
var requests = AjaxHelpers.requests(this);
|
||||
pagingView.setPage(0);
|
||||
AjaxHelpers.respondWithJson(requests, mockEmptyPage);
|
||||
expect(pagingHeader.$('.next-page-link')).toHaveClass('is-disabled');
|
||||
});
|
||||
});
|
||||
|
||||
describe("Previous page button", function () {
|
||||
beforeEach(function () {
|
||||
// Render the page and header so that they can react to events
|
||||
pagingView.render();
|
||||
pagingHeader.render();
|
||||
});
|
||||
|
||||
it('does not move back if a server error occurs', function () {
|
||||
var requests = AjaxHelpers.requests(this);
|
||||
pagingView.setPage(1);
|
||||
respondWithMockAssets(requests);
|
||||
pagingHeader.$('.previous-page-link').click();
|
||||
requests[1].respond(500);
|
||||
expect(pagingView.collection.currentPage).toBe(1);
|
||||
});
|
||||
|
||||
it('can go back a page', function () {
|
||||
var requests = AjaxHelpers.requests(this);
|
||||
pagingView.setPage(1);
|
||||
respondWithMockAssets(requests);
|
||||
pagingHeader.$('.previous-page-link').click();
|
||||
respondWithMockAssets(requests);
|
||||
expect(pagingView.collection.currentPage).toBe(0);
|
||||
});
|
||||
|
||||
it('should be disabled on the first page', function () {
|
||||
var requests = AjaxHelpers.requests(this);
|
||||
pagingView.setPage(0);
|
||||
respondWithMockAssets(requests);
|
||||
expect(pagingHeader.$('.previous-page-link')).toHaveClass('is-disabled');
|
||||
});
|
||||
|
||||
it('should be enabled on the second page', function () {
|
||||
var requests = AjaxHelpers.requests(this);
|
||||
pagingView.setPage(1);
|
||||
respondWithMockAssets(requests);
|
||||
expect(pagingHeader.$('.previous-page-link')).not.toHaveClass('is-disabled');
|
||||
});
|
||||
|
||||
it('should be disabled for an empty page', function () {
|
||||
var requests = AjaxHelpers.requests(this);
|
||||
pagingView.setPage(0);
|
||||
AjaxHelpers.respondWithJson(requests, mockEmptyPage);
|
||||
expect(pagingHeader.$('.previous-page-link')).toHaveClass('is-disabled');
|
||||
});
|
||||
});
|
||||
|
||||
describe("Page metadata section", function() {
|
||||
it('shows the correct metadata for the current page', function () {
|
||||
var requests = AjaxHelpers.requests(this),
|
||||
message;
|
||||
pagingView.setPage(0);
|
||||
respondWithMockAssets(requests);
|
||||
message = pagingHeader.$('.meta').html().trim();
|
||||
expect(message).toBe('<p>Showing <span class="count-current-shown">1-3</span>' +
|
||||
' out of <span class="count-total">4 total</span>, ' +
|
||||
'sorted by <span class="sort-order">Date</span> descending</p>');
|
||||
});
|
||||
|
||||
it('shows the correct metadata when sorted ascending', function () {
|
||||
var requests = AjaxHelpers.requests(this),
|
||||
message;
|
||||
pagingView.setPage(0);
|
||||
pagingView.toggleSortOrder('name-col');
|
||||
respondWithMockAssets(requests);
|
||||
message = pagingHeader.$('.meta').html().trim();
|
||||
expect(message).toBe('<p>Showing <span class="count-current-shown">1-3</span>' +
|
||||
' out of <span class="count-total">4 total</span>, ' +
|
||||
'sorted by <span class="sort-order">Name</span> ascending</p>');
|
||||
});
|
||||
});
|
||||
|
||||
describe("Asset count label", function () {
|
||||
it('should show correct count on first page', function () {
|
||||
var requests = AjaxHelpers.requests(this);
|
||||
pagingView.setPage(0);
|
||||
respondWithMockAssets(requests);
|
||||
expect(pagingHeader.$('.count-current-shown')).toHaveHtml('1-3');
|
||||
});
|
||||
|
||||
it('should show correct count on second page', function () {
|
||||
var requests = AjaxHelpers.requests(this);
|
||||
pagingView.setPage(1);
|
||||
respondWithMockAssets(requests);
|
||||
expect(pagingHeader.$('.count-current-shown')).toHaveHtml('4-4');
|
||||
});
|
||||
|
||||
it('should show correct count for an empty collection', function () {
|
||||
var requests = AjaxHelpers.requests(this);
|
||||
pagingView.setPage(0);
|
||||
AjaxHelpers.respondWithJson(requests, mockEmptyPage);
|
||||
expect(pagingHeader.$('.count-current-shown')).toHaveHtml('0-0');
|
||||
});
|
||||
});
|
||||
|
||||
describe("Asset total label", function () {
|
||||
it('should show correct total on the first page', function () {
|
||||
var requests = AjaxHelpers.requests(this);
|
||||
pagingView.setPage(0);
|
||||
respondWithMockAssets(requests);
|
||||
expect(pagingHeader.$('.count-total')).toHaveText('4 total');
|
||||
});
|
||||
|
||||
it('should show correct total on the second page', function () {
|
||||
var requests = AjaxHelpers.requests(this);
|
||||
pagingView.setPage(1);
|
||||
respondWithMockAssets(requests);
|
||||
expect(pagingHeader.$('.count-total')).toHaveText('4 total');
|
||||
});
|
||||
|
||||
it('should show zero total for an empty collection', function () {
|
||||
var requests = AjaxHelpers.requests(this);
|
||||
pagingView.setPage(0);
|
||||
AjaxHelpers.respondWithJson(requests, mockEmptyPage);
|
||||
expect(pagingHeader.$('.count-total')).toHaveText('0 total');
|
||||
});
|
||||
});
|
||||
|
||||
describe("Sort order label", function () {
|
||||
it('should show correct initial sort order', function () {
|
||||
var requests = AjaxHelpers.requests(this);
|
||||
pagingView.setPage(0);
|
||||
respondWithMockAssets(requests);
|
||||
expect(pagingHeader.$('.sort-order')).toHaveText('Date');
|
||||
});
|
||||
|
||||
it('should show updated sort order', function () {
|
||||
var requests = AjaxHelpers.requests(this);
|
||||
pagingView.toggleSortOrder('name-col');
|
||||
respondWithMockAssets(requests);
|
||||
expect(pagingHeader.$('.sort-order')).toHaveText('Name');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("PagingFooter", function () {
|
||||
var pagingFooter;
|
||||
|
||||
beforeEach(function () {
|
||||
var pagingFooterTpl = readFixtures('paging-footer.underscore');
|
||||
appendSetFixtures($("<script>", { id: "paging-footer-tpl", type: "text/template" }).text(pagingFooterTpl));
|
||||
pagingFooter = new PagingFooter({view: pagingView});
|
||||
});
|
||||
|
||||
describe("Next page button", function () {
|
||||
beforeEach(function () {
|
||||
// Render the page and header so that they can react to events
|
||||
pagingView.render();
|
||||
pagingFooter.render();
|
||||
});
|
||||
|
||||
it('does not move forward if a server error occurs', function () {
|
||||
var requests = AjaxHelpers.requests(this);
|
||||
pagingView.setPage(0);
|
||||
respondWithMockAssets(requests);
|
||||
pagingFooter.$('.next-page-link').click();
|
||||
requests[1].respond(500);
|
||||
expect(pagingView.collection.currentPage).toBe(0);
|
||||
});
|
||||
|
||||
it('can move to the next page', function () {
|
||||
var requests = AjaxHelpers.requests(this);
|
||||
pagingView.setPage(0);
|
||||
respondWithMockAssets(requests);
|
||||
pagingFooter.$('.next-page-link').click();
|
||||
respondWithMockAssets(requests);
|
||||
expect(pagingView.collection.currentPage).toBe(1);
|
||||
});
|
||||
|
||||
it('should be enabled when there is at least one more page', function () {
|
||||
var requests = AjaxHelpers.requests(this);
|
||||
pagingView.setPage(0);
|
||||
respondWithMockAssets(requests);
|
||||
expect(pagingFooter.$('.next-page-link')).not.toHaveClass('is-disabled');
|
||||
});
|
||||
|
||||
it('should be disabled on the final page', function () {
|
||||
var requests = AjaxHelpers.requests(this);
|
||||
pagingView.setPage(1);
|
||||
respondWithMockAssets(requests);
|
||||
expect(pagingFooter.$('.next-page-link')).toHaveClass('is-disabled');
|
||||
});
|
||||
|
||||
it('should be disabled on an empty page', function () {
|
||||
var requests = AjaxHelpers.requests(this);
|
||||
pagingView.setPage(0);
|
||||
AjaxHelpers.respondWithJson(requests, mockEmptyPage);
|
||||
expect(pagingFooter.$('.next-page-link')).toHaveClass('is-disabled');
|
||||
});
|
||||
});
|
||||
|
||||
describe("Previous page button", function () {
|
||||
beforeEach(function () {
|
||||
// Render the page and header so that they can react to events
|
||||
pagingView.render();
|
||||
pagingFooter.render();
|
||||
});
|
||||
|
||||
it('does not move back if a server error occurs', function () {
|
||||
var requests = AjaxHelpers.requests(this);
|
||||
pagingView.setPage(1);
|
||||
respondWithMockAssets(requests);
|
||||
pagingFooter.$('.previous-page-link').click();
|
||||
requests[1].respond(500);
|
||||
expect(pagingView.collection.currentPage).toBe(1);
|
||||
});
|
||||
|
||||
it('can go back a page', function () {
|
||||
var requests = AjaxHelpers.requests(this);
|
||||
pagingView.setPage(1);
|
||||
respondWithMockAssets(requests);
|
||||
pagingFooter.$('.previous-page-link').click();
|
||||
respondWithMockAssets(requests);
|
||||
expect(pagingView.collection.currentPage).toBe(0);
|
||||
});
|
||||
|
||||
it('should be disabled on the first page', function () {
|
||||
var requests = AjaxHelpers.requests(this);
|
||||
pagingView.setPage(0);
|
||||
respondWithMockAssets(requests);
|
||||
expect(pagingFooter.$('.previous-page-link')).toHaveClass('is-disabled');
|
||||
});
|
||||
|
||||
it('should be enabled on the second page', function () {
|
||||
var requests = AjaxHelpers.requests(this);
|
||||
pagingView.setPage(1);
|
||||
respondWithMockAssets(requests);
|
||||
expect(pagingFooter.$('.previous-page-link')).not.toHaveClass('is-disabled');
|
||||
});
|
||||
|
||||
it('should be disabled for an empty page', function () {
|
||||
var requests = AjaxHelpers.requests(this);
|
||||
pagingView.setPage(0);
|
||||
AjaxHelpers.respondWithJson(requests, mockEmptyPage);
|
||||
expect(pagingFooter.$('.previous-page-link')).toHaveClass('is-disabled');
|
||||
});
|
||||
});
|
||||
|
||||
describe("Current page label", function () {
|
||||
it('should show 1 on the first page', function () {
|
||||
var requests = AjaxHelpers.requests(this);
|
||||
pagingView.setPage(0);
|
||||
respondWithMockAssets(requests);
|
||||
expect(pagingFooter.$('.current-page')).toHaveText('1');
|
||||
});
|
||||
|
||||
it('should show 2 on the second page', function () {
|
||||
var requests = AjaxHelpers.requests(this);
|
||||
pagingView.setPage(1);
|
||||
respondWithMockAssets(requests);
|
||||
expect(pagingFooter.$('.current-page')).toHaveText('2');
|
||||
});
|
||||
|
||||
it('should show 1 for an empty collection', function () {
|
||||
var requests = AjaxHelpers.requests(this);
|
||||
pagingView.setPage(0);
|
||||
AjaxHelpers.respondWithJson(requests, mockEmptyPage);
|
||||
expect(pagingFooter.$('.current-page')).toHaveText('1');
|
||||
});
|
||||
});
|
||||
|
||||
describe("Page total label", function () {
|
||||
it('should show the correct value with more than one page', function () {
|
||||
var requests = AjaxHelpers.requests(this);
|
||||
pagingView.setPage(0);
|
||||
respondWithMockAssets(requests);
|
||||
expect(pagingFooter.$('.total-pages')).toHaveText('2');
|
||||
});
|
||||
|
||||
it('should show page 1 when there are no assets', function () {
|
||||
var requests = AjaxHelpers.requests(this);
|
||||
pagingView.setPage(0);
|
||||
AjaxHelpers.respondWithJson(requests, mockEmptyPage);
|
||||
expect(pagingFooter.$('.total-pages')).toHaveText('1');
|
||||
});
|
||||
});
|
||||
|
||||
describe("Page input field", function () {
|
||||
var input;
|
||||
|
||||
beforeEach(function () {
|
||||
pagingFooter.render();
|
||||
});
|
||||
|
||||
it('should initially have a blank page input', function () {
|
||||
var requests = AjaxHelpers.requests(this);
|
||||
pagingView.setPage(0);
|
||||
respondWithMockAssets(requests);
|
||||
expect(pagingFooter.$('.page-number-input')).toHaveValue('');
|
||||
});
|
||||
|
||||
it('should handle invalid page requests', function () {
|
||||
var requests = AjaxHelpers.requests(this);
|
||||
pagingView.setPage(0);
|
||||
respondWithMockAssets(requests);
|
||||
pagingFooter.$('.page-number-input').val('abc');
|
||||
pagingFooter.$('.page-number-input').trigger('change');
|
||||
expect(pagingView.collection.currentPage).toBe(0);
|
||||
expect(pagingFooter.$('.page-number-input')).toHaveValue('');
|
||||
});
|
||||
|
||||
it('should switch pages via the input field', function () {
|
||||
var requests = AjaxHelpers.requests(this);
|
||||
pagingView.setPage(0);
|
||||
respondWithMockAssets(requests);
|
||||
pagingFooter.$('.page-number-input').val('2');
|
||||
pagingFooter.$('.page-number-input').trigger('change');
|
||||
AjaxHelpers.respondWithJson(requests, mockSecondPage);
|
||||
expect(pagingView.collection.currentPage).toBe(1);
|
||||
expect(pagingFooter.$('.page-number-input')).toHaveValue('');
|
||||
});
|
||||
|
||||
it('should handle AJAX failures when switching pages via the input field', function () {
|
||||
var requests = AjaxHelpers.requests(this);
|
||||
pagingView.setPage(0);
|
||||
respondWithMockAssets(requests);
|
||||
pagingFooter.$('.page-number-input').val('2');
|
||||
pagingFooter.$('.page-number-input').trigger('change');
|
||||
requests[1].respond(500);
|
||||
expect(pagingView.collection.currentPage).toBe(0);
|
||||
expect(pagingFooter.$('.page-number-input')).toHaveValue('');
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -1,5 +1,5 @@
|
||||
define(
|
||||
["jquery", "underscore", "backbone", "js/views/previous_video_upload_list", "js/common_helpers/template_helpers"],
|
||||
["jquery", "underscore", "backbone", "js/views/previous_video_upload_list", "common/js/spec_helpers/template_helpers"],
|
||||
function($, _, Backbone, PreviousVideoUploadListView, TemplateHelpers) {
|
||||
"use strict";
|
||||
describe("PreviousVideoUploadListView", function() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
define(
|
||||
["jquery", "backbone", "js/views/previous_video_upload", "js/common_helpers/template_helpers"],
|
||||
["jquery", "backbone", "js/views/previous_video_upload", "common/js/spec_helpers/template_helpers"],
|
||||
function($, Backbone, PreviousVideoUploadView, TemplateHelpers) {
|
||||
"use strict";
|
||||
describe("PreviousVideoUploadView", function() {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
define([
|
||||
'jquery', 'js/models/settings/course_details', 'js/views/settings/main',
|
||||
'js/common_helpers/ajax_helpers'
|
||||
'common/js/spec_helpers/ajax_helpers'
|
||||
], function($, CourseDetailsModel, MainView, AjaxHelpers) {
|
||||
'use strict';
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
define(["jquery", "js/common_helpers/ajax_helpers", "js/common_helpers/template_helpers",
|
||||
define(["jquery", "common/js/spec_helpers/ajax_helpers", "common/js/spec_helpers/template_helpers",
|
||||
"js/spec_helpers/view_helpers", "js/views/utils/view_utils", "js/views/unit_outline", "js/models/xblock_info"],
|
||||
function ($, AjaxHelpers, TemplateHelpers, ViewHelpers, ViewUtils, UnitOutlineView, XBlockInfo) {
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
define([ "jquery", "underscore", "js/common_helpers/ajax_helpers", "js/spec_helpers/edit_helpers",
|
||||
define([ "jquery", "underscore", "common/js/spec_helpers/ajax_helpers", "js/spec_helpers/edit_helpers",
|
||||
"js/views/xblock_editor", "js/models/xblock_info"],
|
||||
function ($, _, AjaxHelpers, EditHelpers, XBlockEditorView, XBlockInfo) {
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
define([ "jquery", "js/common_helpers/ajax_helpers", "URI", "js/views/xblock", "js/models/xblock_info",
|
||||
define([ "jquery", "common/js/spec_helpers/ajax_helpers", "URI", "js/views/xblock", "js/models/xblock_info",
|
||||
"xmodule", "coffee/src/main", "xblock/cms.runtime.v1"],
|
||||
function ($, AjaxHelpers, URI, XBlockView, XBlockInfo) {
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
define(["jquery", "js/common_helpers/ajax_helpers", "js/common_helpers/template_helpers",
|
||||
define(["jquery", "common/js/spec_helpers/ajax_helpers", "common/js/spec_helpers/template_helpers",
|
||||
"js/spec_helpers/edit_helpers", "js/models/xblock_info", "js/views/xblock_string_field_editor"],
|
||||
function ($, AjaxHelpers, TemplateHelpers, EditHelpers, XBlockInfo, XBlockStringFieldEditor) {
|
||||
describe("XBlockStringFieldEditorView", function () {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
define(['jquery', 'js/models/xblock_validation', 'js/views/xblock_validation', 'js/common_helpers/template_helpers'],
|
||||
define(['jquery', 'js/models/xblock_validation', 'js/views/xblock_validation', 'common/js/spec_helpers/template_helpers'],
|
||||
function($, XBlockValidationModel, XBlockValidationView, TemplateHelpers) {
|
||||
|
||||
beforeEach(function () {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* Provides helper methods for invoking Studio modal windows in Jasmine tests.
|
||||
*/
|
||||
define(["jquery", "js/views/feedback_notification", "js/views/feedback_prompt", "js/common_helpers/template_helpers"],
|
||||
define(["jquery", "js/views/feedback_notification", "js/views/feedback_prompt", "common/js/spec_helpers/template_helpers"],
|
||||
function($, NotificationView, Prompt, TemplateHelpers) {
|
||||
var installViewTemplates, createFeedbackSpy, verifyFeedbackShowing,
|
||||
verifyFeedbackHidden, createNotificationSpy, verifyNotificationShowing,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* Provides helper methods for invoking Studio editors in Jasmine tests.
|
||||
*/
|
||||
define(["jquery", "underscore", "js/common_helpers/ajax_helpers", "js/common_helpers/template_helpers",
|
||||
define(["jquery", "underscore", "common/js/spec_helpers/ajax_helpers", "common/js/spec_helpers/template_helpers",
|
||||
"js/spec_helpers/modal_helpers", "js/views/modals/edit_xblock", "js/collections/component_template",
|
||||
"xmodule", "coffee/src/main", "xblock/cms.runtime.v1"],
|
||||
function($, _, AjaxHelpers, TemplateHelpers, modal_helpers, EditXBlockModal, ComponentTemplates) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* Provides helper methods for invoking Studio modal windows in Jasmine tests.
|
||||
*/
|
||||
define(["jquery", "js/common_helpers/template_helpers", "js/spec_helpers/view_helpers"],
|
||||
define(["jquery", "common/js/spec_helpers/template_helpers", "js/spec_helpers/view_helpers"],
|
||||
function($, TemplateHelpers, ViewHelpers) {
|
||||
var installModalTemplates, getModalElement, getModalTitle, isShowingModal, hideModalIfShowing,
|
||||
pressModalButton, cancelModal, cancelModalIfShowing;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* Provides helper methods for invoking Validation modal in Jasmine tests.
|
||||
*/
|
||||
define(['jquery', 'js/spec_helpers/modal_helpers', 'js/common_helpers/template_helpers'],
|
||||
define(['jquery', 'js/spec_helpers/modal_helpers', 'common/js/spec_helpers/template_helpers'],
|
||||
function($, ModalHelpers, TemplateHelpers) {
|
||||
var installValidationTemplates, checkErrorContents, undoChanges;
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
* Provides helper methods for invoking Studio modal windows in Jasmine tests.
|
||||
*/
|
||||
define(["jquery", "js/views/feedback_notification", "js/views/feedback_prompt", 'js/common_helpers/ajax_helpers',
|
||||
"js/common_helpers/template_helpers"],
|
||||
define(["jquery", "js/views/feedback_notification", "js/views/feedback_prompt", 'common/js/spec_helpers/ajax_helpers',
|
||||
"common/js/spec_helpers/template_helpers"],
|
||||
function($, NotificationView, Prompt, AjaxHelpers, TemplateHelpers) {
|
||||
var installViewTemplates, createFeedbackSpy, verifyFeedbackShowing,
|
||||
verifyFeedbackHidden, createNotificationSpy, verifyNotificationShowing,
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
define(["jquery", "underscore", "gettext", "js/models/asset", "js/views/paging", "js/views/asset",
|
||||
"js/views/paging_header", "js/views/paging_footer", "js/utils/modal", "js/views/utils/view_utils",
|
||||
"js/views/feedback_notification", "jquery.fileupload-process", "jquery.fileupload-validate"],
|
||||
function($, _, gettext, AssetModel, PagingView, AssetView, PagingHeader, PagingFooter, ModalUtils, ViewUtils, NotificationView) {
|
||||
define(["jquery", "underscore", "gettext", "js/views/baseview", "js/models/asset", "common/js/components/views/paging",
|
||||
"js/views/asset", "common/js/components/views/paging_header", "common/js/components/views/paging_footer",
|
||||
"js/utils/modal", "js/views/utils/view_utils", "js/views/feedback_notification",
|
||||
"text!templates/asset-library.underscore",
|
||||
"jquery.fileupload-process", "jquery.fileupload-validate"],
|
||||
function($, _, gettext, BaseView, AssetModel, PagingView, AssetView, PagingHeader, PagingFooter,
|
||||
ModalUtils, ViewUtils, NotificationView, asset_library_template) {
|
||||
|
||||
var CONVERSION_FACTOR_MBS_TO_BYTES = 1000 * 1000;
|
||||
|
||||
var AssetsView = PagingView.extend({
|
||||
var AssetsView = BaseView.extend({
|
||||
// takes AssetCollection as model
|
||||
|
||||
events : {
|
||||
@@ -19,21 +22,14 @@ define(["jquery", "underscore", "gettext", "js/models/asset", "js/views/paging",
|
||||
|
||||
allLabel: 'ALL',
|
||||
|
||||
|
||||
initialize : function(options) {
|
||||
options = options || {};
|
||||
|
||||
PagingView.prototype.initialize.call(this);
|
||||
BaseView.prototype.initialize.call(this);
|
||||
var collection = this.collection;
|
||||
this.template = this.loadTemplate("asset-library");
|
||||
this.pagingView = this.createPagingView();
|
||||
this.listenTo(collection, 'destroy', this.handleDestroy);
|
||||
this.registerSortableColumn('js-asset-name-col', gettext('Name'), 'display_name', 'asc');
|
||||
this.registerSortableColumn('js-asset-date-col', gettext('Date Added'), 'date_added', 'desc');
|
||||
this.registerFilterableColumn('js-asset-type-col', gettext('Type'), 'asset_type');
|
||||
this.setInitialSortColumn('js-asset-date-col');
|
||||
this.setInitialFilterColumn('js-asset-type-col');
|
||||
ViewUtils.showLoadingIndicator();
|
||||
this.setPage(0);
|
||||
// set default file size for uploads via template var,
|
||||
// and default to static old value if none exists
|
||||
this.uploadChunkSizeInMBs = options.uploadChunkSizeInMBs || 10;
|
||||
@@ -41,68 +37,83 @@ define(["jquery", "underscore", "gettext", "js/models/asset", "js/views/paging",
|
||||
this.uploadChunkSizeInBytes = this.uploadChunkSizeInMBs * CONVERSION_FACTOR_MBS_TO_BYTES;
|
||||
this.maxFileSizeInBytes = this.maxFileSizeInMBs * CONVERSION_FACTOR_MBS_TO_BYTES;
|
||||
this.maxFileSizeRedirectUrl = options.maxFileSizeRedirectUrl || '';
|
||||
assetsView = this;
|
||||
// error message modal for large file uploads
|
||||
this.largeFileErrorMsg = null;
|
||||
},
|
||||
|
||||
PagingAssetView: PagingView.extend({
|
||||
renderPageItems: function() {
|
||||
var self = this,
|
||||
assets = this.collection,
|
||||
hasAssets = this.collection.assetType !== '' || assets.length > 0,
|
||||
tableBody = this.getTableBody();
|
||||
tableBody.empty();
|
||||
if (hasAssets) {
|
||||
assets.each(
|
||||
function(asset) {
|
||||
var view = new AssetView({model: asset});
|
||||
tableBody.append(view.render().el);
|
||||
}
|
||||
);
|
||||
}
|
||||
self.$('.assets-library').toggle(hasAssets);
|
||||
self.$('.no-asset-content').toggle(!hasAssets);
|
||||
return this;
|
||||
},
|
||||
|
||||
getTableBody: function() {
|
||||
var tableBody = this.tableBody;
|
||||
if (!tableBody) {
|
||||
ViewUtils.hideLoadingIndicator();
|
||||
|
||||
// Create the table
|
||||
this.$el.html(_.template(asset_library_template, {typeData: this.typeData}));
|
||||
tableBody = this.$('#asset-table-body');
|
||||
this.tableBody = tableBody;
|
||||
this.pagingHeader = new PagingHeader({view: this, el: $('#asset-paging-header')});
|
||||
this.pagingFooter = new PagingFooter({view: this, el: $('#asset-paging-footer')});
|
||||
this.pagingHeader.render();
|
||||
this.pagingFooter.render();
|
||||
|
||||
// Hide the contents until the collection has loaded the first time
|
||||
this.$('.assets-library').hide();
|
||||
this.$('.no-asset-content').hide();
|
||||
}
|
||||
return tableBody;
|
||||
},
|
||||
|
||||
onError: function() {
|
||||
ViewUtils.hideLoadingIndicator();
|
||||
}
|
||||
}),
|
||||
|
||||
createPagingView: function() {
|
||||
var pagingView = new this.PagingAssetView({
|
||||
el: this.$el,
|
||||
collection: this.collection
|
||||
});
|
||||
pagingView.registerSortableColumn('js-asset-name-col', gettext('Name'), 'display_name', 'asc');
|
||||
pagingView.registerSortableColumn('js-asset-date-col', gettext('Date Added'), 'date_added', 'desc');
|
||||
pagingView.registerFilterableColumn('js-asset-type-col', gettext('Type'), 'asset_type');
|
||||
pagingView.setInitialSortColumn('js-asset-date-col');
|
||||
pagingView.setInitialFilterColumn('js-asset-type-col');
|
||||
pagingView.setPage(0);
|
||||
return pagingView;
|
||||
},
|
||||
|
||||
render: function() {
|
||||
// Wait until the content is loaded the first time to render
|
||||
this.pagingView.render();
|
||||
return this;
|
||||
},
|
||||
|
||||
afterRender: function(){
|
||||
// Bind events with html elements
|
||||
$('li a.upload-button').on('click', this.showUploadModal);
|
||||
$('.upload-modal .close-button').on('click', this.hideModal);
|
||||
$('.upload-modal .choose-file-button').on('click', this.showFileSelectionMenu);
|
||||
$('li a.upload-button').on('click', _.bind(this.showUploadModal, this));
|
||||
$('.upload-modal .close-button').on('click', _.bind(this.hideModal, this));
|
||||
$('.upload-modal .choose-file-button').on('click', _.bind(this.showFileSelectionMenu, this));
|
||||
return this;
|
||||
},
|
||||
|
||||
getTableBody: function() {
|
||||
var tableBody = this.tableBody;
|
||||
if (!tableBody) {
|
||||
ViewUtils.hideLoadingIndicator();
|
||||
|
||||
// Create the table
|
||||
this.$el.html(this.template({typeData: this.typeData}));
|
||||
tableBody = this.$('#asset-table-body');
|
||||
this.tableBody = tableBody;
|
||||
this.pagingHeader = new PagingHeader({view: this, el: $('#asset-paging-header')});
|
||||
this.pagingFooter = new PagingFooter({view: this, el: $('#asset-paging-footer')});
|
||||
this.pagingHeader.render();
|
||||
this.pagingFooter.render();
|
||||
|
||||
// Hide the contents until the collection has loaded the first time
|
||||
this.$('.assets-library').hide();
|
||||
this.$('.no-asset-content').hide();
|
||||
}
|
||||
return tableBody;
|
||||
},
|
||||
|
||||
renderPageItems: function() {
|
||||
var self = this,
|
||||
assets = this.collection,
|
||||
hasAssets = this.collection.assetType !== '' || assets.length > 0,
|
||||
tableBody = this.getTableBody();
|
||||
tableBody.empty();
|
||||
if (hasAssets) {
|
||||
assets.each(
|
||||
function(asset) {
|
||||
var view = new AssetView({model: asset});
|
||||
tableBody.append(view.render().el);
|
||||
}
|
||||
);
|
||||
}
|
||||
self.$('.assets-library').toggle(hasAssets);
|
||||
self.$('.no-asset-content').toggle(!hasAssets);
|
||||
return this;
|
||||
},
|
||||
|
||||
onError: function() {
|
||||
ViewUtils.hideLoadingIndicator();
|
||||
},
|
||||
|
||||
handleDestroy: function(model) {
|
||||
this.collection.fetch({reset: true}); // reload the collection to get a fresh page full of items
|
||||
analytics.track('Deleted Asset', {
|
||||
@@ -114,9 +125,9 @@ define(["jquery", "underscore", "gettext", "js/models/asset", "js/views/paging",
|
||||
addAsset: function (model) {
|
||||
// Switch the sort column back to the default (most recent date added) and show the first page
|
||||
// so that the new asset is shown at the top of the page.
|
||||
this.setInitialSortColumn('js-asset-date-col');
|
||||
this.setInitialFilterColumn('js-asset-type-col');
|
||||
this.setPage(0);
|
||||
this.pagingView.setInitialSortColumn('js-asset-date-col');
|
||||
this.pagingView.setInitialFilterColumn('js-asset-type-col');
|
||||
this.pagingView.setPage(0);
|
||||
|
||||
analytics.track('Uploaded a File', {
|
||||
'course': course_location_analytics,
|
||||
@@ -126,7 +137,7 @@ define(["jquery", "underscore", "gettext", "js/models/asset", "js/views/paging",
|
||||
|
||||
onToggleColumn: function(event) {
|
||||
var columnName = event.target.id;
|
||||
this.toggleSortOrder(columnName);
|
||||
this.pagingView.toggleSortOrder(columnName);
|
||||
},
|
||||
|
||||
onFilterColumn: function(event) {
|
||||
@@ -140,13 +151,13 @@ define(["jquery", "underscore", "gettext", "js/models/asset", "js/views/paging",
|
||||
}
|
||||
$('.file-input').unbind('change.startUpload');
|
||||
ModalUtils.hideModal();
|
||||
if (assetsView.largeFileErrorMsg) {
|
||||
assetsView.largeFileErrorMsg.hide();
|
||||
if (this.largeFileErrorMsg) {
|
||||
this.largeFileErrorMsg.hide();
|
||||
}
|
||||
},
|
||||
|
||||
showUploadModal: function (event) {
|
||||
var self = assetsView;
|
||||
var self = this;
|
||||
event.preventDefault();
|
||||
self.resetUploadModal();
|
||||
ModalUtils.showModal();
|
||||
@@ -180,33 +191,33 @@ define(["jquery", "underscore", "gettext", "js/models/asset", "js/views/paging",
|
||||
error = error + " " + instructions;
|
||||
}
|
||||
|
||||
assetsView.largeFileErrorMsg = new NotificationView.Error({
|
||||
self.largeFileErrorMsg = new NotificationView.Error({
|
||||
"title": gettext("Your file could not be uploaded"),
|
||||
"message": error
|
||||
});
|
||||
assetsView.largeFileErrorMsg.show();
|
||||
self.largeFileErrorMsg.show();
|
||||
|
||||
assetsView.displayFailedUpload({
|
||||
self.displayFailedUpload({
|
||||
"msg": gettext("Max file size exceeded")
|
||||
});
|
||||
},
|
||||
processdone: function(event, data) {
|
||||
assetsView.largeFileErrorMsg = null;
|
||||
self.largeFileErrorMsg = null;
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
showFileSelectionMenu: function(event) {
|
||||
event.preventDefault();
|
||||
if (assetsView.largeFileErrorMsg) {
|
||||
assetsView.largeFileErrorMsg.hide();
|
||||
if (this.largeFileErrorMsg) {
|
||||
this.largeFileErrorMsg.hide();
|
||||
}
|
||||
$('.file-input').click();
|
||||
},
|
||||
|
||||
startUpload: function (event) {
|
||||
var file = event.target.value;
|
||||
if (!assetsView.largeFileErrorMsg) {
|
||||
if (!this.largeFileErrorMsg) {
|
||||
$('.upload-modal h1').text(gettext('Uploading'));
|
||||
$('.upload-modal .file-name').html(file.substring(file.lastIndexOf("\\") + 1));
|
||||
$('.upload-modal .choose-file-button').hide();
|
||||
@@ -228,7 +239,7 @@ define(["jquery", "underscore", "gettext", "js/models/asset", "js/views/paging",
|
||||
$('.upload-modal .embeddable-xml-input').val('');
|
||||
$('.upload-modal .embeddable').hide();
|
||||
|
||||
assetsView.largeFileErrorMsg = null;
|
||||
this.largeFileErrorMsg = null;
|
||||
},
|
||||
|
||||
showUploadFeedback: function (event, percentComplete) {
|
||||
@@ -285,8 +296,8 @@ define(["jquery", "underscore", "gettext", "js/models/asset", "js/views/paging",
|
||||
title.addClass('column-selected-link');
|
||||
}
|
||||
|
||||
this.filterableColumns['js-asset-type-col'].displayName = assettypeLabel;
|
||||
this.selectFilter('js-asset-type-col');
|
||||
this.pagingView.filterableColumns['js-asset-type-col'].displayName = assettypeLabel;
|
||||
this.pagingView.selectFilter('js-asset-type-col');
|
||||
this.closeFilterPopup(this.$el.find(
|
||||
'.column-filter-link[data-assetfilter="' + assettype + '"]'));
|
||||
},
|
||||
@@ -307,7 +318,7 @@ define(["jquery", "underscore", "gettext", "js/models/asset", "js/views/paging",
|
||||
$('.upload-modal .choose-file-button').text(gettext('Load Another File')).show();
|
||||
$('.upload-modal .progress-fill').width('100%');
|
||||
|
||||
assetsView.addAsset(new AssetModel(asset));
|
||||
this.addAsset(new AssetModel(asset));
|
||||
},
|
||||
|
||||
displayFailedUpload: function (resp) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
define(["jquery", "underscore", "js/views/utils/view_utils", "js/views/container", "js/utils/module", "gettext",
|
||||
"js/views/feedback_notification", "js/views/paging_header", "js/views/paging_footer", "js/views/paging_mixin"],
|
||||
"js/views/feedback_notification", "common/js/components/views/paging_header",
|
||||
"common/js/components/views/paging_footer", "common/js/components/views/paging_mixin"],
|
||||
function ($, _, ViewUtils, ContainerView, ModuleUtils, gettext, NotificationView, PagingHeader, PagingFooter, PagingMixin) {
|
||||
var PagedContainerView = ContainerView.extend(PagingMixin).extend({
|
||||
initialize: function(options){
|
||||
|
||||
@@ -1,142 +0,0 @@
|
||||
define(["underscore", "js/views/baseview", "js/views/feedback_alert", "gettext", "js/views/paging_mixin"],
|
||||
function(_, BaseView, AlertView, gettext, PagingMixin) {
|
||||
|
||||
var PagingView = BaseView.extend(PagingMixin).extend({
|
||||
// takes a Backbone Paginator as a model
|
||||
|
||||
sortableColumns: {},
|
||||
|
||||
filterableColumns: {},
|
||||
|
||||
filterColumn: '',
|
||||
|
||||
initialize: function() {
|
||||
BaseView.prototype.initialize.call(this);
|
||||
var collection = this.collection;
|
||||
collection.bind('add', _.bind(this.onPageRefresh, this));
|
||||
collection.bind('remove', _.bind(this.onPageRefresh, this));
|
||||
collection.bind('reset', _.bind(this.onPageRefresh, this));
|
||||
},
|
||||
|
||||
onPageRefresh: function() {
|
||||
var sortColumn = this.sortColumn;
|
||||
this.renderPageItems();
|
||||
this.$('.column-sort-link').removeClass('current-sort');
|
||||
this.$('#' + sortColumn).addClass('current-sort');
|
||||
},
|
||||
|
||||
onError: function() {
|
||||
// Do nothing by default
|
||||
},
|
||||
|
||||
nextPage: function() {
|
||||
var collection = this.collection,
|
||||
currentPage = collection.currentPage,
|
||||
lastPage = collection.totalPages - 1;
|
||||
if (currentPage < lastPage) {
|
||||
this.setPage(currentPage + 1);
|
||||
}
|
||||
},
|
||||
|
||||
previousPage: function() {
|
||||
var collection = this.collection,
|
||||
currentPage = collection.currentPage;
|
||||
if (currentPage > 0) {
|
||||
this.setPage(currentPage - 1);
|
||||
}
|
||||
},
|
||||
|
||||
registerFilterableColumn: function(columnName, displayName, fieldName) {
|
||||
this.filterableColumns[columnName] = {
|
||||
displayName: displayName,
|
||||
fieldName: fieldName
|
||||
};
|
||||
},
|
||||
|
||||
filterableColumnInfo: function(filterColumn) {
|
||||
var filterInfo = this.filterableColumns[filterColumn];
|
||||
if (!filterInfo) {
|
||||
throw "Unregistered filter column '" + filterInfo + '"';
|
||||
}
|
||||
return filterInfo;
|
||||
},
|
||||
|
||||
filterDisplayName: function() {
|
||||
var filterColumn = this.filterColumn,
|
||||
filterInfo = this.filterableColumnInfo(filterColumn);
|
||||
return filterInfo.displayName;
|
||||
},
|
||||
|
||||
setInitialFilterColumn: function(filterColumn) {
|
||||
var collection = this.collection,
|
||||
filtertInfo = this.filterableColumns[filterColumn];
|
||||
collection.filterField = filtertInfo.fieldName;
|
||||
this.filterColumn = filterColumn;
|
||||
},
|
||||
|
||||
/**
|
||||
* Registers information about a column that can be sorted.
|
||||
* @param columnName The element name of the column.
|
||||
* @param displayName The display name for the column in the current locale.
|
||||
* @param fieldName The database field name that is represented by this column.
|
||||
* @param defaultSortDirection The default sort direction for the column
|
||||
*/
|
||||
registerSortableColumn: function(columnName, displayName, fieldName, defaultSortDirection) {
|
||||
this.sortableColumns[columnName] = {
|
||||
displayName: displayName,
|
||||
fieldName: fieldName,
|
||||
defaultSortDirection: defaultSortDirection
|
||||
};
|
||||
},
|
||||
|
||||
sortableColumnInfo: function(sortColumn) {
|
||||
var sortInfo = this.sortableColumns[sortColumn];
|
||||
if (!sortInfo) {
|
||||
throw "Unregistered sort column '" + sortColumn + '"';
|
||||
}
|
||||
return sortInfo;
|
||||
},
|
||||
|
||||
sortDisplayName: function() {
|
||||
var sortColumn = this.sortColumn,
|
||||
sortInfo = this.sortableColumnInfo(sortColumn);
|
||||
return sortInfo.displayName;
|
||||
},
|
||||
|
||||
setInitialSortColumn: function(sortColumn) {
|
||||
var collection = this.collection,
|
||||
sortInfo = this.sortableColumns[sortColumn];
|
||||
collection.sortField = sortInfo.fieldName;
|
||||
collection.sortDirection = sortInfo.defaultSortDirection;
|
||||
this.sortColumn = sortColumn;
|
||||
},
|
||||
|
||||
toggleSortOrder: function(sortColumn) {
|
||||
var collection = this.collection,
|
||||
sortInfo = this.sortableColumnInfo(sortColumn),
|
||||
sortField = sortInfo.fieldName,
|
||||
defaultSortDirection = sortInfo.defaultSortDirection;
|
||||
if (collection.sortField === sortField) {
|
||||
collection.sortDirection = collection.sortDirection === 'asc' ? 'desc' : 'asc';
|
||||
} else {
|
||||
collection.sortField = sortField;
|
||||
collection.sortDirection = defaultSortDirection;
|
||||
}
|
||||
this.sortColumn = sortColumn;
|
||||
this.setPage(0);
|
||||
},
|
||||
|
||||
selectFilter: function(filterColumn) {
|
||||
var collection = this.collection,
|
||||
filterInfo = this.filterableColumnInfo(filterColumn),
|
||||
filterField = filterInfo.fieldName,
|
||||
defaultFilterKey = false;
|
||||
if (collection.filterField !== filterField) {
|
||||
collection.filterField = filterField;
|
||||
}
|
||||
this.filterColumn = filterColumn;
|
||||
this.setPage(0);
|
||||
}
|
||||
});
|
||||
return PagingView;
|
||||
}); // end define();
|
||||
@@ -1,65 +0,0 @@
|
||||
define(["underscore", "js/views/baseview"], function(_, BaseView) {
|
||||
|
||||
var PagingFooter = BaseView.extend({
|
||||
events : {
|
||||
"click .next-page-link": "nextPage",
|
||||
"click .previous-page-link": "previousPage",
|
||||
"change .page-number-input": "changePage"
|
||||
},
|
||||
|
||||
initialize: function(options) {
|
||||
var view = options.view,
|
||||
collection = view.collection;
|
||||
this.view = view;
|
||||
this.template = this.loadTemplate('paging-footer');
|
||||
collection.bind('add', _.bind(this.render, this));
|
||||
collection.bind('remove', _.bind(this.render, this));
|
||||
collection.bind('reset', _.bind(this.render, this));
|
||||
this.render();
|
||||
},
|
||||
|
||||
render: function() {
|
||||
var view = this.view,
|
||||
collection = view.collection,
|
||||
currentPage = collection.currentPage,
|
||||
lastPage = collection.totalPages - 1;
|
||||
this.$el.html(this.template({
|
||||
current_page: collection.currentPage,
|
||||
total_pages: collection.totalPages
|
||||
}));
|
||||
this.$(".previous-page-link").toggleClass("is-disabled", currentPage === 0).attr('aria-disabled', currentPage === 0);;
|
||||
this.$(".next-page-link").toggleClass("is-disabled", currentPage === lastPage).attr('aria-disabled', currentPage === lastPage);
|
||||
return this;
|
||||
},
|
||||
|
||||
changePage: function() {
|
||||
var view = this.view,
|
||||
collection = view.collection,
|
||||
currentPage = collection.currentPage + 1,
|
||||
pageInput = this.$("#page-number-input"),
|
||||
pageNumber = parseInt(pageInput.val(), 10);
|
||||
if (pageNumber > collection.totalPages) {
|
||||
pageNumber = false;
|
||||
}
|
||||
if (pageNumber <= 0) {
|
||||
pageNumber = false;
|
||||
}
|
||||
// If we still have a page number by this point,
|
||||
// and it's not the current page, load it.
|
||||
if (pageNumber && pageNumber !== currentPage) {
|
||||
view.setPage(pageNumber - 1);
|
||||
}
|
||||
pageInput.val(""); // Clear the value as the label will show beneath it
|
||||
},
|
||||
|
||||
nextPage: function() {
|
||||
this.view.nextPage();
|
||||
},
|
||||
|
||||
previousPage: function() {
|
||||
this.view.previousPage();
|
||||
}
|
||||
});
|
||||
|
||||
return PagingFooter;
|
||||
}); // end define();
|
||||
@@ -1,113 +0,0 @@
|
||||
define(["underscore", "gettext", "js/views/baseview"], function(_, gettext, BaseView) {
|
||||
|
||||
var PagingHeader = BaseView.extend({
|
||||
events : {
|
||||
"click .next-page-link": "nextPage",
|
||||
"click .previous-page-link": "previousPage"
|
||||
},
|
||||
|
||||
initialize: function(options) {
|
||||
var view = options.view,
|
||||
collection = view.collection;
|
||||
this.view = view;
|
||||
this.template = this.loadTemplate('paging-header');
|
||||
collection.bind('add', _.bind(this.render, this));
|
||||
collection.bind('remove', _.bind(this.render, this));
|
||||
collection.bind('reset', _.bind(this.render, this));
|
||||
},
|
||||
|
||||
render: function() {
|
||||
var view = this.view,
|
||||
collection = view.collection,
|
||||
currentPage = collection.currentPage,
|
||||
lastPage = collection.totalPages - 1,
|
||||
messageHtml = this.messageHtml();
|
||||
this.$el.html(this.template({
|
||||
messageHtml: messageHtml
|
||||
}));
|
||||
this.$(".previous-page-link").toggleClass("is-disabled", currentPage === 0).attr('aria-disabled', currentPage === 0);
|
||||
this.$(".next-page-link").toggleClass("is-disabled", currentPage === lastPage).attr('aria-disabled', currentPage === lastPage);
|
||||
return this;
|
||||
},
|
||||
|
||||
messageHtml: function() {
|
||||
var message = '';
|
||||
var asset_type = false;
|
||||
if (this.view.collection.assetType) {
|
||||
if (this.view.collection.sortDirection === 'asc') {
|
||||
// Translators: sample result:
|
||||
// "Showing 0-9 out of 25 total, filtered by Images, sorted by Date Added ascending"
|
||||
message = gettext('Showing %(current_item_range)s out of %(total_items_count)s, filtered by %(asset_type)s, sorted by %(sort_name)s ascending');
|
||||
} else {
|
||||
// Translators: sample result:
|
||||
// "Showing 0-9 out of 25 total, filtered by Images, sorted by Date Added descending"
|
||||
message = gettext('Showing %(current_item_range)s out of %(total_items_count)s, filtered by %(asset_type)s, sorted by %(sort_name)s descending');
|
||||
}
|
||||
asset_type = this.filterNameLabel();
|
||||
}
|
||||
else {
|
||||
if (this.view.collection.sortDirection === 'asc') {
|
||||
// Translators: sample result:
|
||||
// "Showing 0-9 out of 25 total, sorted by Date Added ascending"
|
||||
message = gettext('Showing %(current_item_range)s out of %(total_items_count)s, sorted by %(sort_name)s ascending');
|
||||
} else {
|
||||
// Translators: sample result:
|
||||
// "Showing 0-9 out of 25 total, sorted by Date Added descending"
|
||||
message = gettext('Showing %(current_item_range)s out of %(total_items_count)s, sorted by %(sort_name)s descending');
|
||||
}
|
||||
}
|
||||
|
||||
return '<p>' + interpolate(message, {
|
||||
current_item_range: this.currentItemRangeLabel(),
|
||||
total_items_count: this.totalItemsCountLabel(),
|
||||
asset_type: asset_type,
|
||||
sort_name: this.sortNameLabel()
|
||||
}, true) + "</p>";
|
||||
},
|
||||
|
||||
currentItemRangeLabel: function() {
|
||||
var view = this.view,
|
||||
collection = view.collection,
|
||||
start = collection.start,
|
||||
count = collection.size(),
|
||||
end = start + count;
|
||||
return interpolate('<span class="count-current-shown">%(start)s-%(end)s</span>', {
|
||||
start: Math.min(start + 1, end),
|
||||
end: end
|
||||
}, true);
|
||||
},
|
||||
|
||||
totalItemsCountLabel: function() {
|
||||
var totalItemsLabel;
|
||||
// Translators: turns into "25 total" to be used in other sentences, e.g. "Showing 0-9 out of 25 total".
|
||||
totalItemsLabel = interpolate(gettext('%(total_items)s total'), {
|
||||
total_items: this.view.collection.totalCount
|
||||
}, true);
|
||||
return interpolate('<span class="count-total">%(total_items_label)s</span>', {
|
||||
total_items_label: totalItemsLabel
|
||||
}, true);
|
||||
},
|
||||
|
||||
sortNameLabel: function() {
|
||||
return interpolate('<span class="sort-order">%(sort_name)s</span>', {
|
||||
sort_name: this.view.sortDisplayName()
|
||||
}, true);
|
||||
},
|
||||
|
||||
filterNameLabel: function() {
|
||||
return interpolate('<span class="filter-column">%(filter_name)s</span>', {
|
||||
filter_name: this.view.filterDisplayName()
|
||||
}, true);
|
||||
},
|
||||
|
||||
nextPage: function() {
|
||||
this.view.nextPage();
|
||||
},
|
||||
|
||||
previousPage: function() {
|
||||
this.view.previousPage();
|
||||
}
|
||||
});
|
||||
|
||||
return PagingHeader;
|
||||
}); // end define();
|
||||
@@ -1,37 +0,0 @@
|
||||
define([],
|
||||
function () {
|
||||
var PagedMixin = {
|
||||
setPage: function (page) {
|
||||
var self = this,
|
||||
collection = self.collection,
|
||||
oldPage = collection.currentPage;
|
||||
collection.goTo(page, {
|
||||
reset: true,
|
||||
success: function () {
|
||||
window.scrollTo(0, 0);
|
||||
},
|
||||
error: function (collection) {
|
||||
collection.currentPage = oldPage;
|
||||
self.onError();
|
||||
}
|
||||
});
|
||||
},
|
||||
nextPage: function() {
|
||||
var collection = this.collection,
|
||||
currentPage = collection.currentPage,
|
||||
lastPage = collection.totalPages - 1;
|
||||
if (currentPage < lastPage) {
|
||||
this.setPage(currentPage + 1);
|
||||
}
|
||||
},
|
||||
|
||||
previousPage: function() {
|
||||
var collection = this.collection,
|
||||
currentPage = collection.currentPage;
|
||||
if (currentPage > 0) {
|
||||
this.setPage(currentPage - 1);
|
||||
}
|
||||
}
|
||||
};
|
||||
return PagedMixin;
|
||||
});
|
||||
@@ -70,14 +70,15 @@ lib_paths:
|
||||
- xmodule_js/common_static/js/vendor/jQuery-File-Upload/js/jquery.fileupload-process.js
|
||||
- xmodule_js/common_static/js/vendor/jQuery-File-Upload/js/jquery.fileupload-validate.js
|
||||
- xmodule_js/common_static/js/vendor/mock-ajax.js
|
||||
- xmodule_js/common_static/js/vendor/requirejs/text.js
|
||||
|
||||
# Paths to source JavaScript files
|
||||
src_paths:
|
||||
- coffee/src
|
||||
- js
|
||||
- js/common_helpers
|
||||
- js/factories
|
||||
- js/certificates
|
||||
- js/factories
|
||||
- common/js
|
||||
|
||||
# Paths to spec (test) JavaScript files
|
||||
# We should define the custom path mapping in /coffee/spec/main.coffee as well e.g. certificates etc.
|
||||
@@ -98,6 +99,8 @@ spec_paths:
|
||||
#
|
||||
fixture_paths:
|
||||
- coffee/fixtures
|
||||
- templates
|
||||
- common/templates
|
||||
|
||||
requirejs:
|
||||
paths:
|
||||
|
||||
@@ -62,12 +62,13 @@ lib_paths:
|
||||
- xmodule_js/common_static/js/vendor/jQuery-File-Upload/js/jquery.fileupload.js
|
||||
- xmodule_js/common_static/js/vendor/jQuery-File-Upload/js/jquery.fileupload-process.js
|
||||
- xmodule_js/common_static/js/vendor/jQuery-File-Upload/js/jquery.fileupload-validate.js
|
||||
- xmodule_js/common_static/js/vendor/requirejs/text.js
|
||||
|
||||
# Paths to source JavaScript files
|
||||
src_paths:
|
||||
- coffee/src
|
||||
- js
|
||||
- js/common_helpers
|
||||
- common/js
|
||||
|
||||
# Paths to spec (test) JavaScript files
|
||||
spec_paths:
|
||||
@@ -86,6 +87,8 @@ spec_paths:
|
||||
#
|
||||
fixture_paths:
|
||||
- coffee/fixtures
|
||||
- templates
|
||||
- common/templates
|
||||
|
||||
requirejs:
|
||||
paths:
|
||||
|
||||
@@ -27,6 +27,7 @@ require.config({
|
||||
"jquery.immediateDescendents": "coffee/src/jquery.immediateDescendents",
|
||||
"datepair": "js/vendor/timepicker/datepair",
|
||||
"date": "js/vendor/date",
|
||||
"text": 'js/vendor/requirejs/text',
|
||||
"moment": "js/vendor/moment.min",
|
||||
"underscore": "js/vendor/underscore-min",
|
||||
"underscore.string": "js/vendor/underscore.string.min",
|
||||
|
||||
1
cms/static/templates
Symbolic link
1
cms/static/templates
Symbolic link
@@ -0,0 +1 @@
|
||||
../templates/js
|
||||
Reference in New Issue
Block a user