Closed AnthyG closed 7 years ago
Should I also merge the search-feature-Branch of mine into my master? Or shall I just do a new pull-request for that ❔
Maybe do a different pull request for that - I'm not sure. I've never collaborated on any projects before. I would say a different one so that we keep pull requests for different features separate. What do you think is best?
Yes, I agree with that 👍
I would then recommend, to create a backup of your Zites directory, as I deleted some important files like the Zites content.json
.
I will create the other pull-request, when you merge this one.
I'm currently seeing a bug where the zites don't load until I sign the content.json file - but when I refresh, I have to resign it to load the zites again. There also seems to be a problem with the tabClick function. I am looking into these things right now.
I'm getting an error on the "this.cmd()" function call in the loadZites() function saying that "this" is undefined.
I'll fix that very quick (the "this"-problem).
I don't know, what the bug with the Zites not loading is.. But I also have that problem with the tabClick-Function, resulting in entries not getting hidden, when a tab is clicked 😞
How would I commit changes on this pull request? Is that allowed? I haven't used pull requests all that much before.
I honestly don't know.. 🤔 You'd probably either have to edit it after merging, or fork my fork, edit it, do a pull-request, I accept it, and it appears here.. 😆
I'm not an git-expert either, so I can't really tell...
Oh, it seems, I deleted an if-statement that I didn't replace..: https://github.com/krixano/ImportantZites/blob/master/index.html#L258
Any more issues/ errors/ mistakes?
The entries don't seem to get hidden, when another tab is selected 💢
Oh well, that's because I am not in ZeroNet..
Now I'm getting an unexpected token }
error when clicking on a tab, but it doesn't tell me the line it's on
Do you get it, when you just load the Zite? Or does it happen, when you do a specific action :?
When clicking on a tab
I'll just add ;
everywhere..
Not expecting it to be fixed though.
Well that took some time, I don't really know why..
Also fixed a little thing, where I forgot to escape the '
Two more issues:
I'll look into this.. today.. but like in 14+h :laughing: (or earlier, if I can)
I found out how I can also commit changes on this pull request. Basically, I was able to commit and push directly to your fork because you forked my repository. You can find out more about it here: https://help.github.com/articles/committing-changes-to-a-pull-request-branch-created-from-a-fork/
So now, one last bug to solve - the "All" tab isn't set as not active when clicking on another tab.
Today I won't be much at home, but as far as I checked the code from my phone, everything should be fine, so I don't know what keeps the "All"-Tab from not hiding >:/
When doing this (I have to do it, as I'm not able to clone the Zite), tab-changing works just fine 🤔
getCategoriesList(cb) {
if (typeof cb === "function")
cb([{
"name": "info"
}])
// page.cmd("dbQuery", ["SELECT * FROM categories"], (cats) => {
// if (typeof cb === "function")
// cb(cats);
// })
}
Have you changed the
... Has to be, as you can obviously see the category-tabs 😅data/data.json
-Files category-property category_name
to name
, and reloaded and rebuilt your Database?
Another thing, redoing a database query for each tab click to get the categories seems inefficient (and will lag older computers - like mine for example), so we should cache the categories in a variable. Then, in the getCategories function, check if the variable is not null and call the callback with it as parameter, and if it is null, do the database query and store the categories in the variable so that next time the function is called, the variable will not be null (and will be directly given to the callback without having to do another query).
Maybe select it when the document is ready?
Either document.onready = function(){...}
, or a self-executing function (function(){...})
No, that didn't work. Two things I noticed:
toggleClass(document.getElementById('allTab'), "is-active")
in the onOpenWebsocket
function right before the categories are loaded does toggle the class on the allTab element.previousActiveTab = document.getElementById('allTab');
in the onOpenWebsocket
function right before the categories are loaded doesn't fix anything.I think this could mean that it has something to do with the variable itself, and not the document.getElementById('allTab')
part.
But, the variable works for all of the other tabs and for the all tab only after another tab has been selected at least once.
Then maybe triggering a click-event on the all tab fixes it?
..That's bullsh*t..
So maybe leaving both of the variables blank at the start, and then calling the tabChange-function with "all"? .. Or doing the thing I said before, that I striked through too?
Lol.
That works. There is just one small thing, though it isn't that big of a deal, which is that it takes like a second for the tab to highlight/select.
@krixano one can't select a tab twice anyways.. so it's technically fixed :laughing:
Okay, so I think I am ready to merge this now.
Yay :tada::smile:
WARNING Dear @krixano, please create a backup of
content.json
anddata/data.json
! Also, you have to change your the name of the propertycategory_name
incategories
of yourdata/data.json
-File toname
, as it is self-explaining that the name is meant to be the categories name.I furthermore recommend doing a backup of the complete Zite, just in case anything goes wrong!
Now to the fun part: The major change coming with this pull-request is the automated loading of the categories, placed in the
data/data.json
-File. This resulted in the removal of many lines and thus, much cleaner code.I also don't want to guarantee the functionality of this code, as I can't verify that it actually works.