From 97cfe14abf6706fe1bff890bc198cfd380571f12 Mon Sep 17 00:00:00 2001 From: Safia Abdalla Date: Sat, 9 Jan 2016 23:39:48 -0600 Subject: [PATCH 01/18] Added format_datetime utility function --- notebook/static/base/js/utils.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/notebook/static/base/js/utils.js b/notebook/static/base/js/utils.js index 8775a8f794..c5c89e6325 100644 --- a/notebook/static/base/js/utils.js +++ b/notebook/static/base/js/utils.js @@ -824,6 +824,12 @@ define([ return time.milliseconds.h; } }; + + var format_datetime = function(date) { + return moment(date).format("YYYY-MM-D HH:mm"); + } + + var utils = { load_extension: load_extension, @@ -864,6 +870,7 @@ define([ reject: reject, typeset: typeset, time: time, + format_datetime: format_datetime, _ansispan:_ansispan }; From e235643eb109b01ef5777728525a0005e4231975 Mon Sep 17 00:00:00 2001 From: Safia Abdalla Date: Sat, 9 Jan 2016 23:42:02 -0600 Subject: [PATCH 02/18] Added last_modified date to file tree --- notebook/static/tree/js/notebooklist.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/notebook/static/tree/js/notebooklist.js b/notebook/static/tree/js/notebooklist.js index 4cf108d01e..0b13b7acfa 100644 --- a/notebook/static/tree/js/notebooklist.js +++ b/notebook/static/tree/js/notebooklist.js @@ -369,6 +369,10 @@ define([ $("") .addClass("item_name") .appendTo(link); + + $("") + .addClass("item_modified") + .appendTo(item); if (selectable === false) { checkbox.css('visibility', 'hidden'); @@ -541,11 +545,13 @@ define([ NotebookList.prototype.add_link = function (model, item) { var path = model.path, - name = model.name; + name = model.name, + modified = model.last_modified; var running = (model.type === 'notebook' && this.sessions[path] !== undefined); item.data('name', name); item.data('path', path); + item.data('modified', modified); item.data('type', model.type); item.find(".item_name").text(name); var icon = NotebookList.icons[model.type]; @@ -577,6 +583,9 @@ define([ if (model.type !== "directory") { link.attr('target',IPython._target); } + + // Add in the date that the file was last modified + item.find(".item_modified").text(utils.format_datetime(modified)); }; From 23aeb32cc52bbca05ed33e1176d2b690132f5c0d Mon Sep 17 00:00:00 2001 From: Safia Abdalla Date: Sun, 10 Jan 2016 15:26:28 -0600 Subject: [PATCH 03/18] Added datetime_sort_helper function --- notebook/static/base/js/utils.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/notebook/static/base/js/utils.js b/notebook/static/base/js/utils.js index c5c89e6325..bfccdc207a 100644 --- a/notebook/static/base/js/utils.js +++ b/notebook/static/base/js/utils.js @@ -829,8 +829,16 @@ define([ return moment(date).format("YYYY-MM-D HH:mm"); } + var datetime_sort_helper = function(a, b, order) { + if (moment(a).isBefore(moment(b))) { + return (order == 1) ? -1 : 1; + } else if (moment(a).isSame(moment(b))) { + return 0; + } else { + return (order == 1) ? 1 : -1; + } + } - var utils = { load_extension: load_extension, load_extensions: load_extensions, @@ -871,6 +879,7 @@ define([ typeset: typeset, time: time, format_datetime: format_datetime, + datetime_sort_helper: datetime_sort_helper, _ansispan:_ansispan }; From 0bf3767b88df40a808ca53abbad0e8093a8562fd Mon Sep 17 00:00:00 2001 From: Safia Abdalla Date: Sun, 10 Jan 2016 15:28:15 -0600 Subject: [PATCH 04/18] Updated format string for last modified datetime --- notebook/static/base/js/utils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/notebook/static/base/js/utils.js b/notebook/static/base/js/utils.js index bfccdc207a..84ab453e9b 100644 --- a/notebook/static/base/js/utils.js +++ b/notebook/static/base/js/utils.js @@ -826,7 +826,7 @@ define([ }; var format_datetime = function(date) { - return moment(date).format("YYYY-MM-D HH:mm"); + return moment(date).format("YYYY-MM-DD HH:mm"); } var datetime_sort_helper = function(a, b, order) { From 11eebd2fc00fdab1083e1c1a426569f2e3f1daa3 Mon Sep 17 00:00:00 2001 From: Safia Abdalla Date: Sun, 10 Jan 2016 15:28:54 -0600 Subject: [PATCH 05/18] Added last modified sort button --- notebook/static/tree/less/tree.less | 5 +++++ notebook/templates/tree.html | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/notebook/static/tree/less/tree.less b/notebook/static/tree/less/tree.less index 30ffe5a7f9..dd86b8113e 100644 --- a/notebook/static/tree/less/tree.less +++ b/notebook/static/tree/less/tree.less @@ -188,6 +188,11 @@ ul.breadcrumb { } } +#last_modified { + display: inline-block; + padding-left: @dashboard_lr_pad; +} + #tree-selector { padding-right: 0px; } diff --git a/notebook/templates/tree.html b/notebook/templates/tree.html index 2d444d6282..5553b575ec 100644 --- a/notebook/templates/tree.html +++ b/notebook/templates/tree.html @@ -101,6 +101,11 @@ {% endfor %} +
+ + Last Modified + +
From 6211e33523416e5247a83785ad9e306e52280e21 Mon Sep 17 00:00:00 2001 From: Safia Abdalla Date: Sun, 10 Jan 2016 15:30:07 -0600 Subject: [PATCH 06/18] Added datetime sorting on front end --- notebook/static/tree/js/notebooklist.js | 29 +++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/notebook/static/tree/js/notebooklist.js b/notebook/static/tree/js/notebooklist.js index 0b13b7acfa..21bacc03de 100644 --- a/notebook/static/tree/js/notebooklist.js +++ b/notebook/static/tree/js/notebooklist.js @@ -46,6 +46,7 @@ define([ function(e, d) { that.sessions_loaded(d); }); } this.selected = []; + this.datetime_sorted = false; this._max_upload_size_mb = 25; }; @@ -148,9 +149,36 @@ define([ } } }); + + $('#button-last-modified').click(function (e) { + // If the list is not currently sorted or is sorted in + // descending order, then sort it on ascending order + if (!that.datetime_sorted || that.datetime_sorted == 2) { + that.sort_datetime(1); + that.datetime_sorted = 1;` + } else { + // Otherwise sort the list in descending order and set + // the value of datetime_sorted appropriately + that.sort_datetime(2); + that.datetime_sorted = 2; + } + }); } }; + NotebookList.prototype.sort_datetime = function(order) { + var sort_helper = function(parent, child, selector) { + var items = parent.children(child).sort(function(a, b) { + var first_date = $(selector, a).text(); + var second_date = $(selector, b).text(); + return utils.datetime_sort_helper(first_date, second_date, order); + }); + parent.append(items); + }; + + sort_helper($('#notebook_list'), "div.list_item", 'span.item_modified'); + }; + NotebookList.prototype.handleFilesUpload = function(event, dropOrForm) { var that = this; var files; @@ -372,6 +400,7 @@ define([ $("") .addClass("item_modified") + .addClass("pull-right") .appendTo(item); if (selectable === false) { From a290251ae7168b1648d7d2bac208b31561162dd8 Mon Sep 17 00:00:00 2001 From: Safia Abdalla Date: Mon, 11 Jan 2016 18:11:04 -0600 Subject: [PATCH 07/18] Wiped smudge from screen --- notebook/static/tree/js/notebooklist.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/notebook/static/tree/js/notebooklist.js b/notebook/static/tree/js/notebooklist.js index 21bacc03de..8c26581341 100644 --- a/notebook/static/tree/js/notebooklist.js +++ b/notebook/static/tree/js/notebooklist.js @@ -155,7 +155,7 @@ define([ // descending order, then sort it on ascending order if (!that.datetime_sorted || that.datetime_sorted == 2) { that.sort_datetime(1); - that.datetime_sorted = 1;` + that.datetime_sorted = 1; } else { // Otherwise sort the list in descending order and set // the value of datetime_sorted appropriately From b18d269bda13f95229ef5c94425d489ef26adf6f Mon Sep 17 00:00:00 2001 From: Safia Abdalla Date: Mon, 11 Jan 2016 18:25:50 -0600 Subject: [PATCH 08/18] Added arrow indicator for sorting --- notebook/static/tree/js/notebooklist.js | 4 ++++ notebook/templates/tree.html | 1 + 2 files changed, 5 insertions(+) diff --git a/notebook/static/tree/js/notebooklist.js b/notebook/static/tree/js/notebooklist.js index 8c26581341..7f196d740b 100644 --- a/notebook/static/tree/js/notebooklist.js +++ b/notebook/static/tree/js/notebooklist.js @@ -155,11 +155,15 @@ define([ // descending order, then sort it on ascending order if (!that.datetime_sorted || that.datetime_sorted == 2) { that.sort_datetime(1); + $("#button-last-modified i").removeClass("fa-arrow-down"); + $("#button-last-modified i").addClass("fa-arrow-up"); that.datetime_sorted = 1; } else { // Otherwise sort the list in descending order and set // the value of datetime_sorted appropriately that.sort_datetime(2); + $("#button-last-modified i").removeClass("fa-arrow-up"); + $("#button-last-modified i").addClass("fa-arrow-down"); that.datetime_sorted = 2; } }); diff --git a/notebook/templates/tree.html b/notebook/templates/tree.html index 5553b575ec..c442f17132 100644 --- a/notebook/templates/tree.html +++ b/notebook/templates/tree.html @@ -104,6 +104,7 @@
Last Modified +
From a02148f3adb43ef9e0e0ee1c9ef4dc9ce0898656 Mon Sep 17 00:00:00 2001 From: Safia Abdalla Date: Mon, 11 Jan 2016 19:00:49 -0600 Subject: [PATCH 09/18] Updated format_datetime to return human-friendly dates --- notebook/static/base/js/utils.js | 3 ++- notebook/static/tree/js/notebooklist.js | 13 +++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/notebook/static/base/js/utils.js b/notebook/static/base/js/utils.js index 84ab453e9b..52e2c028e5 100644 --- a/notebook/static/base/js/utils.js +++ b/notebook/static/base/js/utils.js @@ -826,7 +826,8 @@ define([ }; var format_datetime = function(date) { - return moment(date).format("YYYY-MM-DD HH:mm"); + var text = moment(date).fromNow(); + return text === 'a few seconds ago' ? 'seconds ago' : text; } var datetime_sort_helper = function(a, b, order) { diff --git a/notebook/static/tree/js/notebooklist.js b/notebook/static/tree/js/notebooklist.js index 7f196d740b..81ef089b5d 100644 --- a/notebook/static/tree/js/notebooklist.js +++ b/notebook/static/tree/js/notebooklist.js @@ -155,15 +155,15 @@ define([ // descending order, then sort it on ascending order if (!that.datetime_sorted || that.datetime_sorted == 2) { that.sort_datetime(1); - $("#button-last-modified i").removeClass("fa-arrow-down"); - $("#button-last-modified i").addClass("fa-arrow-up"); + $("#button-last-modified i").removeClass("fa-arrow-up"); + $("#button-last-modified i").addClass("fa-arrow-down"); that.datetime_sorted = 1; } else { // Otherwise sort the list in descending order and set // the value of datetime_sorted appropriately that.sort_datetime(2); - $("#button-last-modified i").removeClass("fa-arrow-up"); - $("#button-last-modified i").addClass("fa-arrow-down"); + $("#button-last-modified i").removeClass("fa-arrow-down"); + $("#button-last-modified i").addClass("fa-arrow-up"); that.datetime_sorted = 2; } }); @@ -173,8 +173,8 @@ define([ NotebookList.prototype.sort_datetime = function(order) { var sort_helper = function(parent, child, selector) { var items = parent.children(child).sort(function(a, b) { - var first_date = $(selector, a).text(); - var second_date = $(selector, b).text(); + var first_date = $(selector, a).attr("id"); + var second_date = $(selector, b).attr("id"); return utils.datetime_sort_helper(first_date, second_date, order); }); parent.append(items); @@ -619,6 +619,7 @@ define([ // Add in the date that the file was last modified item.find(".item_modified").text(utils.format_datetime(modified)); + item.find(".item_modified").attr("id", modified); }; From c08c7d58df0f25898ff15d22c340a4bf001667aa Mon Sep 17 00:00:00 2001 From: Safia Abdalla Date: Tue, 12 Jan 2016 20:17:15 -0600 Subject: [PATCH 10/18] Updated front-end sorting and display --- notebook/static/tree/js/notebooklist.js | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/notebook/static/tree/js/notebooklist.js b/notebook/static/tree/js/notebooklist.js index 81ef089b5d..1f6a0adf31 100644 --- a/notebook/static/tree/js/notebooklist.js +++ b/notebook/static/tree/js/notebooklist.js @@ -46,7 +46,8 @@ define([ function(e, d) { that.sessions_loaded(d); }); } this.selected = []; - this.datetime_sorted = false; + // 0 => default sort, 1 => ascending, 2 => descending + this.datetime_sorted = 0; this._max_upload_size_mb = 25; }; @@ -153,34 +154,37 @@ define([ $('#button-last-modified').click(function (e) { // If the list is not currently sorted or is sorted in // descending order, then sort it on ascending order - if (!that.datetime_sorted || that.datetime_sorted == 2) { + if (that.datetime_sorted == 0) { that.sort_datetime(1); $("#button-last-modified i").removeClass("fa-arrow-up"); $("#button-last-modified i").addClass("fa-arrow-down"); that.datetime_sorted = 1; - } else { + } else if (that.datetime_sorted == 1) { // Otherwise sort the list in descending order and set // the value of datetime_sorted appropriately that.sort_datetime(2); $("#button-last-modified i").removeClass("fa-arrow-down"); $("#button-last-modified i").addClass("fa-arrow-up"); that.datetime_sorted = 2; + } else { + $("#button-last-modified i").removeClass("fa-arrow-up"); + that.datetime_sorted = 0; } }); } }; NotebookList.prototype.sort_datetime = function(order) { - var sort_helper = function(parent, child, selector) { + var datetime_sort_helper = function(parent, child, selector) { var items = parent.children(child).sort(function(a, b) { - var first_date = $(selector, a).attr("id"); - var second_date = $(selector, b).attr("id"); + var first_date = $(selector, a).attr("title"); + var second_date = $(selector, b).attr("title"); return utils.datetime_sort_helper(first_date, second_date, order); }); parent.append(items); }; - sort_helper($('#notebook_list'), "div.list_item", 'span.item_modified'); + datetime_sort_helper($('#notebook_list'), "div.list_item", 'span.item_modified'); }; NotebookList.prototype.handleFilesUpload = function(event, dropOrForm) { @@ -619,7 +623,7 @@ define([ // Add in the date that the file was last modified item.find(".item_modified").text(utils.format_datetime(modified)); - item.find(".item_modified").attr("id", modified); + item.find(".item_modified").attr("title", moment(modified).format("YYYY-MM-DD HH:mm")); }; From c3d6bfbf1a34abbe9f82f74c67a0f49d143bc48d Mon Sep 17 00:00:00 2001 From: Safia Abdalla Date: Tue, 12 Jan 2016 20:23:54 -0600 Subject: [PATCH 11/18] Updated styling on last modified element --- notebook/static/tree/less/tree.less | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/notebook/static/tree/less/tree.less b/notebook/static/tree/less/tree.less index dd86b8113e..ac36439074 100644 --- a/notebook/static/tree/less/tree.less +++ b/notebook/static/tree/less/tree.less @@ -139,6 +139,11 @@ ul.breadcrumb { vertical-align: baseline; } +.item_modified { + margin-right: @dashboard_lr_pad; + margin-left: @dashboard_lr_pad; +} + .item_buttons { line-height: 1em; .btn-toolbar(); From 04a456516c1211f96af703bf630d9f1f20f75400 Mon Sep 17 00:00:00 2001 From: Safia Abdalla Date: Wed, 13 Jan 2016 19:46:16 -0600 Subject: [PATCH 12/18] Added button for sort by name --- notebook/static/tree/less/tree.less | 2 +- notebook/templates/tree.html | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/notebook/static/tree/less/tree.less b/notebook/static/tree/less/tree.less index ac36439074..ef733a5408 100644 --- a/notebook/static/tree/less/tree.less +++ b/notebook/static/tree/less/tree.less @@ -193,7 +193,7 @@ ul.breadcrumb { } } -#last_modified { +.sort_button { display: inline-block; padding-left: @dashboard_lr_pad; } diff --git a/notebook/templates/tree.html b/notebook/templates/tree.html index c442f17132..4616289cf7 100644 --- a/notebook/templates/tree.html +++ b/notebook/templates/tree.html @@ -101,12 +101,18 @@ {% endfor %} -
- +
+ Last Modified
+
+ + Name + + +
From c914d9232c4de3af3038b959fe80151a5a5b52e3 Mon Sep 17 00:00:00 2001 From: Safia Abdalla Date: Wed, 13 Jan 2016 19:46:33 -0600 Subject: [PATCH 13/18] Added functionality for sort on name --- notebook/static/tree/js/notebooklist.js | 47 ++++++++++++++++++++++--- 1 file changed, 42 insertions(+), 5 deletions(-) diff --git a/notebook/static/tree/js/notebooklist.js b/notebook/static/tree/js/notebooklist.js index 1f6a0adf31..812ef5ddaa 100644 --- a/notebook/static/tree/js/notebooklist.js +++ b/notebook/static/tree/js/notebooklist.js @@ -46,8 +46,9 @@ define([ function(e, d) { that.sessions_loaded(d); }); } this.selected = []; - // 0 => default sort, 1 => ascending, 2 => descending + // 0 => descending, 1 => ascending this.datetime_sorted = 0; + this.name_sorted = 0; this._max_upload_size_mb = 25; }; @@ -159,18 +160,33 @@ define([ $("#button-last-modified i").removeClass("fa-arrow-up"); $("#button-last-modified i").addClass("fa-arrow-down"); that.datetime_sorted = 1; - } else if (that.datetime_sorted == 1) { + } else { // Otherwise sort the list in descending order and set // the value of datetime_sorted appropriately that.sort_datetime(2); $("#button-last-modified i").removeClass("fa-arrow-down"); $("#button-last-modified i").addClass("fa-arrow-up"); - that.datetime_sorted = 2; - } else { - $("#button-last-modified i").removeClass("fa-arrow-up"); that.datetime_sorted = 0; } }); + + $('#button-sort-name').click(function (e) { + // If the list is not currently sorted or is sorted in + // descending order, then sort it on ascending order + if (that.name_sorted == 0) { + that.sort_name(1); + $("#button-sort-name i").removeClass("fa-arrow-up"); + $("#button-sort-name i").addClass("fa-arrow-down"); + that.name_sorted = 1; + } else { + // Otherwise sort the list in descending order and set + // the value of datetime_sorted appropriately + that.sort_name(2); + $("#button-sort-name i").removeClass("fa-arrow-down"); + $("#button-sort-name i").addClass("fa-arrow-up"); + that.name_sorted = 0; + } + }); } }; @@ -187,6 +203,27 @@ define([ datetime_sort_helper($('#notebook_list'), "div.list_item", 'span.item_modified'); }; + NotebookList.prototype.sort_name = function(order) { + var name_sort_helper = function(parent, child, selector) { + var items = parent.children(child).sort(function(a, b) { + var first_name = $(selector, a).text(); + var second_name = $(selector, b).text(); + return (function(a, b, order) { + if (a < b) { + return (order == 1) ? -1 : 1; + } else if (a == b) { + return 0; + } else { + return (order == 1) ? 1 : -1; + } + })(first_name, second_name, order); + }); + parent.append(items); + }; + + name_sort_helper($('#notebook_list'), "div.list_item", 'span.item_name'); + }; + NotebookList.prototype.handleFilesUpload = function(event, dropOrForm) { var that = this; var files; From 9494ca1a9c13d953664831657a2596b57d211228 Mon Sep 17 00:00:00 2001 From: Safia Abdalla Date: Thu, 14 Jan 2016 21:12:28 -0600 Subject: [PATCH 14/18] Update buttons in template --- notebook/templates/tree.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/notebook/templates/tree.html b/notebook/templates/tree.html index 4616289cf7..966242b144 100644 --- a/notebook/templates/tree.html +++ b/notebook/templates/tree.html @@ -102,13 +102,13 @@
- + Last Modified
- + Name From e6db03ceac253d8c14cffd712bae542941c1b148 Mon Sep 17 00:00:00 2001 From: Safia Abdalla Date: Thu, 14 Jan 2016 21:12:47 -0600 Subject: [PATCH 15/18] Refactor out button click logic --- notebook/static/tree/js/notebooklist.js | 59 +++++++++++-------------- 1 file changed, 26 insertions(+), 33 deletions(-) diff --git a/notebook/static/tree/js/notebooklist.js b/notebook/static/tree/js/notebooklist.js index 812ef5ddaa..f007b9cd1d 100644 --- a/notebook/static/tree/js/notebooklist.js +++ b/notebook/static/tree/js/notebooklist.js @@ -47,8 +47,10 @@ define([ } this.selected = []; // 0 => descending, 1 => ascending - this.datetime_sorted = 0; - this.name_sorted = 0; + this.sort_state = { + 'last-modified': 0, + 'sort-name': 0 + }; this._max_upload_size_mb = 25; }; @@ -152,44 +154,35 @@ define([ } }); - $('#button-last-modified').click(function (e) { - // If the list is not currently sorted or is sorted in - // descending order, then sort it on ascending order - if (that.datetime_sorted == 0) { - that.sort_datetime(1); - $("#button-last-modified i").removeClass("fa-arrow-up"); - $("#button-last-modified i").addClass("fa-arrow-down"); - that.datetime_sorted = 1; - } else { - // Otherwise sort the list in descending order and set - // the value of datetime_sorted appropriately - that.sort_datetime(2); - $("#button-last-modified i").removeClass("fa-arrow-down"); - $("#button-last-modified i").addClass("fa-arrow-up"); - that.datetime_sorted = 0; - } - }); + $('.sort-action').click(function(e) { + var sort_on = e.target.id; - $('#button-sort-name').click(function (e) { - // If the list is not currently sorted or is sorted in - // descending order, then sort it on ascending order - if (that.name_sorted == 0) { - that.sort_name(1); - $("#button-sort-name i").removeClass("fa-arrow-up"); - $("#button-sort-name i").addClass("fa-arrow-down"); - that.name_sorted = 1; + if (that.sort_state.sort_on == 0) { + that.sort_list(sort_on, 1); + $(sort_on + " i").removeClass("fa-arrow-up"); + $(sort_on + " i").addClass("fa-arrow-down"); + that.sort_state.sort_on = 1; } else { - // Otherwise sort the list in descending order and set - // the value of datetime_sorted appropriately - that.sort_name(2); - $("#button-sort-name i").removeClass("fa-arrow-down"); - $("#button-sort-name i").addClass("fa-arrow-up"); - that.name_sorted = 0; + that.sort_list(sort_on, 2); + $(sort_on + " i").removeClass("fa-arrow-down"); + $(sort_on + " i").addClass("fa-arrow-up"); + that.sort_state.sort_on = 0; } }); } }; + NotebookList.prototype.sort_list = function(id, order) { + var that = this; + if (id == 'last-modified') { + that.sort_datetime(order); + } else if (id == 'sort-name') { + that.sort_name(order); + } else { + console.log('id provided to sort_list function is invalid.'); + } + }; + NotebookList.prototype.sort_datetime = function(order) { var datetime_sort_helper = function(parent, child, selector) { var items = parent.children(child).sort(function(a, b) { From 0fbe6abedd0b3e93843cabf0e6359b35f1e303c9 Mon Sep 17 00:00:00 2001 From: Safia Abdalla Date: Thu, 14 Jan 2016 21:17:05 -0600 Subject: [PATCH 16/18] Clean up style update on button click code --- notebook/static/tree/js/notebooklist.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/notebook/static/tree/js/notebooklist.js b/notebook/static/tree/js/notebooklist.js index f007b9cd1d..82cb42ddc7 100644 --- a/notebook/static/tree/js/notebooklist.js +++ b/notebook/static/tree/js/notebooklist.js @@ -159,13 +159,13 @@ define([ if (that.sort_state.sort_on == 0) { that.sort_list(sort_on, 1); - $(sort_on + " i").removeClass("fa-arrow-up"); - $(sort_on + " i").addClass("fa-arrow-down"); + $(sort_on + " i").removeClass("fa-arrow-up") + .addClass("fa-arrow-down"); that.sort_state.sort_on = 1; } else { that.sort_list(sort_on, 2); - $(sort_on + " i").removeClass("fa-arrow-down"); - $(sort_on + " i").addClass("fa-arrow-up"); + $(sort_on + " i").removeClass("fa-arrow-down") + .addClass("fa-arrow-up"); that.sort_state.sort_on = 0; } }); From b1d96cad522167f51a38ebff9abfbd6a9722b6a9 Mon Sep 17 00:00:00 2001 From: Safia Abdalla Date: Thu, 14 Jan 2016 21:29:57 -0600 Subject: [PATCH 17/18] Updated class switch command --- notebook/static/tree/js/notebooklist.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/notebook/static/tree/js/notebooklist.js b/notebook/static/tree/js/notebooklist.js index 82cb42ddc7..54e9e153df 100644 --- a/notebook/static/tree/js/notebooklist.js +++ b/notebook/static/tree/js/notebooklist.js @@ -159,13 +159,11 @@ define([ if (that.sort_state.sort_on == 0) { that.sort_list(sort_on, 1); - $(sort_on + " i").removeClass("fa-arrow-up") - .addClass("fa-arrow-down"); + $("#" + sort_on + " i").switchClass("fa-arrow-up", "fa-arrow-down"); that.sort_state.sort_on = 1; } else { that.sort_list(sort_on, 2); - $(sort_on + " i").removeClass("fa-arrow-down") - .addClass("fa-arrow-up"); + $("#" + sort_on + " i").switchClass("fa-arrow-down", "fa-arrow-up"); that.sort_state.sort_on = 0; } }); From 309b15bda8344898c579267669e4ed28202497b2 Mon Sep 17 00:00:00 2001 From: Safia Abdalla Date: Fri, 15 Jan 2016 10:24:35 -0600 Subject: [PATCH 18/18] Added button arrow reset on refresh --- notebook/static/tree/js/notebooklist.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/notebook/static/tree/js/notebooklist.js b/notebook/static/tree/js/notebooklist.js index 54e9e153df..79e2b822cc 100644 --- a/notebook/static/tree/js/notebooklist.js +++ b/notebook/static/tree/js/notebooklist.js @@ -66,6 +66,8 @@ define([ NotebookList.prototype.bind_events = function () { var that = this; $('#refresh_' + this.element_name + '_list').click(function () { + $("#sort-name i").switchClass("fa-arrow-down", "fa-arrow-up"); + $("#last-modified i").switchClass("fa-arrow-down", "fa-arrow-up"); that.load_sessions(); }); this.element.bind('dragover', function () {