projects
/
Sone.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
62639dc
)
Allow sender selection in replies. This finally fixes #62.
author
David ‘Bombe’ Roden
<bombe@pterodactylus.net>
Tue, 18 Jan 2011 07:04:52 +0000
(08:04 +0100)
committer
David ‘Bombe’ Roden
<bombe@pterodactylus.net>
Tue, 18 Jan 2011 07:04:52 +0000
(08:04 +0100)
src/main/resources/static/css/sone.css
patch
|
blob
|
history
src/main/resources/static/javascript/sone.js
patch
|
blob
|
history
src/main/resources/templates/include/viewPost.html
patch
|
blob
|
history
diff --git
a/src/main/resources/static/css/sone.css
b/src/main/resources/static/css/sone.css
index
530b2e1
..
bc7445a
100644
(file)
--- a/
src/main/resources/static/css/sone.css
+++ b/
src/main/resources/static/css/sone.css
@@
-172,7
+172,7
@@
textarea {
float: right;
}
float: right;
}
-#sone #update-status .select-sender {
+#sone #update-status .select-sender
, #sone .create-reply .select-sender
{
display: none;
}
display: none;
}
@@
-371,12
+371,12
@@
textarea {
#sone .post .create-reply input[type=text] {
margin-left: 0.5ex;
#sone .post .create-reply input[type=text] {
margin-left: 0.5ex;
- width: 4
4
em;
+ width: 4
2
em;
}
#sone .post .create-reply textarea {
margin-left: 0.5ex;
}
#sone .post .create-reply textarea {
margin-left: 0.5ex;
- width: 4
4
em;
+ width: 4
2
em;
height: 4em;
}
height: 4em;
}
@@
-384,6
+384,11
@@
textarea {
float: right;
}
float: right;
}
+#sone .create-reply .select-sender button {
+ display: inline;
+ float: left;
+}
+
#sone .sone {
clear: both;
background-color: #f0f0ff;
#sone .sone {
clear: both;
background-color: #f0f0ff;
diff --git
a/src/main/resources/static/javascript/sone.js
b/src/main/resources/static/javascript/sone.js
index
1ae6c14
..
35b53e3
100644
(file)
--- a/
src/main/resources/static/javascript/sone.js
+++ b/
src/main/resources/static/javascript/sone.js
@@
-491,6
+491,8
@@
function updateReplyLikes(replyId) {
/**
* Posts a reply and calls the given callback when the request finishes.
*
/**
* Posts a reply and calls the given callback when the request finishes.
*
+ * @param sender
+ * The ID of the sender
* @param postId
* The ID of the post the reply refers to
* @param text
* @param postId
* The ID of the post the reply refers to
* @param text
@@
-499,14
+501,14
@@
function updateReplyLikes(replyId) {
* The callback function to call when the request finishes (takes 3
* parameters: success, error, replyId)
*/
* The callback function to call when the request finishes (takes 3
* parameters: success, error, replyId)
*/
-function postReply(postId, text, callbackFunction) {
- $.getJSON("createReply.ajax", { "formPassword" : getFormPassword(), "post" : postId, "text": text }, function(data, textStatus) {
+function postReply(
sender,
postId, text, callbackFunction) {
+ $.getJSON("createReply.ajax", { "formPassword" : getFormPassword(), "
sender": sender, "
post" : postId, "text": text }, function(data, textStatus) {
if (data == null) {
/* TODO - show error */
return;
}
if (data.success) {
if (data == null) {
/* TODO - show error */
return;
}
if (data.success) {
- callbackFunction(true, null, data.reply);
+ callbackFunction(true, null, data.reply
, data.sone
);
} else {
callbackFunction(false, data.error);
}
} else {
callbackFunction(false, data.error);
}
@@
-545,21
+547,25
@@
function ajaxifyPost(postElement) {
return false;
});
$(postElement).find(".create-reply button:submit").click(function() {
return false;
});
$(postElement).find(".create-reply button:submit").click(function() {
- inputField = $(this.form).find(":input:enabled").get(0);
+ sender = $(this.form).find(":input[name=sender]").val();
+ inputField = $(this.form).find(":input[name=text]:enabled").get(0);
postId = getPostId(this);
text = $(inputField).val();
postId = getPostId(this);
text = $(inputField).val();
- (function(postId, text, inputField) {
- postReply(
postId, text, function(success, error, reply
Id) {
+ (function(
sender,
postId, text, inputField) {
+ postReply(
sender, postId, text, function(success, error, replyId, sone
Id) {
if (success) {
$(inputField).val("");
if (success) {
$(inputField).val("");
- loadNewReply(replyId,
getCurrentSoneId()
, postId);
+ loadNewReply(replyId,
soneId
, postId);
markPostAsKnown(getPostElement(inputField));
$("#sone .post#" + postId + " .create-reply").addClass("hidden");
markPostAsKnown(getPostElement(inputField));
$("#sone .post#" + postId + " .create-reply").addClass("hidden");
+ $("#sone .post#" + postId + " .create-reply .sender").hide();
+ $("#sone .post#" + postId + " .create-reply .select-sender").show();
+ $("#sone .post#" + postId + " .create-reply :input[name=sender]").val(getCurrentSoneId());
} else {
alert(error);
}
});
} else {
alert(error);
}
});
- })(postId, text, inputField);
+ })(
sender,
postId, text, inputField);
return false;
});
return false;
});
@@
-612,6
+618,15
@@
function ajaxifyPost(postElement) {
});
});
});
});
+ /* process sender selection. */
+ $(".select-sender", postElement).css("display", "inline");
+ $(".sender", postElement).hide();
+ $(".select-sender button", postElement).click(function() {
+ $(".sender", postElement).show();
+ $(".select-sender", postElement).hide();
+ return false;
+ });
+
/* mark everything as known on click. */
$(postElement).click(function(event) {
if ($(event.target).hasClass("click-to-show")) {
/* mark everything as known on click. */
$(postElement).click(function(event) {
if ($(event.target).hasClass("click-to-show")) {
diff --git
a/src/main/resources/templates/include/viewPost.html
b/src/main/resources/templates/include/viewPost.html
index
b4f570f
..
74e3450
100644
(file)
--- a/
src/main/resources/templates/include/viewPost.html
+++ b/
src/main/resources/templates/include/viewPost.html
@@
-82,6
+82,14
@@
<input type="hidden" name="formPassword" value="<% formPassword|html>" />
<input type="hidden" name="returnPage" value="<% request.uri|html>" />
<input type="hidden" name="post" value="<% post.id|html>" />
<input type="hidden" name="formPassword" value="<% formPassword|html>" />
<input type="hidden" name="returnPage" value="<% request.uri|html>" />
<input type="hidden" name="post" value="<% post.id|html>" />
+ <div class="sender">
+ <select name="sender" title="<%= View.UpdateStatus.Text.ChooseSenderIdentity|l10n|html>">
+ <%foreach localSones localSone>
+ <option value="<% localSone.id|html>"<%if localSone.current> selected="selected"<%/if>><% localSone.niceName|html></option>
+ <%/foreach>
+ </select>
+ </div>
+ <div class="select-sender"><button type="button" title="<%= View.UpdateStatus.Text.ChooseSenderIdentity|l10n|html>">+</button></div>
<input type="text" class="reply-input" name="text" value="" />
<button type="submit"><%= View.Post.SendReply|l10n|html></button>
</form>
<input type="text" class="reply-input" name="text" value="" />
<button type="submit"><%= View.Post.SendReply|l10n|html></button>
</form>