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

[NEW] Adds drag-and-drop on sidebar #539

Merged
merged 2 commits into from
Sep 16, 2017

Conversation

vcapretz
Copy link
Contributor

@vcapretz vcapretz commented Sep 13, 2017

@RocketChat/DesktopApp

Closes #214

this feature introduce the option to drag and drop servers on sidebar, it uses localstorage to save it so when you open the app again it should keep the order

it allows you to reorder it and then saves it using localstorage
localStorage.setItem(this.sortOrderKey, JSON.stringify(this.sortOrder));

const url = sideBarElement.dataset.host;
const host = { url, title: sideBarElement.querySelector('div.tooltip').innerHTML };
Copy link
Contributor

Choose a reason for hiding this comment

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

We should add the active class to the selected server as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done! it should be after recreating the servers on the sidebar, so I put it on the end of the drop listener

});
Object.values(servers.hosts)
.sort((a, b) => {
const orderA = this.sortOrder.indexOf(a.url);
Copy link
Contributor

@gdelavald gdelavald Sep 13, 2017

Choose a reason for hiding this comment

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

No need for consts here IMO, just return the values.

@rodrigok
Copy link
Member

@vcapretz can you post a gif showing the feature?

@vcapretz
Copy link
Contributor Author

@rodrigok added on the the first comment!

when dropping the dragged server on the final position it should be set as the active one
@gdelavald gdelavald merged commit aa9cd3f into RocketChat:develop Sep 16, 2017
gdelavald pushed a commit that referenced this pull request Oct 27, 2017
* Adds drag-and-drop on sidebar

it allows you to reorder it and then saves it using localstorage

* Set active to the dragged server

when dropping the dragged server on the final position it should be set as the active one
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.

Allow drag and drop reordering of rocket.chat servers
3 participants