Chris Jones avatar Chris Jones committed 5278108 Merge

Merge.

Comments (0)

Files changed (5)

static/css/jquery.confirm.css

+#confirmOverlay{
+  width:100%;
+  height:100%;
+  position:fixed;
+  top:0;
+  left:0;
+  background:rgb(11,11,11);
+  background: -moz-linear-gradient(rgba(11,11,11,0.1), rgba(11,11,11,0.6)) repeat-x rgba(11,11,11,0.2);
+  background:-webkit-gradient(linear, 0% 0%, 0% 100%, from(rgba(11,11,11,0.1)), to(rgba(11,11,11,0.6))) repeat-x rgba(11,11,11,0.2);
+  z-index:100000;
+}
+
+#confirmBox{
+  background:#e5e5e5;
+  width:460px;
+  position:fixed;
+  left:50%;
+  top:50%;
+  margin:-130px 0 0 -230px;
+  border: 2px solid rgba(33, 33, 33, 0.75);
+
+  -moz-box-shadow: 0 0 2px rgba(255, 255, 255, 0.6) inset;
+  -webkit-box-shadow: 0 0 2px rgba(255, 255, 255, 0.6) inset;
+  box-shadow: 0 0 2px rgba(255, 255, 255, 0.6) inset;
+}
+
+#confirmBox h1,
+#confirmBox p{
+  background:#f5f5f5;
+  padding: 18px 25px;
+  text-shadow: 1px 1px 0 rgba(255, 255, 255, 0.6);
+  color:#666;
+}
+
+#confirmBox h1{
+  color:rgb(133, 27, 31);
+  letter-spacing:0.3px;
+}
+
+#confirmBox p{
+  background:none;
+  font-size:16px;
+  line-height:1.4;
+  padding-top: 35px;
+}
+
+#confirmButtons{
+  padding:15px 0 25px;
+  text-align:center;
+}
+
+#confirmBox .button{
+  border:2px solid rgba(0,0,0,.35);
+  color:rgba(0, 0, 0, 0.5);
+  display:inline-block;
+  font-weight:bold;
+  margin-right: 15px;
+  padding:10px 20px;
+  text-decoration:none;
+  text-align:center;
+
+  -webkit-border-radius:10px;
+  -moz-border-radius: 10px;
+  border-radius:10px;
+
+  text-shadow: 1px 1px 0 rgba(255, 255, 255, 0.35);
+}
+
+#confirmBox .button:last-child{ margin-right:0;}
+
+#confirmBox .button.go:hover {
+  border-color:rgb(46, 158, 50);
+}  
+#confirmBox .button.stop:hover {
+  border-color:rgb(227, 45, 20);
+}  
+
+#confirmBox header { position:relative; }
+#confirmBox header .close {
+  background:url('../img/x.png');
+  display:block;
+  height:32px;
+
+  position: absolute;
+  top:-20px;
+  right:-20px;
+
+  text-indent:-99999px;
+  width:32px;
+
+}
+#confirmBox header .close:hover { text-decoration:none; }

static/js/jquery.confirm.js

+(function($) {
+    $.confirm = function(params) {
+        if($('#confirmOverlay').length) {
+            return false;
+        }
+
+        var buttonHTML = '';
+        $.each(params.buttons, function(name, obj) {
+            buttonHTML += '<a href="#" class="button ' + obj['class'] + '">' + name + '</a>';
+
+            if(!obj.action) {
+                obj.action = function(){};
+            }
+        });
+
+        var markup = [
+            '<div id="confirmOverlay">',
+            '<div id="confirmBox">',
+            '<header>',
+            '<h1>', params.title, '</h1>',
+            '<a href="#" class="close">x</a>',
+            '</header>',
+            '<p>', params.message, '</p>',
+            '<div id="confirmButtons">',
+            buttonHTML,
+            '</div></div></div>'
+        ].join('');
+
+        $(markup).hide().appendTo('body').fadeIn();
+
+        var buttons = $('#confirmBox .button'),
+            i = 0;
+
+        $.each(params.buttons, function(name, obj) {
+            buttons.eq(i++).click(function() {
+                obj.action();
+                $.confirm.hide();
+                return false;
+            });
+        });
+
+        $('#confirmOverlay').click(function() {
+            $.confirm.hide();
+        });
+
+        $('#confirmBox header .close').click(function() {
+            $.confirm.hide();
+            return false;
+        });
+
+        $('html').bind('keydown', function(e) {
+            var code = (e.keyCode ? e.keyCode : e.which);
+
+            if (code == 27) {
+                $.confirm.hide();
+            }
+        });
+    }
+
+    $.confirm.hide = function() {
+        $('#confirmOverlay').fadeOut(function() {
+            $(this).remove();
+        });
+    }
+
+})(jQuery);

templates/key.html

 		$("#delete").live('click', function(e) {
 			e.stopPropagation();
 			e.preventDefault();
-
-			var link = $(this).attr("href"),
-				confirmation = confirm('Are you sure you want to delete this key?');
-
-			flashes.empty();
-
-			if (confirmation) {
-				$.ajax({
-					url: link,
-					dataType: "json",
-					success: function(data) {
-						$("<li>").text(data['flash']).appendTo(flashes);
-						$("#refresh_keys").trigger('click');
+			var link = $(this).attr("href");
+			$.confirm({
+				'title': 'Delete Confirmation',
+				'message': 'Are you sure you want to delete this key?',
+				'buttons': {
+					'Yes': {
+						'class': 'go',
+						'action': function() {
+							$.ajax({
+								url: link,
+								dataType: "json",
+								success: function(data) {
+									flashes.empty();
+									$("<li>").text(data['flash']).appendTo(flashes);
+									$("#refresh_keys").trigger('click');
+								}
+							});
+						}
+					},
+					'No': {
+						'class': 'stop'
 					}
-				});
-			}
+				}
+			});
 		});
 
     	$("#key").submit(function(e) {

templates/layout.html

 	<link rel="shortcut icon" href="{{ url_for('static', filename='favicon.png') }}">
 	<link rel="stylesheet" href="{{ url_for('static', filename='css/html5reset-1.6.1.css') }}" media="screen" charset="utf-8">
 	<link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}" media="screen" charset="utf-8">
+	<link rel="stylesheet" href="{{ url_for('static', filename='css/jquery.confirm.css') }}" media="screen" charset="utf-8">
 	<script type="text/javascript" src="{{ url_for('static', filename='js/jquery-1.4.4.min.js') }}"></script>
 	<script type="text/javascript" src="{{ url_for('static', filename='js/modernizr-1.6.min.js') }}"></script>
 </head>
 		<p>&copy; <a href="http://brack3t.com">Brack3t</a>. Design by veddermatic. Icons from <a 
 				href="http://somerandomdude.com/projects/iconic/">Iconic</a>.</p>
 	</footer>
+	<script src="{{ url_for('static', filename='js/jquery.confirm.js') }}"></script>
 	{% block extra_scripts %}{% endblock %}
 </body>
 </html>
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.