Missed allow_new from EasyCrudRestController...
Am Samstag, 26. Mai 2012 12:34:59 UTC+2 schrieb Moritz Schlarb:
>
> Hi there!
>
> I did some work to make tgext.crud use the various features of the
> Twitter Bootstrap CSS framework.
> Attached you will find a patch against the 0.5 tag (I wanted it to work
> on TurboGears-2.1.5, using tgext.crud-0.5.1 just gives me
> RenderingErrors related to Genshi).
>
> Also, I did only port the Mako templates, as Genshi complained about the
> XML() function not being defined (and even if I replace it by Markup()
> in the tgext.crud templates, tw2 uses XML() again...)
>
> Changes are:
> - Display menu in a span2 column with highlighted current item
> - Display New ${model} link as button with a Plus icon
> - Optionally disable the "New" functionality altogether with a parameter
> - Display rest of forms in a span10 on the right side.
>
> To do:
> - Pagination... Bootstrap includes some pagination styles
> (http://twitter.github.com/bootstrap/components.html#pagination) but
> they require having the pager using lists which I haven't found possible
> in webhelpers.paginate
> - Use a nicer style for the action buttons in the table --> sprox
> e.g.
> <a ... class="btn btn-mini"><i class="icon-pencil"></i> Edit</a>
> <input type="submit" class="btn-mini btn-danger" ...
> value="Delete" />
> - Use the Bootstrap form elements --> tw2
>
> Hope this patch can be useful in some way!
>
> Cheers,
> Moritz
>
--
You received this message because you are subscribed to the Google Groups
"TurboGears Trunk" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/turbogears-trunk/-/1YB6Q6269IoJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/turbogears-trunk?hl=en.
# HG changeset patch
# User Moritz Schlarb <[email protected]>
# Date 1338028644 -7200
# Branch bootstrap
# Node ID f1f7995b2da29e32bc36bff885fa60bc8395a1ea
# Parent eae3233ae69513c526b0e9271782322ae5d9b900
Missed allow_new from EasyCrudRestController
diff --git a/tgext/crud/controller.py b/tgext/crud/controller.py
--- a/tgext/crud/controller.py
+++ b/tgext/crud/controller.py
@@ -252,7 +252,7 @@
return dict(args=args)
class EasyCrudRestController(CrudRestController):
- def __init__(self, session, menu_items=None):
+ def __init__(self, session, menu_items=None, allow_new=True):
if not hasattr(self, 'table'):
class Table(SortableTableBase):
__entity__=self.model
@@ -283,7 +283,7 @@
__entity__ = self.model
self.new_filler = NewFiller(session)
- super(EasyCrudRestController, self).__init__(session, menu_items)
+ super(EasyCrudRestController, self).__init__(session, menu_items, allow_new)
#Permit to quickly customize form options
if hasattr(self, '__form_options__'):