incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tvansteenbu...@apache.org
Subject [1/4] git commit: [#6164] ticket:537 add new template for edit, add new link and metod, fix css
Date Fri, 21 Feb 2014 17:37:08 GMT
Repository: incubator-allura
Updated Branches:
  refs/heads/master 119afc3a6 -> a75304309


[#6164] ticket:537 add new template for edit, add new link and metod, fix css


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/108e2ef3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/108e2ef3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/108e2ef3

Branch: refs/heads/master
Commit: 108e2ef3eab384d22a15f7bcc1d9cef187a89dfd
Parents: 119afc3
Author: tramzzz <steh44@gmail.com>
Authored: Tue Feb 11 18:32:39 2014 +0200
Committer: Tim Van Steenburgh <tvansteenburgh@gmail.com>
Committed: Fri Feb 21 17:19:43 2014 +0000

----------------------------------------------------------------------
 Allura/allura/controllers/repository.py         | 43 ++++++++++++++++++++
 Allura/allura/nf/allura/css/site_style.css      |  3 ++
 .../templates/repo/merge_request_edit.html      | 33 +++++++++++++++
 3 files changed, 79 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/108e2ef3/Allura/allura/controllers/repository.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/repository.py b/Allura/allura/controllers/repository.py
index 1fb8323..e359885 100644
--- a/Allura/allura/controllers/repository.py
+++ b/Allura/allura/controllers/repository.py
@@ -367,6 +367,49 @@ class MergeRequestController(object):
             limit=limit,
             count=self.req.discussion_thread.post_count)
 
+    @property
+    def mr_widget_edit(self):
+        source_branches = [
+            b.name
+            for b in c.app.repo.get_branches() + c.app.repo.get_tags()]
+        target_branches = [
+            b.name
+            for b in c.app.repo.get_branches() + c.app.repo.get_tags()]
+        return SCMMergeRequestWidget(
+            source_branches=source_branches,
+            target_branches=target_branches)
+
+    @expose('jinja:allura:templates/repo/merge_request_edit.html')
+    def edit(self, **kw):
+        c.form = self.mr_widget_edit
+        if self.req['source_branch'] in c.form.source_branches:
+            source_branch = self.req['source_branch']
+        else:
+            source_branch = c.app.default_branch_name
+        if self.req['target_branch'] in c.form.target_branches:
+            target_branch = self.req['source_branch']
+        else:
+            target_branch = c.app.default_branch_name
+        return {
+            'source_branch': source_branch,
+            'target_branch': target_branch,
+            'description': self.req['description'],
+            'summary': self.req['summary']
+        }
+
+    @expose()
+    @require_post()
+    def do_request_merge_edit(self, **kw):
+        kw = self.mr_widget_edit.to_python(kw)
+        mr = M.MergeRequest.query.get(request_number=self.req['request_number'])
+        mr.target_branch = kw['target_branch']
+        mr.source_branch = kw['source_branch']
+        mr.description = kw['description']
+        M.Notification.post(
+            mr, 'merge_request',
+            subject='Merge request: ' + mr.summary)
+        redirect(mr.url())
+
     @expose()
     @require_post()
     @validate(mr_dispose_form)

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/108e2ef3/Allura/allura/nf/allura/css/site_style.css
----------------------------------------------------------------------
diff --git a/Allura/allura/nf/allura/css/site_style.css b/Allura/allura/nf/allura/css/site_style.css
index 94f5d09..cd28a15 100644
--- a/Allura/allura/nf/allura/css/site_style.css
+++ b/Allura/allura/nf/allura/css/site_style.css
@@ -3294,3 +3294,6 @@ ul.dropdown ul li a:hover {
     text-align: right;
     padding: 5px 10px 5px 0;
 }
+.markdown_preview.btn.edit{
+    margin-left: 10px;
+}

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/108e2ef3/Allura/allura/templates/repo/merge_request_edit.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/repo/merge_request_edit.html b/Allura/allura/templates/repo/merge_request_edit.html
new file mode 100644
index 0000000..88bdfc0
--- /dev/null
+++ b/Allura/allura/templates/repo/merge_request_edit.html
@@ -0,0 +1,33 @@
+{#-
+       Licensed to the Apache Software Foundation (ASF) under one
+       or more contributor license agreements.  See the NOTICE file
+       distributed with this work for additional information
+       regarding copyright ownership.  The ASF licenses this file
+       to you under the Apache License, Version 2.0 (the
+       "License"); you may not use this file except in compliance
+       with the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+       Unless required by applicable law or agreed to in writing,
+       software distributed under the License is distributed on an
+       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+       KIND, either express or implied.  See the License for the
+       specific language governing permissions and limitations
+       under the License.
+-#}
+{% extends 'allura:templates/repo/repo_master.html' %}
+
+{% block title %}
+  {% if c.app.repo %}
+    Repository: {{c.app.repo.name}}
+  {% else %}
+    Repository
+  {% endif %}
+{% endblock %}
+
+{% block header %}Request merge of {{c.app.config.options.mount_label}} {% endblock %}
+
+{% block content %}
+  {{ c.form.display(action='do_request_merge_edit', value=dict(source_branch=source_branch,
target_branch=target_branch, description=description, summary=summary))}}
+{% endblock %}


Mime
View raw message