Return-Path: X-Original-To: apmail-allura-commits-archive@www.apache.org Delivered-To: apmail-allura-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8976818B32 for ; Wed, 22 Jul 2015 12:30:58 +0000 (UTC) Received: (qmail 72029 invoked by uid 500); 22 Jul 2015 12:30:58 -0000 Delivered-To: apmail-allura-commits-archive@allura.apache.org Received: (qmail 71901 invoked by uid 500); 22 Jul 2015 12:30:58 -0000 Mailing-List: contact commits-help@allura.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@allura.apache.org Delivered-To: mailing list commits@allura.apache.org Received: (qmail 71501 invoked by uid 99); 22 Jul 2015 12:30:57 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 22 Jul 2015 12:30:57 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id CAE1AE35DF; Wed, 22 Jul 2015 12:30:57 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: jetmind@apache.org To: commits@allura.apache.org Date: Wed, 22 Jul 2015 12:31:11 -0000 Message-Id: In-Reply-To: <92c8156b01d0487c9b7339b107d63e1a@git.apache.org> References: <92c8156b01d0487c9b7339b107d63e1a@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [15/42] allura git commit: [#7897] ticket:804 Show help modal on "info" click [#7897] ticket:804 Show help modal on "info" click Project: http://git-wip-us.apache.org/repos/asf/allura/repo Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/404bd07c Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/404bd07c Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/404bd07c Branch: refs/heads/ib/7897 Commit: 404bd07c021607342dddc273efa4d7ecd8ed212a Parents: 62be737 Author: Igor Bondarenko Authored: Thu Jun 18 17:25:45 2015 +0300 Committer: Igor Bondarenko Committed: Wed Jul 22 10:59:51 2015 +0300 ---------------------------------------------------------------------- Allura/allura/lib/widgets/form_fields.py | 1 + .../lib/widgets/resources/js/sf_markitup.js | 40 +++++++++++++++++++- .../allura/templates/widgets/markdown_edit.html | 2 +- 3 files changed, 41 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/allura/blob/404bd07c/Allura/allura/lib/widgets/form_fields.py ---------------------------------------------------------------------- diff --git a/Allura/allura/lib/widgets/form_fields.py b/Allura/allura/lib/widgets/form_fields.py index 40efd03..e6be401 100644 --- a/Allura/allura/lib/widgets/form_fields.py +++ b/Allura/allura/lib/widgets/form_fields.py @@ -271,6 +271,7 @@ class MarkdownEdit(ew.TextArea): def resources(self): for r in super(MarkdownEdit, self).resources(): yield r + yield ew.JSLink('js/jquery.lightbox_me.js') yield ew.CSSLink('css/markdown_editor/editor.css') yield ew.JSLink('js/markdown_editor/editor.js') yield ew.JSLink('js/markdown_editor/marked.js') http://git-wip-us.apache.org/repos/asf/allura/blob/404bd07c/Allura/allura/lib/widgets/resources/js/sf_markitup.js ---------------------------------------------------------------------- diff --git a/Allura/allura/lib/widgets/resources/js/sf_markitup.js b/Allura/allura/lib/widgets/resources/js/sf_markitup.js index fd69c66..f57fb4b 100644 --- a/Allura/allura/lib/widgets/resources/js/sf_markitup.js +++ b/Allura/allura/lib/widgets/resources/js/sf_markitup.js @@ -23,7 +23,45 @@ $(window).load(function() { $('div.markdown_edit').each(function(){ var $container = $(this); var $textarea = $('textarea', $container); - new Editor({element: $textarea[0]}).render(); + + var $help_area = $('div.markdown_help', $container); + var $help_contents = $('div.markdown_help_contents', $container); + + var toolbar = Editor.toolbar; + toolbar[11] = {name: 'info', action: show_help}, + toolbar[12] = {name: 'preview', action: show_preview}, + new Editor({ + element: $textarea[0], + toolbar: toolbar + }).render(); + + function show_help() { + $help_contents.html('Loading...'); + $.get($help_contents.attr('data-url'), function (data) { + $help_contents.html(data); + var display_section = function(evt) { + var $all_sections = $('.markdown_syntax_section', $help_contents); + var $this_section = $(location.hash.replace('#', '.'), $help_contents); + if ($this_section.length == 0) { + $this_section = $('.md_ex_toc', $help_contents); + } + $all_sections.addClass('hidden_in_modal'); + $this_section.removeClass('hidden_in_modal'); + $('.markdown_syntax_toc_crumb').toggle(!$this_section.is('.md_ex_toc')); + }; + $('.markdown_syntax_toc a', $help_contents).click(display_section); + $(window).bind('hashchange', display_section); // handle back button + }); + $help_area.lightbox_me(); + } + + function show_preview() { + console.log('preview'); + } + + $('.close', $help_area).bind('click', function() { + $help_area.hide(); + }); }); } }); http://git-wip-us.apache.org/repos/asf/allura/blob/404bd07c/Allura/allura/templates/widgets/markdown_edit.html ---------------------------------------------------------------------- diff --git a/Allura/allura/templates/widgets/markdown_edit.html b/Allura/allura/templates/widgets/markdown_edit.html index 8339bc7..773ea09 100644 --- a/Allura/allura/templates/widgets/markdown_edit.html +++ b/Allura/allura/templates/widgets/markdown_edit.html @@ -21,7 +21,7 @@