Skip to content

Commit

Permalink
Save button
Browse files Browse the repository at this point in the history
turns blue when the page is unsaved
  • Loading branch information
Ankur authored and thomaspark committed Feb 3, 2013
1 parent 482ed7b commit b81e651
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 5 deletions.
20 changes: 20 additions & 0 deletions css/style.css
Expand Up @@ -24,6 +24,7 @@ p {
margin: 0;
}


#control {
z-index: 199999;
min-width: 865px;
Expand Down Expand Up @@ -915,8 +916,27 @@ ie6, li {
background-position: 8px 7px;
}

.unsaved {
background-color: #2ba6cb;
border: 1px solid #1e728c;
-webkit-box-shadow: 0 1px 0 rgba(255, 255, 255, 0.5) inset,
1px 2px 1px rgba(0, 0, 0, 0.2);
-moz-box-shadow: 0 1px 0 rgba(255, 255, 255, 0.5) inset,
1px 2px 1px rgba(0, 0, 0, 0.2);
box-shadow: 0 1px 0 rgba(255, 255, 255, 0.5) inset,
1px 2px 1px rgba(0, 0, 0, 0.2);
color: white;
/*font-weight: bold; */
-webkit-transition: background-color 0.15s ease-in-out;
-moz-transition: background-color 0.15s ease-in-out;
-o-transition: background-color 0.15s ease-in-out;
transition: background-color 0.15s ease-in-out;
/* Hovers */ /* Sizes */ /* Colors */ /* Radii */ /* Layout */ /* Disabled ---------- */
}

.button.download {
padding-left: 24px;

/* background-image: url(/images/arrow_down_12x12.png);*/
background-image: url(../images/download.png);
background-repeat: no-repeat;
Expand Down
2 changes: 2 additions & 0 deletions js/editors/unsaved.js
Expand Up @@ -24,13 +24,15 @@ function updateTitle(revert, onload) {
// if (jsbin.settings.home) title = jsbin.settings.home + '@' + title;
if (editors.html.ready && editors.javascript.ready) {
if (!revert) {
$('#save').addClass('unsaved');
document.title = title + ' [unsaved]';
warn_on_unload = "You have unsaved changes!";
// if ($revert.addClass('enable').is(':hidden')) {
// $revert[onload ? 'show' : 'fadeIn']().next().removeClass('left');
// }
} else {
document.title = title;
$('#save').removeClass('unsaved');
}
}
}
11 changes: 6 additions & 5 deletions nav.php
Expand Up @@ -3,13 +3,14 @@
<div class="buttons">
<a id="account" class="tab button gap" href="<?php echo ROOT?>">New Page</a>

<a id="view" target="<?php echo $code_id?>" class="tab button group light left" href="http://<?php echo $_SERVER['HTTP_HOST'] . ROOT . $code_id?>">View</a>

<?php if ($code_id) : ?>
<a id="save" title="Save a new revision" class="button light save group" href="<?php echo $code_id_path?>save">Save</a>
<?php if ($code_id) : ?>
<a id="save" title="Save a new revision" class="button light save group left" href="<?php echo $code_id_path?>save">Save</a>
<?php else : ?>
<a id="save" class="tab button light save group" href="<?php echo ROOT?>save">Save</a>
<a id="save" class="tab button light save group left" href="<?php echo ROOT?>save">Save</a>
<?php endif ?>
<a id="view" target="<?php echo $code_id?>" class="tab button group light" href="http://<?php echo $_SERVER['HTTP_HOST'] . ROOT . $code_id?>">View</a>



<?php if ($ownership) :?>
<div class="button group gap right tall">
Expand Down

1 comment on commit b81e651

@as3445
Copy link
Collaborator

@as3445 as3445 commented on b81e651 Feb 12, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixes #3

Please sign in to comment.