not really known
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

62 lines
1.8 KiB

  1. define(["sugar-web/graphics/palette",
  2. "text!sugar-web/graphics/activitypalette.html"], function (palette, template) {
  3. 'use strict';
  4. var activitypalette = {};
  5. activitypalette.ActivityPalette = function (activityButton,
  6. datastoreObject) {
  7. palette.Palette.call(this, activityButton);
  8. var activityTitle;
  9. var descriptionLabel;
  10. var descriptionBox;
  11. this.getPalette().id = "activity-palette";
  12. var containerElem = document.createElement('div');
  13. containerElem.innerHTML = template;
  14. this.setContent([containerElem]);
  15. this.titleElem = containerElem.querySelector('#title');
  16. this.descriptionElem = containerElem.querySelector('#description');
  17. this.titleElem.onblur = function () {
  18. datastoreObject.setMetadata({
  19. "title": this.value,
  20. "title_set_by_user": "1"
  21. });
  22. datastoreObject.save();
  23. };
  24. this.descriptionElem.onblur = function () {
  25. datastoreObject.setMetadata({
  26. "description": this.value
  27. });
  28. datastoreObject.save();
  29. };
  30. };
  31. // Fill the text inputs with the received metadata.
  32. var setTitleDescription = function (metadata) {
  33. this.titleElem.value = metadata.title;
  34. if (metadata.description !== undefined) {
  35. this.descriptionElem.value = metadata.description;
  36. }
  37. };
  38. activitypalette.ActivityPalette.prototype =
  39. Object.create(palette.Palette.prototype, {
  40. setTitleDescription: {
  41. value: setTitleDescription,
  42. enumerable: true,
  43. configurable: true,
  44. writable: true
  45. }
  46. });
  47. return activitypalette;
  48. });