[Bps-public-commit] rt-extension-exampletheme branch, master, updated. 7ffe987e2fbb9fb2750d676213193bbaf4a14dad

Jim Brandt jbrandt at bestpractical.com
Wed Sep 13 12:04:26 EDT 2017


The branch, master has been updated
       via  7ffe987e2fbb9fb2750d676213193bbaf4a14dad (commit)
       via  2ccdaa4b8d64e7079f588b99fd6167df6155cd97 (commit)
       via  a51281b1027d5f6b4f511904b093de2ce2804dde (commit)
      from  0ca4779ec8a6a8f953f2bebe2b4628306ee6e890 (commit)

Summary of changes:
 README                            |  33 ++++++++++++++++++++++++++++-----
 inc/YAML/Tiny.pm                  |  12 +++++-------
 lib/RT/Extension/ExampleTheme.pm  |  34 ++++++++++++++++++++++++++++------
 static/css/example-theme.css      |   5 +++++
 static/css/example-theme/main.css |   2 +-
 static/images/bpssymbol.png       | Bin 5007 -> 11211 bytes
 static/js/example-theme.js        |   7 +++++++
 7 files changed, 74 insertions(+), 19 deletions(-)
 create mode 100644 static/css/example-theme.css
 create mode 100644 static/js/example-theme.js

- Log -----------------------------------------------------------------
commit a51281b1027d5f6b4f511904b093de2ce2804dde
Author: Jim Brandt <jbrandt at bestpractical.com>
Date:   Wed Sep 13 11:46:44 2017 -0400

    Add CSS and JS UI change examples

diff --git a/README b/README
index 7b0efdc..6480900 100644
--- a/README
+++ b/README
@@ -9,11 +9,6 @@ DESCRIPTION
 RT VERSION
     Works with RT 4.2, 4.4
 
-CONFIGURATION
-To set this theme as the default RT theme (optional), add the following line to your
-RT_SiteConfig.pm
-        Set( $WebDefaultStylesheet, ('example-theme'));
-
 INSTALLATION
     perl Makefile.PL
     make
@@ -28,6 +23,34 @@ INSTALLATION
 
     Restart your webserver
 
+CONFIGURATION
+    To set this theme as the default RT theme (optional), add the following
+    line to your RT_SiteConfig.pm
+
+        Set( $WebDefaultStylesheet, ('example-theme'));
+
+    Individual users can also select the theme they want on their
+    preferences page.
+
+EXAMPLE CONTENT
+    This extension provides some examples of ways to customize the style of
+    RT. You can find more information in the RT Style Documentation
+    <https://docs.bestpractical.com/rt/latest/customizing/styling_rt.html>.
+
+  CSS
+    To change the appearance of RT, you can modify any CSS files you copy
+    from one of RT's base themes. In addition to copying and modifying the
+    CSS set by RT, you can add your own and even do things like hide parts
+    of the RT UI. See static/css/example-theme.css for an example of hiding
+    the "Priority" field.
+
+  Javascript
+    RT uses jQuery, which provides many tools to modify the RT UI via
+    javascript. To see an example of changing a label with jQuery, see
+    static/js/example-theme.js, which changes "The Basics" on the ticket
+    display page to "Ticket State". The trickiest part is often getting the
+    selector right.
+
 AUTHOR
     Best Practical Solutions, LLC <modules at bestpractical.com>
 
diff --git a/lib/RT/Extension/ExampleTheme.pm b/lib/RT/Extension/ExampleTheme.pm
index 62a95c1..c1365e7 100644
--- a/lib/RT/Extension/ExampleTheme.pm
+++ b/lib/RT/Extension/ExampleTheme.pm
@@ -6,6 +6,7 @@ our $VERSION = '0.01';
 
 # Add css files to the @CSSFiles config
 RT->AddStyleSheets('example-theme.css');
+RT->AddJavaScript('example-theme.js');
 
 =head1 NAME
 
@@ -20,12 +21,6 @@ to change the look and feel of RT. These changes are saved as a theme for others
 
 Works with RT 4.2, 4.4
 
-=head1 CONFIGURATION
-To set this theme as the default RT theme (optional), add the following line to your
-RT_SiteConfig.pm
-
-    Set( $WebDefaultStylesheet, ('example-theme'));
-
 =head1 INSTALLATION
 
 =over
@@ -51,6 +46,33 @@ Add this line:
 
 =back
 
+=head1 CONFIGURATION
+
+To set this theme as the default RT theme (optional), add the following line to your
+RT_SiteConfig.pm
+
+    Set( $WebDefaultStylesheet, ('example-theme'));
+
+Individual users can also select the theme they want on their preferences page.
+
+=head1 EXAMPLE CONTENT
+
+This extension provides some examples of ways to customize the style of RT. You can find
+more information in the L<RT Style Documentation|https://docs.bestpractical.com/rt/latest/customizing/styling_rt.html>.
+
+=head2 CSS
+
+To change the appearance of RT, you can modify any CSS files you copy from one of RT's base
+themes. In addition to copying and modifying the CSS set by RT, you can add your own and
+even do things like hide parts of the RT UI. See F<static/css/example-theme.css> for an
+example of hiding the "Priority" field.
+
+=head2 Javascript
+
+RT uses jQuery, which provides many tools to modify the RT UI via javascript. To see an example
+of changing a label with jQuery, see F<static/js/example-theme.js>, which changes "The Basics" on
+the ticket display page to "Ticket State". The trickiest part is often getting the selector right.
+
 =head1 AUTHOR
 
 Best Practical Solutions, LLC E<lt>modules at bestpractical.comE<gt>
diff --git a/static/css/example-theme.css b/static/css/example-theme.css
new file mode 100644
index 0000000..7733d71
--- /dev/null
+++ b/static/css/example-theme.css
@@ -0,0 +1,5 @@
+/* Example of hiding the priority label on ticket dipslay with some CSS */
+
+tr.priority {
+    display: none;
+}
diff --git a/static/js/example-theme.js b/static/js/example-theme.js
new file mode 100644
index 0000000..2bf69a7
--- /dev/null
+++ b/static/js/example-theme.js
@@ -0,0 +1,7 @@
+/* Example of modifying the RT UI using jQuery. */
+/* This changes "The Basics" to "Ticket State" on ticket display */
+
+jQuery( document ).ready(function() {
+    jQuery(".ticket-info-basics .ticket-info-basics .titlebox-title span.left a").text('Ticket State');
+
+});

commit 2ccdaa4b8d64e7079f588b99fd6167df6155cd97
Author: Jim Brandt <jbrandt at bestpractical.com>
Date:   Wed Sep 13 12:03:48 2017 -0400

    Add higher-res BPS image

diff --git a/static/css/example-theme/main.css b/static/css/example-theme/main.css
index 518e268..6461701 100644
--- a/static/css/example-theme/main.css
+++ b/static/css/example-theme/main.css
@@ -12,7 +12,7 @@ body.example-theme {
     background-image: url("../../../static/images/bpssymbol.png");
     background-repeat: no-repeat;
     background-position: center;
-    background-size: 40%;
+    background-size: 80%;
     background-attachment: fixed;
 }
 
diff --git a/static/images/bpssymbol.png b/static/images/bpssymbol.png
index 132fc02..76db5d2 100644
Binary files a/static/images/bpssymbol.png and b/static/images/bpssymbol.png differ

commit 7ffe987e2fbb9fb2750d676213193bbaf4a14dad
Author: Jim Brandt <jbrandt at bestpractical.com>
Date:   Wed Sep 13 12:04:08 2017 -0400

    Module::Install update

diff --git a/inc/YAML/Tiny.pm b/inc/YAML/Tiny.pm
index aa539f7..4fd023d 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.68-2-gcc5324e
+package YAML::Tiny; # git description: v1.69-8-g2c1e266
 # 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.69';
+our $VERSION = '1.70';
 
 #####################################################################
 # The YAML::Tiny API.
@@ -570,10 +570,8 @@ sub _dump_file {
     if ( _can_flock() ) {
         # Open without truncation (truncate comes after lock)
         my $flags = Fcntl::O_WRONLY()|Fcntl::O_CREAT();
-        sysopen( $fh, $file, $flags );
-        unless ( $fh ) {
-            $self->_error("Failed to open file '$file' for writing: $!");
-        }
+        sysopen( $fh, $file, $flags )
+            or $self->_error("Failed to open file '$file' for writing: $!");
 
         # Use no translation and strict UTF-8
         binmode( $fh, ":raw:encoding(UTF-8)");
@@ -871,4 +869,4 @@ delete $YAML::Tiny::{refaddr};
 
 __END__
 
-#line 1489
+#line 1487

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


More information about the Bps-public-commit mailing list