Skip to content

Commit

Permalink
uns haml, lang pt no lib, holder (proprietario acionista do group)
Browse files Browse the repository at this point in the history
  • Loading branch information
nofxx committed Apr 13, 2009
1 parent 329c370 commit d1ed438
Show file tree
Hide file tree
Showing 46 changed files with 96 additions and 656 deletions.
4 changes: 2 additions & 2 deletions app/models/group.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ class Group < ActiveRecord::Base
has_many :documents, :as => :documentable
has_many :addresses, :as => :addressable
has_many :contacts, :as => :contactable
has_many :group_people
has_many :people, :through => :group_people
has_many :holders
has_many :people, :through => :holders
accepts_nested_attributes_for :documents, :addresses, :contacts, :allow_destroy => true

symbolize :kind, :in => [:filantropic, :comercial]
Expand Down
10 changes: 10 additions & 0 deletions app/models/holder.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
class Holder < ActiveRecord::Base

belongs_to :group
belongs_to :person

def person_text
person.name if person
end

end
5 changes: 4 additions & 1 deletion app/views/groups/_group.html.haml
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
- content_for :head do
= stylesheet_link_tag "jquery/ui.theme"
= javascript_include_tag "jquery/ui.datepicker", "jquery/jquery.template"
= javascript_include_tag "jquery/ui.datepicker", "jquery/jquery.template", "app/group", "jquery/jquery.autocomplete.min"

- semantic_form_for(@group, :html => { :class => "form" }) do |f|
.columns
.column.left
= f.input :name, :input_html => { :size => 40 }
= f.input :official_name, :input_html => { :size => 40 }
- f.inputs :name => "Responsaveis", :id => "holders" do
= f.render_associated_form @group.holders, :new => 2
= f.add_associated_link "+ Novo responsavel", :holders
- f.inputs :name => "Enderecos", :id => "addresses" do
= f.render_associated_form @group.addresses, :partial => "addresses/address"
= f.add_associated_link "+ Novo endereco", :addresses, :partial => "addresses/address"
Expand Down
5 changes: 5 additions & 0 deletions app/views/groups/_holder.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.holder
- f.inputs do
= f.input :person_text, :input_html => { :class => "person_text" }
= f.hidden_field :person_id
= f.remove_link "remove"
7 changes: 7 additions & 0 deletions app/views/professions/_profession.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
- semantic_form_for(@profession, :html => { :class => "form" }) do |f|
= f.input :name, :input_html => { :size => 40 }
= f.input :kind, :as => :select, :collection => Profession.get_kind_values
.navform
= f.submit "Salvar &rarr;", :class => "button"
ou
= link_to 'Cancelar', people_path
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion config/environments/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#config.gem "rspec-rails"
config.gem "nofxx-object_daddy", :lib => "object_daddy"
config.gem "rspec_spinner", :lib => "rspec_spinner"
# config.gem "carlosbrando-remarkable", :lib => "remarkable"
config.gem "carlosbrando-remarkable", :lib => "remarkable"

# Use SQL instead of Active Record's schema dumper when creating the test database.
# This is necessary if your schema can't be completely dumped by the schema dumper,
Expand Down
13 changes: 13 additions & 0 deletions db/migrate/20090412174403_create_holders.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
class CreateHolders < ActiveRecord::Migration
def self.up
create_table :holders do |t|
t.references :group, :person

t.timestamps
end
end

def self.down
drop_table :holders
end
end
2 changes: 1 addition & 1 deletion db/migrate/99999999999999_add_data.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ class AddData < ActiveRecord::Migration
def self.up
Sector.create(:name => "TI")
User.create!(:login => "admin", :password => "admin", :name => "admin", :kind => :admin,
:password_confirmation => "admin", :state => :active, :locale => "pt-BR",
:password_confirmation => "admin", :state => :active, :locale => "pt",
:email => "[email protected]", :time_zone => "Brasilia")

# Load bunch of dumb data in devel mode....
Expand Down
2 changes: 1 addition & 1 deletion lib/locales/pt-BR.yml → lib/locales/pt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ pt-BR:
"false": Feminino
group:
name: Nome Fantasia
official_name: Razao Sociao
official_name: Razao Social
creation: Criada em
kind: Tipo
enums:
Expand Down
8 changes: 8 additions & 0 deletions public/javascripts/app/group.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
$(document).ready(function() {

$(".person_text").autocomplete("/people.json")
.result(function (evt, data, formatted) {
$("#holder_person_id").val(data[1]);
});

});
33 changes: 0 additions & 33 deletions spec/fixtures/ads.yml

This file was deleted.

38 changes: 0 additions & 38 deletions spec/fixtures/animals.yml

This file was deleted.

27 changes: 0 additions & 27 deletions spec/fixtures/areas.yml

This file was deleted.

29 changes: 0 additions & 29 deletions spec/fixtures/bills.yml

This file was deleted.

28 changes: 0 additions & 28 deletions spec/fixtures/calendars.yml

This file was deleted.

22 changes: 0 additions & 22 deletions spec/fixtures/charters.yml

This file was deleted.

35 changes: 0 additions & 35 deletions spec/fixtures/documents.yml

This file was deleted.

31 changes: 0 additions & 31 deletions spec/fixtures/families.yml

This file was deleted.

29 changes: 0 additions & 29 deletions spec/fixtures/groups.yml

This file was deleted.

Loading

0 comments on commit d1ed438

Please sign in to comment.