[ckan-changes] commit/ckanext-community: dread: [plugin, templates]: Fixed routing. Forms do not work yet.

Bitbucket commits-noreply at bitbucket.org
Wed May 25 15:42:15 UTC 2011


1 new changeset in ckanext-community:

http://bitbucket.org/okfn/ckanext-community/changeset/fa534e300e11/
changeset:   r13:fa534e300e11
user:        dread
date:        2011-05-25 17:40:47
summary:     [plugin, templates]: Fixed routing. Forms do not work yet.
affected #:  5 files (1.2 KB)

--- a/ckanext/community/plugin.py	Wed Mar 16 12:58:40 2011 -0400
+++ b/ckanext/community/plugin.py	Wed May 25 16:40:47 2011 +0100
@@ -16,8 +16,37 @@
     implements(IConfigurer, inherit=True)
         
     def before_map(self, map):
-        map.resource('app', 'apps', controller='ckanext.community.controllers.application:AppController')
-        map.resource('idea', 'ideas', controller='ckanext.community.controllers.idea:IdeaController')
+        app_controller = 'ckanext.community.controllers.application:AppController'
+        map.redirect("/apps", "/app")
+        map.redirect("/apps/{url:.*}", "/app/{url}")
+        map.connect('/app/{action}', controller=app_controller,
+        requirements=dict(action='|'.join([
+                        'create',
+                        'new',
+                        'update',
+                        'edit',
+                        'delete',
+                        'show',
+                        ]))
+                    )
+        map.connect('/app/{id}', controller=app_controller, action='show')
+        map.connect('/app', controller=app_controller, action='index')
+
+        idea_controller = 'ckanext.community.controllers.idea:IdeaController'
+        map.redirect("/ideas", "/idea")
+        map.redirect("/ideas/{url:.*}", "/idea/{url}")
+        map.connect('/idea/{action}', controller=idea_controller,
+        requirements=dict(action='|'.join([
+                        'create',
+                        'new',
+                        'update',
+                        'edit',
+                        'delete',
+                        'show',
+                        ]))
+                    )
+        map.connect('/idea/{id}', controller=idea_controller, action='show')
+        map.connect('/idea', controller=idea_controller, action='index')
         
         map.connect('app_api', '/api/2/util/apps/{action}',
             conditions=dict(method=['GET']),


--- a/templates/ckanext/community/apps.html	Wed Mar 16 12:58:40 2011 -0400
+++ b/templates/ckanext/community/apps.html	Wed May 25 16:40:47 2011 +0100
@@ -11,7 +11,7 @@
   
 <div py:match="content" class="community-content"><h3>
-      ${h.link_to('Share your app', h.url_for(controller='apps', action='new'))}
+      ${h.link_to('Share your app', h.url_for(action='new'))}
   </h3><h1>Apps</h1>
@@ -25,7 +25,7 @@
   	    <py:for each="app in c.apps"><tr><td>
-  		        ${h.link_to(app.get('name'), h.url_for(controller='apps', action=app.get('name')))}
+  		        ${h.link_to(app.get('name'), h.url_for(action=app.get('name')))}
   		    </td><td><div>


--- a/templates/ckanext/community/apps_show.html	Wed Mar 16 12:58:40 2011 -0400
+++ b/templates/ckanext/community/apps_show.html	Wed May 25 16:40:47 2011 +0100
@@ -15,7 +15,7 @@
     <div id="content-header"><h1 class="title">${c.app.get('title')}</h1>
         
-    <form py:if="c.auth_for_update" method="get" action="${h.url_for(controller='apps', id='edit', action=c.app.get('name'))}">
+    <form py:if="c.auth_for_update" method="get" action="${h.url_for(id='edit', action=c.app.get('name'))}"><input type="submit" value="Edit" /></form>
     


--- a/templates/ckanext/community/ideas.html	Wed Mar 16 12:58:40 2011 -0400
+++ b/templates/ckanext/community/ideas.html	Wed May 25 16:40:47 2011 +0100
@@ -11,7 +11,7 @@
   
 <div py:match="content" class="community-content"><h3>
-      ${h.link_to('Share your idea', h.url_for(controller='ideas', action='new'))}
+      ${h.link_to('Share your idea', h.url_for(action='new'))}
   </h3><h1>Ideas</h1>
@@ -25,7 +25,7 @@
   	    <py:for each="idea in c.ideas"><tr><td>
-  		        ${h.link_to(idea.get('name'), h.url_for(controller='ideas', action=idea.get('name')))}
+  		        ${h.link_to(idea.get('name'), h.url_for(action=idea.get('name')))}
   		    </td><td><div>


--- a/templates/ckanext/community/ideas_show.html	Wed Mar 16 12:58:40 2011 -0400
+++ b/templates/ckanext/community/ideas_show.html	Wed May 25 16:40:47 2011 +0100
@@ -15,7 +15,7 @@
     <div id="content-header"><h1 class="title">${c.idea.get('title')}</h1>
         
-    <form py:if="c.auth_for_update" method="get" action="${h.url_for(controller='ideas', id='edit', action=c.idea.get('name'))}">
+    <form py:if="c.auth_for_update" method="get" action="${h.url_for(id='edit', action=c.idea.get('name'))}"><input type="submit" value="Edit" /></form>

Repository URL: https://bitbucket.org/okfn/ckanext-community/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.




More information about the ckan-changes mailing list