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
4c4476a7
Commit
4c4476a7
authored
Aug 05, 2016
by
Brian Jacobel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix lint issues on feature branch
parent
a60d456f
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
94 additions
and
104 deletions
+94
-104
common/static/common/js/discussion/views/discussion_thread_list_view.js
+48
-42
common/static/common/js/spec/discussion/view/discussion_thread_list_view_spec.js
+29
-33
common/static/common/js/spec_helpers/discussion_spec_helper.js
+9
-12
lms/djangoapps/discussion/static/discussion/js/discussion_board_factory.js
+1
-1
lms/djangoapps/discussion/static/discussion/js/discussion_profile_page_factory.js
+3
-4
lms/djangoapps/discussion/static/discussion/js/spec/views/discussion_user_profile_view_spec.js
+1
-9
lms/djangoapps/discussion/static/discussion/js/views/discussion_fake_breadcrumbs.js
+1
-1
lms/static/js/spec/courseware/link_clicked_events_spec.js
+1
-1
lms/static/lms/js/spec/main.js
+1
-1
No files found.
common/static/common/js/discussion/views/discussion_thread_list_view.js
View file @
4c4476a7
/* globals Content, Discussion, DiscussionUtil */
/* globals
_, Backbone,
Content, Discussion, DiscussionUtil */
(
function
()
{
(
function
()
{
'use strict'
;
'use strict'
;
var
__hasProp
=
{}.
hasOwnProperty
,
var
__hasProp
=
{}.
hasOwnProperty
,
...
@@ -156,16 +156,13 @@
...
@@ -156,16 +156,13 @@
/**
/**
* Creates search alert model and adds it to collection
* Creates search alert model and adds it to collection
* @param message - alert message
* @param message - alert message
* @param css
_c
lass - Allows setting custom css class for a message. This can be used to style messages
* @param css
C
lass - Allows setting custom css class for a message. This can be used to style messages
*
of different types differently (i.e. other background, completely hide, etc.)
* of different types differently (i.e. other background, completely hide, etc.)
* @returns {Backbone.Model}
* @returns {Backbone.Model}
*/
*/
DiscussionThreadListView
.
prototype
.
addSearchAlert
=
function
(
message
,
css
_c
lass
)
{
DiscussionThreadListView
.
prototype
.
addSearchAlert
=
function
(
message
,
css
C
lass
)
{
var
m
;
var
m
;
if
(
typeof
css_class
===
'undefined'
||
css_class
===
null
)
{
m
=
new
Backbone
.
Model
({
message
:
message
,
css_class
:
cssClass
||
''
});
css_class
=
''
;
}
m
=
new
Backbone
.
Model
({
'message'
:
message
,
'css_class'
:
css_class
});
this
.
searchAlertCollection
.
add
(
m
);
this
.
searchAlertCollection
.
add
(
m
);
return
m
;
return
m
;
};
};
...
@@ -179,16 +176,16 @@
...
@@ -179,16 +176,16 @@
};
};
DiscussionThreadListView
.
prototype
.
reloadDisplayedCollection
=
function
(
thread
)
{
DiscussionThreadListView
.
prototype
.
reloadDisplayedCollection
=
function
(
thread
)
{
var
active
,
$content
,
current_el
,
thread_i
d
;
var
active
,
$content
,
$currentElement
,
threadI
d
;
this
.
clearSearchAlerts
();
this
.
clearSearchAlerts
();
thread
_i
d
=
thread
.
get
(
'id'
);
thread
I
d
=
thread
.
get
(
'id'
);
$content
=
this
.
renderThread
(
thread
);
$content
=
this
.
renderThread
(
thread
);
current_el
=
this
.
$
(
'.forum-nav-thread[data-id='
+
thread_i
d
+
']'
);
$currentElement
=
this
.
$
(
'.forum-nav-thread[data-id='
+
threadI
d
+
']'
);
active
=
current_el
.
has
(
'.forum-nav-thread-link.is-active'
).
length
!==
0
;
active
=
$currentElement
.
has
(
'.forum-nav-thread-link.is-active'
).
length
!==
0
;
current_el
.
replaceWith
(
$content
);
$currentElement
.
replaceWith
(
$content
);
this
.
showMetadataAccordingToSort
();
this
.
showMetadataAccordingToSort
();
if
(
active
)
{
if
(
active
)
{
return
this
.
setActiveThread
(
thread
_i
d
);
return
this
.
setActiveThread
(
thread
I
d
);
}
}
};
};
...
@@ -198,14 +195,14 @@
...
@@ -198,14 +195,14 @@
DiscussionThreadListView
.
prototype
.
addAndSelectThread
=
function
(
thread
)
{
DiscussionThreadListView
.
prototype
.
addAndSelectThread
=
function
(
thread
)
{
var
commentable
_i
d
,
menuItem
,
var
commentable
I
d
,
menuItem
,
self
=
this
;
self
=
this
;
commentable
_i
d
=
thread
.
get
(
'commentable_id'
);
commentable
I
d
=
thread
.
get
(
'commentable_id'
);
menuItem
=
this
.
$
(
'.forum-nav-browse-menu-item[data-discussion-id]'
).
filter
(
function
()
{
menuItem
=
this
.
$
(
'.forum-nav-browse-menu-item[data-discussion-id]'
).
filter
(
function
()
{
return
$
(
this
).
data
(
'discussion-id'
)
===
commentable
_i
d
;
return
$
(
this
).
data
(
'discussion-id'
)
===
commentable
I
d
;
});
});
this
.
setCurrentTopicDisplay
(
this
.
getPathText
(
menuItem
));
this
.
setCurrentTopicDisplay
(
this
.
getPathText
(
menuItem
));
return
this
.
retrieveDiscussion
(
commentable
_i
d
,
function
()
{
return
this
.
retrieveDiscussion
(
commentable
I
d
,
function
()
{
return
self
.
trigger
(
'thread:created'
,
thread
.
get
(
'id'
));
return
self
.
trigger
(
'thread:created'
,
thread
.
get
(
'id'
));
});
});
};
};
...
@@ -403,27 +400,28 @@
...
@@ -403,27 +400,28 @@
this
.
trigger
(
'thread:removed'
,
thread
);
this
.
trigger
(
'thread:removed'
,
thread
);
};
};
DiscussionThreadListView
.
prototype
.
setActiveThread
=
function
(
thread
_i
d
)
{
DiscussionThreadListView
.
prototype
.
setActiveThread
=
function
(
thread
I
d
)
{
var
$srElem
;
var
$srElem
;
this
.
$
(
'.forum-nav-thread-link'
).
find
(
'.sr'
).
remove
();
this
.
$
(
'.forum-nav-thread-link'
).
find
(
'.sr'
).
remove
();
this
.
$
(
".forum-nav-thread[data-id!='"
+
thread
_i
d
+
"'] .forum-nav-thread-link"
)
this
.
$
(
".forum-nav-thread[data-id!='"
+
thread
I
d
+
"'] .forum-nav-thread-link"
)
.
removeClass
(
'is-active'
);
.
removeClass
(
'is-active'
);
$srElem
=
edx
.
HtmlUtils
.
joinHtml
(
$srElem
=
edx
.
HtmlUtils
.
joinHtml
(
edx
.
HtmlUtils
.
HTML
(
'<span class="sr">'
),
edx
.
HtmlUtils
.
HTML
(
'<span class="sr">'
),
edx
.
HtmlUtils
.
ensureHtml
(
gettext
(
'Current conversation'
)),
edx
.
HtmlUtils
.
ensureHtml
(
gettext
(
'Current conversation'
)),
edx
.
HtmlUtils
.
HTML
(
'</span>'
)
edx
.
HtmlUtils
.
HTML
(
'</span>'
)
).
toString
();
).
toString
();
this
.
$
(
".forum-nav-thread[data-id='"
+
thread
_i
d
+
"'] .forum-nav-thread-link"
)
this
.
$
(
".forum-nav-thread[data-id='"
+
thread
I
d
+
"'] .forum-nav-thread-link"
)
.
addClass
(
'is-active'
).
find
(
'.forum-nav-thread-wrapper-1'
)
.
addClass
(
'is-active'
).
find
(
'.forum-nav-thread-wrapper-1'
)
.
prepend
(
$srElem
);
.
prepend
(
$srElem
);
};
};
DiscussionThreadListView
.
prototype
.
goHome
=
function
()
{
DiscussionThreadListView
.
prototype
.
goHome
=
function
()
{
var
url
,
$t
pl_c
ontent
;
var
url
,
$t
emplateC
ontent
;
this
.
template
=
_
.
template
(
$
(
'#discussion-home-template'
).
html
());
this
.
template
=
_
.
template
(
$
(
'#discussion-home-template'
).
html
());
$tpl_content
=
$
(
this
.
template
());
$templateContent
=
$
(
this
.
template
());
$
(
'.forum-content'
).
empty
().
append
(
$tpl_content
);
$
(
'.forum-content'
).
empty
().
append
(
$templateContent
);
$
(
'.forum-nav-thread-list a'
).
removeClass
(
'is-active'
).
find
(
'.sr'
).
remove
();
$
(
'.forum-nav-thread-list a'
).
removeClass
(
'is-active'
).
find
(
'.sr'
)
.
remove
();
$
(
'input.email-setting'
).
bind
(
'click'
,
this
.
updateEmailNotifications
);
$
(
'input.email-setting'
).
bind
(
'click'
,
this
.
updateEmailNotifications
);
url
=
DiscussionUtil
.
urlFor
(
'notifications_status'
,
window
.
user
.
get
(
'id'
));
url
=
DiscussionUtil
.
urlFor
(
'notifications_status'
,
window
.
user
.
get
(
'id'
));
DiscussionUtil
.
safeAjax
({
DiscussionUtil
.
safeAjax
({
...
@@ -480,12 +478,19 @@
...
@@ -480,12 +478,19 @@
};
};
DiscussionThreadListView
.
prototype
.
getBreadcrumbText
=
function
(
$item
)
{
DiscussionThreadListView
.
prototype
.
getBreadcrumbText
=
function
(
$item
)
{
var
subTopic
=
$
(
'.forum-nav-browse-title'
,
$item
).
first
().
text
().
trim
(),
var
$parentSubMenus
=
$item
.
parents
(
'.forum-nav-browse-submenu'
),
$parentSubMenus
=
$item
.
parents
(
'.forum-nav-browse-submenu'
),
crumbs
=
[],
crumbs
=
[];
subTopic
=
$
(
'.forum-nav-browse-title'
,
$item
)
.
first
()
.
text
()
.
trim
();
$parentSubMenus
.
each
(
function
(
i
,
el
)
{
$parentSubMenus
.
each
(
function
(
i
,
el
)
{
crumbs
.
push
(
$
(
el
).
siblings
(
'.forum-nav-browse-title'
).
first
().
text
().
trim
());
crumbs
.
push
(
$
(
el
).
siblings
(
'.forum-nav-browse-title'
)
.
first
()
.
text
()
.
trim
()
);
});
});
if
(
subTopic
!==
'All Discussions'
)
{
if
(
subTopic
!==
'All Discussions'
)
{
...
@@ -505,15 +510,15 @@
...
@@ -505,15 +510,15 @@
}
else
{
}
else
{
items
.
hide
();
items
.
hide
();
return
items
.
each
(
function
(
i
,
item
)
{
return
items
.
each
(
function
(
i
,
item
)
{
var
path
,
pathText
;
var
path
,
pathText
,
item
=
$
(
item
);
$
item
=
$
(
item
);
if
(
!
item
.
is
(
':visible'
))
{
if
(
!
$
item
.
is
(
':visible'
))
{
pathText
=
self
.
getPathText
(
item
).
toLowerCase
();
pathText
=
self
.
getPathText
(
$
item
).
toLowerCase
();
if
(
query
.
split
(
' '
).
every
(
function
(
term
)
{
if
(
query
.
split
(
' '
).
every
(
function
(
term
)
{
return
pathText
.
search
(
term
.
toLowerCase
())
!==
-
1
;
return
pathText
.
search
(
term
.
toLowerCase
())
!==
-
1
;
}))
{
}))
{
path
=
item
.
parents
(
'.forum-nav-browse-menu-item'
).
andSelf
();
path
=
$
item
.
parents
(
'.forum-nav-browse-menu-item'
).
andSelf
();
return
path
.
add
(
item
.
find
(
'.forum-nav-browse-menu-item'
)).
show
();
return
path
.
add
(
$
item
.
find
(
'.forum-nav-browse-menu-item'
)).
show
();
}
}
}
}
});
});
...
@@ -559,7 +564,7 @@
...
@@ -559,7 +564,7 @@
_results
.
push
(
x
.
replace
(
/^
\s
+|
\s
+$/g
,
''
));
_results
.
push
(
x
.
replace
(
/^
\s
+|
\s
+$/g
,
''
));
}
}
return
_results
;
return
_results
;
}
)(
);
}
()
);
prefix
=
''
;
prefix
=
''
;
while
(
path
.
length
>
1
)
{
while
(
path
.
length
>
1
)
{
prefix
=
gettext
(
'…'
)
+
'/'
;
prefix
=
gettext
(
'…'
)
+
'/'
;
...
@@ -619,9 +624,10 @@
...
@@ -619,9 +624,10 @@
return
this
.
retrieveFirstPage
();
return
this
.
retrieveFirstPage
();
};
};
DiscussionThreadListView
.
prototype
.
retrieveDiscussion
=
function
(
discussion_id
,
callback
)
{
DiscussionThreadListView
.
prototype
.
retrieveDiscussion
=
function
(
discussionId
,
callback
)
{
var
url
,
self
=
this
;
var
url
,
url
=
DiscussionUtil
.
urlFor
(
'retrieve_discussion'
,
discussion_id
);
self
=
this
;
url
=
DiscussionUtil
.
urlFor
(
'retrieve_discussion'
,
discussionId
);
return
DiscussionUtil
.
safeAjax
({
return
DiscussionUtil
.
safeAjax
({
url
:
url
,
url
:
url
,
type
:
'GET'
,
type
:
'GET'
,
...
@@ -671,7 +677,7 @@
...
@@ -671,7 +677,7 @@
this
.
hideBrowseMenu
();
this
.
hideBrowseMenu
();
this
.
setCurrentTopicDisplay
(
gettext
(
'Search Results'
));
this
.
setCurrentTopicDisplay
(
gettext
(
'Search Results'
));
text
=
this
.
$
(
'.forum-nav-search-input'
).
val
();
text
=
this
.
$
(
'.forum-nav-search-input'
).
val
();
return
this
.
searchFor
(
text
);
this
.
searchFor
(
text
);
}
}
};
};
...
@@ -730,10 +736,10 @@
...
@@ -730,10 +736,10 @@
message
=
edx
.
HtmlUtils
.
interpolateHtml
(
message
=
edx
.
HtmlUtils
.
interpolateHtml
(
noResponseMsg
,
noResponseMsg
,
{
{
'original_query'
:
edx
.
HtmlUtils
.
joinHtml
(
original_query
:
edx
.
HtmlUtils
.
joinHtml
(
edx
.
HtmlUtils
.
HTML
(
'<em>'
),
text
,
edx
.
HtmlUtils
.
HTML
(
'</em>'
)
edx
.
HtmlUtils
.
HTML
(
'<em>'
),
text
,
edx
.
HtmlUtils
.
HTML
(
'</em>'
)
),
),
'suggested_query'
:
edx
.
HtmlUtils
.
joinHtml
(
suggested_query
:
edx
.
HtmlUtils
.
joinHtml
(
edx
.
HtmlUtils
.
HTML
(
'<em>'
),
edx
.
HtmlUtils
.
HTML
(
'<em>'
),
response
.
corrected_text
,
response
.
corrected_text
,
edx
.
HtmlUtils
.
HTML
(
'</em>'
)
edx
.
HtmlUtils
.
HTML
(
'</em>'
)
...
...
common/static/common/js/spec/discussion/view/discussion_thread_list_view_spec.js
View file @
4c4476a7
/* globals
/* globals
Discussion, DiscussionCourseSettings, DiscussionViewSpecHelper, DiscussionSpecHelper,
_,
Discussion, DiscussionCourseSettings, DiscussionViewSpecHelper, DiscussionSpecHelper,
DiscussionThreadListView, DiscussionUtil, Thread
DiscussionThreadListView, DiscussionUtil, Thread
*/
*/
(
function
()
{
(
function
()
{
...
@@ -156,22 +156,22 @@
...
@@ -156,22 +156,22 @@
return
expect
(
this
.
view
.
$
(
'.forum-nav-filter-main-control'
).
val
()).
toEqual
(
'all'
);
return
expect
(
this
.
view
.
$
(
'.forum-nav-filter-main-control'
).
val
()).
toEqual
(
'all'
);
});
});
checkThreadsOrdering
=
function
(
view
,
sort
_o
rder
,
type
)
{
checkThreadsOrdering
=
function
(
view
,
sort
O
rder
,
type
)
{
expect
(
view
.
$el
.
find
(
'.forum-nav-thread'
).
children
().
length
).
toEqual
(
4
);
expect
(
view
.
$el
.
find
(
'.forum-nav-thread'
).
children
().
length
).
toEqual
(
4
);
expect
(
view
.
$el
.
find
(
'.forum-nav-thread:nth-child(1) .forum-nav-thread-title'
).
text
())
expect
(
view
.
$el
.
find
(
'.forum-nav-thread:nth-child(1) .forum-nav-thread-title'
).
text
())
.
toEqual
(
sort
_o
rder
[
0
]);
.
toEqual
(
sort
O
rder
[
0
]);
expect
(
view
.
$el
.
find
(
'.forum-nav-thread:nth-child(2) .forum-nav-thread-title'
).
text
())
expect
(
view
.
$el
.
find
(
'.forum-nav-thread:nth-child(2) .forum-nav-thread-title'
).
text
())
.
toEqual
(
sort
_o
rder
[
1
]);
.
toEqual
(
sort
O
rder
[
1
]);
expect
(
view
.
$el
.
find
(
'.forum-nav-thread:nth-child(3) .forum-nav-thread-title'
).
text
())
expect
(
view
.
$el
.
find
(
'.forum-nav-thread:nth-child(3) .forum-nav-thread-title'
).
text
())
.
toEqual
(
sort
_o
rder
[
2
]);
.
toEqual
(
sort
O
rder
[
2
]);
expect
(
view
.
$el
.
find
(
'.forum-nav-thread:nth-child(4) .forum-nav-thread-title'
).
text
())
expect
(
view
.
$el
.
find
(
'.forum-nav-thread:nth-child(4) .forum-nav-thread-title'
).
text
())
.
toEqual
(
sort
_o
rder
[
3
]);
.
toEqual
(
sort
O
rder
[
3
]);
return
expect
(
view
.
$el
.
find
(
'.forum-nav-sort-control'
).
val
()).
toEqual
(
type
);
return
expect
(
view
.
$el
.
find
(
'.forum-nav-sort-control'
).
val
()).
toEqual
(
type
);
};
};
describe
(
'thread rendering should be correct'
,
function
()
{
describe
(
'thread rendering should be correct'
,
function
()
{
var
checkRender
;
var
checkRender
;
checkRender
=
function
(
threads
,
type
,
sort
_o
rder
)
{
checkRender
=
function
(
threads
,
type
,
sort
O
rder
)
{
var
discussion
,
view
;
var
discussion
,
view
;
discussion
=
new
Discussion
(
_
.
map
(
threads
,
function
(
thread
)
{
discussion
=
new
Discussion
(
_
.
map
(
threads
,
function
(
thread
)
{
return
new
Thread
(
thread
);
return
new
Thread
(
thread
);
...
@@ -181,56 +181,56 @@
...
@@ -181,56 +181,56 @@
});
});
view
=
makeView
(
discussion
);
view
=
makeView
(
discussion
);
view
.
render
();
view
.
render
();
checkThreadsOrdering
(
view
,
sort
_o
rder
,
type
);
checkThreadsOrdering
(
view
,
sort
O
rder
,
type
);
expect
(
view
.
$el
.
find
(
'.forum-nav-thread-comments-count:visible'
).
length
)
expect
(
view
.
$el
.
find
(
'.forum-nav-thread-comments-count:visible'
).
length
)
.
toEqual
(
type
===
'votes'
?
0
:
4
);
.
toEqual
(
type
===
'votes'
?
0
:
4
);
expect
(
view
.
$el
.
find
(
'.forum-nav-thread-votes-count:visible'
).
length
)
expect
(
view
.
$el
.
find
(
'.forum-nav-thread-votes-count:visible'
).
length
)
.
toEqual
(
type
===
'votes'
?
4
:
0
);
.
toEqual
(
type
===
'votes'
?
4
:
0
);
if
(
type
===
'votes'
)
{
if
(
type
===
'votes'
)
{
return
expect
(
_
.
map
(
view
.
$el
.
find
(
'.forum-nav-thread-votes-count'
),
function
(
element
)
{
expect
(
_
.
map
(
view
.
$el
.
find
(
'.forum-nav-thread-votes-count'
),
function
(
element
)
{
return
$
(
element
).
text
().
trim
();
return
$
(
element
).
text
().
trim
();
})).
toEqual
([
'+25 votes'
,
'+20 votes'
,
'+42 votes'
,
'+12 votes'
]);
})).
toEqual
([
'+25 votes'
,
'+20 votes'
,
'+42 votes'
,
'+12 votes'
]);
}
}
};
};
it
(
'with sort preference activity'
,
function
()
{
it
(
'with sort preference activity'
,
function
()
{
return
checkRender
(
this
.
threads
,
'activity'
,
[
'Thread1'
,
'Thread2'
,
'Thread3'
,
'Thread4'
]);
checkRender
(
this
.
threads
,
'activity'
,
[
'Thread1'
,
'Thread2'
,
'Thread3'
,
'Thread4'
]);
});
});
it
(
'with sort preference votes'
,
function
()
{
it
(
'with sort preference votes'
,
function
()
{
return
checkRender
(
this
.
threads
,
'votes'
,
[
'Thread4'
,
'Thread1'
,
'Thread2'
,
'Thread3'
]);
checkRender
(
this
.
threads
,
'votes'
,
[
'Thread4'
,
'Thread1'
,
'Thread2'
,
'Thread3'
]);
});
});
it
(
'with sort preference comments'
,
function
()
{
it
(
'with sort preference comments'
,
function
()
{
return
checkRender
(
this
.
threads
,
'comments'
,
[
'Thread1'
,
'Thread4'
,
'Thread3'
,
'Thread2'
]);
checkRender
(
this
.
threads
,
'comments'
,
[
'Thread1'
,
'Thread4'
,
'Thread3'
,
'Thread2'
]);
});
});
});
});
describe
(
'Sort change should be correct'
,
function
()
{
describe
(
'Sort change should be correct'
,
function
()
{
var
changeSorting
;
var
changeSorting
;
changeSorting
=
function
(
threads
,
selected
_type
,
new_type
,
sort_o
rder
)
{
changeSorting
=
function
(
threads
,
selected
Type
,
newType
,
sortO
rder
)
{
var
discussion
,
sortControl
,
sorted
_t
hreads
,
view
;
var
discussion
,
sortControl
,
sorted
T
hreads
,
view
;
discussion
=
new
Discussion
(
_
.
map
(
threads
,
function
(
thread
)
{
discussion
=
new
Discussion
(
_
.
map
(
threads
,
function
(
thread
)
{
return
new
Thread
(
thread
);
return
new
Thread
(
thread
);
}),
{
}),
{
pages
:
1
,
pages
:
1
,
sort
:
selected
_t
ype
sort
:
selected
T
ype
});
});
view
=
makeView
(
discussion
);
view
=
makeView
(
discussion
);
view
.
render
();
view
.
render
();
sortControl
=
view
.
$el
.
find
(
'.forum-nav-sort-control'
);
sortControl
=
view
.
$el
.
find
(
'.forum-nav-sort-control'
);
expect
(
sortControl
.
val
()).
toEqual
(
selected
_t
ype
);
expect
(
sortControl
.
val
()).
toEqual
(
selected
T
ype
);
sorted
_t
hreads
=
[];
sorted
T
hreads
=
[];
if
(
new
_t
ype
===
'activity'
)
{
if
(
new
T
ype
===
'activity'
)
{
sorted
_t
hreads
=
[
threads
[
0
],
threads
[
3
],
threads
[
1
],
threads
[
2
]];
sorted
T
hreads
=
[
threads
[
0
],
threads
[
3
],
threads
[
1
],
threads
[
2
]];
}
else
if
(
new
_t
ype
===
'comments'
)
{
}
else
if
(
new
T
ype
===
'comments'
)
{
sorted
_t
hreads
=
[
threads
[
0
],
threads
[
3
],
threads
[
2
],
threads
[
1
]];
sorted
T
hreads
=
[
threads
[
0
],
threads
[
3
],
threads
[
2
],
threads
[
1
]];
}
else
if
(
new
_t
ype
===
'votes'
)
{
}
else
if
(
new
T
ype
===
'votes'
)
{
sorted
_t
hreads
=
[
threads
[
3
],
threads
[
0
],
threads
[
1
],
threads
[
2
]];
sorted
T
hreads
=
[
threads
[
3
],
threads
[
0
],
threads
[
1
],
threads
[
2
]];
}
}
$
.
ajax
.
and
.
callFake
(
function
(
params
)
{
$
.
ajax
.
and
.
callFake
(
function
(
params
)
{
params
.
success
({
params
.
success
({
'discussion_data'
:
sorted_t
hreads
,
discussion_data
:
sortedT
hreads
,
page
:
1
,
page
:
1
,
num_pages
:
1
num_pages
:
1
});
});
...
@@ -239,9 +239,9 @@
...
@@ -239,9 +239,9 @@
}
}
};
};
});
});
sortControl
.
val
(
new
_t
ype
).
change
();
sortControl
.
val
(
new
T
ype
).
change
();
expect
(
$
.
ajax
).
toHaveBeenCalled
();
expect
(
$
.
ajax
).
toHaveBeenCalled
();
checkThreadsOrdering
(
view
,
sort
_order
,
new_t
ype
);
checkThreadsOrdering
(
view
,
sort
Order
,
newT
ype
);
};
};
it
(
'with sort preference activity'
,
function
()
{
it
(
'with sort preference activity'
,
function
()
{
...
@@ -290,7 +290,7 @@
...
@@ -290,7 +290,7 @@
});
});
it
(
'renders search alert with custom class'
,
function
()
{
it
(
'renders search alert with custom class'
,
function
()
{
var
foo
,
messages
;
var
messages
;
testAlertMessages
([]);
testAlertMessages
([]);
this
.
view
.
addSearchAlert
(
'foo'
,
'custom-class'
);
this
.
view
.
addSearchAlert
(
'foo'
,
'custom-class'
);
...
@@ -299,7 +299,7 @@
...
@@ -299,7 +299,7 @@
expect
(
messages
[
0
].
text
).
toEqual
(
'foo'
);
expect
(
messages
[
0
].
text
).
toEqual
(
'foo'
);
expect
(
messages
[
0
].
css_class
).
toEqual
(
'search-alert custom-class'
);
expect
(
messages
[
0
].
css_class
).
toEqual
(
'search-alert custom-class'
);
foo
=
this
.
view
.
addSearchAlert
(
'bar'
,
'other-class'
);
this
.
view
.
addSearchAlert
(
'bar'
,
'other-class'
);
messages
=
getAlertMessagesAndClasses
();
messages
=
getAlertMessagesAndClasses
();
expect
(
messages
.
length
).
toEqual
(
2
);
expect
(
messages
.
length
).
toEqual
(
2
);
...
@@ -572,11 +572,7 @@
...
@@ -572,11 +572,7 @@
});
});
describe
(
'when shown'
,
function
()
{
describe
(
'when shown'
,
function
()
{
beforeEach
(
function
()
{
it
(
'should show again when header button is clicked'
,
function
()
{
return
$
(
'.forum-nav-browse'
).
click
();
});
it
(
'should hide when header button is clicked'
,
function
()
{
$
(
'.forum-nav-browse'
).
click
();
$
(
'.forum-nav-browse'
).
click
();
return
expectBrowseMenuVisible
(
false
);
return
expectBrowseMenuVisible
(
false
);
});
});
...
...
common/static/common/js/spec_helpers/discussion_spec_helper.js
View file @
4c4476a7
...
@@ -22,18 +22,18 @@
...
@@ -22,18 +22,18 @@
DiscussionSpecHelper
.
getTestRoleInfo
=
function
()
{
DiscussionSpecHelper
.
getTestRoleInfo
=
function
()
{
return
{
return
{
'Moderator'
:
[],
Moderator
:
[],
'Administrator'
:
[],
Administrator
:
[],
'Community TA'
:
[]
'Community TA'
:
[]
};
};
};
};
DiscussionSpecHelper
.
makeTA
=
function
()
{
DiscussionSpecHelper
.
makeTA
=
function
()
{
return
DiscussionUtil
.
roleIds
[
'Community TA'
].
push
(
parseInt
(
DiscussionUtil
.
getUser
().
id
));
return
DiscussionUtil
.
roleIds
[
'Community TA'
].
push
(
parseInt
(
DiscussionUtil
.
getUser
().
id
,
10
));
};
};
DiscussionSpecHelper
.
makeModerator
=
function
()
{
DiscussionSpecHelper
.
makeModerator
=
function
()
{
return
DiscussionUtil
.
roleIds
.
Moderator
.
push
(
parseInt
(
DiscussionUtil
.
getUser
().
id
));
return
DiscussionUtil
.
roleIds
.
Moderator
.
push
(
parseInt
(
DiscussionUtil
.
getUser
().
id
,
10
));
};
};
DiscussionSpecHelper
.
makeAjaxSpy
=
function
(
fakeAjax
)
{
DiscussionSpecHelper
.
makeAjaxSpy
=
function
(
fakeAjax
)
{
...
@@ -50,25 +50,22 @@
...
@@ -50,25 +50,22 @@
return
jasmine
.
createSpyObj
(
'event'
,
[
'preventDefault'
,
'target'
]);
return
jasmine
.
createSpyObj
(
'event'
,
[
'preventDefault'
,
'target'
]);
};
};
DiscussionSpecHelper
.
makeCourseSettings
=
function
(
isCohorted
)
{
DiscussionSpecHelper
.
makeCourseSettings
=
function
()
{
if
(
typeof
isCohorted
===
'undefined'
||
isCohorted
===
null
)
{
isCohorted
=
true
;
}
return
new
DiscussionCourseSettings
({
return
new
DiscussionCourseSettings
({
category_map
:
{
category_map
:
{
children
:
[
'Test Topic'
,
'Other Topic'
],
children
:
[
'Test Topic'
,
'Other Topic'
],
entries
:
{
entries
:
{
'Test Topic'
:
{
'Test Topic'
:
{
is_cohorted
:
isCohorted
,
is_cohorted
:
true
,
id
:
'test_topic'
id
:
'test_topic'
},
},
'Other Topic'
:
{
'Other Topic'
:
{
is_cohorted
:
isCohorted
,
is_cohorted
:
true
,
id
:
'other_topic'
id
:
'other_topic'
}
}
}
}
},
},
is_cohorted
:
isCohorted
is_cohorted
:
true
});
});
};
};
...
@@ -106,7 +103,7 @@
...
@@ -106,7 +103,7 @@
// suppressing Line is too long (4272 characters!)
// suppressing Line is too long (4272 characters!)
/* jshint -W101 */
/* jshint -W101 */
appendSetFixtures
(
appendSetFixtures
(
"<script type=
\
'text/template
\
' id=
\
'thread-list-template
\
'>
\
n <div class=
\
'forum-nav-header
\
'>
\
n <button type=
\
'button
\
' class=
\
'forum-nav-browse
\
' id=
\
'forum-nav-browse
\
' aria-haspopup=
\
'true
\
'>
\
n <span class=
\
'icon fa fa-bars
\
' aria-hidden=
\
'true
\
'></span>
\
n <span class=
\
'sr
\
'>Discussion topics; currently listing: </span>
\
n <span class=
\
'forum-nav-browse-current
\
'>All Discussions</span>
\
n ▾
\
n </button>
\
n <form class=
\
'forum-nav-search
\
'>
\
n <label>
\
n <span class=
\
'sr
\
'>Search all posts</span>
\
n <input class=
\
'forum-nav-search-input
\
' id=
\
'forum-nav-search
\
' type=
\
'text
\
' placeholder=
\
'Search all posts
\
'>
\
n <span class=
\
'icon fa fa-search
\
' aria-hidden=
\
'true
\
'></span>
\
n </label>
\
n </form>
\
n </div>
\
n <div class=
\
'forum-nav-browse-menu-wrapper
\
' style=
\
'display: none
\
'>
\
n <form class=
\
'forum-nav-browse-filter
\
'>
\
n <label>
\
n <span class=
\
'sr
\
'>Filter Topics</span>
\
n <input type=
\
'text
\
' class=
\
'forum-nav-browse-filter-input
\
' placeholder=
\
'filter topics
\
'>
\
n </label>
\
n </form>
\
n <ul class=
\
'forum-nav-browse-menu
\
'>
\
n <li class=
\
'forum-nav-browse-menu-item forum-nav-browse-menu-all
\
'>
\
n <a href=
\
'#
\
' class=
\
'forum-nav-browse-title
\
'>All Discussions</a>
\
n </li>
\
n <li class=
\
'forum-nav-browse-menu-item forum-nav-browse-menu-following
\
'>
\
n <a href=
\
'#
\
' class=
\
'forum-nav-browse-title
\
'><span class=
\
'icon fa fa-star
\
' aria-hidden=
\
'true
\
'></span>Posts I'm Following</a>
\
n </li>
\
n <li class=
\
'forum-nav-browse-menu-item
\
'>
\
n <a href=
\
'#
\
' class=
\
'forum-nav-browse-title
\
'>Parent</a>
\
n <ul class=
\
'forum-nav-browse-submenu
\
'>
\
n <li class=
\
'forum-nav-browse-menu-item
\
'>
\
n <a href=
\
'#
\
' class=
\
'forum-nav-browse-title
\
'>Target</a>
\
n <ul class=
\
'forum-nav-browse-submenu
\
'>
\
n <li
\
n class=
\
'forum-nav-browse-menu-item
\
'
\
n data-discussion-id=
\
'child
\
'
\
n data-cohorted=
\
'false
\
'
\
n >
\
n <a href=
\
'#
\
' class=
\
'forum-nav-browse-title
\
'>Child</a>
\
n </li>
\
n </ul>
\
n <li
\
n class=
\
'forum-nav-browse-menu-item
\
'
\
n data-discussion-id=
\
'sibling
\
'
\
n data-cohorted=
\
'false
\
'
\
n >
\
n <a href=
\
'#
\
' class=
\
'forum-nav-browse-title
\
'>Sibling</a>
\
n </li>
\
n </ul>
\
n </li>
\
n <li
\
n class=
\
'forum-nav-browse-menu-item
\
'
\
n data-discussion-id=
\
'other
\
'
\
n data-cohorted=
\
'true
\
'
\
n >
\
n <a href=
\
'#
\
' class=
\
'forum-nav-browse-title
\
'>Other Category</a>
\
n </li>
\
n </ul>
\
n </div>
\
n <div class=
\
'forum-nav-thread-list-wrapper
\
' id=
\
'sort-filter-wrapper
\
' tabindex=
\
'-1
\
'>
\
n <div class=
\
'forum-nav-refine-bar
\
'>
\
n <label class=
\
'forum-nav-filter-main
\
'>
\
n <select class=
\
'forum-nav-filter-main-control
\
'>
\
n <option value=
\
'all
\
'>Show all</option>
\
n <option value=
\
'unread
\
'>Unread</option>
\
n <option value=
\
'unanswered
\
'>Unanswered</option>
\
n <option value=
\
'flagged
\
'>Flagged</option>
\
n </select>
\
n </label>
\
n <% if (isCohorted && isPrivilegedUser) { %>
\
n <label class=
\
'forum-nav-filter-cohort
\
'>
\
n <span class=
\
'sr
\
'>Cohort:</span>
\
n <select class=
\
'forum-nav-filter-cohort-control
\
'>
\
n <option value=
\
'
\
'>in all cohorts</option>
\
n <option value=
\
'1
\
'>Cohort1</option>
\
n <option value=
\
'2
\
'>Cohort2</option>
\
n </select>
\
n </label>
\
n <% } %>
\
n <label class=
\
'forum-nav-sort
\
'>
\
n <select class=
\
'forum-nav-sort-control
\
'>
\
n <option value=
\
'activity
\
'>by recent activity</option>
\
n <option value=
\
'comments
\
'>by most activity</option>
\
n <option value=
\
'votes
\
'>by most votes</option>
\
n </select>
\
n </label>
\
n </div>
\
n </div>
\
n <div class=
\
'search-alerts
\
'></div>
\
n <ul class=
\
'forum-nav-thread-list
\
'></ul>
\
n</script>"
);
"<script type=
\
'text/template
\
' id=
\
'thread-list-template
\
'>
\
n <div class=
\
'forum-nav-header
\
'>
\
n <button type=
\
'button
\
' class=
\
'forum-nav-browse
\
' id=
\
'forum-nav-browse
\
' aria-haspopup=
\
'true
\
'>
\
n <span class=
\
'icon fa fa-bars
\
' aria-hidden=
\
'true
\
'></span>
\
n <span class=
\
'sr
\
'>Discussion topics; currently listing: </span>
\
n <span class=
\
'forum-nav-browse-current
\
'>All Discussions</span>
\
n ▾
\
n </button>
\
n <form class=
\
'forum-nav-search
\
'>
\
n <label>
\
n <span class=
\
'sr
\
'>Search all posts</span>
\
n <input class=
\
'forum-nav-search-input
\
' id=
\
'forum-nav-search
\
' type=
\
'text
\
' placeholder=
\
'Search all posts
\
'>
\
n <span class=
\
'icon fa fa-search
\
' aria-hidden=
\
'true
\
'></span>
\
n </label>
\
n </form>
\
n </div>
\
n <div class=
\
'forum-nav-browse-menu-wrapper
\
' style=
\
'display: none
\
'>
\
n <form class=
\
'forum-nav-browse-filter
\
'>
\
n <label>
\
n <span class=
\
'sr
\
'>Filter Topics</span>
\
n <input type=
\
'text
\
' class=
\
'forum-nav-browse-filter-input
\
' placeholder=
\
'filter topics
\
'>
\
n </label>
\
n </form>
\
n <ul class=
\
'forum-nav-browse-menu
\
'>
\
n <li class=
\
'forum-nav-browse-menu-item forum-nav-browse-menu-all
\
'>
\
n <a href=
\
'#
\
' class=
\
'forum-nav-browse-title
\
'>All Discussions</a>
\
n </li>
\
n <li class=
\
'forum-nav-browse-menu-item forum-nav-browse-menu-following
\
'>
\
n <a href=
\
'#
\
' class=
\
'forum-nav-browse-title
\
'><span class=
\
'icon fa fa-star
\
' aria-hidden=
\
'true
\
'></span>Posts I'm Following</a>
\
n </li>
\
n <li class=
\
'forum-nav-browse-menu-item
\
'>
\
n <a href=
\
'#
\
' class=
\
'forum-nav-browse-title
\
'>Parent</a>
\
n <ul class=
\
'forum-nav-browse-submenu
\
'>
\
n <li class=
\
'forum-nav-browse-menu-item
\
'>
\
n <a href=
\
'#
\
' class=
\
'forum-nav-browse-title
\
'>Target</a>
\
n <ul class=
\
'forum-nav-browse-submenu
\
'>
\
n <li
\
n class=
\
'forum-nav-browse-menu-item
\
'
\
n data-discussion-id=
\
'child
\
'
\
n data-cohorted=
\
'false
\
'
\
n >
\
n <a href=
\
'#
\
' class=
\
'forum-nav-browse-title
\
'>Child</a>
\
n </li>
\
n </ul>
\
n <li
\
n class=
\
'forum-nav-browse-menu-item
\
'
\
n data-discussion-id=
\
'sibling
\
'
\
n data-cohorted=
\
'false
\
'
\
n >
\
n <a href=
\
'#
\
' class=
\
'forum-nav-browse-title
\
'>Sibling</a>
\
n </li>
\
n </ul>
\
n </li>
\
n <li
\
n class=
\
'forum-nav-browse-menu-item
\
'
\
n data-discussion-id=
\
'other
\
'
\
n data-cohorted=
\
'true
\
'
\
n >
\
n <a href=
\
'#
\
' class=
\
'forum-nav-browse-title
\
'>Other Category</a>
\
n </li>
\
n </ul>
\
n </div>
\
n <div class=
\
'forum-nav-thread-list-wrapper
\
' id=
\
'sort-filter-wrapper
\
' tabindex=
\
'-1
\
'>
\
n <div class=
\
'forum-nav-refine-bar
\
'>
\
n <label class=
\
'forum-nav-filter-main
\
'>
\
n <select class=
\
'forum-nav-filter-main-control
\
'>
\
n <option value=
\
'all
\
'>Show all</option>
\
n <option value=
\
'unread
\
'>Unread</option>
\
n <option value=
\
'unanswered
\
'>Unanswered</option>
\
n <option value=
\
'flagged
\
'>Flagged</option>
\
n </select>
\
n </label>
\
n <% if (isCohorted && isPrivilegedUser) { %>
\
n <label class=
\
'forum-nav-filter-cohort
\
'>
\
n <span class=
\
'sr
\
'>Cohort:</span>
\
n <select class=
\
'forum-nav-filter-cohort-control
\
'>
\
n <option value=
\
'
\
'>in all cohorts</option>
\
n <option value=
\
'1
\
'>Cohort1</option>
\
n <option value=
\
'2
\
'>Cohort2</option>
\
n </select>
\
n </label>
\
n <% } %>
\
n <label class=
\
'forum-nav-sort
\
'>
\
n <select class=
\
'forum-nav-sort-control
\
'>
\
n <option value=
\
'activity
\
'>by recent activity</option>
\
n <option value=
\
'comments
\
'>by most activity</option>
\
n <option value=
\
'votes
\
'>by most votes</option>
\
n </select>
\
n </label>
\
n </div>
\
n </div>
\
n <div class=
\
'search-alerts
\
'></div>
\
n <ul class=
\
'forum-nav-thread-list
\
'></ul>
\
n</script>"
);
// eslint-disable-line max-len, no-useless-escape
appendSetFixtures
(
appendSetFixtures
(
'<div id=
\'
fixture-element
\'
></div>
\
n'
+
'<div id=
\'
fixture-element
\'
></div>
\
n'
+
...
...
lms/djangoapps/discussion/static/discussion/js/discussion_board_factory.js
View file @
4c4476a7
...
@@ -55,7 +55,7 @@
...
@@ -55,7 +55,7 @@
BreadcrumbsModel
=
Backbone
.
Model
.
extend
({
BreadcrumbsModel
=
Backbone
.
Model
.
extend
({
defaults
:
{
defaults
:
{
contents
:
[]
,
contents
:
[]
}
}
});
});
...
...
lms/djangoapps/discussion/static/discussion/js/discussion_profile_page_factory.js
View file @
4c4476a7
...
@@ -11,14 +11,13 @@
...
@@ -11,14 +11,13 @@
numPages
=
options
.
numPages
;
numPages
=
options
.
numPages
;
// Roles are not included in user profile page, but they are not used for anything
// Roles are not included in user profile page, but they are not used for anything
window
.
DiscussionUtil
.
loadRoles
({
window
.
DiscussionUtil
.
loadRoles
({
'Moderator'
:
[],
Moderator
:
[],
'Administrator'
:
[],
Administrator
:
[],
'Community TA'
:
[]
'Community TA'
:
[]
});
});
window
.
$$course_id
=
options
.
courseId
;
window
.
$$course_id
=
options
.
courseId
;
window
.
user
=
new
window
.
DiscussionUser
(
userInfo
);
window
.
user
=
new
window
.
DiscussionUser
(
userInfo
);
// jshint nonew:false
new
DiscussionUserProfileView
({
// eslint-disable-line no-new
new
DiscussionUserProfileView
({
el
:
$element
,
el
:
$element
,
collection
:
threads
,
collection
:
threads
,
page
:
page
,
page
:
page
,
...
...
lms/djangoapps/discussion/static/discussion/js/spec/views/discussion_user_profile_view_spec.js
View file @
4c4476a7
...
@@ -62,15 +62,7 @@ define(
...
@@ -62,15 +62,7 @@ define(
});
});
describe
(
'pagination rendering should be correct'
,
function
()
{
describe
(
'pagination rendering should be correct'
,
function
()
{
var
baseUri
,
checkRender
,
pageInfo
;
var
checkRender
=
function
(
params
)
{
baseUri
=
URI
(
window
.
location
);
pageInfo
=
function
(
page
)
{
return
{
url
:
baseUri
.
clone
().
addSearch
(
'page'
,
page
).
toString
(),
number
:
page
};
};
checkRender
=
function
(
params
)
{
var
getPageNumber
,
paginator
,
view
;
var
getPageNumber
,
paginator
,
view
;
view
=
makeView
([],
params
.
page
,
params
.
numPages
);
view
=
makeView
([],
params
.
page
,
params
.
numPages
);
paginator
=
view
.
$
(
'.discussion-paginator'
);
paginator
=
view
.
$
(
'.discussion-paginator'
);
...
...
lms/djangoapps/discussion/static/discussion/js/views/discussion_fake_breadcrumbs.js
View file @
4c4476a7
...
@@ -12,7 +12,7 @@
...
@@ -12,7 +12,7 @@
define
([
define
([
'backbone'
,
'backbone'
,
'edx-ui-toolkit/js/utils/html-utils'
,
'edx-ui-toolkit/js/utils/html-utils'
,
'text!discussion/templates/fake-breadcrumbs.underscore'
,
'text!discussion/templates/fake-breadcrumbs.underscore'
],
],
function
(
Backbone
,
HtmlUtils
,
breadcrumbsTemplate
)
{
function
(
Backbone
,
HtmlUtils
,
breadcrumbsTemplate
)
{
var
DiscussionFakeBreadcrumbs
=
Backbone
.
View
.
extend
({
var
DiscussionFakeBreadcrumbs
=
Backbone
.
View
.
extend
({
...
...
lms/static/js/spec/courseware/link_clicked_events_spec.js
View file @
4c4476a7
...
@@ -12,7 +12,7 @@ define(['jquery', 'logger', 'js/courseware/courseware_factory'], function($, Log
...
@@ -12,7 +12,7 @@ define(['jquery', 'logger', 'js/courseware/courseware_factory'], function($, Log
$
(
'.external-link'
).
click
();
$
(
'.external-link'
).
click
();
expect
(
Logger
.
log
).
toHaveBeenCalledWith
(
'edx.ui.lms.link_clicked'
,
{
expect
(
Logger
.
log
).
toHaveBeenCalledWith
(
'edx.ui.lms.link_clicked'
,
{
target_url
:
'http://example.com/'
,
target_url
:
'http://example.com/'
,
current_url
:
'http://'
+
window
.
location
.
host
+
'/context.html'
current_url
:
window
.
location
.
toString
()
});
});
});
});
...
...
lms/static/lms/js/spec/main.js
View file @
4c4476a7
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
paths
:
{
paths
:
{
'gettext'
:
'xmodule_js/common_static/js/test/i18n'
,
'gettext'
:
'xmodule_js/common_static/js/test/i18n'
,
'codemirror'
:
'xmodule_js/common_static/js/vendor/CodeMirror/codemirror'
,
'codemirror'
:
'xmodule_js/common_static/js/vendor/CodeMirror/codemirror'
,
'jquery'
:
'common/js/vendor/jquery'
,
jquery
:
'common/js/vendor/jquery'
,
'jquery-migrate'
:
'common/js/vendor/jquery-migrate'
,
'jquery-migrate'
:
'common/js/vendor/jquery-migrate'
,
'jquery.ui'
:
'xmodule_js/common_static/js/vendor/jquery-ui.min'
,
'jquery.ui'
:
'xmodule_js/common_static/js/vendor/jquery-ui.min'
,
'jquery.eventDrag'
:
'xmodule_js/common_static/js/vendor/jquery.event.drag-2.2'
,
'jquery.eventDrag'
:
'xmodule_js/common_static/js/vendor/jquery.event.drag-2.2'
,
...
...
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