Author: bob
Date: 2012-05-05 10:45:05 +0100 (Sat, 05 May 2012)
New Revision: 1381
Modified:
trunk/Changes
Log:
Documented AUTOMATED_TESTING change to Build.PL in Changes
Modified: trunk/Changes
===================================================================
--- trunk/Changes 2012-05-05 09:00:29 UTC (rev 1380)
+++ trunk/Changes 2012-05-05 09:45:05 UTC (rev 1381)
@@ -21,6 +21,7 @@
Format params such as format=map work as before. Old-style URLs
will automatically redirect to new-style ones.
Added project metadata to Build.PL (#285).
+ Skip Build.PL questions if AUTOMATED_TESTING=1 (#291)
Added a basic stylesheet, installed into the static_path directory.
Fixed the JSON output for action=index (using a new dependency on
Template::Plugin::JSON::Escape).
Author: kake
Date: 2012-05-05 10:00:29 +0100 (Sat, 05 May 2012)
New Revision: 1380
Modified:
trunk/Build.PL
trunk/Changes
Log:
Documented changes from [1378] and put correct Wiki::Toolkit version in prereqs.
Modified: trunk/Build.PL
===================================================================
--- trunk/Build.PL 2012-05-04 12:21:17 UTC (rev 1379)
+++ trunk/Build.PL 2012-05-05 09:00:29 UTC (rev 1380)
@@ -299,7 +299,7 @@
'CGI' => '2.92', # avoid escapeHTML bug
'CGI::Carp' => 0,
'CGI::Cookie' => 0,
- 'Wiki::Toolkit' => '0.77',
+ 'Wiki::Toolkit' => '0.80',
'Wiki::Toolkit::Feed::Atom' => 0,
'Wiki::Toolkit::Feed::RSS' => 0,
'Wiki::Toolkit::Formatter::UseMod' => 0,
Modified: trunk/Changes
===================================================================
--- trunk/Changes 2012-05-04 12:21:17 UTC (rev 1379)
+++ trunk/Changes 2012-05-05 09:00:29 UTC (rev 1380)
@@ -32,6 +32,8 @@
your wiki.conf).
The preferences page now remembers what page the user got to it from,
and sends them back there.
+ Fixed bug with recent changes display when minor edit suppressed (for
+ which we require version 0.80 of Wiki::Toolkit).
0.66 12 April 2012
All templates now have access to the "username" TT variable.
Author: kake
Date: 2012-05-02 17:04:06 +0100 (Wed, 02 May 2012)
New Revision: 1375
Added:
trunk/templates/edit_form_preview.tt
Modified:
trunk/Build.PL
trunk/MANIFEST
trunk/README.CSS
trunk/templates/edit_form.tt
trunk/templates/edit_form_actions.tt
Log:
Added a few more CSS hooks to the edit form, also added anchor link to jump from preview to form (fixes #202).
Modified: trunk/Build.PL
===================================================================
--- trunk/Build.PL 2012-05-02 13:39:43 UTC (rev 1374)
+++ trunk/Build.PL 2012-05-02 16:04:06 UTC (rev 1375)
@@ -393,6 +393,7 @@
"metadata.tt",
"edit_form.tt",
"edit_form_actions.tt",
+ "edit_form_preview.tt",
"error.tt",
"footer.tt",
"header.tt",
Modified: trunk/MANIFEST
===================================================================
--- trunk/MANIFEST 2012-05-02 13:39:43 UTC (rev 1374)
+++ trunk/MANIFEST 2012-05-02 16:04:06 UTC (rev 1375)
@@ -42,6 +42,7 @@
templates/display_metadata.tt
templates/edit_form.tt
templates/edit_form_actions.tt
+templates/edit_form_preview.tt
templates/error.tt
templates/footer.tt
templates/header.tt
Modified: trunk/README.CSS
===================================================================
--- trunk/README.CSS 2012-05-02 13:39:43 UTC (rev 1374)
+++ trunk/README.CSS 2012-05-02 16:04:06 UTC (rev 1375)
@@ -36,7 +36,7 @@
Used in: edit_form_actions.tt
Purpose: Contains a button for previewing an edit.
div.cancel_edit
- Used in: edit_form_actions.tt
+ Used in: edit_form_actions.tt, edit_form_preview.tt
Purpose: Contains a link for cancelling an edit.
div.commit_edit
Used in: edit_form_actions.tt
@@ -59,6 +59,11 @@
Used in: edit_form.tt node_image_fields.tt
Purpose: Contains details of an edit conflict for a single type of data.
+div.jump_to_edit_form
+ Used in: edit_form_preview.tt
+ Purpose: Contains a link to jump up or down the page to the edit form,
+ when previewing one's edits.
+
div.licence_and_moderation_notes
Used in: edit_form.tt
Purpose: Contains a description of the guide's licence and details of any
@@ -82,6 +87,16 @@
Used in: navbar_*.tt
Purpose: Defines an item in the navigation bar
+div.preview
+ Used in: edit_form_preview.tt
+ Purpose: Container for use with #maincontent when the content is being
+ previewed while editing.
+
+div.preview_actions
+ Used in: edit_form_preview.tt
+ Purpose: Groups together links for cancelling an edit and for jumping
+ up/down the page to the edit form, when previewing one's edits.
+
div.warning_text
Used in: edit_form.tt
Purpose: Warns the user that there is an edit conflict
Modified: trunk/templates/edit_form.tt
===================================================================
--- trunk/templates/edit_form.tt 2012-05-02 13:39:43 UTC (rev 1374)
+++ trunk/templates/edit_form.tt 2012-05-02 16:04:06 UTC (rev 1375)
@@ -29,18 +29,10 @@
[% END %]
[% IF preview_html AND preview_above_edit_box %]
- <div id="maincontent">
- <h2>Preview</h2>
- [% IF summary %]
- <div id="summary">[% summary %]</div>
- [% END %]
- [% INCLUDE node_image.tt %]
- [% INCLUDE display_metadata.tt %]
- [% preview_html %]
- </div>
- <br clear="all" />
+ [% INCLUDE edit_form_preview.tt %]
[% END %]
+ <a name="edit_form_anchor"></a>
<form id="edit_page_form" action="[% cgi_url %]" method="post"
enctype="application/x-www-form-urlencoded">
@@ -412,16 +404,7 @@
</form>
[% IF preview_html AND NOT preview_above_edit_box %]
- <div id="maincontent">
- <h2>Preview</h2>
- [% IF summary %]
- <div id="summary">[% summary %]</div>
- [% END %]
- [% INCLUDE node_image.tt %]
- [% INCLUDE display_metadata.tt %]
- [% preview_html %]
- </div>
- <br clear="all" />
+ [% INCLUDE edit_form_preview.tt %]
[% END %]
[% END %]
[% INCLUDE footer.tt omit_footer_search_form = 1 %]
Modified: trunk/templates/edit_form_actions.tt
===================================================================
--- trunk/templates/edit_form_actions.tt 2012-05-02 13:39:43 UTC (rev 1374)
+++ trunk/templates/edit_form_actions.tt 2012-05-02 16:04:06 UTC (rev 1375)
@@ -4,7 +4,7 @@
class="form_button" />
</div>
<div class="cancel_edit">
- (<a href="[% cgi_url %]?[% node_param %]">cancel edit</a>)
+ <a href="[% cgi_url %]?[% node_param %]">Cancel edit</a>
</div>
<div class="commit_edit">
[% IF moderate %]
Added: trunk/templates/edit_form_preview.tt
===================================================================
--- trunk/templates/edit_form_preview.tt (rev 0)
+++ trunk/templates/edit_form_preview.tt 2012-05-02 16:04:06 UTC (rev 1375)
@@ -0,0 +1,18 @@
+<div id="maincontent" class="preview">
+ <h2>Preview</h2>
+ <div class="preview_actions">
+ <div class="cancel_edit">
+ <a href="[% cgi_url %]?[% node_param %]">Cancel edit</a>
+ </div>
+ <div class="jump_to_edit_form">
+ <a href="#edit_form_anchor">Jump to edit form</a>
+ </div>
+ </div>
+ [% IF summary %]
+ <div id="summary">[% summary %]</div>
+ [% END %]
+ [% INCLUDE node_image.tt %]
+ [% INCLUDE display_metadata.tt %]
+ [% preview_html %]
+</div>
+<br clear="all" />
Author: kake
Date: 2012-05-02 14:39:43 +0100 (Wed, 02 May 2012)
New Revision: 1374
Modified:
trunk/lib/OpenGuides/Template.pm
trunk/t/68_bug_website_displayed.t
Log:
And strip trailing / from displayed websites when it's the only / in the URL.
Modified: trunk/lib/OpenGuides/Template.pm
===================================================================
--- trunk/lib/OpenGuides/Template.pm 2012-05-02 13:14:07 UTC (rev 1373)
+++ trunk/lib/OpenGuides/Template.pm 2012-05-02 13:39:43 UTC (rev 1374)
@@ -366,11 +366,17 @@
my $website = $args{metadata} ? $metadata{website}[0]
: $q->param("website");
+ # Do truncation for website name display. Max length of field is set in
+ # conf file (website_link_max_chars). Leading http:// and www. if present
+ # is stripped; trailing / is also stripped if it's the only / in the URL.
my $formatted_website_text = "";
if ( $website && $website ne "http://" && is_web_uri( $website ) ) {
my $maxlen = $config->website_link_max_chars;
my $trunc_website = $website;
$trunc_website =~ s|http://(www.)?||;
+ if ( $trunc_website =~ tr|/|| == 1 ) {
+ $trunc_website =~ s|/$||;
+ }
if ( length( $trunc_website ) > $maxlen ) {
$trunc_website = substr( $trunc_website, 0, $maxlen - 3 ) . "...";
}
Modified: trunk/t/68_bug_website_displayed.t
===================================================================
--- trunk/t/68_bug_website_displayed.t 2012-05-02 13:14:07 UTC (rev 1373)
+++ trunk/t/68_bug_website_displayed.t 2012-05-02 13:39:43 UTC (rev 1374)
@@ -11,7 +11,7 @@
plan skip_all => "DBD::SQLite could not be used - no database to test with ($error)";
}
-plan tests => 6;
+plan tests => 7;
OpenGuides::Test::refresh_db();
@@ -24,12 +24,16 @@
"A busy main-line station that actually exists.", undef,
{ website => "http://www.example.com/foo" } )
or die "Couldn't write node";
+$guide->wiki->write_node( "West Croydon Station",
+ "Another main-line station that actually exists.", undef,
+ { website => "http://www.example.com/bar/" } )
+ or die "Couldn't write node";
$config->website_link_max_chars( 20 );
my %tt_vars = $guide->display_node( id => "South Croydon Station",
return_tt_vars => 1 );
is( $tt_vars{formatted_website_text},
- '<a href="http://example.com/">example.com/</a>',
+ '<a href="http://example.com/">example.com</a>',
"Website correctly displayed when no need for truncation," );
%tt_vars = $guide->display_node( id => "East Croydon Station",
@@ -38,6 +42,12 @@
'<a href="http://www.example.com/foo">example.com/foo</a>',
"Website correctly truncated when there's a leading www" );
+%tt_vars = $guide->display_node( id => "West Croydon Station",
+ return_tt_vars => 1 );
+is( $tt_vars{formatted_website_text},
+ '<a href="http://www.example.com/bar/">example.com/bar/</a>',
+ "Trailing slash not stripped unless it's immediately after domain name" );
+
%tt_vars = $guide->display_node( id => "North Croydon Station",
return_tt_vars => 1 );
is( $tt_vars{formatted_website_text},