Skip to content

Commit 67f8a64

Browse files
committed
Fix menu for github and dropbox
Signed-off-by: Cédric Couralet <[email protected]>
1 parent d24fb48 commit 67f8a64

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

app.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,11 @@ app.locals.authProviders = {
198198
email: config.isEmailEnable,
199199
allowEmailRegister: config.allowEmailRegister
200200
}
201-
app.locals.enableGitlabSnippets = (!config.gitlab.scope || config.gitlab.scope === 'api')
201+
202+
// Export/Import menu items
203+
app.locals.enableDropBoxSave = config.isDropboxEnable
204+
app.locals.enableGitHubGist = config.isGitHubEnable
205+
app.locals.enableGitlabSnippets = config.isGitlabSnippetsEnable
202206

203207
app.use(require('./lib/web/baseRouter'))
204208
app.use(require('./lib/web/statusRouter'))

lib/config/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ if (config.gitlab && config.gitlab.version !== 'v4' && config.gitlab.version !==
110110
logger.warn('config.js contains wrong version (' + config.gitlab.version + ') for gitlab api; it should be \'v3\' or \'v4\'. Defaulting to v4')
111111
config.gitlab.version = 'v4'
112112
}
113+
// If gitlab scope is api, enable snippets Export/import
114+
config.isGitlabSnippetsEnable = (!config.gitlab.scope || config.gitlab.scope === 'api')
113115

114116
// Only update i18n files in development setups
115117
config.updateI18nFiles = (env === Environment.development)

public/views/codimd/header.ejs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@
3232
</li>
3333
<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>
3434
</li>
35-
<% if((typeof github !== 'undefined' && github) || (typeof dropbox !== 'undefined' && dropbox) || enableGitlabSnippets) { %>
35+
<% if(enableGitHubGist || enableDropBoxSave || enableGitlabSnippets) { %>
3636
<li class="divider"></li>
3737
<li class="dropdown-header"><%= __('Export') %></li>
3838
<li role="presentation"><a role="menuitem" class="ui-save-dropbox" tabindex="-1" href="#" target="_self"><i class="fa fa-dropbox fa-fw"></i> Dropbox</a>
3939
</li>
40-
<% if(typeof github !== 'undefined' && github) { %>
40+
<% if(enableGitHubGist) { %>
4141
<li role="presentation"><a role="menuitem" class="ui-save-gist" tabindex="-1" href="#" target="_blank" rel="noopener"><i class="fa fa-github fa-fw"></i> Gist</a>
4242
</li>
4343
<% } %>
@@ -134,12 +134,12 @@
134134
</li>
135135
<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>
136136
</li>
137-
<% if((typeof github !== 'undefined' && github) || (typeof dropbox !== 'undefined' && dropbox) || enableGitlabSnippets ) { %>
137+
<% if(enableGitHubGist || enableDropBoxSave || enableGitlabSnippets) { %>
138138
<li class="divider"></li>
139139
<li class="dropdown-header"><%= __('Export') %></li>
140140
<li role="presentation"><a role="menuitem" class="ui-save-dropbox" tabindex="-1" href="#" target="_self"><i class="fa fa-dropbox fa-fw"></i> Dropbox</a>
141141
</li>
142-
<% if(typeof github !== 'undefined' && github) { %>
142+
<% if(enableGitHubGist) { %>
143143
<li role="presentation"><a role="menuitem" class="ui-save-gist" tabindex="-1" href="#" target="_blank" rel="noopener"><i class="fa fa-github fa-fw"></i> Gist</a>
144144
</li>
145145
<% } %>

0 commit comments

Comments
 (0)