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

Craig Kaiser craig at bestpractical.com
Thu Mar 15 10:14:33 EDT 2018


The branch, master has been updated
       via  5a977fe92e380d752cf92bf44ab835c81e6866e0 (commit)
       via  461f26b9552d43315d836e9aac6817c044af683e (commit)
      from  a1fa2391d00b758225c35e7634d8cfed2f4dbe92 (commit)

Summary of changes:
 html/NoAuth/Featured/Details.html | 29 ++++++++++++++++++
 html/NoAuth/Featured/index.html   | 63 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 92 insertions(+)
 create mode 100644 html/NoAuth/Featured/Details.html
 create mode 100644 html/NoAuth/Featured/index.html

- Log -----------------------------------------------------------------
commit 461f26b9552d43315d836e9aac6817c044af683e
Author: craig Kaiser <craig at bestpractical.com>
Date:   Thu Mar 15 09:44:39 2018 -0400

    Create featured tickets page backend
    
    Create a public page that populates a grid with information from
    tickets. Where the tickets are limited by queue and status. Have a link
    for each box for more detail on the ticket.

diff --git a/html/NoAuth/Featured/index.html b/html/NoAuth/Featured/index.html
new file mode 100644
index 0000000..2520317
--- /dev/null
+++ b/html/NoAuth/Featured/index.html
@@ -0,0 +1,63 @@
+<h1 align='center'>Features</h1>
+
+<ul class="cards-content">
+% while ( my $ticket = $tickets->Next ) {
+    <li>
+        <h2><% $ticket->Subject ? $ticket->Subject : 'Ticket: ' . $ticket->Id %></h2>
+        <h3><% $ticket->FirstCustomFieldValue('Description') %></h3>
+        <form action="/NoAuth/Featured/Details.html">
+            <button type="submit" name="ticketId" value="<% $ticket->Id %>" class="button">READ!</button>
+        </form>
+    </li>
+%   if ( $ticket->FirstCustomFieldValue('Funded') ) {
+        Funded!
+%   }
+    </li>
+% }
+</ul>
+<%init>
+my $queue = RT::Queue->new(RT->SystemUser);
+my ($ret, $msg) = $queue->Load(RT->Config->Get('FeaturedTicketsQueue'));
+return ($ret, $msg) unless $ret;
+
+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');
+
+while (my $status = $statuses->Next() ){
+    $tickets->LimitStatus( VALUE => $status->Content);
+}
+
+if( $ARGS{Email} ){
+    my $ticket = RT::Ticket->new(RT->SystemUser);
+    ($ret, $msg) = $ticket->Load( $ARGS{ticketId} );
+    return ($ret, $msg) unless $ret;
+
+    my $sponsors = RT::CustomRole->new(RT->SystemUser);
+    ($ret, $msg) = $sponsors->Load( 'Sponsors' );
+    return ($ret, $msg) unless $ret;
+
+    my $user = RT::User->new(RT->SystemUser);
+    ($ret, $msg) = $user->LoadByEmail($ARGS{Email});
+
+    if ( !$ret ) {
+        my ($ret, $msg) = $user->Create(
+                RealName           => $ARGS{Name},
+                EmailAddress       => $ARGS{Email},
+                Address1           => $ARGS{Address},
+        );
+    return ($ret, $msg) unless $ret;
+    }
+
+    ($ret, $msg) = $ticket->AddWatcher( Type => $sponsors->GroupType, PrincipalId => $user->id );
+    RT::Logger->error('Couldn\'t Add user as new sponsor') unless $ret;
+
+    ($ret, $msg) = $ticket->Comment(
+        Content  => 'New sponsor added: ' . $ARGS{Email}
+    );
+    RT::Logger->error('Could not comment on Ticket') unless $ret;
+}
+
+</%init>

commit 5a977fe92e380d752cf92bf44ab835c81e6866e0
Author: craig Kaiser <craig at bestpractical.com>
Date:   Thu Mar 15 09:47:13 2018 -0400

    Create featured tickets details page backend
    
    Page that displays additional information on featured tickets. As well
    as allows individuals to add themselves to a custom role on the ticket.

diff --git a/html/NoAuth/Featured/Details.html b/html/NoAuth/Featured/Details.html
new file mode 100644
index 0000000..2b7fd71
--- /dev/null
+++ b/html/NoAuth/Featured/Details.html
@@ -0,0 +1,29 @@
+<div>
+    <% $ticket->Subject %>
+</div>
+<div>
+    <% $ticket->FirstCustomFieldValue('Description') %>
+</div>
+<div>
+    <% $ticket->FirstCustomFieldValue('Goal') %>
+</div>
+<div>
+<p>I Want To Contribute</p>
+<form action="/NoAuth/Featured">
+    <input placeholder="Name" name="Name">
+    <input placeholder="Email" type="email" name="Email" required>
+    <input placeholder="Address" name="Address">
+    <input name="ticketId" value="<% $ticketId %>" type="hidden">
+    <input type="submit" name="Sponsor" value="Submit">
+</form>
+</div>
+
+<%init>
+my $ticket = RT::Ticket->new(RT->SystemUser);
+my ($ret, $msg) = $ticket->Load( $ticketId );
+return ($ret, $msg) unless $ret;
+</%init>
+
+<%args>
+$ticketId
+</%args>

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


More information about the Bps-public-commit mailing list