Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: stefanogualdi/Filemanager
base: da46c15b1e
...
head fork: stefanogualdi/Filemanager
compare: b15a6b10ed
Checking mergeability… Don't worry, you can still create the pull request.
  • 5 commits
  • 1 file changed
  • 0 commit comments
  • 2 contributors
Showing with 21 additions and 8 deletions.
  1. +21 −8 scripts/filemanager.js
View
29 scripts/filemanager.js
@@ -64,6 +64,18 @@ var displayPath = function(path) {
return path;
}
+// Set the view buttons state
+var setViewButtonsFor = function(viewMode) {
+ if (viewMode == 'grid') {
+ $('#grid').addClass('ON');
+ $('#list').removeClass('ON');
+ }
+ else {
+ $('#list').addClass('ON');
+ $('#grid').removeClass('ON');
+ }
+}
+
// Test if a given url exists
function file_exists (url) {
// http://kevin.vanzonneveld.net
@@ -653,7 +665,7 @@ var getFolderInfo = function(path){
for(key in data){
var props = data[key]['Properties'];
- cap_classes = "";
+ var cap_classes = "";
for (cap in capabilities) {
if (has_capability(data[key], capabilities[cap])) {
cap_classes += " cap_" + capabilities[cap];
@@ -681,6 +693,7 @@ var getFolderInfo = function(path){
for(key in data){
var path = data[key]['Path'];
var props = data[key]['Properties'];
+ var cap_classes = "";
for (cap in capabilities) {
if (has_capability(data[key], capabilities[cap])) {
cap_classes += " cap_" + capabilities[cap];
@@ -785,7 +798,7 @@ var populateFileTree = function(path, callback){
if(data) {
result += "<ul class=\"jqueryFileTree\" style=\"display: none;\">";
for(key in data) {
- cap_classes = "";
+ var cap_classes = "";
for (cap in capabilities) {
if (has_capability(data[key], capabilities[cap])) {
cap_classes += " cap_" + capabilities[cap];
@@ -841,24 +854,24 @@ $(function(){
// Set initial view state.
$('#fileinfo').data('view', defaultViewMode);
-
+ setViewButtonsFor(defaultViewMode);
+
$('#home').click(function(){
- $('#fileinfo').data('view', 'grid');
+ var currentViewMode = $('#fileinfo').data('view');
+ $('#fileinfo').data('view', currentViewMode);
$('#filetree>ul>li.expanded>a').trigger('click');
getFolderInfo(fileRoot);
});
// Set buttons to switch between grid and list views.
$('#grid').click(function(){
- $(this).addClass('ON');
- $('#list').removeClass('ON');
+ setViewButtonsFor('grid');
$('#fileinfo').data('view', 'grid');
getFolderInfo($('#currentpath').val());
});
$('#list').click(function(){
- $(this).addClass('ON');
- $('#grid').removeClass('ON');
+ setViewButtonsFor('list');
$('#fileinfo').data('view', 'list');
getFolderInfo($('#currentpath').val());
});

No commit comments for this range

Something went wrong with that request. Please try again.