fnp
/
redakcja.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
cf166fd
)
Lepsze wiadomości.
author
zuber
<marek@stepniowski.com>
Tue, 6 Oct 2009 15:15:36 +0000
(17:15 +0200)
committer
zuber
<marek@stepniowski.com>
Tue, 6 Oct 2009 15:15:36 +0000
(17:15 +0200)
project/static/css/master.css
patch
|
blob
|
history
project/static/js/messages.js
patch
|
blob
|
history
project/static/js/models.js
patch
|
blob
|
history
project/templates/explorer/editor.html
patch
|
blob
|
history
diff --git
a/project/static/css/master.css
b/project/static/css/master.css
index
653b864
..
7c794e5
100644
(file)
--- a/
project/static/css/master.css
+++ b/
project/static/css/master.css
@@
-349,4
+349,23
@@
body#base button {
body#base button:hover {
background-color: #EEE;
body#base button:hover {
background-color: #EEE;
-}
\ No newline at end of file
+}
+
+/* ================= */
+/* = Message boxes = */
+/* ================= */
+.info {
+ background-color: gray;
+}
+
+.success {
+ background-color: green;
+}
+
+.error {
+ background-color: yellow;
+}
+
+.critical {
+ background-color: red;
+}
diff --git
a/project/static/js/messages.js
b/project/static/js/messages.js
index
c64aa5b
..
51a457d
100644
(file)
--- a/
project/static/js/messages.js
+++ b/
project/static/js/messages.js
@@
-7,13
+7,14
@@
Editor.MessageCenter = Editor.Object.extend({
},
addMessage: function(type, text, flash) {
},
addMessage: function(type, text, flash) {
+ if (!flash) {
+ flash = text;
+ }
this.messages.push({type: type, text: text});
this.messages.push({type: type, text: text});
- if (flash) {
- this.flashMessages.push({type: type, text: flash});
- if (this.flashMessages.length == 1) {
- this.set('firstFlashMessage', this.flashMessages[0]);
- setTimeout(this.changeFlashMessage.bind(this), 1000 * 10);
- }
+ this.flashMessages.push({type: type, text: flash});
+ if (this.flashMessages.length == 1) {
+ this.set('firstFlashMessage', this.flashMessages[0]);
+ setTimeout(this.changeFlashMessage.bind(this), 1000 * 10);
}
},
}
},
@@
-21,7
+22,7
@@
Editor.MessageCenter = Editor.Object.extend({
this.flashMessages.splice(0, 1);
if (this.flashMessages.length > 0) {
this.set('firstFlashMessage', this.flashMessages[0]);
this.flashMessages.splice(0, 1);
if (this.flashMessages.length > 0) {
this.set('firstFlashMessage', this.flashMessages[0]);
- setTimeout(this.changeFlashMessage.bind(this), 1000 *
10);
+ setTimeout(this.changeFlashMessage.bind(this), 1000 *
3); // 3 seconds
} else {
this.set('firstFlashMessage', null);
}
} else {
this.set('firstFlashMessage', null);
}
diff --git
a/project/static/js/models.js
b/project/static/js/models.js
index
0b00c7c
..
3cd98f6
100644
(file)
--- a/
project/static/js/models.js
+++ b/
project/static/js/models.js
@@
-55,6
+55,7
@@
Editor.XMLModel = Editor.Model.extend({
load: function(force) {
if (force || this.get('state') == 'empty') {
this.set('state', 'loading');
load: function(force) {
if (force || this.get('state') == 'empty') {
this.set('state', 'loading');
+ messageCenter.addMessage('info', 'Wczytuję XML...');
$.ajax({
url: this.serverURL,
dataType: 'text',
$.ajax({
url: this.serverURL,
dataType: 'text',
@@
-73,6
+74,7
@@
Editor.XMLModel = Editor.Model.extend({
}
this.set('data', data);
this.set('state', 'synced');
}
this.set('data', data);
this.set('state', 'synced');
+ messageCenter.addMessage('success', 'Wczytałem XML :-)');
},
loadingFailed: function() {
},
loadingFailed: function() {
@@
-81,11
+83,13
@@
Editor.XMLModel = Editor.Model.extend({
}
this.set('error', 'Nie udało się załadować panelu');
this.set('state', 'error');
}
this.set('error', 'Nie udało się załadować panelu');
this.set('state', 'error');
+ messageCenter.addMessage('error', 'Nie udało mi się wczytać XML. Spróbuj ponownie :-(');
},
update: function(message) {
if (this.get('state') == 'dirty') {
this.set('state', 'updating');
},
update: function(message) {
if (this.get('state') == 'dirty') {
this.set('state', 'updating');
+ messageCenter.addMessage('info', 'Zapisuję XML...');
var payload = {
contents: this.get('data'),
var payload = {
contents: this.get('data'),
@@
-114,13
+118,14
@@
Editor.XMLModel = Editor.Model.extend({
}
this.set('revision', data.revision);
this.set('state', 'updated');
}
this.set('revision', data.revision);
this.set('state', 'updated');
+ messageCenter.addMessage('success', 'Zapisałem XML :-)');
},
updatingFailed: function() {
if (this.get('state') != 'updating') {
alert('erroneous state:', this.get('state'));
}
},
updatingFailed: function() {
if (this.get('state') != 'updating') {
alert('erroneous state:', this.get('state'));
}
- messageCenter.addMessage('error', '
Uaktualnienie nie powiodło się', 'Uaktualnienie nie powiodło się
');
+ messageCenter.addMessage('error', '
Nie udało mi się zapisać XML. Spróbuj ponownie :-(
');
this.set('state', 'dirty');
},
this.set('state', 'dirty');
},
@@
-161,6
+166,7
@@
Editor.HTMLModel = Editor.Model.extend({
load: function(force) {
if (force || this.get('state') == 'empty') {
this.set('state', 'loading');
load: function(force) {
if (force || this.get('state') == 'empty') {
this.set('state', 'loading');
+ messageCenter.addMessage('info', 'Wczytuję HTML...');
$.ajax({
url: this.serverURL,
dataType: 'text',
$.ajax({
url: this.serverURL,
dataType: 'text',
@@
-177,6
+183,7
@@
Editor.HTMLModel = Editor.Model.extend({
}
this.set('data', data);
this.set('state', 'synced');
}
this.set('data', data);
this.set('state', 'synced');
+ messageCenter.addMessage('success', 'Wczytałem HTML :-)');
},
loadingFailed: function() {
},
loadingFailed: function() {
@@
-185,6
+192,7
@@
Editor.HTMLModel = Editor.Model.extend({
}
this.set('error', 'Nie udało się załadować panelu');
this.set('state', 'error');
}
this.set('error', 'Nie udało się załadować panelu');
this.set('state', 'error');
+ messageCenter.addMessage('error', 'Nie udało mi się wczytać HTML. Spróbuj ponownie :-(');
},
// For debbuging
},
// For debbuging
@@
-263,6
+271,7
@@
Editor.DocumentModel = Editor.Model.extend({
load: function() {
if (this.get('state') == 'empty') {
this.set('state', 'loading');
load: function() {
if (this.get('state') == 'empty') {
this.set('state', 'loading');
+ messageCenter.addMessage('info', 'Ładuję dane dokumentu...');
$.ajax({
cache: false,
url: documentsUrl + fileId,
$.ajax({
cache: false,
url: documentsUrl + fileId,
@@
-283,6
+292,7
@@
Editor.DocumentModel = Editor.Model.extend({
for (var key in this.contentModels) {
this.contentModels[key].addObserver(this, 'state', this.contentModelStateChanged.bind(this));
}
for (var key in this.contentModels) {
this.contentModels[key].addObserver(this, 'state', this.contentModelStateChanged.bind(this));
}
+ messageCenter.addMessage('success', 'Dane dokumentu zostały załadowane :-)');
},
contentModelStateChanged: function(property, value, contentModel) {
},
contentModelStateChanged: function(property, value, contentModel) {
@@
-299,8
+309,6
@@
Editor.DocumentModel = Editor.Model.extend({
if (this.contentModels[key].guid() == contentModel.guid()) {
this.contentModels[key].set('state', 'synced');
this.data.user_revision = this.contentModels[key].get('revision');
if (this.contentModels[key].guid() == contentModel.guid()) {
this.contentModels[key].set('state', 'synced');
this.data.user_revision = this.contentModels[key].get('revision');
- messageCenter.addMessage('info', 'Uaktualnienie dokumentu do wersji ' + this.data.user_revision,
- 'Uaktualnienie dokumentu do wersji ' + this.data.user_revision);
}
}
for (key in this.contentModels) {
}
}
for (key in this.contentModels) {
@@
-323,6
+331,7
@@
Editor.DocumentModel = Editor.Model.extend({
update: function() {
this.set('state', 'loading');
update: function() {
this.set('state', 'loading');
+ messageCenter.addMessage('info', 'Uaktualniam dokument...');
$.ajax({
url: this.data.merge_url,
dataType: 'json',
$.ajax({
url: this.data.merge_url,
dataType: 'json',
@@
-346,9
+355,14
@@
Editor.DocumentModel = Editor.Model.extend({
this.contentModels[key].set('revision', this.data.user_revision);
this.contentModels[key].set('state', 'empty');
}
this.contentModels[key].set('revision', this.data.user_revision);
this.contentModels[key].set('state', 'empty');
}
+ messageCenter.addMessage('success', 'Uaktualniłem dokument do najnowszej wersji :-)');
} else if (xhr.status == 202) { // Wygenerowano PullRequest (tutaj?)
} else if (xhr.status == 204) { // Nic nie zmieniono
} else if (xhr.status == 202) { // Wygenerowano PullRequest (tutaj?)
} else if (xhr.status == 204) { // Nic nie zmieniono
+ messageCenter.addMessage('info', 'Nic się nie zmieniło od ostatniej aktualizacji. Po co mam uaktualniać?');
} else if (xhr.status == 409) { // Konflikt podczas operacji
} else if (xhr.status == 409) { // Konflikt podczas operacji
+ messageCenter.addMessage('error', 'Wystąpił konflikt podczas aktualizacji. Pędź po programistów! :-(');
+ } else if (xhr.status == 500) {
+ messageCenter.addMessage('critical', 'Błąd serwera. Pędź po programistów! :-(');
}
this.set('state', 'synced');
this.set('updateData', null);
}
this.set('state', 'synced');
this.set('updateData', null);
@@
-356,6
+370,7
@@
Editor.DocumentModel = Editor.Model.extend({
merge: function(message) {
this.set('state', 'loading');
merge: function(message) {
this.set('state', 'loading');
+ messageCenter.addMessage('info', 'Scalam dokument z głównym repozytorium...');
$.ajax({
url: this.data.merge_url,
type: 'post',
$.ajax({
url: this.data.merge_url,
type: 'post',
@@
-378,11
+393,15
@@
Editor.DocumentModel = Editor.Model.extend({
this.contentModels[key].set('revision', this.data.user_revision);
this.contentModels[key].set('state', 'empty');
}
this.contentModels[key].set('revision', this.data.user_revision);
this.contentModels[key].set('state', 'empty');
}
- messageCenter.addMessage('info', 'Uaktualnienie dokumentu do wersji ' + this.get('mergeData').revision,
- 'Uaktualnienie dokumentu do wersji ' + this.get('mergeData').revision);
+ messageCenter.addMessage('success', 'Scaliłem dokument z głównym repozytorium :-)');
} else if (xhr.status == 202) { // Wygenerowano PullRequest
} else if (xhr.status == 202) { // Wygenerowano PullRequest
+ messageCenter.addMessage('success', 'Wysłałem prośbę o scalenie dokumentu z głównym repozytorium.');
} else if (xhr.status == 204) { // Nic nie zmieniono
} else if (xhr.status == 204) { // Nic nie zmieniono
+ messageCenter.addMessage('info', 'Nic się nie zmieniło od ostatniego scalenia. Po co mam scalać?');
} else if (xhr.status == 409) { // Konflikt podczas operacji
} else if (xhr.status == 409) { // Konflikt podczas operacji
+ messageCenter.addMessage('error', 'Wystąpił konflikt podczas scalania. Pędź po programistów! :-(');
+ } else if (xhr.status == 500) {
+ messageCenter.addMessage('critical', 'Błąd serwera. Pędź po programistów! :-(');
}
this.set('state', 'synced');
this.set('mergeData', null);
}
this.set('state', 'synced');
this.set('mergeData', null);
diff --git
a/project/templates/explorer/editor.html
b/project/templates/explorer/editor.html
index
edb3bfc
..
620d853
100644
(file)
--- a/
project/templates/explorer/editor.html
+++ b/
project/templates/explorer/editor.html
@@
-63,7
+63,7
@@
<script type="text/html" charset="utf-8" id="flash-view-template">
<div class="flashview">
<% if (shownMessage) { %>
<script type="text/html" charset="utf-8" id="flash-view-template">
<div class="flashview">
<% if (shownMessage) { %>
- <p style="margin: 0; padding: 0.2em 0.5em; line-height: 1.8em
; background-color: yellow
" class="<%= shownMessage.type %>"><%= shownMessage.text %></p>
+ <p style="margin: 0; padding: 0.2em 0.5em; line-height: 1.8em" class="<%= shownMessage.type %>"><%= shownMessage.text %></p>
<% } %>
</div>
</script>
<% } %>
</div>
</script>
@@
-161,8
+161,7
@@
<label for="message">Commit message:</label>
<textarea cols="60" rows="10" name="message" id="commit-dialog-message"></textarea>
<p id="commit-dialog-error-empty-message">Wiadomość nie może być pusta.</p>
<label for="message">Commit message:</label>
<textarea cols="60" rows="10" name="message" id="commit-dialog-message"></textarea>
<p id="commit-dialog-error-empty-message">Wiadomość nie może być pusta.</p>
- <fieldset id="commit-dialog-related-issues"
- ui:ajax-src="{{REDMINE_URL}}/publications/issues/{{fileid}}">
+ <fieldset id="commit-dialog-related-issues" ui:ajax-src="{{REDMINE_URL}}/publications/issues/{{fileid}}">
<legend>Related issues</legend>
<div class="loading-box" style="display: none;">
<p>Loading related issues...</p>
<legend>Related issues</legend>
<div class="loading-box" style="display: none;">
<p>Loading related issues...</p>