Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export folders #756

Merged
merged 1 commit into from
Aug 14, 2016
Merged

Export folders #756

merged 1 commit into from
Aug 14, 2016

Conversation

alchzh
Copy link
Contributor

@alchzh alchzh commented Aug 13, 2016

I was sleep drunk when I slapped this together so it probably needs some cleaning up but it works...

not that I didn't add import to folder because you can just append it to restore all...

Folder view

Export view

var buf = '';
for (var i = 0, len = Storage.teams.length; i < len; i++) {
var team = Storage.teams[i];
if ((folder.indexOf("/") && team.folder === folder.slice(0, -1)) || team.format === folder) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

folder.indexOf("/") and folder.slice(0, -1) are weird things to do in an inner loop.

Not to mention folder.indexOf("/") should probably be folder.slice(-1) === '/'

@alchzh
Copy link
Contributor Author

alchzh commented Aug 13, 2016

@Zarel is this good now?

cleaned up messy if statement and squashed commits

@@ -404,6 +409,8 @@

if (window.nodewebkit) {
buf += '<button name="revealFolder" class="button"><i class="fa fa-folder-open"></i> Reveal teams folder</button> <button name="reloadTeamsFolder" class="button"><i class="fa fa-refresh"></i> Reload teams files</button> <button name="backup" class="button"><i class="fa fa-upload"></i> Backup/Restore all teams</button>';
} else if (this.curFolder) {
buf += '<button name="backup" class="button"><i class="fa fa-upload"></i> Backup all teams from this folder</button>';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe still have a Backup all teams button under it or something?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess that would be ambiguous. This is fine.

@Zarel
Copy link
Member

Zarel commented Aug 14, 2016

Sounds good. Can you confirm you want it (and all your future contributions to Pokémon Showdown) released under the MIT license?

@Zarel Zarel merged commit 95adc89 into smogon:master Aug 14, 2016
@alchzh
Copy link
Contributor Author

alchzh commented Aug 14, 2016

MIT license is good

@alchzh
Copy link
Contributor Author

alchzh commented Aug 14, 2016

I just realized that this doesn't work with the (uncategorized) or genN folders... should I remove the button from those or add more code to make it work. I don't see much reason to export those anyways...

@Zarel
Copy link
Member

Zarel commented Aug 14, 2016

I'd say remove the button from those.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants