brisk-bills 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +8 -0
- data/COPYING +674 -0
- data/COPYING.LESSER +165 -0
- data/INSTALL +5 -0
- data/README +22 -0
- data/Rakefile +11 -0
- data/TODO.txt +112 -0
- data/app/controllers/admin/activities_controller.rb +151 -0
- data/app/controllers/admin/activities_controller/adjustment.rb +16 -0
- data/app/controllers/admin/activities_controller/labor.rb +119 -0
- data/app/controllers/admin/activities_controller/labor/slimtimer.rb +28 -0
- data/app/controllers/admin/activities_controller/material.rb +20 -0
- data/app/controllers/admin/activities_controller/proposal.rb +15 -0
- data/app/controllers/admin/activities_with_prices_controller.rb +68 -0
- data/app/controllers/admin/adjustments_controller.rb +22 -0
- data/app/controllers/admin/client_accounting_controller.rb +49 -0
- data/app/controllers/admin/client_financial_transactions_controller.rb +24 -0
- data/app/controllers/admin/client_representatives_controller.rb +31 -0
- data/app/controllers/admin/clients_controller.rb +31 -0
- data/app/controllers/admin/employee_client_labor_rate_controller.rb +30 -0
- data/app/controllers/admin/employees_controller.rb +32 -0
- data/app/controllers/admin/employees_controller/slimtimer.rb +29 -0
- data/app/controllers/admin/invoices_controller.rb +165 -0
- data/app/controllers/admin/labors_controller.rb +103 -0
- data/app/controllers/admin/labors_controller/slimtimer.rb +31 -0
- data/app/controllers/admin/materials_controller.rb +24 -0
- data/app/controllers/admin/payments_controller.rb +75 -0
- data/app/controllers/admin/proposals_controller.rb +22 -0
- data/app/controllers/admin/settings_controller.rb +23 -0
- data/app/controllers/application_controller.rb +22 -0
- data/app/controllers/authentication_controller.rb +131 -0
- data/app/helpers/activity_type_model_helper.rb +194 -0
- data/app/helpers/admin/activities_helper.rb +110 -0
- data/app/helpers/admin/activities_helper/labor_helper.rb +28 -0
- data/app/helpers/admin/activities_helper/proposal_helper.rb +11 -0
- data/app/helpers/admin/activities_helper/slimtimer_helper.rb +13 -0
- data/app/helpers/admin/activities_with_prices_helper.rb +17 -0
- data/app/helpers/admin/activity_tax_controller_helper.rb +48 -0
- data/app/helpers/admin/activity_tax_field_helper.rb +33 -0
- data/app/helpers/admin/activity_type_controller_helper.rb +83 -0
- data/app/helpers/admin/activity_type_field_helper.rb +45 -0
- data/app/helpers/admin/adjustments_helper.rb +5 -0
- data/app/helpers/admin/client_accounting_helper.rb +13 -0
- data/app/helpers/admin/client_financial_transactions_helper.rb +9 -0
- data/app/helpers/admin/client_representatives_helper.rb +26 -0
- data/app/helpers/admin/clients_helper.rb +6 -0
- data/app/helpers/admin/employee_client_labor_rate_helper.rb +77 -0
- data/app/helpers/admin/employees_helper.rb +9 -0
- data/app/helpers/admin/employees_helper/slimtimer_helper.rb +2 -0
- data/app/helpers/admin/has_credential_column_helper.rb +60 -0
- data/app/helpers/admin/invoices_helper.rb +59 -0
- data/app/helpers/admin/is_active_column_helper.rb +46 -0
- data/app/helpers/admin/labors_helper.rb +20 -0
- data/app/helpers/admin/labors_helper/slimtimer_helper.rb +13 -0
- data/app/helpers/admin/materials_helper.rb +5 -0
- data/app/helpers/admin/payments_helper.rb +41 -0
- data/app/helpers/admin/proposals_helper.rb +3 -0
- data/app/helpers/admin/settings_helper.rb +8 -0
- data/app/helpers/admin_layout_helper.rb +91 -0
- data/app/helpers/application_helper.rb +27 -0
- data/app/helpers/authentication_helper.rb +61 -0
- data/app/helpers/extensible_object_helper.rb +28 -0
- data/app/helpers/has_credential_model_helper.rb +39 -0
- data/app/helpers/invoice_pdf_helper.rb +71 -0
- data/app/helpers/is_active_model_helper.rb +40 -0
- data/app/helpers/money_model_helper.rb +21 -0
- data/app/model_views/client_accounting.rb +5 -0
- data/app/model_views/client_financial_transaction.rb +15 -0
- data/app/model_views/invoices_with_total.rb +36 -0
- data/app/models/activity.rb +104 -0
- data/app/models/activity/adjustment.rb +34 -0
- data/app/models/activity/labor.rb +91 -0
- data/app/models/activity/labor/slimtimer.rb +28 -0
- data/app/models/activity/material.rb +16 -0
- data/app/models/activity/proposal.rb +17 -0
- data/app/models/activity_type.rb +2 -0
- data/app/models/client.rb +93 -0
- data/app/models/client_eventlog.rb +5 -0
- data/app/models/client_representative.rb +22 -0
- data/app/models/credential.rb +195 -0
- data/app/models/employee.rb +49 -0
- data/app/models/employee/labor.rb +13 -0
- data/app/models/employee/slimtimer.rb +43 -0
- data/app/models/employee_client_labor_rate.rb +20 -0
- data/app/models/invoice.rb +280 -0
- data/app/models/invoice_payment.rb +8 -0
- data/app/models/notifier.rb +85 -0
- data/app/models/payment.rb +108 -0
- data/app/models/payment_method.rb +7 -0
- data/app/models/setting.rb +39 -0
- data/app/models/slimtimer_task.rb +6 -0
- data/app/models/slimtimer_time_entry.rb +69 -0
- data/app/views/admin/activities/_adjustment_column.rhtml +23 -0
- data/app/views/admin/activities/_form.rhtml +20 -0
- data/app/views/admin/activities/_form_attribute.rhtml +12 -0
- data/app/views/admin/activities/_labor_column.rhtml +17 -0
- data/app/views/admin/activities/_material_column.rhtml +10 -0
- data/app/views/admin/activities/_proposal_column.rhtml +11 -0
- data/app/views/admin/activities_with_prices/move_to_invoice.rhtml +44 -0
- data/app/views/admin/activities_with_prices/move_to_invoice.rjs +9 -0
- data/app/views/admin/invoices/download.rpdf +224 -0
- data/app/views/authentication/email.rjs +9 -0
- data/app/views/authentication/login.rhtml +75 -0
- data/app/views/authentication/login.rjs +14 -0
- data/app/views/authentication/reset_password_via_token.rhtml +16 -0
- data/app/views/authentication/reset_password_via_token.rjs +6 -0
- data/app/views/authentication/sign_in_error.rjs +2 -0
- data/app/views/layouts/_navigation_tree.rhtml +15 -0
- data/app/views/layouts/admin.rhtml +26 -0
- data/app/views/layouts/public.rhtml +18 -0
- data/app/views/notifier/_email_footer.html.rhtml +12 -0
- data/app/views/notifier/_email_footer.plain.rhtml +3 -0
- data/app/views/notifier/_email_header.html.rhtml +53 -0
- data/app/views/notifier/invoice_available.html.rhtml +5 -0
- data/app/views/notifier/invoice_available.plain.rhtml +4 -0
- data/app/views/notifier/reset_password_requested.html.rhtml +15 -0
- data/app/views/notifier/reset_password_requested.plain.rhtml +9 -0
- data/bin/brisk-bills +51 -0
- data/config/boot.rb +164 -0
- data/config/environment.rb +39 -0
- data/config/environments/development.rb +17 -0
- data/config/environments/production.rb +18 -0
- data/config/environments/test.rb +19 -0
- data/config/locale/en.rb +26 -0
- data/config/routes.rb +20 -0
- data/config/secrets.yml +2 -0
- data/db/migrate/001_create_employees.rb +14 -0
- data/db/migrate/002_create_employee_slimtimers.rb +14 -0
- data/db/migrate/003_create_slimtimer_tasks.rb +21 -0
- data/db/migrate/004_create_slimtimer_time_entries.rb +25 -0
- data/db/migrate/005_create_clients.rb +12 -0
- data/db/migrate/006_create_client_representatives.rb +16 -0
- data/db/migrate/007_create_client_eventlogs.rb +13 -0
- data/db/migrate/008_create_activities.rb +17 -0
- data/db/migrate/009_create_activity_labors.rb +16 -0
- data/db/migrate/010_create_employee_client_labor_rates.rb +19 -0
- data/db/migrate/011_create_activity_adjustments.rb +16 -0
- data/db/migrate/012_create_activity_materials.rb +16 -0
- data/db/migrate/013_create_activity_proposals.rb +18 -0
- data/db/migrate/014_create_invoices.rb +16 -0
- data/db/migrate/015_create_payments.rb +18 -0
- data/db/migrate/016_create_payment_methods.rb +18 -0
- data/db/migrate/017_create_invoice_payments.rb +14 -0
- data/db/migrate/018_create_activity_types.rb +37 -0
- data/db/migrate/019_create_settings.rb +45 -0
- data/db/migrate/020_is_active_employees_clients.rb +11 -0
- data/db/migrate/021_create_views_and_indexes.rb +78 -0
- data/db/migrate/022_create_client_financial_transactions.rb +32 -0
- data/db/migrate/023_create_credentials_migrate_representatives.rb +133 -0
- data/db/migrate/024_updates_for_sales_tax.rb +91 -0
- data/db/migrate/025_alter_credentials_for_reset.rb +11 -0
- data/db/migrate/026_create_st_settings.rb +17 -0
- data/db/migrate/027_create_sessions.rb +16 -0
- data/db/migrate/028_money_to_cents.rb +136 -0
- data/db/schema.rb +301 -0
- data/lib/brisk-bills.rb +17 -0
- data/lib/brisk-bills/initializer.rb +100 -0
- data/lib/dti-navigation-menu/lib/dti-navigation-menu.rb +27 -0
- data/lib/generators/generator_base_extension.rb +16 -0
- data/lib/generators/instance/instance_generator.rb +117 -0
- data/lib/generators/instance/templates/databases/mysql.yml +47 -0
- data/lib/generators/instance/templates/instance_boot.rb +166 -0
- data/lib/generators/instance/templates/instance_environment.rb +65 -0
- data/lib/generators/instance/templates/instance_generate +18 -0
- data/lib/generators/instance/templates/instance_rakefile +3 -0
- data/lib/generators/instance/templates/instance_routes.rb +1 -0
- data/lib/tasks/create_last_months_invoices.rake +37 -0
- data/lib/tasks/credential_tasks.rake +47 -0
- data/lib/tasks/first_time_setup.rake +96 -0
- data/lib/tasks/instance.rake +27 -0
- data/lib/tasks/invoice_as_csv.rake +32 -0
- data/lib/tasks/package.rake +120 -0
- data/lib/tasks/slimtimer_import.rake +198 -0
- data/lib/utilities.rb +18 -0
- data/log/.keep +0 -0
- data/public/.htaccess +40 -0
- data/public/404.html +30 -0
- data/public/500.html +30 -0
- data/public/blank.html +33 -0
- data/public/blank_iframe.html +2 -0
- data/public/dispatch.cgi +10 -0
- data/public/dispatch.fcgi +24 -0
- data/public/dispatch.rb +10 -0
- data/public/favicon.ico +0 -0
- data/public/images/active_scaffold/DO_NOT_EDIT +2 -0
- data/public/images/active_scaffold/default/add.gif +0 -0
- data/public/images/active_scaffold/default/arrow_down.gif +0 -0
- data/public/images/active_scaffold/default/arrow_up.gif +0 -0
- data/public/images/active_scaffold/default/close.gif +0 -0
- data/public/images/active_scaffold/default/cross.png +0 -0
- data/public/images/active_scaffold/default/indicator-small.gif +0 -0
- data/public/images/active_scaffold/default/indicator.gif +0 -0
- data/public/images/active_scaffold/default/magnifier.png +0 -0
- data/public/images/background.gif +0 -0
- data/public/images/brisk-bills-logo.gif +0 -0
- data/public/images/calendar_date_select/calendar.gif +0 -0
- data/public/images/dti-logo.gif +0 -0
- data/public/images/dti-logo.jpg +0 -0
- data/public/images/favicon.ico +0 -0
- data/public/images/invoice-background.jpg +0 -0
- data/public/images/login-form-spinner.gif +0 -0
- data/public/images/nav-arrow.gif +0 -0
- data/public/images/notice-error.gif +0 -0
- data/public/images/notice-info.gif +0 -0
- data/public/images/rails.png +0 -0
- data/public/javascripts/active_scaffold/DO_NOT_EDIT +2 -0
- data/public/javascripts/active_scaffold/default/active_scaffold.js +430 -0
- data/public/javascripts/active_scaffold/default/dhtml_history.js +867 -0
- data/public/javascripts/active_scaffold/default/form_enhancements.js +114 -0
- data/public/javascripts/active_scaffold/default/rico_corner.js +370 -0
- data/public/javascripts/application.js +2 -0
- data/public/javascripts/briskbills-quick-helpers.js +9 -0
- data/public/javascripts/builder.js +136 -0
- data/public/javascripts/controls.js +963 -0
- data/public/javascripts/dragdrop.js +973 -0
- data/public/javascripts/effects.js +1128 -0
- data/public/javascripts/modalbox.js +573 -0
- data/public/javascripts/prototype.js +4320 -0
- data/public/javascripts/scriptaculous.js +58 -0
- data/public/javascripts/shadedborder.js +249 -0
- data/public/javascripts/slider.js +275 -0
- data/public/javascripts/sound.js +55 -0
- data/public/javascripts/unittest.js +568 -0
- data/public/robots.txt +1 -0
- data/public/stylesheets/active_scaffold/DO_NOT_EDIT +2 -0
- data/public/stylesheets/active_scaffold/default/stylesheet-ie.css +35 -0
- data/public/stylesheets/active_scaffold/default/stylesheet.css +809 -0
- data/public/stylesheets/admin/global.css +152 -0
- data/public/stylesheets/admin/pages.css +137 -0
- data/public/stylesheets/admin/screen.css +3 -0
- data/public/stylesheets/admin/structure.css +88 -0
- data/public/stylesheets/modalbox.css +95 -0
- data/public/stylesheets/public/global.css +36 -0
- data/public/stylesheets/public/pages.css +105 -0
- data/public/stylesheets/public/screen.css +3 -0
- data/public/stylesheets/public/structure.css +0 -0
- data/public/stylesheets/spinner.gif +0 -0
- data/script/about +3 -0
- data/script/breakpointer +3 -0
- data/script/console +3 -0
- data/script/dbconsole +3 -0
- data/script/destroy +3 -0
- data/script/generate +3 -0
- data/script/performance/benchmarker +3 -0
- data/script/performance/profiler +3 -0
- data/script/performance/request +3 -0
- data/script/plugin +3 -0
- data/script/process/inspector +3 -0
- data/script/process/reaper +3 -0
- data/script/process/spawner +3 -0
- data/script/runner +3 -0
- data/script/server +3 -0
- data/test/fixtures/activities.yml +28 -0
- data/test/fixtures/activity_adjustments.yml +7 -0
- data/test/fixtures/activity_labors.yml +25 -0
- data/test/fixtures/activity_materials.yml +7 -0
- data/test/fixtures/activity_proposals.yml +7 -0
- data/test/fixtures/activity_types.yml +23 -0
- data/test/fixtures/client_eventlogs.yml +5 -0
- data/test/fixtures/client_financial_transactions.yml +7 -0
- data/test/fixtures/client_representatives.yml +56 -0
- data/test/fixtures/clients.yml +172 -0
- data/test/fixtures/credentials.yml +34 -0
- data/test/fixtures/employee_client_labor_rates.yml +365 -0
- data/test/fixtures/employee_slimtimers.yml +19 -0
- data/test/fixtures/employees.yml +22 -0
- data/test/fixtures/invoice_payments.yml +7 -0
- data/test/fixtures/invoices.yml +7 -0
- data/test/fixtures/payment_methods.yml +7 -0
- data/test/fixtures/payments.yml +7 -0
- data/test/fixtures/settings.yml +7 -0
- data/test/fixtures/slimtimer_tasks.yml +5 -0
- data/test/fixtures/slimtimer_time_entries.yml +5 -0
- data/test/functional/admin/activities_controller_test.rb +8 -0
- data/test/functional/admin/adjustments_controller_test.rb +8 -0
- data/test/functional/admin/client_accounting_controller_test.rb +8 -0
- data/test/functional/admin/client_financial_transactions_controller_test.rb +8 -0
- data/test/functional/admin/client_representatives_controller_test.rb +8 -0
- data/test/functional/admin/clients_controller_test.rb +8 -0
- data/test/functional/admin/employee_client_labor_rate_controller_test.rb +8 -0
- data/test/functional/admin/employees/slimtimer_controller_test.rb +8 -0
- data/test/functional/admin/employees_controller_test.rb +8 -0
- data/test/functional/admin/invoices_controller_test.rb +8 -0
- data/test/functional/admin/labors_controller_test.rb +8 -0
- data/test/functional/admin/materials_controller_test.rb +8 -0
- data/test/functional/admin/payments_controller_test.rb +8 -0
- data/test/functional/admin/proposals_controller_test.rb +8 -0
- data/test/functional/admin/settings_controller_test.rb +8 -0
- data/test/functional/authentication_controller_test.rb +8 -0
- data/test/test_helper.rb +30 -0
- data/test/test_unit_factory_helper.rb +154 -0
- data/test/unit/activity/adjustment_test.rb +8 -0
- data/test/unit/activity/labor_test.rb +279 -0
- data/test/unit/activity/material_test.rb +8 -0
- data/test/unit/activity/proposal_test.rb +8 -0
- data/test/unit/activity_test.rb +83 -0
- data/test/unit/activity_type_test.rb +8 -0
- data/test/unit/client_eventlog_test.rb +10 -0
- data/test/unit/client_financial_transaction_test.rb +8 -0
- data/test/unit/client_representative_test.rb +10 -0
- data/test/unit/client_test.rb +24 -0
- data/test/unit/credential_test.rb +217 -0
- data/test/unit/employee/slimtimer_test.rb +10 -0
- data/test/unit/employee_client_labor_rate_test.rb +8 -0
- data/test/unit/employee_test.rb +25 -0
- data/test/unit/invoice_payment_test.rb +8 -0
- data/test/unit/invoice_test.rb +459 -0
- data/test/unit/notifier_test.rb +9 -0
- data/test/unit/payment_method_test.rb +8 -0
- data/test/unit/payment_test.rb +155 -0
- data/test/unit/setting_test.rb +8 -0
- data/test/unit/slimtimer_task_test.rb +10 -0
- data/test/unit/slimtimer_time_entry_test.rb +132 -0
- data/vendor/plugins/InlineAttachment-0.3.0-modified/README +79 -0
- data/vendor/plugins/InlineAttachment-0.3.0-modified/init.rb +2 -0
- data/vendor/plugins/InlineAttachment-0.3.0-modified/lib/inline_attachment.rb +136 -0
- data/vendor/plugins/InlineAttachment-0.3.0-modified/lib/tmail_content_id.rb +40 -0
- data/vendor/plugins/active_scaffold/CHANGELOG +152 -0
- data/vendor/plugins/active_scaffold/MIT-LICENSE +20 -0
- data/vendor/plugins/active_scaffold/README +28 -0
- data/vendor/plugins/active_scaffold/Rakefile +24 -0
- data/vendor/plugins/active_scaffold/environment.rb +17 -0
- data/vendor/plugins/active_scaffold/frontends/default/images/add.gif +0 -0
- data/vendor/plugins/active_scaffold/frontends/default/images/arrow_down.gif +0 -0
- data/vendor/plugins/active_scaffold/frontends/default/images/arrow_up.gif +0 -0
- data/vendor/plugins/active_scaffold/frontends/default/images/close.gif +0 -0
- data/vendor/plugins/active_scaffold/frontends/default/images/cross.png +0 -0
- data/vendor/plugins/active_scaffold/frontends/default/images/indicator-small.gif +0 -0
- data/vendor/plugins/active_scaffold/frontends/default/images/indicator.gif +0 -0
- data/vendor/plugins/active_scaffold/frontends/default/images/magnifier.png +0 -0
- data/vendor/plugins/active_scaffold/frontends/default/javascripts/active_scaffold.js +430 -0
- data/vendor/plugins/active_scaffold/frontends/default/javascripts/dhtml_history.js +867 -0
- data/vendor/plugins/active_scaffold/frontends/default/javascripts/form_enhancements.js +114 -0
- data/vendor/plugins/active_scaffold/frontends/default/javascripts/rico_corner.js +370 -0
- data/vendor/plugins/active_scaffold/frontends/default/stylesheets/stylesheet-ie.css +35 -0
- data/vendor/plugins/active_scaffold/frontends/default/stylesheets/stylesheet.css +809 -0
- data/vendor/plugins/active_scaffold/frontends/default/views/_add_existing_form.html.erb +40 -0
- data/vendor/plugins/active_scaffold/frontends/default/views/_create_form.html.erb +49 -0
- data/vendor/plugins/active_scaffold/frontends/default/views/_create_form_on_list.html.erb +38 -0
- data/vendor/plugins/active_scaffold/frontends/default/views/_field_search.html.erb +45 -0
- data/vendor/plugins/active_scaffold/frontends/default/views/_form.html.erb +18 -0
- data/vendor/plugins/active_scaffold/frontends/default/views/_form_association.html.erb +20 -0
- data/vendor/plugins/active_scaffold/frontends/default/views/_form_association_footer.html.erb +42 -0
- data/vendor/plugins/active_scaffold/frontends/default/views/_form_association_header.html.erb +10 -0
- data/vendor/plugins/active_scaffold/frontends/default/views/_form_association_record.html.erb +27 -0
- data/vendor/plugins/active_scaffold/frontends/default/views/_form_attribute.html.erb +12 -0
- data/vendor/plugins/active_scaffold/frontends/default/views/_form_hidden_attribute.html.erb +1 -0
- data/vendor/plugins/active_scaffold/frontends/default/views/_form_messages.html.erb +5 -0
- data/vendor/plugins/active_scaffold/frontends/default/views/_horizontal_subform.html.erb +21 -0
- data/vendor/plugins/active_scaffold/frontends/default/views/_list.html.erb +37 -0
- data/vendor/plugins/active_scaffold/frontends/default/views/_list_actions.html.erb +13 -0
- data/vendor/plugins/active_scaffold/frontends/default/views/_list_calculations.html.erb +22 -0
- data/vendor/plugins/active_scaffold/frontends/default/views/_list_column_headings.html.erb +32 -0
- data/vendor/plugins/active_scaffold/frontends/default/views/_list_header.html.erb +14 -0
- data/vendor/plugins/active_scaffold/frontends/default/views/_list_inline_adapter.html.erb +9 -0
- data/vendor/plugins/active_scaffold/frontends/default/views/_list_pagination_links.html.erb +30 -0
- data/vendor/plugins/active_scaffold/frontends/default/views/_list_record.html.erb +35 -0
- data/vendor/plugins/active_scaffold/frontends/default/views/_live_search.html.erb +25 -0
- data/vendor/plugins/active_scaffold/frontends/default/views/_messages.html.erb +10 -0
- data/vendor/plugins/active_scaffold/frontends/default/views/_nested.html.erb +44 -0
- data/vendor/plugins/active_scaffold/frontends/default/views/_search.html.erb +21 -0
- data/vendor/plugins/active_scaffold/frontends/default/views/_show.html.erb +8 -0
- data/vendor/plugins/active_scaffold/frontends/default/views/_show_columns.html.erb +11 -0
- data/vendor/plugins/active_scaffold/frontends/default/views/_update_actions.html.erb +9 -0
- data/vendor/plugins/active_scaffold/frontends/default/views/_update_form.html.erb +53 -0
- data/vendor/plugins/active_scaffold/frontends/default/views/add_existing.js.rjs +16 -0
- data/vendor/plugins/active_scaffold/frontends/default/views/add_existing_form.html.erb +5 -0
- data/vendor/plugins/active_scaffold/frontends/default/views/create.html.erb +5 -0
- data/vendor/plugins/active_scaffold/frontends/default/views/delete.html.erb +13 -0
- data/vendor/plugins/active_scaffold/frontends/default/views/destroy.js.rjs +10 -0
- data/vendor/plugins/active_scaffold/frontends/default/views/edit_associated.js.rjs +15 -0
- data/vendor/plugins/active_scaffold/frontends/default/views/field_search.html.erb +5 -0
- data/vendor/plugins/active_scaffold/frontends/default/views/form_messages.js.rjs +1 -0
- data/vendor/plugins/active_scaffold/frontends/default/views/form_messages_on_create.js.rjs +2 -0
- data/vendor/plugins/active_scaffold/frontends/default/views/form_messages_on_update.js.rjs +2 -0
- data/vendor/plugins/active_scaffold/frontends/default/views/list.html.erb +44 -0
- data/vendor/plugins/active_scaffold/frontends/default/views/on_create.js.rjs +25 -0
- data/vendor/plugins/active_scaffold/frontends/default/views/on_update.js.rjs +11 -0
- data/vendor/plugins/active_scaffold/frontends/default/views/search.html.erb +5 -0
- data/vendor/plugins/active_scaffold/frontends/default/views/show.html.erb +5 -0
- data/vendor/plugins/active_scaffold/frontends/default/views/update.html.erb +8 -0
- data/vendor/plugins/active_scaffold/frontends/default/views/update_column.js.rjs +12 -0
- data/vendor/plugins/active_scaffold/init.rb +18 -0
- data/vendor/plugins/active_scaffold/install.rb +40 -0
- data/vendor/plugins/active_scaffold/install_assets.rb +36 -0
- data/vendor/plugins/active_scaffold/lib/active_record_permissions.rb +123 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold.rb +144 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/actions/core.rb +102 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/actions/create.rb +120 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/actions/delete.rb +46 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/actions/field_search.rb +46 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/actions/list.rb +77 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/actions/live_search.rb +46 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/actions/nested.rb +215 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/actions/search.rb +40 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/actions/show.rb +34 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/actions/subform.rb +17 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/actions/update.rb +114 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/attribute_params.rb +185 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/config/base.rb +37 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/config/core.rb +189 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/config/create.rb +43 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/config/delete.rb +25 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/config/field_search.rb +53 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/config/form.rb +49 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/config/list.rb +134 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/config/live_search.rb +52 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/config/nested.rb +31 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/config/search.rb +52 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/config/show.rb +39 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/config/subform.rb +33 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/config/update.rb +32 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/configurable.rb +29 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/constraints.rb +178 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/data_structures/action_columns.rb +97 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/data_structures/action_link.rb +136 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/data_structures/action_links.rb +47 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/data_structures/actions.rb +45 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/data_structures/column.rb +297 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/data_structures/columns.rb +75 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/data_structures/error_message.rb +24 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/data_structures/set.rb +62 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/data_structures/sorting.rb +89 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/finder.rb +234 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/helpers/association_helpers.rb +40 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/helpers/controller_helpers.rb +25 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/helpers/country_helpers.rb +348 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/helpers/form_column_helpers.rb +267 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/helpers/id_helpers.rb +125 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/helpers/list_column_helpers.rb +178 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/helpers/pagination_helpers.rb +37 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/helpers/search_column_helpers.rb +172 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/helpers/show_column_helpers.rb +46 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/helpers/view_helpers.rb +196 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/locale/en.rb +66 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/locale/es.yml +64 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/locale/hu.yml +62 -0
- data/vendor/plugins/active_scaffold/lib/bridges/bridge.rb +52 -0
- data/vendor/plugins/active_scaffold/lib/bridges/calendar_date_select/bridge.rb +11 -0
- data/vendor/plugins/active_scaffold/lib/bridges/calendar_date_select/lib/as_cds_bridge.rb +53 -0
- data/vendor/plugins/active_scaffold/lib/bridges/file_column/bridge.rb +12 -0
- data/vendor/plugins/active_scaffold/lib/bridges/file_column/lib/as_file_column_bridge.rb +49 -0
- data/vendor/plugins/active_scaffold/lib/bridges/file_column/lib/file_column_helpers.rb +51 -0
- data/vendor/plugins/active_scaffold/lib/bridges/file_column/lib/form_ui.rb +32 -0
- data/vendor/plugins/active_scaffold/lib/bridges/file_column/lib/list_ui.rb +26 -0
- data/vendor/plugins/active_scaffold/lib/bridges/file_column/test/functional/file_column_keep_test.rb +43 -0
- data/vendor/plugins/active_scaffold/lib/bridges/file_column/test/mock_model.rb +9 -0
- data/vendor/plugins/active_scaffold/lib/bridges/file_column/test/test_helper.rb +15 -0
- data/vendor/plugins/active_scaffold/lib/dhtml_confirm.rb +54 -0
- data/vendor/plugins/active_scaffold/lib/extensions/action_controller_rendering.rb +20 -0
- data/vendor/plugins/active_scaffold/lib/extensions/action_view_rendering.rb +87 -0
- data/vendor/plugins/active_scaffold/lib/extensions/array.rb +7 -0
- data/vendor/plugins/active_scaffold/lib/extensions/component_response_with_namespacing.rb +17 -0
- data/vendor/plugins/active_scaffold/lib/extensions/generic_view_paths.rb +33 -0
- data/vendor/plugins/active_scaffold/lib/extensions/localize.rb +10 -0
- data/vendor/plugins/active_scaffold/lib/extensions/name_option_for_datetime.rb +12 -0
- data/vendor/plugins/active_scaffold/lib/extensions/nil_id_in_url_params.rb +7 -0
- data/vendor/plugins/active_scaffold/lib/extensions/resources.rb +26 -0
- data/vendor/plugins/active_scaffold/lib/extensions/reverse_associations.rb +56 -0
- data/vendor/plugins/active_scaffold/lib/extensions/to_label.rb +8 -0
- data/vendor/plugins/active_scaffold/lib/extensions/unsaved_associated.rb +61 -0
- data/vendor/plugins/active_scaffold/lib/extensions/unsaved_record.rb +20 -0
- data/vendor/plugins/active_scaffold/lib/extensions/usa_state.rb +46 -0
- data/vendor/plugins/active_scaffold/lib/paginator.rb +136 -0
- data/vendor/plugins/active_scaffold/lib/responds_to_parent.rb +68 -0
- data/vendor/plugins/active_scaffold/public/blank.html +33 -0
- data/vendor/plugins/active_scaffold/test/bridges/bridge_test.rb +47 -0
- data/vendor/plugins/active_scaffold/test/config/create_test.rb +55 -0
- data/vendor/plugins/active_scaffold/test/config/list_test.rb +74 -0
- data/vendor/plugins/active_scaffold/test/config/update_test.rb +17 -0
- data/vendor/plugins/active_scaffold/test/const_mocker.rb +36 -0
- data/vendor/plugins/active_scaffold/test/data_structures/action_columns_test.rb +119 -0
- data/vendor/plugins/active_scaffold/test/data_structures/action_link_test.rb +78 -0
- data/vendor/plugins/active_scaffold/test/data_structures/action_links_test.rb +78 -0
- data/vendor/plugins/active_scaffold/test/data_structures/actions_test.rb +25 -0
- data/vendor/plugins/active_scaffold/test/data_structures/association_column_test.rb +41 -0
- data/vendor/plugins/active_scaffold/test/data_structures/column_test.rb +161 -0
- data/vendor/plugins/active_scaffold/test/data_structures/columns_test.rb +69 -0
- data/vendor/plugins/active_scaffold/test/data_structures/error_message_test.rb +28 -0
- data/vendor/plugins/active_scaffold/test/data_structures/set_test.rb +86 -0
- data/vendor/plugins/active_scaffold/test/data_structures/sorting_test.rb +96 -0
- data/vendor/plugins/active_scaffold/test/data_structures/standard_column_test.rb +34 -0
- data/vendor/plugins/active_scaffold/test/data_structures/virtual_column_test.rb +34 -0
- data/vendor/plugins/active_scaffold/test/extensions/active_record_test.rb +45 -0
- data/vendor/plugins/active_scaffold/test/extensions/array.rb +12 -0
- data/vendor/plugins/active_scaffold/test/misc/active_record_permissions.rb +154 -0
- data/vendor/plugins/active_scaffold/test/misc/configurable_test.rb +96 -0
- data/vendor/plugins/active_scaffold/test/misc/constraints_test.rb +175 -0
- data/vendor/plugins/active_scaffold/test/misc/finder_test.rb +70 -0
- data/vendor/plugins/active_scaffold/test/misc/lang_test.rb +12 -0
- data/vendor/plugins/active_scaffold/test/model_stub.rb +39 -0
- data/vendor/plugins/active_scaffold/test/run_all.rb +8 -0
- data/vendor/plugins/active_scaffold/test/test_helper.rb +13 -0
- data/vendor/plugins/active_scaffold/uninstall.rb +12 -0
- data/vendor/plugins/active_scaffold_as_gem/init.rb +21 -0
- data/vendor/plugins/active_scaffold_form_observation/init.rb +4 -0
- data/vendor/plugins/active_scaffold_form_observation/lib/active_scaffold_form_observation.rb +99 -0
- data/vendor/plugins/active_scaffold_full_refresh/init.rb +7 -0
- data/vendor/plugins/active_scaffold_full_refresh/lib/active_scaffold_full_refresh.rb +46 -0
- data/vendor/plugins/active_scaffold_move_column_under/init.rb +17 -0
- data/vendor/plugins/acts_as_money/README +24 -0
- data/vendor/plugins/acts_as_money/Rakefile +22 -0
- data/vendor/plugins/acts_as_money/init.rb +3 -0
- data/vendor/plugins/acts_as_money/install.rb +1 -0
- data/vendor/plugins/acts_as_money/lib/acts_as_money.rb +27 -0
- data/vendor/plugins/acts_as_money/tasks/money_tasks.rake +4 -0
- data/vendor/plugins/acts_as_money/test/money_test.rb +8 -0
- data/vendor/plugins/association_hacks/init.rb +1 -0
- data/vendor/plugins/association_hacks/lib/association_hacks.rb +27 -0
- data/vendor/plugins/railspdf/CHANGELOG +5 -0
- data/vendor/plugins/railspdf/README +88 -0
- data/vendor/plugins/railspdf/Rakefile +22 -0
- data/vendor/plugins/railspdf/TODO +1 -0
- data/vendor/plugins/railspdf/init.rb +3 -0
- data/vendor/plugins/railspdf/lib/railspdf.rb +65 -0
- data/vendor/plugins/railspdf/test/railspdf_test.rb +14 -0
- data/vendor/plugins/railspdf/test/test_helper.rb +9 -0
- data/vendor/plugins/render_component/README +37 -0
- data/vendor/plugins/render_component/Rakefile +22 -0
- data/vendor/plugins/render_component/init.rb +2 -0
- data/vendor/plugins/render_component/lib/components.rb +142 -0
- data/vendor/plugins/render_component/test/abstract_unit.rb +8 -0
- data/vendor/plugins/render_component/test/components_test.rb +140 -0
- metadata +657 -0
@@ -0,0 +1,11 @@
|
|
1
|
+
ActiveScaffold.bridge "CalendarDateSelect" do
|
2
|
+
install do
|
3
|
+
# check to see if the old bridge was installed. If so, warn them
|
4
|
+
# we can detect this by checking to see if the bridge was installed before calling this code
|
5
|
+
if ActiveScaffold::Config::Core.instance_methods.include?("initialize_with_calendar_date_select")
|
6
|
+
raise RuntimeError, "We've detected that you have active_scaffold_calendar_date_select_bridge installed. This plugin has been moved to core. Please remove active_scaffold_calendar_date_select_bridge to prevent any conflicts"
|
7
|
+
end
|
8
|
+
|
9
|
+
require File.join(File.dirname(__FILE__), "lib/as_cds_bridge.rb")
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
module ActiveScaffold::Config
|
2
|
+
class Core < Base
|
3
|
+
|
4
|
+
def initialize_with_calendar_date_select(model_id)
|
5
|
+
initialize_without_calendar_date_select(model_id)
|
6
|
+
|
7
|
+
calendar_date_select_fields = self.model.columns.collect{|c| c.name.to_sym if [:date, :datetime].include?(c.type) }.compact
|
8
|
+
# check to see if file column was used on the model
|
9
|
+
return if calendar_date_select_fields.empty?
|
10
|
+
|
11
|
+
# automatically set the forum_ui to a file column
|
12
|
+
calendar_date_select_fields.each{|field|
|
13
|
+
self.columns[field].form_ui = :calendar_date_select
|
14
|
+
}
|
15
|
+
end
|
16
|
+
|
17
|
+
alias_method_chain :initialize, :calendar_date_select
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
|
23
|
+
module ActiveScaffold
|
24
|
+
module Helpers
|
25
|
+
# Helpers that assist with the rendering of a Form Column
|
26
|
+
module FormColumnHelpers
|
27
|
+
def active_scaffold_input_calendar_date_select(column, options)
|
28
|
+
options[:class] = "#{options[:class]} text-input".strip
|
29
|
+
calendar_date_select("record", column.name, options.merge(column.options))
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
module ActiveScaffold
|
36
|
+
module Helpers
|
37
|
+
module ViewHelpers
|
38
|
+
|
39
|
+
# Provides stylesheets to include with +stylesheet_link_tag+
|
40
|
+
def active_scaffold_stylesheets_with_calendar_date_select(frontend = :default)
|
41
|
+
active_scaffold_stylesheets_without_calendar_date_select.to_a << calendar_date_select_stylesheets
|
42
|
+
end
|
43
|
+
alias_method_chain :active_scaffold_stylesheets, :calendar_date_select
|
44
|
+
|
45
|
+
# Provides stylesheets to include with +stylesheet_link_tag+
|
46
|
+
def active_scaffold_javascripts_with_calendar_date_select(frontend = :default)
|
47
|
+
active_scaffold_javascripts_without_calendar_date_select.to_a << calendar_date_select_javascripts
|
48
|
+
end
|
49
|
+
alias_method_chain :active_scaffold_javascripts, :calendar_date_select
|
50
|
+
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
ActiveScaffold.bridge "FileColumn" do
|
2
|
+
install do
|
3
|
+
if ActiveScaffold::Config::Core.instance_methods.include?("initialize_with_file_column")
|
4
|
+
raise RuntimeError, "We've detected that you have active_scaffold_file_column_bridge installed. This plugin has been moved to core. Please remove active_scaffold_file_column_bridge to prevent any conflicts"
|
5
|
+
end
|
6
|
+
|
7
|
+
require File.join(File.dirname(__FILE__), "lib/as_file_column_bridge")
|
8
|
+
require File.join(File.dirname(__FILE__), "lib/form_ui")
|
9
|
+
require File.join(File.dirname(__FILE__), "lib/list_ui")
|
10
|
+
require File.join(File.dirname(__FILE__), "lib/file_column_helpers")
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require 'active_scaffold/data_structures/column'
|
2
|
+
module ActiveScaffold::DataStructures
|
3
|
+
class Column
|
4
|
+
attr_accessor :file_column_display
|
5
|
+
end
|
6
|
+
end
|
7
|
+
|
8
|
+
module ActiveScaffold::Config
|
9
|
+
class Core < Base
|
10
|
+
attr_accessor :file_column_fields
|
11
|
+
def initialize_with_file_column(model_id)
|
12
|
+
initialize_without_file_column(model_id)
|
13
|
+
|
14
|
+
return unless FileColumnHelpers.klass_has_file_column_fields?(self.model)
|
15
|
+
|
16
|
+
self.model.send :extend, FileColumnHelpers
|
17
|
+
|
18
|
+
# include the "delete" helpers for use with active scaffold, unless they are already included
|
19
|
+
self.model.generate_delete_helpers
|
20
|
+
|
21
|
+
# switch on multipart
|
22
|
+
self.update.multipart = true
|
23
|
+
self.create.multipart = true
|
24
|
+
|
25
|
+
self.model.file_column_fields.each{ |field|
|
26
|
+
configure_file_column_field(field)
|
27
|
+
}
|
28
|
+
end
|
29
|
+
|
30
|
+
alias_method_chain :initialize, :file_column unless self.instance_methods.include?("initialize_without_file_column")
|
31
|
+
|
32
|
+
def configure_file_column_field(field)
|
33
|
+
# set list_ui first because it gets its default value from form_ui
|
34
|
+
self.columns[field].list_ui ||= self.model.field_has_image_version?(field, "thumb") ? :thumbnail : :download_link_with_filename
|
35
|
+
self.columns[field].form_ui ||= :file_column
|
36
|
+
|
37
|
+
# these 2 parameters are necessary helper attributes for the file column that must be allowed to be set to the model by active scaffold.
|
38
|
+
self.columns[field].params.add "#{field}_temp", "delete_#{field}"
|
39
|
+
|
40
|
+
# set null to false so active_scaffold wont set it to null
|
41
|
+
# delete_file_column will take care of deleting a file or not.
|
42
|
+
self.model.columns_hash[field.to_s].instance_variable_set("@null", false)
|
43
|
+
|
44
|
+
rescue
|
45
|
+
false
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
module FileColumnHelpers
|
2
|
+
class << self
|
3
|
+
def file_column_fields(klass)
|
4
|
+
klass.instance_methods.grep(/_just_uploaded\?$/).collect{|m| m[0..-16].to_sym }
|
5
|
+
end
|
6
|
+
|
7
|
+
def generate_delete_helpers(klass)
|
8
|
+
file_column_fields(klass).each { |field|
|
9
|
+
klass.send :class_eval, <<-EOF, __FILE__, __LINE__ + 1 unless klass.methods.include?("#{field}_with_delete=")
|
10
|
+
attr_reader :delete_#{field}
|
11
|
+
|
12
|
+
def delete_#{field}=(value)
|
13
|
+
value = (value=="true") if String===value
|
14
|
+
return unless value
|
15
|
+
|
16
|
+
# passing nil to the file column causes the file to be deleted. Don't delete if we just uploaded a file!
|
17
|
+
self.#{field} = nil unless self.#{field}_just_uploaded?
|
18
|
+
end
|
19
|
+
EOF
|
20
|
+
}
|
21
|
+
end
|
22
|
+
|
23
|
+
def klass_has_file_column_fields?(klass)
|
24
|
+
true unless file_column_fields(klass).empty?
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def file_column_fields
|
29
|
+
@file_column_fields||=FileColumnHelpers.file_column_fields(self)
|
30
|
+
end
|
31
|
+
|
32
|
+
def options_for_file_column_field(field)
|
33
|
+
self.allocate.send("#{field}_options")
|
34
|
+
end
|
35
|
+
|
36
|
+
def field_has_image_version?(field, version="thumb")
|
37
|
+
begin
|
38
|
+
# the only way to get to the options of a particular field is to use the instance method
|
39
|
+
options = options_for_file_column_field(field)
|
40
|
+
versions = options[:magick][:versions]
|
41
|
+
raise unless versions.stringify_keys[version]
|
42
|
+
true
|
43
|
+
rescue
|
44
|
+
false
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def generate_delete_helpers
|
49
|
+
FileColumnHelpers.generate_delete_helpers(self)
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module ActiveScaffold
|
2
|
+
module Helpers
|
3
|
+
# Helpers that assist with the rendering of a Form Column
|
4
|
+
module FormColumnHelpers
|
5
|
+
def active_scaffold_input_file_column(column, options)
|
6
|
+
if @record.send(column.name)
|
7
|
+
# we already have a value? display the form for deletion.
|
8
|
+
content_tag(
|
9
|
+
:div,
|
10
|
+
content_tag(
|
11
|
+
:div,
|
12
|
+
get_column_value(@record, column) + " " +
|
13
|
+
hidden_field(:record, "delete_#{column.name}", :value => "false") +
|
14
|
+
" | " +
|
15
|
+
link_to_function(as_(:remove_file), "$(this).previous().value='true'; p=$(this).up(); p.hide(); p.next().show();"),
|
16
|
+
{}
|
17
|
+
) +
|
18
|
+
content_tag(
|
19
|
+
:div,
|
20
|
+
file_column_field("record", column.name, options),
|
21
|
+
:style => "display: none"
|
22
|
+
),
|
23
|
+
{}
|
24
|
+
)
|
25
|
+
else
|
26
|
+
# no, just display the file_column_field
|
27
|
+
file_column_field("record", column.name, options)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module ActiveScaffold
|
2
|
+
module Helpers
|
3
|
+
# Helpers that assist with the rendering of a List Column
|
4
|
+
module ListColumnHelpers
|
5
|
+
def active_scaffold_column_download_link_with_filename(column, record)
|
6
|
+
return nil if record.send(column.name).nil?
|
7
|
+
active_scaffold_column_download_link(column, record, File.basename(record.send(column.name)))
|
8
|
+
end
|
9
|
+
|
10
|
+
def active_scaffold_column_download_link(column, record, label = nil)
|
11
|
+
return nil if record.send(column.name).nil?
|
12
|
+
label||=as_(:download)
|
13
|
+
link_to( label, url_for_file_column(record, column.name.to_s), :popup => true)
|
14
|
+
end
|
15
|
+
|
16
|
+
def active_scaffold_column_thumbnail(column, record)
|
17
|
+
return nil if record.send(column.name).nil?
|
18
|
+
link_to(
|
19
|
+
image_tag(url_for_file_column(record, column.name.to_s, "thumb"), :border => 0),
|
20
|
+
url_for_file_column(record, column.name.to_s),
|
21
|
+
:popup => true)
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
data/vendor/plugins/active_scaffold/lib/bridges/file_column/test/functional/file_column_keep_test.rb
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), "../test_helper.rb")
|
2
|
+
|
3
|
+
class DeleteFileColumnTest < Test::Unit::TestCase
|
4
|
+
def setup
|
5
|
+
DeleteFileColumn.generate_delete_helpers(MockModel)
|
6
|
+
@model = MockModel.new
|
7
|
+
@model.band_image = "coolio.jpg"
|
8
|
+
end
|
9
|
+
|
10
|
+
def test__file_column_fields
|
11
|
+
assert_equal(1, @model.file_column_fields.length)
|
12
|
+
end
|
13
|
+
|
14
|
+
def test__delete_band_image__boolean__should_delete
|
15
|
+
@model.delete_band_image = true
|
16
|
+
assert_nil @model.band_image
|
17
|
+
end
|
18
|
+
|
19
|
+
def test__delete_band_image__string__should_delete
|
20
|
+
@model.delete_band_image = "true"
|
21
|
+
assert_nil @model.band_image
|
22
|
+
end
|
23
|
+
|
24
|
+
|
25
|
+
def test__delete_band_image__boolean_false__shouldnt_delete
|
26
|
+
@model.delete_band_image = false
|
27
|
+
assert_not_nil @model.band_image
|
28
|
+
end
|
29
|
+
|
30
|
+
def test__delete_band_image__string_false__shouldnt_delete
|
31
|
+
@model.delete_band_image = "false"
|
32
|
+
assert_not_nil @model.band_image
|
33
|
+
end
|
34
|
+
|
35
|
+
|
36
|
+
def test__just_uploaded__shouldnt_delete
|
37
|
+
@model.band_image_just_uploaded = true
|
38
|
+
@model.delete_band_image = "true"
|
39
|
+
assert_not_nil(@model.band_image)
|
40
|
+
end
|
41
|
+
|
42
|
+
|
43
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require "rubygems"
|
3
|
+
require 'active_support'
|
4
|
+
|
5
|
+
for file in ["../lib/delete_file_column.rb", "mock_model.rb"]
|
6
|
+
require File.expand_path(File.join(File.dirname(__FILE__), file))
|
7
|
+
end
|
8
|
+
|
9
|
+
|
10
|
+
|
11
|
+
def dbg
|
12
|
+
require 'ruby-debug'
|
13
|
+
Debugger.start
|
14
|
+
debugger
|
15
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# Matt Mower <matt@cominded.com>
|
2
|
+
#
|
3
|
+
# A base class for creating DHTML confirmation types.
|
4
|
+
#
|
5
|
+
# The real work is done by the onclick_function and onclick_handler methods. In
|
6
|
+
# general it should only be required to override the default onclick_handler
|
7
|
+
# method and provide the specific Javascript required to invoke the DHTML confirm
|
8
|
+
# dialog of your choice.
|
9
|
+
#
|
10
|
+
# It is up to this dialog, if the user confirms the intended action, to invoke
|
11
|
+
# the function window.gFireModalLink() to trigger the intended action of the link.
|
12
|
+
# For example, using the Modalbox library, you would use something like:
|
13
|
+
#
|
14
|
+
# Modalbox.hide( {
|
15
|
+
# afterHide: function() {
|
16
|
+
# window.gFireModalLink();
|
17
|
+
# } } );
|
18
|
+
#
|
19
|
+
# By default the only action recognized is :value which is used to add a
|
20
|
+
# dhtml_confirm attribute to the link <a> tag. This value is detected by the
|
21
|
+
# ActiveScaffold link and triggers the DHTML confirmation logic.
|
22
|
+
#
|
23
|
+
class DHTMLConfirm
|
24
|
+
attr_accessor :value, :message, :options
|
25
|
+
|
26
|
+
def initialize( options = {} )
|
27
|
+
@options = options
|
28
|
+
@value = @options.delete(:value) { |key| "yes" }
|
29
|
+
@message = @options.delete(:message) { |key| "Are you sure?" }
|
30
|
+
end
|
31
|
+
|
32
|
+
def onclick_function( controller, link_id )
|
33
|
+
script = <<-END
|
34
|
+
window.gFireModalLink = function() {
|
35
|
+
var link = $('#{link_id}').action_link;
|
36
|
+
link.open_action.call( link );
|
37
|
+
};
|
38
|
+
#{ensure_termination(onclick_handler(controller,link_id))}
|
39
|
+
return false;
|
40
|
+
END
|
41
|
+
# script = "window.gModalLink = $('#{link_id}').action_link;#{onclick_handler(controller,link_id)}return false;"
|
42
|
+
end
|
43
|
+
|
44
|
+
def onclick_handler( controller, link_id )
|
45
|
+
""
|
46
|
+
end
|
47
|
+
|
48
|
+
protected
|
49
|
+
def ensure_termination( expression )
|
50
|
+
expression =~ /;$/ ? expression : "#{expression};"
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# wrap the action rendering for ActiveScaffold controllers
|
2
|
+
module ActionController #:nodoc:
|
3
|
+
class Base
|
4
|
+
def render_with_active_scaffold(*args, &block)
|
5
|
+
if self.class.uses_active_scaffold? and params[:adapter] and @rendering_adapter.nil?
|
6
|
+
@rendering_adapter = true # recursion control
|
7
|
+
# if we need an adapter, then we render the actual stuff to a string and insert it into the adapter template
|
8
|
+
render :partial => params[:adapter][1..-1],
|
9
|
+
:locals => {:payload => render_to_string(args.first, &block)},
|
10
|
+
:use_full_path => true, :layout => false
|
11
|
+
@rendering_adapter = nil # recursion control
|
12
|
+
else
|
13
|
+
render_without_active_scaffold(*args, &block)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
alias_method_chain :render, :active_scaffold
|
17
|
+
|
18
|
+
# Rails 2.x implementation is post-initialization on :active_scaffold method
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,87 @@
|
|
1
|
+
# wrap the action rendering for ActiveScaffold views
|
2
|
+
module ActionView #:nodoc:
|
3
|
+
class Base
|
4
|
+
# Adds two rendering options.
|
5
|
+
#
|
6
|
+
# ==render :super
|
7
|
+
#
|
8
|
+
# This syntax skips all template overrides and goes directly to the provided ActiveScaffold templates.
|
9
|
+
# Useful if you want to wrap an existing template. Just call super!
|
10
|
+
#
|
11
|
+
# ==render :active_scaffold => #{controller.to_s}, options = {}+
|
12
|
+
#
|
13
|
+
# Lets you embed an ActiveScaffold by referencing the controller where it's configured.
|
14
|
+
#
|
15
|
+
# You may specify options[:constraints] for the embedded scaffold. These constraints have three effects:
|
16
|
+
# * the scaffold's only displays records matching the constraint
|
17
|
+
# * all new records created will be assigned the constrained values
|
18
|
+
# * constrained columns will be hidden (they're pretty boring at this point)
|
19
|
+
#
|
20
|
+
# You may also specify options[:conditions] for the embedded scaffold. These only do 1/3 of what
|
21
|
+
# constraints do (they only limit search results). Any format accepted by ActiveRecord::Base.find is valid.
|
22
|
+
#
|
23
|
+
# Defining options[:label] lets you completely customize the list title for the embedded scaffold.
|
24
|
+
#
|
25
|
+
def render_with_active_scaffold(*args, &block)
|
26
|
+
if args.first == :super
|
27
|
+
options = args[1] || {}
|
28
|
+
options[:locals] ||= {}
|
29
|
+
|
30
|
+
known_extensions = [:erb, :rhtml, :rjs, :haml]
|
31
|
+
# search through call stack for a template file (normally matches on first caller)
|
32
|
+
# note that we can't use split(':').first because windoze boxen may have an extra colon to specify the drive letter. the
|
33
|
+
# solution is to count colons from the *right* of the string, not the left. see issue #299.
|
34
|
+
template_path = caller.find{|c| known_extensions.include?(c.split(':')[-3].split('.').last.to_sym) }
|
35
|
+
template = File.basename(template_path.split(':')[-3])
|
36
|
+
|
37
|
+
# paths previous to current template_path must be ignored to avoid infinite loops when is called twice or more
|
38
|
+
index = 0
|
39
|
+
|
40
|
+
controller.class.active_scaffold_paths.each_with_index do |active_scaffold_template_path, i|
|
41
|
+
index = i + 1 and break if template_path.include? active_scaffold_template_path
|
42
|
+
end
|
43
|
+
|
44
|
+
controller.class.active_scaffold_paths.slice(index..-1).each do |active_scaffold_template_path|
|
45
|
+
active_scaffold_template = File.join(active_scaffold_template_path, template)
|
46
|
+
return render(:file => active_scaffold_template, :locals => options[:locals]) if File.file? active_scaffold_template
|
47
|
+
end
|
48
|
+
elsif args.first.is_a?(Hash) and args.first[:active_scaffold]
|
49
|
+
require 'digest/md5'
|
50
|
+
options = args.first
|
51
|
+
|
52
|
+
remote_controller = options[:active_scaffold]
|
53
|
+
constraints = options[:constraints]
|
54
|
+
conditions = options[:conditions]
|
55
|
+
eid = Digest::MD5.hexdigest(params[:controller] + remote_controller.to_s + constraints.to_s + conditions.to_s)
|
56
|
+
session["as:#{eid}"] = {:constraints => constraints, :conditions => conditions, :list => {:label => args.first[:label]}}
|
57
|
+
options[:params] ||= {}
|
58
|
+
options[:params].merge! :eid => eid
|
59
|
+
|
60
|
+
render_component :controller => remote_controller.to_s, :action => 'table', :params => options[:params]
|
61
|
+
else
|
62
|
+
render_without_active_scaffold(*args, &block)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
alias_method_chain :render, :active_scaffold
|
66
|
+
|
67
|
+
def partial_pieces(partial_path)
|
68
|
+
if partial_path.include?('/')
|
69
|
+
return File.dirname(partial_path), File.basename(partial_path)
|
70
|
+
else
|
71
|
+
return controller.class.controller_path, partial_path
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
# This is the template finder logic, keep it updated with however we find stuff in rails
|
76
|
+
# currently this very similar to the logic in ActionBase::Base.render for options file
|
77
|
+
# TODO: Work with rails core team to find a better way to check for this.
|
78
|
+
def template_exists?(template_name, template_format = nil)
|
79
|
+
begin
|
80
|
+
self.view_paths.find_template(template_name, template_format)
|
81
|
+
return true
|
82
|
+
rescue ActionView::MissingTemplate => e
|
83
|
+
return false
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|