public inbox for [email protected]  
help / color / mirror / Atom feed
From: Akshay Joshi <[email protected]>
To: pgadmin-hackers <[email protected]>
Subject: Customisable delete row message
Date: Mon, 1 Aug 2016 12:26:07 +0530
Message-ID: <CANxoLDfoXwN0FVfDTbuGBCNMjJpqbaV05weF3=VRro9wRi15UQ@mail.gmail.com> (raw)
List-Unsubscribe:  <mailto:[email protected]?body=unsub%20pgadmin-hackers>

Hi All

With current implementation message for delete row is hard coded 'Are you
sure you wish to delete this row?' in DeleteCell control. I have modified
this behaviour and make it customisable. User of this control can set their
own delete message.

Attached is the patch file, please review it and let me know the review
comments if any.

-- 
*Akshay Joshi*
*Principal Software Engineer *



*Phone: +91 20-3058-9517Mobile: +91 976-788-8246*


-- 
Sent via pgadmin-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


Attachments:

  [application/octet-stream] custom_delete_msg.patch (1.2K, 3-custom_delete_msg.patch)
  download | inline diff:
diff --git a/web/pgadmin/static/js/backgrid/backgrid.pgadmin.js b/web/pgadmin/static/js/backgrid/backgrid.pgadmin.js
index 49edd99..8e737c4 100644
--- a/web/pgadmin/static/js/backgrid/backgrid.pgadmin.js
+++ b/web/pgadmin/static/js/backgrid/backgrid.pgadmin.js
@@ -252,6 +252,10 @@
   });
 
   var DeleteCell = Backgrid.Extension.DeleteCell = Backgrid.Cell.extend({
+      defaults: _.defaults({
+        defaultDeleteMsg: 'Are you sure you wish to delete this row?'
+      }, Backgrid.Cell.prototype.defaults),
+
       /** @property */
       className: "delete-cell",
       events: {
@@ -266,9 +270,11 @@
                              Backgrid.callByNeed(this.column.get('canDeleteRow'),
                               this.column, this.model) : true;
         if (canDeleteRow) {
+          var delete_msg = !_.isUndefined(this.column.get('customDeleteMsg')) ?
+                           this.column.get('customDeleteMsg'): that.defaults.defaultDeleteMsg;
           Alertify.confirm(
             'Delete Row',
-            'Are you sure you wish to delete this row?',
+            delete_msg,
             function(evt) {
               that.model.collection.remove(that.model);
             },


view thread (2+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected]
  Subject: Re: Customisable delete row message
  In-Reply-To: <CANxoLDfoXwN0FVfDTbuGBCNMjJpqbaV05weF3=VRro9wRi15UQ@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox