Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix CSS and other wwwdocs resources on PSGI version #23

Merged
merged 5 commits into from
Nov 28, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions lib/Act/Dispatcher.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -117,6 +118,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 ) {
Expand Down
6 changes: 6 additions & 0 deletions lib/Act/Handler/User/Register.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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!
Expand Down
14 changes: 13 additions & 1 deletion lib/Act/Util.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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 = (
Expand Down Expand Up @@ -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
{
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions po/en.po
Original file line number Diff line number Diff line change
Expand Up @@ -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."
4 changes: 4 additions & 0 deletions templates/core/user/register
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down