summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCédric Couralet2018-11-07 12:12:50 +0000
committerCédric Couralet2018-11-07 12:30:17 +0000
commit67f8a64f2b1ea653b567a48ac6aa760b03c7189c (patch)
tree874d45a71b209e8e598e4568784e364b96d28678
parentd24fb48f16bff4d0e6b1bfdeffd2b41c7e61a347 (diff)
Fix menu for github and dropbox
Signed-off-by: Cédric Couralet <cedric.couralet@gmail.com>
-rw-r--r--app.js6
-rw-r--r--lib/config/index.js2
-rw-r--r--public/views/codimd/header.ejs8
3 files changed, 11 insertions, 5 deletions
diff --git a/app.js b/app.js
index 50b61226..622d866f 100644
--- a/app.js
+++ b/app.js
@@ -198,7 +198,11 @@ app.locals.authProviders = {
email: config.isEmailEnable,
allowEmailRegister: config.allowEmailRegister
}
-app.locals.enableGitlabSnippets = (!config.gitlab.scope || config.gitlab.scope === 'api')
+
+// Export/Import menu items
+app.locals.enableDropBoxSave = config.isDropboxEnable
+app.locals.enableGitHubGist = config.isGitHubEnable
+app.locals.enableGitlabSnippets = config.isGitlabSnippetsEnable
app.use(require('./lib/web/baseRouter'))
app.use(require('./lib/web/statusRouter'))
diff --git a/lib/config/index.js b/lib/config/index.js
index f8b68e30..501fdca3 100644
--- a/lib/config/index.js
+++ b/lib/config/index.js
@@ -110,6 +110,8 @@ if (config.gitlab && config.gitlab.version !== 'v4' && config.gitlab.version !==
logger.warn('config.js contains wrong version (' + config.gitlab.version + ') for gitlab api; it should be \'v3\' or \'v4\'. Defaulting to v4')
config.gitlab.version = 'v4'
}
+// If gitlab scope is api, enable snippets Export/import
+config.isGitlabSnippetsEnable = (!config.gitlab.scope || config.gitlab.scope === 'api')
// Only update i18n files in development setups
config.updateI18nFiles = (env === Environment.development)
diff --git a/public/views/codimd/header.ejs b/public/views/codimd/header.ejs
index 56a42eb4..b83838ea 100644
--- a/public/views/codimd/header.ejs
+++ b/public/views/codimd/header.ejs
@@ -32,12 +32,12 @@
</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) || enableGitlabSnippets) { %>
+ <% if(enableGitHubGist || enableDropBoxSave || enableGitlabSnippets) { %>
<li class="divider"></li>
<li class="dropdown-header"><%= __('Export') %></li>
<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>
</li>
- <% if(typeof github !== 'undefined' && github) { %>
+ <% if(enableGitHubGist) { %>
<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>
</li>
<% } %>
@@ -134,12 +134,12 @@
</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) || enableGitlabSnippets ) { %>
+ <% if(enableGitHubGist || enableDropBoxSave || enableGitlabSnippets) { %>
<li class="divider"></li>
<li class="dropdown-header"><%= __('Export') %></li>
<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>
</li>
- <% if(typeof github !== 'undefined' && github) { %>
+ <% if(enableGitHubGist) { %>
<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>
</li>
<% } %>