You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2015/09/16 22:32:54 UTC
[1/2] allura git commit: [#7955] hide Reply/link/etc column when
editing a post
Repository: allura
Updated Branches:
refs/heads/db/7955 753da53f2 -> c2a5c43a0
[#7955] hide Reply/link/etc column when editing a post
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/4127614b
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/4127614b
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/4127614b
Branch: refs/heads/db/7955
Commit: 4127614b6f30e7501356a4b9ef2aa45f1322e327
Parents: 753da53
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Wed Sep 16 20:07:03 2015 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Wed Sep 16 20:07:03 2015 +0000
----------------------------------------------------------------------
Allura/allura/lib/widgets/discuss.py | 13 +++++++++++++
1 file changed, 13 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/4127614b/Allura/allura/lib/widgets/discuss.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/widgets/discuss.py b/Allura/allura/lib/widgets/discuss.py
index ff131e8..8f1ab2a 100644
--- a/Allura/allura/lib/widgets/discuss.py
+++ b/Allura/allura/lib/widgets/discuss.py
@@ -350,6 +350,16 @@ class Post(HierWidget):
if($('a.edit_post', post)){
$('a.edit_post', post).click(function (ele) {
$('.display_post', post).hide();
+
+ // remove the options column, but have to adjust the width of the middle section which is
+ // already hard-coded
+ var $opts = $('.options:first', post);
+ var opts_width = $opts.outerWidth(true);
+ $opts.hide();
+ var $post_middle = $('div.grid-14:first', post);
+ $post_middle.data('original-width', $post_middle.width());
+ $post_middle.width($post_middle.width() + opts_width);
+
var $edit_post_form = $('.edit_post_form', post);
var cm = get_cm($edit_post_form);
$edit_post_form.show();
@@ -359,7 +369,10 @@ class Post(HierWidget):
});
$("a.cancel_edit_post", post).click(function(evt){
$('.display_post', post).show();
+ $('.options', post).show();
$('.edit_post_form', post).hide();
+ var $post_middle = $('div.grid-14:first', post);
+ $post_middle.width($post_middle.data('original-width'));
});
}
if($('.reply_post', post)){
[2/2] allura git commit: [#7955] JS event handling cleanup for post
widget
Posted by br...@apache.org.
[#7955] JS event handling cleanup for post widget
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/c2a5c43a
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/c2a5c43a
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/c2a5c43a
Branch: refs/heads/db/7955
Commit: c2a5c43a04c2e06f4ea08d174bb519c3e0d15828
Parents: 4127614
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Wed Sep 16 20:31:39 2015 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Wed Sep 16 20:31:39 2015 +0000
----------------------------------------------------------------------
Allura/allura/lib/widgets/discuss.py | 16 ++++++++--------
Allura/allura/templates/widgets/post_widget.html | 4 ++--
2 files changed, 10 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/c2a5c43a/Allura/allura/lib/widgets/discuss.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/widgets/discuss.py b/Allura/allura/lib/widgets/discuss.py
index 8f1ab2a..1e3d632 100644
--- a/Allura/allura/lib/widgets/discuss.py
+++ b/Allura/allura/lib/widgets/discuss.py
@@ -315,9 +315,9 @@ class Post(HierWidget):
$('div.discussion-post').each(function () {
var post = this;
$('.submit', post).button();
- $('.flag_post', post).click(function (ele) {
+ $('.flag_post', post).click(function (evt) {
+ evt.preventDefault();
this.parentNode.submit();
- return false;
});
$('.moderate_post', post).click(function(e){
e.preventDefault();
@@ -348,7 +348,8 @@ class Post(HierWidget):
function get_cm($elem) { return $('.CodeMirror', $elem)[0].CodeMirror; }
if($('a.edit_post', post)){
- $('a.edit_post', post).click(function (ele) {
+ $('a.edit_post', post).click(function (evt) {
+ evt.preventDefault();
$('.display_post', post).hide();
// remove the options column, but have to adjust the width of the middle section which is
@@ -365,7 +366,6 @@ class Post(HierWidget):
$edit_post_form.show();
cm.refresh();
cm.focus();
- return false;
});
$("a.cancel_edit_post", post).click(function(evt){
$('.display_post', post).show();
@@ -376,19 +376,19 @@ class Post(HierWidget):
});
}
if($('.reply_post', post)){
- $('.reply_post', post).click(function (ele) {
+ $('.reply_post', post).click(function (evt) {
+ evt.preventDefault();
var $reply_post_form = $('.reply_post_form', post);
var cm = get_cm($reply_post_form);
$reply_post_form.show();
cm.focus();
- return false;
});
$('.reply_post', post).button();
}
if($('.add_attachment', post)){
- $('.add_attachment', post).click(function (ele) {
+ $('.add_attachment', post).click(function (evt) {
+ evt.preventDefault();
$('.add_attachment_form', post).show();
- return false;
});
}
if($('.shortlink', post)){
http://git-wip-us.apache.org/repos/asf/allura/blob/c2a5c43a/Allura/allura/templates/widgets/post_widget.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/widgets/post_widget.html b/Allura/allura/templates/widgets/post_widget.html
index 193161b..a0e4545 100644
--- a/Allura/allura/templates/widgets/post_widget.html
+++ b/Allura/allura/templates/widgets/post_widget.html
@@ -97,13 +97,13 @@
</div>
<div class="options grid-3">
{% if h.has_access(value.thread, 'post')() %}
- <a href="" class="reply_post btn"{%if value.status == 'pending'%} style="display:none"{%endif%}><b data-icon="{{g.icons['reply'].char}}" class="ico {{g.icons['reply'].css}}"></b>Reply</a>
+ <a href="#" class="reply_post btn"{%if value.status == 'pending'%} style="display:none"{%endif%}><b data-icon="{{g.icons['reply'].char}}" class="ico {{g.icons['reply'].css}}"></b>Reply</a>
{% endif %}
<div style="clear:both">
<div class="little_link">
<a href="{{shortlink_url}}" class="little_link shortlink"{%if value.status == 'pending'%} style="display:none"{%endif%}><span>Link</span></a><br/>
{% if h.has_access(value, 'moderate')()%}
- <a href="" class="edit_post little_link"><span>Edit</span></a><br/>
+ <a href="#" class="edit_post little_link"><span>Edit</span></a><br/>
{% endif %}
</div>
{% if h.has_access(value.thread, 'moderate')() %}