Skip to content

Commit

Permalink
Add authas to the plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
afuna committed Nov 11, 2014
1 parent 08acea4 commit a82ceea
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 1 deletion.
16 changes: 15 additions & 1 deletion cgi-bin/DW/Template/Plugin.pm
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# Authors:
# Andrea Nall <anall@andreanall.com>
#
# Copyright (c) 2010-2011 by Dreamwidth Studios, LLC.
# Copyright (c) 2010-2014 by Dreamwidth Studios, LLC.
#
# This program is free software; you may redistribute it and/or modify it under
# the same terms as Perl itself. For a copy of the license, please reference
Expand Down Expand Up @@ -147,6 +147,20 @@ sub img {
return LJ::img(@_);
}

=head2 authas
Print out the authas select dropdown
=cut
sub authas {
my ( $self, $args ) = @_;

my $r = DW::Request->get;
return "<form action='" . LJ::create_url() . "' method='get'>"
. LJ::make_authas_select( LJ::get_remote(), { authas => $r->get_args->{authas}, foundation => 1, %{$args || {}} } )
. "</form>"
}

=head2 scoped_include
Easy way to handle changing the ml scope around an INCLUDE block.
Expand Down
42 changes: 42 additions & 0 deletions views/components/authas.tt
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
[%# Authas dropdown

Authors:
Afuna <coder.dw@afunamatata.com>

This program is free software; you may redistribute it and/or modify it under
the same terms as Perl itself. For a copy of the license, please reference
'perldoc perlartistic' or 'perldoc perlgpl'.
%]

[%- sections.title = ".title" | ml -%]
[%- CALL dw.active_resource_group( "foundation" ) -%]

[%- INCLUDE components/fancyselect.tt
name = "authas"
label = dw.ml( "web.authas.btn" )

items = [
{ label = "plain"
value = "plain"
format = "a plain option"
}
{ label = "image"
value = "image"
format = "with image prefix"
image = {
src = "/silk/site/tick.png"
width = 16
height = 16
}
}
{ label = "user"
value = "user"
format = "contains a @user"
}
{
label = "comm"
value = "comm"
format = "contains a @c:comm"
}
]
-%]
11 changes: 11 additions & 0 deletions views/dev/style-guide.tt
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,17 @@ dw.need_res( { group => "foundation" },
</div>
</div>

<h2>Authas</h2>
<div class="row">
<div class="columns">
[%- dw.authas() -%]
</div>
</div>
<div class="row"><div class="columns">
[%- WRAPPER code -%]
dw.authas()
[%- END -%]
</div></div>
<h2>Alert Boxes</h2>
<div data-alert class="alert-box radius">
This is a standard alert (div.alert-box).
Expand Down

0 comments on commit a82ceea

Please sign in to comment.