Use a HTML template instead of HTML embeded within python

Bug #1079638 reported by Rafał Cieślak
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ubuntu Accomplishments Viewer
Fix Committed
Medium
Marqin

Bug Description

The point of this but is to clean up the _accomplishment_info(...) funcion. What it does it preparing HTML code for the webkit viewer. All HTML tags are within the code, like this:

html = html + '<b><div style="somestyle">'
html = html + message
html = html + '</div></b><br/><h2> The caption is: <i>'
html = html + caption
html = html + '</i></h2>'

This is not elegant. Editing the HTML code is super difficult, the outcome is not human-readable, and the code of _accomplishment_info(...) is complicated.
The ideal solution would be to use a separate .html template, which would look like this:

<b>
  <div style="somestyle">
    [MESSAGE]
  </div>
</b>
<br/>
<h2> The caption is: <i> [CAPTION] </i> </h2>

Then, _accomplishment_info(...) would load this file, substitute [TAGS] with values (conditionally hiding some of sections), and pass result to webkit.
This way the HTML would be significantly easier to maintain, and so would be _accomplishment_info(...).

Related branches

Marqin (marqin)
Changed in ubuntu-accomplishments-viewer:
status: Triaged → In Progress
Revision history for this message
Marqin (marqin) wrote :

There will be:
 <div style="{MESSAGE_DIV_STYLE}">
   {MESSAGE}
 </div>
and when there will be no purpose to show that div:
{MESSAGE_DIV_STYLE} will change into "display:none" ;)

Revision history for this message
Marqin (marqin) wrote :

I think it's complete. Just need cleanup&review and then I will propose merging.

Changed in ubuntu-accomplishments-viewer:
status: In Progress → Fix Committed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.