Fix markitup & two small improvements (#424)

* Generate a compare link for preview release notes

* Fix typo on cron message

* Fix markitup functionality
This commit is contained in:
Belle Aerni authored and GitHub committed 2022-11-04 00:20:49 -07:00
1 parent 3152d67aee
commit c71f17fd56
6 files changed
+50 -31

No files matched your search

+2 -1
View File
@@ -59,7 +59,8 @@ class Box_Update
public function getLatestReleaseNotes()
{
if($this->getUpdateBranch() === "preview"){
return "Release notes are not available for preview builds. You can check the latest changes on our [Github](https://github.com/FOSSBilling/FOSSBilling/commits/main)";
$compareLink = 'https://github.com/FOSSBilling/FOSSBilling/compare/' . $this->getLatestVersion() . '...main';
return "Release notes are not available for preview builds. You can check the latest changes on our [Github]($compareLink)";
}
$response = $this->_getLatestVersionInfo();
+3 -3
View File
@@ -247,14 +247,14 @@ class Service
$disableAutoCron = $this->di['config']['disable_auto_cron'] ?? false;
if (false === $runFromTest && false === $disableAutoCron) {
if (!$last_exec) {
$msgs['info'][] = 'Cron was never executed. FOSSBilling will automatically execute cron when you access the admin panel, but you should make sure you have setup cron the job.';
$msgs['info'][] = 'Cron was never executed. FOSSBilling will automatically execute cron when you access the admin panel, but you should make sure you have setup the cron job.';
$cronService = $this->di['mod_service']('cron');
$cronService->runCrons($interval);
$cronService->runCrons();
} else {
$minSinceLastExec = (time() - strtotime($last_exec)) / 60;
if ($minSinceLastExec >= 15) {
$minSinceLastExec = round($minSinceLastExec, 2);
$msgs['info'][] = 'Cron hasn\'t been executed in ' . $minSinceLastExec . ' minutes. FOSSBilling will automatically execute cron when you access the admin panel, but you should make sure you have setup cron the job.';
$msgs['info'][] = 'Cron hasn\'t been executed in ' . $minSinceLastExec . ' minutes. FOSSBilling will automatically execute cron when you access the admin panel, but you should make sure you have setup the cron job.';
$cronService = $this->di['mod_service']('cron');
$cronService->runCrons();
error_log("Cron hasn't been run in $minSinceLastExec minutes. Manually executing.");
@@ -9,22 +9,38 @@
// ----------------------------------------------------------------------------
// Basic set. Feel free to add more tags
// ----------------------------------------------------------------------------
var mySettings = {
onShiftEnter: {keepDefault:false, replaceWith:'<br />\n'},
onCtrlEnter: {keepDefault:false, openWith:'\n<p>', closeWith:'</p>'},
onTab: {keepDefault:false, replaceWith:' '},
markupSet: [
{name:'Bold', key:'B', openWith:'(!(<strong>|!|<b>)!)', closeWith:'(!(</strong>|!|</b>)!)' },
{name:'Italic', key:'I', openWith:'(!(<em>|!|<i>)!)', closeWith:'(!(</em>|!|</i>)!)' },
{name:'Stroke through', key:'S', openWith:'<del>', closeWith:'</del>' },
{separator:'---------------' },
{name:'Bulleted List', openWith:' <li>', closeWith:'</li>', multiline:true, openBlockWith:'<ul>\n', closeBlockWith:'\n</ul>'},
{name:'Numeric List', openWith:' <li>', closeWith:'</li>', multiline:true, openBlockWith:'<ol>\n', closeBlockWith:'\n</ol>'},
{separator:'---------------' },
{name:'Picture', key:'P', replaceWith:'<img src="[![Source:!:http://]!]" alt="[![Alternative text]!]" />' },
{name:'Link', key:'L', openWith:'<a href="[![Link:!:http://]!]"(!( title="[![Title]!]")!)>', closeWith:'</a>', placeHolder:'Your text to link...' },
{separator:'---------------' },
{name:'Clean', className:'clean', replaceWith:function(markitup) { return markitup.selection.replace(/<(.*?)>/g, "") } },
{name:'Preview', className:'preview', call:'preview'}
]
function returnSettings(assetPath){
var mySettings = {
previewParser: function(content) {
var r = '';
$.ajax({
url: $('meta[property="bb:client_area"]').attr("content") + 'preview/markdown',
data: {content: content},
type: "POST",
success: function(data){ r = data; },
async: false
});
return r;
},
onShiftEnter: {keepDefault:false, openWith:'\n\n'},
onTab: {keepDefault:false, replaceWith:' '},
markupSet: [
{name:'Bold', key:'B', openWith:'**', closeWith:'**'},
{name:'Italic', key:'I', openWith:'_', closeWith:'_'},
{name:'Stroke through', key:'S', openWith:'~~~', closeWith:'~~~' },
{separator:'---------------' },
{name:'Bulleted List', openWith:'- '},
{name:'Numeric List', openWith:function(markItUp) {
return markItUp.line+'. ';
}},
{separator:'---------------' },
{name:'Picture', key:'P', replaceWith:'![[![Alternative text]!]]([![Url:!:http://]!])'},
{name:'Link', key:'L', openWith:'[', closeWith:']([![Url:!:http://]!])', placeHolder:'Your text to link here...'},
{separator:'---------------' },
{name:'Clean', className:'clean', replaceWith:function(markitup) { return markitup.selection.replace(/<(.*?)>/g, "") } },
{name:'Preview', className:'preview', call:'preview'}
],
previewTemplatePath: assetPath
}
return mySettings;
}
@@ -1,5 +0,0 @@
/* preview style examples */
body {
background-color:#EFEFEF;
font:70% Verdana, Arial, Helvetica, sans-serif;
}
@@ -3,7 +3,13 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>markItUp! preview template</title>
<link rel="stylesheet" type="text/css" href="~/templates/preview.css" />
<style>
/* preview style examples */
body {
background-color:#EFEFEF;
font:70% Verdana, Arial, Helvetica, sans-serif;
}
</style>
</head>
<body>
<!-- content -->
@@ -1,11 +1,12 @@
{% set bb_editor = admin.wysiwyg_editor %}
{% if bb_editor == 'markitup' %}
{{ 'markitup/skins/boxbilling/style.css' | mod_asset_url('wysiwyg') | stylesheet_tag }}
{{ 'markitup/sets/markdown/style.css' | mod_asset_url('wysiwyg') | stylesheet_tag }}
{{ 'markitup/skins/simple/style.css' | mod_asset_url('wysiwyg') | stylesheet_tag }}
{{ 'markitup/sets/default/style.css' | mod_asset_url('wysiwyg') | stylesheet_tag }}
{{ 'markitup/jquery.markitup.js' | mod_asset_url('wysiwyg') | script_tag }}
{{ 'markitup/sets/markdown/set.js' | mod_asset_url('wysiwyg') | script_tag }}
{{ 'markitup/sets/default/set.js' | mod_asset_url('wysiwyg') | script_tag }}
<script type="text/javascript" >
var mySettings = returnSettings( "{{ 'markitup/templates/preview.html' | mod_asset_url('wysiwyg')}}" );
$(document).ready(function() {
$(".{{class}}").markItUp(mySettings);
});