0 Votes

Changes for page Todolist Macro

Last modified by Ryan C on 2025/04/30 07:54

From version 22.1
edited by Ryan C
on 2025/04/24 11:12
Change comment: Todo List item added
To version 24.2
edited by Ryan C
on 2025/04/24 11:17
Change comment: Synchronized object properties with their current classes

Summary

Details

Page properties
Content
... ... @@ -4,5 +4,6 @@
4 4  a 3nd thing|0
5 5  adding this thing|0
6 6  adding this thing|0
7 +refreshed they are still there not even having to save page|0
7 7  
8 8  {{/todolist}}
XWiki.JavaScriptExtension[0]
Code
... ... @@ -87,30 +87,33 @@
87 87   }
88 88   return Ember.RSVP.resolve();
89 89   },
90 -
91 91   saveAll: function(alldata) {
92 92   console.log("saveAll");
93 93   var query = { save: "1", content: JSON.stringify(alldata) };
94 -
95 - return new Ember.RSVP.Promise(function(resolve, reject) {
96 - jQuery.getJSON(
97 - "${xwiki.getURL('TodoLists.TodoListsService')}?page=" +
98 - XWiki.currentSpace + "." + XWiki.currentPage +
99 - "&xpage=plain&outputSyntax=plain",
100 - query
101 - ).then(function(data) {
102 - Ember.run(function() {
103 - resolve(data);
104 - });
105 - }, function(jqXHR) {
106 - Ember.run(function() {
107 - reject(jqXHR);
108 - });
109 - });
110 - });
111 - }
93 +return new Ember.RSVP.Promise(function(resolve, reject) {
94 + jQuery.getJSON(
95 + "${xwiki.getURL('TodoLists.TodoListsService')}?page=" +
96 + (
97 + typeof XWiki !== 'undefined' &&
98 + XWiki.currentSpace &&
99 + XWiki.currentPage
100 + ? XWiki.currentSpace + "." + XWiki.currentPage
101 + : document.location.pathname.split('/').pop()
102 + ) +
103 + "&xpage=plain&outputSyntax=plain",
104 + query
105 + ).then(function(data) {
106 + Ember.run(function() {
107 + resolve(data);
108 + });
109 + }, function(jqXHR) {
110 + Ember.run(function() {
111 + reject(jqXHR);
112 + });
112 112   });
114 +});
113 113  
116 +
114 114   // Register the adapter
115 115   Todos.ApplicationAdapter.reopen({
116 116   namespace: 'api'