Show More
@@ -57,28 +57,43 b' class FilesController(BaseController):' | |||||
57 | def index(self, repo_name, revision, f_path): |
|
57 | def index(self, repo_name, revision, f_path): | |
58 | hg_model = ScmModel() |
|
58 | hg_model = ScmModel() | |
59 | c.repo = hg_model.get_repo(c.repo_name) |
|
59 | c.repo = hg_model.get_repo(c.repo_name) | |
60 | revision = request.POST.get('at_rev', None) or revision |
|
60 | ||
|
61 | try: | |||
|
62 | #reditect to given revision from form | |||
|
63 | post_revision = request.POST.get('at_rev', None) | |||
|
64 | if post_revision: | |||
|
65 | post_revision = c.repo.get_changeset(post_revision).raw_id | |||
|
66 | redirect(url('files_home', repo_name=c.repo_name, | |||
|
67 | revision=post_revision, f_path=f_path)) | |||
|
68 | ||||
|
69 | c.branch = request.GET.get('branch', None) | |||
61 |
|
70 | |||
62 | c.f_path = f_path |
|
71 | c.f_path = f_path | |
63 |
|
72 | |||
64 | try: |
|
|||
65 | c.changeset = c.repo.get_changeset(revision) |
|
73 | c.changeset = c.repo.get_changeset(revision) | |
66 | cur_rev = c.changeset.revision |
|
74 | cur_rev = c.changeset.revision | |
67 |
|
75 | |||
|
76 | #prev link | |||
68 | try: |
|
77 | try: | |
69 | prev_rev = c.repo.get_changeset(cur_rev).prev().raw_id |
|
78 | prev_rev = c.repo.get_changeset(cur_rev).prev(c.branch).raw_id | |
70 | c.url_prev = url('files_home', repo_name=c.repo_name, |
|
79 | c.url_prev = url('files_home', repo_name=c.repo_name, | |
71 | revision=prev_rev, f_path=f_path) |
|
80 | revision=prev_rev, f_path=f_path) | |
|
81 | if c.branch: | |||
|
82 | c.url_prev += '?branch=%s' % c.branch | |||
72 | except ChangesetDoesNotExistError: |
|
83 | except ChangesetDoesNotExistError: | |
73 | c.url_prev = '#' |
|
84 | c.url_prev = '#' | |
74 |
|
85 | |||
|
86 | #next link | |||
75 | try: |
|
87 | try: | |
76 | next_rev = c.repo.get_changeset(cur_rev).next().raw_id |
|
88 | next_rev = c.repo.get_changeset(cur_rev).next(c.branch).raw_id | |
77 | c.url_next = url('files_home', repo_name=c.repo_name, |
|
89 | c.url_next = url('files_home', repo_name=c.repo_name, | |
78 | revision=next_rev, f_path=f_path) |
|
90 | revision=next_rev, f_path=f_path) | |
|
91 | if c.branch: | |||
|
92 | c.url_next += '?branch=%s' % c.branch | |||
79 | except ChangesetDoesNotExistError: |
|
93 | except ChangesetDoesNotExistError: | |
80 | c.url_next = '#' |
|
94 | c.url_next = '#' | |
81 |
|
95 | |||
|
96 | #files | |||
82 | try: |
|
97 | try: | |
83 | c.files_list = c.changeset.get_node(f_path) |
|
98 | c.files_list = c.changeset.get_node(f_path) | |
84 | c.file_history = self._get_history(c.repo, c.files_list, f_path) |
|
99 | c.file_history = self._get_history(c.repo, c.files_list, f_path) |
@@ -1614,10 +1614,18 b' padding:0;' | |||||
1614 | } |
|
1614 | } | |
1615 |
|
1615 | |||
1616 | div.browserblock .browser-header { |
|
1616 | div.browserblock .browser-header { | |
1617 | border-bottom:1px solid #CCC; |
|
|||
1618 | background:#FFF; |
|
1617 | background:#FFF; | |
1619 | color:blue; |
|
|||
1620 | padding:10px 0; |
|
1618 | padding:10px 0; | |
|
1619 | float:left; | |||
|
1620 | } | |||
|
1621 | ||||
|
1622 | div.browserblock .browser-branch { | |||
|
1623 | background:#FFF; | |||
|
1624 | padding:20px 0 0 0; | |||
|
1625 | float:left; | |||
|
1626 | } | |||
|
1627 | div.browserblock .browser-branch label { | |||
|
1628 | color:#4A4A4A; | |||
1621 | } |
|
1629 | } | |
1622 |
|
1630 | |||
1623 | div.browserblock .browser-header span { |
|
1631 | div.browserblock .browser-header span { | |
@@ -1627,6 +1635,7 b' font-weight:700;' | |||||
1627 |
|
1635 | |||
1628 | div.browserblock .browser-body { |
|
1636 | div.browserblock .browser-body { | |
1629 | background:#EEE; |
|
1637 | background:#EEE; | |
|
1638 | border-top:1px solid #CCC; | |||
1630 | } |
|
1639 | } | |
1631 |
|
1640 | |||
1632 | table.code-browser { |
|
1641 | table.code-browser { |
@@ -17,6 +17,24 b'' | |||||
17 | </div> |
|
17 | </div> | |
18 | ${h.end_form()} |
|
18 | ${h.end_form()} | |
19 | </div> |
|
19 | </div> | |
|
20 | <div class="browser-branch"> | |||
|
21 | ${h.checkbox('stay_at_branch',c.changeset.branch,c.changeset.branch==c.branch)} | |||
|
22 | <label>${_('follow current branch')}</label> | |||
|
23 | <script type="text/javascript"> | |||
|
24 | YUE.on('stay_at_branch','click',function(e){ | |||
|
25 | if(e.target.checked){ | |||
|
26 | var uri = "${h.url.current(branch='__BRANCH__')}" | |||
|
27 | uri = uri.replace('__BRANCH__',e.target.value); | |||
|
28 | window.location = uri; | |||
|
29 | } | |||
|
30 | else{ | |||
|
31 | window.location = "${h.url.current()}"; | |||
|
32 | } | |||
|
33 | ||||
|
34 | }) | |||
|
35 | </script> | |||
|
36 | </div> | |||
|
37 | <div style="clear:both"></div> | |||
20 | <div class="browser-body"> |
|
38 | <div class="browser-body"> | |
21 | <table class="code-browser"> |
|
39 | <table class="code-browser"> | |
22 | <thead> |
|
40 | <thead> |
General Comments 0
You need to be logged in to leave comments.
Login now