From 88252ea35e61b0ae9c2359e0963259c97fb1d5cb Mon Sep 17 00:00:00 2001 From: psychobunny Date: Thu, 26 Mar 2015 16:52:39 -0400 Subject: [PATCH] init --- .gitattributes | 22 +++ .gitignore | 218 +++++++++++++++++++++++++ .npmignore | 2 + LICENSE | 8 + README.md | 11 ++ library.js | 31 ++++ package.json | 26 +++ plugin.json | 25 +++ static/lib/main.js | 5 + static/style.less | 3 + static/templates/admin/plugins/q&a.tpl | 51 ++++++ 11 files changed, 402 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 .npmignore create mode 100644 LICENSE create mode 100644 README.md create mode 100644 library.js create mode 100644 package.json create mode 100644 plugin.json create mode 100644 static/lib/main.js create mode 100644 static/style.less create mode 100644 static/templates/admin/plugins/q&a.tpl diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..412eeda --- /dev/null +++ b/.gitattributes @@ -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 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d77e539 --- /dev/null +++ b/.gitignore @@ -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/ diff --git a/.npmignore b/.npmignore new file mode 100644 index 0000000..d913c17 --- /dev/null +++ b/.npmignore @@ -0,0 +1,2 @@ +sftp-config.json +node_modules/ diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..b86168b --- /dev/null +++ b/LICENSE @@ -0,0 +1,8 @@ +Copyright (c) 2013-2014, psychobunny +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. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..7a443e4 --- /dev/null +++ b/README.md @@ -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. \ No newline at end of file diff --git a/library.js b/library.js new file mode 100644 index 0000000..a1a9f76 --- /dev/null +++ b/library.js @@ -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; \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..1639ffa --- /dev/null +++ b/package.json @@ -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" +} diff --git a/plugin.json b/plugin.json new file mode 100644 index 0000000..e10f844 --- /dev/null +++ b/plugin.json @@ -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" +} \ No newline at end of file diff --git a/static/lib/main.js b/static/lib/main.js new file mode 100644 index 0000000..45fd745 --- /dev/null +++ b/static/lib/main.js @@ -0,0 +1,5 @@ +"use strict"; + +(function() { + +}()); \ No newline at end of file diff --git a/static/style.less b/static/style.less new file mode 100644 index 0000000..a39a295 --- /dev/null +++ b/static/style.less @@ -0,0 +1,3 @@ +body { + +} \ No newline at end of file diff --git a/static/templates/admin/plugins/q&a.tpl b/static/templates/admin/plugins/q&a.tpl new file mode 100644 index 0000000..273a7e2 --- /dev/null +++ b/static/templates/admin/plugins/q&a.tpl @@ -0,0 +1,51 @@ +
+
+
+
Sample Admin Page
+
+
+

+ Adjust these settings. You can then retrieve these settings in code via: + meta.config['sample:setting1'] and meta.config['sample:setting2'] +

+
+ +
+
+
+ + +
+
+
+
+
+
+
+
Control Panel
+
+ +
+
+
+
+ + \ No newline at end of file