From 9bd3ebe20708b3d61f1cab8daeeffe8748f93852 Mon Sep 17 00:00:00 2001 From: Angus Gibson Date: Wed, 9 Dec 2015 16:14:54 +1100 Subject: [PATCH 1/2] Dropdown on commits page to choose branch #1846 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. --- public/js/gogs.js | 7 +++--- templates/repo/commits.tmpl | 44 +++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 3 deletions(-) diff --git a/public/js/gogs.js b/public/js/gogs.js index be17b8c8f..427280db5 100644 --- a/public/js/gogs.js +++ b/public/js/gogs.js @@ -218,8 +218,9 @@ function initRepository() { }); } - // File list - if ($('.repository.file.list').length > 0) { + // File list and commits + if ($('.repository.file.list').length > 0 || + ('.repository.commits').length > 0) { initFilterSearchDropdown('.choose.reference .dropdown'); $('.reference.column').click(function () { @@ -1036,4 +1037,4 @@ $(window).load(function () { } }).trigger('hashchange'); } -}); \ No newline at end of file +}); diff --git a/templates/repo/commits.tmpl b/templates/repo/commits.tmpl index 879f762df..0c8ca443c 100644 --- a/templates/repo/commits.tmpl +++ b/templates/repo/commits.tmpl @@ -2,6 +2,50 @@
{{template "repo/header" .}}
+
+ +
{{template "repo/commits_table" .}}
From df05134494ccc4cf53ff816a6457c7e21a69f730 Mon Sep 17 00:00:00 2001 From: Angus Gibson Date: Wed, 9 Dec 2015 17:11:41 +1100 Subject: [PATCH 2/2] Break branch-selection dropdown into a template We only handle branch selection for repo home and commits pages, so the redirection URL is based on PageIsCommits --- templates/repo/branch_dropdown.tmpl | 44 ++++++++++++++++++++++++++++ templates/repo/commits.tmpl | 45 +---------------------------- templates/repo/home.tmpl | 45 +---------------------------- 3 files changed, 46 insertions(+), 88 deletions(-) create mode 100644 templates/repo/branch_dropdown.tmpl diff --git a/templates/repo/branch_dropdown.tmpl b/templates/repo/branch_dropdown.tmpl new file mode 100644 index 000000000..a825ee243 --- /dev/null +++ b/templates/repo/branch_dropdown.tmpl @@ -0,0 +1,44 @@ +
+ +
diff --git a/templates/repo/commits.tmpl b/templates/repo/commits.tmpl index 0c8ca443c..88a87ef8c 100644 --- a/templates/repo/commits.tmpl +++ b/templates/repo/commits.tmpl @@ -2,50 +2,7 @@
{{template "repo/header" .}}
-
- -
+ {{template "repo/branch_dropdown" .}} {{template "repo/commits_table" .}}
diff --git a/templates/repo/home.tmpl b/templates/repo/home.tmpl index ccbe6639c..22a2f839a 100644 --- a/templates/repo/home.tmpl +++ b/templates/repo/home.tmpl @@ -15,50 +15,7 @@ {{end}} -
- -
+ {{template "repo/branch_dropdown" .}}