More descriptive 'Delete relation' alert, and select CANCEL by default
authorRichard Fairhurst <richard@systemeD.net>
Mon, 12 Mar 2012 18:01:11 +0000 (18:01 +0000)
committerRichard Fairhurst <richard@systemeD.net>
Mon, 12 Mar 2012 18:01:11 +0000 (18:01 +0000)
net/systemeD/halcyon/connection/Relation.as
net/systemeD/potlatch2/TagViewer.mxml
net/systemeD/potlatch2/controller/ControllerState.as

index 85fa0505f94bbfd168d1277eb41908e345377e35..900877e9ee582762cce135868a89157a4fa0daa6 100644 (file)
@@ -151,6 +151,11 @@ package net.systemeD.halcyon.connection {
                        return desc;
                }
                
+               public function getRelationType():String {
+                       var relTags:Object = getTagsHash();
+                       return relTags["type"] ? relTags["type"] : getType();
+               }
+               
                private function getSignificantName(entity:Entity):String {
                        if (!entity.loaded || (entity is Relation)) return '';
 
index 5756ab5f32a4ddc019e44d06f059d6c6b19361c4..37fc7142b048fbacc4bbc389536922ecca23749f 100644 (file)
                                break;
                        
                        case 3: // Delete relation
-                               Alert.show("Do you really want to delete the relation?","Are you sure?",Alert.YES | Alert.CANCEL,null,
+                               var warning:String="This relation has # members. Deleting it will affect all of them and erase this $. Are you really sure?";
+                               warning=warning.replace("#",rel.length).replace("$",rel.getRelationType());
+                               Alert.show(warning,"Are you sure?",Alert.YES | Alert.CANCEL,null,
                                        function(event:CloseEvent):void { 
                                                if (event.detail==Alert.CANCEL) return;
                                                rel.remove(MainUndoStack.getGlobalStack().addAction);
-                                       } );
+                                       } , null, Alert.CANCEL);
                                break;
                }
        }
index 2ef4fb3384bc8415345b42f754db3b42094e98fc..d2c5deb6d6d30907ebce558a8876595fae310149 100644 (file)
@@ -235,7 +235,7 @@ package net.systemeD.potlatch2.controller {
                        for each (var item:Entity in _selection)
                                if (item.id>0) revertable=true;
                        if (revertable)
-                               Alert.show("Revert selected items to the last saved version, discarding your changes?","Are you sure?",Alert.YES | Alert.CANCEL,null,revertHandler);
+                               Alert.show("Revert selected items to the last saved version, discarding your changes?","Are you sure?",Alert.YES | Alert.CANCEL,null,revertHandler,null,Alert.CANCEL);
                }
                protected function revertHandler(event:CloseEvent):void {
                        if (event.detail==Alert.CANCEL) return;