diff --git a/rhodecode/apps/my_account/views/my_account.py b/rhodecode/apps/my_account/views/my_account.py --- a/rhodecode/apps/my_account/views/my_account.py +++ b/rhodecode/apps/my_account/views/my_account.py @@ -682,8 +682,8 @@ class MyAccountView(BaseAppView, DataGri 'target_repo': _render('pullrequest_target_repo', pr.target_repo.repo_name), 'name': _render('pullrequest_name', - pr.pull_request_id, pr.work_in_progress, - pr.target_repo.repo_name, + pr.pull_request_id, pr.pull_request_state, + pr.work_in_progress, pr.target_repo.repo_name, short=True), 'name_raw': pr.pull_request_id, 'status': _render('pullrequest_status', diff --git a/rhodecode/apps/repository/views/repo_pull_requests.py b/rhodecode/apps/repository/views/repo_pull_requests.py --- a/rhodecode/apps/repository/views/repo_pull_requests.py +++ b/rhodecode/apps/repository/views/repo_pull_requests.py @@ -108,8 +108,8 @@ class RepoPullRequestsView(RepoAppView, data.append({ 'name': _render('pullrequest_name', - pr.pull_request_id, pr.work_in_progress, - pr.target_repo.repo_name), + pr.pull_request_id, pr.pull_request_state, + pr.work_in_progress, pr.target_repo.repo_name), 'name_raw': pr.pull_request_id, 'status': _render('pullrequest_status', pr.calculated_review_status()), @@ -273,15 +273,7 @@ class RepoPullRequestsView(RepoAppView, self.request.matchdict['pull_request_id']) pull_request_id = pull_request.pull_request_id - if pull_request.pull_request_state != PullRequest.STATE_CREATED: - log.debug('show: forbidden because pull request is in state %s', - pull_request.pull_request_state) - msg = _(u'Cannot show pull requests in state other than `{}`. ' - u'Current state is: `{}`').format(PullRequest.STATE_CREATED, - pull_request.pull_request_state) - h.flash(msg, category='error') - raise HTTPFound(h.route_path('pullrequest_show_all', - repo_name=self.db_repo_name)) + c.state_progressing = pull_request.is_state_changing() version = self.request.GET.get('version') from_version = self.request.GET.get('from_version') or version @@ -1061,15 +1053,7 @@ class RepoPullRequestsView(RepoAppView, return {'response': True, 'redirect_url': redirect_url} - if pull_request.pull_request_state != PullRequest.STATE_CREATED: - log.debug('update: forbidden because pull request is in state %s', - pull_request.pull_request_state) - msg = _(u'Cannot update pull requests in state other than `{}`. ' - u'Current state is: `{}`').format(PullRequest.STATE_CREATED, - pull_request.pull_request_state) - h.flash(msg, category='error') - return {'response': True, - 'redirect_url': redirect_url} + is_state_changing = pull_request.is_state_changing() # only owner or admin can update it allowed_to_update = PullRequestModel().check_user_update( @@ -1083,6 +1067,16 @@ class RepoPullRequestsView(RepoAppView, pull_request, controls['review_members'], pull_request.reviewer_data) elif str2bool(self.request.POST.get('update_commits', 'false')): + if is_state_changing: + log.debug('commits update: forbidden because pull request is in state %s', + pull_request.pull_request_state) + msg = _(u'Cannot update pull requests commits in state other than `{}`. ' + u'Current state is: `{}`').format( + PullRequest.STATE_CREATED, pull_request.pull_request_state) + h.flash(msg, category='error') + return {'response': True, + 'redirect_url': redirect_url} + self._update_commits(pull_request) if force_refresh: redirect_url = h.route_path( @@ -1182,7 +1176,7 @@ class RepoPullRequestsView(RepoAppView, self.request.matchdict['pull_request_id']) _ = self.request.translate - if pull_request.pull_request_state != PullRequest.STATE_CREATED: + if pull_request.is_state_changing(): log.debug('show: forbidden because pull request is in state %s', pull_request.pull_request_state) msg = _(u'Cannot merge pull requests in state other than `{}`. ' diff --git a/rhodecode/model/db.py b/rhodecode/model/db.py --- a/rhodecode/model/db.py +++ b/rhodecode/model/db.py @@ -4225,6 +4225,9 @@ class PullRequest(Base, _PullRequestBase def is_closed(self): return pull_request_obj.is_closed() + def is_state_changing(self): + return pull_request_obj.is_state_changing() + @property def pull_request_version_id(self): return getattr(pull_request_obj, 'pull_request_version_id', None) @@ -4256,6 +4259,9 @@ class PullRequest(Base, _PullRequestBase def is_closed(self): return self.status == self.STATUS_CLOSED + def is_state_changing(self): + return self.pull_request_state != PullRequest.STATE_CREATED + def __json__(self): return { 'revisions': self.revisions, @@ -4313,6 +4319,9 @@ class PullRequestVersion(Base, _PullRequ # calculate from original return self.pull_request.status == self.STATUS_CLOSED + def is_state_changing(self): + return self.pull_request.pull_request_state != PullRequest.STATE_CREATED + def calculated_review_status(self): return self.pull_request.calculated_review_status() diff --git a/rhodecode/public/css/main.less b/rhodecode/public/css/main.less --- a/rhodecode/public/css/main.less +++ b/rhodecode/public/css/main.less @@ -414,16 +414,28 @@ ul.auth_plugins { } -#pr-title-input { - width: 72%; +.pr-title-input { + width: 80%; font-size: 1em; - margin: 0; - padding: 0 0 0 @padding/4; + margin: 0 0 4px 0; + padding: 0; line-height: 1.7em; color: @text-color; letter-spacing: .02em; font-weight: @text-bold-weight; font-family: @text-bold; + + &:hover { + box-shadow: none; + } +} + +#pr-title { + input { + border: 1px transparent; + color: black; + opacity: 1 + } } #pullrequest_title { diff --git a/rhodecode/public/css/tags.less b/rhodecode/public/css/tags.less --- a/rhodecode/public/css/tags.less +++ b/rhodecode/public/css/tags.less @@ -62,6 +62,23 @@ } +.tag-merge-state-created { + color: @color1; +} + +.tag-merge-state-creating { + color: @color1; +} + +.tag-merge-state-merging { + color: @color3; +} + +.tag-merge-state-updating { + color: @color3; +} + + .metatag-list { margin: 0; padding: 0; diff --git a/rhodecode/templates/admin/my_account/my_account_pullrequests.mako b/rhodecode/templates/admin/my_account/my_account_pullrequests.mako --- a/rhodecode/templates/admin/my_account/my_account_pullrequests.mako +++ b/rhodecode/templates/admin/my_account/my_account_pullrequests.mako @@ -47,10 +47,10 @@ pageLength: ${c.visual.dashboard_items}, order: [[ 2, "desc" ]], columns: [ + { data: {"_": "target_repo", + "sort": "target_repo"}, title: "${_('Target Repo')}", className: "td-targetrepo", orderable: false}, { data: {"_": "status", "sort": "status"}, title: "", className: "td-status", orderable: false}, - { data: {"_": "target_repo", - "sort": "target_repo"}, title: "${_('Target Repo')}", className: "td-targetrepo", orderable: false}, { data: {"_": "name", "sort": "name_raw"}, title: "${_('Id')}", className: "td-componentname", "type": "num" }, { data: {"_": "title", @@ -78,9 +78,6 @@ if (data['owned']) { $(row).addClass('owned'); } - if (data['state'] !== 'created') { - $(row).addClass('state-' + data['state']); - } } }); $pullRequestListTable.on('xhr.dt', function(e, settings, json, xhr){ diff --git a/rhodecode/templates/data_table/_dt_elements.mako b/rhodecode/templates/data_table/_dt_elements.mako --- a/rhodecode/templates/data_table/_dt_elements.mako +++ b/rhodecode/templates/data_table/_dt_elements.mako @@ -370,17 +370,22 @@ ${comments_nr} %def> -<%def name="pullrequest_name(pull_request_id, is_wip, target_repo_name, short=False)"> +<%def name="pullrequest_name(pull_request_id, state, is_wip, target_repo_name, short=False)"> - % if is_wip: - wip - % endif % if short: !${pull_request_id} % else: ${_('Pull request !{}').format(pull_request_id)} % endif + + % if state not in ['created']: + ${state} + % endif + + % if is_wip: + wip + % endif %def> diff --git a/rhodecode/templates/pullrequests/pullrequest_show.mako b/rhodecode/templates/pullrequests/pullrequest_show.mako --- a/rhodecode/templates/pullrequests/pullrequest_show.mako +++ b/rhodecode/templates/pullrequests/pullrequest_show.mako @@ -10,14 +10,17 @@ %def> <%def name="breadcrumbs_links()"> - - ${c.pull_request.title} - %if c.pull_request.is_closed(): - (${_('Closed')}) - %endif - + <% + pr_title = c.pull_request.title + if c.pull_request.is_closed(): + pr_title = '[{}] {}'.format(_('Closed'), pr_title) + %> + +