[Bps-public-commit] RT-Extension-FeaturedTickets branch, master, updated. 6487c04f67f117be50efdf69b714e5346c013294
Craig Kaiser
craig at bestpractical.com
Mon Mar 26 17:37:28 EDT 2018
The branch, master has been updated
via 6487c04f67f117be50efdf69b714e5346c013294 (commit)
via 254507b4a78494923aa7fa4586434cfec2c1841b (commit)
from 898691301fca6499699e4000ce6300f5dd570107 (commit)
Summary of changes:
META.yml | 2 +-
html/NoAuth/Featured/index.html | 69 +++++++++++++++++-----------------
html/NoAuth/Helpers/NewSponsor | 18 ++++-----
inc/Module/Install/RTx.pm | 2 +-
inc/Module/Install/RTx/Runtime.pm | 1 +
inc/YAML/Tiny.pm | 6 +--
lib/RT/Extension/FeaturedTickets.pm | 2 +-
static/css/featured-tickets.css | 71 ++++++++++++++++++++++-------------
static/js/Featured.js | 56 ---------------------------
static/js/featured-tickets.js | 75 +++++++++++++++++++++++++++++++++++++
10 files changed, 171 insertions(+), 131 deletions(-)
delete mode 100644 static/js/Featured.js
create mode 100644 static/js/featured-tickets.js
- Log -----------------------------------------------------------------
commit 254507b4a78494923aa7fa4586434cfec2c1841b
Author: craig Kaiser <craig at bestpractical.com>
Date: Fri Mar 23 10:52:54 2018 -0400
Update module install
diff --git a/META.yml b/META.yml
index fb3d4e9..39b6650 100644
--- a/META.yml
+++ b/META.yml
@@ -26,6 +26,6 @@ resources:
license: http://opensource.org/licenses/gpl-license.php
repository: https://github.com/bestpractical/rt-extension-featuredtickets
version: '0.01'
-x_module_install_rtx_version: '0.39'
+x_module_install_rtx_version: '0.40'
x_requires_rt: 4.4.0
x_rt_too_new: 4.6.0
diff --git a/inc/Module/Install/RTx.pm b/inc/Module/Install/RTx.pm
index 3268e7e..7cad529 100644
--- a/inc/Module/Install/RTx.pm
+++ b/inc/Module/Install/RTx.pm
@@ -8,7 +8,7 @@ no warnings 'once';
use Module::Install::Base;
use base 'Module::Install::Base';
-our $VERSION = '0.39';
+our $VERSION = '0.40';
use FindBin;
use File::Glob ();
diff --git a/inc/Module/Install/RTx/Runtime.pm b/inc/Module/Install/RTx/Runtime.pm
index 937949f..ae07502 100644
--- a/inc/Module/Install/RTx/Runtime.pm
+++ b/inc/Module/Install/RTx/Runtime.pm
@@ -33,6 +33,7 @@ sub RTxDatabase {
my $lib_path = File::Basename::dirname($INC{'RT.pm'});
my @args = (
+ "-I.",
"-Ilib",
"-I$RT::LocalLibPath",
"-I$lib_path",
diff --git a/inc/YAML/Tiny.pm b/inc/YAML/Tiny.pm
index 4fd023d..fb157a6 100644
--- a/inc/YAML/Tiny.pm
+++ b/inc/YAML/Tiny.pm
@@ -2,12 +2,12 @@
use 5.008001; # sane UTF-8 support
use strict;
use warnings;
-package YAML::Tiny; # git description: v1.69-8-g2c1e266
+package YAML::Tiny; # git description: v1.72-7-g8682f63
# XXX-INGY is 5.8.1 too old/broken for utf8?
# XXX-XDG Lancaster consensus was that it was sufficient until
# proven otherwise
-our $VERSION = '1.70';
+our $VERSION = '1.73';
#####################################################################
# The YAML::Tiny API.
@@ -374,7 +374,7 @@ sub _load_scalar {
while ( @$lines ) {
$lines->[0] =~ /^(\s*)/;
last unless length($1) >= $indent->[-1];
- push @multiline, substr(shift(@$lines), length($1));
+ push @multiline, substr(shift(@$lines), $indent->[-1]);
}
my $j = (substr($string, 0, 1) eq '>') ? ' ' : "\n";
commit 6487c04f67f117be50efdf69b714e5346c013294
Author: craig Kaiser <craig at bestpractical.com>
Date: Mon Mar 26 15:20:51 2018 -0400
Update variable naming css and js
diff --git a/html/NoAuth/Featured/index.html b/html/NoAuth/Featured/index.html
index f0f45a7..44a3eb1 100644
--- a/html/NoAuth/Featured/index.html
+++ b/html/NoAuth/Featured/index.html
@@ -28,41 +28,47 @@
<script src="http://cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7/html5shiv.js"></script>
<![endif]-->
<!-- Add google analytics tags here -->
-<script
-src="https://code.jquery.com/jquery-3.3.1.min.js"
-integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8="
-crossorigin="anonymous"></script>
+<& /Elements/HeaderJavascript &>
</head>
-<body>
+<body class="featured-tickets-body">
-<div class="logo">
+<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>
</div>
-<div class="banner">
- <h1 class="banner-head">
+<div class="featured-tickets-banner">
+ <h1 class="featured-tickets-banner-head">
Request Tracker (RT)<br>
Sponsor a feature or fix
</h1>
</div>
<!-- The Modal -->
-<div id="myModal" class="modal">
- <!-- Modal content -->
- <div class="modal-content details">
- <span class="close">×</span>
- <h1 class='sponsor-header'>Sponsor This Feature!</h1>
- <hr>
- <h1 id='sponsor-subject'></h1>
- <h4 class='feature-details' id='sponsor-details'></h4>
- <h4 id='sponsor-goal'></h4>
-
- <form id='sponsor-form' name='new-sponsor' onsubmit="event.preventDefault(); NewSponsor();">
- <input class="sponsor-form" placeholder="Name" name="Name" id='form-name' type="text">
- <input class="sponsor-form" placeholder="Email" type="email" id='form-email' name="Email" required>
- <input class="sponsor-form" placeholder="Contribution Amount" id='form-amount' name="Amount">
- <input class="sponsor-form" name="ticketId" id='form-ticket-id' type="hidden">
- <button class="button-choose pure-button">Submit</button>
+<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>
+ <h2><div id="featured-tickets-subject"></div></h2>
+ <h4><div id="featured-tickets-details"></div></h4>
+ <h4><div id="featured-tickets-goal"></div></h4>
+ <fieldset class="featured-tickets-inputs">
+ <div class="pure-control-group">
+ <label for="featured-tickets-name">Name</label>
+ <input id="featured-tickets-name" placeholder="Name">
+ </div>
+ <div class="pure-control-group">
+ <label for="featured-tickets-email">Email</label>
+ <input id="featured-tickets-email" placeholder="Email" type="email">
+ </div>
+ <div class="pure-control-group">
+ <label for="featured-tickets-amount">Amount</label>
+ <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>
+ </fieldset>
</form>
</div>
</div>
@@ -74,20 +80,16 @@ crossorigin="anonymous"></script>
<div class="pricing-table pricing-table-free">
<div class="pricing-table-header">
<h2><% $ticket->Subject ? $ticket->Subject : 'Ticket: ' . $ticket->Id %></h2>
- <p class="feature-details"><% $ticket->FirstCustomFieldValue('Description') %></p>
+ <p><% $ticket->FirstCustomFieldValue('Description') %></p>
</div>
-
- <ul class="pricing-table-list">
- <li>Awesome point 1</li>
- <li>Awesome point 2</li>
% if ( $ticket->FirstCustomFieldValue('Funded') ) {
<div class='ribbon-wrapper'>
<div class='ribbon'>Funded!</div>
</div>
% }
- </ul>
-% my $args = {'ticket_id' => $ticket->Id, 'Subject' => $ticket->Subject, 'Goal' => $ticket->FirstCustomFieldValue('Goal'), 'Details' => $ticket->FirstCustomFieldValue('Description') };
- <button onclick="detailsClicked(<% encode_json( $args ) %>)" type="submit" class="button-choose pure-button" value="<% $ticket->Id %>" name="ticket_id">Details</button>
+
+% 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>
</div>
%}
@@ -134,12 +136,11 @@ crossorigin="anonymous"></script>
</div> <!-- end information -->
</div> <!-- end l-content -->
-<div class="footer l-box">
+<div class="featured-tickets-footer l-box">
<p>
Header image courtesy of <a href='https://unsplash.com/@rawpixel'>@rawpixel</a> on <a href='http://unsplash.com/'>Unsplash</a>.
</p>
</div>
-<script src="/static/js/Featured.js"></script>
</body>
</html>
diff --git a/html/NoAuth/Helpers/NewSponsor b/html/NoAuth/Helpers/NewSponsor
index 19a6607..ab7cf64 100644
--- a/html/NoAuth/Helpers/NewSponsor
+++ b/html/NoAuth/Helpers/NewSponsor
@@ -1,9 +1,12 @@
+% $r->content_type('application/json; charset=utf-8');
+<% JSON( \@msgs ) |n %>
% $m->abort;
<%args>
$ticket_id => undef
</%args>
<%init>
+my @msgs;
if( $ARGS{Email} ){
my $queue = RT::Queue->new(RT->SystemUser);
my ($ret, $msg) = $queue->Load(RT->Config->Get('FeaturedTicketsQueue'));
@@ -17,10 +20,6 @@ if( $ARGS{Email} ){
# If ticket fails to load, just load the page - bogus id
if ( $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});
@@ -34,19 +33,19 @@ if( $ARGS{Email} ){
if ( $ARGS{Amount} > 0 ) {
($ret, $msg) = $ticket->Create(
- Subject => $ARGS{Name} . " Sponsor Ticket For: \"". $parent_ticket->Subject ."\"",
+ Subject => $ARGS{Name} . "\'s Sponsor Ticket For: \"". $parent_ticket->Subject ."\"",
Queue => $queue->Name,
DependedOnBy => $ARGS{ticket_id},
'CustomField-' . $ticket->LoadCustomFieldByIdentifier('Amount')->Id => $ARGS{Amount},
);
RT::Logger->error('Could Not Create Linked Ticket') 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->AddWatcher( Type => 'Requestor', PrincipalId => $user->id );
+ RT::Logger->error('Couldn\'t Add user as Requestor') unless $ret;
}
- ($ret, $msg) = $parent_ticket->AddWatcher( Type => $sponsors->GroupType, PrincipalId => $user->id );
- RT::Logger->debug('Couldn\'t Add user as new sponsor') unless $ret;
+ ($ret, $msg) = $parent_ticket->AddWatcher( Type => 'Requestor', PrincipalId => $user->id );
+ RT::Logger->debug('Couldn\'t Add user as Requestor') unless $ret;
my $new_amount = $ARGS{Amount} + $parent_ticket->FirstCustomFieldValue('Amount');
@@ -63,6 +62,7 @@ if( $ARGS{Email} ){
);
RT::Logger->error('Could not comment on Ticket') unless $ret;
}
+ push @msgs, "Success" unless !$ret;
}
</%init>
diff --git a/lib/RT/Extension/FeaturedTickets.pm b/lib/RT/Extension/FeaturedTickets.pm
index be8ef13..2684107 100644
--- a/lib/RT/Extension/FeaturedTickets.pm
+++ b/lib/RT/Extension/FeaturedTickets.pm
@@ -5,7 +5,7 @@ package RT::Extension::FeaturedTickets;
our $VERSION = '0.01';
RT->AddStyleSheets("featured-tickets.css");
-
+RT->AddJavaScript("featured-tickets.js");
=head1 NAME
diff --git a/static/css/featured-tickets.css b/static/css/featured-tickets.css
index 9311d7e..c74d827 100644
--- a/static/css/featured-tickets.css
+++ b/static/css/featured-tickets.css
@@ -2,22 +2,22 @@
* -- BASE STYLES --
* Most of these are inherited from Base, but I want to change a few.
*/
-body {
+ .featured-tickets-body {
color: #526066;
background: #E8E8E8;
}
-h2, h3 {
+.featured-tickets-h2, featured-tickets-h3 {
letter-spacing: 0.25em;
text-transform: uppercase;
font-weight: 600;
}
-p {
+.featured-tickets-p {
line-height: 1.6em;
}
-.logo {
+.featured-tickets-logo {
position: absolute;
width 183px;
margin-left: -92px;
@@ -57,7 +57,7 @@ p {
* vertically center the text.
*/
-.banner {
+.featured-tickets-banner {
background: transparent
url('/static/images/rawpixel-com-250087-unsplash.jpg') 0 0 no-repeat fixed;
text-align: center;
@@ -69,7 +69,7 @@ p {
display: table;
}
-.banner-head {
+.featured-tickets-banner-head {
display: table-cell;
vertical-align: middle;
margin-bottom: 0;
@@ -135,7 +135,7 @@ p {
}
-.feature-details {
+.featured-tickets-details {
padding-left: 2em;
padding-right: 2em;
}
@@ -189,7 +189,7 @@ p {
* Styles for the "Choose" button at the bottom of a pricing table.
* This inherits from Pure Button.
*/
-.button-choose {
+.featured-tickets-button-choose {
border: 1px solid #ccc;
background: #fff;
color: #333;
@@ -199,12 +199,12 @@ p {
bottom: -1.5em;
}
-.information-head {
+.featured-tickets-information-head {
color: black;
font-weight: 500;
}
-.footer {
+.featured-tickets-footer {
background: #111;
color: #888;
text-align: center;
@@ -231,13 +231,14 @@ p {
}
-input {
+.featured-tickets-input {
display: block;
margin: 0 auto;
widows: 65%;
}
-#sponsor-form {
+.featured-tickets-form {
+ padding: 5px;
align-content: center;
}
@@ -256,7 +257,7 @@ input {
/*
* -- DETAILS POP-UP --
*/
- .modal {
+ .featured-tickets-modal {
display: none; /* Hidden by default */
position: fixed; /* Stay in place */
z-index: 1; /* Sit on top */
@@ -270,36 +271,54 @@ input {
}
/* Modal Content/Box */
-.modal-content {
+.featured-tickets-modal-content {
background-color: #fefefe;
margin: 15% auto; /* 15% from the top and centered */
padding: 20px;
- border: 1px solid #888;
- width: 80%; /* Could be more or less, depending on screen size */
+ border: 2px solid #006699;
+ width: 60%; /* Could be more or less, depending on screen size */
}
+.featured-tickets-modal-content h2 {
+ letter-spacing: 0em;
+ text-transform: none;
+ font-weight: 600;
+ color: #006699;
+}
/* The Close Button */
-.close {
- color: #aaa;
+.featured-tickets-modal-close {
float: right;
- font-size: 28px;
- font-weight: bold;
+ position: relative;
+ top: -51px;
+ right: -30px;
+ display: block;
+ width: 30px;
+ height: 30px;
+ text-indent: -9999px;
+ background: url(../../../static/css/images/jquery-modal-close.png) no-repeat 0 0;
}
-.close:hover,
-.close:focus {
+.featured-tickets-modal-close:hover,
+.featured-tickets-modal-close:focus {
color: black;
text-decoration: none;
cursor: pointer;
}
- .details {
+ .featured-tickets-input {
+ width: 50%;
+ }
+
+ .pure-form-aligned .pure-control-group label {
+ width: 3em;
+ }
+
+ .featured-tickets-details {
width: 50%;
margin: center;
padding: 35px;
border: 2px solid #006699;
background-clip: padding-box;
- text-align: center;
background-color: #d3dae1;
}
@@ -317,8 +336,8 @@ input {
height: 88px;
overflow: hidden;
position: absolute;
- top: -3px;
- right: -3px;
+ top: 0px;
+ right: 0px;
}
.ribbon {
diff --git a/static/js/Featured.js b/static/js/Featured.js
deleted file mode 100644
index c5c519f..0000000
--- a/static/js/Featured.js
+++ /dev/null
@@ -1,56 +0,0 @@
-// Get the modal
-var modal = document.getElementById('myModal');
-
-// Get the button that opens the modal
-var btn = document.getElementById("myBtn");
-
-// Get the <span> element that closes the modal
-var span = document.getElementsByClassName("close")[0];
-
-// Our new sponsor form
-var form = jQuery("#new-sponsor").serialize();
-
-// When the user clicks on <span> (x), close the modal
-span.onclick = function() {
- modal.style.display = "none";
-}
-
-// Create our new ticket for the sponsor
-function NewSponsor() {
- var name = document.getElementById('form-name');
- var email = document.getElementById('form-email');
- var amount = document.getElementById('form-amount');
- var ticket_id = document.getElementById('form-ticket-id');
-
- jQuery.ajax({
- type: 'POST',
- url: "http://localhost:8080/NoAuth//Helpers/LoadObj?Name=" + name.value +";Email=" + email.value + ";Amount=" + amount.value + ";ticket_id="+ticket_id.value,
- dataType: "json",
- });
-
- modal.style.display = "none";
- name.value = '';
- email.value = '';
- amount.value = '';
-};
-
-function detailsClicked( args ) {
- var subject = document.getElementById('sponsor-subject');
- var details = document.getElementById('sponsor-details');
- var goal = document.getElementById('sponsor-goal');
- var form_ticket_id = document.getElementById('form-ticket-id');
-
- subject.innerHTML = args['Subject'];
- details.innerHTML = args['Details'];
- goal.innerHTML = "Goal: $" + ( args['Goal'] ? args['Goal'] : 0 );
- form_ticket_id.value = args['ticket_id'];
-
- modal.style.display = "block";
-}
-
-// When the user clicks anywhere outside of the modal, close it
-window.onclick = function(event) {
- if (event.target == modal) {
- modal.style.display = "none";
- }
-}
\ No newline at end of file
diff --git a/static/js/featured-tickets.js b/static/js/featured-tickets.js
new file mode 100644
index 0000000..2377022
--- /dev/null
+++ b/static/js/featured-tickets.js
@@ -0,0 +1,75 @@
+var modal;
+var span;
+var form;
+var span;
+var name;
+var email;
+var amount;
+var ticket_id;
+var data;
+
+jQuery(document).ready(function() {
+ // Get the modal
+ modal = document.getElementById('featured-tickets-modal-modal');
+
+ // Get the <span> element that closes the modal
+ span = document.getElementsByClassName("featured-tickets-modal-close")[0];
+
+ // Our new sponsor form
+ form = jQuery("#new-sponsor").serialize();
+
+ // When the user clicks on <span> (x), close the modal
+ span.onclick = function() {
+ modal.style.display = "none";
+ }
+});
+
+// Create our new ticket for the sponsor
+function NewSponsor() {
+ sponsor_name = document.getElementById('featured-tickets-name');
+ email = document.getElementById('featured-tickets-email');
+ amount = document.getElementById('featured-tickets-amount');
+ ticket_id = document.getElementById('featured-tickets-ticket-id');
+
+ data = { "Name" : sponsor_name.value, "Email" : email.value, "Amount" : amount.value, "ticket_id" : ticket_id.value };
+
+ jQuery.ajax({
+ type: 'POST',
+ url: "/NoAuth/Helpers/NewSponsor",
+ dataType: "json",
+ data: data,
+ success: function( data ) {
+ console.log('AJAX call to NewSponsor created new sponsor ticket');
+ },
+ error: function () {
+ console.log('An error occured with NewSponsor create');
+ }
+ });
+
+ modal.style.display = "none";
+ sponsor_name.value = '';
+ email.value = '';
+ amount.value = '';
+ ticket_id = '';
+}
+
+function detailsClicked( args ) {
+ var subject = document.getElementById('featured-tickets-subject');
+ var details = document.getElementById('featured-tickets-details');
+ var goal = document.getElementById('featured-tickets-goal');
+ var form_ticket_id = document.getElementById('featured-tickets-ticket-id');
+
+ subject.innerHTML = args['Subject'];
+ details.innerHTML = args['Details'];
+ goal.innerHTML = args['Goal'];
+ form_ticket_id.value = args['ticket_id'];
+
+ modal.style.display = "block";
+}
+
+// When the user clicks anywhere outside of the modal, close it
+window.onclick = function(event) {
+ if (event.target == modal) {
+ modal.style.display = "none";
+ }
+}
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list