The themes in the preview list are loaded from the Geany-Themes repository on Github on the fly (but cached for one hour).
- adds new menu item "Download -> Geany Themes" - displays brief information about the Geany-Themes project - list available themes with preview thumbnail and a gallery
Closes #5.
![website_geany_themes_preview](https://user-images.githubusercontent.com/617017/59974257-955dd400-9599-11e9...) ![website_geany_themes_gallery](https://user-images.githubusercontent.com/617017/59974283-ee2d6c80-9599-11e9...)
You can view, comment on, or merge this pull request online at:
https://github.com/geany/www.geany.org/pull/8
-- Commit Summary --
* Add Geany-Themes page with theme preview
-- File Changes --
A page_content/download/themes.md (10) M static_docs/github_client.py (8) A static_docs/templates/pages/download/themes.html (65) M static_docs/urls.py (4) M static_docs/views.py (29)
-- Patch Links --
https://github.com/geany/www.geany.org/pull/8.patch https://github.com/geany/www.geany.org/pull/8.diff
This is awesome!
I think [the thumbnails should be larger](https://github.com/geany/geany-themes/blob/b77a43c9c496dec9f36bf225b47198fdc...) though. Maybe we should bump them to 100 or 120 pixels?
I agree, I took the thumbnails from the index JSON. Preferably, we keep it this way and increase the size in the index JSON directly?
I just removed the size dimensions on the `<img` tag in the website template (they are unnecessary in this case). So, if we agree on changing the size in Geany-Themes, we have nothing to do on the website part.
Preferably, we keep it this way and increase the size in the index JSON directly?
I agree. I don't even know where I came up with 64x64, probably just arbitrary.
See geany/geany-themes#32
@eht16 there's also a link to Geany-Themes Github repo under "Easily Customizable" section on the home page which I guess should probably link instead to the new themes page.
codebrainz commented on this pull request.
+class ThemesView(StaticDocsView):
+ """ + Fetch the Geany-Themes index from https://github.com/geany/geany-themes/tree/master/index + """ + + template_name = "pages/download/themes.html" + + # ---------------------------------------------------------------------- + def get_context_data(self, **kwargs): + theme_index = self._get_theme_index() + context = super(ThemesView, self).get_context_data(**kwargs) + context['theme_index'] = theme_index + return context + + # ---------------------------------------------------------------------- + @cache_function(CACHE_TIMEOUT_1HOUR)
I don't know if it's even worth it, but instead of caching, it could check the [index.json.md5 file](https://github.com/geany/geany-themes/blob/b77a43c9c496dec9f36bf225b47198fdc...) to see whether it needs to re-download the whole index again. 45 bytes to download the md5 file each page access to save downloading ~800 kilobytes every hour the page is accessed, and it would always be up-to-date.
Just a thought, not important at all.
@eht16 pushed 2 commits.
c5a12415d902bdcb5d66538a885e1ca90ea52d88 Theme preview: Refetch theme index only if MD5 hash has changed 6a0317bba2727d909c84f25f9da74d251168c224 Log request duration of Github API calls
@eht16 pushed 1 commit.
c6f4436ca108ebc32b87a028efe690d49bda7f5b Homepage: Change themes link to the preview page
eht16 commented on this pull request.
+class ThemesView(StaticDocsView):
+ """ + Fetch the Geany-Themes index from https://github.com/geany/geany-themes/tree/master/index + """ + + template_name = "pages/download/themes.html" + + # ---------------------------------------------------------------------- + def get_context_data(self, **kwargs): + theme_index = self._get_theme_index() + context = super(ThemesView, self).get_context_data(**kwargs) + context['theme_index'] = theme_index + return context + + # ---------------------------------------------------------------------- + @cache_function(CACHE_TIMEOUT_1HOUR)
I don't know if it's worth, too. But just implemented it in https://github.com/geany/www.geany.org/pull/8/commits/c5a12415d902bdcb5d6653.... Besides reducing traffic between us and Github, it probably won't make much difference: the request durations of the MD5 hash and the whole index JSON are almost equal. But anyway, it probably won't hurt and in case of theme index updates, the preview page will update quicker.
@eht16 there's also a link to Geany-Themes Github repo under "Easily Customizable" section on the home page which I guess should probably link instead to the new themes page.
Link updated, thanks for the pointer.
And here is a screenshot with the larger thumbnails of https://github.com/geany/geany-themes/pull/32: ![Screen Shot 2019-06-29 at 07 56 49-fullpage](https://user-images.githubusercontent.com/617017/60381646-91bdc780-9a47-11e9...)
Nice!
codebrainz approved this pull request.
LGTM
Merged #8 into master.
github-comments@lists.geany.org