glonlas / Jira2ScrumBoard

Scrum user stories generator, helper for visual management
http://www.jira2scrumboard.com/
MIT License
11 stars 3 forks source link

Allow multiple templates #11

Open glonlas opened 7 years ago

glonlas commented 7 years ago

the tool should allow multiple index card template.

Like: Story, Epics, Index cards

dknighton commented 7 years ago

I find the Jira2ScrumBoard tool extremely useful. It's near perfect as-is, but allowing multiple templates would make it the perfect solution for my needs. I would be happy to look into this functionality myself if I can get a little insight into how the template currently works.

glonlas commented 7 years ago

Hello dknighton,

Happy to know this tool is useful.

Before starting, you have to know what data Jira2Scrumboard can gather from the Jira file and if it is enough for your new index card.

Today Jira2Scrumboard supports the following fields:

If you are fine with that you can continue. Otherwise, let met know and I will explain to you how to find more fields.

Ok, let's start with some hints.

Views (Index cards)

The views of the card should be in the following folder: Jira2ScrumBoard/src/AgileStoryPrint/JiraBundle/Resources/views/StoryCard. As you will see, Symfony is using a twig format. The card should include the CSS because the PDF interpeter as some issue to resolve external links.

Translations

The translations for the view are inside the file: Jira2ScrumBoard/src/AgileStoryPrint/JiraBundle/Resources/translations/messages.en.xlf

The system will always fall back on the English version: messages.en.xlf. You do not to have to take care of the other translations.

How to change the view to use?

The logic that call the view is in the file: Jira2ScrumBoard/src/AgileStoryPrint/JiraBundle/Controller/StoriesController.php inside the method getStoriesCards()

You will see something like:

$html = $this->renderView( 'AgileStoryPrintJiraBundle:StoryCard:card.html.twig', array( 'stories' => $storyCards->getStories() ) );

As an example, if your new card view is named "wideCard.html." You only need to change the path to the Twig view as 'AgileStoryPrintJiraBundle:StoryCard:wideCard.html.twig'

Simple isn't it?

How to manage multiple cards?

This is where we need more logic in this app to be able to choose between different card views. The best will be to have an option on the front-end view (web page) and send the option to the controller.

The DefaultController generates the home page with the upload form. The upload form will call StoriesController. StoriesController renders the cards and generates the PDF.

The logic should pass the view the user wants to StoriesController::getStoriesCards()

The app needs some refactoring, so do not hesitate :)

The home page twig is here: Jira2ScrumBoard/src/AgileStoryPrint/JiraBundle/Resources/views/Pages/index.html.twig The home page controller: Jira2ScrumBoard/src/AgileStoryPrint/JiraBundle/Controller/DefaultController.php

Please let me know if I am not clear.