Closed ericfranz closed 8 years ago
I'm having a lot of trouble persisting this.
I have tried using cookies to store the user's choice, but attempting to access the cookie data from inside the module where the file sorting takes place breaks the Node preprocessor and Nginx responds with a 502 error.
Calling a [panel].refresh()
resets the button bar and wipes the checked value from the checkbox. Adding an onload()
listener that sets the checkbox only works on the initial app load, but it clears the value and doesn't fire again after a JSON load.
The app currently uses a .cloudcmd.json
file for settings that's stored in the user's homedir. I will probably need to figure out how to extend that file and use whatever accessor methods are available to manipulate it.
There is an alternative approach that will shift the complexity elsewhere but may be preferable:
.dotfile { display: none
and .showdotfiles .dotfile { display: block }
(or whatever the normal display value is for the row)Finally, when storing cookies, there is a cookies js file I am using in OD2 that is probably appropriate to continue to use in OD3. It is code pulled from MDN and works well.
example:
docCookies.setItem(name, value[, end[, path[, domain[, secure]]]])
docCookies.getItem(name)
docCookies.removeItem(name[, path])
docCookies.hasItem(name)
docCookies.keys()
This approach would make it so that 100% of the modifications for this are client side. We could do the same thing with the hide/show columns.
I'm already doing a lot of this. I will still have difficulty resetting that check-box on JSON reload.
Using class names might work for sorting, but will probably break arrow key and select functionality since those work by reading the DOM. (i.e. Hiding files to the user won't hide them to the app)
Also I included jQuery 1.12 in my tree solution so its available to use via jQuery12
if that will make life easier.
https://api.jquery.com/visible-selector/
and
.files li.dotfile {
display: none;
}
to hide. Also, add jquery like this by copying this block:
In a separate commit we can remove the CDN reference. This way when you merge and I merge there should be no conflict.
Changes to cloudfunc.js I took: lib/cloudfunc.js
// OSC_CUSTOM_CODE hide all dot files unless cookie is set based on checkbox
// TODO figure out how to access the cookies here and disable this block when we want to show dotfiles
// right now this is loading before the page is done...
- files = files.filter(function(value) {
- return value.name.charAt(0) !== '.';
- });
-
+
+
+ var isDotfile = file.name.charAt(0) == ".";
+
if (file.size === 'dir') {
fileTable += rendy(templateFile, {
tag : 'li',
attribute : attribute,
- className : '',
+ className : isDotfile ? 'dotfile' : '',
This should just be: