You are here: Foswiki>Tasks Web>Item12124 (29 May 2014, GeorgeClark)Edit Attach

Item12124: Pass class and id attributes to LOGIN and LOGOUT macros

pencil
Priority: Enhancement
Current State: Confirmed
Released In: n/a
Target Release: minor
Applies To: Engine
Component:
Branches:
Reported By: ArthurClemens
Waiting For:
Last Change By: GeorgeClark
In order to get the generated link picked up by javascript, a class or id should be added to the link.

Change to LoginManager:

sub _LOGIN {

    #my( $session, $params, $topic, $web ) = @_;
    my $session = shift;
    my $this    = $session->getLoginManager();
    
    return '' if $session->inContext('authenticated');

    my $url = $this->loginUrl();
    my $params = shift; 
    
    if ($url) {
        my $text = $session->templates->expandTemplate('LOG_IN');
        return CGI::a( { href => $url, $params->stringify() }, $text );
    }
    return '';
}

and so on.

Only caveat is using this method you cannot pass data-xxx values because Foswiki::Attrs does not handle hyphens well for this case.

-- ArthurClemens - 07 Oct 2012

Less trouble is to achieve this with a container element (span) to access the link.

This brings problems in CSS because accessor > a no longer works if a span is inbetween.

-- ArthurClemens - 07 Oct 2012

i don't understand, so I hope you do smile

-- SvenDowideit - 08 Nov 2012

The CSS hierarchy is sensitive to the container ordering. If you add a span, then the element order changes and the css attributes are missed.

-- GeorgeClark - 29 May 2014
 

ItemTemplate edit

Summary Pass class and id attributes to LOGIN and LOGOUT macros
ReportedBy ArthurClemens
Codebase trunk
SVN Range
AppliesTo Engine
Component
Priority Enhancement
CurrentState Confirmed
WaitingFor
Checkins
TargetRelease minor
ReleasedIn n/a
CheckinsOnBranches
trunkCheckins
Release01x01Checkins
Topic revision: r5 - 29 May 2014, GeorgeClark
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy