spree_zaez_brazilian_fields 3.0.0 → 3.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +14 -0
  3. data/.rspec +1 -0
  4. data/.travis.yml +12 -0
  5. data/Gemfile +7 -0
  6. data/Guardfile +90 -0
  7. data/LICENSE +26 -0
  8. data/README.md +98 -0
  9. data/Rakefile +21 -0
  10. data/app/assets/javascripts/spree/backend/app/users/user_account_type.js.coffee +79 -0
  11. data/app/assets/javascripts/spree/backend/spree_zaez_brazilian_fields.js +4 -0
  12. data/app/assets/javascripts/spree/frontend/app/users/user_account_type.js.coffee +102 -0
  13. data/app/assets/javascripts/spree/frontend/spree_zaez_brazilian_fields.js +3 -0
  14. data/app/assets/stylesheets/spree/backend/spree_zaez_brazilian_fields.css +14 -0
  15. data/app/assets/stylesheets/spree/frontend/spree_zaez_brazilian_fields.css +5 -0
  16. data/app/helpers/spree/api/api_helpers_decorator.rb +4 -0
  17. data/app/models/spree/app_configuration_decorator.rb +6 -0
  18. data/app/models/spree/user_decorator.rb +87 -0
  19. data/app/overrides/spree/admin/general_settings/edit/add_sms_permission.html.erb.deface +23 -0
  20. data/app/overrides/spree/shared/_user_form/add_brazilian_fields.html.erb.deface +47 -0
  21. data/app/overrides/spree/shared/_user_form/add_name_to_form.html.erb.deface +4 -0
  22. data/app/overrides/spree/user_registrations/new/add_user_account_constructor.html.erb.deface +5 -0
  23. data/app/overrides/spree/users/edit/add_id_to_form.html.erb.deface +2 -0
  24. data/app/overrides/spree/users/edit/add_user_account_constructor.html.erb.deface +5 -0
  25. data/app/overrides/spree/users/show/add_brazilian_fields.html.erb.deface +20 -0
  26. data/app/views/spree/admin/users/_form.html.erb +139 -0
  27. data/bin/rails +7 -0
  28. data/config/locales/en.yml +20 -0
  29. data/config/locales/pt-br.yml +20 -0
  30. data/config/routes.rb +3 -0
  31. data/db/migrate/20150527162516_add_brazilian_fields_to_spree_users.rb +15 -0
  32. data/lib/generators/spree_zaez_brazilian_fields/install/install_generator.rb +31 -0
  33. data/lib/spree_zaez_brazilian_fields.rb +7 -0
  34. data/lib/spree_zaez_brazilian_fields/engine.rb +20 -0
  35. data/lib/spree_zaez_brazilian_fields/factories.rb +25 -0
  36. data/spec/features/account_spec.rb +31 -0
  37. data/spec/features/admin/general_settings_spec.rb +32 -0
  38. data/spec/features/admin/users_spec.rb +150 -0
  39. data/spec/features/sign_up_spec.rb +94 -0
  40. data/spec/models/spree/app_configuration_decorator_spec.rb +9 -0
  41. data/spec/models/spree/user_decorator_spec.rb +97 -0
  42. data/spec/spec_helper.rb +89 -0
  43. data/spec/support/capybara_login.rb +13 -0
  44. data/spec/support/controller_hacks.rb +34 -0
  45. data/spree_zaez_brazilian_fields.gemspec +38 -0
  46. data/vendor/assets/javascripts/inputmask/inputmask.min.js +10 -0
  47. data/vendor/assets/javascripts/inputmask/jquery.inputmask.min.js +8 -0
  48. data/vendor/assets/javascripts/jquery.validate/jquery.validate.min.js +12 -0
  49. metadata +59 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 238db02688943f6a3b450c6279447cde80d0c54a
4
- data.tar.gz: 2ce38c9eb59b267ed030f187907dda6a6f42d543
3
+ metadata.gz: 114e54fe364e913975de4df6e1787e46c14ff40d
4
+ data.tar.gz: c8cdbc900a4a2167c35499cc0ce939de6a2e4ecf
5
5
  SHA512:
6
- metadata.gz: 083c52163ebcec1033667e581f767adadef5d65c34cc94a29c6b6bc3335af4aef55b6b2f73031f9c066da779359be0209bea1728ab72286945139d438519294f
7
- data.tar.gz: f06b89171f8758137a2b8c6eac092d4733e77237b76c998d88bce7abd13d8c719f7550361b28de044c08a87805034644deac7327e83ff434f7765e578c8c2647
6
+ metadata.gz: 434abc51d516b952a628176f17c56471957e054b8153c6b20cb80f4ee20cec7c05a51cd8095b2ac2cd35b8c333a686a99e6d98fe936b8acdb32e926732027de1
7
+ data.tar.gz: 99137c3fca07f0d4d41af920f5f7b46a7fce533cce0e61d25ce0e25851563eb6db1df513ef11df2e8b1de6ddb87dc884d07b1893c08eb13529995f7176216e3d
@@ -0,0 +1,14 @@
1
+ \#*
2
+ *~
3
+ .#*
4
+ .DS_Store
5
+ .idea
6
+ .project
7
+ .sass-cache
8
+ coverage
9
+ Gemfile.lock
10
+ tmp
11
+ nbproject
12
+ pkg
13
+ *.swp
14
+ spec/dummy
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --format documentation --color
@@ -0,0 +1,12 @@
1
+ before_script:
2
+ - sh -e /etc/init.d/xvfb start
3
+ - export DISPLAY=:99.0
4
+ bundler_args: --quiet
5
+ script:
6
+ - bundle exec rake test_app
7
+ - bundle exec rspec
8
+ language: ruby
9
+ rvm:
10
+ - 2.0.0
11
+ - 2.1.2
12
+ - 2.1.5
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'spree', github: 'spree/spree', branch: '3-0-stable'
4
+ # Provides basic authentication functionality for testing parts of your engine
5
+ gem 'spree_auth_devise', github: 'spree/spree_auth_devise', branch: '3-0-stable'
6
+
7
+ gemspec
@@ -0,0 +1,90 @@
1
+ # A sample Guardfile
2
+ # More info at https://github.com/guard/guard#readme
3
+
4
+ ## Uncomment and set this to only include directories you want to watch
5
+ # directories %w(app lib config test spec feature)
6
+
7
+ ## Uncomment to clear the screen before every task
8
+ # clearing :on
9
+
10
+ ## Guard internally checks for changes in the Guardfile and exits.
11
+ ## If you want Guard to automatically start up again, run guard in a
12
+ ## shell loop, e.g.:
13
+ ##
14
+ ## $ while bundle exec guard; do echo "Restarting Guard..."; done
15
+ ##
16
+ ## Note: if you are using the `directories` clause above and you are not
17
+ ## watching the project directory ('.'), the you will want to move the Guardfile
18
+ ## to a watched dir and symlink it back, e.g.
19
+ #
20
+ # $ mkdir config
21
+ # $ mv Guardfile config/
22
+ # $ ln -s config/Guardfile .
23
+ #
24
+ # and, you'll have to watch "config/Guardfile" instead of "Guardfile"
25
+
26
+ # Note: The cmd option is now required due to the increasing number of ways
27
+ # rspec may be run, below are examples of the most common uses.
28
+ # * bundler: 'bundle exec rspec'
29
+ # * bundler binstubs: 'bin/rspec'
30
+ # * spring: 'bin/rspec' (This will use spring if running and you have
31
+ # installed the spring binstubs per the docs)
32
+ # * zeus: 'zeus rspec' (requires the server to be started separately)
33
+ # * 'just' rspec: 'rspec'
34
+
35
+ guard :shell do
36
+ watch(/^db\/migrate\/.*\.rb/) do |m|
37
+ puts "#{m[0]} Changed"
38
+ `bundle exec rake test_app`
39
+ end
40
+ end
41
+
42
+ guard :bundler do
43
+ watch('Gemfile')
44
+ # Uncomment next line if Gemfile contain `gemspec' command
45
+ watch(/^.+\.gemspec/)
46
+ end
47
+
48
+ guard :rspec, cmd: "bundle exec rspec" do
49
+ require "guard/rspec/dsl"
50
+ dsl = Guard::RSpec::Dsl.new(self)
51
+
52
+ # Feel free to open issues for suggestions and improvements
53
+
54
+ # RSpec files
55
+ rspec = dsl.rspec
56
+ watch(rspec.spec_helper) { rspec.spec_dir }
57
+ watch(rspec.spec_support) { rspec.spec_dir }
58
+ watch(rspec.spec_files)
59
+
60
+ # Ruby files
61
+ ruby = dsl.ruby
62
+ dsl.watch_spec_files_for(ruby.lib_files)
63
+
64
+ # Rails files
65
+ rails = dsl.rails(view_extensions: %w(erb haml slim))
66
+ dsl.watch_spec_files_for(rails.app_files)
67
+ dsl.watch_spec_files_for(rails.views)
68
+
69
+ watch(rails.controllers) do |m|
70
+ [
71
+ rspec.spec.("routing/#{m[1]}_routing"),
72
+ rspec.spec.("controllers/#{m[1]}_controller"),
73
+ rspec.spec.("acceptance/#{m[1]}")
74
+ ]
75
+ end
76
+
77
+ # Rails config changes
78
+ watch(rails.spec_helper) { rspec.spec_dir }
79
+ watch(rails.routes) { "#{rspec.spec_dir}/routing" }
80
+ watch(rails.app_controller) { "#{rspec.spec_dir}/controllers" }
81
+
82
+ # Capybara features specs
83
+ watch(rails.view_dirs) { |m| rspec.spec.("features/#{m[1]}") }
84
+
85
+ # Turnip features and steps
86
+ watch(%r{^spec/acceptance/(.+)\.feature$})
87
+ watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) do |m|
88
+ Dir[File.join("**/#{m[1]}.feature")][0] || "spec/acceptance"
89
+ end
90
+ end
data/LICENSE ADDED
@@ -0,0 +1,26 @@
1
+ Copyright (c) 2015 [name of plugin creator]
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without modification,
5
+ are permitted provided that the following conditions are met:
6
+
7
+ * Redistributions of source code must retain the above copyright notice,
8
+ this list of conditions and the following disclaimer.
9
+ * Redistributions in binary form must reproduce the above copyright notice,
10
+ this list of conditions and the following disclaimer in the documentation
11
+ and/or other materials provided with the distribution.
12
+ * Neither the name Spree nor the names of its contributors may be used to
13
+ endorse or promote products derived from this software without specific
14
+ prior written permission.
15
+
16
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
20
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
21
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
22
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
23
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
24
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
25
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,98 @@
1
+ Spree Brazilian Fields [![Build Status](https://travis-ci.org/zaeznet/spree_zaez_brazilian_fields.svg?branch=master)](https://travis-ci.org/zaeznet/spree_zaez_brazilian_fields)
2
+ ====================
3
+
4
+ This gem add some brazilian fields to user class.
5
+
6
+ For the personal account is added CPF, RG, birth date and gender.
7
+ For the business account is added CNPJ, state registry and contact name.
8
+ For both accounts is added name and permission to send newsletter and SMS.
9
+
10
+ In general settings, it's possible enable/disable if the receive_sms field it should be displayed.
11
+ To set the settings through a config file, you can modify the value like so:
12
+
13
+ ```ruby
14
+ Spree::Config[:sms_permission] = true
15
+ ```
16
+
17
+ Installation
18
+ ------------
19
+
20
+ Add spree_zaez_brazilian_fields to your Gemfile:
21
+
22
+ ```ruby
23
+ gem 'spree_zaez_brazilian_fields', github: 'zaeznet/spree_zaez_brazilian_fields'
24
+ ```
25
+
26
+ Bundle your dependencies and run the installation generator:
27
+
28
+ ```shell
29
+ bundle
30
+ bundle exec rails g spree_zaez_brazilian_fields:install
31
+ ```
32
+
33
+ Override
34
+ ------------
35
+
36
+ ```
37
+ spree/admin/users/_form.html.erb
38
+ ```
39
+
40
+ Deface
41
+ ------------
42
+
43
+ ```
44
+ Backend
45
+ * add_sms_permission => spree/admin/general_settings/edit.hrml.erb
46
+
47
+ Frontend
48
+ * add_brazilian_field -> spree/shared/_user_form.html.erb
49
+ * add_name_to_form -> spree/shared/_user_form.html.erb
50
+ * add_user_account_constructor -> spree/user_registrations/new.html.erb
51
+ * add_id_to_form -> spree/users/edit.html.erb
52
+ * add_user_account_constructor -> spree/users/edit.html.erb
53
+ * add_brazilian_fields -> spree/users/show.html.erb
54
+ ```
55
+
56
+ Testing
57
+ -------
58
+
59
+ First bundle your dependencies, then run `rake`. `rake` will default to building the dummy app if it does not exist, then it will run specs. The dummy app can be regenerated by using `rake test_app`.
60
+
61
+ ```shell
62
+ bundle
63
+ bundle exec rake
64
+ ```
65
+
66
+ When testing your applications integration with this extension you may use it's factories.
67
+ Simply add this require statement to your spec_helper:
68
+
69
+ ```ruby
70
+ require 'spree_zaez_brazilian_fields/factories'
71
+ ```
72
+
73
+ Copyright (c) 2015 Zaez Inovação Digital, released under the New BSD License
74
+
75
+ License
76
+ -------
77
+
78
+ The MIT License (MIT)
79
+
80
+ Copyright (c) 2015 Zaez Inovação Digital
81
+
82
+ Permission is hereby granted, free of charge, to any person obtaining a copy
83
+ of this software and associated documentation files (the "Software"), to deal
84
+ in the Software without restriction, including without limitation the rights
85
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
86
+ copies of the Software, and to permit persons to whom the Software is
87
+ furnished to do so, subject to the following conditions:
88
+
89
+ The above copyright notice and this permission notice shall be included in all
90
+ copies or substantial portions of the Software.
91
+
92
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
93
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
94
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
95
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
96
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
97
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
98
+ SOFTWARE.
@@ -0,0 +1,21 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
3
+
4
+ require 'rspec/core/rake_task'
5
+ require 'spree/testing_support/extension_rake'
6
+
7
+ RSpec::Core::RakeTask.new
8
+
9
+ task :default do
10
+ if Dir["spec/dummy"].empty?
11
+ Rake::Task[:test_app].invoke
12
+ Dir.chdir("../../")
13
+ end
14
+ Rake::Task[:spec].invoke
15
+ end
16
+
17
+ desc 'Generates a dummy app for testing'
18
+ task :test_app do
19
+ ENV['LIB_NAME'] = 'spree_zaez_brazilian_fields'
20
+ Rake::Task['extension:test_app'].invoke
21
+ end
@@ -0,0 +1,79 @@
1
+ #= require_self
2
+ class window.UserAccountType
3
+ afterConstructor: ->
4
+
5
+ beforeConstructor: ->
6
+
7
+ constructor: (defaultExecution = true) ->
8
+ do @beforeConstructor
9
+ do @defaultExecution if defaultExecution
10
+ do @afterConstructor
11
+
12
+ defaultExecution: ->
13
+ # verifica qual esta checado
14
+ if $('#user_account_type_business').is(':checked')
15
+ do @setBusinessType
16
+ else
17
+ do @setPersonalType
18
+ # insere as mascaras dos campos cpf e cnpj
19
+ $('#user_cpf').inputmask("999.999.999-99")
20
+ $('#user_cnpj').inputmask("99.999.999/9999-99")
21
+ # listeners
22
+ $('#user_account_type_business').click => do @setBusinessType
23
+ $('#user_account_type_personal').click => do @setPersonalType
24
+ # gera as validacoes do formulario
25
+ # de acordo com o tipo de pessoa (fisica ou juridica) escolhida
26
+ $("##{@formId()}").validate
27
+ errorClass: 'error-form'
28
+ rules:
29
+ 'user[name]':
30
+ required:true
31
+ 'user[cpf]':
32
+ required:'#user_account_type_personal:checked'
33
+ 'user[rg]':
34
+ required:'#user_account_type_personal:checked'
35
+ 'user[birth_date]':
36
+ required:'#user_account_type_personal:checked'
37
+ 'user[gender]':
38
+ required:'#user_account_type_personal:checked'
39
+ 'user[cnpj]':
40
+ required:'#user_account_type_business:checked'
41
+ 'user[state_registry]':
42
+ required:'#user_account_type_business:checked'
43
+ 'user[contact]':
44
+ required:'#user_account_type_business:checked'
45
+
46
+ # retorna o id do formulario
47
+ # se for criacao, sera 'new_spree_user'
48
+ # se for edicao, sera 'edit_spree_user'
49
+ formId: ->
50
+ # se existir o formulario de edicao
51
+ if $('#edit_user').length != 0
52
+ 'edit_user'
53
+ else
54
+ 'new_user'
55
+
56
+ # modificado o formulario para a insercao/edicao
57
+ # de uma pessoa juridica
58
+ # exibindo seus campos (cnpj, ie e contato)
59
+ # e limpando os campos de uma pessoa fisica
60
+ setBusinessType: ->
61
+ $('#business_account').show()
62
+ $('#personal_account').hide()
63
+ # limpa os campos da pessoa fisica
64
+ $('#user_cpf, #user_rg, #user_birth_date').val('')
65
+ # nao checar o genero
66
+ # modifica o label do nome
67
+ $("[for='user_name']").text(Spree.translations.user_name_business)
68
+
69
+ # modifica o formulario para a insercao/edicao
70
+ # de uma pessoa fisica
71
+ # exibindo seus campos (cpf, rg, data de nascimento e genero)
72
+ # e limpando os campos de uma pessoa juridica
73
+ setPersonalType: ->
74
+ $('#business_account').hide()
75
+ $('#personal_account').show()
76
+ # limpa os campos da pessoa juridica
77
+ $('#user_cnpj, #user_state_registry, #user_contact').val('')
78
+ # modifica o label do nome
79
+ $("[for='user_name']").text(Spree.translations.user_name_personal)
@@ -0,0 +1,4 @@
1
+ //= require ./app/users/user_account_type
2
+ //= require inputmask/inputmask.min.js
3
+ //= require inputmask/jquery.inputmask.min.js
4
+ //= require jquery.validate/jquery.validate.min
@@ -0,0 +1,102 @@
1
+ #= require_self
2
+ class window.UserAccountType
3
+
4
+ # prefixo dos campos
5
+ # variavel utilizada para poder reutilizar a classe tanto na criacao qanto na edicao
6
+ # pois no formulario de criacao
7
+ # os campos recebem o prefixo 'spree_' (exe. 'spree_user_cpf')
8
+ # ja no formulario de edicao nao
9
+ @prefix = 'spree_'
10
+ # traducoes utilizadas na classe
11
+ @translations = {}
12
+
13
+ afterConstructor: ->
14
+
15
+ beforeConstructor: ->
16
+
17
+ constructor: (translations = {}, prefix = 'spree_', defaultExecution = true) ->
18
+ @translations = translations
19
+ @prefix = prefix
20
+ do @beforeConstructor
21
+ do @defaultExecution if defaultExecution
22
+ do @afterConstructor
23
+
24
+ defaultExecution: ->
25
+ if @isEdit()
26
+ if $("##{@prefix}user_account_type_business").is(':checked')
27
+ do @setBusinessType
28
+ else
29
+ do @setPersonalType
30
+ else
31
+ do @setPersonalType
32
+ # insere as mascaras nos campos cpf e cnpj
33
+ $("##{@prefix}user_cpf").inputmask("999.999.999-99")
34
+ $("##{@prefix}user_cnpj").inputmask("99.999.999/9999-99")
35
+ # listeners
36
+ $("##{@prefix}user_account_type_business").click => do @setBusinessType
37
+ $("##{@prefix}user_account_type_personal").click => do @setPersonalType
38
+ # gera as validacoes do formulario
39
+ # de acordo com o tipo de pessoa (fisica ou juridica) escolhida
40
+ $("##{@formId()}").validate
41
+ errorClass: 'error-form'
42
+ rules:
43
+ "#{@prefix}user[name]":
44
+ required:true
45
+ "#{@prefix}user[cpf]":
46
+ required:"##{@prefix}user_account_type_personal:checked"
47
+ "#{@prefix}user[rg]":
48
+ required:"##{@prefix}user_account_type_personal:checked"
49
+ "#{@prefix}user[birth_date]":
50
+ required:"##{@prefix}user_account_type_personal:checked"
51
+ "#{@prefix}user[gender]":
52
+ required:"##{@prefix}user_account_type_personal:checked"
53
+ "#{@prefix}user[cnpj]":
54
+ required:"##{@prefix}user_account_type_business:checked"
55
+ "#{@prefix}user[state_registry]":
56
+ required:"##{@prefix}user_account_type_business:checked"
57
+ "#{@prefix}user[contact]":
58
+ required:"##{@prefix}user_account_type_business:checked"
59
+
60
+ # retorna o id do formulario
61
+ # se for criacao, sera 'new_spree_user'
62
+ # se for edicao, sera 'edit_spree_user'
63
+ formId: ->
64
+ if @isEdit()
65
+ 'edit_spree_user'
66
+ else
67
+ 'new_spree_user'
68
+
69
+ # verifica se o formulario e de edicao
70
+ # verificando a variavel prefix passada na inicializacao da classe
71
+ isEdit: ->
72
+ if @prefix == ''
73
+ true
74
+ else
75
+ false
76
+
77
+ # modificado o formulario para a insercao/edicao
78
+ # de uma pessoa juridica
79
+ # exibindo seus campos (cnpj, ie e contato)
80
+ # e limpando os campos de uma pessoa fisica
81
+ setBusinessType: ->
82
+ $('#business_account').show()
83
+ $('#personal_account').hide()
84
+ # limpa os campos da pessoa fisica
85
+ $("##{@prefix}user_cpf, ##{@prefix}user_rg, ##{@prefix}user_birth_date").val('')
86
+ # limpa o genero
87
+ $('#spree_user_gender_f').prop 'checked', false
88
+ $('#spree_user_gender_m').prop 'checked', false
89
+ # modifica o placeholder do campo nome
90
+ $("##{@prefix}user_name").attr 'placeholder', @translations.user_name_business
91
+
92
+ # modifica o formulario para a insercao/edicao
93
+ # de uma pessoa fisica
94
+ # exibindo seus campos (cpf, rg, data de nascimento e genero)
95
+ # e limpando os campos de uma pessoa juridica
96
+ setPersonalType: ->
97
+ $('#business_account').hide()
98
+ $('#personal_account').show()
99
+ # limpa os campos da pessoa juridica
100
+ $("##{@prefix}user_cnpj, ##{@prefix}user_state_registry, ##{@prefix}user_contact").val('')
101
+ # modifica o placeholder do campo nome
102
+ $("##{@prefix}user_name").attr 'placeholder', @translations.user_name_personal