Commit b15f979ff63872a4566299533dff066d1f039c15
Exists in
master
and in
1 other branch
Merge pull request #266 from shukydvir/issue_140
added support to change the branch name for backtrace links - default to...
Showing
2 changed files
with
9 additions
and
2 deletions
Show diff stats
app/models/app.rb
... | ... | @@ -6,6 +6,7 @@ class App |
6 | 6 | field :api_key |
7 | 7 | field :github_repo |
8 | 8 | field :bitbucket_repo |
9 | + field :repository_branch | |
9 | 10 | field :resolve_errs_on_deploy, :type => Boolean, :default => false |
10 | 11 | field :notify_all_users, :type => Boolean, :default => false |
11 | 12 | field :notify_on_errs, :type => Boolean, :default => true |
... | ... | @@ -106,6 +107,9 @@ class App |
106 | 107 | end |
107 | 108 | alias :notify_on_deploys? :notify_on_deploys |
108 | 109 | |
110 | + def repo_branch | |
111 | + self.repository_branch.present? ? self.repository_branch : 'master' | |
112 | + end | |
109 | 113 | |
110 | 114 | def github_repo? |
111 | 115 | self.github_repo.present? |
... | ... | @@ -116,7 +120,7 @@ class App |
116 | 120 | end |
117 | 121 | |
118 | 122 | def github_url_to_file(file) |
119 | - "#{github_url}/blob/master#{file}" | |
123 | + "#{github_url}/blob/#{repo_branch + file}" | |
120 | 124 | end |
121 | 125 | |
122 | 126 | def bitbucket_repo? |
... | ... | @@ -128,7 +132,7 @@ class App |
128 | 132 | end |
129 | 133 | |
130 | 134 | def bitbucket_url_to_file(file) |
131 | - "#{bitbucket_url}/src/master#{file}" | |
135 | + "#{bitbucket_url}/src/#{repo_branch + file}" | |
132 | 136 | end |
133 | 137 | |
134 | 138 | ... | ... |
app/views/apps/_fields.html.haml
... | ... | @@ -5,6 +5,9 @@ |
5 | 5 | = f.text_field :name |
6 | 6 | |
7 | 7 | %div |
8 | + = f.label :repository_branch | |
9 | + = f.text_field :repository_branch, :placeholder => "master" | |
10 | +%div | |
8 | 11 | = f.label :github_repo |
9 | 12 | = f.text_field :github_repo, :placeholder => "errbit/errbit from https://github.com/errbit/errbit" |
10 | 13 | %div | ... | ... |