diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2013-07-22 18:44:54 +0200 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2013-07-22 18:44:54 +0200 |
commit | d6bc45cd39d82f4d5412055a018371b56351e2f5 (patch) | |
tree | 6b048acf902a27f613b598149c403456292dae87 /pyload/web/app | |
parent | guess media types by name (diff) | |
download | pyload-d6bc45cd39d82f4d5412055a018371b56351e2f5.tar.xz |
implemented media type filter
Diffstat (limited to 'pyload/web/app')
4 files changed, 25 insertions, 5 deletions
diff --git a/pyload/web/app/scripts/views/dashboard/filterView.js b/pyload/web/app/scripts/views/dashboard/filterView.js index ad72cf926..736b740e1 100644 --- a/pyload/web/app/scripts/views/dashboard/filterView.js +++ b/pyload/web/app/scripts/views/dashboard/filterView.js @@ -31,7 +31,10 @@ define(['jquery', 'backbone', 'underscore', 'app', 'utils/apitypes', 'models/Pac }, template: template, + // Visible dl state state: null, + // bit mask of filtered, thus not visible media types + types: 0, initialize: function() { this.state = Api.DownloadState.All; @@ -120,6 +123,10 @@ define(['jquery', 'backbone', 'underscore', 'app', 'utils/apitypes', 'models/Pac // determine if a file should be visible // TODO: non download files is_visible: function(file) { + // bit is set -> not visible + if (file.get('media') & this.types) + return false; + if (this.state === Api.DownloadState.Finished) return file.isFinished(); else if (this.state === Api.DownloadState.Unfinished) @@ -140,7 +147,20 @@ define(['jquery', 'backbone', 'underscore', 'app', 'utils/apitypes', 'models/Pac }, filter_type: function(e) { + var el = $(e.target); + var type = parseInt(el.data('type')); + + // Bit is already set, so type is not visible, will become visible now + if (type & this.types) { + el.find('i').removeClass('icon-remove').addClass('icon-ok'); + } else { // type will be hidden + el.find('i').removeClass('icon-ok').addClass('icon-remove'); + } + this.types ^= type; + + this.apply_filter(); + return false; } }); diff --git a/pyload/web/app/scripts/views/headerView.js b/pyload/web/app/scripts/views/headerView.js index 2c83fb381..b4ffbc35d 100644 --- a/pyload/web/app/scripts/views/headerView.js +++ b/pyload/web/app/scripts/views/headerView.js @@ -144,7 +144,6 @@ define(['jquery', 'underscore', 'backbone', 'app', 'models/ServerStatus', 'colle // Render progressbar only when needed if (!_.isEqual([data.tasks, data.downloads], this.lastStatus)) { - console.log('render bar'); this.lastStatus = [data.tasks, data.downloads]; this.$('#progress-info').html(templateProgress(data)); } else { diff --git a/pyload/web/app/templates/default/dashboard/actionbar.html b/pyload/web/app/templates/default/dashboard/actionbar.html index a8b2ebecd..ad9a1278d 100644 --- a/pyload/web/app/templates/default/dashboard/actionbar.html +++ b/pyload/web/app/templates/default/dashboard/actionbar.html @@ -31,8 +31,9 @@ <li><a class="filter-type" data-type="4" href="#"><i class="icon-ok"></i> Image</a></li> <li><a class="filter-type" data-type="8" href="#"><i class="icon-ok"></i> Video</a></li> <li><a class="filter-type" data-type="16" href="#"><i class="icon-ok"></i> Document</a></li> - <li><a class="filter-type" data-type="32" href="#"><i class="icon-remove"></i> Archive</a></li> - <li><a class="filter-type" data-type="1" href="#"><i class="icon-remove"></i> Other</a></li> + <li><a class="filter-type" data-type="32" href="#"><i class="icon-ok"></i> Archive</a></li> + <li><a class="filter-type" data-type="64" href="#"><i class="icon-ok"></i> Executable</a></li> + <li><a class="filter-type" data-type="1" href="#"><i class="icon-ok"></i> Other</a></li> </ul> </li> <li class="dropdown" style="float: right;"> diff --git a/pyload/web/app/templates/default/dashboard/package.html b/pyload/web/app/templates/default/dashboard/package.html index 0f2496046..83f4fa39e 100644 --- a/pyload/web/app/templates/default/dashboard/package.html +++ b/pyload/web/app/templates/default/dashboard/package.html @@ -9,8 +9,8 @@ <div class="package-frame"> <div class="tag-area"> - <span class="badge badge-success"><i class="icon-tag"></i>video</span> - <span class="badge badge-success badge-ghost"><i class="icon-tag"></i> Add Tag</span> + <!--<span class="badge badge-success"><i class="icon-tag"></i>video</span>--> + <!--<span class="badge badge-success badge-ghost"><i class="icon-tag"></i> Add Tag</span>--> </div> <div class="package-indicator"> <i class="icon-plus-sign btn-move" data-toggle="tooltip" title="Move files here"></i> |