[Bps-public-commit] RT-Extension-FeaturedTickets branch, master, updated. d199458ca0cbb94af8eda7fa0d1e4fbc2e246cc8

Craig Kaiser craig at bestpractical.com
Fri Mar 30 08:34:58 EDT 2018


The branch, master has been updated
       via  d199458ca0cbb94af8eda7fa0d1e4fbc2e246cc8 (commit)
       via  0ace130b28f51d42e91d5b51cd667abb9371e764 (commit)
       via  0519decadd93c99451c3d6082bb2ff9590e22e03 (commit)
       via  d06a9a3f95a189f539c5a682f23c4bbb2902968d (commit)
      from  6487c04f67f117be50efdf69b714e5346c013294 (commit)

Summary of changes:
 README                              | 43 ++++++++++++++++++++++++++-----------
 etc/initialdata                     | 30 +++++---------------------
 html/NoAuth/Featured/Details.html   | 37 -------------------------------
 html/NoAuth/Featured/index.html     | 17 ++++++---------
 lib/RT/Extension/FeaturedTickets.pm | 36 ++++++++++++++++++++++---------
 static/css/featured-tickets.css     | 17 +++++++++------
 static/js/featured-tickets.js       | 11 ++++++++--
 7 files changed, 87 insertions(+), 104 deletions(-)
 delete mode 100644 html/NoAuth/Featured/Details.html

- Log -----------------------------------------------------------------
commit d06a9a3f95a189f539c5a682f23c4bbb2902968d
Author: craig Kaiser <craig at bestpractical.com>
Date:   Thu Mar 29 15:51:41 2018 -0400

    Update initialdata file
    
    Remove not needed customrole and customfield due to switching
    to config options. Create queue 'FeaturedTickets' to default
    customfields to. This is better than looking for a config value
    in RT_SiteConfig.

diff --git a/etc/initialdata b/etc/initialdata
index 467fa31..fd4e3be 100644
--- a/etc/initialdata
+++ b/etc/initialdata
@@ -1,16 +1,12 @@
 use strict;
 use warnings;
 
-my $QueueName = RT->Config->Get('FeaturedTicketsQueue');
+my $QueueName = 'FeaturedTickets';
 our @CustomFields;
 
-our @CustomRoles = (
-    {
-        Name        => 'Sponsors',
-        Description => 'Sponsors for Feature',
-        ApplyTo     => $QueueName,
-    },
-);
+our @Queues = ({
+    Name => 'FeaturedTickets',
+});
 
 @CustomFields = (
     {
@@ -38,26 +34,10 @@ our @CustomRoles = (
          ApplyTo     => $QueueName,
     },
     {
-         Name        =>'Details',
+         Name        =>'Description',
          Type        =>'Text',
          LookupType  =>'RT::Queue-RT::Ticket',
          Description =>'Details On Feature',
          ApplyTo     => $QueueName,
     },
-     {
-         Name        =>'Featured Statuses',
-         Type        =>'SelectMultiple',
-         RenderType  =>'List',
-         Values      => [
-             { Name =>'New', SortOrder => 1 },
-             { Name =>'Open', SortOrder => 2 },
-             { Name =>'Resolved', SortOrder => 3 },
-             { Name =>'Stalled', SortOrder => 4 },
-             { Name =>'Rejected', SortOrder => 5 },
-             { Name =>'Deleted', SortOrder => 6 },
-         ],
-         LookupType  =>'RT::Queue',
-         Description =>'Statuses of Tickets in Queue that will be displayed',
-         ApplyTo     => $QueueName,
-    },
 );
\ No newline at end of file

commit 0519decadd93c99451c3d6082bb2ff9590e22e03
Author: craig Kaiser <craig at bestpractical.com>
Date:   Thu Mar 29 15:53:49 2018 -0400

    Improve styling and JS on Featured page

diff --git a/html/NoAuth/Featured/index.html b/html/NoAuth/Featured/index.html
index 44a3eb1..eb13369 100644
--- a/html/NoAuth/Featured/index.html
+++ b/html/NoAuth/Featured/index.html
@@ -30,7 +30,7 @@
 <!-- Add google analytics tags here -->
 <& /Elements/HeaderJavascript &>
 </head>
-<body class="featured-tickets-body">
+<body class="featured-tickets-body" id="featured-tickets-body">
 
 <div class="featured-tickets-logo">
     <a href="https://bestpractical.com" class="logo-link"><img src="https://static.bestpractical.com/bpslogo.png" alt="Best Practical Solutions logo"></a>
@@ -47,9 +47,7 @@
 <div class="featured-tickets-modal" id="featured-tickets-modal-modal" align='center'>
     <div class="featured-tickets-modal-content">
         <form class="pure-form pure-form-aligned" onsubmit="event.preventDefault(); NewSponsor();">
-            <span class="featured-tickets-modal-close"></span>
-            <h1>Sponsor This Feature!</h1>
-            <hr>
+            <span class="featured-tickets-modal-close" id="featured-tickets-modal-close"></span>
             <h2><div id="featured-tickets-subject"></div></h2>
             <h4><div id="featured-tickets-details"></div></h4>
             <h4><div id="featured-tickets-goal"></div></h4>
@@ -67,7 +65,7 @@
                     <input id="featured-tickets-amount" placeholder="Contribution Amount">
                 </div>
                 <input id="featured-tickets-ticket-id" type="hidden">
-                <button type="submit" class="pure-button pure-button-primary">Submit</button>
+                <button type="submit" class="featured-tickets-button-choose pure-button">Submit</button>
             </fieldset>
         </form>
     </div>
@@ -80,14 +78,13 @@
         <div class="pricing-table pricing-table-free">
             <div class="pricing-table-header">
                 <h2><% $ticket->Subject ? $ticket->Subject : 'Ticket: ' . $ticket->Id %></h2>
-                    <p><% $ticket->FirstCustomFieldValue('Description') %></p>
                 </div>
 %   if ( $ticket->FirstCustomFieldValue('Funded') ) {
     <div class='ribbon-wrapper'>
         <div class='ribbon'>Funded!</div>
     </div>
 %   }
-
+<p><% $ticket->FirstCustomFieldValue('Description') %></p>
 %   my $args = {'ticket_id' => $ticket->Id, 'Subject' => $ticket->Subject, 'Goal' => 'Goal: $' . ($ticket->FirstCustomFieldValue('Goal') ? $ticket->FirstCustomFieldValue('Goal') : 0), 'Details' => $ticket->FirstCustomFieldValue('Description') };
                     <button onclick="detailsClicked(<% encode_json( $args ) %>)" type="submit" class="featured-tickets-button-choose pure-button" value="<% $ticket->Id %>" name="ticket_id">Details</button>
             </div>
@@ -153,10 +150,10 @@ my $tickets = RT::Tickets->new(RT->SystemUser);
 ($ret, $msg) = $tickets->LimitQueue( VALUE => $queue->Name );
 return ($ret, $msg) unless $ret;
 
-my $statuses = $queue->CustomFieldValues('Featured statuses');
+my @statuses = RT->Config->Get('FeaturedTicketStatuses');
 
-while (my $status = $statuses->Next() ){
-    $tickets->LimitStatus( VALUE => $status->Content);
+for my $status (@statuses) {
+    $tickets->LimitStatus( VALUE => $status->[0]);
 }
 </%init>
 
diff --git a/static/css/featured-tickets.css b/static/css/featured-tickets.css
index c74d827..492eb70 100644
--- a/static/css/featured-tickets.css
+++ b/static/css/featured-tickets.css
@@ -3,8 +3,8 @@
  * Most of these are inherited from Base, but I want to change a few.
  */
  .featured-tickets-body {
-    color: #526066;
-    background: #E8E8E8;
+    color: black;
+    background: #FAFAFA;
 }
 
 .featured-tickets-h2, featured-tickets-h3 {
@@ -63,7 +63,7 @@
     text-align: center;
     background-size: cover;
     filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/static/images/rawpixel-com-250087-unsplash.jpg', sizingMethod='scale');
-    height: 200px;
+    height: 400px;
     width: 100%;
     margin-bottom: 3em;
     display: table;
@@ -112,6 +112,7 @@
  */
 .pricing-table-free .pricing-table-header {
     background: #006699;
+    text-align: center;
 }
 
 .pricing-table-biz .pricing-table-header {
@@ -129,7 +130,8 @@
 }
 .pricing-table-header h2 {
     margin: 0;
-    padding-top: 2em;
+    padding-top:1em;
+    padding-bottom: 1em;
     font-size: 1em;
     font-weight: normal;
 
@@ -196,7 +198,6 @@
     border-radius: 2em;
     font-weight: bold;
     position: relative;
-    bottom: -1.5em;
 }
 
 .featured-tickets-information-head {
@@ -265,7 +266,9 @@
     top: 0;
     width: 100%; /* Full width */
     height: 100%; /* Full height */
-    overflow: auto; /* Enable scroll if needed */
+    overflow-x: -moz-hidden-unscrollable;
+    overflow-x: hidden;
+    overflow-y: auto;
     background-color: rgb(0,0,0); /* Fallback color */
     background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
 }
@@ -276,7 +279,7 @@
     margin: 15% auto; /* 15% from the top and centered */
     padding: 20px;
     border: 2px solid #006699;
-    width: 60%; /* Could be more or less, depending on screen size */
+    width: 40%; /* Could be more or less, depending on screen size */
 }
 
 .featured-tickets-modal-content h2 {
diff --git a/static/js/featured-tickets.js b/static/js/featured-tickets.js
index 2377022..c1dac64 100644
--- a/static/js/featured-tickets.js
+++ b/static/js/featured-tickets.js
@@ -12,15 +12,18 @@ jQuery(document).ready(function() {
     // Get the modal
     modal = document.getElementById('featured-tickets-modal-modal');
 
+    FeaturedTicketsPage = document.getElementById('featured-tickets-body');
+
     // Get the <span> element that closes the modal
-    span = document.getElementsByClassName("featured-tickets-modal-close")[0];
+    FeaturedTicketSpan = document.getElementById('featured-tickets-modal-close');
 
     // Our new sponsor form
     form = jQuery("#new-sponsor").serialize();
 
     // When the user clicks on <span> (x), close the modal
-    span.onclick = function() {
+    FeaturedTicketSpan.onclick = function() {
         modal.style.display = "none";
+        FeaturedTicketsPage.style.overflow = 'auto';
     }
 });
 
@@ -47,6 +50,8 @@ function NewSponsor() {
     });
 
     modal.style.display = "none";
+    FeaturedTicketsPage.style.overflow = 'auto';
+
     sponsor_name.value = '';
     email.value = '';
     amount.value = '';
@@ -65,11 +70,13 @@ function detailsClicked( args )  {
     form_ticket_id.value = args['ticket_id'];
 
     modal.style.display = "block";
+    FeaturedTicketsPage.style.overflow = 'hidden';
 }
 
 // When the user clicks anywhere outside of the modal, close it
 window.onclick = function(event) {
     if (event.target == modal) {
         modal.style.display = "none";
+        FeaturedTicketsPage.style.overflow = 'auto';
     }
 }

commit 0ace130b28f51d42e91d5b51cd667abb9371e764
Author: craig Kaiser <craig at bestpractical.com>
Date:   Thu Mar 29 16:06:15 2018 -0400

    Update docs for extension

diff --git a/README b/README
index 3eb081c..4379712 100644
--- a/README
+++ b/README
@@ -1,15 +1,33 @@
 NAME
-    RT-Extension-FeaturedTickets - [One line description of module's purpose
-    here]
+    RT-Extension-FeaturedTickets - Generate public web page for featured
+    tickets.
 
 DESCRIPTION
-    [Why would someone install this extension? What does it do? What problem
-    does it solve?]
+    Create a webpage that anyone can view (NoAuth), displaying details on
+    featured tickets. A visitor can decide to sign up as a requestor on a
+    linked ticket in the same queue. The tickets featured can be selected
+    from a queue and limited to their statuses.
 
-RT VERSION
-    Works with RT [What versions of RT is this known to work with?]
+Configuration
+    Will need to specify two config variables for the extension:
+
+        Set($FeaturedTicketsQueue, 'FeaturedTickets');
+
+    $FeaturedTicketsQueue specifies which queue the featured tickets will be
+    loaded from, when the initialdata is loaded the 'FeaturedTickets' queue
+    is created by default. Renaming this queue is the simplest way to use
+    another queue name but keep the relevant applied custom fields.
 
-    [Make sure to use requires_rt and rt_too_new in Makefile.PL]
+        Set($FeaturedTicketStatuses, ['open', ...]);
+
+    $FeaturedTicketStatuses is an array ref, where the ticket statuses that
+    will be accepted from the $FeaturedTicketsQueue are specified. Only
+    tickets with one of the statuses in the array will be listed on the
+    featured page. It is advisable not to use 'new' as an accepted status,
+    or sponsored tickets will also be displayed.
+
+RT VERSION
+    Works with RT 4.4
 
 INSTALLATION
     perl Makefile.PL
@@ -18,17 +36,16 @@ INSTALLATION
         May need root permissions
 
     Edit your /opt/rt4/etc/RT_SiteConfig.pm
-        If you are using RT 4.2 or greater, add this line:
+        Activate the plugin by adding the below:
 
             Plugin('RT::Extension::FeaturedTickets');
 
-        For RT 4.0, add this line:
-
-            Set(@Plugins, qw(RT::Extension::FeaturedTickets));
-
         or add RT::Extension::FeaturedTickets to your existing @Plugins
         line.
 
+    Insert into database
+            make initdb
+
     Clear your mason cache
             rm -rf /opt/rt4/var/mason_data/obj
 
@@ -47,7 +64,7 @@ BUGS
         L<rt.cpan.org|http://rt.cpan.org/Public/Dist/Display.html?Name=RT-Extension-FeaturedTickets>.
 
 LICENSE AND COPYRIGHT
-    This software is Copyright (c) 2018 by Craig
+    This software is Copyright (c) 2018 by Best Practical Solutions, LLC.
 
     This is free software, licensed under:
 
diff --git a/lib/RT/Extension/FeaturedTickets.pm b/lib/RT/Extension/FeaturedTickets.pm
index 2684107..cb3e6d0 100644
--- a/lib/RT/Extension/FeaturedTickets.pm
+++ b/lib/RT/Extension/FeaturedTickets.pm
@@ -9,18 +9,34 @@ RT->AddJavaScript("featured-tickets.js");
 
 =head1 NAME
 
-RT-Extension-FeaturedTickets - [One line description of module's purpose here]
+RT-Extension-FeaturedTickets - Generate public web page for featured tickets.
 
 =head1 DESCRIPTION
 
-[Why would someone install this extension? What does it do? What problem
-does it solve?]
+Create a webpage that anyone can view (NoAuth), displaying details on featured tickets. A visitor
+can decide to sign up as a requestor on a linked ticket in the same queue. The tickets featured
+can be selected from a queue and limited to their statuses.
+
+=head1 Configuration
+
+Will need to specify two config variables for the extension:
+
+    Set($FeaturedTicketsQueue, 'FeaturedTickets');
+
+$FeaturedTicketsQueue specifies which queue the featured tickets will be loaded from, when
+the initialdata is loaded the 'FeaturedTickets' queue is created by default. Renaming this queue is the simplest
+way to use another queue name but keep the relevant applied custom fields.
+
+    Set($FeaturedTicketStatuses, ['open', ...]);
+
+$FeaturedTicketStatuses is an array ref, where the ticket statuses that will be accepted from the $FeaturedTicketsQueue
+are specified. Only tickets with one of the statuses in the array will be listed on the featured page. It is advisable
+not to use 'new' as an accepted status, or sponsored tickets will also be displayed.
 
 =head1 RT VERSION
 
-Works with RT [What versions of RT is this known to work with?]
+Works with RT 4.4
 
-[Make sure to use requires_rt and rt_too_new in Makefile.PL]
 
 =head1 INSTALLATION
 
@@ -36,15 +52,15 @@ May need root permissions
 
 =item Edit your F</opt/rt4/etc/RT_SiteConfig.pm>
 
-If you are using RT 4.2 or greater, add this line:
+Activate the plugin by adding the below:
 
     Plugin('RT::Extension::FeaturedTickets');
 
-For RT 4.0, add this line:
+or add C<RT::Extension::FeaturedTickets> to your existing C<@Plugins> line.
 
-    Set(@Plugins, qw(RT::Extension::FeaturedTickets));
+=item Insert into database
 
-or add C<RT::Extension::FeaturedTickets> to your existing C<@Plugins> line.
+    make initdb
 
 =item Clear your mason cache
 
@@ -70,7 +86,7 @@ or via the web at
 
 =head1 LICENSE AND COPYRIGHT
 
-This software is Copyright (c) 2018 by Craig
+This software is Copyright (c) 2018 by Best Practical Solutions, LLC.
 
 This is free software, licensed under:
 

commit d199458ca0cbb94af8eda7fa0d1e4fbc2e246cc8
Author: craig Kaiser <craig at bestpractical.com>
Date:   Fri Mar 30 08:34:12 2018 -0400

    Remove extra file

diff --git a/html/NoAuth/Featured/Details.html b/html/NoAuth/Featured/Details.html
deleted file mode 100644
index 238734b..0000000
--- a/html/NoAuth/Featured/Details.html
+++ /dev/null
@@ -1,37 +0,0 @@
-
-% if ( $ret ) {
-<div>
-    <% $ticket->Subject %>
-</div>
-<div>
-    <% $ticket->FirstCustomFieldValue('Details') %>
-</div>
-<div>
-    <% $ticket->FirstCustomFieldValue('Goal') %>
-</div>
-<div>
-<p>I Want To Contribute</p>
-<form action="/NoAuth/Featured">
-    <input placeholder="Name" name="Name" type="text">
-    <input placeholder="Email" type="email" name="Email" required>
-    <input placeholder="Contribution Amount" name="Amount">
-    <input name="ticket_id" value="<% $ticket_id %>" type="hidden">
-    <input type="submit" name="Sponsor" value="Submit">
-</form>
-</div>
-% } else {
-<div align='center'>
-    <h1>A Problem Occured With The Ticket ID</h1>
-    <a href="/NoAuth/Featured">Follow Me Back To The Featured Page</a>
-</div>
-% }
-
-<%init>
-my $ticket = RT::Ticket->new(RT->SystemUser);
-my ($ret, $msg) = $ticket->Load( $ticket_id );
-RT::Logger->error("$msg") unless $ret;
-</%init>
-
-<%args>
-$ticket_id => undef
-</%args>

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


More information about the Bps-public-commit mailing list