Skip to content

Instantly share code, notes, and snippets.

@oren
Created September 15, 2010 21:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oren/581553 to your computer and use it in GitHub Desktop.
Save oren/581553 to your computer and use it in GitHub Desktop.
view :
<%= render "missing_content" %>
_missing_content.html.erb :
<% if @missing_content %>
<h2> The following keys has no content on environment :</h2>
<% @missing_content.each do |language| %>
<ul>
<li>
<%= language[:language] %>- <%= language[:keys].join(',') %>
</li>
</ul>
<% end %>
<% end %>
get_missing_content.js.erb :
$("#missing_content").html("<%= escape_javascript( render 'missing_content' ) ) %>");
application.js :
$(".current-environments input[type='radio']").click(function() {
$.ajax({
url: '/get_missing_content',
success: function(data) {}
});
});
pages_controller:
def get_missing_content
@missing_content = [ {:language => 'english', :keys => ['key1', 'key2', 'key3']}, {:language => 'spanish', :keys => ['key1']}, {:language => 'russian', :keys => ['key4']} ]
respond_to do |format|
format.js
end
end
routes:
map.get_missing_content 'get_missing_content',
:controller => 'pages',
:action => 'get_missing_content',
:conditions => { :method => :get }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment