guara 0.0.1.rc
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +23 -0
- data/.rspec +2 -0
- data/.travis.yml +33 -0
- data/Gemfile +82 -0
- data/Gemfile.lock +323 -0
- data/Guardfile +32 -0
- data/MIT-LICENSE +20 -0
- data/README.md +8 -0
- data/Rakefile +7 -0
- data/app/admin/business_activities.rb +3 -0
- data/app/admin/business_departments.rb +3 -0
- data/app/admin/business_segments.rb +13 -0
- data/app/admin/cities.rb +3 -0
- data/app/admin/company_businesses.rb +3 -0
- data/app/admin/dashboard.rb +39 -0
- data/app/admin/districts.rb +3 -0
- data/app/admin/states.rb +3 -0
- data/app/admin/task_types.rb +3 -0
- data/app/admin/user_groups.rb +3 -0
- data/app/admin/users.rb +3 -0
- data/app/assets/images/close.gif +0 -0
- data/app/assets/images/custom/logo.png +0 -0
- data/app/assets/images/custom/nav_logo.png +0 -0
- data/app/assets/images/custom/nav_logo.psd +0 -0
- data/app/assets/images/rails.png +0 -0
- data/app/assets/javascripts/active_admin.js +5 -0
- data/app/assets/javascripts/application.js +97 -0
- data/app/assets/javascripts/business_departments.js.coffee +3 -0
- data/app/assets/javascripts/company_businesses.js.coffee +3 -0
- data/app/assets/javascripts/crm.js.coffee +14 -0
- data/app/assets/javascripts/fcbk.js +556 -0
- data/app/assets/javascripts/jquery-ui-timepicker-addon.js +1326 -0
- data/app/assets/javascripts/jquery.mask.1.3.js +7 -0
- data/app/assets/javascripts/jquery.multiselect.filter.xjs +173 -0
- data/app/assets/javascripts/jquery.multiselect.xjs +668 -0
- data/app/assets/javascripts/system_task_status.js.coffee +3 -0
- data/app/assets/javascripts/tests/ajaxes.js.coffee +3 -0
- data/app/assets/stylesheets/abilities.css.scss +6 -0
- data/app/assets/stylesheets/active_admin.css.scss +65 -0
- data/app/assets/stylesheets/application.css +19 -0
- data/app/assets/stylesheets/business_departments.css.scss +3 -0
- data/app/assets/stylesheets/company_businesses.css.scss +3 -0
- data/app/assets/stylesheets/custom.css.scss +322 -0
- data/app/assets/stylesheets/customer.scss +7 -0
- data/app/assets/stylesheets/fcbk.css +165 -0
- data/app/assets/stylesheets/guara.css.scss +159 -0
- data/app/assets/stylesheets/jquery-ui.css +567 -0
- data/app/assets/stylesheets/jquery_bootstrap.css.scss +92 -0
- data/app/assets/stylesheets/jquery_multiselect_filter.xcss +3 -0
- data/app/assets/stylesheets/scaffolds.css.scss +42 -0
- data/app/assets/stylesheets/users.css.scss +10 -0
- data/app/controllers/abilities_controller.rb +37 -0
- data/app/controllers/application_controller.rb +12 -0
- data/app/controllers/business_activities_controller.rb +87 -0
- data/app/controllers/business_departments_controller.rb +90 -0
- data/app/controllers/business_segments_controller.rb +88 -0
- data/app/controllers/company_businesses_controller.rb +46 -0
- data/app/controllers/contacts_controller.rb +105 -0
- data/app/controllers/customers_controller.rb +117 -0
- data/app/controllers/microposts_controller.rb +31 -0
- data/app/controllers/sessions_controller.rb +32 -0
- data/app/controllers/static_pages_controller.rb +23 -0
- data/app/controllers/system_task_status_controller.rb +84 -0
- data/app/controllers/task_feedbacks_controller.rb +6 -0
- data/app/controllers/task_types_controller.rb +85 -0
- data/app/controllers/tasks_controller.rb +107 -0
- data/app/controllers/tests/ajaxes_controller.rb +115 -0
- data/app/controllers/tests/lab_ajax_controller.rb +27 -0
- data/app/controllers/users_controller.rb +62 -0
- data/app/helpers/ability_helper.rb +15 -0
- data/app/helpers/application_helper.rb +32 -0
- data/app/helpers/business_activities_helper.rb +2 -0
- data/app/helpers/business_departments_helper.rb +2 -0
- data/app/helpers/business_segments_helper.rb +2 -0
- data/app/helpers/company_businesses_helper.rb +2 -0
- data/app/helpers/contacts_helper.rb +2 -0
- data/app/helpers/customers_helper.rb +23 -0
- data/app/helpers/email_helper.rb +8 -0
- data/app/helpers/form_ajax_helper.rb +8 -0
- data/app/helpers/guara_views_helper.rb +38 -0
- data/app/helpers/locale_helper.rb +24 -0
- data/app/helpers/menu_helper.rb +55 -0
- data/app/helpers/sessions_helper.rb +56 -0
- data/app/helpers/tasks_helper.rb +20 -0
- data/app/helpers/tests/ajaxes_helper.rb +2 -0
- data/app/helpers/user_abilities_helper.rb +12 -0
- data/app/helpers/users_helper.rb +29 -0
- data/app/mailers/.gitkeep +0 -0
- data/app/models/.gitkeep +0 -0
- data/app/models/ability.rb +52 -0
- data/app/models/address.rb +7 -0
- data/app/models/business_activity.rb +5 -0
- data/app/models/business_department.rb +3 -0
- data/app/models/business_segment.rb +5 -0
- data/app/models/city.rb +7 -0
- data/app/models/company_business.rb +6 -0
- data/app/models/contact.rb +69 -0
- data/app/models/customer.rb +117 -0
- data/app/models/customer_activity.rb +9 -0
- data/app/models/customer_financial.rb +10 -0
- data/app/models/customer_has_customers.rb +7 -0
- data/app/models/customer_pf.rb +13 -0
- data/app/models/customer_pj.rb +71 -0
- data/app/models/customer_pj_has_customers_pj.rb +7 -0
- data/app/models/customer_product.rb +3 -0
- data/app/models/customer_segment.rb +9 -0
- data/app/models/district.rb +6 -0
- data/app/models/email.rb +7 -0
- data/app/models/micropost.rb +10 -0
- data/app/models/relationship.rb +9 -0
- data/app/models/search.rb +17 -0
- data/app/models/state.rb +3 -0
- data/app/models/system_ability.rb +16 -0
- data/app/models/system_module.rb +16 -0
- data/app/models/system_task_resolution.rb +26 -0
- data/app/models/system_task_status.rb +19 -0
- data/app/models/task.rb +76 -0
- data/app/models/task_feedback.rb +11 -0
- data/app/models/task_type.rb +12 -0
- data/app/models/tests.rb +5 -0
- data/app/models/tests/ajax.rb +3 -0
- data/app/models/user.rb +126 -0
- data/app/models/user_ability.rb +23 -0
- data/app/models/user_group.rb +9 -0
- data/app/models/user_type.rb +9 -0
- data/app/models/users_has_groups.rb +9 -0
- data/app/validators/customer_cnpj_validator.rb +14 -0
- data/app/validators/email_validator.rb +21 -0
- data/app/views/abilities/index.html.erb +25 -0
- data/app/views/active_extend/_one_to_many_inputs.html.erb +7 -0
- data/app/views/active_extend/_one_to_many_inputs_fields.html.erb +10 -0
- data/app/views/active_extend/_one_to_many_inputs_with_glyph.html.erb +21 -0
- data/app/views/business_activities/_business_activity.html.erb +0 -0
- data/app/views/business_activities/_form.html.erb +25 -0
- data/app/views/business_activities/edit.html.erb +6 -0
- data/app/views/business_activities/index.html.erb +33 -0
- data/app/views/business_activities/new.html.erb +5 -0
- data/app/views/business_activities/show.html.erb +15 -0
- data/app/views/business_departments/_form.html.erb +10 -0
- data/app/views/business_departments/edit.html.erb +6 -0
- data/app/views/business_departments/index.html.erb +33 -0
- data/app/views/business_departments/new.html.erb +5 -0
- data/app/views/business_departments/show.html.erb +15 -0
- data/app/views/business_segments/_business_segment.html.erb +8 -0
- data/app/views/business_segments/_form.html.erb +25 -0
- data/app/views/business_segments/edit.html.erb +6 -0
- data/app/views/business_segments/index.html.erb +33 -0
- data/app/views/business_segments/new.html.erb +5 -0
- data/app/views/business_segments/show.html.erb +15 -0
- data/app/views/company_businesses/_form.html.erb +10 -0
- data/app/views/company_businesses/edit.html.erb +6 -0
- data/app/views/company_businesses/index.html.erb +25 -0
- data/app/views/company_businesses/new.html.erb +5 -0
- data/app/views/company_businesses/show.html.erb +15 -0
- data/app/views/contacts/_form.html.erb +53 -0
- data/app/views/contacts/_header.html.erb +3 -0
- data/app/views/contacts/_list.html.erb +46 -0
- data/app/views/contacts/_side_panel.html.erb +61 -0
- data/app/views/contacts/edit.html.erb +6 -0
- data/app/views/contacts/index.html.erb +72 -0
- data/app/views/contacts/new.html.erb +5 -0
- data/app/views/contacts/show.html.erb +52 -0
- data/app/views/customers/_businesses_done.html.erb +18 -0
- data/app/views/customers/_customer_segment.html.erb +9 -0
- data/app/views/customers/_form.html.erb +177 -0
- data/app/views/customers/_form_search.html.erb +119 -0
- data/app/views/customers/_modules.html.erb +6 -0
- data/app/views/customers/_navbar.html.erb +23 -0
- data/app/views/customers/_segment.html.erb +10 -0
- data/app/views/customers/edit.html.erb +8 -0
- data/app/views/customers/index.html.erb +46 -0
- data/app/views/customers/new.pj.html.erb +4 -0
- data/app/views/customers/show.pj.html.erb +200 -0
- data/app/views/devise/confirmations/new.html.erb +12 -0
- data/app/views/devise/mailer/confirmation_instructions.html.erb +5 -0
- data/app/views/devise/mailer/reset_password_instructions.html.erb +8 -0
- data/app/views/devise/mailer/unlock_instructions.html.erb +7 -0
- data/app/views/devise/passwords/edit.html.erb +16 -0
- data/app/views/devise/passwords/new.html.erb +12 -0
- data/app/views/devise/registrations/edit.html.erb +25 -0
- data/app/views/devise/registrations/new.html.erb +18 -0
- data/app/views/devise/sessions/new.html.erb +24 -0
- data/app/views/devise/shared/_links.erb +25 -0
- data/app/views/devise/unlocks/new.html.erb +12 -0
- data/app/views/emails/_email_fields.html.erb +1 -0
- data/app/views/layouts/_active_admin_footer.html.erb +4 -0
- data/app/views/layouts/_active_admin_header.html.erb +5 -0
- data/app/views/layouts/_footer.html.erb +12 -0
- data/app/views/layouts/_header.html.erb +51 -0
- data/app/views/layouts/_shim.html.erb +3 -0
- data/app/views/layouts/active_admin.html.arb +1 -0
- data/app/views/layouts/application.html.erb +24 -0
- data/app/views/microposts/_micropost.html.erb +11 -0
- data/app/views/sessions/new.html.erb +18 -0
- data/app/views/shared/_calendar.html.erb +17 -0
- data/app/views/shared/_error_messages.html.erb +13 -0
- data/app/views/shared/_feed.html.erb +10 -0
- data/app/views/shared/_feed_item.html.erb +15 -0
- data/app/views/shared/_micropost_form.html.erb +7 -0
- data/app/views/shared/_multi_selection.html.erb +16 -0
- data/app/views/shared/_multi_selection.html_checkbox.erb +11 -0
- data/app/views/shared/_multi_selection_autocomple.html.erb +5 -0
- data/app/views/shared/_notifies.html.erb +17 -0
- data/app/views/shared/_user_info.html.erb +14 -0
- data/app/views/static_pages/about.html.erb +5 -0
- data/app/views/static_pages/contact.html.erb +5 -0
- data/app/views/static_pages/help.html.erb +5 -0
- data/app/views/static_pages/home.html.erb +37 -0
- data/app/views/static_pages/news.html.erb +2 -0
- data/app/views/system_task_status/_form.html.erb +9 -0
- data/app/views/system_task_status/edit.html.erb +6 -0
- data/app/views/system_task_status/index.html.erb +23 -0
- data/app/views/system_task_status/new.html.erb +5 -0
- data/app/views/system_task_status/show.html.erb +10 -0
- data/app/views/task_feedbacks/_list.html.erb +51 -0
- data/app/views/task_feedbacks/_side_form.html.erb +56 -0
- data/app/views/task_feedbacks/_side_panel.html.erb +64 -0
- data/app/views/task_types/_form.html.erb +10 -0
- data/app/views/task_types/edit.html.erb +6 -0
- data/app/views/task_types/index.html.erb +23 -0
- data/app/views/task_types/new.html.erb +5 -0
- data/app/views/task_types/show.html.erb +10 -0
- data/app/views/tasks/_form.html.erb +52 -0
- data/app/views/tasks/_header.html.erb +3 -0
- data/app/views/tasks/_list.html.erb +50 -0
- data/app/views/tasks/_side_panel.html.erb +64 -0
- data/app/views/tasks/create.js.erb +1 -0
- data/app/views/tasks/edit.html.erb +6 -0
- data/app/views/tasks/index.html.erb +61 -0
- data/app/views/tasks/new.html.erb +5 -0
- data/app/views/tasks/show.html.erb +46 -0
- data/app/views/tests/ajaxes/_form.html.erb +10 -0
- data/app/views/tests/ajaxes/_list.html.erb +6 -0
- data/app/views/tests/ajaxes/add_and_update.html.erb +22 -0
- data/app/views/tests/ajaxes/all.js.erb +2 -0
- data/app/views/tests/ajaxes/edit.html.erb +6 -0
- data/app/views/tests/ajaxes/index.html.erb +25 -0
- data/app/views/tests/ajaxes/new.html.erb +5 -0
- data/app/views/tests/ajaxes/show.html.erb +15 -0
- data/app/views/tests/js.js +51 -0
- data/app/views/tests/lab_ajax/multiselection.html.erb +84 -0
- data/app/views/users/_user.html.erb +8 -0
- data/app/views/users/edit.html.erb +27 -0
- data/app/views/users/index.html.erb +9 -0
- data/app/views/users/new.html.erb +24 -0
- data/app/views/users/show.html.erb +26 -0
- data/bundle +0 -0
- data/config.ru +4 -0
- data/config/application.rb +73 -0
- data/config/boot.rb +6 -0
- data/config/database.yml +38 -0
- data/config/environment.rb +31 -0
- data/config/environments/development.rb +42 -0
- data/config/environments/production.rb +68 -0
- data/config/environments/test.rb +39 -0
- data/config/guara/menus.rb +34 -0
- data/config/initializers/active_admin.rb +210 -0
- data/config/initializers/backtrace_silencers.rb +7 -0
- data/config/initializers/cmgb_rules.rb +2 -0
- data/config/initializers/devise.rb +216 -0
- data/config/initializers/formtastic.rb +77 -0
- data/config/initializers/inflections.rb +19 -0
- data/config/initializers/json_paches_utf8.rb +13 -0
- data/config/initializers/kaminari.rb +21 -0
- data/config/initializers/locale.rb +7 -0
- data/config/initializers/meta_search.rb +10 -0
- data/config/initializers/mime_types.rb +5 -0
- data/config/initializers/secret_token.rb +7 -0
- data/config/initializers/session_store.rb +8 -0
- data/config/initializers/string.rb +9 -0
- data/config/initializers/wrap_parameters.rb +14 -0
- data/config/locales/devise.en.yml +57 -0
- data/config/locales/devise.pt-BR.yml +62 -0
- data/config/locales/pt-BR.yml +404 -0
- data/config/routes.rb +129 -0
- data/db/migrate/20120610142404_create_users.rb +10 -0
- data/db/migrate/20120610183820_add_index_to_users_email.rb +5 -0
- data/db/migrate/20120610185217_add_password_digest_to_users.rb +5 -0
- data/db/migrate/20120612000411_add_remember_token_to_users.rb +6 -0
- data/db/migrate/20120616162515_add_admin_to_users.rb +5 -0
- data/db/migrate/20120616215835_create_microposts.rb +11 -0
- data/db/migrate/20120617224530_create_relationships.rb +14 -0
- data/db/migrate/20120621095918_create_customers.rb +36 -0
- data/db/migrate/20120621100528_create_customer_pfs.rb +14 -0
- data/db/migrate/20120621100534_create_customer_pjs.rb +13 -0
- data/db/migrate/20120621100557_create_emails.rb +13 -0
- data/db/migrate/20120621100618_create_tasks.rb +26 -0
- data/db/migrate/20120621100639_create_customer_products.rb +14 -0
- data/db/migrate/20120621100705_create_districts.rb +11 -0
- data/db/migrate/20120621100720_create_cities.rb +11 -0
- data/db/migrate/20120624192444_create_business_segments.rb +10 -0
- data/db/migrate/20120624224245_create_business_activities.rb +13 -0
- data/db/migrate/20120628092744_create_customer_activities.rb +9 -0
- data/db/migrate/20120628092754_create_customer_segments.rb +9 -0
- data/db/migrate/20120703102859_create_states.rb +10 -0
- data/db/migrate/20120705121011_create_contacts.rb +18 -0
- data/db/migrate/20120711233943_add_devise_to_users.rb +56 -0
- data/db/migrate/20120723102847_create_user_abilities.rb +10 -0
- data/db/migrate/20120723104500_create_system_modules.rb +9 -0
- data/db/migrate/20120723104639_create_system_abilities.rb +9 -0
- data/db/migrate/20120728181903_create_user_groups.rb +10 -0
- data/db/migrate/20120729112600_create_users_has_groups.rb +14 -0
- data/db/migrate/20120729121922_add_groups_to_users.rb +6 -0
- data/db/migrate/20120910002835_create_system_task_status.rb +7 -0
- data/db/migrate/20120910010153_create_system_task_resolutions.rb +7 -0
- data/db/migrate/20120911021535_create_task_types.rb +10 -0
- data/db/migrate/20120911070836_create_task_feedbacks.rb +14 -0
- data/db/migrate/20120924022719_create_tests_ajaxes.rb +10 -0
- data/db/migrate/20121007131035_create_business_departments.rb +10 -0
- data/db/migrate/20121013120849_add_notes_and_other_contacts_to_customer.rb +5 -0
- data/db/migrate/20121014201255_create_company_businesses.rb +10 -0
- data/db/migrate/20121014202449_add_company_business_to_task_type.rb +6 -0
- data/db/migrate/20121014212430_add_primary_company_business_to_user.rb +5 -0
- data/db/migrate/20121015101844_add_parent_id_to_system_task_resolution.rb +5 -0
- data/db/migrate/20121026231241_create_customer_has_customers.rb +10 -0
- data/db/migrate/20121026232755_create_customer_pj_has_customers_pjs.rb +10 -0
- data/db/migrate/20121029094047_create_admin_notes.rb +17 -0
- data/db/migrate/20121029094048_move_admin_notes_to_comments.rb +25 -0
- data/db/migrate/20121103183646_add_enabled_to_cities.rb +5 -0
- data/db/migrate/20121104135014_create_customer_financials.rb +17 -0
- data/db/migrate/20121104141751_create_addresses.rb +19 -0
- data/db/migrate/20121205150619_add_type_id_to_users.rb +5 -0
- data/db/schema.rb~ +378 -0
- data/db/seeds.rb +99 -0
- data/gemfiles/Gemfile.rails.3.2.x +82 -0
- data/guara.gemspec +31 -0
- data/lib/active_extend/README.md +19 -0
- data/lib/active_extend/active_disablable.rb +59 -0
- data/lib/active_extend/string_helper.rb +9 -0
- data/lib/active_migration.rb +4 -0
- data/lib/active_migration/converters/rtf_to_html.rb +123 -0
- data/lib/active_migration/dictionary.rb +19 -0
- data/lib/active_migration/migration.rb +211 -0
- data/lib/active_migration/schemas.rb +143 -0
- data/lib/active_migration/spelling_fix.rb +20 -0
- data/lib/active_migration/transformer/grouped_field_fixed_spelling.rb +110 -0
- data/lib/assets/.gitkeep +0 -0
- data/lib/cmgb_rules/app/models/task.rb +19 -0
- data/lib/guara/version.rb +3 -0
- data/lib/spec/asserts/sheet1.xls +0 -0
- data/lib/spec/lib/active_migration_schemas_spec.rb +40 -0
- data/lib/spec/lib/active_migration_spec.rb +78 -0
- data/lib/spec/spec_helper.rb +121 -0
- data/lib/spec/support/active_migration_helper.rb +109 -0
- data/lib/spec/support/utilities.rb +7 -0
- data/lib/tasks/.gitkeep +0 -0
- data/lib/tasks/add_privilegies.rake +6 -0
- data/lib/tasks/external_migration.rake +22 -0
- data/lib/tasks/sample_data.rake +77 -0
- data/lib/tasks/smaple_data_test.rake +13 -0
- data/lib/templates/erb/scaffold/_form.html.erb +11 -0
- data/public/404.html +26 -0
- data/public/422.html +26 -0
- data/public/500.html +25 -0
- data/public/data.txt +1 -0
- data/public/favicon.ico +0 -0
- data/public/javascripts/autocomplete-rails.js +16 -0
- data/public/robots.txt +5 -0
- data/script/create_db +5 -0
- data/script/rails +6 -0
- data/script/recreate_db +5 -0
- data/script/recreate_db.bat +9 -0
- data/script/recreate_db_test +5 -0
- data/script/recreate_development_db +10 -0
- data/spec/controllers/business_activities_controller_spec.disabled +167 -0
- data/spec/controllers/business_departments_controller_spec.disabled +164 -0
- data/spec/controllers/business_segments_controller_spec.disabled +165 -0
- data/spec/controllers/company_businesses_controller_spec.disabled +164 -0
- data/spec/controllers/system_task_status_controller_spec.disabled +164 -0
- data/spec/controllers/system_task_status_spec.disabled +11 -0
- data/spec/controllers/task_types_controller_spec.disabled +164 -0
- data/spec/controllers/tasks_controller_spec.disabled +23 -0
- data/spec/controllers/tests/ajaxes_controller_spec.disabled +164 -0
- data/spec/factories.rb +101 -0
- data/spec/factories/addresses.rb +13 -0
- data/spec/factories/business_departments.rb +8 -0
- data/spec/factories/company_businesses.rb +8 -0
- data/spec/factories/customer_financials.rb +11 -0
- data/spec/factories/customer_has_customers.rb +8 -0
- data/spec/factories/customer_pj_has_customers_pjs.rb +8 -0
- data/spec/factories/system_task_resolutions.rb +7 -0
- data/spec/factories/system_task_status.rb +7 -0
- data/spec/factories/task.rb +17 -0
- data/spec/factories/task_feedbacks.rb +19 -0
- data/spec/factories/task_types.rb +8 -0
- data/spec/factories/tests_ajaxes.rb +8 -0
- data/spec/helpers/business_activities_helper_spec.rb +15 -0
- data/spec/helpers/business_departments_helper_spec.rb +15 -0
- data/spec/helpers/business_segments_helper_spec.rb +15 -0
- data/spec/helpers/company_businesses_helper_spec.rb +15 -0
- data/spec/helpers/customers/contacts_helper_spec.rb +15 -0
- data/spec/helpers/menu_helper_spec.rb +25 -0
- data/spec/helpers/tests/ajaxes_helper_spec.rb +15 -0
- data/spec/helpers/users_helpers_spec.rb +32 -0
- data/spec/models/address_spec.rb +5 -0
- data/spec/models/business_activity_spec.rb +5 -0
- data/spec/models/business_department_spec.rb +5 -0
- data/spec/models/business_segment_spec.rb +5 -0
- data/spec/models/city_spec.rb +5 -0
- data/spec/models/company_business_spec.rb +19 -0
- data/spec/models/contact_spec.rb +60 -0
- data/spec/models/customer_activity_spec.rb +5 -0
- data/spec/models/customer_financial_spec.rb +48 -0
- data/spec/models/customer_has_customers_spec.rb +18 -0
- data/spec/models/customer_pf_spec.rb +24 -0
- data/spec/models/customer_pj_has_customers_pj_spec.rb +34 -0
- data/spec/models/customer_pj_spec.rb +72 -0
- data/spec/models/customer_product_spec.rb +5 -0
- data/spec/models/customer_segment_spec.rb +5 -0
- data/spec/models/customer_spec.rb +135 -0
- data/spec/models/district_spec.rb +5 -0
- data/spec/models/emails_spec.rb +24 -0
- data/spec/models/micropost_spec.rb +49 -0
- data/spec/models/relationship_spec.rb +38 -0
- data/spec/models/state_spec.rb +5 -0
- data/spec/models/system_ability_spec.rb +5 -0
- data/spec/models/system_module_spec.rb +5 -0
- data/spec/models/system_task_resolution_spec.rb +17 -0
- data/spec/models/system_task_status_spec.rb +17 -0
- data/spec/models/task_feedback_spec.rb +46 -0
- data/spec/models/task_spec.rb +176 -0
- data/spec/models/task_type_spec.rb +27 -0
- data/spec/models/tests/ajax_spec.rb +5 -0
- data/spec/models/user_ability_spec.rb +35 -0
- data/spec/models/user_group_spec.rb +26 -0
- data/spec/models/user_spec.rb +274 -0
- data/spec/models/users_has_groups_spec.rb +29 -0
- data/spec/requests/authentication_pages_spec.rb +157 -0
- data/spec/requests/business_activities_spec.rb +7 -0
- data/spec/requests/business_departments_spec.rb +7 -0
- data/spec/requests/business_segments_spec.rb +7 -0
- data/spec/requests/company_businesses_spec.rb +11 -0
- data/spec/requests/customer_contacts_pages_spec.rb +96 -0
- data/spec/requests/customer_pages_spec.rb +60 -0
- data/spec/requests/micropost_pages_spec.rb +58 -0
- data/spec/requests/static_pages_spec.rb +57 -0
- data/spec/requests/task_pages_spec.rb +124 -0
- data/spec/requests/tests/tests_ajaxes_spec.rb +11 -0
- data/spec/requests/user_abilities_pages_spec.rb +73 -0
- data/spec/requests/user_pages_spec.rb +116 -0
- data/spec/routing/business_activities_routing_spec.rb +35 -0
- data/spec/routing/business_departments_routing_spec.rb +35 -0
- data/spec/routing/business_segments_routing_spec.rb +35 -0
- data/spec/routing/company_businesses_routing_spec.rb +35 -0
- data/spec/routing/system_task_status_routing_spec.rb +35 -0
- data/spec/routing/task_types_routing_spec.rb +35 -0
- data/spec/routing/tests/ajaxes_routing_spec.rb +35 -0
- data/spec/spec_helper.rb +123 -0
- data/spec/support/custom_matchers.rb +9 -0
- data/spec/support/utilities.rb +120 -0
- data/spec/views/business_departments/edit.html.erb_spec.rb +20 -0
- data/spec/views/business_departments/index.html.erb_spec.disabled +23 -0
- data/spec/views/business_departments/new.html.erb_spec.rb +20 -0
- data/spec/views/business_departments/show.html.erb_spec.rb +17 -0
- data/spec/views/company_businesses/edit.html.erb_spec.rb +20 -0
- data/spec/views/company_businesses/index.html.erb_spec.rb +23 -0
- data/spec/views/company_businesses/new.html.erb_spec.rb +20 -0
- data/spec/views/company_businesses/show.html.erb_spec.rb +17 -0
- data/spec/views/task_types/edit.html.erb_spec.rb +18 -0
- data/spec/views/task_types/index.html.erb_spec.rb +20 -0
- data/spec/views/task_types/new.html.erb_spec.rb +18 -0
- data/spec/views/task_types/show.html.erb_spec.rb +15 -0
- data/test/fixtures/.gitkeep +0 -0
- data/test/functional/.gitkeep +0 -0
- data/test/integration/.gitkeep +0 -0
- data/test/performance/browsing_test.rb +12 -0
- data/test/test_helper.rb +13 -0
- data/test/unit/.gitkeep +0 -0
- data/vendor/assets/javascripts/.gitkeep +0 -0
- data/vendor/assets/stylesheets/.gitkeep +0 -0
- data/vendor/assets/stylesheets/active_admin/_base.css.scss +45 -0
- data/vendor/assets/stylesheets/active_admin/_forms.css.scss +270 -0
- data/vendor/assets/stylesheets/active_admin/_header.css.scss +137 -0
- data/vendor/assets/stylesheets/active_admin/_mixins.css.scss +1 -0
- data/vendor/assets/stylesheets/active_admin/_typography.css.scss +100 -0
- data/vendor/assets/stylesheets/active_admin/components/_batch_actions.css.scss +11 -0
- data/vendor/assets/stylesheets/active_admin/components/_blank_slates.scss +31 -0
- data/vendor/assets/stylesheets/active_admin/components/_breadcrumbs.scss +20 -0
- data/vendor/assets/stylesheets/active_admin/components/_buttons.scss +11 -0
- data/vendor/assets/stylesheets/active_admin/components/_columns.scss +3 -0
- data/vendor/assets/stylesheets/active_admin/components/_comments.css.scss +40 -0
- data/vendor/assets/stylesheets/active_admin/components/_date_picker.css.scss +123 -0
- data/vendor/assets/stylesheets/active_admin/components/_dropdown_menu.scss +151 -0
- data/vendor/assets/stylesheets/active_admin/components/_flash_messages.css.scss +39 -0
- data/vendor/assets/stylesheets/active_admin/components/_grid.scss +9 -0
- data/vendor/assets/stylesheets/active_admin/components/_links.scss +5 -0
- data/vendor/assets/stylesheets/active_admin/components/_pagination.scss +34 -0
- data/vendor/assets/stylesheets/active_admin/components/_panels.scss +6 -0
- data/vendor/assets/stylesheets/active_admin/components/_popovers.css.scss +123 -0
- data/vendor/assets/stylesheets/active_admin/components/_scopes.scss +10 -0
- data/vendor/assets/stylesheets/active_admin/components/_status_tags.scss +12 -0
- data/vendor/assets/stylesheets/active_admin/components/_table_tools.css.scss +94 -0
- data/vendor/assets/stylesheets/active_admin/components/_tables.css.scss +108 -0
- data/vendor/assets/stylesheets/active_admin/mixins/_all.css.scss +11 -0
- data/vendor/assets/stylesheets/active_admin/mixins/_buttons.css.scss +66 -0
- data/vendor/assets/stylesheets/active_admin/mixins/_gradients.css.scss +37 -0
- data/vendor/assets/stylesheets/active_admin/mixins/_icons.css.scss +24 -0
- data/vendor/assets/stylesheets/active_admin/mixins/_reset.css.scss +165 -0
- data/vendor/assets/stylesheets/active_admin/mixins/_rounded.css.scss +43 -0
- data/vendor/assets/stylesheets/active_admin/mixins/_sections.css.scss +36 -0
- data/vendor/assets/stylesheets/active_admin/mixins/_shadows.css.scss +22 -0
- data/vendor/assets/stylesheets/active_admin/mixins/_typography.scss +3 -0
- data/vendor/assets/stylesheets/active_admin/mixins/_utilities.scss +26 -0
- data/vendor/assets/stylesheets/active_admin/mixins/_variables.css.scss +24 -0
- data/vendor/assets/stylesheets/active_admin/pages/_dashboard.scss +5 -0
- data/vendor/assets/stylesheets/active_admin/pages/_logged_out.scss +44 -0
- data/vendor/assets/stylesheets/active_admin/print.css.scss +290 -0
- data/vendor/assets/stylesheets/active_admin/structure/_footer.scss +14 -0
- data/vendor/assets/stylesheets/active_admin/structure/_main_structure.scss +26 -0
- data/vendor/assets/stylesheets/active_admin/structure/_title_bar.scss +44 -0
- data/vendor/plugins/.gitkeep +0 -0
- metadata +731 -0
@@ -0,0 +1,11 @@
|
|
1
|
+
class TaskFeedback < ActiveRecord::Base
|
2
|
+
attr_accessible :date, :notes, :resolution, :resolution_id, :status, :task, :user
|
3
|
+
|
4
|
+
belongs_to :task
|
5
|
+
belongs_to :status, class_name: "SystemTaskStatus"
|
6
|
+
belongs_to :resolution, class_name: "SystemTaskResolution"
|
7
|
+
belongs_to :user
|
8
|
+
|
9
|
+
validates_presence_of :notes, :resolution
|
10
|
+
|
11
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
class TaskType < ActiveRecord::Base
|
2
|
+
attr_accessible :enabled, :name, :company_business, :company_business_id
|
3
|
+
|
4
|
+
include ActiveDisablable
|
5
|
+
|
6
|
+
belongs_to :company_business
|
7
|
+
|
8
|
+
def self.for_business(company_business)
|
9
|
+
where(company_business_id:company_business.id)
|
10
|
+
end
|
11
|
+
|
12
|
+
end
|
data/app/models/tests.rb
ADDED
data/app/models/user.rb
ADDED
@@ -0,0 +1,126 @@
|
|
1
|
+
# == Schema Information
|
2
|
+
#
|
3
|
+
# Table name: users
|
4
|
+
#
|
5
|
+
# id :integer not null, primary key
|
6
|
+
# name :string(25)
|
7
|
+
# email :string(100)
|
8
|
+
# created_at :datetime not null
|
9
|
+
# updated_at :datetime not null
|
10
|
+
#
|
11
|
+
|
12
|
+
class User < ActiveRecord::Base
|
13
|
+
include ActiveDisablable
|
14
|
+
|
15
|
+
#attr_readonly :admin
|
16
|
+
attr_accessible :name, :email, :password, :password_confirmation, :admin, :remember_me, :users_has_groups,
|
17
|
+
:primary_group, :secundary_groups, :primary_company_business, :primary_company_business_id,
|
18
|
+
:type_id
|
19
|
+
|
20
|
+
# Include default devise modules. Others available are:
|
21
|
+
# :token_authenticatable, :confirmable,
|
22
|
+
# :lockable, and :omniauthable, :registerable
|
23
|
+
devise :database_authenticatable,
|
24
|
+
:recoverable, :rememberable, :trackable, :validatable, :timeoutable
|
25
|
+
|
26
|
+
#RELATIONSHIPS<===================================================================
|
27
|
+
before_save { |user| user.email = email.downcase }
|
28
|
+
before_save :create_remember_token
|
29
|
+
|
30
|
+
has_many :microposts, dependent: :destroy
|
31
|
+
has_many :relationships, foreign_key: "follower_id", dependent: :destroy
|
32
|
+
has_many :followed_users, through: :relationships, source: :followed
|
33
|
+
|
34
|
+
has_many :reverse_relationships, foreign_key: "followed_id",
|
35
|
+
class_name: "Relationship",
|
36
|
+
dependent: :destroy
|
37
|
+
has_many :followers, through: :reverse_relationships, source: :follower
|
38
|
+
|
39
|
+
has_many :abilities, class_name: "UserAbility", :as => :skilled
|
40
|
+
|
41
|
+
has_many :tasks
|
42
|
+
|
43
|
+
has_many :assigned_tasks, class_name: "Task", foreign_key: "assigned_id"
|
44
|
+
|
45
|
+
belongs_to :primary_company_business, class_name: "CompanyBusiness"
|
46
|
+
|
47
|
+
#GROUPS<=================
|
48
|
+
belongs_to :primary_group, class_name: "UserGroup", foreign_key: "primary_group_id"
|
49
|
+
has_many :users_has_groups, class_name: "UsersHasGroups"
|
50
|
+
has_many :secundary_groups, through: :users_has_groups, source: :user_group
|
51
|
+
|
52
|
+
#VALIDATIONS<============================================================
|
53
|
+
#BASICS
|
54
|
+
VALID_NAME_REGEX = /\A\w+.*\s.*\z/i
|
55
|
+
VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i
|
56
|
+
|
57
|
+
validates :name, presence: true, length: { maximum: 30 }, format: { with: VALID_NAME_REGEX }, uniqueness: true
|
58
|
+
validates :email, presence: true, format: { with: VALID_EMAIL_REGEX }, uniqueness: { case_sensitive: false } #:email => true
|
59
|
+
|
60
|
+
#PASSWORD
|
61
|
+
validates :password, presence: true, length: { minimum: 6 }, :if => :need_password?
|
62
|
+
validates :password_confirmation, presence: true, :if => :need_password?
|
63
|
+
|
64
|
+
public
|
65
|
+
|
66
|
+
def feed
|
67
|
+
# This is preliminary. See "Following users" for the full implementation.
|
68
|
+
Micropost.where("user_id = ?", id)
|
69
|
+
end
|
70
|
+
|
71
|
+
def following?(other_user)
|
72
|
+
relationships.find_by_followed_id(other_user.id)
|
73
|
+
end
|
74
|
+
|
75
|
+
def follow!(other_user)
|
76
|
+
relationships.create!(followed_id: other_user.id)
|
77
|
+
end
|
78
|
+
|
79
|
+
def unfollow!(other_user)
|
80
|
+
relationships.find_by_followed_id(other_user.id).destroy
|
81
|
+
end
|
82
|
+
|
83
|
+
def groups
|
84
|
+
ret = []
|
85
|
+
ret << self.primary_group if (self.primary_group)
|
86
|
+
ret << self.secundary_groups if (self.secundary_groups)
|
87
|
+
ret.flatten.uniq
|
88
|
+
end
|
89
|
+
|
90
|
+
def all_abilities
|
91
|
+
abilities = []
|
92
|
+
abilities << self.abilities if (self.abilities)
|
93
|
+
abilities << self.groups.collect { |g| g.abilities } if (self.groups)
|
94
|
+
abilities.flatten.flatten.uniq
|
95
|
+
end
|
96
|
+
|
97
|
+
def able?(module_, ability)
|
98
|
+
all_abilities.select { |ab| ab.module.id == module_.id && ab.ability.id == ability.id }.count > 0
|
99
|
+
end
|
100
|
+
|
101
|
+
def define_abilities(modules_and_abilities)
|
102
|
+
self.abilities.each do |u_ability|
|
103
|
+
u_ability.delete
|
104
|
+
end
|
105
|
+
labilities = []
|
106
|
+
|
107
|
+
modules_and_abilities.each do |module_and_ability|
|
108
|
+
labilities << abilities.build(module_and_ability)
|
109
|
+
end
|
110
|
+
|
111
|
+
self.abilities = labilities
|
112
|
+
|
113
|
+
end
|
114
|
+
|
115
|
+
private
|
116
|
+
|
117
|
+
def create_remember_token
|
118
|
+
self.remember_token = SecureRandom.urlsafe_base64
|
119
|
+
end
|
120
|
+
|
121
|
+
def need_password?
|
122
|
+
return self.new_record? || (password.to_s.strip.length != 0) || (password_confirmation.to_s.strip.length != 0)
|
123
|
+
end
|
124
|
+
|
125
|
+
|
126
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
class UserAbility < ActiveRecord::Base
|
2
|
+
attr_accessible :skilled, :ability, :module
|
3
|
+
|
4
|
+
belongs_to :skilled, :polymorphic => true
|
5
|
+
belongs_to :module, class_name: "SystemModule"
|
6
|
+
belongs_to :ability, class_name: "SystemAbility"
|
7
|
+
|
8
|
+
validates :module, presence: true
|
9
|
+
validates :ability, presence: true
|
10
|
+
|
11
|
+
validates_uniqueness_of :ability_id, :scope => [:skilled_id, :module_id]
|
12
|
+
validates_associated :skilled, :module, :ability
|
13
|
+
|
14
|
+
#<=========================================================
|
15
|
+
|
16
|
+
def self.for(skilled, system_module)
|
17
|
+
find_all_by_skilled_id_and_module_id(skilled, system_module).collect { |ua| ua.ability }
|
18
|
+
end
|
19
|
+
|
20
|
+
def garant(skilled, system_module, ability)
|
21
|
+
create!(:skilled => skilled, :module => system_module, :ability => ability)
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
class CustomerCnpjValidator < ActiveModel::EachValidator
|
2
|
+
def validate_each(record, attribute, value)
|
3
|
+
|
4
|
+
if (record.person_type==CustomerPj.to_s)
|
5
|
+
|
6
|
+
#cnpj
|
7
|
+
unless (!record.complete? && ((value == "") || (value == '0'*14) || (Cnpj.new(value).valido?))) ||
|
8
|
+
(Cnpj.new(value).valido?)
|
9
|
+
record.errors[attribute] << (options[:message] || ("%s %s" % [I18n.t("customer_pjs.doc"), I18n.t('errors.messages.invalid')]) )
|
10
|
+
end
|
11
|
+
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'mail'
|
2
|
+
class EmailValidator < ActiveModel::EachValidator
|
3
|
+
def validate_each(record,attribute,value)
|
4
|
+
begin
|
5
|
+
m = Mail::Address.new(value)
|
6
|
+
# We must check that value contains a domain and that value is an email address
|
7
|
+
r = m.domain && m.address == value
|
8
|
+
t = m.__send__(:tree)
|
9
|
+
# We need to dig into treetop
|
10
|
+
# A valid domain must have dot_atom_text elements size > 1
|
11
|
+
# user@localhost is excluded
|
12
|
+
# treetop must respond to domain
|
13
|
+
# We exclude valid email values like <user@localhost.com>
|
14
|
+
# Hence we use m.__send__(tree).domain
|
15
|
+
r &&= (t.domain.dot_atom_text.elements.size > 1)
|
16
|
+
rescue Exception => e
|
17
|
+
r = false
|
18
|
+
end
|
19
|
+
record.errors[attribute] << (options[:message] || "is invalid") unless r
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<% provide(:title, t("users.abilities.title", :user => @user.name )) %>
|
2
|
+
<h1><%=t("users.abilities.title", :user => @user.name ) %></h1>
|
3
|
+
|
4
|
+
|
5
|
+
<%= form_tag user_abilities_path(@user), :method => :post, :class => "well abilities" do %>
|
6
|
+
|
7
|
+
<ul>
|
8
|
+
<% @modules.each do |mdl| %>
|
9
|
+
<li>
|
10
|
+
<h3><%=t("system.modules.%s" % mdl.name.downcase)%></h3>
|
11
|
+
<ul class="inline">
|
12
|
+
<% @abilities.each do |ab| %>
|
13
|
+
<li class="inline">
|
14
|
+
<%= label_tag abilities_name_checkbox(mdl, ab), t("system.abilities.%s" % ab.name) %>
|
15
|
+
<%= check_box_tag abilities_name_checkbox(mdl, ab), ab.id, @user.able?(mdl, ab) %>
|
16
|
+
</li>
|
17
|
+
<% end %>
|
18
|
+
</ul>
|
19
|
+
</li>
|
20
|
+
<% end %>
|
21
|
+
</ul>
|
22
|
+
|
23
|
+
<%= submit_tag t("helpers.forms.update"), class: "btn btn-large btn-primary" %>
|
24
|
+
|
25
|
+
<% end %>
|
@@ -0,0 +1,7 @@
|
|
1
|
+
<%= form.semantic_fields_for target do |builder, i| %>
|
2
|
+
<%= render 'active_extend/one_to_many_inputs_fields', f: builder, inputs: inputs %>
|
3
|
+
<% end %>
|
4
|
+
|
5
|
+
<%= link_to_add_fields "add", form, target do |builder| %>
|
6
|
+
<%= render 'active_extend/one_to_many_inputs_fields', f: builder, inputs: inputs %>
|
7
|
+
<% end %>
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<fieldset>
|
2
|
+
<% inputs.each do |input,options| %>
|
3
|
+
<% if options.include? :glyph %>
|
4
|
+
<div class="controls">
|
5
|
+
<div class="input-prepend">
|
6
|
+
<span class="add-on"><i class="<%= options[:glyph] %>"></i></span>
|
7
|
+
<% end %>
|
8
|
+
|
9
|
+
<%= f.input input, options %>
|
10
|
+
|
11
|
+
<% if options.include? :glyph %>
|
12
|
+
</div>
|
13
|
+
</div>
|
14
|
+
<% end %>
|
15
|
+
<% end %>
|
16
|
+
<%= f.hidden_field :_destroy %>
|
17
|
+
|
18
|
+
<%= link_to '#', class: "remove_fields btn btn-small" do %>
|
19
|
+
<i class="icon-remove"></i>
|
20
|
+
<% end %></span>
|
21
|
+
</fieldset>
|
File without changes
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<%= form_for(@business_activity) do |f| %>
|
2
|
+
<% if @business_activity.errors.any? %>
|
3
|
+
<div id="error_explanation">
|
4
|
+
<h2><%= pluralize(@business_activity.errors.count, "error") %> prohibited this business_activity from being saved:</h2>
|
5
|
+
|
6
|
+
<ul>
|
7
|
+
<% @business_activity.errors.full_messages.each do |msg| %>
|
8
|
+
<li><%= msg %></li>
|
9
|
+
<% end %>
|
10
|
+
</ul>
|
11
|
+
</div>
|
12
|
+
<% end %>
|
13
|
+
|
14
|
+
<div class="field">
|
15
|
+
<%= f.label :name %><br />
|
16
|
+
<%= f.text_field :name %>
|
17
|
+
</div>
|
18
|
+
<div class="field">
|
19
|
+
<%= f.label :enabled %><br />
|
20
|
+
<%= f.check_box :enabled %>
|
21
|
+
</div>
|
22
|
+
<div class="actions">
|
23
|
+
<%= f.submit %>
|
24
|
+
</div>
|
25
|
+
<% end %>
|
@@ -0,0 +1,33 @@
|
|
1
|
+
<h1>Listing business_activities</h1>
|
2
|
+
|
3
|
+
<section id="buttons">
|
4
|
+
<div class="page-header wehll">
|
5
|
+
<%= t("search.results")%>
|
6
|
+
</div>
|
7
|
+
<table class="table table-bordered table-striped">
|
8
|
+
<thead>
|
9
|
+
<tr>
|
10
|
+
<th>Name</th>
|
11
|
+
<th>Disable</th>
|
12
|
+
<th></th>
|
13
|
+
<th></th>
|
14
|
+
<th></th>
|
15
|
+
</tr>
|
16
|
+
</thead>
|
17
|
+
<tbody>
|
18
|
+
<% @business_activities.each do |business_activity| %>
|
19
|
+
<tr>
|
20
|
+
<td><%= business_activity.name %></td>
|
21
|
+
<td><%= business_activity.enabled %></td>
|
22
|
+
<td><%= link_to 'Show', business_activity %></td>
|
23
|
+
<td><%= link_to 'Edit', edit_business_activity_path(business_activity) %></td>
|
24
|
+
<td><%= link_to 'Destroy', business_activity, confirm: 'Are you sure?', method: :delete %></td>
|
25
|
+
</tr>
|
26
|
+
<% end %>
|
27
|
+
</tbody>
|
28
|
+
</table>
|
29
|
+
</section>
|
30
|
+
|
31
|
+
<br />
|
32
|
+
|
33
|
+
<%= link_to 'New Business activity', new_business_activity_path %>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<p id="notice"><%= notice %></p>
|
2
|
+
|
3
|
+
<p>
|
4
|
+
<b>Name:</b>
|
5
|
+
<%= @business_activity.name %>
|
6
|
+
</p>
|
7
|
+
|
8
|
+
<p>
|
9
|
+
<b>Disable:</b>
|
10
|
+
<%= @business_activity.enabled %>
|
11
|
+
</p>
|
12
|
+
|
13
|
+
|
14
|
+
<%= link_to 'Edit', edit_business_activity_path(@business_activity) %> |
|
15
|
+
<%= link_to 'Back', business_activities_path %>
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<%= semantic_form_for @business_department do |f| %>
|
2
|
+
<%= f.inputs do %>
|
3
|
+
<%= f.input :name %>
|
4
|
+
<%= f.input :enabled %>
|
5
|
+
<% end %>
|
6
|
+
|
7
|
+
<%= f.actions do %>
|
8
|
+
<%= f.action :submit, :as => :input, :button_html => {:class => "btn btn-primary"} %>
|
9
|
+
<% end %>
|
10
|
+
<% end %>
|