With the usage of a port of github's linguist functionality to Go,
which I have made as a separate library and is hosted here:
https://github.com/generaltso/linguist
And a quick design I made, I have hacked a language statistics bar
into gogs
I wasn't sure where to put everything so it's sitting directly
on the view router and the CSS is inlined into a new template file
Based on the structure of this project I would fully expect this
feature to belong in its own sub-package
Also, even though determining language stats on-the-fly is pretty
fast, caching the results in the database for large codebases
would probably be a much better strategy, especially if the top
language were to be displayed in the "Explore" view like GitHub has
I also had difficulty trying to figure out how to do:
if len(something) == 1 ? '' : 's'
with go templates for plurals (1 Commit vs 2 Commits), and I kinda
gave up there...
I've mostly duplicated the dropdown code from repo/home.tmpl, which
basically only required a change to the URL. This could probably be
broken out into something more modular.
We can look at the PushCommits object to see how many commits were
included in a commit, and add some template logic to only show the
comparison link when there are at least 2 commits in a push. We also
correct the link to display the number of commits.
This commit improves templates readability, since all of them use consistent
indent with all template command blocks indented too.
1. Indents both HTML containers such as <div>, <p> and Go HTML template blocks
such as {{if}} {{with}}
2. Cleans all trailing white-space
3. Adds trailing last line-break to each file
Most commit in Git are expected to follow standard of single header line,
followed by description paragraphs, separated by empty line from previous block.
Previously Gogs were treating everything as single header. Now we are trying to
render only first line as header, but following lines (description chunks) as a
verbatim.
With grey SHA1 labels, we should consider having also more subtle strips on
commits list. As current strips blend too much with grey SHA1 labels and top
bar, making hard to distinguish headers from content.