You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by jo...@apache.org on 2014/03/13 16:43:05 UTC
git commit: [#7107] ticket:545 Prompt before revert wiki page revision
Repository: incubator-allura
Updated Branches:
refs/heads/master 4a9c34487 -> abfcaa696
[#7107] ticket:545 Prompt before revert wiki page revision
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/abfcaa69
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/abfcaa69
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/abfcaa69
Branch: refs/heads/master
Commit: abfcaa696c315deec2b3dd04503bd2cbe214f8d0
Parents: 4a9c344
Author: tramzzz <st...@gmail.com>
Authored: Thu Feb 27 17:55:50 2014 +0200
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Thu Mar 13 15:41:16 2014 +0000
----------------------------------------------------------------------
ForgeWiki/forgewiki/templates/wiki/master.html | 19 +++++++++++--------
.../forgewiki/templates/wiki/page_history.html | 15 ++++++++++++++-
.../forgewiki/tests/functional/test_root.py | 8 ++++----
ForgeWiki/forgewiki/wiki_main.py | 2 ++
4 files changed, 31 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/abfcaa69/ForgeWiki/forgewiki/templates/wiki/master.html
----------------------------------------------------------------------
diff --git a/ForgeWiki/forgewiki/templates/wiki/master.html b/ForgeWiki/forgewiki/templates/wiki/master.html
index a920736..c237ab7 100644
--- a/ForgeWiki/forgewiki/templates/wiki/master.html
+++ b/ForgeWiki/forgewiki/templates/wiki/master.html
@@ -44,16 +44,19 @@
</form>
''')}}
<script type="text/javascript">
- /*<![CDATA[*/
$('.post-link')
- .click(function(evt) {
- var cval = $.cookie('_session_id');
- evt.preventDefault();
- $.post(this.href, {_session_id:cval}, function(val)
- { window.location = val.location; },
- 'json');
+ .click(function() {
+ var dialog_text = $(".confirm_revert_"+$(this).data("version"));
+ var modal = $('#lightbox_revert');
+ modal.html(dialog_text.html());
+ modal.find('.continue_revert').click(function(evt) {
+ var cval = $.cookie('_session_id');
+ evt.preventDefault();
+ $.post($(this).attr('href'), {_session_id:cval}, function(val)
+ { window.location = val.location; },
+ 'json');
+ });
});
- /*]]>*/
</script>
{% block wiki_extra_js %}{% endblock %}
{% endblock %}
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/abfcaa69/ForgeWiki/forgewiki/templates/wiki/page_history.html
----------------------------------------------------------------------
diff --git a/ForgeWiki/forgewiki/templates/wiki/page_history.html b/ForgeWiki/forgewiki/templates/wiki/page_history.html
index 617b648..53fd54a 100644
--- a/ForgeWiki/forgewiki/templates/wiki/page_history.html
+++ b/ForgeWiki/forgewiki/templates/wiki/page_history.html
@@ -52,7 +52,19 @@
<td><input name="v2" type="radio" value="{{p.version}}"/></td>
<td class="tright">
{% if i != 0 and h.has_access(p, 'edit')() %}
- <a class="post-link" href="./revert?version={{p.version}}"><b data-icon="{{g.icons['fork'].char}}" class="ico {{g.icons['fork'].css}}" title="Revert to version {{p.version}}"></b></a>
+ <a class="post-link" data-version="{{p.version}}" href="#"><b data-icon="{{g.icons['fork'].char}}" class="ico {{g.icons['fork'].css}}" title="Revert to version {{p.version}}"></b></a>
+ <div class="confirm_revert_{{p.version}}" style="display:none">
+ <b class="ico ico-close close" data-icon="D"></b>
+ <h1>Confirm revert to version {{p.version}}</h1>
+ <p>
+ Do you really want to revert page to version {{p.version}}?
+ You can undo it later by reverting changes made by this revert.
+ </p>
+ <p>
+ <button class="continue_revert" href="./revert?version={{p.version}}">Yes</button>
+ <input type="button" value="Cancel" class="cancel_revert close">
+ </p>
+ </div>
{% endif %}
<a href="./?version={{p.version}}"><b data-icon="{{g.icons['search'].char}}" class="ico {{g.icons['search'].css}}" title="View Revision"></b></a>
</td>
@@ -63,4 +75,5 @@
</table>
</form>
{{c.page_list.display(limit=limit, page=page, count=count)}}
+{{c.revert.display(content='')}}
{% endblock %}
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/abfcaa69/ForgeWiki/forgewiki/tests/functional/test_root.py
----------------------------------------------------------------------
diff --git a/ForgeWiki/forgewiki/tests/functional/test_root.py b/ForgeWiki/forgewiki/tests/functional/test_root.py
index 6239a6b..3ac9737 100644
--- a/ForgeWiki/forgewiki/tests/functional/test_root.py
+++ b/ForgeWiki/forgewiki/tests/functional/test_root.py
@@ -235,16 +235,16 @@ class TestRootController(TestController):
assert '2 by Test Admin' in response
assert '1 by Test Admin' in response
# you can revert to an old revison, but not the current one
- assert response.html.find('a', {'href': './revert?version=1'})
- assert not response.html.find('a', {'href': './revert?version=2'})
+ assert response.html.find('a', {'data-version': '1'})
+ assert not response.html.find('a', {'data-version': '2'})
response = self.app.get('/wiki/tést/history',
extra_environ=dict(username='*anonymous'))
# two revisions are shown
assert '2 by Test Admin' in response
assert '1 by Test Admin' in response
# you cannot revert to any revision
- assert not response.html.find('a', {'href': './revert?version=1'})
- assert not response.html.find('a', {'href': './revert?version=2'})
+ assert not response.html.find('a', {'data-version': '1'})
+ assert not response.html.find('a', {'data-version': '2'})
def test_page_diff(self):
self.app.post(
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/abfcaa69/ForgeWiki/forgewiki/wiki_main.py
----------------------------------------------------------------------
diff --git a/ForgeWiki/forgewiki/wiki_main.py b/ForgeWiki/forgewiki/wiki_main.py
index 51d5f13..9193ecc 100644
--- a/ForgeWiki/forgewiki/wiki_main.py
+++ b/ForgeWiki/forgewiki/wiki_main.py
@@ -61,6 +61,7 @@ class W:
create_page_lightbox = CreatePageWidget(
name='create_wiki_page', trigger='#sidebar a.add_wiki_page')
markdown_editor = ffw.MarkdownEdit()
+ revert = ffw.Lightbox(name='revert', trigger='a.post-link')
label_edit = ffw.LabelEdit()
attachment_add = ffw.AttachmentAdd()
attachment_list = ffw.AttachmentList()
@@ -558,6 +559,7 @@ class PageController(BaseController, FeedController):
raise exc.HTTPNotFound
c.page_list = W.page_list
c.page_size = W.page_size
+ c.revert = W.revert
limit, pagenum, start = g.handle_paging(limit, page, default=25)
count = 0
pages = self.page.history()