You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by tv...@apache.org on 2013/09/09 16:02:40 UTC

[5/6] git commit: [#6533] ticket:422 improved form and added template for github code import

[#6533] ticket:422 improved form and added template for github code import


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

Branch: refs/heads/master
Commit: 7e720e75f75f31c085d11b4ec13a82d3d51555f4
Parents: df79d59
Author: Anton Kasyanov <mi...@gmail.com>
Authored: Thu Sep 5 13:18:16 2013 +0300
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Mon Sep 9 14:02:08 2013 +0000

----------------------------------------------------------------------
 ForgeImporters/forgeimporters/github/code.py    | 25 ++++++++++----
 .../github/templates/code/index.html            | 35 ++++++++++++++++++++
 2 files changed, 54 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/7e720e75/ForgeImporters/forgeimporters/github/code.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/github/code.py b/ForgeImporters/forgeimporters/github/code.py
index 9121f5c..1ed516a 100644
--- a/ForgeImporters/forgeimporters/github/code.py
+++ b/ForgeImporters/forgeimporters/github/code.py
@@ -25,6 +25,19 @@ from allura.lib import validators as v
 from forgeimporters.base import ToolImporter
 from forgeimporters.github import GitHubProjectExtractor
 
+from tg import (
+        expose,
+        flash,
+        redirect,
+        validate,
+        )
+from tg.decorators import (
+        with_trailing_slash,
+        without_trailing_slash,
+        )
+from allura.lib.decorators import require_post, task
+from pylons import tmpl_context as c
+
 TARGET_APPS = []
 
 try:
@@ -35,18 +48,17 @@ except ImportError:
 
 @task(notifications_disabled=True)
 def import_tool(**kw):
-    GoogleRepoImporter().import_tool(c.project, c.user, **kw)
+    GitHubRepoImporter().import_tool(c.project, c.user, **kw)
 
 
 class GitHubRepoImportForm(fe.schema.Schema):
     gh_project_name = fev.UnicodeString(not_empty=True)
+    gh_user_name = fev.UnicodeString(not_empty=True)
     mount_point = fev.UnicodeString()
     mount_label = fev.UnicodeString()
 
     def _to_python(self, value, state):
         value = super(self.__class__, self)._to_python(value, state)
-
-        gh_project_name = value['gh_project_name']
         mount_point = value['mount_point']
         try:
             v.MountPointValidator('git').to_python(mount_point)
@@ -72,10 +84,11 @@ class GitHubRepoImportController(BaseController):
     @without_trailing_slash
     @expose()
     @require_post()
-    @validate(GoogleRepoImportForm(), error_handler=index)
-    def create(self, gc_project_name, mount_point, mount_label, **kw):
+    @validate(GitHubRepoImportForm(), error_handler=index)
+    def create(self, gh_project_name, gh_user_name, mount_point, mount_label, **kw):
         import_tool.post(
-                project_name=gc_project_name,
+                project_name=gh_project_name,
+                user_name=gh_user_name,
                 mount_point=mount_point,
                 mount_label=mount_label)
         flash('Repo import has begun. Your new repo will be available '

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/7e720e75/ForgeImporters/forgeimporters/github/templates/code/index.html
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/github/templates/code/index.html b/ForgeImporters/forgeimporters/github/templates/code/index.html
new file mode 100644
index 0000000..5bf7f0c
--- /dev/null
+++ b/ForgeImporters/forgeimporters/github/templates/code/index.html
@@ -0,0 +1,35 @@
+{#-
+       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 'forgeimporters:templates/importer_base.html' %}
+
+{% block title %}
+{{c.project.name}} / Import your repo from GitHub
+{% endblock %}
+
+{% block importer_fields %}
+<div>
+  <label for="gc_project_name">GitHub User Name</label>
+  <input name="gc_project_name" value="{{ c.form_values['gc_project_name'] }}" />
+  {{ error('gc_project_name') }}
+  <label for="gc_project_name">GitHub Project Name</label>
+  <input name="gc_project_name" value="{{ c.form_values['gc_project_name'] }}" />
+  {{ error('gc_project_name') }}
+
+</div>
+{% endblock %}
\ No newline at end of file