Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fix CSS and other wwwdocs resources on PSGI version #23

Merged
merged 5 commits into from

3 participants

@hoelzro

Fixes GH #22

@book
Owner

Can you explain why absolute URI are needed?

I think I did this for Facebook login; Facebook::Graph needs an absolute URI for callbacks.

@book
Owner

make_uri() is also used for all internal URI, so it's better that they are relative to /, I think.

Maybe write a make_abs_uri() instead, for when being absolute is a requirement?

@hoelzro

Ok, I'll do that!

@hoelzro

@book More commits for you!

@maddingue maddingue merged commit b7dd871 into book:psgi
@maddingue
Collaborator

hoping I didn't make anything stupid

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 10, 2011
  1. @hoelzro
  2. @hoelzro
Commits on Oct 11, 2011
  1. @hoelzro

    Revert "Generate absolute URIs with make_uri and co"

    hoelzro authored
    This reverts commit 150f37d.
  2. @hoelzro

    Add make_abs_uri

    hoelzro authored
Commits on Nov 18, 2011
  1. @hoelzro
This page is out of date. Refresh to see the latest.
View
16 lib/Act/Dispatcher.pm
@@ -5,6 +5,7 @@ use Encode qw(decode_utf8);
use Plack::Builder;
use Plack::Request;
use Plack::App::Cascade;
+use Plack::App::File;
use Act::Config;
use Act::Handler::Static;
@@ -118,6 +119,21 @@ sub conference_app {
};
Plack::App::Cascade->new( catch => [99], apps => [
builder {
+ # XXX ugly, but functional for now
+ enable sub {
+ my ( $app ) = @_;
+
+ return sub {
+ my ( $env ) = @_;
+
+ my $res = $app->($env);
+ $res->[0] = 99 if $res->[0] == 404;
+ return $res;
+ };
+ };
+ Plack::App::File->new(root => $Config->general_root)->to_app;
+ },
+ builder {
enable '+Act::Middleware::Auth';
for my $uri ( keys %public_handlers ) {
mount "/$uri" => _handler_app($public_handlers{$uri});
View
6 lib/Act/Handler/User/Register.pm
@@ -45,6 +45,12 @@ sub handler
# conference is closed
if ($Config->closed) {
$Request{status} = 403;
+ my $template = Act::Template::HTML->new();
+ $template->variables(
+ closed => 1,
+ end_date => DateTime::Format::Pg->parse_timestamp($Config->talks_end_date)->epoch,
+ );
+ $template->process('user/register');
return;
}
# special case of logged in users!
View
14 lib/Act/Util.pm
@@ -13,7 +13,7 @@ use Act::Database;
use vars qw(@ISA @EXPORT %Languages);
@ISA = qw(Exporter);
-@EXPORT = qw(make_uri make_uri_info self_uri localize);
+@EXPORT = qw(make_uri make_abs_uri make_uri_info self_uri localize);
# password generation data
my %grams = (
@@ -96,6 +96,14 @@ sub make_uri
return _build_uri($uri, %params);
}
+sub make_abs_uri {
+ my ( $action, %params ) = @_;
+
+ my $uri = $Request{r}->uri;
+ $uri->path(make_uri(@_));
+ return $uri;
+}
+
# create a uri pathinfo-style
sub make_uri_info
{
@@ -348,6 +356,10 @@ Returns an URI that points to I<action>, with an optional query string
built from I<%params>. For more details on actions, refer to the
Act::Dispatcher documentation.
+=item make_abs_uri(I<$action>, I<%params>)
+
+Similar to L<make_uri/"">, but returns an absolute URI.
+
=item self_uri(I<%params>)
Returns a self-referential URI (a URI that points to the current location)
View
2  po/en.po
@@ -1413,3 +1413,5 @@ msgstr "Unknown order ID."
msgid "User is not registered."
msgstr "User is not registered."
+msgid "Sorry, registration for this conference has been closed."
+msgstr "Sorry, registration for this conference has been closed."
View
4 templates/core/user/register
@@ -3,6 +3,10 @@
<p>
{{Sorry, this conference is over.}}
</p>
+[% ELSIF closed %]
+<p>
+ {{Sorry, registration for this conference has been closed.}}
+</p>
[% ELSE %]
<p>
Something went wrong with that request. Please try again.