Skip to content

Commit

Permalink
Made anthill form look nice
Browse files Browse the repository at this point in the history
Some work on dashboard
Some minor CSS work on forms
  • Loading branch information
TomK32 committed Aug 22, 2009
1 parent 75f3e59 commit ec8fc71
Show file tree
Hide file tree
Showing 12 changed files with 73 additions and 8 deletions.
2 changes: 0 additions & 2 deletions app/models/anthill.rb
Expand Up @@ -21,7 +21,5 @@ def set_position

self.latitude = rand(self.map.width)
self.longitude = rand(self.map.height)

puts y self
end
end
10 changes: 6 additions & 4 deletions app/views/anthills/_form.html.haml
@@ -1,11 +1,13 @@

%p
= form.label :name, t(:'.name')
= form.text_field :name
%fieldset
%legend= t(:'.details')
%p
= form.label :name, t(:'.name')
= form.text_field :name

%fieldset
%legend= t(:'.maps')
- Map.open.all(:limit => 10).each do |map|
%p
%p.checkbox
= form.radio_button :map_id, map.id
= form.label "map_id_#{map.id}", map.name
7 changes: 7 additions & 0 deletions app/views/ants/_ant.html.haml
@@ -0,0 +1,7 @@
%div[ant]

= link_to 'Show', object_path(ant)
|
= link_to 'Edit', edit_object_path(ant)
|
= link_to 'Destroy', object_path(ant), :confirm => 'Really destroy ant?', :method => :delete
4 changes: 4 additions & 0 deletions app/views/ants/_form.html.haml
@@ -0,0 +1,4 @@
= form.hidden_field :type
%p
There aren't any options yet when creating a new queen. Later you can
choose from standard types or something like that.
11 changes: 11 additions & 0 deletions app/views/ants/edit.html.haml
@@ -0,0 +1,11 @@
%h1 Editing ant

= error_messages_for :ant

- form_for(:ant, :url => object_url, :html => { :method => :put }) do |f|
= render :partial => "form", :locals => {:f => f}
%p= submit_tag "Update"

= link_to 'Show', object_path
|
= link_to 'Back', objects_path
5 changes: 5 additions & 0 deletions app/views/ants/index.html.haml
@@ -0,0 +1,5 @@
%h1 Listing ants

= render :partial => 'ant', :collection => current_objects

= link_to 'New ant', new_object_path
9 changes: 9 additions & 0 deletions app/views/ants/new.html.haml
@@ -0,0 +1,9 @@
- @page_title = t(:'.page_title', :name => current_model_name)

= error_messages_for :ant

- form_for(:ant, :url => anthill_ants_url) do |form|
= render :partial => "form", :object => form
%p.submit
= submit_tag t(:'.submit', :name => current_model_name)

9 changes: 9 additions & 0 deletions app/views/ants/show.html.haml
@@ -0,0 +1,9 @@
%h1 Viewing ant

%div[current_object]

= link_to 'Edit', edit_object_path
|
= link_to 'Destroy', object_path, :confirm => 'Really destroy ant?', :method => :delete
|
= link_to 'Back', objects_path
7 changes: 7 additions & 0 deletions app/views/dashboard/_anthill.haml
@@ -0,0 +1,7 @@

%div[anthill]
.name= link_to anthill.name, anthill_path(anthill)
%ul
%li.created_at.datetime= anthill.created_at
%li.worker_count= t(:'.workers', :count => anthill.worker_count)
%li.soldier_count= t(:'.soldiers', :count => anthill.soldier_count)
3 changes: 2 additions & 1 deletion app/views/dashboard/index.html.haml
Expand Up @@ -3,6 +3,7 @@
%p= render :partial => 'intro'

%h2.anthills= t(:'.anthills')
=link_to t(:'.create_new_anthill'), new_anthill_path
- current_user.anthills.each do |anthill|
= render :partial => 'anthill', :object => anthill

.new=link_to t(:'.create_new_anthill'), new_anthill_path
11 changes: 11 additions & 0 deletions config/locales/en.yml
Expand Up @@ -8,6 +8,7 @@ en:
navigation:
login: 'Login'
logout: 'Logout'
signup: 'Signup'
dashboard: 'Dashboard'

sessions:
Expand Down Expand Up @@ -36,20 +37,30 @@ en:
anthills: 'anthills'
events: 'events'
communication: 'communication'
anthill:
soldiers: '{{count}} soldiers'
workers: '{{count}} workers'
anthills:
new:
page_title: 'Create a new anthill'
submit: 'Create my anthill'
form:
details: 'Details on your new anthill'
name: 'Name (e.g. Southwestern Union Anthill)'
maps: 'Maps (only those still accepting new players are shown)'
show:
page_title: 'Anthill "{{name}}" by {{user}}'
queen: 'Queen'
queen_missing: "You don't have a queen yet in your anthill."
plant_queen: 'Plant a new queen in your anthill'
ants:
new:
page_title: 'Plant a new {{name}}'
submit: 'Plant {{name}}'
maps:
index:
stats: '{{anthills_count}} of {{max_anthills}}'
states:
open: 'open for all'
active: 'active'
inactive: 'inactive'
3 changes: 2 additions & 1 deletion public/stylesheets/sass/forms.sass
Expand Up @@ -11,8 +11,9 @@ label
.checkbox label
display: inline

input[type=text], input[type=password]
input[type=text], input[type=password], input[type=submit]
:font-size 1.4em
:background-color = !color_title_background + #050505

input:focus, input:active
:background-color = !color_title_background

0 comments on commit ec8fc71

Please sign in to comment.