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
daa38af5
Commit
daa38af5
authored
Sep 17, 2012
by
Ibrahim Awwal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Convert DiscussionFilter to coffeescript.
parent
bb6f4cdb
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
82 deletions
+28
-82
lms/static/coffee/src/discussion/discussion_filter.coffee
+28
-0
lms/static/js/discussion-filter.js
+0
-82
No files found.
lms/static/coffee/src/discussion/discussion_filter.coffee
0 → 100644
View file @
daa38af5
class
@
DiscussionFilter
@
filterDrop
:
(
e
)
->
$drop
=
$
(
e
.
target
).
parents
(
'.topic_menu_wrapper, .browse-topic-drop-menu-wrapper'
)
query
=
$
(
e
.
target
).
val
()
$items
=
$drop
.
find
(
'a'
)
if
(
query
.
length
==
0
)
$items
.
removeClass
(
'hidden'
)
return
;
$items
.
addClass
(
'hidden'
)
$items
.
each
(
i
)
->
thisText
=
$
(
this
).
not
(
'.unread'
).
text
()
$
(
this
).
parents
(
'ul'
).
siblings
(
'a'
).
not
(
'.unread'
).
each
(
i
)
->
thisText
=
thisText
+
' '
+
$
(
this
).
text
();
test
=
true
terms
=
thisText
.
split
(
' '
)
if
(
thisText
.
toLowerCase
().
search
(
query
.
toLowerCase
())
==
-
1
)
test
=
false
if
(
test
)
$
(
this
).
removeClass
(
'hidden'
)
# show children
$
(
this
).
parent
().
find
(
'a'
).
removeClass
(
'hidden'
);
# show parents
$
(
this
).
parents
(
'ul'
).
siblings
(
'a'
).
removeClass
(
'hidden'
);
lms/static/js/discussion-filter.js
deleted
100644 → 0
View file @
bb6f4cdb
var
DiscussionFilter
=
DiscussionFilter
||
{};
DiscussionFilter
.
filterDrop
=
function
(
e
)
{
/*
* multiple queries
*/
// var $drop = $(e.target).parents('.form-topic-drop-menu-wrapper, .browse-topic-drop-menu-wrapper');
// var queries = $(this).val().split(' ');
// var $items = $drop.find('a');
// if(queries.length == 0) {
// $items.show();
// return;
// }
// $items.hide();
// $items.each(function(i) {
// var thisText = $(this).children().not('.unread').text();
// $(this).parents('ul').siblings('a').not('.unread').each(function(i) {
// thisText = thisText + ' ' + $(this).text();
// });
// var test = true;
// var terms = thisText.split(' ');
// for(var i = 0; i < queries.length; i++) {
// if(thisText.toLowerCase().search(queries[i].toLowerCase()) == -1) {
// test = false;
// }
// }
// if(test) {
// $(this).show();
// // show children
// $(this).parent().find('a').show();
// // show parents
// $(this).parents('ul').siblings('a').show();
// }
// });
/*
* single query
*/
var
$drop
=
$
(
e
.
target
).
parents
(
'.topic_menu_wrapper, .browse-topic-drop-menu-wrapper'
);
var
query
=
$
(
e
.
target
).
val
();
var
$items
=
$drop
.
find
(
'a'
);
if
(
query
.
length
==
0
)
{
$items
.
removeClass
(
'hidden'
);
return
;
}
$items
.
addClass
(
'hidden'
);
$items
.
each
(
function
(
i
)
{
var
thisText
=
$
(
this
).
not
(
'.unread'
).
text
();
$
(
this
).
parents
(
'ul'
).
siblings
(
'a'
).
not
(
'.unread'
).
each
(
function
(
i
)
{
thisText
=
thisText
+
' '
+
$
(
this
).
text
();
});
var
test
=
true
;
var
terms
=
thisText
.
split
(
' '
);
if
(
thisText
.
toLowerCase
().
search
(
query
.
toLowerCase
())
==
-
1
)
{
test
=
false
;
}
if
(
test
)
{
$
(
this
).
removeClass
(
'hidden'
);
// show children
$
(
this
).
parent
().
find
(
'a'
).
removeClass
(
'hidden'
);
// show parents
$
(
this
).
parents
(
'ul'
).
siblings
(
'a'
).
removeClass
(
'hidden'
);
}
});
}
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