Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: instructure/canvas-lms
base: stable
...
head fork: ryanflorence/canvas-lms
Checking mergeability… Don't worry, you can still create the pull request.
  • 3 commits
  • 9 files changed
  • 0 commit comments
  • 2 contributors
Commits on Mar 28, 2012
@ryankshaw ryankshaw better cancel button, deleted display, wording
Change-Id: I4e22133dcfc4d685e4c8c992765a2ce274429f8b
8b26d6a
@ryanflorence ryanflorence side comments text, reply to topic, deleted replies
- the button to add a reply to the topic is now a
  link so it doesn't conflict visually with other
  buttons

- text in the "write a reply…" is now "add a side
  comment…" for side_comment discussions

- replies to deleted entries in side_comment
  discussions should display

- form should not display for deleted entries

Change-Id: Ibe9a8edb353911c73dc8eab5818f36d38c4d6bf9
b819325
@ryanflorence ryanflorence collapse deleted entries with children
and some better styling

Change-Id: I35417a543c5fe6ea4be76300bb0b27e1c2da9ce4
a843e21
View
16 app/coffeescripts/discussions/Entry.coffee
@@ -50,6 +50,7 @@ define [
'editor'
'canModerate'
'allowsSideComments'
+ 'hideRepliesOnCollapse'
{ name: 'canReply', deps: ['parent_id'] }
{ name: 'summary', deps: ['message'] }
]
@@ -126,9 +127,20 @@ define [
##
# Shows the reply form at the bottom of all side comments
allowsSideComments: ->
- !ENV.DISCUSSION.THREADED and
+ deleted = @get 'deleted'
+ not ENV.DISCUSSION.THREADED and
ENV.DISCUSSION.PERMISSIONS.CAN_REPLY and
- @get('parent_id') is null # root entry
+ @get('parent_id') is null and # root entry
+ not deleted
+
+ ##
+ # Computed attribute. In side_comment discussions we hide the replies
+ # on collapse
+ hideRepliesOnCollapse: ->
+ not ENV.DISCUSSION.THREADED and
+ # TODO: have @get('root_entry') instead of this check all over the place
+ @get('parent_id') is null and
+ @get('replies').length > 0
##
# Not familiar enough with Backbone.sync to do this, using ajaxJSON
View
2  app/coffeescripts/discussions/EntryView.coffee
@@ -58,7 +58,7 @@ define [
onCollapsedView: (model, collapsedView) =>
@toggleCollapsedClass()
- if @model.get('allowsSideComments')
+ if @model.get 'hideRepliesOnCollapse'
els = @$('.replies, .add-side-comment-wrap')
if collapsedView
els.hide()
View
10 app/coffeescripts/discussions/Reply.coffee
@@ -1,11 +1,13 @@
define [
+ 'compiled/backbone-ext/Backbone'
+ 'use!underscore'
'i18n!discussions.reply'
'jquery'
'compiled/discussions/Entry'
'str/htmlEscape'
'jst/discussions/_reply_attachment'
'tinymce.editor_box'
-], (I18n, $, Entry, htmlEscape, replyAttachmentTemplate) ->
+], (Backbone, _, I18n, $, Entry, htmlEscape, replyAttachmentTemplate) ->
class Reply
@@ -46,6 +48,7 @@ define [
setTimeout =>
@textarea.editorBox 'focus'
@editing = true
+ @trigger 'edit', this
##
# Hides the TinyMCE editor
@@ -58,6 +61,7 @@ define [
@textarea.val @content
@el.show()
@editing = false
+ @trigger 'hide', this
##
# Submit handler for the reply form. Creates a new Entry and saves it
@@ -134,3 +138,7 @@ define [
removeAttachments: ->
@form.find('ul.discussion-reply-attachments').empty()
+ _.extend Reply.prototype, Backbone.Events
+
+ Reply
+
View
11 app/coffeescripts/discussions/TopicView.coffee
@@ -50,6 +50,11 @@ define [
@$el.toggleClass 'directed-discussion', !ENV.DISCUSSION.THREADED
##
+ # Cache all the elements reused in the class
+ cacheElements: ->
+ @$addRootReply = @$ '.add_root_reply'
+
+ ##
# Creates the Entries
#
# @api private
@@ -69,6 +74,7 @@ define [
@discussion.model.bind 'fetchSuccess', =>
unread_entries = @discussion.model.get 'unread_entries'
@setNextUnread unread_entries
+ @cacheElements()
# TODO get rid of this global, used
window.DISCUSSION = @discussion
@@ -119,7 +125,10 @@ define [
# @api private
addReply: (event) ->
event.preventDefault()
- @reply ?= new Reply this, topLevel: true, added: @initEntries
+ unless @reply?
+ @reply = new Reply this, topLevel: true, added: @initEntries
+ @reply.on 'edit', => @$addRootReply.hide()
+ @reply.on 'hide', => @$addRootReply.show()
@model.set 'notification', ''
@reply.edit()
View
20 app/stylesheets/discussions.sass
@@ -133,6 +133,8 @@
display: none
.show-if-replying
display: block
+ .cancel_button
+ font-size: 11px
.discussion-reply-label
display: block
@@ -238,6 +240,8 @@
margin-bottom: 0
position: relative
+.directed-discussion .entry .deleted-discussion-entry
+
.directed-discussion .entry .entry .discussion_entry
margin-bottom: 5px
border-bottom: none
@@ -254,15 +258,25 @@
.directed-discussion .entry .replies
background-color: #cccccc
margin-left: 20px
- margin-bottom: -5px
-.entry .add-side-comment-wrap .discussion-reply-form
+.add-side-comment-wrap .discussion-reply-form
background: #cccccc
padding: 10px
- margin-top: 5px
+ margin-top: 0px
margin-left: 20px
box-shadow: none
+.directed-discussion .discussion-entries:last-child
+ margin-bottom: 0
+
+.directed-discussion .entry:last-child
+ margin-bottom: 0px
+ padding-bottom: 4px
+
+.directed-discussion .discussion-entries
+ margin-top: 0px
+
.add_root_reply
+ display: inline-block
margin-top: 20px
View
6 app/views/discussion_topics/show.html.erb
@@ -35,9 +35,9 @@
<% end %>
<a id="jump_to_next_unread" class="button button-sidebar-wide disabled"><%= image_tag('discussions/next_unread_icon.png') %> Jump to Next Unread</a>
<select class="view_switcher" style="display:none;">
- <option value="collapsed" class="collapsed-view">All Collapsed</option>
- <option value="unread" class="unread-view">Unread Only</option>
- <option value="expanded" class="expanded-view" selected>All Expanded</option>
+ <option value="collapsed" class="collapsed-view"><%= t :collapse_all, 'Collapse All' %></option>
+ <option value="unread" class="unread-view"><%= t :expand_unread, 'Expand Unread' %></option>
+ <option value="expanded" class="expanded-view" selected><%= t :expand_all, 'Expand All' %></option>
</select>
</div>
View
2  app/views/jst/discussions/EntryCollectionView.handlebars
@@ -1,6 +1,6 @@
<ul class="discussion-entries"></ul>
{{#if showReplyButton}}
- <button class="button add_root_reply">{{#t "add_reply"}}Add Reply{{/t}}</button>
+ <span class="add_root_reply">&#8593; <a href="*">{{#t "add_reply_to_topic"}}Add Reply to Topic{{/t}}</a></span>
{{/if}}
View
12 app/views/jst/discussions/_deleted_entry.handlebars
@@ -1,14 +1,6 @@
-<header class="discussion-section {{read_state}}">
- <div class="discussion-read-state tooltip">
- <span class="tooltip_wrap unread"></span>
- <span class="tooltip_wrap just_read"></span>
- </div>
+<header class="{{#if hideRepliesOnCollapse}}admin-link-hover-area{{/if}} discussion-section {{read_state}}" data-event="toggleCollapsed">
<div class="discussion-header-content right-of-avatar">
- <div class="admin-links"></div>
- <h1 class="discussion-title">
- <a class="summary ellipsis"><i>{{#t "deleted"}}This entry has been deleted{{/t}}</i></a>
- </h1>
- <h2 class="discussion-subtitle"></h2>
+ <h1 class="discussion-title">{{#t "deleted"}}This entry has been deleted{{/t}}</h1>
</div>
</header>
View
10 app/views/jst/discussions/_reply_form.handlebars
@@ -1,7 +1,11 @@
<form class="discussion-section hide-if-collapsed discussion-reply-form">
<span class="notification" data-bind="notification"></span>
<label class="discussion-reply-label hide-if-replying" data-event="addReply" for="reply_message_for_{{id}}">
- {{#t "write_a_reply"}}Write a reply...{{/t}}
+ {{#if allowsSideComments}}
+ {{#t "add_side_comment"}}Add a side comment...{{/t}}
+ {{else}}
+ {{#t "write_a_reply"}}Write a reply...{{/t}}
+ {{/if}}
</label>
<div class="show-if-replying">
<textarea class="reply-textarea" id="reply_message_for_{{id}}"></textarea>
@@ -10,8 +14,8 @@
<a href="#" class="discussion-reply-add-attachment" data-event="addReplyAttachment">{{#t "attach_file"}}Attach{{/t}}</a>
{{/if}}
<div>
- <button class="button" type="submit">{{#t "post_response"}}Post Response{{/t}}</button>
- <button class="cancel_button button button-secondary small-button">{{#t "cancel"}}Cancel{{/t}}</button>
+ <button class="button small-button" type="submit">{{#t "post_response"}}Post Response{{/t}}</button>
+ <a href="#" class="cancel_button">{{#t "cancel"}}Cancel{{/t}}</a>
</div>
</div>
</form>

No commit comments for this range

Something went wrong with that request. Please try again.