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
57fa123f
Commit
57fa123f
authored
Nov 15, 2016
by
alisan617
Committed by
GitHub
Nov 15, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Revert PR#13843"
parent
e5a57e75
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
216 additions
and
172 deletions
+216
-172
common/static/common/js/discussion/views/discussion_thread_list_view.js
+0
-0
common/static/common/js/spec/discussion/view/discussion_thread_edit_view_spec.js
+1
-1
common/static/common/js/spec/discussion/view/discussion_thread_list_view_spec.js
+0
-0
common/static/common/js/spec/discussion/view/discussion_thread_show_view_spec.js
+1
-1
common/static/common/js/spec/discussion/view/discussion_thread_view_spec.js
+5
-5
common/static/common/js/spec/discussion/view/response_comment_view_spec.js
+1
-1
common/static/common/js/spec_helpers/discussion_spec_helper.js
+21
-8
common/test/acceptance/tests/discussion/test_discussion.py
+2
-0
lms/djangoapps/discussion/static/discussion/js/discussion_board_factory.js
+31
-51
lms/djangoapps/discussion/static/discussion/js/discussion_profile_page_factory.js
+13
-4
lms/djangoapps/discussion/static/discussion/js/discussion_router.js
+25
-22
lms/djangoapps/discussion/static/discussion/js/spec/discussion_board_factory_spec.js
+28
-11
lms/djangoapps/discussion/static/discussion/js/spec/discussion_board_view_spec.js
+58
-0
lms/djangoapps/discussion/static/discussion/js/spec/views/discussion_search_view_spec.js
+0
-36
lms/djangoapps/discussion/static/discussion/js/views/discussion_board_view.js
+0
-0
lms/djangoapps/discussion/static/discussion/js/views/discussion_search_view.js
+1
-18
lms/djangoapps/discussion/static/discussion/templates/discussion-home.underscore
+0
-0
lms/djangoapps/discussion/templates/discussion/discussion_board.html
+2
-0
lms/static/lms/js/spec/main.js
+22
-11
lms/templates/discussion/_js_body_dependencies.html
+3
-0
lms/templates/discussion/_thread_list_template.html
+1
-2
lms/templates/discussion/_underscore_templates.html
+1
-1
No files found.
common/static/common/js/discussion/views/discussion_thread_list_view.js
View file @
57fa123f
This diff is collapsed.
Click to expand it.
common/static/common/js/spec/discussion/view/discussion_thread_edit_view_spec.js
View file @
57fa123f
...
...
@@ -16,7 +16,7 @@
'title'
:
'test thread title'
});
this
.
thread
=
new
Thread
(
this
.
threadData
);
this
.
course_settings
=
DiscussionSpecHelper
.
make
CourseSettings
();
this
.
course_settings
=
DiscussionSpecHelper
.
createTest
CourseSettings
();
this
.
createEditView
=
function
(
options
)
{
options
=
_
.
extend
({
...
...
common/static/common/js/spec/discussion/view/discussion_thread_list_view_spec.js
View file @
57fa123f
This diff is collapsed.
Click to expand it.
common/static/common/js/spec/discussion/view/discussion_thread_show_view_spec.js
View file @
57fa123f
...
...
@@ -5,7 +5,7 @@
var
$$course_id
=
'$$course_id'
;
describe
(
'DiscussionThreadShowView'
,
function
()
{
beforeEach
(
function
()
{
DiscussionSpecHelper
.
setUpGlobals
();
DiscussionSpecHelper
.
setUpGlobals
(
{}
);
DiscussionSpecHelper
.
setUnderscoreFixtures
();
this
.
user
=
DiscussionUtil
.
getUser
();
this
.
threadData
=
{
...
...
common/static/common/js/spec/discussion/view/discussion_thread_view_spec.js
View file @
57fa123f
...
...
@@ -129,7 +129,7 @@
model
:
thread
,
el
:
$
(
'#fixture-element'
),
mode
:
mode
,
course_settings
:
DiscussionSpecHelper
.
make
CourseSettings
()
course_settings
:
DiscussionSpecHelper
.
createTest
CourseSettings
()
});
renderWithTestResponses
(
view
,
1
);
if
(
mode
===
'inline'
)
{
...
...
@@ -185,7 +185,7 @@
model
:
this
.
thread
,
el
:
$
(
'#fixture-element'
),
mode
:
'tab'
,
course_settings
:
DiscussionSpecHelper
.
make
CourseSettings
()
course_settings
:
DiscussionSpecHelper
.
createTest
CourseSettings
()
});
});
describe
(
'responses'
,
function
()
{
...
...
@@ -282,7 +282,7 @@
model
:
this
.
thread
,
el
:
$
(
'#fixture-element'
),
mode
:
'inline'
,
course_settings
:
DiscussionSpecHelper
.
make
CourseSettings
()
course_settings
:
DiscussionSpecHelper
.
createTest
CourseSettings
()
});
});
describe
(
'render'
,
function
()
{
...
...
@@ -397,7 +397,7 @@
model
:
this
.
thread
,
el
:
$
(
'#fixture-element'
),
mode
:
'tab'
,
course_settings
:
DiscussionSpecHelper
.
make
CourseSettings
()
course_settings
:
DiscussionSpecHelper
.
createTest
CourseSettings
()
});
});
generateContent
=
function
(
idStart
,
idEnd
)
{
...
...
@@ -465,7 +465,7 @@
model
:
this
.
thread
,
el
:
$
(
'#fixture-element'
),
mode
:
'tab'
,
course_settings
:
DiscussionSpecHelper
.
make
CourseSettings
()
course_settings
:
DiscussionSpecHelper
.
createTest
CourseSettings
()
});
});
it
(
"doesn't show report option if can_report ability is disabled"
,
function
()
{
...
...
common/static/common/js/spec/discussion/view/response_comment_view_spec.js
View file @
57fa123f
...
...
@@ -5,7 +5,7 @@
describe
(
'ResponseCommentView'
,
function
()
{
beforeEach
(
function
()
{
DiscussionSpecHelper
.
setUpGlobals
();
DiscussionSpecHelper
.
setUpGlobals
(
{}
);
this
.
comment
=
new
Comment
({
id
:
'01234567'
,
user_id
:
user
.
id
,
...
...
common/static/common/js/spec_helpers/discussion_spec_helper.js
View file @
57fa123f
/* global DiscussionCourseSettings, DiscussionUtil, DiscussionUser */
/* global
Content, Discussion,
DiscussionCourseSettings, DiscussionUtil, DiscussionUser */
(
function
()
{
'use strict'
;
this
.
DiscussionSpecHelper
=
(
function
()
{
function
DiscussionSpecHelper
()
{
}
DiscussionSpecHelper
.
setUpGlobals
=
function
()
{
DiscussionUtil
.
loadRoles
(
DiscussionSpecHelper
.
getTestRoleInfo
());
window
.
$$course_id
=
'edX/999/test'
;
window
.
user
=
new
DiscussionUser
(
DiscussionSpecHelper
.
getTestUserInfo
());
return
DiscussionUtil
.
setUser
(
window
.
user
);
DiscussionSpecHelper
.
setUpGlobals
=
function
(
opts
)
{
var
options
=
opts
||
{};
DiscussionUtil
.
loadRoles
(
options
.
roles
||
DiscussionSpecHelper
.
getTestRoleInfo
());
window
.
$$course_id
=
options
.
courseName
||
'edX/999/test'
;
window
.
user
=
new
DiscussionUser
(
options
.
userInfo
||
DiscussionSpecHelper
.
getTestUserInfo
());
DiscussionUtil
.
setUser
(
window
.
user
);
};
DiscussionSpecHelper
.
getTestUserInfo
=
function
()
{
...
...
@@ -50,7 +51,7 @@
return
jasmine
.
createSpyObj
(
'event'
,
[
'preventDefault'
,
'target'
]);
};
DiscussionSpecHelper
.
make
CourseSettings
=
function
()
{
DiscussionSpecHelper
.
createTest
CourseSettings
=
function
()
{
return
new
DiscussionCourseSettings
({
category_map
:
{
children
:
[[
'Test Topic'
,
'entry'
],
[
'Other Topic'
,
'entry'
]],
...
...
@@ -69,12 +70,24 @@
});
};
DiscussionSpecHelper
.
createTestDiscussion
=
function
(
options
)
{
var
sortPreference
=
options
.
sort_preference
,
threads
=
options
.
threads
||
[],
threadPages
=
options
.
thread_pages
||
1
,
contentInfo
=
options
.
content_info
;
DiscussionSpecHelper
.
setUpGlobals
(
options
);
if
(
contentInfo
)
{
Content
.
loadContentInfos
(
contentInfo
);
}
return
new
Discussion
(
threads
,
{
pages
:
threadPages
,
sort
:
sortPreference
});
};
DiscussionSpecHelper
.
setUnderscoreFixtures
=
function
()
{
var
templateFixture
,
templateName
,
templateNames
,
templateNamesNoTrailingTemplate
,
i
,
j
,
len
;
templateNames
=
[
'thread'
,
'thread-show'
,
'thread-edit'
,
'thread-response'
,
'thread-response-show'
,
'thread-response-edit'
,
'response-comment-show'
,
'response-comment-edit'
,
'thread-list-item'
,
'
discussion-home'
,
'
search-alert'
,
'new-post'
,
'thread-type'
,
'new-post-menu-entry'
,
'new-post-alert'
,
'search-alert'
,
'new-post'
,
'thread-type'
,
'new-post-menu-entry'
,
'new-post-alert'
,
'new-post-menu-category'
,
'topic'
,
'post-user-display'
,
'inline-discussion'
,
'pagination'
,
'profile-thread'
,
'customwmd-prompt'
,
'nav-loading'
];
...
...
common/test/acceptance/tests/discussion/test_discussion.py
View file @
57fa123f
...
...
@@ -511,6 +511,7 @@ class DiscussionOpenClosedThreadTest(BaseDiscussionTestCase):
page
.
a11y_audit
.
config
.
set_rules
({
'ignore'
:
[
'section'
,
# TODO: AC-491
'aria-required-children'
,
# TODO: AC-534
'color-contrast'
,
# Commented out for now because they reproducibly fail on Jenkins but not locally
]
})
...
...
@@ -520,6 +521,7 @@ class DiscussionOpenClosedThreadTest(BaseDiscussionTestCase):
page
.
a11y_audit
.
config
.
set_rules
({
'ignore'
:
[
'section'
,
# TODO: AC-491
'aria-required-children'
,
# TODO: AC-534
'color-contrast'
,
# Commented out for now because they reproducibly fail on Jenkins but not locally
]
})
...
...
lms/djangoapps/discussion/static/discussion/js/discussion_board_factory.js
View file @
57fa123f
...
...
@@ -5,38 +5,50 @@
[
'jquery'
,
'backbone'
,
'common/js/discussion/content'
,
'common/js/discussion/discussion'
,
'common/js/discussion/utils'
,
'common/js/discussion/models/discussion_course_settings'
,
'common/js/discussion/models/discussion_user'
,
'common/js/discussion/views/new_post_view'
,
'discussion/js/discussion_router'
,
'discussion/js/views/discussion_fake_breadcrumbs'
,
'discussion/js/views/discussion_search_view'
,
'common/js/discussion/views/new_post_view'
'discussion/js/views/discussion_board_view'
],
function
(
$
,
Backbone
,
DiscussionRouter
,
DiscussionFakeBreadcrumbs
,
DiscussionSearchView
,
NewPostView
)
{
function
(
$
,
Backbone
,
Content
,
Discussion
,
DiscussionUtil
,
DiscussionCourseSettings
,
DiscussionUser
,
NewPostView
,
DiscussionRouter
,
DiscussionBoardView
)
{
return
function
(
options
)
{
var
userInfo
=
options
.
user_info
,
sortPreference
=
options
.
sort_preference
,
threads
=
options
.
threads
,
threadPages
=
options
.
thread_pages
,
contentInfo
=
options
.
content_info
,
user
=
new
window
.
DiscussionUser
(
userInfo
),
user
=
new
DiscussionUser
(
userInfo
),
discussion
,
courseSettings
,
newPostView
,
discussionBoardView
,
router
,
breadcrumbs
,
BreadcrumbsModel
,
searchBox
,
routerEvents
;
// TODO:
Perhaps
eliminate usage of global variables when possible
window
.
DiscussionUtil
.
loadRoles
(
options
.
roles
);
// TODO: eliminate usage of global variables when possible
DiscussionUtil
.
loadRoles
(
options
.
roles
);
window
.
$$course_id
=
options
.
courseId
;
window
.
courseName
=
options
.
course_name
;
window
.
DiscussionUtil
.
setUser
(
user
);
DiscussionUtil
.
setUser
(
user
);
window
.
user
=
user
;
window
.
Content
.
loadContentInfos
(
contentInfo
);
Content
.
loadContentInfos
(
contentInfo
);
discussion
=
new
window
.
Discussion
(
threads
,
{
pages
:
threadPages
,
sort
:
sortPreference
});
courseSettings
=
new
window
.
DiscussionCourseSettings
(
options
.
course_settings
);
// Create a discussion model
discussion
=
new
Discussion
(
threads
,
{
pages
:
threadPages
,
sort
:
sortPreference
});
courseSettings
=
new
DiscussionCourseSettings
(
options
.
course_settings
);
// Create the discussion board view
discussionBoardView
=
new
DiscussionBoardView
({
el
:
$
(
'.discussion-board'
),
discussion
:
discussion
,
courseSettings
:
courseSettings
});
discussionBoardView
.
render
();
// Create the new post view
newPostView
=
new
NewPostView
({
...
...
@@ -47,59 +59,27 @@
});
newPostView
.
render
();
// Set up
the
router to manage the page's history
// Set up
a
router to manage the page's history
router
=
new
DiscussionRouter
({
courseId
:
options
.
courseId
,
discussion
:
discussion
,
courseSettings
:
courseSettings
,
discussionBoardView
:
discussionBoardView
,
newPostView
:
newPostView
});
router
.
start
();
// Initialize and render search box
searchBox
=
new
DiscussionSearchView
({
el
:
$
(
'.forum-search'
),
threadListView
:
router
.
nav
}).
render
();
// Initialize and render breadcrumbs
BreadcrumbsModel
=
Backbone
.
Model
.
extend
({
defaults
:
{
contents
:
[]
}
});
breadcrumbs
=
new
DiscussionFakeBreadcrumbs
({
el
:
$
(
'.has-breadcrumbs'
),
model
:
new
BreadcrumbsModel
(),
events
:
{
'click .all-topics'
:
function
(
event
)
{
event
.
preventDefault
();
searchBox
.
clearSearch
();
this
.
model
.
set
(
'contents'
,
[]);
router
.
navigate
(
''
,
{
trigger
:
true
});
router
.
nav
.
toggleBrowseMenu
(
event
);
}
}
}).
render
();
routerEvents
=
{
// Add new breadcrumbs and clear search box when the user selects topics
'topic:selected'
:
function
(
topic
)
{
breadcrumbs
.
model
.
set
(
'contents'
,
topic
);
router
.
discussionBoardView
.
breadcrumbs
.
model
.
set
(
'contents'
,
topic
);
},
// Clear search box when a thread is selected
'thread:selected'
:
function
()
{
searchBox
.
clearSearch
();
},
// Add 'Search Results' to breadcrumbs when user searches
'search:initiated'
:
function
()
{
breadcrumbs
.
model
.
set
(
'contents'
,
[
'Search Results'
]);
router
.
discussionBoardView
.
searchView
.
clearSearch
();
}
};
Object
.
keys
(
routerEvents
).
forEach
(
function
(
key
)
{
router
.
nav
.
on
(
key
,
routerEvents
[
key
]);
router
.
discussionBoardView
.
on
(
key
,
routerEvents
[
key
]);
});
};
});
...
...
lms/djangoapps/discussion/static/discussion/js/discussion_profile_page_factory.js
View file @
57fa123f
(
function
(
define
)
{
'use strict'
;
define
([
'jquery'
,
'discussion/js/views/discussion_user_profile_view'
],
function
(
$
,
DiscussionUserProfileView
)
{
define
(
[
'jquery'
,
'common/js/discussion/utils'
,
'common/js/discussion/models/discussion_user'
,
'discussion/js/views/discussion_user_profile_view'
],
function
(
$
,
DiscussionUtil
,
DiscussionUser
,
DiscussionUserProfileView
)
{
return
function
(
options
)
{
var
$element
=
options
.
$el
,
threads
=
options
.
threads
,
...
...
@@ -10,13 +16,16 @@
page
=
options
.
page
,
numPages
=
options
.
numPages
;
// Roles are not included in user profile page, but they are not used for anything
window
.
DiscussionUtil
.
loadRoles
({
DiscussionUtil
.
loadRoles
({
Moderator
:
[],
Administrator
:
[],
'Community TA'
:
[]
});
// TODO: remove global variable usage
window
.
$$course_id
=
options
.
courseId
;
window
.
user
=
new
window
.
DiscussionUser
(
userInfo
);
window
.
user
=
new
DiscussionUser
(
userInfo
);
new
DiscussionUserProfileView
({
// eslint-disable-line no-new
el
:
$element
,
collection
:
threads
,
...
...
lms/djangoapps/discussion/static/discussion/js/discussion_router.js
View file @
57fa123f
...
...
@@ -6,10 +6,10 @@
'underscore'
,
'backbone'
,
'common/js/discussion/utils'
,
'common/js/discussion/
views/discussion_thread_list_view
'
,
'common/js/discussion/
models/discussion_course_settings
'
,
'common/js/discussion/views/discussion_thread_view'
],
function
(
_
,
Backbone
,
DiscussionUtil
,
Discussion
ThreadListView
,
DiscussionThreadView
)
{
function
(
_
,
Backbone
,
DiscussionUtil
,
Discussion
CourseSettings
,
DiscussionThreadView
)
{
var
DiscussionRouter
=
Backbone
.
Router
.
extend
({
routes
:
{
''
:
'allThreads'
,
...
...
@@ -21,14 +21,9 @@
_
.
bindAll
(
this
,
'allThreads'
,
'showThread'
);
this
.
courseId
=
options
.
courseId
;
this
.
discussion
=
options
.
discussion
;
this
.
course_settings
=
options
.
courseSettings
;
this
.
course_settings
=
new
DiscussionCourseSettings
(
options
.
course_settings
);
this
.
discussionBoardView
=
options
.
discussionBoardView
;
this
.
newPostView
=
options
.
newPostView
;
this
.
nav
=
new
DiscussionThreadListView
({
collection
:
this
.
discussion
,
el
:
$
(
'.forum-nav'
),
courseSettings
:
this
.
course_settings
});
this
.
nav
.
render
();
},
start
:
function
()
{
...
...
@@ -41,10 +36,18 @@
});
// Automatically navigate when the user selects threads
this
.
nav
.
on
(
'thread:selected'
,
_
.
bind
(
this
.
navigateToThread
,
this
));
this
.
nav
.
on
(
'thread:removed'
,
_
.
bind
(
this
.
navigateToAllThreads
,
this
));
this
.
nav
.
on
(
'threads:rendered'
,
_
.
bind
(
this
.
setActiveThread
,
this
));
this
.
nav
.
on
(
'thread:created'
,
_
.
bind
(
this
.
navigateToThread
,
this
));
this
.
discussionBoardView
.
discussionThreadListView
.
on
(
'thread:selected'
,
_
.
bind
(
this
.
navigateToThread
,
this
)
);
this
.
discussionBoardView
.
discussionThreadListView
.
on
(
'thread:removed'
,
_
.
bind
(
this
.
navigateToAllThreads
,
this
)
);
this
.
discussionBoardView
.
discussionThreadListView
.
on
(
'threads:rendered'
,
_
.
bind
(
this
.
setActiveThread
,
this
)
);
this
.
discussionBoardView
.
discussionThreadListView
.
on
(
'thread:created'
,
_
.
bind
(
this
.
navigateToThread
,
this
)
);
Backbone
.
history
.
start
({
pushState
:
true
,
...
...
@@ -57,15 +60,15 @@
},
allThreads
:
function
()
{
this
.
nav
.
updateSidebar
();
return
this
.
nav
.
goHome
();
this
.
discussionBoardView
.
updateSidebar
();
return
this
.
discussionBoardView
.
goHome
();
},
setActiveThread
:
function
()
{
if
(
this
.
thread
)
{
return
this
.
nav
.
setActiveThread
(
this
.
thread
.
get
(
'id'
));
return
this
.
discussionBoardView
.
discussionThreadListView
.
setActiveThread
(
this
.
thread
.
get
(
'id'
));
}
else
{
return
this
.
nav
.
goHome
;
return
this
.
discussionBoardView
.
goHome
;
}
},
...
...
@@ -86,8 +89,8 @@
if
(
!
(
$
(
'.forum-content'
).
is
(
':visible'
)))
{
$
(
'.forum-content'
).
fadeIn
();
}
if
(
this
.
newPostView
.
$el
.
is
(
':visible'
))
{
this
.
newPostView
.
$el
.
fadeOut
();
if
(
$
(
'.new-post-article'
)
.
is
(
':visible'
))
{
$
(
'.new-post-article'
)
.
fadeOut
();
}
this
.
main
=
new
DiscussionThreadView
({
el
:
$
(
'.forum-content'
),
...
...
@@ -97,14 +100,13 @@
});
this
.
main
.
render
();
this
.
main
.
on
(
'thread:responses:rendered'
,
function
()
{
return
self
.
nav
.
updateSidebar
();
return
self
.
discussionBoardView
.
updateSidebar
();
});
return
this
.
thread
.
on
(
'thread:thread_type_updated'
,
this
.
showMain
);
},
navigateToThread
:
function
(
threadId
)
{
var
thread
;
thread
=
this
.
discussion
.
get
(
threadId
);
var
thread
=
this
.
discussion
.
get
(
threadId
);
return
this
.
navigate
(
''
+
(
thread
.
get
(
'commentable_id'
))
+
'/threads/'
+
threadId
,
{
trigger
:
true
});
...
...
@@ -135,6 +137,7 @@
}
});
}
});
return
DiscussionRouter
;
...
...
lms/djangoapps/discussion/static/discussion/js/spec/discussion_board_factory_spec.js
View file @
57fa123f
...
...
@@ -4,16 +4,34 @@ define(
'backbone'
,
'common/js/spec_helpers/page_helpers'
,
'common/js/spec_helpers/discussion_spec_helper'
,
'discussion/js/discussion_board_factory'
'discussion/js/discussion_board_factory'
,
'discussion/js/views/discussion_board_view'
],
function
(
$
,
Backbone
,
PageHelpers
,
DiscussionSpecHelper
,
DiscussionBoardFactory
)
{
function
(
$
,
Backbone
,
PageHelpers
,
DiscussionSpecHelper
,
DiscussionBoardFactory
,
DiscussionBoardView
)
{
'use strict'
;
// TODO: re-enable when this doesn't interact badly with other history tests
xdescribe
(
'Discussion Board Factory'
,
function
()
{
describe
(
'DiscussionBoardFactory'
,
function
()
{
var
createDiscussionBoardView
=
function
()
{
var
discussionBoardView
,
discussion
=
DiscussionSpecHelper
.
createTestDiscussion
({}),
courseSettings
=
DiscussionSpecHelper
.
createTestCourseSettings
();
setFixtures
(
'<div class="discussion-board"><div class="forum-search"></div></div>'
);
DiscussionSpecHelper
.
setUnderscoreFixtures
();
discussionBoardView
=
new
DiscussionBoardView
({
el
:
$
(
'.discussion-board'
),
discussion
:
discussion
,
courseSettings
:
courseSettings
});
return
discussionBoardView
;
};
var
initializeDiscussionBoardFactory
=
function
()
{
DiscussionBoardFactory
({
el
:
$
(
'
.discussion-board
'
),
el
:
$
(
'
#discussion-container
'
),
courseId
:
'test_course_id'
,
course_name
:
'Test Course'
,
user_info
:
DiscussionSpecHelper
.
getTestUserInfo
(),
...
...
@@ -33,14 +51,11 @@ define(
};
beforeEach
(
function
()
{
PageHelpers
.
preventBackboneChangingUrl
();
// Install the fixtures
setFixtures
(
'<div class="discussion-board">'
+
' <div class="forum-nav"></div>'
+
'</div>'
'<div id="discussion-container" class="discussion-board"></div></div>'
);
PageHelpers
.
preventBackboneChangingUrl
();
DiscussionSpecHelper
.
setUnderscoreFixtures
();
});
...
...
@@ -48,9 +63,11 @@ define(
Backbone
.
history
.
stop
();
});
it
(
'can render itself'
,
function
()
{
xit
(
'can render itself'
,
function
()
{
// this failed Search: navigates to search, and TeamsTab
var
discussionView
=
createDiscussionBoardView
();
discussionView
.
render
();
initializeDiscussionBoardFactory
();
expect
(
$
(
'.discussion-board'
).
text
()).
toContain
(
'All Discussion
s'
);
expect
(
discussionView
.
$el
.
text
()).
toContain
(
'Search all post
s'
);
});
});
}
...
...
lms/djangoapps/discussion/static/discussion/js/spec/discussion_board_view_spec.js
0 → 100644
View file @
57fa123f
/* globals Discussion, DiscussionCourseSettings */
(
function
(
define
)
{
'use strict'
;
define
(
[
'underscore'
,
'jquery'
,
'edx-ui-toolkit/js/utils/constants'
,
'common/js/discussion/discussion'
,
'common/js/spec_helpers/discussion_spec_helper'
,
'discussion/js/views/discussion_board_view'
],
function
(
_
,
$
,
constants
,
Discussion
,
DiscussionSpecHelper
,
DiscussionBoardView
)
{
describe
(
'DiscussionBoardView'
,
function
()
{
var
createDiscussionBoardView
;
createDiscussionBoardView
=
function
()
{
var
discussionBoardView
,
discussion
=
DiscussionSpecHelper
.
createTestDiscussion
({}),
courseSettings
=
DiscussionSpecHelper
.
createTestCourseSettings
();
setFixtures
(
'<div class="discussion-board"><div class="forum-search"></div></div>'
);
DiscussionSpecHelper
.
setUnderscoreFixtures
();
discussionBoardView
=
new
DiscussionBoardView
({
el
:
$
(
'.discussion-board'
),
discussion
:
discussion
,
courseSettings
:
courseSettings
});
return
discussionBoardView
;
};
describe
(
'Search events'
,
function
()
{
it
(
'perform search when enter pressed inside search textfield'
,
function
()
{
var
discussionBoardView
=
createDiscussionBoardView
(),
threadListView
;
discussionBoardView
.
render
();
threadListView
=
discussionBoardView
.
discussionThreadListView
;
spyOn
(
threadListView
,
'performSearch'
);
discussionBoardView
.
$
(
'.search-input'
).
trigger
(
$
.
Event
(
'keydown'
,
{
which
:
constants
.
keyCodes
.
enter
}));
expect
(
threadListView
.
performSearch
).
toHaveBeenCalled
();
});
it
(
'perform search when search icon is clicked'
,
function
()
{
var
discussionBoardView
=
createDiscussionBoardView
(),
threadListView
;
discussionBoardView
.
render
();
threadListView
=
discussionBoardView
.
discussionThreadListView
;
spyOn
(
threadListView
,
'performSearch'
);
discussionBoardView
.
$el
.
find
(
'.search-btn'
).
click
();
expect
(
threadListView
.
performSearch
).
toHaveBeenCalled
();
});
});
});
});
}).
call
(
this
,
define
||
RequireJS
.
define
);
lms/djangoapps/discussion/static/discussion/js/spec/views/discussion_search_view_spec.js
deleted
100644 → 0
View file @
e5a57e75
define
([
'jquery'
,
'edx-ui-toolkit/js/utils/constants'
,
'discussion/js/views/discussion_search_view'
],
function
(
$
,
constants
,
DiscussionSearchView
)
{
'use strict'
;
describe
(
'DiscussionSearchView'
,
function
()
{
var
view
;
beforeEach
(
function
()
{
setFixtures
(
'<div class="search-container"></div>'
);
view
=
new
DiscussionSearchView
({
el
:
$
(
'.search-container'
),
threadListView
:
{
performSearch
:
jasmine
.
createSpy
()
}
}).
render
();
});
describe
(
'Search events'
,
function
()
{
it
(
'perform search when enter pressed inside search textfield'
,
function
()
{
view
.
$el
.
find
(
'.search-input'
).
trigger
(
$
.
Event
(
'keydown'
,
{
which
:
constants
.
keyCodes
.
enter
}));
expect
(
view
.
threadListView
.
performSearch
).
toHaveBeenCalled
();
});
it
(
'perform search when search icon is clicked'
,
function
()
{
view
.
$el
.
find
(
'.search-btn'
).
click
();
expect
(
view
.
threadListView
.
performSearch
).
toHaveBeenCalled
();
});
});
});
}
);
lms/djangoapps/discussion/static/discussion/js/views/discussion_board_view.js
0 → 100644
View file @
57fa123f
This diff is collapsed.
Click to expand it.
lms/djangoapps/discussion/static/discussion/js/views/discussion_search_view.js
View file @
57fa123f
...
...
@@ -15,33 +15,16 @@
* in order to clean up that file and make it possible to break its logic into files like this one.
*/
var
searchView
=
Backbone
.
View
.
extend
({
events
:
{
'keydown .search-input'
:
'performSearch'
,
'click .search-btn'
:
'performSearch'
,
'topic:selected'
:
'clearSearch'
},
initialize
:
function
(
options
)
{
_
.
extend
(
this
,
_
.
pick
(
options
,
'threadListView'
));
_
.
extend
(
this
,
_
.
pick
(
options
,
[
'discussionBoardView'
]
));
this
.
template
=
HtmlUtils
.
template
(
searchTemplate
);
this
.
threadListView
=
options
.
threadListView
;
this
.
listenTo
(
this
.
model
,
'change'
,
this
.
render
);
this
.
render
();
},
render
:
function
()
{
HtmlUtils
.
setHtml
(
this
.
$el
,
this
.
template
());
return
this
;
},
performSearch
:
function
(
event
)
{
if
(
event
.
which
===
constants
.
keyCodes
.
enter
||
event
.
type
===
'click'
)
{
event
.
preventDefault
();
this
.
threadListView
.
performSearch
(
$
(
'.search-input'
,
this
.
$el
));
}
},
clearSearch
:
function
()
{
this
.
$
(
'.search-input'
).
val
(
''
);
this
.
threadListView
.
clearSearchAlerts
();
}
});
...
...
common/static/common/templates/discussion
/discussion-home.underscore
→
lms/djangoapps/discussion/static/discussion/templates
/discussion-home.underscore
View file @
57fa123f
File moved
lms/djangoapps/discussion/templates/discussion/discussion_board.html
View file @
57fa123f
...
...
@@ -77,6 +77,8 @@ DiscussionBoardFactory({
<div
class=
"page-content"
>
<div
class=
"discussion-body layout layout-1t2t"
>
<aside
class=
"forum-nav layout-col layout-col-a"
role=
"complementary"
aria-label=
"${_("
Discussion
thread
list
")}"
>
<
%
include
file=
"_filter_dropdown.html"
/>
<div
class=
"discussion-thread-list-container"
></div>
</aside>
<main
id=
"main"
aria-label=
"Content"
tabindex=
"-1"
class=
"discussion-column layout-col layout-col-b"
>
...
...
lms/static/lms/js/spec/main.js
View file @
57fa123f
...
...
@@ -288,11 +288,11 @@
deps
:
[
'jquery'
,
'underscore'
,
'slick.core'
,
'slick.grid'
],
init
:
function
()
{
// Set global variables that the util code is expecting to be defined
require
([
require
([
// eslint-disable-line global-require
'edx-ui-toolkit/js/utils/html-utils'
,
'edx-ui-toolkit/js/utils/string-utils'
],
function
(
HtmlUtils
,
StringUtils
)
{
window
.
edx
=
edx
||
{};
window
.
edx
=
window
.
edx
||
{};
window
.
edx
.
HtmlUtils
=
HtmlUtils
;
window
.
edx
.
StringUtils
=
StringUtils
;
});
...
...
@@ -383,7 +383,7 @@
deps
:
[
'jquery'
,
'underscore'
,
'underscore.string'
,
'backbone'
,
'gettext'
],
init
:
function
()
{
// Set global variables that the payment code is expecting to be defined
require
([
require
([
// eslint-disable-line global-require
'underscore'
,
'underscore.string'
,
'edx-ui-toolkit/js/utils/html-utils'
,
...
...
@@ -391,7 +391,7 @@
],
function
(
_
,
str
,
HtmlUtils
,
StringUtils
)
{
window
.
_
=
_
;
window
.
_
.
str
=
str
;
window
.
edx
=
edx
||
{};
window
.
edx
=
window
.
edx
||
{};
window
.
edx
.
HtmlUtils
=
HtmlUtils
;
window
.
edx
.
StringUtils
=
StringUtils
;
});
...
...
@@ -527,10 +527,21 @@
exports
:
'DiscussionUtil'
,
init
:
function
()
{
// Set global variables that the discussion code is expecting to be defined
require
([
'backbone'
,
'URI'
],
function
(
Backbone
,
URI
)
{
window
.
Backbone
=
Backbone
;
window
.
URI
=
URI
;
});
require
(
// eslint-disable-line global-require
[
'backbone'
,
'URI'
,
'edx-ui-toolkit/js/utils/html-utils'
,
'edx-ui-toolkit/js/utils/string-utils'
],
function
(
Backbone
,
URI
,
HtmlUtils
,
StringUtils
)
{
window
.
Backbone
=
Backbone
;
window
.
URI
=
URI
;
window
.
edx
=
window
.
edx
||
{};
window
.
edx
.
HtmlUtils
=
HtmlUtils
;
window
.
edx
.
StringUtils
=
StringUtils
;
}
);
}
},
'common/js/discussion/content'
:
{
...
...
@@ -542,11 +553,11 @@
'common/js/discussion/discussion'
:
{
deps
:
[
'common/js/discussion/utils'
,
'
xmodule_js/common_static/
common/js/discussion/content'
'common/js/discussion/content'
],
exports
:
'Discussion'
},
'common/js/discussion/discussion_course_settings'
:
{
'common/js/discussion/
models/
discussion_course_settings'
:
{
deps
:
[
'common/js/discussion/utils'
],
...
...
@@ -664,7 +675,7 @@
var
testFiles
=
[
'discussion/js/spec/discussion_board_factory_spec.js'
,
'discussion/js/spec/discussion_profile_page_factory_spec.js'
,
'discussion/js/spec/
views/discussion_search
_view_spec.js'
,
'discussion/js/spec/
discussion_board
_view_spec.js'
,
'discussion/js/spec/views/discussion_user_profile_view_spec.js'
,
'lms/js/spec/preview/preview_factory_spec.js'
,
'js/spec/api_admin/catalog_preview_spec.js'
,
...
...
lms/templates/discussion/_js_body_dependencies.html
View file @
57fa123f
...
...
@@ -16,11 +16,14 @@ from openedx.core.djangolib.js_utils import js_escaped_string
<
%
discussion_classes =
[
['
Discussion
',
'
common
/
js
/
discussion
/
discussion
'],
['
Content
',
'
common
/
js
/
discussion
/
content
'],
['
DiscussionModuleView
',
'
common
/
js
/
discussion
/
discussion_module_view
'],
['
DiscussionThreadView
',
'
common
/
js
/
discussion
/
views
/
discussion_thread_view
'],
['
DiscussionThreadListView
',
'
common
/
js
/
discussion
/
views
/
discussion_thread_list_view
'],
['
DiscussionThreadProfileView
',
'
common
/
js
/
discussion
/
views
/
discussion_thread_profile_view
'],
['
DiscussionUtil
',
'
common
/
js
/
discussion
/
utils
'],
['
DiscussionCourseSettings
',
'
common
/
js
/
discussion
/
models
/
discussion_course_settings
'],
['
DiscussionUser
',
'
common
/
js
/
discussion
/
models
/
discussion_user
'],
['
NewPostView
',
'
common
/
js
/
discussion
/
views
/
new_post_view
'],
]
%
>
...
...
lms/templates/discussion/_thread_list_template.html
View file @
57fa123f
<
%
page
expression_filter=
"h"
/>
<
%!
from
django
.
utils
.
translation
import
ugettext
as
_
%
>
<script
type=
"text/template"
id=
"thread-list-template"
>
<%
include
file
=
"_filter_dropdown.html"
/>
<
div
class
=
"forum-nav-thread-list-wrapper"
id
=
"sort-filter-wrapper"
tabindex
=
"-1"
>
<
div
class
=
"forum-nav-thread-list-wrapper"
id
=
"sort-filter-wrapper"
tabindex
=
"-1"
style
=
"display:none"
>
<
div
class
=
"forum-nav-refine-bar"
>
<
label
class
=
"forum-nav-filter-main"
>
##
Translators
:
This
labels
a
filter
menu
in
forum
navigation
...
...
lms/templates/discussion/_underscore_templates.html
View file @
57fa123f
...
...
@@ -14,7 +14,7 @@
<
%
template_names =
[
'
thread
',
'
thread-show
',
'
thread-edit
',
'
thread-response
',
'
thread-response-show
',
'
thread-response-edit
',
'
response-comment-show
',
'
response-comment-edit
',
'
thread-list-item
',
'
discussion-home
',
'
search-alert
',
'
response-comment-show
',
'
response-comment-edit
',
'
thread-list-item
',
'
search-alert
',
'
new-post
',
'
new-post-menu-entry
',
'
new-post-menu-category
',
'
new-post-alert
',
'
topic
',
'
post-user-display
',
'
inline-discussion
',
'
pagination
',
'
profile-thread
',
'
customwmd-prompt
',
'
nav-loading
',
'
thread-type
'
]
...
...
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