Skip to content

Commit

Permalink
General cleanup. Moved the hide views event to the form where it real…
Browse files Browse the repository at this point in the history
…ly belongs
  • Loading branch information
baphled committed Jun 25, 2010
1 parent 63d6232 commit 232440f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 deletions.
5 changes: 0 additions & 5 deletions public/javascripts/application.js
Expand Up @@ -24,11 +24,6 @@ $(document).ready(function() {
(event.type == 'mouseover')? $(this).addClass('ui-state-hover') : $(this).removeClass('ui-state-hover');
});

/**
* We don't want our checkboxes viewable initially
*/
$('.views').hide();

/**
* Handling the viewing and hiding of our item checkboxes
*/
Expand Down
15 changes: 7 additions & 8 deletions public/javascripts/hover_dialog.js
Expand Up @@ -2,21 +2,20 @@
$(document).ready(function() {

// Create acessors for our hover dialog
var $formAction = $('form').attr('action'),
formIdArray = $('form').attr('id').split('_');
var formIdArray = $('form').attr('id').split('_');
resourceSingular = formIdArray[1],
resourcePlural = resourceSingular.pluralize(),
$tagInput = $('input#'+ resourceSingular + '_tag_list'),
$tagInputWrapper = $('li#'+ resourceSingular + '_tag_list_input'),
$hoverDialog = $("<div></div>")
.addClass('hover ui-widget ui-widget-content ui-corner-all')
.insertAfter($tagInput)
.hide();
.addClass('hover ui-widget ui-widget-content ui-corner-all')
.insertAfter($tagInput)
.hide();

$tagInput.keyup(function() {
$url = '/' + resourcePlural + "/tags.json";
var url = '/' + resourcePlural + "/tags.json";
$.ajax({
url: $url,
url: url,
data: $tagInput.serialize(),
dataType: 'json',
type: 'GET',
Expand Down Expand Up @@ -51,7 +50,7 @@ $(document).ready(function() {

// if there are no more tags we should hide the dialog panel
// @todo cleanup as this could be done cleaner
if ($hoverDialog.html() == (' ' || ' ') ) {
if ($hoverDialog.html().trim() == '') {
$hoverDialog.fadeOut();
}
return false;
Expand Down

0 comments on commit 232440f

Please sign in to comment.