Skip to content

Instantly share code, notes, and snippets.

@daniloisr
Created February 16, 2011 19:54
Show Gist options
  • Save daniloisr/830046 to your computer and use it in GitHub Desktop.
Save daniloisr/830046 to your computer and use it in GitHub Desktop.
# resposta do controller
respond_with do |format|
format.js {
render :update do |page|
if params[:page]
page.call "$('#repo_list').html", render(:partial => 'repo_list', :locals => { :f => SemanticFormBuilder.new(@page.class.name.underscore.to_s, @page, self, {}, proc{}) })
elsif params[:page_files]
page.call "$('#files_list').append", render(:partial => 'files_list')
page.call "$('#will_paginate').html", (will_paginate @page_files_unchecked, :param_name => 'page_files', :previous_label => t("will_paginate.previous"), :next_label => t("will_paginate.next"), :class => 'pagination ajax', :page_links => false, :renderer => Twitter, :twitter_label => t("more"))
end
end
}
format.html
end
###############
# View
<% @page.type ||= "Page" %>
<% @page_files_unchecked.each do |repo_file| %>
<%= check_box_tag("#{@page.type.downcase}[repository_ids][]", repo_file.id, false) %>
<%= "#{repo_file.description} (#{repo_file.archive_file_name})" %>
<br />
<% end %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment