aboutsummaryrefslogtreecommitdiff
path: root/views
Commit message (Collapse)AuthorAgeFilesLines
* Added main branch handling from upstream projectThorsten Ortlepp2024-11-071-24/+8
|
* Added CSS improvement from upstream projectThorsten Ortlepp2024-11-071-1/+1
|
* Fix templates for breaking change in Bottle 0.12+Thorsten Ortlepp2024-11-073-8/+8
|
* Added dark mode from upstream projectThorsten Ortlepp2024-08-082-0/+4
|
* Handle main branch the same way as master branchThorsten Ortlepp2023-08-081-0/+18
|
* Simplify smstrAlberto Bertogli2020-05-242-7/+7
| | | | | | | | | With the Python 2 to 3 migration and the type checking, we can be fairly confident that smstr are always constructed from strings, not bytes. This allows the code to be simplified, as we no longer need to carry the dual raw/unicode representation.
* Move to Python 3Alberto Bertogli2020-05-241-1/+1
| | | | | | | | | | | Python 3 was released more than 10 years ago, and support for Python 2 is going away, with many Linux distributions starting to phase it out. This patch migrates git-arr to Python 3. The generated output is almost exactly the same, there are some minor differences such as HTML characters being quoted more aggresively, and handling of paths with non-utf8 values.
* Implement a "patch" view0.15Alberto Bertogli2018-10-011-0/+8
| | | | | This commit implements a "patch" view, with a simple plain-text representation of a commit, that can be used as a patch file.
* Tune markdown CSS to increase readabilityAlberto Bertogli2018-03-041-0/+2
| | | | | | | | The default CSS is not very comfortable for markdown, as for example the links are hidden. This patch makes the markdown CSS tunable by wrapping it into a div, and then adjusting the default styles to increase readability.
* views: In the summary, make the sections toggableAlberto Bertogli2017-08-273-17/+17
| | | | | | As an experiment, make the sections of the summary to be toggable. This can help readability, although it's unclear if it's worth the additional complexity and could be removed later.
* views: Include the root tree in the summaryAlberto Bertogli2017-08-273-16/+23
| | | | | | | | Including the tree as part of the summary gives a bit more information and provides an easy path into the tree. It does clutter things a bit, so this is an experiment and may be removed later.
* views: Change the "repository" line into "git clone"Alberto Bertogli2017-08-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | We display the location of the repository, but the entire row is not convenient for copy-pasting. This patch changes the wording to "git clone" so the entire row can be copied and pasted into a terminal. There's a trick, because if we just changed the wording to: <td>git clone</td> <td>https://example.com/repo</td> that would get copied as: git clone\thttps://example.com/repo which does not work well when pasted into a terminal (as the \t gets "eaten" in most cases). So this patch changes the HTML to have a space after "clone": <td>git clone </td> <td>https://example.com/repo</td> and the CSS to preserve the space, so the following gets copied: git clone \thttps://example.com/repo which works when pasting on a terminal.
* style: In the index, make the project names explicit linksAlberto Bertogli2017-08-271-3/+3
| | | | | For readability, make the project names in the index to be explicit links.
* views: Improve display on mobile browsersAlberto Bertogli2015-11-186-19/+19
| | | | | | | | | | This patch moves the pages to HTML5, and adds some simple meta tags and CSS media constraints so things render better on mobile browsers, while leaving the desktop unaffected. It's still not ideal, though. Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>
* views/tree: signify root directory in page titleEric Sunshine2015-01-241-1/+1
| | | | | | | | | | | The page title in a root tree displays as "git >> repo >> branch >>", which looks odd and fails to convey the fact that the page represents a tree. Appending a '/' (for example "git >> repo >> branch >> /") makes it more obvious that the page shows a tree, in general, and the root tree, in particular. Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>
* views/blob: suppress double-slash in page titleEric Sunshine2015-01-241-1/+1
| | | | | | | | | | | | | | | | | | For blobs in subdirectories, the page title always includes a double slash between the final directory component and the filename (for example, "git >> repo >> branch >> doc//readme.txt"). This is unsightly. git-arr:blob() ensures that the directory passed to views/blob always has a trailing slash, so we can drop the slash inserted by views/blob between the directory and the filename. As a side-effect, this also changes the page title for blobs in the root directory. Instead of "git >> repo >> branch >> /readme.txt", the title becomes "git >> repo >> branch >> readme.txt", which is slightly more aesthetically pleasing. Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>
* branch: pass branch name view explicitlyEric Sunshine2015-01-171-4/+4
| | | | | | | | | | | Passing the branch name into the view indirectly via Repo.new_in_branch() increases cognitive burden, thus outweighing whatever minor convenience (if any) is gained by doing so. The code is easier to reason about when the branch name is passed to the view directly. Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>
* blob: pass branch name to view explicitlyEric Sunshine2015-01-171-4/+4
| | | | | | | | | | | Passing the branch name into the view indirectly via Repo.new_in_branch() increases cognitive burden, thus outweighing whatever minor convenience (if any) is gained by doing so. The code is easier to reason about when the branch name is passed to the view directly. Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>
* tree: pass branch name to view explicitlyEric Sunshine2015-01-171-4/+4
| | | | | | | | | | | Passing the branch name into the view indirectly via Repo.new_in_branch() increases cognitive burden, thus outweighing whatever minor convenience (if any) is gained by doing so. The code is easier to reason about when the branch name is passed to the view directly. Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>
* views: blob: render empty blobs speciallyEric Sunshine2015-01-131-1/+7
| | | | | | | | | | | | | | | Empty (zero-length) blobs are currently rendered by 'pygments' misleadingly as a single empty line, or, when 'pygments' is unavailable, as "nothingness" preceding a horizontal rule. In either case, it is somewhat difficult to glean concrete information about the blob. Address this by instead rendering summary information about the blob: in particular, its classification ("empty") and its size ("0 bytes"). This is analogous to the summary information rendered for binary blobs ("binary" and size). Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>
* blob: cap amount of rendered binary blob contentEric Sunshine2015-01-131-1/+10
| | | | | | | | | | | | | | | | Although hexdump(1)-style rendering of binary blob content may reveal some meaningful information about the data, it wastes even more storage space than embedding the raw data itself. However, many binary files have a "magic number" or other signature near the beginning of the file, so it is often possible to glean useful information from just the initial chunk of the file without having the entire content available. Thus, limiting the rendered data to just an initial chunk saves storage space while still potentially presenting useful information about the binary content. Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>
* blob: render hexdump(1)-style binary blob contentEric Sunshine2015-01-131-2/+10
| | | | | | | | | | | | | | Raw binary blob content tends to look like "line noise" and is rarely, if ever, meaningful. A hexdump(1)-style rendering (specifically, "hexdump -C"), on the other hand, showing runs of hexadecimal byte values along with an ASCII representation of those bytes can sometimes reveal useful information about the data. (A subsequent patch will add the ability to cap the amount of data rendered in order to reduce storage space requirements.) Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>
* blob: render binary blob summary information rather than raw contentEric Sunshine2015-01-131-0/+8
| | | | | | | | | | | | | | | | | Binary blobs are currently rendered as raw data directly into the HTML output, looking much like "line noise". This is rarely, if ever, meaningful, and consumes considerable storage space since the entire raw blob content is embedded in the generated HTML file. Address this issue by instead emitting summary information about the blob, such as its classification ("binary") and its size. Other information can be added as needed. As in Git itself, a blob is considered binary if a NUL is present in the first ~8KB. Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>
* embed_image_blob: retire reload of image blobEric Sunshine2015-01-131-1/+1
| | | | | | | | | | | | Historically, the 'blob' view was unconditionally handed cooked (utf8-encoded) blob content, so embed_image_blob(), which requires raw blob content, has been forced to reload the blob in raw form, which is ugly and expensive. However, now that the Blob returned by Repo.blob() is able to vend raw or cooked content, it is no longer necessary for embed_image_blob() to reload the blob to gain access to the raw content. Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>
* git.py: introduce Blob abstractionEric Sunshine2015-01-131-4/+4
| | | | | | | | | | | | | | | | | | Some blob representations (such as embedded images) require raw blob content, however, the 'blob' view is unconditionally handed cooked (utf8-encoded) content, thus representations which need raw content are forced to reload the blob in raw form, which is ugly and expensive (due to shelling out to git-cat-file a second time). The ultimate goal is to eliminate the wasteful blob reloading when raw content is needed. As a first step, introduce a Blob abstraction to be returned by Repo.blob() rather than the cooked content. A subsequent change will flesh out Blob, allowing it to return raw or cooked content on demand without the client having to specify one or the other when invoking Repo.blob(). Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>
* views: fix broken URLs involving hierarchical branch namesEric Sunshine2015-01-113-16/+21
| | | | | | | | | | | | | | | | | | | Git branch names can be hierarchical (for example, "wip/parser/fix"), however, git-arr does not take this into account when formulating URLs on branch, tree, and blobs pages. These URLs are dysfunctional because it is assumed incorrectly that a single "../" is sufficient to climb over the branch name when computing relative paths to resources higher in the hierarchy. This problem manifests as failure to load static resources (stylesheet, etc.), broken links to commits on branch pages, and malfunctioning breadcrumb trails. Fix this problem by computing the the proper number of "../" based upon the branch name, rather than assuming that a single "../" will work unconditionally. (This is analogous to the treatment already given to hierarchical pathnames in tree and blob views.) Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>
* views: branch/paginate: teach "next" link to respect 'max_pages'Eric Sunshine2015-01-111-0/+1
| | | | | | | | | | | | | | | | | Pagination link "next" does not respect 'max_pages', thus it incorrectly remains enabled on the final page capped by 'max_pages'. When clicked, the user is taken to a "404 Page not found" error page, which makes for a poor user experience. Fix this problem by teaching the "next" link to respect 'max_pages'. (As a side-effect, this also causes 'serve' mode to respect 'max_pages', which was not previously the case. This change of behavior is appropriate since it brings 'serve' mode, which is intended primarily for testing, more in line with 'generate' mode.) Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>
* views: branch/paginate: fix incorrectly enabled "next" linkEric Sunshine2015-01-112-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | When the number of commits on a branch page is less than 'commits_per_page', the pagination "next" link is disabled, indicating correctly that this is the final page. However, if the number of commits on the branch page is exactly 'commits_per_page', then the "next" link is incorrectly enabled, even on the final page. When clicked, the user is taken to a "404 Page not found" error page, which makes for a poor user experience. Fix this problem by reliably detecting when the branch page is the final one. Do so by asking for (but not displaying) one commit more than actually needed by the page. If the additional commit is successfully retrieved, then another page definitely follows this one. If not retrieved, then this is definitely the final page. (Unfortunately, the seemingly more expedient approach of checking if the final commit on the current page is a root commit -- has no parents -- is not a reliable indicator that this the final page since a branch may have multiple root commits due to merging.) Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>
* views: summary: suppress extra horizontal rule when no "master" branchEric Sunshine2015-01-111-2/+1
| | | | | | | | | | | | | | When a repository has a "master" branch, a short summary of its most recent commits is shown, followed by a horizontal rule. If there is no "master" branch, then the commit summary is suppressed, however, the rule is shown unconditionally, which is ugly, particularly when there is already a rule following the web_url/git_url block. Therefore, suppress the "master" branch horizontal rule when not needed. (This is analogous to how the rule following the web_url/git_url block is suppressed when that information is not shown). Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>
* views/tree.html: Fix lambda syntax0.13Alberto Bertogli2014-07-291-1/+1
| | | | | | | Some versions of bottle.py don't deal well with the "if" inside the lambda, so work around it by just using comparison and simplifying the function. Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>
* Fix one-line 'if' termination in tree, blob templatesVanya Sergeev2014-06-302-2/+6
| | | | | | | | The missing '% end' template keyword to these one-line if statements was causing bottle 0.12.7 to incorrectly indent the following line, leading to an IndentationError at runtime when the blob and tree templates are compiled. Signed-off-by: Vanya Sergeev <vsergeev@gmail.com>
* Fix committer field in the commit view0.12Alberto Bertogli2013-11-031-4/+4
| | | | | | | The commit view shows the author information in the committer field; this patch fixes it by showing the appropriate fields. Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>
* Show the age of a repository in the index, via javascriptAlberto Bertogli2013-11-021-1/+3
| | | | | | | | | This patch adds the age of the repository to the index view, using javascript to give a nice human string for the age. When javascript is not available, the element remains hidden. Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>
* Make embedding markdown and images configurable per-repoAlberto Bertogli2013-11-021-2/+2
| | | | | | | | This patch introduces the embed_markdown and embed_images configuration options, so users can enable and disable those features on a per-repository basis. Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>
* Add embed data URI image blob supportVanya Sergeev2013-11-021-1/+3
|
* Add markdown blob supportVanya Sergeev2013-11-021-1/+3
|
* Use heuristics to decide what to colorizeAlberto Bertogli2012-11-182-2/+2
| | | | | | | In practise pygments seems to have a very hard time processing large files and files with long lines, so try to avoid using it in those cases. Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>
* Initial commit0.01Alberto Bertogli2012-11-108-0/+390
Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>