mirror of
https://hk.gh-proxy.com/https://github.com/NodeBB/nodebb-plugin-question-and-answer.git
synced 2025-10-04 04:41:22 +08:00
init
This commit is contained in:
commit
88252ea35e
11 changed files with 402 additions and 0 deletions
22
.gitattributes
vendored
Normal file
22
.gitattributes
vendored
Normal file
|
@ -0,0 +1,22 @@
|
|||
# Auto detect text files and perform LF normalization
|
||||
* text=auto
|
||||
|
||||
# Custom for Visual Studio
|
||||
*.cs diff=csharp
|
||||
*.sln merge=union
|
||||
*.csproj merge=union
|
||||
*.vbproj merge=union
|
||||
*.fsproj merge=union
|
||||
*.dbproj merge=union
|
||||
|
||||
# Standard to msysgit
|
||||
*.doc diff=astextplain
|
||||
*.DOC diff=astextplain
|
||||
*.docx diff=astextplain
|
||||
*.DOCX diff=astextplain
|
||||
*.dot diff=astextplain
|
||||
*.DOT diff=astextplain
|
||||
*.pdf diff=astextplain
|
||||
*.PDF diff=astextplain
|
||||
*.rtf diff=astextplain
|
||||
*.RTF diff=astextplain
|
218
.gitignore
vendored
Normal file
218
.gitignore
vendored
Normal file
|
@ -0,0 +1,218 @@
|
|||
#################
|
||||
## Eclipse
|
||||
#################
|
||||
|
||||
*.pydevproject
|
||||
.project
|
||||
.metadata
|
||||
bin/
|
||||
tmp/
|
||||
*.tmp
|
||||
*.bak
|
||||
*.swp
|
||||
*~.nib
|
||||
local.properties
|
||||
.classpath
|
||||
.settings/
|
||||
.loadpath
|
||||
|
||||
# External tool builders
|
||||
.externalToolBuilders/
|
||||
|
||||
# Locally stored "Eclipse launch configurations"
|
||||
*.launch
|
||||
|
||||
# CDT-specific
|
||||
.cproject
|
||||
|
||||
# PDT-specific
|
||||
.buildpath
|
||||
|
||||
|
||||
#################
|
||||
## Visual Studio
|
||||
#################
|
||||
|
||||
## Ignore Visual Studio temporary files, build results, and
|
||||
## files generated by popular Visual Studio add-ons.
|
||||
|
||||
# User-specific files
|
||||
*.suo
|
||||
*.user
|
||||
*.sln.docstates
|
||||
|
||||
# Build results
|
||||
|
||||
[Dd]ebug/
|
||||
[Rr]elease/
|
||||
x64/
|
||||
build/
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
|
||||
# MSTest test Results
|
||||
[Tt]est[Rr]esult*/
|
||||
[Bb]uild[Ll]og.*
|
||||
|
||||
*_i.c
|
||||
*_p.c
|
||||
*.ilk
|
||||
*.meta
|
||||
*.obj
|
||||
*.pch
|
||||
*.pdb
|
||||
*.pgc
|
||||
*.pgd
|
||||
*.rsp
|
||||
*.sbr
|
||||
*.tlb
|
||||
*.tli
|
||||
*.tlh
|
||||
*.tmp
|
||||
*.tmp_proj
|
||||
*.log
|
||||
*.vspscc
|
||||
*.vssscc
|
||||
.builds
|
||||
*.pidb
|
||||
*.log
|
||||
*.scc
|
||||
|
||||
# Visual C++ cache files
|
||||
ipch/
|
||||
*.aps
|
||||
*.ncb
|
||||
*.opensdf
|
||||
*.sdf
|
||||
*.cachefile
|
||||
|
||||
# Visual Studio profiler
|
||||
*.psess
|
||||
*.vsp
|
||||
*.vspx
|
||||
|
||||
# Guidance Automation Toolkit
|
||||
*.gpState
|
||||
|
||||
# ReSharper is a .NET coding add-in
|
||||
_ReSharper*/
|
||||
*.[Rr]e[Ss]harper
|
||||
|
||||
# TeamCity is a build add-in
|
||||
_TeamCity*
|
||||
|
||||
# DotCover is a Code Coverage Tool
|
||||
*.dotCover
|
||||
|
||||
# NCrunch
|
||||
*.ncrunch*
|
||||
.*crunch*.local.xml
|
||||
|
||||
# Installshield output folder
|
||||
[Ee]xpress/
|
||||
|
||||
# DocProject is a documentation generator add-in
|
||||
DocProject/buildhelp/
|
||||
DocProject/Help/*.HxT
|
||||
DocProject/Help/*.HxC
|
||||
DocProject/Help/*.hhc
|
||||
DocProject/Help/*.hhk
|
||||
DocProject/Help/*.hhp
|
||||
DocProject/Help/Html2
|
||||
DocProject/Help/html
|
||||
|
||||
# Click-Once directory
|
||||
publish/
|
||||
|
||||
# Publish Web Output
|
||||
*.Publish.xml
|
||||
*.pubxml
|
||||
|
||||
# NuGet Packages Directory
|
||||
## TODO: If you have NuGet Package Restore enabled, uncomment the next line
|
||||
#packages/
|
||||
|
||||
# Windows Azure Build Output
|
||||
csx
|
||||
*.build.csdef
|
||||
|
||||
# Windows Store app package directory
|
||||
AppPackages/
|
||||
|
||||
# Others
|
||||
sql/
|
||||
*.Cache
|
||||
ClientBin/
|
||||
[Ss]tyle[Cc]op.*
|
||||
~$*
|
||||
*~
|
||||
*.dbmdl
|
||||
*.[Pp]ublish.xml
|
||||
*.pfx
|
||||
*.publishsettings
|
||||
|
||||
# RIA/Silverlight projects
|
||||
Generated_Code/
|
||||
|
||||
# Backup & report files from converting an old project file to a newer
|
||||
# Visual Studio version. Backup files are not needed, because we have git ;-)
|
||||
_UpgradeReport_Files/
|
||||
Backup*/
|
||||
UpgradeLog*.XML
|
||||
UpgradeLog*.htm
|
||||
|
||||
# SQL Server files
|
||||
App_Data/*.mdf
|
||||
App_Data/*.ldf
|
||||
|
||||
#############
|
||||
## Windows detritus
|
||||
#############
|
||||
|
||||
# Windows image file caches
|
||||
Thumbs.db
|
||||
ehthumbs.db
|
||||
|
||||
# Folder config file
|
||||
Desktop.ini
|
||||
|
||||
# Recycle Bin used on file shares
|
||||
$RECYCLE.BIN/
|
||||
|
||||
# Mac crap
|
||||
.DS_Store
|
||||
|
||||
|
||||
#############
|
||||
## Python
|
||||
#############
|
||||
|
||||
*.py[co]
|
||||
|
||||
# Packages
|
||||
*.egg
|
||||
*.egg-info
|
||||
dist/
|
||||
build/
|
||||
eggs/
|
||||
parts/
|
||||
var/
|
||||
sdist/
|
||||
develop-eggs/
|
||||
.installed.cfg
|
||||
|
||||
# Installer logs
|
||||
pip-log.txt
|
||||
|
||||
# Unit test / coverage reports
|
||||
.coverage
|
||||
.tox
|
||||
|
||||
#Translations
|
||||
*.mo
|
||||
|
||||
#Mr Developer
|
||||
.mr.developer.cfg
|
||||
|
||||
sftp-config.json
|
||||
node_modules/
|
2
.npmignore
Normal file
2
.npmignore
Normal file
|
@ -0,0 +1,2 @@
|
|||
sftp-config.json
|
||||
node_modules/
|
8
LICENSE
Normal file
8
LICENSE
Normal file
|
@ -0,0 +1,8 @@
|
|||
Copyright (c) 2013-2014, psychobunny <psycho.bunny@hotmail.com>
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
|
||||
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
11
README.md
Normal file
11
README.md
Normal file
|
@ -0,0 +1,11 @@
|
|||
# Question and Answer Plugin for NodeBB
|
||||
|
||||
A Q&A plugin for NodeBB Forums which allows users to post topics as questions and select a post as the answe
|
||||
|
||||
## Installation
|
||||
|
||||
npm install nodebb-plugin-q&a
|
||||
|
||||
## Screenshots
|
||||
|
||||
Coming soon.
|
31
library.js
Normal file
31
library.js
Normal file
|
@ -0,0 +1,31 @@
|
|||
"use strict";
|
||||
|
||||
var plugin = {};
|
||||
|
||||
plugin.init = function(params, callback) {
|
||||
var app = params.router,
|
||||
middleware = params.middleware,
|
||||
controllers = params.controllers;
|
||||
|
||||
app.get('/admin/plugins/q&a', middleware.admin.buildHeader, renderAdmin);
|
||||
app.get('/api/admin/plugins/q&a', renderAdmin);
|
||||
|
||||
callback();
|
||||
};
|
||||
|
||||
plugin.addAdminNavigation = function(header, callback) {
|
||||
header.plugins.push({
|
||||
route: '/plugins/q&a',
|
||||
icon: 'fa-question-circle',
|
||||
name: 'Q&A'
|
||||
});
|
||||
|
||||
callback(null, header);
|
||||
};
|
||||
|
||||
|
||||
function renderAdmin(req, res, next) {
|
||||
res.render('admin/plugins/q&a', {});
|
||||
}
|
||||
|
||||
module.exports = plugin;
|
26
package.json
Normal file
26
package.json
Normal file
|
@ -0,0 +1,26 @@
|
|||
{
|
||||
"name": "nodebb-plugin-q&a",
|
||||
"version": "0.0.1",
|
||||
"description": "A Q&A plugin for NodeBB which allows users to post topics as questions and select a post as the answer",
|
||||
"main": "library.js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/psychobunny/nodebb-plugin-q&a"
|
||||
},
|
||||
"keywords": [
|
||||
"nodebb",
|
||||
"plugin",
|
||||
"question",
|
||||
"answer",
|
||||
"Q&A"
|
||||
],
|
||||
"author": {
|
||||
"name": "psychobunny",
|
||||
"email": "psycho.bunny@hotmail.com"
|
||||
},
|
||||
"license": "BSD-2-Clause",
|
||||
"bugs": {
|
||||
"url": "https://github.com/psychobunny/nodebb-plugin-q&a/issues"
|
||||
},
|
||||
"readmeFilename": "README.md"
|
||||
}
|
25
plugin.json
Normal file
25
plugin.json
Normal file
|
@ -0,0 +1,25 @@
|
|||
{
|
||||
"id": "nodebb-plugin-q&a",
|
||||
"name": "Question and Answer Plugin for NodeBB",
|
||||
"description": "A Q&A plugin for NodeBB which allows users to post topics as questions and select a post as the answe",
|
||||
"url": "https://github.com/NodeBB/nodebb-plugin-q&a",
|
||||
"library": "./library.js",
|
||||
"hooks": [
|
||||
{
|
||||
"hook": "static:app.load", "method": "init"
|
||||
},
|
||||
{
|
||||
"hook": "filter:admin.header.build", "method": "addAdminNavigation"
|
||||
}
|
||||
],
|
||||
"staticDirs": {
|
||||
"static": "./static"
|
||||
},
|
||||
"less": [
|
||||
"static/style.less"
|
||||
],
|
||||
"scripts": [
|
||||
"static/lib/main.js"
|
||||
],
|
||||
"templates": "static/templates"
|
||||
}
|
5
static/lib/main.js
Normal file
5
static/lib/main.js
Normal file
|
@ -0,0 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
(function() {
|
||||
|
||||
}());
|
3
static/style.less
Normal file
3
static/style.less
Normal file
|
@ -0,0 +1,3 @@
|
|||
body {
|
||||
|
||||
}
|
51
static/templates/admin/plugins/q&a.tpl
Normal file
51
static/templates/admin/plugins/q&a.tpl
Normal file
|
@ -0,0 +1,51 @@
|
|||
<div class="row">
|
||||
<div class="col-lg-9">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">Sample Admin Page</div>
|
||||
<div class="panel-body">
|
||||
<form role="form" class="quickstart-settings">
|
||||
<p>
|
||||
Adjust these settings. You can then retrieve these settings in code via:
|
||||
<code>meta.config['sample:setting1']</code> and <code>meta.config['sample:setting2']</code>
|
||||
</p>
|
||||
<div class="form-group">
|
||||
<label for="Setting 1">Setting 1</label>
|
||||
<input type="text" id="setting-1" name="setting-1" title="Setting 1" class="form-control" placeholder="Setting 1"><br />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="Setting 2">Setting 2</label>
|
||||
<input type="text" id="setting-2" name="setting-2" title="Setting 2" class="form-control" placeholder="Setting 2">
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-3">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">Control Panel</div>
|
||||
<div class="panel-body">
|
||||
<button class="btn btn-primary" id="save">Save Settings</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
require(['settings'], function(Settings) {
|
||||
Settings.load('quickstart', $('.quickstart-settings'));
|
||||
|
||||
$('#save').on('click', function() {
|
||||
Settings.save('quickstart', $('.quickstart-settings'), function() {
|
||||
app.alert({
|
||||
type: 'success',
|
||||
alert_id: 'quickstart-saved',
|
||||
title: 'Settings Saved',
|
||||
message: 'Please reload your NodeBB to apply these settings',
|
||||
clickfn: function() {
|
||||
socket.emit('admin.reload');
|
||||
}
|
||||
})
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue