[Rt-commit] rt branch, 4.2/charts, updated. rt-4.1.8-488-g4f2fd88
Thomas Sibley
trs at bestpractical.com
Mon Jun 17 14:52:09 EDT 2013
The branch, 4.2/charts has been updated
via 4f2fd8895be1c9787cab6a6b861c0ebca17c9ae9 (commit)
via 6f73404c71d98189282bd6fa2fd10426e91064e2 (commit)
from 264f0ab6cbabe0cd6b0a461bf35829fc500a06fb (commit)
Summary of changes:
share/html/Search/Chart | 48 +++++++++++++++++------------------
share/static/js/event-registration.js | 1 +
2 files changed, 24 insertions(+), 25 deletions(-)
- Log -----------------------------------------------------------------
commit 6f73404c71d98189282bd6fa2fd10426e91064e2
Author: Thomas Sibley <trs at bestpractical.com>
Date: Mon Jun 17 11:25:22 2013 -0700
Refactor error plotting to reduce duplication
It's too easy to change parameters much later and forget to update both
plotting sequences.
diff --git a/share/html/Search/Chart b/share/html/Search/Chart
index aa6cb09..80f8671 100644
--- a/share/html/Search/Chart
+++ b/share/html/Search/Chart
@@ -68,36 +68,34 @@ $Height ||= ($ChartStyle eq 'pie' ? $Width : 400);
my $plot_error = sub {
my $text = shift;
- my $plot = GD::Image->new($Width => $Height);
- $plot->colorAllocate(255, 255, 255); # background
- my $black = $plot->colorAllocate(0, 0, 0);
-
- require GD::Text::Wrap;
- my $error = GD::Text::Wrap->new($plot,
- color => $black,
- text => $text,
- align => "left",
- width => $Width - 20,
- preserve_nl => 1,
- );
- $error->set_font( $font, 16 );
+ my ($plot, $error);
+
+ my $create_plot = sub {
+ my ($width, $height) = @_;
+
+ my $plot = GD::Image->new($width => $height);
+ $plot->colorAllocate(255, 255, 255); # background
+ my $black = $plot->colorAllocate(0, 0, 0);
+
+ require GD::Text::Wrap;
+ my $error = GD::Text::Wrap->new($plot,
+ color => $black,
+ text => $text,
+ align => "left",
+ width => $width - 20,
+ preserve_nl => 1,
+ );
+ $error->set_font( $font, 16 );
+ return ($plot, $error);
+ };
+ ($plot, $error) = $create_plot->($Width, $Height);
my $text_height = ($error->get_bounds(0, 0))[3];
- $plot = GD::Image->new($Width => $text_height+20);
- $plot->colorAllocate(255, 255, 255); # background
- $black = $plot->colorAllocate(0, 0, 0);
+ # GD requires us to replot it all with the new height
+ ($plot, $error) = $create_plot->($Width, $text_height + 20);
- $error = GD::Text::Wrap->new($plot,
- color => $black,
- text => $text,
- align => "left",
- width => $Width - 20,
- preserve_nl => 1,
- );
- $error->set_font( $font, 16 );
$error->draw(10, 10);
-
$m->comp( 'SELF:Plot', plot => $plot, %ARGS );
};
commit 4f2fd8895be1c9787cab6a6b861c0ebca17c9ae9
Author: Thomas Sibley <trs at bestpractical.com>
Date: Mon Jun 17 11:51:12 2013 -0700
Disable the hidden select used to store the complete option hierarchy
Disabling prevents the fields from being unnecessarily submitted.
diff --git a/share/static/js/event-registration.js b/share/static/js/event-registration.js
index 75f015d..98e1e27 100644
--- a/share/static/js/event-registration.js
+++ b/share/static/js/event-registration.js
@@ -51,6 +51,7 @@ jQuery(function() {
var complete = jQuery(this)
.clone(true, true)
.attr("name", name + "-Complete")
+ .attr("disabled", "disabled")
.hide()
.insertAfter(this);
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list