Display link to github for remote themes

Hi folks,

it would be nice if a remote theme page contained a direct link to the respective Github repo.
There is a link “About theme” which typically leads to a topic here on meta (where the link to github can be found) and the License link would typically link to the github repo. However, both of these are useless if you happen to fork a theme and make local modifications.

Maybe something like this could work?

Alternatively, the link could be below the Check updates button.

Also, now that we can import from specific branches, the branch itself should be displayed as well or at least the link to Github should go to that branch.

If this sounds reasonable, would you accept a PR?

8개의 좋아요

Definitely would!

Be sure to include before/after screenshots as well :wink:

7개의 좋아요

Hmm, I started working on this here, but am having two problems (I am Handlebars noob so they are probably trivial):

  1. In app/assets/javascripts/admin/templates/customize-themes-show.hbs, I would expect variable model.remote_theme.branch to work, but it doesn’t i.e it does not return the non-default branch that I imported.

  2. I will probably need a Handlebars helper to create a proper Github link for non-default branch, but I do not know where to put the code. I will need something like this:

Handlebars.registerHelper('getGithubUrl', function(baseUrl, branch) {
   if (! branch) { 
     return baseUrl;
   } else {
     // strip '.git' from the end, it is added there automatically in GitImporter
     var url = str.substring( 0, str.indexOf( ".git" ) );;
     return url + '/tree/' + branch;
   }
});

Sorry for noob questions, any pointers will be highly appreciated. :blush:

One quick note here, I am not too easy baking “GitHub” into our UIs here, we want to allow diversity here, if people want to use bitbucket or gitlab for themes it is A-OK.

5개의 좋아요

Thank you! I wasn’t sure others are supported, will change it.

3개의 좋아요

We should own this feature and not outsource it @sam

3개의 좋아요

이제 원격 테마를 위한 멋진 “Source” 링크가 추가되었습니다! :clap:

다만, 한 가지 작은 개선 사항이 있으면 좋겠습니다. 테마가 커스텀 브랜치에서 가져온 경우에도 링크가 항상 기본 브랜치로 이동합니다.

이 문제를 수정하려고 어설프게 시도해 보았지만, 끝까지 해결하지는 못했습니다. 혹시 도움을 주시거나 이 작업을 이어가실 분이 계신다면 드래프트 PR을 제출해 두었습니다. 감사합니다!

8개의 좋아요

좋은 수정이네요, @vinothkannans. 검토해 주시고, 간단한 js 테스트도 추가해 주실 수 있을까요?

4개의 좋아요

위 커밋에 병합되었습니다.

7개의 좋아요