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
91379aa9
Commit
91379aa9
authored
Sep 04, 2012
by
Arjun Singh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improve date search, fix respnding, make sidebar expand when discussion column does
parent
9064f81b
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
19 additions
and
5 deletions
+19
-5
lms/static/coffee/src/discussion/content.coffee
+0
-1
lms/static/coffee/src/discussion/discussion.coffee
+8
-1
lms/static/coffee/src/discussion/main.coffee
+1
-0
lms/static/coffee/src/discussion/views/discussion_thread_list_view.coffee
+1
-1
lms/static/coffee/src/discussion/views/discussion_thread_view.coffee
+1
-1
lms/static/coffee/src/discussion/views/thread_response_view.coffee
+3
-1
lms/static/js/discussions-temp.js
+5
-0
No files found.
lms/static/coffee/src/discussion/content.coffee
View file @
91379aa9
...
...
@@ -24,7 +24,6 @@ if Backbone?
updateInfo
:
(
info
)
->
if
info
console
.
log
info
.
ability
@
set
(
'ability'
,
info
.
ability
)
@
set
(
'voted'
,
info
.
voted
)
@
set
(
'subscribed'
,
info
.
subscribed
)
...
...
lms/static/coffee/src/discussion/discussion.coffee
View file @
91379aa9
...
...
@@ -5,7 +5,7 @@ if Backbone?
initialize
:
->
@
bind
"add"
,
(
item
)
=>
item
.
discussion
=
@
@
comparator
=
@
sortByDate
@
comparator
=
@
sortByDate
RecentFirst
find
:
(
id
)
->
_
.
first
@
where
(
id
:
id
)
...
...
@@ -19,6 +19,13 @@ if Backbone?
sortByDate
:
(
thread
)
->
thread
.
get
(
"created_at"
)
sortByDateRecentFirst
:
(
thread
)
->
-
(
new
Date
(
thread
.
get
(
"created_at"
)).
getTime
())
#return String.fromCharCode.apply(String,
# _.map(thread.get("created_at").split(""),
# ((c) -> return 0xffff - c.charChodeAt()))
#)
sortByVotes
:
(
thread1
,
thread2
)
->
thread1_count
=
parseInt
(
thread1
.
get
(
"votes"
)[
'up_count'
])
thread2_count
=
parseInt
(
thread2
.
get
(
"votes"
)[
'up_count'
])
...
...
lms/static/coffee/src/discussion/main.coffee
View file @
91379aa9
...
...
@@ -8,6 +8,7 @@ DiscussionApp =
threads
=
element
.
data
(
"threads"
)
content_info
=
element
.
data
(
"content-info"
)
window
.
user
=
new
DiscussionUser
(
user_info
)
console
.
log
content_info
Content
.
loadContentInfos
(
content_info
)
discussion
=
new
Discussion
(
threads
)
new
DiscussionRouter
({
discussion
:
discussion
})
...
...
lms/static/coffee/src/discussion/views/discussion_thread_list_view.coffee
View file @
91379aa9
...
...
@@ -89,7 +89,7 @@ class @DiscussionThreadListView extends Backbone.View
$
(
event
.
target
).
addClass
(
"active"
)
sortBy
=
$
(
event
.
target
).
data
(
"sort"
)
if
sortBy
==
"date"
@
displayedCollection
.
comparator
=
@
displayedCollection
.
sortByDate
@
displayedCollection
.
comparator
=
@
displayedCollection
.
sortByDate
RecentFirst
else
if
sortBy
==
"votes"
@
displayedCollection
.
comparator
=
@
displayedCollection
.
sortByVotes
else
if
sortBy
==
"comments"
...
...
lms/static/coffee/src/discussion/views/discussion_thread_view.coffee
View file @
91379aa9
...
...
@@ -111,7 +111,7 @@ class @DiscussionThreadView extends DiscussionContentView
event
.
preventDefault
()
url
=
@
model
.
urlFor
(
'reply'
)
body
=
@
$
(
"#wmd-input"
).
val
()
response
=
new
Comment
(
body
:
body
,
created_at
:
(
new
Date
()).
toISOString
(),
username
:
window
.
user
.
get
(
"username"
),
votes
:
{
up_count
:
0
})
response
=
new
Comment
(
body
:
body
,
created_at
:
(
new
Date
()).
toISOString
(),
username
:
window
.
user
.
get
(
"username"
),
votes
:
{
up_count
:
0
}
,
endorsed
:
false
,
user_id
:
window
.
user
.
get
(
"id"
)
)
@
renderResponse
(
response
)
@
addComment
()
...
...
lms/static/coffee/src/discussion/views/thread_response_view.coffee
View file @
91379aa9
...
...
@@ -8,6 +8,8 @@ class @ThreadResponseView extends DiscussionContentView
"click .action-endorse"
:
"toggleEndorse"
render
:
->
console
.
log
@
model
console
.
log
@
model
.
toJSON
()
@
$el
.
html
(
@
template
(
@
model
.
toJSON
()))
if
window
.
user
.
voted
(
@
model
)
@
$
(
".vote-btn"
).
addClass
(
"is-cast"
)
...
...
@@ -65,7 +67,7 @@ class @ThreadResponseView extends DiscussionContentView
body
=
@
$
(
".comment-form-input"
).
val
()
if
not
body
.
trim
().
length
return
comment
=
new
Comment
(
body
:
body
,
created_at
:
(
new
Date
()).
toISOString
(),
username
:
window
.
user
.
get
(
"username"
))
comment
=
new
Comment
(
body
:
body
,
created_at
:
(
new
Date
()).
toISOString
(),
username
:
window
.
user
.
get
(
"username"
)
,
user_id
:
window
.
user
.
get
(
"id"
)
)
@
renderComment
(
comment
)
@
trigger
"comment:add"
@
$
(
".comment-form-input"
).
val
(
""
)
...
...
lms/static/js/discussions-temp.js
View file @
91379aa9
...
...
@@ -68,6 +68,11 @@ $(document).ready(function() {
$
(
window
).
bind
(
'resize'
,
updateSidebarDimensions
);
$
(
window
).
bind
(
'scroll'
,
updateSidebarCoordinates
);
$
(
'.discussion-column'
).
bind
(
"input"
,
function
(
e
)
{
console
.
log
(
"resized"
);
updateSidebarCoordinates
();
updateSidebarDimensions
();
})
updateSidebarCoordinates
();
updateSidebarDimensions
();
});
...
...
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