diff --git a/common/static/coffee/src/discussion/discussion_router.coffee b/common/static/coffee/src/discussion/discussion_router.coffee
index 283632a542..f9c9e44c97 100644
--- a/common/static/coffee/src/discussion/discussion_router.coffee
+++ b/common/static/coffee/src/discussion/discussion_router.coffee
@@ -41,9 +41,6 @@ if Backbone?
@main.render()
@main.on "thread:responses:rendered", =>
@nav.updateSidebar()
- @main.on "tag:selected", (tag) =>
- search = "[#{tag}]"
- @nav.setAndSearchFor(search)
navigateToThread: (thread_id) =>
thread = @discussion.get(thread_id)
diff --git a/common/static/coffee/src/discussion/utils.coffee b/common/static/coffee/src/discussion/utils.coffee
index 1cb2894798..1b5f9ce094 100644
--- a/common/static/coffee/src/discussion/utils.coffee
+++ b/common/static/coffee/src/discussion/utils.coffee
@@ -75,7 +75,6 @@ class @DiscussionUtil
undo_vote_for_comment : "/courses/#{$$course_id}/discussion/comments/#{param}/unvote"
upload : "/courses/#{$$course_id}/discussion/upload"
search : "/courses/#{$$course_id}/discussion/forum/search"
- tags_autocomplete : "/courses/#{$$course_id}/discussion/threads/tags/autocomplete"
retrieve_discussion : "/courses/#{$$course_id}/discussion/forum/#{param}/inline"
retrieve_single_thread : "/courses/#{$$course_id}/discussion/forum/#{param}/threads/#{param1}"
openclose_thread : "/courses/#{$$course_id}/discussion/threads/#{param}/close"
@@ -157,20 +156,6 @@ class @DiscussionUtil
[event, selector] = eventSelector.split(' ')
$local(selector).unbind(event)[event] handler
- @processTag: (text) ->
- text.toLowerCase()
-
- @tagsInputOptions: ->
- autocomplete_url: @urlFor('tags_autocomplete')
- autocomplete:
- remoteDataType: 'json'
- interactive: true
- height: '30px'
- width: '100%'
- defaultText: "Tag your post: press enter after each tag"
- removeWithBackspace: true
- preprocessTag: @processTag
-
@formErrorHandler: (errorsField) ->
(xhr, textStatus, error) ->
response = JSON.parse(xhr.responseText)
diff --git a/common/static/coffee/src/discussion/views/discussion_thread_edit_view.coffee b/common/static/coffee/src/discussion/views/discussion_thread_edit_view.coffee
index 6e9be30b6e..918c70f576 100644
--- a/common/static/coffee/src/discussion/views/discussion_thread_edit_view.coffee
+++ b/common/static/coffee/src/discussion/views/discussion_thread_edit_view.coffee
@@ -16,7 +16,6 @@ if Backbone?
@$el.html(@template(@model.toJSON()))
@delegateEvents()
DiscussionUtil.makeWmdEditor @$el, $.proxy(@$, @), "edit-post-body"
- @$(".edit-post-tags").tagsInput DiscussionUtil.tagsInputOptions()
@
update: (event) ->
diff --git a/common/static/coffee/src/discussion/views/discussion_thread_list_view.coffee b/common/static/coffee/src/discussion/views/discussion_thread_list_view.coffee
index 57385c15bd..9eaffc142f 100644
--- a/common/static/coffee/src/discussion/views/discussion_thread_list_view.coffee
+++ b/common/static/coffee/src/discussion/views/discussion_thread_list_view.coffee
@@ -393,11 +393,6 @@ if Backbone?
text = @$(".post-search-field").val()
@searchFor(text)
- setAndSearchFor: (text) ->
- @showSearch()
- @$(".post-search-field").val(text)
- @searchFor(text)
-
searchFor: (text, callback, value) ->
@mode = 'search'
@current_search = text
diff --git a/common/static/coffee/src/discussion/views/discussion_thread_view.coffee b/common/static/coffee/src/discussion/views/discussion_thread_view.coffee
index 2cf992e2be..7569faaa0b 100644
--- a/common/static/coffee/src/discussion/views/discussion_thread_view.coffee
+++ b/common/static/coffee/src/discussion/views/discussion_thread_view.coffee
@@ -4,10 +4,6 @@ if Backbone?
events:
"click .discussion-submit-post": "submitComment"
- # TODO tags
- # Until we decide what to do w/ tags, removing them.
- #"click .thread-tag": "tagSelected"
-
$: (selector) ->
@$el.find(selector)
@@ -27,10 +23,6 @@ if Backbone?
@renderShowView()
@renderAttrs()
- # TODO tags
- # Until we decide what to do w/ tags, removing them.
- #@renderTags()
-
@$("span.timeago").timeago()
@makeWmdEditor "reply-body"
@renderResponses()
@@ -40,21 +32,6 @@ if Backbone?
if @responsesRequest?
@responsesRequest.abort()
- # TODO tags
- # Until we decide what to do w/ tags, removing them.
- #renderTags: ->
- # # tags
- # for tag in @model.get("tags")
- # if !tags
- # tags = $('
')
- # tags.append("
#{tag} ")
- # @$(".post-body").after(tags)
-
- # TODO tags
- # Until we decide what to do w tags, removing them.
- #tagSelected: (e) ->
- # @trigger "tag:selected", $(e.target).html()
-
renderResponses: ->
setTimeout(=>
@$el.find(".loading").show()
@@ -116,10 +93,6 @@ if Backbone?
newTitle = @editView.$(".edit-post-title").val()
newBody = @editView.$(".edit-post-body textarea").val()
- # TODO tags
- # Until we decide what to do w/ tags, removing them.
- #newTags = @editView.$(".edit-post-tags").val()
-
url = DiscussionUtil.urlFor('update_thread', @model.id)
DiscussionUtil.safeAjax
@@ -133,31 +106,20 @@ if Backbone?
title: newTitle
body: newBody
- # TODO tags
- # Until we decide what to do w/ tags, removing them.
- #tags: newTags
-
error: DiscussionUtil.formErrorHandler(@$(".edit-post-form-errors"))
success: (response, textStatus) =>
# TODO: Move this out of the callback, this makes it feel sluggish
@editView.$(".edit-post-title").val("").attr("prev-text", "")
@editView.$(".edit-post-body textarea").val("").attr("prev-text", "")
- @editView.$(".edit-post-tags").val("")
- @editView.$(".edit-post-tags").importTags("")
@editView.$(".wmd-preview p").html("")
@model.set
title: newTitle
body: newBody
- tags: response.content.tags
@createShowView()
@renderShowView()
- # TODO tags
- # Until we decide what to do w/ tags, removing them.
- #@renderTags()
-
createEditView: () ->
if @showView?
diff --git a/common/static/coffee/src/discussion/views/discussion_thread_view_inline.coffee b/common/static/coffee/src/discussion/views/discussion_thread_view_inline.coffee
index 992b6686b9..d605f6e31a 100644
--- a/common/static/coffee/src/discussion/views/discussion_thread_view_inline.coffee
+++ b/common/static/coffee/src/discussion/views/discussion_thread_view_inline.coffee
@@ -32,9 +32,6 @@ if Backbone?
@renderShowView()
@renderAttrs()
- # TODO tags commenting out til we decide what to do with tags
- #@renderTags()
-
@$("span.timeago").timeago()
@$el.find('.post-extended-content').hide()
if @expanded
diff --git a/common/static/coffee/src/discussion/views/new_post_inline_vew.coffee b/common/static/coffee/src/discussion/views/new_post_inline_vew.coffee
index ffd43ff7bf..97d1730402 100644
--- a/common/static/coffee/src/discussion/views/new_post_inline_vew.coffee
+++ b/common/static/coffee/src/discussion/views/new_post_inline_vew.coffee
@@ -9,9 +9,6 @@ if Backbone?
DiscussionUtil.makeWmdEditor @$el, $.proxy(@$, @), "new-post-body"
- # TODO tags: commenting out til we know what to do with them
- #@$(".new-post-tags").tagsInput DiscussionUtil.tagsInputOptions()
-
events:
"submit .new-post-form": "createPost"
@@ -27,9 +24,6 @@ if Backbone?
body = @$(".new-post-body").find(".wmd-input").val()
group = @$(".new-post-group option:selected").attr("value")
- # TODO tags: commenting out til we know what to do with them
- #tags = @$(".new-post-tags").val()
-
anonymous = false || @$("input.discussion-anonymous").is(":checked")
anonymous_to_peers = false || @$("input.discussion-anonymous-to-peers").is(":checked")
follow = false || @$("input.discussion-follow").is(":checked")
@@ -48,9 +42,6 @@ if Backbone?
body: body
group_id: group
- # TODO tags: commenting out til we know what to do with them
- #tags: tags
-
anonymous: anonymous
anonymous_to_peers: anonymous_to_peers
auto_subscribe: follow
@@ -63,8 +54,4 @@ if Backbone?
@$(".new-post-title").val("").attr("prev-text", "")
@$(".new-post-body textarea").val("").attr("prev-text", "")
- # TODO tags, commenting out til we know what to do with them
- #@$(".new-post-tags").val("")
- #@$(".new-post-tags").importTags("")
-
@collection.add thread
diff --git a/common/static/coffee/src/discussion/views/new_post_view.coffee b/common/static/coffee/src/discussion/views/new_post_view.coffee
index 606e4f30d7..e7a961a8a2 100644
--- a/common/static/coffee/src/discussion/views/new_post_view.coffee
+++ b/common/static/coffee/src/discussion/views/new_post_view.coffee
@@ -15,8 +15,6 @@ if Backbone?
DiscussionUtil.makeWmdEditor @$el, $.proxy(@$, @), "new-post-body"
- @$(".new-post-tags").tagsInput DiscussionUtil.tagsInputOptions()
-
if @$($(".topic_menu li a")[0]).attr('cohorted') != "True"
$('.choose-cohort').hide();
@@ -126,7 +124,6 @@ if Backbone?
event.preventDefault()
title = @$(".new-post-title").val()
body = @$(".new-post-body").find(".wmd-input").val()
- tags = @$(".new-post-tags").val()
group = @$(".new-post-group option:selected").attr("value")
anonymous = false || @$("input.discussion-anonymous").is(":checked")
@@ -145,7 +142,6 @@ if Backbone?
data:
title: title
body: body
- tags: tags
anonymous: anonymous
anonymous_to_peers: anonymous_to_peers
auto_subscribe: follow
@@ -158,8 +154,6 @@ if Backbone?
@$el.hide()
@$(".new-post-title").val("").attr("prev-text", "")
@$(".new-post-body textarea").val("").attr("prev-text", "")
- @$(".new-post-tags").val("")
- @$(".new-post-tags").importTags("")
@$(".wmd-preview p").html("")
@collection.add thread
diff --git a/lms/djangoapps/django_comment_client/base/tests.py b/lms/djangoapps/django_comment_client/base/tests.py
index 513780ecda..e1c6d7ba12 100644
--- a/lms/djangoapps/django_comment_client/base/tests.py
+++ b/lms/djangoapps/django_comment_client/base/tests.py
@@ -71,7 +71,7 @@ class ViewsTestCase(UrlResetMixin, ModuleStoreTestCase):
"user_id":"1","username":"robot",\
"votes":{"count":0,"up_count":0,\
"down_count":0,"point":0},\
- "abuse_flaggers":[],"tags":[],\
+ "abuse_flaggers":[],\
"type":"thread","group_id":null,\
"pinned":false,\
"endorsed":false,\
@@ -119,7 +119,7 @@ class ViewsTestCase(UrlResetMixin, ModuleStoreTestCase):
"user_id":"1","username":"robot",\
"votes":{"count":0,"up_count":0,\
"down_count":0,"point":0},\
- "abuse_flaggers":[1],"tags":[],\
+ "abuse_flaggers":[1],\
"type":"thread","group_id":null,\
"pinned":false,\
"endorsed":false,\
@@ -179,7 +179,7 @@ class ViewsTestCase(UrlResetMixin, ModuleStoreTestCase):
"user_id":"1","username":"robot",\
"votes":{"count":0,"up_count":0,\
"down_count":0,"point":0},\
- "abuse_flaggers":[],"tags":[],\
+ "abuse_flaggers":[],\
"type":"thread","group_id":null,\
"pinned":false,\
"endorsed":false,\
diff --git a/lms/djangoapps/django_comment_client/base/urls.py b/lms/djangoapps/django_comment_client/base/urls.py
index 97ba282db2..972c2ee23e 100644
--- a/lms/djangoapps/django_comment_client/base/urls.py
+++ b/lms/djangoapps/django_comment_client/base/urls.py
@@ -2,7 +2,6 @@ from django.conf.urls.defaults import url, patterns
urlpatterns = patterns('django_comment_client.base.views', # nopep8
url(r'upload$', 'upload', name='upload'),
- url(r'threads/tags/autocomplete$', 'tags_autocomplete', name='tags_autocomplete'),
url(r'threads/(?P
[\w\-]+)/update$', 'update_thread', name='update_thread'),
url(r'threads/(?P[\w\-]+)/reply$', 'create_comment', name='create_comment'),
url(r'threads/(?P[\w\-]+)/delete', 'delete_thread', name='delete_thread'),
diff --git a/lms/djangoapps/django_comment_client/base/views.py b/lms/djangoapps/django_comment_client/base/views.py
index 4d8bffdd73..12cdf58b2e 100644
--- a/lms/djangoapps/django_comment_client/base/views.py
+++ b/lms/djangoapps/django_comment_client/base/views.py
@@ -85,7 +85,7 @@ def create_thread(request, course_id, commentable_id):
else:
anonymous_to_peers = False
- thread = cc.Thread(**extract(post, ['body', 'title', 'tags']))
+ thread = cc.Thread(**extract(post, ['body', 'title']))
thread.update_attributes(**{
'anonymous': anonymous,
'anonymous_to_peers': anonymous_to_peers,
@@ -142,7 +142,7 @@ def update_thread(request, course_id, thread_id):
Given a course id and thread id, update a existing thread, used for both static and ajax submissions
"""
thread = cc.Thread.find(thread_id)
- thread.update_attributes(**extract(request.POST, ['body', 'title', 'tags']))
+ thread.update_attributes(**extract(request.POST, ['body', 'title']))
thread.save()
if request.is_ajax():
return ajax_content_response(request, course_id, thread.to_dict())
@@ -527,15 +527,6 @@ def search_similar_threads(request, course_id, commentable_id):
})
-@require_GET
-def tags_autocomplete(request, course_id):
- value = request.GET.get('q', None)
- results = []
- if value:
- results = cc.tags_autocomplete(value)
- return JsonResponse(results)
-
-
@require_POST
@login_required
@csrf.csrf_exempt
diff --git a/lms/djangoapps/django_comment_client/forum/views.py b/lms/djangoapps/django_comment_client/forum/views.py
index 4bbcd5acd4..fc405923fe 100644
--- a/lms/djangoapps/django_comment_client/forum/views.py
+++ b/lms/djangoapps/django_comment_client/forum/views.py
@@ -38,7 +38,6 @@ def get_threads(request, course_id, discussion_id=None, per_page=THREADS_PER_PAG
'sort_key': 'date',
'sort_order': 'desc',
'text': '',
- 'tags': '',
'commentable_id': discussion_id,
'course_id': course_id,
'user_id': request.user.id,
@@ -80,7 +79,7 @@ def get_threads(request, course_id, discussion_id=None, per_page=THREADS_PER_PAG
strip_none(extract(request.GET,
['page', 'sort_key',
'sort_order', 'text',
- 'tags', 'commentable_ids', 'flagged'])))
+ 'commentable_ids', 'flagged'])))
threads, page, num_pages = cc.Thread.search(query_params)
@@ -201,9 +200,6 @@ def forum_form_discussion(request, course_id):
# query_params={'follower_id': request.user.id},
#)
- #trending_tags = cc.search_trending_tags(
- # course_id,
- #)
with newrelic.agent.FunctionTrace(nr_transaction, "get_cohort_info"):
cohorts = get_course_cohorts(course_id)
cohorted_commentables = get_cohorted_commentables(course_id)
@@ -214,7 +210,6 @@ def forum_form_discussion(request, course_id):
'csrf': csrf(request)['csrf_token'],
'course': course,
#'recent_active_threads': recent_active_threads,
- #'trending_tags': trending_tags,
'staff_access': has_access(request.user, course, 'staff'),
'threads': saxutils.escape(json.dumps(threads), escapedict),
'thread_pages': query_params['num_pages'],
@@ -284,10 +279,6 @@ def single_thread(request, course_id, discussion_id, thread_id):
# query_params={'follower_id': request.user.id},
#)
- #trending_tags = cc.search_trending_tags(
- # course_id,
- #)
-
with newrelic.agent.FunctionTrace(nr_transaction, "get_metadata_for_threads"):
annotated_content_info = utils.get_metadata_for_threads(course_id, threads, request.user, user_info)
@@ -304,7 +295,6 @@ def single_thread(request, course_id, discussion_id, thread_id):
'annotated_content_info': saxutils.escape(json.dumps(annotated_content_info), escapedict),
'course': course,
#'recent_active_threads': recent_active_threads,
- #'trending_tags': trending_tags,
'course_id': course.id, # TODO: Why pass both course and course.id to template?
'thread_id': thread_id,
'threads': saxutils.escape(json.dumps(threads), escapedict),
diff --git a/lms/djangoapps/django_comment_client/mustache_helpers.py b/lms/djangoapps/django_comment_client/mustache_helpers.py
index adaf26c9e0..c116de69c1 100644
--- a/lms/djangoapps/django_comment_client/mustache_helpers.py
+++ b/lms/djangoapps/django_comment_client/mustache_helpers.py
@@ -1,5 +1,3 @@
-from .utils import url_for_tags as _url_for_tags
-
import django.core.urlresolvers as urlresolvers
import sys
import inspect
@@ -21,10 +19,6 @@ def url_for_user(content, user_id):
return urlresolvers.reverse('django_comment_client.forum.views.user_profile', args=[content['course_id'], user_id])
-def url_for_tags(content, tags): # assume that attribute 'tags' is in the format u'a, b, c'
- return _url_for_tags(content['course_id'], tags)
-
-
def close_thread_text(content):
if content.get('closed'):
return 'Re-open thread'
diff --git a/lms/djangoapps/django_comment_client/utils.py b/lms/djangoapps/django_comment_client/utils.py
index c8422fb14b..4aefbc67af 100644
--- a/lms/djangoapps/django_comment_client/utils.py
+++ b/lms/djangoapps/django_comment_client/utils.py
@@ -306,10 +306,6 @@ def get_metadata_for_threads(course_id, threads, user, user_info):
# put this method in utils.py to avoid circular import dependency between helpers and mustache_helpers
-def url_for_tags(course_id, tags):
- return reverse('django_comment_client.forum.views.forum_form_discussion', args=[course_id]) + '?' + urllib.urlencode({'tags': tags})
-
-
def render_mustache(template_name, dictionary, *args, **kwargs):
template = edxmako.lookup['main'].get_template(template_name).source
return pystache.render(template, dictionary)
@@ -336,7 +332,6 @@ def extend_content(content):
content_info = {
'displayed_title': content.get('highlighted_title') or content.get('title', ''),
'displayed_body': content.get('highlighted_body') or content.get('body', ''),
- 'raw_tags': ','.join(content.get('tags', [])),
'permalink': permalink(content),
'roles': roles,
'updated': content['created_at'] != content['updated_at'],
@@ -365,7 +360,7 @@ def safe_content(content):
'endorsed', 'parent_id', 'thread_id', 'votes', 'closed', 'created_at',
'updated_at', 'depth', 'type', 'commentable_id', 'comments_count',
'at_position_list', 'children', 'highlighted_title', 'highlighted_body',
- 'courseware_title', 'courseware_url', 'tags', 'unread_comments_count',
+ 'courseware_title', 'courseware_url', 'unread_comments_count',
'read', 'group_id', 'group_name', 'group_string', 'pinned', 'abuse_flaggers',
'stats'
diff --git a/lms/lib/comment_client/comment_client.py b/lms/lib/comment_client/comment_client.py
index 4f660533f1..d6a14deeff 100644
--- a/lms/lib/comment_client/comment_client.py
+++ b/lms/lib/comment_client/comment_client.py
@@ -22,26 +22,9 @@ def search_recent_active_threads(course_id, recursive=False, query_params={}, *a
return perform_request('get', _url_for_search_recent_active_threads(), attributes, *args, **kwargs)
-def search_trending_tags(course_id, query_params={}, *args, **kwargs):
- default_params = {'course_id': course_id}
- attributes = dict(default_params.items() + query_params.items())
- return perform_request('get', _url_for_search_trending_tags(), attributes, *args, **kwargs)
-
-
-def tags_autocomplete(value, *args, **kwargs):
- return perform_request('get', _url_for_threads_tags_autocomplete(), {'value': value}, *args, **kwargs)
-
def _url_for_search_similar_threads():
return "{prefix}/search/threads/more_like_this".format(prefix=settings.PREFIX)
def _url_for_search_recent_active_threads():
return "{prefix}/search/threads/recent_active".format(prefix=settings.PREFIX)
-
-
-def _url_for_search_trending_tags():
- return "{prefix}/search/tags/trending".format(prefix=settings.PREFIX)
-
-
-def _url_for_threads_tags_autocomplete():
- return "{prefix}/threads/tags/autocomplete".format(prefix=settings.PREFIX)
diff --git a/lms/lib/comment_client/thread.py b/lms/lib/comment_client/thread.py
index e2eb7217d8..813b398592 100644
--- a/lms/lib/comment_client/thread.py
+++ b/lms/lib/comment_client/thread.py
@@ -16,7 +16,7 @@ class Thread(models.Model):
updatable_fields = [
'title', 'body', 'anonymous', 'anonymous_to_peers', 'course_id',
- 'closed', 'tags', 'user_id', 'commentable_id', 'group_id', 'group_name', 'pinned'
+ 'closed', 'user_id', 'commentable_id', 'group_id', 'group_name', 'pinned'
]
initializable_fields = updatable_fields
@@ -34,7 +34,7 @@ class Thread(models.Model):
'recursive': False}
params = merge_dict(default_params, strip_blank(strip_none(query_params)))
- if query_params.get('text') or query_params.get('tags'):
+ if query_params.get('text'):
url = cls.url(action='search')
else:
url = cls.url(action='get_all', params=extract(params, 'commentable_id'))
diff --git a/lms/static/css/vendor/jquery.tagsinput.css b/lms/static/css/vendor/jquery.tagsinput.css
deleted file mode 100644
index c595e249f9..0000000000
--- a/lms/static/css/vendor/jquery.tagsinput.css
+++ /dev/null
@@ -1,7 +0,0 @@
-div.tagsinput { border:1px solid #CCC; background: #FFF; padding:5px; width:300px; height:100px; overflow-y: auto;}
-div.tagsinput span.tag { border: 1px solid #a5d24a; -moz-border-radius:2px; -webkit-border-radius:2px; display: block; float: left; padding: 5px; text-decoration:none; background: #cde69c; color: #638421; margin-right: 5px; margin-bottom:5px;font-family: helvetica; font-size:13px;}
-div.tagsinput span.tag a { font-weight: bold; color: #82ad2b; text-decoration:none; font-size: 11px; }
-div.tagsinput input { width:80px; margin:0px; font-family: helvetica; font-size: 13px; border:1px solid transparent; padding:5px; background: transparent; color: #000; outline:0px; margin-right:5px; margin-bottom:5px; }
-div.tagsinput div { display:block; float: left; }
-.tags_clear { clear: both; width: 100%; height: 0px; }
-.not_valid {background: #FBD8DB !important; color: #90111A !important;}
diff --git a/lms/static/js/jquery.tagsinput.js b/lms/static/js/jquery.tagsinput.js
deleted file mode 100644
index 917eba817c..0000000000
--- a/lms/static/js/jquery.tagsinput.js
+++ /dev/null
@@ -1,370 +0,0 @@
-/*
-
- jQuery Tags Input Plugin 1.3.3
-
- Copyright (c) 2011 XOXCO, Inc
-
- Documentation for this plugin lives here:
- http://xoxco.com/clickable/jquery-tags-input
-
- Licensed under the MIT license:
- http://www.opensource.org/licenses/mit-license.php
-
- ben@xoxco.com
-
-*/
-
-(function($) {
-
- var delimiter = new Array();
- var tags_callbacks = new Array();
- $.fn.doAutosize = function(o){
- var minWidth = $(this).data('minwidth'),
- maxWidth = $(this).data('maxwidth'),
- val = '',
- input = $(this),
- testSubject = $('#'+$(this).data('tester_id'));
-
- if (val === (val = input.val())) {return;}
-
- // Enter new content into testSubject
- var escaped = val.replace(/&/g, '&').replace(/\s/g,' ').replace(//g, '>');
- testSubject.html(escaped);
- // Calculate new width + whether to change
- var testerWidth = testSubject.width(),
- newWidth = (testerWidth + o.comfortZone) >= minWidth ? testerWidth + o.comfortZone : minWidth,
- currentWidth = input.width(),
- isValidWidthChange = (newWidth < currentWidth && newWidth >= minWidth)
- || (newWidth > minWidth && newWidth < maxWidth);
-
- // Animate width
- if (isValidWidthChange) {
- input.width(newWidth);
- }
-
-
- };
- $.fn.resetAutosize = function(options){
- // alert(JSON.stringify(options));
- var minWidth = $(this).data('minwidth') || options.minInputWidth || $(this).width(),
- maxWidth = $(this).data('maxwidth') || options.maxInputWidth || ($(this).closest('.tagsinput').width() - options.inputPadding),
- val = '',
- input = $(this),
- testSubject = $(' ').css({
- position: 'absolute',
- top: -9999,
- left: -9999,
- width: 'auto',
- fontSize: input.css('fontSize'),
- fontFamily: input.css('fontFamily'),
- fontWeight: input.css('fontWeight'),
- letterSpacing: input.css('letterSpacing'),
- whiteSpace: 'nowrap'
- }),
- testerId = $(this).attr('id')+'_autosize_tester';
- if(! $('#'+testerId).length > 0){
- testSubject.attr('id', testerId);
- testSubject.appendTo('body');
- }
-
- input.data('minwidth', minWidth);
- input.data('maxwidth', maxWidth);
- input.data('tester_id', testerId);
- input.css('width', minWidth);
- };
-
- $.fn.addTag = function(value,options) {
- options = jQuery.extend({focus:false,callback:true},options);
- this.each(function() {
- var id = $(this).attr('id');
-
- var tagslist = $(this).val().split(delimiter[id]);
- if (tagslist[0] == '') {
- tagslist = new Array();
- }
-
- value = jQuery.trim(value);
-
- if (options.callback && tags_callbacks[id] && tags_callbacks[id]['preprocessTag']) {
- var f = tags_callbacks[id]['preprocessTag'];
- value = f.call(this, value);
- }
-
- if (options.unique) {
- var skipTag = $(this).tagExist(value);
- if(skipTag == true) {
- //Marks fake input as not_valid to let styling it
- $('#'+id+'_tag').addClass('not_valid');
- }
- } else {
- var skipTag = false;
- }
-
- if (value !='' && skipTag != true) {
- $('').addClass('tag').append(
- $('').text(value).append(' '),
- $('', {
- href : '#',
- title : 'Remove tag',
- text : 'x'
- }).click(function () {
- return $('#' + id).removeTag(escape(value));
- })
- ).insertBefore('#' + id + '_addTag');
-
- tagslist.push(value);
-
- $('#'+id+'_tag').val('');
- if (options.focus) {
- $('#'+id+'_tag').focus();
- } else {
- $('#'+id+'_tag').blur();
- }
-
- $.fn.tagsInput.updateTagsField(this,tagslist);
-
- if (options.callback && tags_callbacks[id] && tags_callbacks[id]['onAddTag']) {
- var f = tags_callbacks[id]['onAddTag'];
- f.call(this, value);
- }
- if(tags_callbacks[id] && tags_callbacks[id]['onChange'])
- {
- var i = tagslist.length;
- var f = tags_callbacks[id]['onChange'];
- f.call(this, $(this), tagslist[i-1]);
- }
- }
-
- });
-
- return false;
- };
-
- $.fn.removeTag = function(value) {
- value = unescape(value);
- this.each(function() {
- var id = $(this).attr('id');
-
- var old = $(this).val().split(delimiter[id]);
-
- $('#'+id+'_tagsinput .tag').remove();
- str = '';
- for (i=0; i< old.length; i++) {
- if (old[i]!=value) {
- str = str + delimiter[id] +old[i];
- }
- }
-
- $.fn.tagsInput.importTags(this,str);
-
- if (tags_callbacks[id] && tags_callbacks[id]['onRemoveTag']) {
- var f = tags_callbacks[id]['onRemoveTag'];
- f.call(this, value);
- }
- });
-
- return false;
- };
-
- $.fn.tagExist = function(val) {
- var id = $(this).attr('id');
- var tagslist = $(this).val().split(delimiter[id]);
- return (jQuery.inArray(val, tagslist) >= 0); //true when tag exists, false when not
- };
-
- // clear all existing tags and import new ones from a string
- $.fn.importTags = function(str) {
- id = $(this).attr('id');
- $('#'+id+'_tagsinput .tag').remove();
- $.fn.tagsInput.importTags(this,str);
- }
-
- $.fn.tagsInput = function(options) {
- var settings = jQuery.extend({
- interactive:true,
- defaultText:'add a tag',
- minChars:0,
- width:'300px',
- height:'100px',
- autocomplete: {selectFirst: false },
- 'hide':true,
- 'delimiter':',',
- 'unique':true,
- removeWithBackspace:true,
- placeholderColor:'#666666',
- autosize: true,
- comfortZone: 20,
- inputPadding: 6*2
- },options);
-
- this.each(function() {
- if (settings.hide) {
- $(this).hide();
- }
- var id = $(this).attr('id');
- if (!id || delimiter[$(this).attr('id')]) {
- id = $(this).attr('id', 'tags' + new Date().getTime()).attr('id');
- }
-
- var data = jQuery.extend({
- pid:id,
- real_input: '#'+id,
- holder: '#'+id+'_tagsinput',
- input_wrapper: '#'+id+'_addTag',
- fake_input: '#'+id+'_tag'
- },settings);
-
- delimiter[id] = data.delimiter;
-
- if (settings.onAddTag || settings.onRemoveTag || settings.onChange || settings.preprocessTag) {
- tags_callbacks[id] = new Array();
- tags_callbacks[id]['onAddTag'] = settings.onAddTag;
- tags_callbacks[id]['onRemoveTag'] = settings.onRemoveTag;
- tags_callbacks[id]['onChange'] = settings.onChange;
- tags_callbacks[id]['preprocessTag'] = settings.preprocessTag;
- }
-
- var markup = '';
-
- $(markup).insertAfter(this);
-
-
- $(data.holder).css('width',settings.width);
- $(data.holder).css('min-height',settings.height);
- $(data.holder).css('height','100%');
-
- if ($(data.real_input).val()!='') {
- $.fn.tagsInput.importTags($(data.real_input),$(data.real_input).val());
- }
- if (settings.interactive) {
- $(data.fake_input).val($(data.fake_input).attr('data-default'));
- $(data.fake_input).css('color',settings.placeholderColor);
- $(data.fake_input).resetAutosize(settings);
-
- $(data.fake_input).doAutosize(settings);
- $(data.holder).bind('click',data,function(event) {
- $(event.data.fake_input).focus();
- });
-
- $(data.fake_input).bind('focus',data,function(event) {
- if ($(event.data.fake_input).val()==$(event.data.fake_input).attr('data-default')) {
- $(event.data.fake_input).val('');
- }
- $(event.data.fake_input).css('color','#000000');
- });
-
- if (settings.autocomplete_url != undefined) {
- autocomplete_options = {source: settings.autocomplete_url};
- for (attrname in settings.autocomplete) {
- autocomplete_options[attrname] = settings.autocomplete[attrname];
- }
-
- if (jQuery.Autocompleter !== undefined) {
- onSelectCallback = settings.autocomplete.onItemSelect;
- settings.autocomplete.onItemSelect = function() {
- $(data.real_input).addTag($(data.fake_input).val(), {focus: true, unique: (settings.unique)});
- $(data.fake_input).resetAutosize(settings);
- if (onSelectCallback) {
- onSelectCallback();
- }
- }
- $(data.fake_input).autocomplete(settings.autocomplete_url, settings.autocomplete);
- $(data.fake_input).bind('result',data,function(event,data,formatted) {
- if (data) {
- $('#'+id).addTag(data[0] + "",{focus:true,unique:(settings.unique)});
- }
- });
- } else if (jQuery.ui.autocomplete !== undefined) {
- $(data.fake_input).autocomplete(autocomplete_options);
- $(data.fake_input).bind('autocompleteselect',data,function(event,ui) {
- $(event.data.real_input).addTag(ui.item.value,{focus:true,unique:(settings.unique)});
-
- return false;
- });
- }
-
-
- } else {
- // if a user tabs out of the field, create a new tag
- // this is only available if autocomplete is not used.
- $(data.fake_input).bind('blur',data,function(event) {
- var d = $(this).attr('data-default');
- if ($(event.data.fake_input).val()!='' && $(event.data.fake_input).val()!=d) {
- if( (event.data.minChars <= $(event.data.fake_input).val().length) && (!event.data.maxChars || (event.data.maxChars >= $(event.data.fake_input).val().length)) )
- $(event.data.real_input).addTag($(event.data.fake_input).val(),{focus:true,unique:(settings.unique)});
- } else {
- $(event.data.fake_input).val($(event.data.fake_input).attr('data-default'));
- $(event.data.fake_input).css('color',settings.placeholderColor);
- }
- return false;
- });
-
- }
- // if user types a comma, create a new tag
- $(data.fake_input).bind('keypress',data,function(event) {
- if (event.which==event.data.delimiter.charCodeAt(0) || event.which==13 ) {
- event.preventDefault();
- if( (event.data.minChars <= $(event.data.fake_input).val().length) && (!event.data.maxChars || (event.data.maxChars >= $(event.data.fake_input).val().length)) )
- $(event.data.real_input).addTag($(event.data.fake_input).val(),{focus:true,unique:(settings.unique)});
- $(event.data.fake_input).resetAutosize(settings);
- return false;
- } else if (event.data.autosize) {
- $(event.data.fake_input).doAutosize(settings);
- }
- });
- //Delete last tag on backspace
- data.removeWithBackspace && $(data.fake_input).bind('keydown', function(event)
- {
- if(event.keyCode == 8 && $(this).val() == '')
- {
- event.preventDefault();
- var last_tag = $(this).closest('.tagsinput').find('.tag:last').text();
- var id = $(this).attr('id').replace(/_tag$/, '');
- last_tag = last_tag.replace(/[\s]+x$/, '');
- $('#' + id).removeTag(escape(last_tag));
- $(this).trigger('focus');
- }
- });
- $(data.fake_input).blur();
-
- //Removes the not_valid class when user changes the value of the fake input
- if(data.unique) {
- $(data.fake_input).keydown(function(event){
- if(event.keyCode == 8 || String.fromCharCode(event.which).match(/\w+|[áéíóúÁÉÍÓÚñÑ,/]+/)) {
- $(this).removeClass('not_valid');
- }
- });
- }
- } // if settings.interactive
- });
-
- return this;
-
- };
-
- $.fn.tagsInput.updateTagsField = function(obj,tagslist) {
- var id = $(obj).attr('id');
- $(obj).val(tagslist.join(delimiter[id]));
- };
-
- $.fn.tagsInput.importTags = function(obj,val) {
- $(obj).val('');
- var id = $(obj).attr('id');
- var tags = val.split(delimiter[id]);
- for (i=0; i
- ## TODO commenting out tags til we figure out what to do with them
- ##
- ## ${_("Add post tags")}
- ##
- ##
${_("Cancel")}
diff --git a/lms/templates/discussion/_js_head_dependencies.html b/lms/templates/discussion/_js_head_dependencies.html
index 961f254efe..50123ad2aa 100644
--- a/lms/templates/discussion/_js_head_dependencies.html
+++ b/lms/templates/discussion/_js_head_dependencies.html
@@ -7,11 +7,9 @@
-
-
diff --git a/lms/templates/discussion/_new_post.html b/lms/templates/discussion/_new_post.html
index dfc942730b..b74c489bdf 100644
--- a/lms/templates/discussion/_new_post.html
+++ b/lms/templates/discussion/_new_post.html
@@ -73,11 +73,6 @@
- ## TODO tags commenting out til we figure out what to do w/ tags
- ##
- ## ${_("Add post tags")}
- ##
- ##
${_("Cancel")}
diff --git a/lms/templates/discussion/_search_bar.html b/lms/templates/discussion/_search_bar.html
index 98cabc31d6..f1ff3197b6 100644
--- a/lms/templates/discussion/_search_bar.html
+++ b/lms/templates/discussion/_search_bar.html
@@ -10,10 +10,6 @@ def base_url_for_search():
%>
diff --git a/lms/templates/discussion/_trending_tags.html b/lms/templates/discussion/_trending_tags.html
deleted file mode 100644
index 509516c2d5..0000000000
--- a/lms/templates/discussion/_trending_tags.html
+++ /dev/null
@@ -1,14 +0,0 @@
-<%! import django_comment_client.helpers as helpers %>
-
-% if trending_tags:
-
-% endif
diff --git a/lms/templates/discussion/_underscore_templates.html b/lms/templates/discussion/_underscore_templates.html
index 2ebd1465e1..24bb016acf 100644
--- a/lms/templates/discussion/_underscore_templates.html
+++ b/lms/templates/discussion/_underscore_templates.html
@@ -91,12 +91,6 @@
- ## TODO tags
- ## Until we decide what to do with tags, commenting them out.
- ##
- ## ${_("Edit post tags")}
- ## "}">
- ##
${_("Cancel")}
diff --git a/lms/templates/discussion/mustache/_inline_discussion.mustache b/lms/templates/discussion/mustache/_inline_discussion.mustache
index 6c57fa9dfe..58d5f6f6d0 100644
--- a/lms/templates/discussion/mustache/_inline_discussion.mustache
+++ b/lms/templates/discussion/mustache/_inline_discussion.mustache
@@ -12,10 +12,6 @@
- {{! TODO tags: Getting rid of tags for now. }}
- {{!}}
- {{! }}
- {{!
}}
Cancel
diff --git a/lms/templates/discussion/mustache/_inline_discussion_cohorted.mustache b/lms/templates/discussion/mustache/_inline_discussion_cohorted.mustache
index 6daef10dbb..6eab3f10cc 100644
--- a/lms/templates/discussion/mustache/_inline_discussion_cohorted.mustache
+++ b/lms/templates/discussion/mustache/_inline_discussion_cohorted.mustache
@@ -12,10 +12,6 @@
- {{! TODO tags: Getting rid of tags for now. }}
- {{!}}
- {{! }}
- {{!
}}
Cancel