overview.plugin.js 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. const PLUGIN_NAME = "Overview";
  2. /**
  3. * @type {{plugin: Function, plugin:name: string, markup: string}}
  4. */
  5. module.exports = {
  6. /**
  7. * Plugin init
  8. */
  9. "plugin": function () { /* noop */ },
  10. /**
  11. * Hooks
  12. */
  13. "hooks": {
  14. "markup": fileContent("/overview.html"),
  15. "client:js": fileContent("/overview.client.js"),
  16. "templates": [
  17. getPath("/snippet-info.html"),
  18. getPath("/url-info.html")
  19. ],
  20. "page": {
  21. path: "/",
  22. title: PLUGIN_NAME,
  23. template: "overview.html",
  24. controller: PLUGIN_NAME.replace(" ", "") + "Controller",
  25. order: 1,
  26. icon: "cog"
  27. }
  28. },
  29. /**
  30. * Plugin name
  31. */
  32. "plugin:name": PLUGIN_NAME
  33. };
  34. /**
  35. * @param filepath
  36. * @returns {*}
  37. */
  38. function getPath (filepath) {
  39. return require("path").join(__dirname, filepath);
  40. }
  41. /**
  42. * @param filepath
  43. * @returns {*}
  44. */
  45. function fileContent (filepath) {
  46. return require("fs").readFileSync(getPath(filepath), "utf-8");
  47. }