Skip to content

Commit

Permalink
managing top cities
Browse files Browse the repository at this point in the history
  • Loading branch information
paulca committed Nov 2, 2009
1 parent 0cddce8 commit 2ad0e62
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
8 changes: 8 additions & 0 deletions app/controllers/admin/top_cities_controller.rb
@@ -1,3 +1,11 @@
class Admin::TopCitiesController < ApplicationController
inherit_resources

def create
create! { admin_top_cities_path }
end

def update
update! { admin_top_cities_path }
end
end
21 changes: 19 additions & 2 deletions app/views/admin/top_cities/index.html.erb
Expand Up @@ -5,7 +5,24 @@
</ul>

<%- if @top_cities.empty? -%>
<p><%= t('top_city.no_cities') %></p>
<%- else -%>
<table>
<tr>
<th><%= t('top_city.city') %></th>
<th>&nbsp;</th>
</tr>

<%- @top_cities.each do |top_city| -%>
<tr>
<td>
<%= top_city.city %>, <%= t("countries.#{top_city.country}") %>
(<%= link_to t('general.edit'), edit_admin_top_city_path(top_city) %>)
</td>
<td>
<%= link_to t('general.delete'), [:admin, top_city], :method => :delete, :confirm => t('general.confirm') %>
</td>
</tr>
<%- end -%>
</table>
<%- end -%>
3 changes: 3 additions & 0 deletions config/locales/en.yml
Expand Up @@ -308,6 +308,9 @@ en:

top_city:
add_new: Add Top City
no_cities: No top cities have been set

city: City

rfp:
validations:
Expand Down

0 comments on commit 2ad0e62

Please sign in to comment.