Skip to content

Commit

Permalink
refactor: v3 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
julianlam committed Sep 28, 2022
1 parent 1552242 commit e56901f
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 27 deletions.
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ Embed.parse = function(data, callback) {
commitKeys.push([fullUrlCommitMatch.repo, fullUrlCommitMatch.commit].join('@'));
}

console.log(issueKeys, commitKeys);
async.parallel({
issues: function(next) {
async.map(issueKeys, function(issueKey, next) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@
"striptags": "^3.1.0"
},
"nbbpm": {
"compatibility": "^1.0.0 || ^2.0.0"
"compatibility": "^3.0.0"
}
}
4 changes: 2 additions & 2 deletions plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"url": "https://github.com/julianlam/nodebb-plugin-github-embed",
"library": "./index.js",
"templates": "templates",
"less": [
"less/default.less"
"scss": [
"scss/default.scss"
],
"hooks": [
{ "hook": "filter:parse.post", "method": "parse" },
Expand Down
4 changes: 2 additions & 2 deletions less/default.less → scss/default.scss
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
color: #333;
text-transform: none !important;

span.label {
span.badge {
color: white;
.border-radius(2px);
border-radius: 2px;
font-size: 11px;
padding: 3px 4px;

Expand Down
32 changes: 16 additions & 16 deletions templates/admin/plugins/github-embed.tpl
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
<div class="row">
<div class="col-lg-9">
<div class="panel panel-default">
<div class="panel-heading">GitHub Embed</div>
<div class="panel-body">
<div class="card">
<div class="card-header">GitHub Embed</div>
<div class="card-body">
<form class="form github-embed-settings">
<div class="row">
<div class="col-sm-6">
<div class="form-group">
<div class="mb-3">
<label for="defaultRepo">Default Repository</label>
<input type="text" class="form-control" id="defaultRepo" name="defaultRepo" placeholder="NodeBB/NodeBB" />
<span class="help-block">Optional. Allows you to reference issues simply by providing the issue number (e.g. gh#1234). This field expects the repository owner and repository name, separated by a forward slash (/).</span>
<span class="form-text">Optional. Allows you to reference issues simply by providing the issue number (e.g. gh#1234). This field expects the repository owner and repository name, separated by a forward slash (/).</span>
</div>
<div class="form-group">
<div class="mb-3">
<label for="cacheHours">Number of hours to cache issue data</label>
<input type="text" class="form-control" id="cacheHours" name="cacheHours" placeholder="6" />
<span class="help-block">To reduce the number of calls to GitHub, this plugin will remember issue data for a specified number of hours. (Default: 6)</span>
<span class="form-text">To reduce the number of calls to GitHub, this plugin will remember issue data for a specified number of hours. (Default: 6)</span>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<div class="mb-3">
<label for="clientId">Client ID/Secret Pair</label>
<div class="row">
<div class="col-xs-5">
<div class="col-5">
<input type="text" class="form-control" id="clientId" name="clientId" placeholder="Client ID" />
</div>
<div class="col-xs-7">
<div class="col-7">
<input type="text" class="form-control" id="clientSecret" name="clientSecret" placeholder="Client Secret" />
</div>
</div>
<span class="help-block">Optional. Without a client ID/secret pair, requests are rate-limited to one request per second.</span>
<span class="form-text">Optional. Without a client ID/secret pair, requests are rate-limited to one request per second.</span>
</div>
<div class="form-group">
<div class="mb-3">
<label for="personalAccessToken">Personal Access Token</label>
<input type="text" class="form-control" id="personalAccessToken" name="personalAccessToken" />
<p class="help-block">
<p class="form-text">
Optional. A <a href="https://github.com/blog/1509-personal-api-tokens">Personal Access Token</a> can also be
generated in order to authenticate your requests, raise your API call limit, and access private repositories
(if configured to do so).
Expand All @@ -47,9 +47,9 @@
</div>

<div class="col-lg-3">
<div class="panel panel-default">
<div class="panel-heading">Control Panel</div>
<div class="panel-body">
<div class="card">
<div class="card-header">Control Panel</div>
<div class="card-body">
<button class="btn btn-primary" id="save">Save Settings</button>
</div>
</div>
Expand Down
12 changes: 6 additions & 6 deletions templates/partials/embed-block.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
<!-- BEGIN embeds -->
<!-- IF embeds.type.issue -->
<div class="col-md-6">
<div class="github-embed panel panel-default">
<div class="panel-body">
<div class="github-embed card">
<div class="card-body">
<div class="meta">
<img class="author-picture not-responsive" src="{embeds.user.picture}" title="{embeds.user.login}" />
<a href="{embeds.user.url}"><span class="username">{embeds.user.login}</span></a> created this issue <span class="timeago" title="{embeds.created}"></span> in <a href="//github.com/{embeds.repo}">{embeds.repo}</a>
</div>
<h3>
<span class="label label-default {embeds.state} pull-right">{embeds.state}</span>
<span class="badge {embeds.state} float-end">{embeds.state}</span>
<a href="{embeds.url}">{embeds.title}</a>
<span class="number">#{embeds.number}</span>
</h3>
Expand All @@ -19,10 +19,10 @@
<!-- ENDIF embeds.type.issue -->
<!-- IF embeds.type.commit -->
<div class="col-md-6">
<div class="github-embed panel panel-default">
<div class="panel-body">
<div class="github-embed card">
<div class="card-body">
<div class="meta">
<span class="pull-right">{embeds.commentCount} <i class="fa fa-comment"></i></span>
<span class="float-end">{embeds.commentCount} <i class="fa fa-comment"></i></span>
<img class="author-picture not-responsive" src="{embeds.user.picture}" title="{embeds.user.login}" />
<a href="{embeds.user.url}"><span class="username">{embeds.user.login}</span></a> committed <span class="timeago" title="{embeds.created}"></span> to <a href="//github.com/{embeds.repo}">{embeds.repo}</a>
</div>
Expand Down

0 comments on commit e56901f

Please sign in to comment.