Author: rjollos Date: Sun Dec 29 09:21:48 2013 New Revision: 1554007 URL: http://svn.apache.org/r1554007 Log: 0.8dev: Added a Clear Default button for the products table on the Manage Products page. Refs #722.Add a Clear Default button for the products table on the Manage Products page
Modified: bloodhound/trunk/bloodhound_multiproduct/multiproduct/product_admin.py bloodhound/trunk/bloodhound_multiproduct/multiproduct/templates/admin_products.html bloodhound/trunk/bloodhound_multiproduct/tests/functional/admin.py Modified: bloodhound/trunk/bloodhound_multiproduct/multiproduct/product_admin.py URL: http://svn.apache.org/viewvc/bloodhound/trunk/bloodhound_multiproduct/multiproduct/product_admin.py?rev=1554007&r1=1554006&r2=1554007&view=diff ============================================================================== --- bloodhound/trunk/bloodhound_multiproduct/multiproduct/product_admin.py (original) +++ bloodhound/trunk/bloodhound_multiproduct/multiproduct/product_admin.py Sun Dec 29 09:21:48 2013 @@ -142,6 +142,13 @@ class ProductAdminPanel(TicketAdminPanel prefix) _save_config(self.config, req, self.log) req.redirect(req.href.admin(cat, page)) + + # Clear default product + elif req.args.get('clear'): + self.log.info("Clearing default product") + self.config.set('ticket', 'default_product', '') + _save_config(self.config, req, self.log) + req.redirect(req.href.admin(cat, page)) products = Product.select(self.env) data = {'view': 'list', Modified: bloodhound/trunk/bloodhound_multiproduct/multiproduct/templates/admin_products.html URL: http://svn.apache.org/viewvc/bloodhound/trunk/bloodhound_multiproduct/multiproduct/templates/admin_products.html?rev=1554007&r1=1554006&r2=1554007&view=diff ============================================================================== --- bloodhound/trunk/bloodhound_multiproduct/multiproduct/templates/admin_products.html (original) +++ bloodhound/trunk/bloodhound_multiproduct/multiproduct/templates/admin_products.html Sun Dec 29 09:21:48 2013 @@ -123,6 +123,7 @@ $product.description</textarea> <div class="buttons"> <input type="submit" name="remove" value="${_('Remove selected items')}" /> <input type="submit" name="apply" value="${_('Apply changes')}" /> + <input type="submit" name="clear" value="${_('Clear default')}" /> </div> <p class="help"> You can remove all items from this list to completely hide this Modified: bloodhound/trunk/bloodhound_multiproduct/tests/functional/admin.py URL: http://svn.apache.org/viewvc/bloodhound/trunk/bloodhound_multiproduct/tests/functional/admin.py?rev=1554007&r1=1554006&r2=1554007&view=diff ============================================================================== --- bloodhound/trunk/bloodhound_multiproduct/tests/functional/admin.py (original) +++ bloodhound/trunk/bloodhound_multiproduct/tests/functional/admin.py Sun Dec 29 09:21:48 2013 @@ -31,6 +31,27 @@ from tests.functional import Multiproduc #---------------- +class TestAdminProductDefault(MultiproductFunctionalTestCase, + FunctionalTwillTestCaseSetup): + def runTest(self): + """Admin set default product""" + name = self._tester.create_product() + products_url = self._tester.url + '/admin/ticket/products' + tc.go(products_url) + tc.formvalue('product_table', 'default', name) + tc.submit('apply') + tc.find('type="radio" name="default" value="%s" checked="checked"' + % name) + tc.go(self._tester.url + '/newticket') + tc.find('<option selected="selected" value="%s">%s</option>' + % (name, name)) + # Test the "Clear default" button + tc.go(products_url) + tc.submit('clear', 'product_table') + tc.notfind('type="radio" name="default" value=".+" checked="checked"') + tid = self._tester.create_ticket() + + class RegressionTestBhTicket667(MultiproductFunctionalTestCase, FunctionalTwillTestCaseSetup): @@ -59,6 +80,7 @@ def functionalSuite(suite=None): import tests.functional suite = tests.functional.functionalSuite() + suite.addTest(TestAdminProductDefault()) suite.addTest(RegressionTestBhTicket667()) return suite