diff --git a/conf.php-dist b/conf.php-dist index 0945963b..92e5d1d1 100644 --- a/conf.php-dist +++ b/conf.php-dist @@ -3,6 +3,7 @@ // repositoryUrl and categoryUrl are twig templates, which take the following input values: // {{ repositoryId }} id of the repository // {{ categoryId }} id of the category (not for repositoryUrl) +// {{ branchId }} id of the branch (not for repositoryUrl) $repositories = array( 'default' => array( 'path' => 'node_modules/openstreetbrowser-categories-main', @@ -10,7 +11,7 @@ $repositories = array( // public URL of repository 'repositoryUrl' => 'https://github.com/example/categories', // public URL of source of a category in repository - 'categoryUrl' => 'https://github.com/example/categories/tree/master/{{ categoryId }}.json', + 'categoryUrl' => 'https://github.com/example/categories/tree/{{ branchId }}/{{ categoryId }}.json', ), ); diff --git a/src/addCategories.js b/src/addCategories.js index f475a313..89dc7287 100644 --- a/src/addCategories.js +++ b/src/addCategories.js @@ -17,6 +17,9 @@ function addCategoriesShow (repo, options={}) { [ repoId, branchId ] = repo.split(/~/) } + if (!branchId) { + branchId = 'master' + } content.innerHTML = '

' + lang('more_categories') + '

' + ' ' + lang('loading') @@ -163,7 +166,7 @@ function addCategoriesShow (repo, options={}) { var editLink = null if (repo && categoryUrl) { editLink = document.createElement('a') - editLink.href = categoryUrl.render({ repositoryId: repo, categoryId: id }) + editLink.href = categoryUrl.render({ repositoryId: repoId, categoryId: id, branchId: branchId }) } if (!repo && repositoryUrl) { editLink = document.createElement('a')