Skip to content

Conversation

@jvz
Copy link
Member

@jvz jvz commented Oct 29, 2018

…login.jelly

Signed-off-by: Matt Sicker boards@gmail.com

See JENKINS-54325.

Proposed changelog entries

  • Internal: login.jelly and signup.jelly now support displaying all registered SimplePageDecorator extensions rather than just the top priority one.
  • Internal: the password field in the login page now has a matching id as its name (j_password) for easier access from the DOM.

Submitter checklist

  • JIRA issue is well described
  • Changelog entry appropriate for the audience affected by the change (users or developer, depending on the change). Examples
    * Use the Internal: prefix if the change has no user-visible impact (API, test frameworks, etc.)
  • Appropriate autotests or explanation to why this change has no tests
  • For dependency updates: links to external changelogs and, if possible, full diffs

Desired reviewers

@reviewbybees @scherler @Wadeck

…login.jelly

Signed-off-by: Matt Sicker <boards@gmail.com>
@daniel-beck daniel-beck requested a review from scherler October 30, 2018 20:31
Copy link
Contributor

@Wadeck Wadeck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: you can @Deprecated the getSimplePageDecorator()

RC: The hudson/security/HudsonPrivateSecurityRealm/signup.jelly also requires a modification otherwise the login page will work but not the signup one ;)

jvz added 3 commits October 30, 2018 16:10
Signed-off-by: Matt Sicker <boards@gmail.com>
Signed-off-by: Matt Sicker <boards@gmail.com>
Signed-off-by: Matt Sicker <boards@gmail.com>
@jvz
Copy link
Member Author

jvz commented Oct 30, 2018

@Wadeck Deprecated the old function, and updated signup.jelly

}
</script>
</j:if>
<div class="footer">
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not so sure about the HTML structure here. My use case in paranoia-plugin is to insert a <script> element here, so the rendering doesn't matter too much. The default SimplePageDescriptor does not specify a footer fragment.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am fine with that

Copy link
Contributor

@Wadeck Wadeck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🐝

Copy link
Contributor

@scherler scherler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Internal: login.jelly and signup.jelly now support displaying all registered SimplePageDecorator extensions rather than just the top priority one.

Actually there is a point behind to return only one. Your changes will provoke that all existing login pages would display 2 logos when a custom one is provided.

Did you test this?

If you are not provide a way to actually limit e.g. the logo to only one implementations I am not seeing the point to break the only one implementation approach.

@jvz
Copy link
Member Author

jvz commented Nov 5, 2018

I tested this mainly with a new plugin called Paranoia. The problem being that I can't provide any footer without losing the header, and I didn't want to copy the default headers and styles.

Perhaps the logo should only display the first one while the other includes can overlap?

@scherler
Copy link
Contributor

scherler commented Nov 5, 2018

Did you see https://jenkins.io/blog/2018/06/27/new-login-page/ ? There is no need to copy and paste but you can include the default ones.

Regarding the footer could the paranoia plugin not expose another extension point which aggregates all footers and then inject it as only one

The reason of only one is to have a clean design and prevent surprises in design when plugins are extending.

@jvz
Copy link
Member Author

jvz commented Nov 5, 2018

Are you suggesting an extension point in core? If so, I could redo this change as such to add some sort of footer decorator. Otherwise, I'm not sure what you mean. I'd like to have this plugin be able to work with other custom page decorators or still use the default one otherwise.

@scherler
Copy link
Contributor

scherler commented Nov 5, 2018

Not in core in your plugin, people using it can extend it.

@jvz
Copy link
Member Author

jvz commented Nov 5, 2018

But then I'm stuck with either an unstyled set of login/signup pages, or I'm copying simple-head.jelly and simple-header.jelly to my plugin which makes those pages unable to be overridden.

@scherler
Copy link
Contributor

scherler commented Nov 5, 2018

Hmm, do you want to have a quick hangouts/meet/... about it?

In the blog post I wrote:

<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core">
  <link rel="stylesheet" href="${resURL}/css/simple-page.css" type="text/css" />
  <link rel="stylesheet" href="${resURL}/css/simple-page.theme.css" type="text/css" />
  <style>
    .simple-page .logo {
        background-image: url('${resURL}/plugin/YOUR_PLUGIN/icons/my.svg');
        background-repeat: no-repeat;
        background-position: 50% 0;
        height: 130px;
    }
  </style>
  <link rel="stylesheet" href="${resURL}/css/simple-page-forms.css" type="text/css" />
</j:jelly>

That is using the core/default styles and adding to it, would that not cover your case?

@jvz
Copy link
Member Author

jvz commented Nov 5, 2018

I mean I can do that, but this plugin isn't overriding the styles there. I'm injecting scripts into pages.

Edit: see my usage here: https://github.com/jenkinsci/paranoia-plugin/blob/master/src/main/resources/io/jenkins/plugins/paranoia/DisableLoginAutocompleteDecorator/simple-footer.jelly

Copy link
Contributor

@scherler scherler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I see it you need simply provide src/main/resources/jenkins/model/DefaultSimplePageDecorator/simple-footer.jelly and inject your stuff there

<div class="footer">

<st:include it="${simpleDecorator}" page="simple-footer.jelly" optional="true"/>
<j:forEach var="simpleDecorator" items="${simpleDecorators}">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is actually the only change you need besides creating the methods to get all decorators.

* @since 2.128
* @deprecated use {@link #getSimplePageDecorators()} instead
*/
@Deprecated
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nupp

* Gets all {@link SimplePageDecorator}s for the login page.
* @since TODO
*/
public static List<SimplePageDecorator> getSimplePageDecorators() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

* Returns all login page decorators.
* @since TODO
*/
public static List<SimplePageDecorator> all() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

<!-- in case of error we want to surround the form elements with an error hint -->
<j:set var="inputClass" value="${data.errorMessage!=null ? 'danger' : 'normal'}"/>
<j:set var="simpleDecorator" value="${h.simplePageDecorator}"/>
<j:set var="simpleDecorators" value="${h.simplePageDecorators}"/>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need both

<!-- we do not want bots on this page -->
<meta name="ROBOTS" content="NOFOLLOW"/>
<!-- css styling, will fallback to default implementation -->
<st:include it="${simpleDecorator}" page="simple-head.jelly" optional="true"/>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nupp

}
</script>
</j:if>
<div class="footer">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am fine with that

<!-- in case of error we want to surround the form elements with an error hint -->
<j:set var="inputClass" value="${error ? 'danger' : 'normal'}"/>
<j:set var="simpleDecorator" value="${h.simplePageDecorator}"/>
<j:set var="simpleDecorators" value="${h.simplePageDecorators}"/>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see above, you need both

<!-- we do not want bots on this page -->
<meta name="ROBOTS" content="NOFOLLOW" />
<!-- css styling, will fallback to default implementation -->
<st:include it="${simpleDecorator}" page="simple-head.jelly" optional="true"/>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👎

<j:otherwise>
<div class="simple-page" role="main">
<div class="modal login">
<st:include it="${simpleDecorator}" page="simple-header.jelly" optional="true"/>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👎

@jvz
Copy link
Member Author

jvz commented Nov 7, 2018

Ah, I see what you mean. I'll update this to only add support for multiple footers. Then I can set a low priority on my decorator.

@jvz
Copy link
Member Author

jvz commented Nov 7, 2018

Redone in #3721.

@jvz jvz closed this Nov 7, 2018
@jvz jvz deleted the simple-page-decorators branch November 7, 2018 20:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants