RFI: Tinkering with the public site

Does the context "know" which properties to expect or will it automagically add new ones?

I would like to rummage a bit in the themes and find a certain one. Can this be done somewhat like this:

    kunagi/WEB-INF/classes/scrum/server/project/HomepageUpdater.java
        private void fillStory(ContextBuilder context, Requirement requirement) {
                context.put("id", requirement.getId());
                context.put("reference", requirement.getReference());
                context.put("label", toHtml(requirement.getLabel()));
                context.put("description", wikiToHtml(requirement.getDescription()));
                context.put("testDescription", wikiToHtml(requirement.getTestDescription()));
                if (requirement.isEstimatedWorkSet() && !requirement.isDirty())
                        context.put("estimatedWork", requirement.getEstimatedWorkAsString());
                fillComments(context, requirement);
        requirement.getThemes.foreach() {
        
        foreach(String theme: requirement.getThemes() ) {
          if(theme.contains("muhaha") {
            context.put("silly_property", "StringSample"));
            break;
          }
        }

Statement from Kunagi Team

Velocity context now contains story.themes and issue.themes. Will be shipped with the next release.

Status

Issue is closed.

Comments

Thu, Dec 12, 2013, 21:27 by Witek (SM,T)

I don't realy understand what you mean.

If there is a Java object in context, you can access it in your Velocity template. And also its properties. No need to change the Java code.

The syntax for accessing these properties is best explained in the Velocity documentation: velocity.apache.org/..velocity-1.7/user-guide.html

Fri, Dec 13, 2013, 08:10 by Karsten Jeppesen

Hi Witek,

Well, as you write "If there is a Java object". In this case I want to create a new property in "context". My question is if that can be done trivially or if there is a class description of "context". In this case my goal is to create a new context property which then subsequently can be used by the VTL in the html generation.
So yes - there is a need to change the JAVA code or there will not be a property to read. :-)
Cheers,
Karsten

Tue, Dec 17, 2013, 08:20 by Witek (SM,T)

What property/object do you need in the context?

Tue, Dec 17, 2013, 09:07 by Karsten Jeppesen

Hi Witek,
He he - Im after the tags (Themes). A Theme like "background-color:xxx;" or "color:xxx;" could easily be extracted in the homepage generator and transferred to the velocity template.
Eye-candy for the color-makes-up-for-my-lack-of-understanding people.
An argument of "Why the h... don't you use projects as they are supposed to be used" could easily be made, but we are not there yet.

Cheers,
Karsten

Tue, Dec 17, 2013, 10:27 by Witek (SM,T)

I have put the themes to the context. Will be available with the next release.

Tue, Dec 17, 2013, 10:40 by Karsten Jeppesen

Thanks a million Witek, I will send you a screendump when this flies so you can see to what purpose I put it.

Cheers,
Karsten

Post a comment



optional
optional