[Bps-public-commit] RT-BugTracker-Public branch, rt4, updated. f84c3676f9bebfef23e54cea2a6b38fe7c1c9755

Thomas Sibley trs at bestpractical.com
Fri Mar 8 20:36:49 EST 2013


The branch, rt4 has been updated
       via  f84c3676f9bebfef23e54cea2a6b38fe7c1c9755 (commit)
       via  cbcccfe639826396e5ca16094eece14e999082c4 (commit)
       via  9094214c17f99fdf759a6222f9b882cd2198ccf4 (commit)
       via  4648a4a38be55c6e54d663b44c4d3b0469cf0111 (commit)
      from  f541317223a8ad5311eab3a8206f26361ae5f31c (commit)

Summary of changes:
 .../BugTracker-Public/Elements/Tabs/Privileged     | 33 +++++++-----
 html/Callbacks/BugTracker-Public/autohandler/Auth  |  2 +-
 html/NoAuth/css/bugtracker-public.css              | 23 +++++++++
 html/NoAuth/js/bugtracker-public.js                |  8 +++
 html/Public/Bug/Report.html                        | 59 +++++++++++-----------
 lib/RT/BugTracker/Public.pm                        |  3 ++
 6 files changed, 86 insertions(+), 42 deletions(-)
 create mode 100644 html/NoAuth/css/bugtracker-public.css
 create mode 100644 html/NoAuth/js/bugtracker-public.js

- Log -----------------------------------------------------------------
commit 4648a4a38be55c6e54d663b44c4d3b0469cf0111
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Fri Mar 8 14:10:56 2013 -0800

    Avoid an uninitialized warning

diff --git a/html/Callbacks/BugTracker-Public/autohandler/Auth b/html/Callbacks/BugTracker-Public/autohandler/Auth
index 0269754..c420351 100644
--- a/html/Callbacks/BugTracker-Public/autohandler/Auth
+++ b/html/Callbacks/BugTracker-Public/autohandler/Auth
@@ -61,7 +61,7 @@ if (    not ($session{'CurrentUser'} and $session{'CurrentUser'}->id)
 
     # We only care if the public equivalent is a page and not the top-level.
     undef $has_public_equiv
-        if $has_public_equiv eq "/Public/";
+        if $has_public_equiv and $has_public_equiv eq "/Public/";
 
     if ( $path =~ m{ ^/+Public/ }x or $has_public_equiv ) {
         my $cu = new RT::CurrentUser;

commit 9094214c17f99fdf759a6222f9b882cd2198ccf4
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Fri Mar 8 15:34:33 2013 -0800

    Preserve the RT generated "Logged in as..." menu for Bitcard/OpenID users
    
    These users are also forced to the Public view but have actual accounts
    unlike a true guest public user.

diff --git a/html/Callbacks/BugTracker-Public/Elements/Tabs/Privileged b/html/Callbacks/BugTracker-Public/Elements/Tabs/Privileged
index 58926eb..0a51390 100644
--- a/html/Callbacks/BugTracker-Public/Elements/Tabs/Privileged
+++ b/html/Callbacks/BugTracker-Public/Elements/Tabs/Privileged
@@ -6,6 +6,9 @@ return unless RT::BugTracker::Public->IsPublicUser;
 # example)
 my $about = Menu->child("about");
 
+# Save the Preferences menu ("Logged in as..") for Bitcard/OpenID users
+my $preferences = Menu->child("preferences");
+
 # Clear the decks
 RT::Interface::Web::InitializeMenu();
 
@@ -27,19 +30,25 @@ Menu()->child(
 
 Menu->child( "about", menu => $about );
 
-Menu->child(
-    'preferences' => title => loc( 'Welcome [_1]anonymous guest[_2].', '<span class="current-user">', '</span>' ),
-    escape_title  => 0,
-    sort_order    => 100,
-);
+if ($session{CurrentUser}->Name eq RT->Config->Get("WebPublicUser")) {
+    Menu->child(
+        'preferences' => title => loc( 'Welcome [_1]anonymous guest[_2].', '<span class="current-user">', '</span>' ),
+        escape_title  => 0,
+        sort_order    => 100,
+    );
 
-# Public user must logout to login
-Menu->child(
-    "login",
-    title       => loc('Login as another user'),
-    path        => '/NoAuth/Logout.html',
-    sort_order  => 101,
-);
+    # Public user must logout to login
+    Menu->child(
+        "login",
+        title       => loc('Login as another user'),
+        path        => '/NoAuth/Logout.html',
+        sort_order  => 101,
+    );
+} else {
+    # Preserve core RT generated "Logged in as" menu for other authenticated
+    # users from Bitcard and OpenID which also get the Public view
+    Menu->child("preferences", menu => $preferences);
+}
 
 my $queue;
 my $request_path = $HTML::Mason::Commands::r->path_info;

commit cbcccfe639826396e5ca16094eece14e999082c4
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Fri Mar 8 15:35:37 2013 -0800

    Avoid an uninitialized warning on initial page load

diff --git a/html/Public/Bug/Report.html b/html/Public/Bug/Report.html
index 63cf7b3..f0dd74d 100755
--- a/html/Public/Bug/Report.html
+++ b/html/Public/Bug/Report.html
@@ -252,7 +252,7 @@ unless (keys %{$session{'Attachments'}} and $ARGS{'id'} eq 'new') {
 
 # }}}
 
-if ((!exists $ARGS{'AddMoreAttach'}) and ($ARGS{'id'} eq 'new') and $ValidCFs) { # new ticket?
+if ((!exists $ARGS{'AddMoreAttach'}) and (($ARGS{'id'} || '') eq 'new') and $ValidCFs) { # new ticket?
     $m->comp('Display.html', %ARGS);
     $RT::Logger->crit("After display call; error is $@");
     $m->abort();

commit f84c3676f9bebfef23e54cea2a6b38fe7c1c9755
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Fri Mar 8 17:34:22 2013 -0800

    Rework the bug report page with a split layout and clearer instructions
    
    Public guest users are pointed more prominently at a clickable (but
    bot-protected) mailto link.  Bitcard is still mentioned, but is the
    second option rather than the first.
    
    The split layout helps emphasize the instructions vs. the form or method
    of reporting a bug.  Much like RT's side by side ticket create layout,
    the split is reactive and will collapse to a single column for narrow
    browsers.

diff --git a/html/NoAuth/css/bugtracker-public.css b/html/NoAuth/css/bugtracker-public.css
new file mode 100644
index 0000000..64358f1
--- /dev/null
+++ b/html/NoAuth/css/bugtracker-public.css
@@ -0,0 +1,23 @@
+/* Similar to core RT's "sidebyside" styles */
+
+#reporting-a-bug {
+    float: right;
+    width: 58%;
+    clear: right;
+}
+
+.reporting-a-bug-instructions {
+    float: left;
+    width: 40%;
+    clear: left;
+}
+
+ at media (max-width: 950px) {
+    /* Revert to a single column when we're less than 1000px wide */
+    #reporting-a-bug, .reporting-a-bug-instructions {
+        float: none;
+        width: auto;
+        clear: both;
+    }
+}
+
diff --git a/html/NoAuth/js/bugtracker-public.js b/html/NoAuth/js/bugtracker-public.js
new file mode 100644
index 0000000..93ab5a7
--- /dev/null
+++ b/html/NoAuth/js/bugtracker-public.js
@@ -0,0 +1,8 @@
+jQuery(function() {
+    jQuery("a[data-bug-email]").each(function() {
+        var a = jQuery(this);
+        a.attr("href", "mailto:bug-"
+                       + encodeURIComponent(a.attr("data-bug-email"))
+                       + "@rt.cpan.org");
+    });
+});
diff --git a/html/Public/Bug/Report.html b/html/Public/Bug/Report.html
index f0dd74d..cf736fb 100755
--- a/html/Public/Bug/Report.html
+++ b/html/Public/Bug/Report.html
@@ -48,6 +48,7 @@
 <& /Elements/Header, Title => loc("Report a bug in [_1]", $Queue) &>
 <& /Elements/Tabs &>
 
+<div class="reporting-a-bug-instructions">
 <p>
 Thanks for taking the time to report a bug in <em><% $Queue %></em>.  You
 should be aware that each and every module available through CPAN is free
@@ -63,17 +64,25 @@ deserves:
   <li>Be detailed.</li>
 </ul>
 
+<p>
+Try to include any information you think might help the developer isolate,
+reproduce and fix your problem.
+</p>
+</div>
+
+<div id="reporting-a-bug">
 % if ( $session{'CurrentUser'}->Name eq $RT::WebPublicUser ) {
 
-<p>
-  <strong>Due to spam, you must login with a Bitcard (or PAUSE) account to report a bug
-  via the web interface.  See the <a href="<% RT->Config->Get('WebPath') %>/NoAuth/Logout.html">front page</a> for details
-  on obtaining and logging in with a Bitcard account.</strong>
+<p style="font-weight: bold">
+  The quickest way to report a bug in <% $QueueObj->Name %> is by sending email to
+  <a style="font-size: 1.2em" href="#" data-bug-email="<% $QueueObj->Name %>">bug-<% $QueueObj->Name %> <i>[at]</i> rt.cpan.org</a>.
 </p>
 
-<p><strong>
-If you do not wish to register with Bitcard, please report your bug by sending email to: </strong>
-bug-<% $QueueObj->Name %> <i>[at]</i> rt.cpan.org.
+<p>
+  If you want to report a bug via the web, you must login with a Bitcard or
+  other account.  Accounts are required due to spam.
+  See the <a href="<% RT->Config->Get('WebPath') %>/NoAuth/Logout.html">login page</a> for details
+  on obtaining and logging in with a Bitcard account.
 </p>
 
 % } else {
@@ -147,12 +156,21 @@ bug-<% $QueueObj->Name %> <i>[at]</i> rt.cpan.org.
 % } else {
 <& /Elements/MessageBox, QuoteTransaction => $QuoteTransaction &>
 %}
+</td>
+</tr>
+<tr>
+<td align="RIGHT" colspan="2">
+</td>
+</tr>
+</table>
+<& /Elements/Submit, Label => loc("Create")&>
+</div>
+
+</form>
 % }
-<p>
-Try to include any information you think might help the developer isolate,
-reproduce and fix your problem.
-</p>
+</div>
 
+<div class="reporting-a-bug-instructions">
 <p>
 Be sure to include at least the following information:
 
@@ -173,20 +191,8 @@ Other things that are often helpful:
     <li>A patch against the latest released version of this distribution which fixes this bug.</li>
   </ul>
 </p>
-% if ( $session{'CurrentUser'}->Name ne $RT::WebPublicUser ) {
-</td>
-</tr>
-<tr>
-<td align="RIGHT" colspan="2">
-</td>
-</tr>
-</table>
-<& /Elements/Submit, Label => loc("Create")&>
 </div>
 
-</form>
-% }
-
 <%INIT>
 $Queue =~ s/::/-/g;
 
@@ -257,12 +263,7 @@ if ((!exists $ARGS{'AddMoreAttach'}) and (($ARGS{'id'} || '') eq 'new') and $Val
     $RT::Logger->crit("After display call; error is $@");
     $m->abort();
 }
-
-my $current_tab = "Public/Bug/Report.html"
-    ."?Queue=". $m->interp->apply_escapes($QueueObj->Name, 'u');
-
 </%INIT>
-
 <%ARGS>
 $DependsOn => undef
 $DependedOnBy => undef
diff --git a/lib/RT/BugTracker/Public.pm b/lib/RT/BugTracker/Public.pm
index 37a6dc2..9c79678 100644
--- a/lib/RT/BugTracker/Public.pm
+++ b/lib/RT/BugTracker/Public.pm
@@ -55,6 +55,9 @@ use URI::Escape qw/ uri_escape /;
 
 our $VERSION = '0.03_02';
 
+RT->AddJavaScript("bugtracker-public.js");
+RT->AddStyleSheets("bugtracker-public.css");
+
 =head1 NAME
 
 RT::BugTracker::Public - Adds a public, (hopefully) userfriendly bug tracking UI to RT

-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list