This is a rough proof of concept.
There will be broken things.
Comments are welcome.
Installation
| <?php | |
| $countries = array | |
| ( | |
| 'AF' => 'Afghanistan', | |
| 'AX' => 'Aland Islands', | |
| 'AL' => 'Albania', | |
| 'DZ' => 'Algeria', | |
| 'AS' => 'American Samoa', | |
| 'AD' => 'Andorra', |
| @import "dataTables/jquery.dataTables"; | |
| /* A modifier pour avoir les bons espacements */ | |
| body.active_admin .data_table { | |
| padding-bottom: 10px; | |
| } | |
| body.active_admin .dataTables_paginate { | |
| margin-top: -10px; |
| def select_from_chosen(item_text, options) | |
| field = find_field(options[:from]) | |
| option_value = page.evaluate_script("$(\"##{field[:id]} option:contains('#{item_text}')\").val()") | |
| page.execute_script("$('##{field[:id]}').val('#{option_value}')") | |
| end |
| <?php | |
| // Test cards | |
| $cards = array( | |
| '378282246310005', // American Express | |
| '371449635398431', // American Express | |
| '5078601870000127985', // Aura | |
| '5078601800003247449', // Aura | |
| '30569309025904', // Diners Club | |
| '38520000023237', // Diners Club |
| group :tools do | |
| gem "guard" | |
| gem "guard-bundler" | |
| gem "guard-rspec" | |
| #For detecting changes in the filesystem | |
| gem 'rb-inotify', :require => false | |
| gem 'rb-fsevent', :require => false | |
| #For displaying notices |
| ActiveAdmin.setup do |config| | |
| config.view_factory.footer = Footer | |
| end |
| # this stuff goes in config/initializers/active_admin.rb | |
| ActiveAdmin.setup do |config| | |
| config.after_filter do | |
| save_search_filters if respond_to?(:save_filters?) and save_filters? | |
| end | |
| config.before_filter :only => [:index, :show, :edit, :new, :create] do | |
| restore_search_filters if respond_to?(:save_filters?) and save_filters? |
| module ActiveAdmin | |
| module Views | |
| class ActiveAdminForm | |
| class DeprecatedFormBufferSubstitute | |
| def initialize(form) | |
| @form = form | |
| end | |
| def << (value) | |
| @form.text_node value.html_safe | |
| end |
| # This file extends and overrides parts of the ActiveAdmin DSL and internals | |
| # in order to provide support for automatically displaying and editing images, | |
| # which in our infrastructure are stored as URLs whose column names end in "img". | |
| # Since this file will be reloaded frequently in the development environment, | |
| # all operations done at load time (class_eval's, etc.) MUST be idempotent. | |
| ActiveAdmin::Views::TableFor.class_eval do | |
| def img_column(col_sym=:img, title="Image") | |
| column title, sortable: false do |obj| |