- alert("There are unsaved changes - can't make a pull request.");
-
- this.showPopup('not-implemented');
-/*
- $.ajax({
- url: '/pull-request',
- dataType: 'json',
- success: function(data, textStatus) {
- $.log('data: ' + data);
- },
- error: function(rq, tstat, err) {
- $.log('commit error', rq, tstat, err);
- },
- type: 'POST',
- data: {}
- }); */
+ alert("There are unsaved changes - can't commit.");
+
+ var self = this;
+
+ /* this.showPopup('not-implemented'); */
+
+ $.log('URL !: ', $('#toolbar-commit-form').attr('action'));
+
+ $.ajax({
+ url: $('#toolbar-commit-form').attr('action'),
+ dataType: 'json',
+ success: function(data, textStatus) {
+ switch(data.result) {
+ case 'done':
+ self.showPopup('generic-yes', 'Łączenie zmian powiodło się.');
+
+ if(data.localmodified)
+ self.refreshPanels()
+
+ break;
+ case 'nothing-to-do':
+ self.showPopup('generic-info', 'Brak zmian do połaczenia.');
+ break;
+ default:
+ self.showPopup('generic-error', data.errors && data.errors[0]);
+ }
+ },
+ error: function(rq, tstat, err) {
+ self.showPopup('generic-error', 'Błąd serwera: ' + err);
+ },
+ type: 'POST',
+ data: {'message': $('#toolbar-commit-message').val() }
+ });