summaryrefslogtreecommitdiff
path: root/public
diff options
context:
space:
mode:
Diffstat (limited to 'public')
-rw-r--r--public/js/index.js17
-rw-r--r--public/views/codimd/body.ejs2
-rw-r--r--public/views/index/body.ejs2
3 files changed, 14 insertions, 7 deletions
diff --git a/public/js/index.js b/public/js/index.js
index 6e13fe9c..1330deac 100644
--- a/public/js/index.js
+++ b/public/js/index.js
@@ -970,6 +970,7 @@ ui.toolbar.export.snippet.click(function () {
.done(function (data) {
$('#snippetExportModalAccessToken').val(data.accesstoken)
$('#snippetExportModalBaseURL').val(data.baseURL)
+ $('#snippetExportModalVersion').val(data.version)
$('#snippetExportModalLoading').hide()
$('#snippetExportModal').modal('toggle')
$('#snippetExportModalProjects').find('option').remove().end().append('<option value="init" selected="selected" disabled="disabled">Select From Available Projects</option>')
@@ -1021,6 +1022,7 @@ ui.toolbar.import.snippet.click(function () {
.done(function (data) {
$('#snippetImportModalAccessToken').val(data.accesstoken)
$('#snippetImportModalBaseURL').val(data.baseURL)
+ $('#snippetImportModalVersion').val(data.version)
$('#snippetImportModalContent').prop('disabled', false)
$('#snippetImportModalConfirm').prop('disabled', false)
$('#snippetImportModalLoading').hide()
@@ -1243,10 +1245,10 @@ ui.modal.snippetImportProjects.change(function () {
var accesstoken = $('#snippetImportModalAccessToken').val()
var baseURL = $('#snippetImportModalBaseURL').val()
var project = $('#snippetImportModalProjects').val()
-
+ var version = $('#snippetImportModalVersion').val()
$('#snippetImportModalLoading').show()
$('#snippetImportModalContent').val('/projects/' + project)
- $.get(baseURL + '/api/v3/projects/' + project + '/snippets?access_token=' + accesstoken)
+ $.get(baseURL + '/api/' + version + '/projects/' + project + '/snippets?access_token=' + accesstoken)
.done(function (data) {
$('#snippetImportModalSnippets').find('option').remove().end().append('<option value="init" selected="selected" disabled="disabled">Select From Available Snippets</option>')
data.forEach(function (snippet) {
@@ -1433,7 +1435,7 @@ $('#snippetImportModalConfirm').click(function () {
} else {
ui.spinner.show()
var accessToken = '?access_token=' + $('#snippetImportModalAccessToken').val()
- var fullURL = $('#snippetImportModalBaseURL').val() + '/api/v3' + snippeturl
+ var fullURL = $('#snippetImportModalBaseURL').val() + '/api/' + $('#snippetImportModalVersion').val() + snippeturl
$.get(fullURL + accessToken)
.done(function (data) {
var content = '# ' + (data.title || 'Snippet Import')
@@ -1470,15 +1472,19 @@ $('#snippetImportModalConfirm').click(function () {
$('#snippetExportModalConfirm').click(function () {
var accesstoken = $('#snippetExportModalAccessToken').val()
var baseURL = $('#snippetExportModalBaseURL').val()
+ var version = $('#snippetExportModalVersion').val()
+
var data = {
title: $('#snippetExportModalTitle').val(),
file_name: $('#snippetExportModalFileName').val(),
code: editor.getValue(),
- visibility_level: $('#snippetExportModalVisibility').val()
+ visibility_level: $('#snippetExportModalVisibility').val(),
+ visibility: $('#snippetExportModalVisibility').val() === 0 ? 'private' : ($('#snippetExportModalVisibility').val() === 10 ? 'internal' : '')
}
+
if (!data.title || !data.file_name || !data.code || !data.visibility_level || !$('#snippetExportModalProjects').val()) return
$('#snippetExportModalLoading').show()
- var fullURL = baseURL + '/api/v3/projects/' + $('#snippetExportModalProjects').val() + '/snippets?access_token=' + accesstoken
+ var fullURL = baseURL + '/api/' + version + '/projects/' + $('#snippetExportModalProjects').val() + '/snippets?access_token=' + accesstoken
$.post(fullURL
, data
, function (ret) {
@@ -1487,7 +1493,6 @@ $('#snippetExportModalConfirm').click(function () {
var redirect = baseURL + '/' + $("#snippetExportModalProjects option[value='" + $('#snippetExportModalProjects').val() + "']").text() + '/snippets/' + ret.id
showMessageModal('<i class="fa fa-gitlab"></i> Export to Snippet', 'Export Successful!', redirect, 'View Snippet Here', true)
}
- , 'json'
)
})
diff --git a/public/views/codimd/body.ejs b/public/views/codimd/body.ejs
index b5932a61..d4f27a93 100644
--- a/public/views/codimd/body.ejs
+++ b/public/views/codimd/body.ejs
@@ -153,6 +153,7 @@
<div class="modal-body">
<input type="hidden" id="snippetImportModalAccessToken" />
<input type="hidden" id="snippetImportModalBaseURL" />
+ <input type="hidden" id="snippetImportModalVersion" />
<div class="ui-field-contain" style="display:table;margin-bottom:10px;width:100%;">
<div style="display:table-row;margin-bottom:5px;">
<label style="display:table-cell;">Project:</label>
@@ -191,6 +192,7 @@
<div class="modal-body">
<input type="hidden" id="snippetExportModalAccessToken" />
<input type="hidden" id="snippetExportModalBaseURL" />
+ <input type="hidden" id="snippetExportModalVersion" />
<div class="ui-field-contain" style="display:table;margin-bottom:10px;width:100%;">
<div style="display:table-row;margin-bottom:5px;">
<label style="display:table-cell;">Title:</label>
diff --git a/public/views/index/body.ejs b/public/views/index/body.ejs
index 29fa3181..53dbf2a2 100644
--- a/public/views/index/body.ejs
+++ b/public/views/index/body.ejs
@@ -152,7 +152,7 @@
&copy; 2018 <a href="https://hackmd.io">CodiMD</a> | <a href="<%- url %>/s/release-notes" target="_blank"><%= __('Releases') %></a><% if(privacyStatement) { %> | <a href="<%- url %>/s/privacy" target="_blank"><%= __('Privacy') %></a><% } %><% if(termsOfUse) { %> | <a href="<%- url %>/s/terms-of-use" target="_blank"><%= __('Terms of Use') %></a><% } %>
</p>
<h6 class="social-foot">
- <%- __('Follow us on %s and %s.', '<a href="https://github.com/hackmdio/CodiMD" target="_blank"><i class="fa fa-github"></i> GitHub</a>, <a href="https://twitter.com/hackmdio" target="_blank"><i class="fa fa-twitter"></i> Twitter</a>', '<a href="https://www.facebook.com/hackmdio" target="_blank"><i class="fa fa-facebook-square"></i> Facebook</a>') %>
+ <%- __('Follow us on %s and %s.', '<a href="https://github.com/hackmdio/CodiMD" target="_blank"><i class="fa fa-github"></i> GitHub</a>, <a href="https://riot.im/app/#/room/#codimd:matrix.org" target="_blank"><i class="fa fa-comments"></i> Riot</a>') %>
</h6>
</div>
</div>