Enable editing for inline threads.
Currently there's a bug where editing more than once without reloading the page causes it to successively get more and more broken.
This commit is contained in:
@@ -6,6 +6,9 @@ if Backbone?
|
||||
"click .expand-post": "expandPost"
|
||||
"click .collapse-post": "collapsePost"
|
||||
|
||||
initialize: ->
|
||||
super()
|
||||
|
||||
initLocal: ->
|
||||
@$local = @$el.children(".discussion-article").children(".local")
|
||||
if not @$local.length
|
||||
@@ -25,7 +28,7 @@ if Backbone?
|
||||
@delegateEvents()
|
||||
@renderShowView()
|
||||
@renderAttrs()
|
||||
#@renderTags() #TODO: Decide if we want tags on inline threads
|
||||
@renderTags() #TODO: Decide if we want to show tags on inline threads
|
||||
@$("span.timeago").timeago()
|
||||
@$el.find('.post-extended-content').hide()
|
||||
if @expanded
|
||||
@@ -50,7 +53,6 @@ if Backbone?
|
||||
@trigger "thread:responses:rendered"
|
||||
@$('.loading').remove()
|
||||
|
||||
edit: ->
|
||||
|
||||
toggleClosed: (event) ->
|
||||
#TODO: showview
|
||||
@@ -85,7 +87,7 @@ if Backbone?
|
||||
abbreviated = DiscussionUtil.abbreviateString @model.get('body'), 140
|
||||
@model.set('abbreviatedBody', abbreviated)
|
||||
|
||||
expandPost: (event) ->
|
||||
expandPost: (event) =>
|
||||
@expanded = true
|
||||
@$el.addClass('expanded')
|
||||
@$el.find('.post-body').html(@model.get('body'))
|
||||
@@ -105,3 +107,7 @@ if Backbone?
|
||||
@$el.find('.collapse-post').css('display', 'none')
|
||||
@$el.find('.post-extended-content').hide()
|
||||
@$el.find('.expand-post').css('display', 'block')
|
||||
|
||||
createEditView: () ->
|
||||
super()
|
||||
@editView.bind "thread:update", @expandPost
|
||||
|
||||
@@ -2214,8 +2214,77 @@ body.discussion {
|
||||
.wmd-spacer3 {
|
||||
left: 300px;
|
||||
}
|
||||
.edit-post-form {
|
||||
width: 100%;
|
||||
margin-bottom: 20px;
|
||||
@include clearfix;
|
||||
@include box-sizing(border-box);
|
||||
|
||||
.form-row {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.post-cancel {
|
||||
@include white-button;
|
||||
float: left;
|
||||
margin: 10px 0 0 15px;
|
||||
}
|
||||
|
||||
.post-update {
|
||||
@include blue-button;
|
||||
float: left;
|
||||
height: 37px;
|
||||
margin-top: 10px;
|
||||
padding-bottom: 2px;
|
||||
|
||||
&:hover {
|
||||
border-color: #222;
|
||||
}
|
||||
}
|
||||
|
||||
.edit-post-title, .edit-post-tags {
|
||||
width: 100%;
|
||||
height: 40px;
|
||||
padding: 0 10px;
|
||||
box-sizing: border-box;
|
||||
border-radius: 3px;
|
||||
border: 1px solid #aaa;
|
||||
font-size: 16px;
|
||||
font-family: $sans-serif;
|
||||
color: #333;
|
||||
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15) inset;
|
||||
}
|
||||
|
||||
.tagsinput {
|
||||
padding: 10px;
|
||||
@include box-sizing(border-box);
|
||||
border: 1px solid #aaa;
|
||||
border-radius: 3px;
|
||||
background: #fff;
|
||||
font-family: 'Monaco', monospace;
|
||||
font-size: 13px;
|
||||
line-height: 1.6;
|
||||
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3) inset;
|
||||
|
||||
span.tag {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
.thread-tags {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.thread-tag {
|
||||
padding: 3px 10px 6px;
|
||||
border-radius: 3px;
|
||||
color: #333;
|
||||
background: #c5eeff;
|
||||
border: 1px solid #90c4d7;
|
||||
font-size: 13px;
|
||||
}
|
||||
}
|
||||
|
||||
.discussion-user-threads {
|
||||
@extend .discussion-module
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user