-
-
Save ohadlevy/1481158 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb | |
index e9af70b..8186708 100644 | |
--- a/app/helpers/application_helper.rb | |
+++ b/app/helpers/application_helper.rb | |
@@ -64,9 +64,10 @@ module ApplicationHelper | |
def link_to_add_puppetclass klass, type | |
options = klass.name.size > 28 ? {:'data-original-title'=>klass.name, :rel=>'twipsy'} : {} | |
content_tag(:span, truncate(klass.name, :length => 28), options).html_safe + | |
- link_to_function("", "add_puppet_class(this)", :'data-class-id'=>klass.id, | |
- :'data-original-title'=>"Click to add #{klass}", :rel=>'twipsy', | |
- :class=>"ui-icon ui-icon-plus") | |
+ link_to_function("", "add_puppet_class(this)", | |
+ 'data-class-id' => klass.id, 'data-type' => type, | |
+ 'data-original-title' => "Click to add #{klass}", :rel => 'twipsy', | |
+ :class => "ui-icon ui-icon-plus") | |
end | |
def check_all_links(form_name) | |
diff --git a/public/javascripts/host_edit.js b/public/javascripts/host_edit.js | |
index 93bc998..d299b6a 100644 | |
--- a/public/javascripts/host_edit.js | |
+++ b/public/javascripts/host_edit.js | |
@@ -1,8 +1,9 @@ | |
function add_puppet_class(item){ | |
var id = $(item).attr('data-class-id'); | |
+ var type = $(item).attr('data-type'); | |
var content = $(item).parent().clone(); | |
content.attr('id', 'selected_puppetclass_'+ id); | |
- content.append("<input id='host_puppetclass_ids_' name='host[puppetclass_ids][]' type='hidden' value=" +id+ ">"); | |
+ content.append("<input id='" + type +"_puppetclass_ids_' name='" + type +"[puppetclass_ids][]' type='hidden' value=" +id+ ">"); | |
content.children('span').twipsy(); | |
var link = content.children('a'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment