history.plugin.js 1.1 KB

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