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

Fix menu when gitlab is enabled #1041

Merged
merged 2 commits into from Nov 7, 2018

Conversation

Projects
None yet
2 participants
@micedre
Contributor

micedre commented Nov 7, 2018

When gitlab is enabled with scope API, the menu Export/Import Snippets is not displayed.
This is because gitlab var stay indefined in public/views/codimd/header.ejs.

The fix here is to add a var enableGitlabSnippets and then use it in header.ejs.

Fix menu when gitlab is enabled
Signed-off-by: Cédric Couralet <cedric.couralet@gmail.com>
@SISheogorath

Some minor changes :)

Thanks a lot for your work 👍

app.js Outdated
@@ -198,6 +198,7 @@ app.locals.authProviders = {
email: config.isEmailEnable,
allowEmailRegister: config.allowEmailRegister
}
app.locals.enableGitlabSnippets = (!config.gitlab.scope || config.gitlab.scope === 'api')

This comment has been minimized.

@SISheogorath

SISheogorath Nov 7, 2018

Member

Can we move the (!config.gitlab.scope || config.gitlab.scope === 'api')-part to ./lib/config/index.js?

@@ -32,7 +32,7 @@
</li>
<li role="presentation"><a role="menuitem" class="ui-extra-slide" tabindex="-1" href="#" target="_blank" rel="noopener"><i class="fa fa-tv fa-fw"></i> <%= __('Slide Mode') %></a>
</li>
<% if((typeof github !== 'undefined' && github) || (typeof dropbox !== 'undefined' && dropbox) || (typeof gitlab !== 'undefined' && gitlab && (!gitlab.scope || gitlab.scope === 'api'))) { %>
<% if((typeof github !== 'undefined' && github) || (typeof dropbox !== 'undefined' && dropbox) || enableGitlabSnippets) { %>

This comment has been minimized.

@SISheogorath

SISheogorath Nov 7, 2018

Member

And can you fix github and dropbox along the line, since they'll definitely break as well.

@micedre

This comment has been minimized.

Contributor

micedre commented Nov 7, 2018

Done, is it what you had in mind?
I can't test github or dropbox in my environment (only that the menu are here).

@SISheogorath

Was exactly what I had it mind! Thanks a lot!

One final change, which is style related

@@ -134,16 +134,16 @@
</li>
<li role="presentation"><a role="menuitem" class="ui-extra-slide" tabindex="-1" href="#" target="_blank" rel="noopener"><i class="fa fa-tv fa-fw"></i> <%= __('Slide Mode') %></a>
</li>
<% if((typeof github !== 'undefined' && github) || (typeof dropbox !== 'undefined' && dropbox) || (typeof gitlab !== 'undefined' && gitlab && (!gitlab.scope || gitlab.scope === 'api'))) { %>
<% if(enableGitHubGist || enableDropBoxSave || enableGitlabSnippets ) { %>

This comment has been minimized.

@SISheogorath

SISheogorath Nov 7, 2018

Member

Just a minor formatting hint: Could you please remove the space in front of the )? 😉

This comment has been minimized.

@micedre

micedre Nov 7, 2018

Contributor

sure !

Fix menu for github and dropbox
Signed-off-by: Cédric Couralet <cedric.couralet@gmail.com>
@SISheogorath

This comment has been minimized.

Member

SISheogorath commented Nov 7, 2018

Nice work!

@SISheogorath SISheogorath merged commit 4e5e7df into hackmdio:master Nov 7, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment