Skip to content

Commit

Permalink
Added inflection and refactored the hover_dialog file to use inflecti…
Browse files Browse the repository at this point in the history
…on instead of our hack.
  • Loading branch information
baphled committed Jun 21, 2010
1 parent c244e55 commit 071e0ac
Show file tree
Hide file tree
Showing 3 changed files with 515 additions and 10 deletions.
1 change: 1 addition & 0 deletions app/views/layouts/no_sidebar.html.erb
Expand Up @@ -20,6 +20,7 @@
<%= javascript_include_tag "jquery.formtastic.tooltips" %>
<%= javascript_include_tag "application" %>
<%= javascript_include_tag "jquery-validate" %>
<%= javascript_include_tag "inflection" %>
<%= javascript_include_tag "form" %>
<%= yield :js_head %>
<%= javascript_include_tag "http://cdn.jquerytools.org/1.2.0/all/jquery.tools.min.js" %>
Expand Down
13 changes: 3 additions & 10 deletions public/javascripts/hover_dialog.js
Expand Up @@ -8,14 +8,8 @@ $(document).ready(function() {
// We need singular & plural resource names to take advantage of hover dialog
var formIdArray = $formID.split('_');
var $resourceSingular = formIdArray[1];
var $resourcePlural = '';
var $resourcePlural = formIdArray[1].pluralize();

// Should really use some kind of pluralisation technique
if ($resourceSingular == 'story') {
$resourcePlural = 'stories'
} else {
$resourcePlural = $resourceSingular + 's';
};
// Selector for our tag input
var $tagInput = $('input#'+ $resourceSingular + '_tag_list');
var $tagInputWrapper = $('li#'+ $resourceSingular + '_tag_list_input');
Expand Down Expand Up @@ -62,9 +56,8 @@ $(document).ready(function() {
$tagInput.attr('value',$tagInput.attr('value') + $(this).html() + ', ');
$(this).fadeOut();
return false;
}))
.append(' ')
.fadeIn();
})
).append(' ').fadeIn();
};
};
});

0 comments on commit 071e0ac

Please sign in to comment.