[Bps-public-commit] rt-extension-inlinehelp branch target-selector updated. b689fb018b406c5b88eb4b3e3d8b304016a69944

BPS Git Server git at git.bestpractical.com
Wed Oct 13 22:39:23 UTC 2021


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "rt-extension-inlinehelp".

The branch, target-selector has been updated
       via  b689fb018b406c5b88eb4b3e3d8b304016a69944 (commit)
       via  6af44c7fd5c55257776ac3beec708b18c087124a (commit)
       via  8cd20ce6f8e3a96bc4b4669d54882befffb307fe (commit)
       via  63dd8ac9e44dfa17779803992ef57a869814da71 (commit)
       via  313c89f259e5293bd1231b35fbfd0e49f60406e9 (commit)
       via  f6b3841b575a63696a1c410a90cfedc5001e81e6 (commit)
      from  3e2b2d9e686df537df3425172eedc0478e7fdf5e (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit b689fb018b406c5b88eb4b3e3d8b304016a69944
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Thu Oct 14 06:38:26 2021 +0800

    Document how to customize help icon size

diff --git a/README b/README
index c1e252e..c55b08d 100644
--- a/README
+++ b/README
@@ -424,6 +424,23 @@ DESIGN CONSIDERATIONS
     customize the help content (since it now lives in code instead of an
     article). It also makes it more difficult to support multiple locales.
 
+MISC
+  Change Icon Size
+    By default the icon size is inherited from its parent, to customize it,
+    you can add css rules on Admin Theme page like:
+
+        span.popup-help {
+            font-size: larger;
+        }
+
+        span.popup-help {
+            font-size: smaller;
+        }
+
+        span.popup-help {
+            font-size: 12px;
+        }
+
 INTERNATIONALIZATION
     InlineHelp works with multiple languages by using articles in classes.
     Each class should have a different value for its Locale custom field.
diff --git a/lib/RT/Extension/InlineHelp.pm b/lib/RT/Extension/InlineHelp.pm
index 25b81c7..11f77fe 100644
--- a/lib/RT/Extension/InlineHelp.pm
+++ b/lib/RT/Extension/InlineHelp.pm
@@ -600,6 +600,25 @@ to do so. However, this makes it much more difficult for end users to edit or cu
 help content (since it now lives in code instead of an article). It also makes it more
 difficult to support multiple locales.
 
+=head1 MISC
+
+=head2 Change Icon Size
+
+By default the icon size is inherited from its parent, to customize it, you
+can add css rules on Admin Theme page like:
+
+    span.popup-help {
+        font-size: larger;
+    }
+
+    span.popup-help {
+        font-size: smaller;
+    }
+
+    span.popup-help {
+        font-size: 12px;
+    }
+
 =head1 INTERNATIONALIZATION
 
 InlineHelp works with multiple languages by using articles in classes. Each class should
commit 6af44c7fd5c55257776ac3beec708b18c087124a
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Thu Oct 14 06:28:18 2021 +0800

    Sync and clean up documents

diff --git a/README b/README
index 7550366..c1e252e 100644
--- a/README
+++ b/README
@@ -91,7 +91,9 @@ USAGE
         </script>
 
 REFERENCE
-    There are three primary ways to use the Inline Help:
+    There are four primary ways to use the Inline Help:
+
+    *   "Target Selector"
 
     *   "Mason Templates"
 
@@ -99,7 +101,11 @@ REFERENCE
 
     *   "JavaScript"
 
-    The core API is also available and described in "Programmatic API".
+  Target Selector
+    With this approach, you won't need to write any Mason/HTML/JS code, all
+    you need to do is to specify the elements(using jQuery selector syntax)
+    in aritlces' Target custom field, and the inline help will show up
+    automatically.
 
   Mason Templates
     Add a /Elements/PopupHelp component anywhere in a Mason template:
@@ -154,12 +160,8 @@ REFERENCE
     content" attributes to any HTML elements.
 
     *   data-help Required. The name of the help topic. If data-content is
-        omitted, content will come from an article with this Name. Used as
-        the title of the popup dialog if data-title is not supplied or if in
-        asynchronous mode. See "Async".
-
-    *   data-title Optional. The title to use for the popup dialog box. If
-        omitted, data-help will be used.
+        omitted, content will come from an article with this Name. See
+        "Async".
 
     *   data-content Optional. The help content. If omitted, asynchronous
         mode will be used to dynamically retrieve the help content. See
@@ -174,7 +176,7 @@ REFERENCE
     with some static help content that includes custom HTML
 
         <button data-help="Save Widget"
-                data-content='Saves the <font color="red">Widget</font> to RT'
+                data-content="Saves the Widget to RT"
                 data-action="after">Save</button>
 
     Or we could omit the data-content altogether to have RT return the help
@@ -201,7 +203,7 @@ REFERENCE
 
     This includes the default rule
 
-        { selector: "[data-help]", action: helpify }
+        { selector: "[data-help]" }
 
     which matches anything with a data-help attribute and therefore powers
     the "HTML Attributes" method.
@@ -216,15 +218,10 @@ REFERENCE
     in a page callback somewhere) so they do not need to overlay virtually
     every template in RT just to add help icons throughout.
 
-    Note that renderPopupHelpItems does not consider the ShowInlineHelp
-    setting/user-preference because it is assumed that the server-side logic
-    would already have omitted the JavaScript call altogether (e.g. via the
-    /Elements/PopupHelp component) if ShowInlineHelp was unset.
-
    Help Selector Rules
     A help selector rule is a JavaScript object with the following keys:
 
-    *   selector - *String | Function*
+    *   selector - *String*
 
         Required. Defines which DOM elements should receive a help icon. Can
         match 0, 1, or many elements. Selectors matching 0 elements have no
@@ -233,14 +230,7 @@ REFERENCE
         *   *String* A JQuery selector string that defines the matching DOM
             elements
 
-        *   *Function*
-
-            A JavaScript function that will be passed an instance of the
-            JQuery object and should return a JQuery collection of matching
-            DOM elements. That is, the function signature is function(
-            jQuery ) { ... }
-
-    *   title - *String | Array(String) | Function*
+    *   title - *String*
 
         Optional. The help topic(s) that should be associated with the
         element(s) matching the selector
@@ -250,16 +240,7 @@ REFERENCE
             element, this will be its help topic. If more than one element
             are matched, they will all get this same help topic.
 
-        *   *Array(String)* An array of help topic names. They will be
-            applied in order corresponding to the elements returned by the
-            selector
-
-        *   *Function* A JavaScript function that will be called with the
-            elements matched by the selector that should return the help
-            topic for that element. That is, the function signagure is
-            function( $els ) { ... }
-
-    *   content - *String | Array(String)*
+    *   content - *String*
 
         Optional. The help content to be displayed in the popup when the
         user hovers over the help icon.
@@ -270,11 +251,7 @@ REFERENCE
         *   *String* The help content. May contain HTML. Will be applied for
             all elements matched by selector.
 
-        *   *Array(String)* Each member of the array will be applied to each
-            corresponding member of the array of elements matched by
-            selector.
-
-    *   action - *String | Function*
+    *   action - *String*
 
         Optional. The action that should be taken with each help icon that
         results from the application of selector. Responsible for actually
@@ -283,8 +260,7 @@ REFERENCE
 
         If missing, "append" is the default.
 
-        *   *String* A shortcut method for referencing a number of
-            predefined action functions. The following values are supported:
+        *   *String*
 
             *   *before* The help icon will be prepended to the DOM *before*
                 the element(s) matched by selector
@@ -303,19 +279,6 @@ REFERENCE
                 used, for example, by the /Elements/PopupHelp Mason
                 component.
 
-            *   *offset* The help icon will be offset from the element(s)
-                matched by selector by the amounts communicated in
-                actionArgs. Works with the JQuery offset method and takes an
-                object parameter with coordinate keys { top: 10, left: 20 }
-
-        *   *Function* A JavaScript function responsible for actually adding
-            the help icons to the DOM. Will be called for each element
-            matched by the selector. The function signature is function(
-            $el, rule, actionArgs )
-
-    *   actionArgs - Array Any additional arguments that should be passed to
-        the action function.
-
    Examples
     Add a help topic named "My Topic" to the DOM element with an id of
     "ticket-id"
@@ -350,82 +313,34 @@ REFERENCE
 
         addPopupHelpItems( { selector: "button[type='submit']", title: "A Note on Submitting Forms" } )
 
-    Find every <div> element with a "heading" class, and add a help topic
-    named "One" to the first one, "Two" to the second one, and "Three" to
-    the third one.
-
-        addPopupHelpItems( { selector: "div.heading", title: [ "One", "Two", "Three" ]} )
-
-    Use a custom selector function to match divs that have ids starting with
-    "ACME-" but only when not working locally in developer mode. Determine
-    the article title from the matching ids by stripping off the "ACME-"
-    portion
-
-        var acmeDivs = function( jQuery ) {
-            if (location.hostname != "localhost") {
-                return jQuery("div").filter(function($el) {
-                    return $el.id.startsWith("ACME-")
-                })
-            }
-        }
-
-        var makeTitle = function( el ) {
-            return el.id.replace("ACME-", "")
-        }
-
-        addPopupHelpItems(
-            {
-                selector: acmeDivs,
-                title:    makeTitle
-            }
-        )
-
     Prepend help topics to all form radio buttons
 
         addPopupHelpItems(
             {
                 selector: "form input[type='radio']",
-                topic:    "Radio Button Help",
+                title:    "Radio Button Help",
                 content:  "You can only select one at a time",
                 action:   "prepend"
             }
         )
 
-    Provide help for every field in each section on a ticket display page,
-    but place each help icon in a line at the top of its respective section.
-    Use asynchronous mode for help content, using the field text as the help
-    topic.
-
-        var sectionInsert = function( $els, rule, options ) {
-            $els.each(function(i,el) {
-                const $el = jQuery(el)
-                const $a = $el.closest(".titlebox").find(".titlebox-title.card-header a")
-                const fieldName = $el.text().replace(":", "")
-                $a.append( buildPopupHelpHtml( fieldName ) )
-            })
-        }
-
-        addPopupHelpItems(
-            {
-                selector: ".titlebox .card-body .form-row .label",
-                action:   sectionInsert
-            }
-        )
-
   Programmatic API
     The following functions are part of, and used by, InlineHelp. You can
     also call them directly from your code.
 
-   RT::Interface::Web::GetInlineHelpClass( locales )
+   HTML::Mason::Commands::GetInlineHelpClass( locales )
     Given a list of locales, find the best article class that has been
     associated with the "Inline Help" custom field. Locales are searched in
     order. The first Class with an "Inline Help" custom field and matching
     "Locale" custom field will be returned.
 
-   RT::Interface::Web::GetHelpArticleContent( class_id, article_name )
+   HTML::Mason::Commands::GetInlineHelpArticleTitle( class_id, article_name )
+    Returns the value of the Display Name Custom Field of an Article of the
+    given Class.
+
+   HTML::Mason::Commands::GetInlineHelpArticleContent( class_id, article_name )
     Returns the raw, unscrubbed and unescaped Content of an Article of the
-    given Class. Often, the class_id will come from GetInlineHelpClass, but
-    it does not have to.
+    given Class.
 
   Async
     In asynchronous mode, only the help topic is supplied when the page is
diff --git a/lib/RT/Extension/InlineHelp.pm b/lib/RT/Extension/InlineHelp.pm
index 2fc14fd..25b81c7 100644
--- a/lib/RT/Extension/InlineHelp.pm
+++ b/lib/RT/Extension/InlineHelp.pm
@@ -64,8 +64,7 @@ $RT::Config::META{ShowInlineHelp} = {
 
     # GetInlineHelpArticleTitle class_id, article_name
     #
-    # Returns the value of the C<"Display Name"> Custom Field of an Article of the given Class.
-    # Often, the class_id will come from GetInlineHelpClass, but it does not have to.
+    # Returns the value of the C<Display Name> Custom Field of an Article of the given Class.
 
     sub GetInlineHelpArticleTitle {
         my $class_id     = shift || return '';    # required
@@ -86,7 +85,6 @@ $RT::Config::META{ShowInlineHelp} = {
     # GetInlineHelpArticleContent class_id, article_name
     #
     # Returns the raw, unscrubbed and unescaped Content of an Article of the given Class.
-    # Often, the class_id will come from GetInlineHelpClass, but it does not have to.
 
     sub GetInlineHelpArticleContent {
         my $class_id     = shift || return '';    # required
@@ -221,10 +219,13 @@ query. The following would associate a help topic to a specific button:
 
 =head1 REFERENCE
 
-There are three primary ways to use the Inline Help:
+There are four primary ways to use the Inline Help:
 
 =over
 
+=item *
+L</Target Selector>
+
 =item *
 L</Mason Templates>
 
@@ -236,7 +237,12 @@ L</JavaScript>
 
 =back
 
-The core API is also available and described in L</Programmatic API>.
+=head2 Target Selector
+
+With this approach, you won't need to write any Mason/HTML/JS code, all you
+need to do is to specify the elements(using jQuery selector syntax) in
+aritlces' C<Target> custom field, and the inline help will show up
+automatically.
 
 =head2 Mason Templates
 
@@ -295,12 +301,7 @@ attributes to any HTML elements.
 =item * C<data-help>
 Required. The name of the help topic. If C<data-content>
 is omitted, content will come from an article with this Name.
-Used as the title of the popup dialog if C<data-title> is not supplied or if in
-asynchronous mode. See L</Async>.
-
-=item * C<data-title>
-Optional. The title to use for the popup dialog box. If omitted, C<data-help> will
-be used.
+See L</Async>.
 
 =item * C<data-content>
 Optional. The help content. If omitted, asynchronous mode will be used to dynamically retrieve
@@ -318,7 +319,7 @@ A Mason template might add the C<data-help> attribute to an element along
 with some static help content that includes custom HTML
 
     <button data-help="Save Widget"
-            data-content='Saves the <font color="red">Widget</font> to RT'
+            data-content="Saves the Widget to RT"
             data-action="after">Save</button>
 
 Or we could omit the C<data-content> altogether to have RT return the help content from the
@@ -343,7 +344,7 @@ component in the page footer).
 
 This includes the default rule
 
-    { selector: "[data-help]", action: helpify }
+    { selector: "[data-help]" }
 
 which matches anything with a C<data-help> attribute and therefore powers the L</HTML Attributes>
 method.
@@ -356,17 +357,13 @@ appropriate rules. Importantly, these rules can usually be added to one place (e
 callback somewhere) so they do not need to overlay virtually every template in RT just to
 add help icons throughout.
 
-Note that C<renderPopupHelpItems> does not consider the C<ShowInlineHelp> setting/user-preference because
-it is assumed that the server-side logic would already have omitted the JavaScript call altogether
-(e.g. via the C</Elements/PopupHelp> component) if C<ShowInlineHelp> was unset.
-
 =head3 Help Selector Rules
 
 A help selector rule is a JavaScript object with the following keys:
 
 =over
 
-=item * C<selector> - I<String | Function>
+=item * C<selector> - I<String>
 
 Required. Defines which DOM elements should receive a help icon. Can match 0, 1, or many elements.
 Selectors matching 0 elements have no impact on the DOM.
@@ -376,15 +373,9 @@ Selectors matching 0 elements have no impact on the DOM.
 =item * I<String>
 A JQuery selector string that defines the matching DOM elements
 
-=item * I<Function>
-
-A JavaScript function that will be passed an instance of the C<JQuery> object and should
-return a JQuery collection of matching DOM elements. That is, the function signature
-is C<function( jQuery ) { ... }>
-
 =back
 
-=item * C<title> - I<String | Array(String) | Function>
+=item * C<title> - I<String>
 
 Optional. The help topic(s) that should be associated with the element(s) matching the C<selector>
 
@@ -395,18 +386,9 @@ The name of the help topic that should be matched against the article Name. If t
 matches exactly one element, this will be its help topic. If more than one element are
 matched, they will all get this same help topic.
 
-=item * I<Array(String)>
-An array of help topic names. They will be applied in order corresponding to the elements
-returned by the C<selector>
-
-=item * I<Function>
-A JavaScript function that will be called with the elements matched by the C<selector> that
-should return the help topic for that element. That is, the function signagure is
-C<function( $els ) { ... }>
-
 =back
 
-=item * C<content> - I<String | Array(String)>
+=item * C<content> - I<String>
 
 Optional. The help content to be displayed in the popup when the user hovers
 over the help icon.
@@ -418,13 +400,9 @@ If missing, asynchronous mode is automatically triggered (see L</Async>)
 =item * I<String>
 The help content. May contain HTML. Will be applied for all elements matched by C<selector>.
 
-=item * I<Array(String)>
-Each member of the array will be applied to each corresponding member of the array of
-elements matched by C<selector>.
-
 =back
 
-=item * C<action> - I<String | Function>
+=item * C<action> - I<String>
 
 Optional. The action that should be taken with each help icon that results from the application
 of C<selector>. Responsible for actually adding the help icons to the DOM. This controls, for
@@ -435,8 +413,6 @@ If missing, C<"append"> is the default.
 =over
 
 =item * I<String>
-A shortcut method for referencing a number of predefined action functions. The following values
-are supported:
 
 =over
 
@@ -456,22 +432,10 @@ The help icon will be prepended to the beginning of the DOM element(s) matched b
 The help icon will be inserted into the DOM I<in place of> the element(s) matched by C<selector>.
 This action is used, for example, by the C</Elements/PopupHelp> Mason component.
 
-=item * I<offset>
-The help icon will be offset from the element(s) matched by C<selector> by the amounts
-communicated in C<actionArgs>. Works with the JQuery C<offset> method and takes an object
-parameter with coordinate keys C<{ top: 10, left: 20 }>
-
 =back
 
-=item * I<Function>
-A JavaScript function responsible for actually adding the help icons to the DOM. Will be called
-for each element matched by the C<selector>. The function signature is C<function( $el, rule, actionArgs )>
-
 =back
 
-=item * C<actionArgs> - Array
-Any additional arguments that should be passed to the C<action> function.
-
 =back
 
 =head3 Examples
@@ -507,80 +471,35 @@ of type C<submit>.
 
     addPopupHelpItems( { selector: "button[type='submit']", title: "A Note on Submitting Forms" } )
 
-Find every C<E<lt>divE<gt>> element with a C<"heading"> class, and add a help topic named
-C<"One"> to the first one, C<"Two"> to the second one, and C<"Three"> to the third one.
-
-    addPopupHelpItems( { selector: "div.heading", title: [ "One", "Two", "Three" ]} )
-
-Use a custom C<selector> function to match divs that have ids starting with C<"ACME-"> but only when
-not working locally in developer mode. Determine the article title from the matching ids by stripping
-off the C<"ACME-"> portion
-
-    var acmeDivs = function( jQuery ) {
-        if (location.hostname != "localhost") {
-            return jQuery("div").filter(function($el) {
-                return $el.id.startsWith("ACME-")
-            })
-        }
-    }
-
-    var makeTitle = function( el ) {
-        return el.id.replace("ACME-", "")
-    }
-
-    addPopupHelpItems(
-        {
-            selector: acmeDivs,
-            title:    makeTitle
-        }
-    )
-
 Prepend help topics to all form radio buttons
 
     addPopupHelpItems(
         {
             selector: "form input[type='radio']",
-            topic:    "Radio Button Help",
+            title:    "Radio Button Help",
             content:  "You can only select one at a time",
             action:   "prepend"
         }
     )
 
-Provide help for every field in each section on a ticket display page, but place each
-help icon in a line at the top of its respective section. Use asynchronous mode for
-help content, using the field text as the help topic.
-
-    var sectionInsert = function( $els, rule, options ) {
-        $els.each(function(i,el) {
-            const $el = jQuery(el)
-            const $a = $el.closest(".titlebox").find(".titlebox-title.card-header a")
-            const fieldName = $el.text().replace(":", "")
-            $a.append( buildPopupHelpHtml( fieldName ) )
-        })
-    }
-
-    addPopupHelpItems(
-        {
-            selector: ".titlebox .card-body .form-row .label",
-            action:   sectionInsert
-        }
-    )
-
 =head2 Programmatic API
 
 The following functions are part of, and used by, InlineHelp. You can also call them
 directly from your code.
 
-=head3 RT::Interface::Web::GetInlineHelpClass( locales )
+=head3 HTML::Mason::Commands::GetInlineHelpClass( locales )
 
 Given a list of locales, find the best article class that has been associated with the
 C<"Inline Help"> custom field. Locales are searched in order. The first Class with an
 C<"Inline Help"> custom field and matching C<"Locale"> custom field will be returned.
 
-=head3 RT::Interface::Web::GetHelpArticleContent( class_id, article_name )
+=head3 HTML::Mason::Commands::GetInlineHelpArticleTitle( class_id, article_name )
+
+Returns the value of the C<Display Name> Custom Field of an Article of the given Class.
+
+=head3 HTML::Mason::Commands::GetInlineHelpArticleContent( class_id, article_name )
 
 Returns the raw, unscrubbed and unescaped C<Content> of an Article of the given Class.
-Often, the class_id will come from C<GetInlineHelpClass>, but it does not have to.
 
 =head2 Async
 
commit 8cd20ce6f8e3a96bc4b4669d54882befffb307fe
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Thu Oct 14 06:21:17 2021 +0800

    Update method name for consistency

diff --git a/html/Elements/PopupHelp b/html/Elements/PopupHelp
index 18864bb..19d6adf 100644
--- a/html/Elements/PopupHelp
+++ b/html/Elements/PopupHelp
@@ -57,8 +57,8 @@ if ($Title) {
     my @locs = ( $lh->language_tag(), $lh->fallback_languages() );
     my $help_class = GetInlineHelpClass( \@locs );
     if ($help_class && $help_class->Id) {
-        $help_title = GetHelpArticleTitle( $help_class->id, $Title ) || $Title;
-        $help_content = GetHelpArticleContent( $help_class->Id, $Title );
+        $help_title = GetInlineHelpArticleTitle( $help_class->id, $Title ) || $Title;
+        $help_content = GetInlineHelpArticleContent( $help_class->Id, $Title );
     }
     $has_help = $help_content;
 }
diff --git a/html/Helpers/HelpTopic b/html/Helpers/HelpTopic
index 04ccc79..f1b6677 100644
--- a/html/Helpers/HelpTopic
+++ b/html/Helpers/HelpTopic
@@ -58,8 +58,8 @@ if ($title) {
     my $lh = $session{'CurrentUser'}->LanguageHandle;
     my @locs = ( $lh->language_tag(), $lh->fallback_languages() );
     if ( my $help_class = GetInlineHelpClass( \@locs ) ) {
-        $result{content} = GetHelpArticleContent( $help_class->Id, $title );
-        $result{title} = GetHelpArticleTitle( $help_class->id, $title );
+        $result{content} = GetInlineHelpArticleContent( $help_class->Id, $title );
+        $result{title} = GetInlineHelpArticleTitle( $help_class->id, $title );
     }
 
     $result{content} ||= "<div class='text-danger'>No help was found for '$title'.</div>";
diff --git a/lib/RT/Extension/InlineHelp.pm b/lib/RT/Extension/InlineHelp.pm
index f1df24a..2fc14fd 100644
--- a/lib/RT/Extension/InlineHelp.pm
+++ b/lib/RT/Extension/InlineHelp.pm
@@ -62,12 +62,12 @@ $RT::Config::META{ShowInlineHelp} = {
         return;
     }
 
-    # GetHelpArticleTitle class_id, article_name
+    # GetInlineHelpArticleTitle class_id, article_name
     #
     # Returns the value of the C<"Display Name"> Custom Field of an Article of the given Class.
     # Often, the class_id will come from GetInlineHelpClass, but it does not have to.
 
-    sub GetHelpArticleTitle {
+    sub GetInlineHelpArticleTitle {
         my $class_id     = shift || return '';    # required
         my $article_name = shift || return '';    # required
 
@@ -83,12 +83,12 @@ $RT::Config::META{ShowInlineHelp} = {
         return '';
     }
 
-    # GetHelpArticleContent class_id, article_name
+    # GetInlineHelpArticleContent class_id, article_name
     #
     # Returns the raw, unscrubbed and unescaped Content of an Article of the given Class.
     # Often, the class_id will come from GetInlineHelpClass, but it does not have to.
 
-    sub GetHelpArticleContent {
+    sub GetInlineHelpArticleContent {
         my $class_id     = shift || return '';    # required
         my $article_name = shift || return '';    # required
 
commit 63dd8ac9e44dfa17779803992ef57a869814da71
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Thu Oct 14 06:13:17 2021 +0800

    Drop "offset" support as it is not quite useful and could break layout
    
    The implementation didn't just set the offset of the help icon, but also
    the elemnt the help icon binds to, which is rarely people want.
    
    Considering it's not a useful feature, here we simply drop it.

diff --git a/static/js/inlinehelp.js b/static/js/inlinehelp.js
index 2f7c8e4..1c3873e 100644
--- a/static/js/inlinehelp.js
+++ b/static/js/inlinehelp.js
@@ -28,9 +28,6 @@ function helpify($els, item={}, options={}) {
             case "prepend":
                 $el.prepend( buildPopupHelpHtml( title, content ) );
                 break;
-            case "offset":
-                $el.append( buildPopupHelpHtml( title, content ) ).offset( options );
-                break;
             case "replace":
                 $el.replaceWith( buildPopupHelpHtml( title, content ) );
                 break;
commit 313c89f259e5293bd1231b35fbfd0e49f60406e9
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Thu Oct 14 06:12:23 2021 +0800

    Drop the osbolete "helpify" action argument from code

diff --git a/static/js/inlinehelp.js b/static/js/inlinehelp.js
index 81b4998..2f7c8e4 100644
--- a/static/js/inlinehelp.js
+++ b/static/js/inlinehelp.js
@@ -1,6 +1,6 @@
 // a list of entries to process for the page
 var pagePopupHelpItems = [
-    { selector: "[data-help]", action: helpify }  // by default, anything with data-help attributes gets processed
+    { selector: "[data-help]" }  // by default, anything with data-help attributes gets processed
 ];
 
 if ( RT.CurrentUser.InlineHelp ) {
commit f6b3841b575a63696a1c410a90cfedc5001e81e6
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Thu Oct 14 06:10:55 2021 +0800

    Respect ShowInlineHelp before calling renderPopupHelpItems

diff --git a/html/Callbacks/RT-Extensio-InlineHelp/Elements/Footer/Default b/html/Callbacks/RT-Extensio-InlineHelp/Elements/Footer/Default
index 087ed12..11f115c 100644
--- a/html/Callbacks/RT-Extensio-InlineHelp/Elements/Footer/Default
+++ b/html/Callbacks/RT-Extensio-InlineHelp/Elements/Footer/Default
@@ -6,3 +6,7 @@ jQuery(function() {
     renderPopupHelpItems();
 });
 </script>
+
+<%INIT>
+return unless RT->Config->Get('ShowInlineHelp', $session{CurrentUser});
+</%INIT>
-----------------------------------------------------------------------

Summary of changes:
 README                                             | 152 ++++++--------------
 .../RT-Extensio-InlineHelp/Elements/Footer/Default |   4 +
 html/Elements/PopupHelp                            |   4 +-
 html/Helpers/HelpTopic                             |   4 +-
 lib/RT/Extension/InlineHelp.pm                     | 158 +++++++--------------
 static/js/inlinehelp.js                            |   5 +-
 6 files changed, 99 insertions(+), 228 deletions(-)


hooks/post-receive
-- 
rt-extension-inlinehelp


More information about the Bps-public-commit mailing list