Skip to content

Commit

Permalink
Merge pull request #63 from barisusakli/bootstrap5
Browse files Browse the repository at this point in the history
bootstrap5
  • Loading branch information
barisusakli committed Sep 21, 2022
2 parents 5ef99c0 + a30206c commit 1676a03
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 68 deletions.
1 change: 0 additions & 1 deletion lib/dbsearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,6 @@ async function reIndexPids(pids, topic) {
async function renderAdmin(req, res) {
const results = await getGlobalAndPluginData();
results.plugin.progressData = await getProgress();
results.plugin.csrf = req.csrfToken();
res.render('admin/plugins/dbsearch', results.plugin);
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@
"eslint-plugin-import": "2.25.2"
},
"nbbpm": {
"compatibility": "^1.19.6"
"compatibility": "^3.0.0"
}
}
2 changes: 1 addition & 1 deletion public/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ define('admin/plugins/dbsearch', ['alerts'], function (alerts) {
dbsearch.init = function () {
$('#save').on('click', function () {
$.post(config.relative_path + '/api/admin/plugins/dbsearch/save', {
_csrf: $('#csrf_token').val(),
_csrf: config.csrf_token,
topicLimit: $('#topicLimit').val(),
postLimit: $('#postLimit').val(),
excludeCategories: $('#exclude-categories').val(),
Expand Down
126 changes: 61 additions & 65 deletions templates/admin/plugins/dbsearch.tpl
Original file line number Diff line number Diff line change
@@ -1,77 +1,73 @@
<div class="row">
<div class="col-lg-12">
<div class="panel panel-default">

<div class="panel-heading"><h4>DB Search</h4></div>

<div class="panel-body">

<div class="alert alert-info">
Topics Indexed: <strong id="topics-indexed">{topicsIndexed}</strong> / <strong>{topicCount}</strong>
</div>
<div class="progress">
<div class="topic-progress progress-bar" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width:{progressData.topicsPercent}%;min-width: 2em;">{progressData.topicsPercent}%</div>
</div>
<div class="col-12">
<div class="card">
<div class="card-header">DB Search</div>
<div class="card-body row">
<div class="col-6">
<div class="mb-3">
<div class="alert alert-info">
Topics Indexed: <strong id="topics-indexed">{topicsIndexed}</strong> / <strong>{topicCount}</strong>
</div>

<div class="alert alert-info">
Posts Indexed: <strong id="posts-indexed">{postsIndexed}</strong> / <strong>{postCount}</strong>
</div>
<div class="progress">
<div class="post-progress progress-bar" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width:{progressData.postsPercent}%;min-width: 2em;">{progressData.postsPercent}%</div>
</div>
<div class="progress" style="height:24px;">
<div class="topic-progress progress-bar" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width:{progressData.topicsPercent}%;min-width: 2em;">{progressData.topicsPercent}%</div>
</div>
</div>
<div class="mb-3">
<div class="alert alert-info">
Posts Indexed: <strong id="posts-indexed">{postsIndexed}</strong> / <strong>{postCount}</strong>
</div>
<div class="progress" style="height:24px;">
<div class="post-progress progress-bar" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width:{progressData.postsPercent}%;min-width: 2em;">{progressData.postsPercent}%</div>
</div>
</div>

<button class="btn btn-warning" id="reindex" <!-- IF working -->disabled<!-- ENDIF working -->>Re Index</button>
<button class="btn btn-danger" id="clear-index">Clear Index</button>
<span id="work-in-progress" class="<!-- IF !working -->hidden<!-- ENDIF !working -->">
<i class="fa fa-gear fa-spin"></i> Working...
</span>
<hr/>
<button class="btn btn-warning" id="reindex" <!-- IF working -->disabled<!-- ENDIF working -->>Re Index</button>
<button class="btn btn-danger" id="clear-index">Clear Index</button>
<span id="work-in-progress" class="<!-- IF !working -->hidden<!-- ENDIF !working -->">
<i class="fa fa-gear fa-spin"></i> Working...
</span>

<div class="form-group post-search-item">
<label>Select categories to exclude from indexing</label>
<select multiple class="form-control" id="exclude-categories" size="10">
<!-- BEGIN allCategories -->
<option value="{allCategories.value}" <!-- IF allCategories.selected -->selected<!-- ENDIF allCategories.selected -->>{allCategories.text}</option>
<!-- END allCategories -->
</select>
</div>
<hr/>

<!-- IF languageSupported -->
<form class="form">
<div class="row">
<div class="col-sm-4 col-xs-12">
<div class="form-group">
<label>Index Language</label>
<select class="form-control" id="indexLanguage">
<!-- BEGIN languages -->
<option value="{languages.value}" <!-- IF languages.selected -->selected<!-- ENDIF languages.selected -->>{languages.name}</option>
<!-- END languages -->
</select>
</div>
</div>
<!-- IF languageSupported -->
<div class="mb-3">
<label class="form-label">Index Language</label>
<select class="form-select" id="indexLanguage">
<!-- BEGIN languages -->
<option value="{languages.value}" <!-- IF languages.selected -->selected<!-- ENDIF languages.selected -->>{languages.name}</option>
<!-- END languages -->
</select>
</div>
</form>
<button class="btn btn-primary" id="changeLanguage">Change Language</button>
<hr/>
<!-- ENDIF languageSupported -->
<button class="btn btn-primary" id="changeLanguage">Change Language</button>
<hr/>
<!-- ENDIF languageSupported -->

<form class="form">
<div class="row">
<div class="col-sm-4 col-xs-12">
<div class="form-group">
<label>Topic Limit</label>
<input id="topicLimit" type="text" class="form-control" placeholder="Number of topics to return" value="{topicLimit}">
<label>Post Limit</label>
<input id="postLimit" type="text" class="form-control" placeholder="Number of posts to return" value="{postLimit}">
</div>
</div>
<div class="mb-3">
<label class="form-label">Topic Limit</label>
<input id="topicLimit" type="text" class="form-control" placeholder="Number of topics to return" value="{topicLimit}">
</div>
</form>

<button class="btn btn-primary" id="save">Save</button>
<div class="mb-3">
<label class="form-label">Post Limit</label>
<input id="postLimit" type="text" class="form-control" placeholder="Number of posts to return" value="{postLimit}">
</div>
</div>

<input id="csrf_token" type="hidden" value="{csrf}" />
<div class="col-6">
<div class="post-search-item">
<label class="form-label">Select categories to exclude from indexing</label>
<select multiple class="form-select" id="exclude-categories" size="30">
<!-- BEGIN allCategories -->
<option value="{allCategories.value}" <!-- IF allCategories.selected -->selected<!-- ENDIF allCategories.selected -->>{allCategories.text}</option>
<!-- END allCategories -->
</select>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

<button id="save" class="floating-button mdl-button mdl-js-button mdl-button--fab mdl-js-ripple-effect mdl-button--colored">
<i class="material-icons">save</i>
</button>

0 comments on commit 1676a03

Please sign in to comment.