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
bfc475bd
Commit
bfc475bd
authored
Oct 10, 2014
by
jsa
Committed by
Zia Fazal
Apr 07, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add topic selection to inline thread editing, fixing errors
Co-Authored-By: Brian Talbot <btalbot@edx.org> TNL-549
parent
4c1679ac
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
27 deletions
+42
-27
common/static/coffee/spec/discussion/discussion_spec_helper.coffee
+0
-7
common/static/coffee/spec/discussion/view/discussion_thread_edit_view_spec.js
+41
-19
lms/djangoapps/django_comment_client/forum/views.py
+1
-1
No files found.
common/static/coffee/spec/discussion/discussion_spec_helper.coffee
View file @
bfc475bd
...
@@ -38,13 +38,6 @@ class @DiscussionSpecHelper
...
@@ -38,13 +38,6 @@ class @DiscussionSpecHelper
is_cohorted
:
is_cohorted
is_cohorted
:
is_cohorted
)
)
@
makeAjaxSpy
=
(
fakeAjax
)
->
spyOn
(
$
,
"ajax"
).
andCallFake
(
(
params
)
->
fakeAjax
(
params
)
{
always
:
->
}
)
@
setUnderscoreFixtures
=
->
@
setUnderscoreFixtures
=
->
for
templateName
in
[
'thread-show'
]
for
templateName
in
[
'thread-show'
]
templateFixture
=
readFixtures
(
'templates/discussion/'
+
templateName
+
'.underscore'
)
templateFixture
=
readFixtures
(
'templates/discussion/'
+
templateName
+
'.underscore'
)
...
...
common/static/coffee/spec/discussion/view/discussion_thread_edit_view_spec.js
View file @
bfc475bd
...
@@ -113,36 +113,58 @@
...
@@ -113,36 +113,58 @@
});
});
});
});
it
(
'can save new data correctly'
,
function
()
{
testUpdate
=
function
(
view
,
thread
)
{
var
view
;
spyOn
(
$
,
'ajax'
).
andCallFake
(
function
(
params
)
{
spyOn
(
$
,
'ajax'
).
andCallFake
(
function
(
params
)
{
expect
(
params
.
url
.
path
()).
toEqual
(
DiscussionUtil
.
urlFor
(
'update_thread'
,
'dummy_id'
));
expect
(
params
.
url
.
path
()).
toEqual
(
DiscussionUtil
.
urlFor
(
'update_thread'
,
'dummy_id'
));
expect
(
params
.
data
.
thread_type
).
toBe
(
'discussion'
);
if
(
view
.
isTabMode
())
{
expect
(
params
.
data
.
commentable_id
).
toBe
(
'topic'
);
// TODO remove the tabMode condition, depends on #5554 / TNL-606
expect
(
params
.
data
.
title
).
toBe
(
'new_title'
);
expect
(
params
.
data
.
thread_type
).
toBe
(
'discussion'
);
}
expect
(
params
.
data
.
commentable_id
).
toBe
(
'other_topic'
);
expect
(
params
.
data
.
title
).
toBe
(
'changed thread title'
);
params
.
success
();
params
.
success
();
return
{
always
:
function
()
{}};
return
{
always
:
function
()
{}};
});
});
this
.
createEditView
();
view
.
$el
.
find
(
'a.topic-title'
)[
1
].
click
();
// set new topic
this
.
view
.
$el
.
find
(
'a.topic-title'
).
first
().
click
();
// set new topic
view
.
$
(
'.edit-post-title'
).
val
(
'changed thread title'
);
// set new title
this
.
view
.
$
(
'.edit-post-title'
).
val
(
'new_title'
);
// set new title
view
.
$
(
"label[for$='post-type-discussion']"
).
click
();
// set new thread type
this
.
view
.
$
(
"label[for$='post-type-discussion']"
).
click
();
// set new thread type
view
.
$
(
'.post-update'
).
click
();
this
.
view
.
$
(
'.post-update'
).
click
();
expect
(
$
.
ajax
).
toHaveBeenCalled
();
expect
(
$
.
ajax
).
toHaveBeenCalled
();
expect
(
this
.
thread
.
get
(
'title'
)).
toBe
(
'new_title'
);
expect
(
thread
.
get
(
'title'
)).
toBe
(
'changed thread title'
);
expect
(
this
.
thread
.
get
(
'commentable_id'
)).
toBe
(
'topic'
);
if
(
view
.
isTabMode
())
{
expect
(
this
.
thread
.
get
(
'thread_type'
)).
toBe
(
'discussion'
);
// TODO remove the tabMode condition, depends on #5554 / TNL-606
expect
(
this
.
thread
.
get
(
'courseware_title'
)).
toBe
(
'Topic'
);
expect
(
thread
.
get
(
'thread_type'
)).
toBe
(
'discussion'
);
}
expect
(
thread
.
get
(
'commentable_id'
)).
toBe
(
'other_topic'
);
expect
(
thread
.
get
(
'courseware_title'
)).
toBe
(
'Other Topic'
);
expect
(
view
.
$
(
'.edit-post-title'
)).
toHaveValue
(
''
);
expect
(
view
.
$
(
'.wmd-preview p'
)).
toHaveText
(
''
);
}
expect
(
this
.
view
.
$
(
'.edit-post-title'
)).
toHaveValue
(
''
);
it
(
'can save new data correctly in tab mode'
,
function
()
{
expect
(
this
.
view
.
$
(
'.wmd-preview p'
)).
toHaveText
(
''
);
this
.
createEditView
();
testUpdate
(
this
.
view
,
this
.
thread
);
});
});
it
(
'can close the view'
,
function
()
{
it
(
'can save new data correctly in inline mode'
,
function
()
{
this
.
createEditView
();
this
.
createEditView
({
"mode"
:
"inline"
});
this
.
view
.
$
(
'.post-cancel'
).
click
();
testUpdate
(
this
.
view
,
this
.
thread
);
});
testCancel
=
function
(
view
)
{
view
.
$
(
'.post-cancel'
).
click
();
expect
(
$
(
'.edit-post-form'
)).
not
.
toExist
();
expect
(
$
(
'.edit-post-form'
)).
not
.
toExist
();
}
it
(
'can close the view in tab mode'
,
function
()
{
this
.
createEditView
();
testCancel
(
this
.
view
);
});
it
(
'can close the view in inline mode'
,
function
()
{
this
.
createEditView
({
"mode"
:
"inline"
});
testCancel
(
this
.
view
);
});
});
});
});
}).
call
(
this
);
}).
call
(
this
);
lms/djangoapps/django_comment_client/forum/views.py
View file @
bfc475bd
...
@@ -265,7 +265,7 @@ def single_thread(request, course_id, discussion_id, thread_id):
...
@@ -265,7 +265,7 @@ def single_thread(request, course_id, discussion_id, thread_id):
nr_transaction
=
newrelic
.
agent
.
current_transaction
()
nr_transaction
=
newrelic
.
agent
.
current_transaction
()
course
=
get_course_with_access
(
request
.
user
,
'load_forum'
,
course_key
)
course
=
get_course_with_access
(
request
.
user
,
'load_forum'
,
course_key
)
course_settings
=
make_course_settings
(
course
,
include_category_map
=
True
)
course_settings
=
make_course_settings
(
course
)
cc_user
=
cc
.
User
.
from_django_user
(
request
.
user
)
cc_user
=
cc
.
User
.
from_django_user
(
request
.
user
)
user_info
=
cc_user
.
to_dict
()
user_info
=
cc_user
.
to_dict
()
is_moderator
=
cached_has_permission
(
request
.
user
,
"see_all_cohorts"
,
course_key
)
is_moderator
=
cached_has_permission
(
request
.
user
,
"see_all_cohorts"
,
course_key
)
...
...
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