Closed bowlofeggs closed 7 years ago
Hello Randy,
What is the expected outcome? Simply keep first 30 characters or so and add ellipsis?
Hello Bianca!
Actually @ryanlerch just wrote some template code to do something very similar on this update page:
<%def name="generateupdatetitlestring()">
% if len(update.builds) == 1:
% for build in update.builds:
${self.util.packagename_from_nvr(build.nvr)}
% endfor
% elif len(update.builds) == 2:
% for build in update.builds:
% if loop.last:
and
% endif
${self.util.packagename_from_nvr(build.nvr)}
% endfor
% elif len(update.builds) > 2:
% for build in update.builds:
% if loop.index == 0:
${self.util.packagename_from_nvr(build.nvr)},
% elif loop.index == 1:
${self.util.packagename_from_nvr(build.nvr)}
& ${len(update.builds)-2} more
% endif
% endfor
% endif
</%def>
I bet we could take that idea and move it into a Python method on the bodhi.server.models.Update
class and basically do the same thing there (but probably substitute the & with "and", or we could make it an optional boolean on the method whether to use & or and). If we did that, then we could just have the template I cited use the common method for some nice code sharing.
How does that sound to you?
This was fixed by #1561.
This issue was originally reported by Harald Reindl. I've quoted what he wrote below: