51 lines
1.5 KiB
Plaintext
51 lines
1.5 KiB
Plaintext
<div id="tags" class="clear">
|
|
<%= render :partial => 'category', :collection => @categorylist %>
|
|
</div>
|
|
<div class="form-actions form-fixed form-inline pagination-right">
|
|
<%= form_for @new_category, :url => {:action => "create"}, :remote => true do |f| %>
|
|
<%= f.fields_for :name_translations do |name| %>
|
|
<% @site_valid_locales.each do |locale| %>
|
|
<%= label_tag(locale,t("gallery.new_category")+"["+I18nVariable.from_locale(locale)+"]") %>
|
|
<%= name.text_field locale %>
|
|
<% end %>
|
|
<% end %>
|
|
<%= f.submit t("gallery.save"), :class=> "btn btn-primary" %>
|
|
<% end %>
|
|
</div>
|
|
<script type="text/javascript">
|
|
var deleteCategory = function(a){
|
|
var parent = a.parent().parent();
|
|
parent.hide("slide",function(){parent.remove();})
|
|
}
|
|
var parent;
|
|
var editCategory = function(a,data){
|
|
parent = a.parent().parent();
|
|
var parenthtml = parent.html();
|
|
var tempdom = $("<div class='tagitem'></div>");
|
|
tempdom.append(data);
|
|
parent.html(tempdom);
|
|
tempdom.find("a#temp_cancel_btn").click(function(){
|
|
parent.html(parenthtml);
|
|
})
|
|
}
|
|
|
|
$(document).ready(function(){
|
|
$("#tags div.action a.delete").live('ajax:success', function(){
|
|
deleteCategory($(this));
|
|
})
|
|
$("#tags div.action a.edit").live('ajax:success',function(evt, data, status, xhr){
|
|
editCategory($(this),data);
|
|
})
|
|
})
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|