Clean up dead forums front-end code
This commit is contained in:
@@ -79,15 +79,6 @@ if Backbone?
|
||||
if @attrRenderer[attr]
|
||||
@attrRenderer[attr].apply(@, [value])
|
||||
|
||||
$: (selector) ->
|
||||
@$local.find(selector)
|
||||
|
||||
initLocal: ->
|
||||
@$local = @$el.children(".local")
|
||||
if not @$local.length
|
||||
@$local = @$el
|
||||
@$delegateElement = @$local
|
||||
|
||||
makeWmdEditor: (cls_identifier) =>
|
||||
if not @$el.find(".wmd-panel").length
|
||||
DiscussionUtil.makeWmdEditor @$el, $.proxy(@$, @), cls_identifier
|
||||
@@ -103,7 +94,6 @@ if Backbone?
|
||||
|
||||
|
||||
initialize: ->
|
||||
@initLocal()
|
||||
@model.bind('change', @renderPartialAttrs, @)
|
||||
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@ if Backbone?
|
||||
|
||||
render: ->
|
||||
@$el.html(@renderTemplate())
|
||||
@initLocal()
|
||||
@delegateEvents()
|
||||
|
||||
@renderShowView()
|
||||
|
||||
@@ -10,12 +10,6 @@ if Backbone?
|
||||
initialize: ->
|
||||
super()
|
||||
|
||||
initLocal: ->
|
||||
@$local = @$el.children(".discussion-article").children(".local")
|
||||
if not @$local.length
|
||||
@$local = @$el
|
||||
@$delegateElement = @$local
|
||||
|
||||
renderTemplate: () ->
|
||||
if @model.has('group_id')
|
||||
@template = DiscussionUtil.getTemplate("_inline_thread_cohorted")
|
||||
|
||||
@@ -30,7 +30,6 @@ if Backbone?
|
||||
params = @model.toJSON()
|
||||
|
||||
@$el.html(@template(params))
|
||||
@initLocal()
|
||||
@delegateEvents()
|
||||
@renderAttrs()
|
||||
@renderFlagged()
|
||||
|
||||
@@ -1,401 +0,0 @@
|
||||
.discussion-module {
|
||||
@extend .discussion-body;
|
||||
margin: 20px 0;
|
||||
padding: 20px 20px 28px 20px;
|
||||
background: #f6f6f6 !important;
|
||||
border-radius: 3px;
|
||||
|
||||
.responses {
|
||||
margin-top: 40px;
|
||||
|
||||
> li {
|
||||
margin: 0 20px 30px;
|
||||
}
|
||||
}
|
||||
|
||||
.discussion-show {
|
||||
display: block;
|
||||
width: 200px;
|
||||
margin: auto;
|
||||
font-size: 14px;
|
||||
text-align: center;
|
||||
|
||||
&.shown {
|
||||
.show-hide-discussion-icon {
|
||||
background-position: 0 0;
|
||||
}
|
||||
}
|
||||
|
||||
.show-hide-discussion-icon {
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
top: 5px;
|
||||
margin-right: 6px;
|
||||
width: 21px;
|
||||
height: 19px;
|
||||
background: url(../images/show-hide-discussion-icon.png) no-repeat;
|
||||
background-position: -21px 0;
|
||||
}
|
||||
}
|
||||
|
||||
.new-post-btn {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
section.discussion {
|
||||
margin-top: 20px;
|
||||
|
||||
.threads {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
/* Course content p has a default margin-bottom of 1.416em, this is just to reset that */
|
||||
.discussion-thread {
|
||||
padding: 0;
|
||||
@include transition(all .25s);
|
||||
|
||||
.dogear,
|
||||
.vote-btn {
|
||||
display: none;
|
||||
}
|
||||
|
||||
&.expanded {
|
||||
padding: 20px 0;
|
||||
|
||||
.dogear,
|
||||
.vote-btn {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.discussion-article {
|
||||
border: 1px solid #b2b2b2;
|
||||
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
|
||||
border-radius: 3px;
|
||||
}
|
||||
}
|
||||
|
||||
p {
|
||||
margin-bottom: 0em;
|
||||
}
|
||||
|
||||
.discussion-article {
|
||||
border: 1px solid #ddd;
|
||||
border-bottom-width: 0;
|
||||
background: #fff;
|
||||
min-height: 0;
|
||||
padding: 10px 10px 15px 10px;
|
||||
box-shadow: 0 1px 0 #ddd;
|
||||
@include transition(all .2s);
|
||||
|
||||
.discussion-post {
|
||||
padding: 12px 20px 0 20px;
|
||||
@include clearfix;
|
||||
|
||||
header {
|
||||
padding-bottom: 0;
|
||||
margin-bottom: 15px;
|
||||
|
||||
h3 {
|
||||
font-size: 19px;
|
||||
font-weight: 700;
|
||||
margin-bottom: 0px;
|
||||
}
|
||||
|
||||
h4 {
|
||||
font-size: 16px;
|
||||
}
|
||||
}
|
||||
|
||||
.post-body {
|
||||
font-size: 14px;
|
||||
clear: both;
|
||||
}
|
||||
}
|
||||
|
||||
.post-tools {
|
||||
margin-left: 20px;
|
||||
|
||||
a {
|
||||
display: block;
|
||||
font-size: 12px;
|
||||
line-height: 30px;
|
||||
|
||||
&.expand-post:before {
|
||||
content: '▾ ';
|
||||
}
|
||||
|
||||
&.collapse-post:before {
|
||||
content: '▴ ';
|
||||
}
|
||||
|
||||
&.collapse-post {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.responses {
|
||||
margin-top: 10px;
|
||||
|
||||
header {
|
||||
padding-bottom: 0em;
|
||||
margin-bottom: 5px;
|
||||
|
||||
.posted-by {
|
||||
font-size: 0.8em;
|
||||
}
|
||||
}
|
||||
.response-body {
|
||||
margin-bottom: 0.2em;
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
|
||||
.discussion-reply-new {
|
||||
.wmd-input {
|
||||
height: 120px;
|
||||
}
|
||||
}
|
||||
|
||||
// Content that is hidden by default in the inline view
|
||||
.post-extended-content{
|
||||
display: none;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.new-post-article {
|
||||
display: none;
|
||||
margin-top: 20px;
|
||||
|
||||
.inner-wrapper {
|
||||
max-width: 1180px;
|
||||
min-width: 760px;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
.thread-title {
|
||||
display: block;
|
||||
margin-bottom: 20px;
|
||||
font-size: 21px;
|
||||
color: #333;
|
||||
font-weight: 700;
|
||||
}
|
||||
}
|
||||
|
||||
.new-post-btn {
|
||||
@include blue-button;
|
||||
display: inline-block;
|
||||
font-size: 13px;
|
||||
margin-right: 4px;
|
||||
}
|
||||
|
||||
.new-post-icon {
|
||||
display: block;
|
||||
float: left;
|
||||
width: 16px;
|
||||
height: 17px;
|
||||
margin: 8px 7px 0 0;
|
||||
font-size: 16px;
|
||||
vertical-align: middle;
|
||||
color: $white;
|
||||
}
|
||||
|
||||
.moderator-actions {
|
||||
padding-left: 0 !important;
|
||||
}
|
||||
|
||||
section.pagination {
|
||||
margin-top: 30px;
|
||||
|
||||
nav.discussion-paginator {
|
||||
float: right;
|
||||
|
||||
ol {
|
||||
li {
|
||||
list-style: none;
|
||||
display: inline-block;
|
||||
padding-right: 0.5em;
|
||||
a {
|
||||
@include white-button;
|
||||
}
|
||||
}
|
||||
|
||||
li.current-page{
|
||||
height: 35px;
|
||||
padding: 0 15px;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 3px;
|
||||
font-size: 13px;
|
||||
font-weight: 700;
|
||||
line-height: 32px;
|
||||
color: #333;
|
||||
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.new-post-body {
|
||||
.wmd-panel {
|
||||
width: 100%;
|
||||
min-width: 500px;
|
||||
}
|
||||
|
||||
.wmd-button-bar {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.wmd-input {
|
||||
height: 150px;
|
||||
width: 100%;
|
||||
background-color: #e9e9e9;
|
||||
border: 1px solid #c8c8c8;
|
||||
font-family: Monaco, 'Lucida Console', monospace;
|
||||
font-style: normal;
|
||||
font-size: 0.8em;
|
||||
line-height: 1.6em;
|
||||
@include border-radius(3px 3px 0 0);
|
||||
|
||||
&::-webkit-input-placeholder {
|
||||
color: #888;
|
||||
}
|
||||
}
|
||||
|
||||
.wmd-preview {
|
||||
position: relative;
|
||||
font-family: $sans-serif;
|
||||
padding: 25px 20px 10px 20px;
|
||||
margin-bottom: 5px;
|
||||
box-sizing: border-box;
|
||||
border: 1px solid #c8c8c8;
|
||||
border-top-width: 0;
|
||||
@include border-radius(0 0 3px 3px);
|
||||
overflow: hidden;
|
||||
@include transition(all, .2s, easeOut);
|
||||
|
||||
&:before {
|
||||
content: 'PREVIEW';
|
||||
position: absolute;
|
||||
top: 3px;
|
||||
left: 5px;
|
||||
font-size: 11px;
|
||||
color: #bbb;
|
||||
}
|
||||
|
||||
p {
|
||||
font-family: $sans-serif;
|
||||
}
|
||||
background-color: #fafafa;
|
||||
}
|
||||
|
||||
.wmd-button-row {
|
||||
position: relative;
|
||||
margin-left: 5px;
|
||||
margin-right: 5px;
|
||||
margin-bottom: 5px;
|
||||
margin-top: 10px;
|
||||
padding: 0px;
|
||||
height: 20px;
|
||||
overflow: hidden;
|
||||
@include transition(all, .2s, easeOut);
|
||||
}
|
||||
|
||||
.wmd-spacer {
|
||||
width: 1px;
|
||||
height: 20px;
|
||||
margin-left: 14px;
|
||||
|
||||
position: absolute;
|
||||
background-color: Silver;
|
||||
display: inline-block;
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
.wmd-button {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
padding-left: 2px;
|
||||
padding-right: 3px;
|
||||
position: absolute;
|
||||
display: inline-block;
|
||||
list-style: none;
|
||||
cursor: pointer;
|
||||
background: none;
|
||||
}
|
||||
|
||||
.wmd-button > span {
|
||||
display: inline-block;
|
||||
background-image: url(../images/new-post-icons-full.png);
|
||||
background-repeat: no-repeat;
|
||||
background-position: 0px 0px;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
}
|
||||
|
||||
.wmd-spacer1 {
|
||||
left: 50px;
|
||||
}
|
||||
.wmd-spacer2 {
|
||||
left: 175px;
|
||||
}
|
||||
|
||||
.wmd-spacer3 {
|
||||
left: 300px;
|
||||
}
|
||||
|
||||
.wmd-prompt-background {
|
||||
background-color: Black;
|
||||
}
|
||||
|
||||
.wmd-prompt-dialog {
|
||||
@extend .modal;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.wmd-prompt-dialog {
|
||||
padding: 20px;
|
||||
|
||||
> div {
|
||||
font-size: 0.8em;
|
||||
font-family: arial, helvetica, sans-serif;
|
||||
}
|
||||
|
||||
b {
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
> form > input[type="text"] {
|
||||
border-radius: 3px;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
> form > input[type="button"] {
|
||||
border: 1px solid #888;
|
||||
font-family: $sans-serif;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
> form > input[type="file"] {
|
||||
margin-bottom: 18px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.wmd-button-row {
|
||||
// this is being hidden now because the inline styles to position the icons are not being written
|
||||
display: none;
|
||||
position: relative;
|
||||
height: 12px;
|
||||
}
|
||||
|
||||
.wmd-button {
|
||||
span {
|
||||
background-image: url("/static/images/wmd-buttons.png");
|
||||
display: inline-block;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,62 +0,0 @@
|
||||
<%! from urllib import urlencode %>
|
||||
|
||||
<%
|
||||
def merge(dic1, dic2):
|
||||
return dict(dic1.items() + dic2.items())
|
||||
|
||||
def url_for_page(_page):
|
||||
return base_url + '?' + urlencode(merge(query_params, {'page': _page}))
|
||||
%>
|
||||
|
||||
<%def name="link_to_page(_page, text)">
|
||||
<a class="discussion-page-link" href="javascript:void(0)" page-url="${url_for_page(_page) | h}">${text}</a>
|
||||
</%def>
|
||||
|
||||
<%def name="div_page(_page)">
|
||||
% if _page != page:
|
||||
<div class="page-link">
|
||||
${link_to_page(_page, str(_page))}
|
||||
</div>
|
||||
% else:
|
||||
<div class="page-link">${_page}</div>
|
||||
% endif
|
||||
</%def>
|
||||
|
||||
<%def name="list_pages(*args)">
|
||||
% for arg in args:
|
||||
% if arg == 'dots':
|
||||
<div class="page-dots">...</div>
|
||||
% elif isinstance(arg, list):
|
||||
% for _page in arg:
|
||||
${div_page(_page)}
|
||||
% endfor
|
||||
% else:
|
||||
${div_page(arg)}
|
||||
% endif
|
||||
% endfor
|
||||
</%def>
|
||||
|
||||
<div class="discussion-${discussion_type | h}-paginator discussion-paginator local">
|
||||
<div class="prev-page">
|
||||
% if page > 1:
|
||||
${link_to_page(page - 1, "< Previous page")}
|
||||
% endif
|
||||
</div>
|
||||
|
||||
% if num_pages <= 2 * pages_nearby_delta + 2:
|
||||
${list_pages(range(1, num_pages + 1))}
|
||||
% else:
|
||||
% if page <= 2 * pages_nearby_delta:
|
||||
${list_pages(range(1, 2 * pages_nearby_delta + 2), 'dots', num_pages)}
|
||||
% elif num_pages - page + 1 <= 2 * pages_nearby_delta:
|
||||
${list_pages(1, 'dots', range(num_pages - 2 * pages_nearby_delta, num_pages + 1))}
|
||||
% else:
|
||||
${list_pages(1, 'dots', range(page - pages_nearby_delta, page + pages_nearby_delta + 1), 'dots', num_pages)}
|
||||
% endif
|
||||
% endif
|
||||
<div class="next-page">
|
||||
% if page < num_pages:
|
||||
${link_to_page(page + 1, "Next page >")}
|
||||
% endif
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,41 +0,0 @@
|
||||
<%! from urllib import urlencode %>
|
||||
|
||||
<%def name="link_to_sort(key, title)">
|
||||
% if key == sort_key:
|
||||
${_link_to_sort(key, None, title + '', 'sorted')}
|
||||
<!---
|
||||
% if sort_order.lower() == 'desc':
|
||||
${_link_to_sort(key, 'asc', title + '', 'sorted')}
|
||||
% else:
|
||||
${_link_to_sort(key, 'desc', title + '', 'sorted')}
|
||||
% endif
|
||||
-->
|
||||
% else:
|
||||
${_link_to_sort(key, 'desc', title)}
|
||||
% endif
|
||||
</%def>
|
||||
|
||||
<%def name="_link_to_sort(key, order, title, cls='')">
|
||||
<%
|
||||
def merge(dic1, dic2):
|
||||
return dict(dic1.items() + dic2.items())
|
||||
|
||||
def url_for_sort(key, order):
|
||||
if order is None:
|
||||
return ''
|
||||
else:
|
||||
return base_url + '?' + urlencode(merge(query_params, {'page': 1, 'sort_key': key, 'sort_order': order}))
|
||||
%>
|
||||
<a class="discussion-sort-link ${cls | h}" href="javascript:void(0)" sort-url="${url_for_sort(key, order) | h}">${title}</a>
|
||||
</%def>
|
||||
|
||||
<div class="discussion-sort local">
|
||||
<span class="discussion-label">Sort by:</span>
|
||||
${link_to_sort('date', 'date')}
|
||||
|
||||
${link_to_sort('activity', 'top')}
|
||||
|
||||
${link_to_sort('votes', 'votes')}
|
||||
|
||||
${link_to_sort('comments', 'comments')}
|
||||
</div>
|
||||
@@ -111,7 +111,7 @@
|
||||
<script aria-hidden="true" type="text/template" id="thread-response-template">
|
||||
<div class="discussion-response"></div>
|
||||
<ol class="comments">
|
||||
<li class="new-comment response-local">
|
||||
<li class="new-comment">
|
||||
% if course is UNDEFINED or has_permission(user, 'create_sub_comment', course.id):
|
||||
<form class="comment-form" data-id="${'<%- wmdId %>'}">
|
||||
<ul class="discussion-errors"></ul>
|
||||
@@ -128,7 +128,7 @@
|
||||
</script>
|
||||
|
||||
<script aria-hidden="true" type="text/template" id="thread-response-show-template">
|
||||
<header class="response-local">
|
||||
<header>
|
||||
<a href="#" class="vote-btn" role="button" aria-pressed="false"><!-- DiscussionContentView.renderVote() populates this --></a>
|
||||
<a href="javascript:void(0)" class="endorse-btn action-endorse" style="cursor: default; display: none;" data-tooltip="${_('endorse') | h}"><span class="check-icon" style="pointer-events: none; "></span></a>
|
||||
${"<% if (obj.username) { %>"}
|
||||
@@ -138,11 +138,11 @@
|
||||
${"<% } %>"}
|
||||
<p class="posted-details" title="${'<%- created_at %>'}">${'<%- created_at %>'}</p>
|
||||
</header>
|
||||
<div class="response-local"><div class="response-body">${"<%- body %>"}</div>
|
||||
<div class="response-body">${"<%- body %>"}</div>
|
||||
<div class="discussion-flag-abuse notflagged" data-role="thread-flag" role="button" aria-pressed="false" tabindex="0">
|
||||
<i class="icon icon-flag"></i><span class="flag-label">${_("Report Misuse")}</span></div>
|
||||
</div>
|
||||
<ul class="moderator-actions response-local">
|
||||
<ul class="moderator-actions">
|
||||
<li style="display: none"><a class="action-edit" href="javascript:void(0)"><span class="edit-icon"></span> ${_("Edit")}</a></li>
|
||||
<li style="display: none"><a class="action-delete" href="javascript:void(0)"><span class="delete-icon"></span> ${_("Delete")}</a></li>
|
||||
<li style="display: none"><a class="action-openclose" href="javascript:void(0)"><span class="edit-icon"></span> ${_("Close")}</a></li>
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<ol class="responses"/>
|
||||
<div class="response-pagination"/>
|
||||
{{#ability.can_reply}}
|
||||
<form class="local discussion-reply-new" data-id="{{id}}">
|
||||
<form class="discussion-reply-new" data-id="{{id}}">
|
||||
<h4>${_("Post a response:")}</h4>
|
||||
<ul class="discussion-errors"></ul>
|
||||
<div class="reply-body" data-id="{{id}}"></div>
|
||||
@@ -26,7 +26,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="local post-tools">
|
||||
<div class="post-tools">
|
||||
<a href="javascript:void(0)" class="expand-post"><span class="icon icon-plus"/> ${_("Expand discussion")}</a>
|
||||
<a href="javascript:void(0)" class="collapse-post"><span class="icon icon-minus"/> ${_("Collapse discussion")}</a>
|
||||
</div>
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
</div>
|
||||
<ol class="responses"/>
|
||||
<div class="response-pagination"/>
|
||||
<form class="local discussion-reply-new" data-id="{{id}}">
|
||||
<form class="discussion-reply-new" data-id="{{id}}">
|
||||
<h4>${_("Post a response:")}</h4>
|
||||
<ul class="discussion-errors"></ul>
|
||||
<div class="reply-body" data-id="{{id}}"></div>
|
||||
@@ -25,7 +25,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="local post-tools">
|
||||
<div class="post-tools">
|
||||
<a href="javascript:void(0)" class="expand-post"><span class="icon icon-plus"/> ${_("Expand discussion")}</a>
|
||||
<a href="javascript:void(0)" class="collapse-post"><span class="icon icon-minus"/> ${_("Collapse discussion")}</a>
|
||||
</div>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<%! from django.utils.translation import ugettext as _ %>
|
||||
|
||||
<div class="discussion-post local">
|
||||
<div class="discussion-post">
|
||||
<div><a href="javascript:void(0)" class="dogear action-follow" data-tooltip="follow"></a></div>
|
||||
<header>
|
||||
<a href="#" class="vote-btn" role="button" aria-pressed="false"/>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<%! from django.utils.translation import ugettext as _ %>
|
||||
|
||||
<nav class="discussion-{{discussiontype}}-paginator discussion-paginator local">
|
||||
<nav class="discussion-{{discussiontype}}-paginator discussion-paginator">
|
||||
<ol>
|
||||
{{#previous}}
|
||||
<li><a class="discussion-pagination" href="{{url}}" data-page-number="{{number}}">< ${_("Previous")}</a></li>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<%! from django.utils.translation import ugettext as _ %>
|
||||
|
||||
<article class="discussion-article" data-id="{{id}}">
|
||||
<div class="discussion-post local">
|
||||
<div class="discussion-post">
|
||||
<header>
|
||||
<h3>{{title}}</h3>
|
||||
<p class="posted-details">
|
||||
@@ -20,7 +20,7 @@
|
||||
</header>
|
||||
<div class="post-body">{{{abbreviatedBody}}}</div>
|
||||
</div>
|
||||
<div class="local post-tools">
|
||||
<div class="post-tools">
|
||||
<a href="{{permalink}}">${_("View discussion")}</a>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user