This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module ActiveAdmin | |
| module Filters | |
| module FormtasticAddons | |
| alias :old_seems_searchable? :seems_searchable? | |
| def seems_searchable? | |
| return false if ransacker? | |
| old_seems_searchable? | |
| end | |
| def klass |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module ActiveAdmin | |
| module Views | |
| class IndexAsTable < ActiveAdmin::Component | |
| def build(page_presenter, collection) | |
| table_options = { | |
| id: "index_table_#{active_admin_config.resource_name.plural}", | |
| sortable: true, | |
| class: "index_table index", | |
| i18n: active_admin_config.resource_class, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def gravatar?(email) | |
| puts "checking #{email}" | |
| email_hash = Digest::MD5.hexdigest(email.to_s.downcase) | |
| gravatar_check = "http://gravatar.com/avatar/#{email_hash}.png?d=404" | |
| uri = URI.parse(gravatar_check) | |
| http = Net::HTTP.new(uri.host, uri.port) | |
| request = Net::HTTP::Get.new(uri.request_uri) | |
| response = http.request(request) | |
| response.code.to_i != 404 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module ActiveAdmin | |
| module Inputs | |
| module Filters | |
| module StringInputExt | |
| def self.included(base) | |
| base.class_eval do | |
| @filters = [:equals, :contains, :starts_with, :ends_with] | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- | |
| :visa: | |
| :rules: | |
| - :length: | |
| - 13 | |
| - 16 | |
| :prefixes: | |
| - '4' | |
| :mastercard: | |
| :rules: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ActiveAdmin.setup do |config| | |
| config.view_factory.footer = Footer | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'rack/body_proxy' | |
| require 'active_record/query_cache' | |
| module ActiveRecord | |
| module Turntable | |
| module Rack | |
| class QueryCache < ActiveRecord::QueryCache | |
| def call(env) | |
| enabled = ActiveRecord::Base.connection.query_cache_enabled | |
| connection_id = ActiveRecord::Base.connection_id |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class BaseDecorator < Draper::Decorator | |
| delegate_all | |
| include Rails.application.routes.url_helpers | |
| def arbre(&block) | |
| Arbre::Context.new({}, self, &block).to_s #<<<--pass self as second argument | |
| end | |
| def comments_count | |
| ActiveAdmin::Comment.where(resource_id: self.model.id.to_s, resource_type: self.model.class.to_s).count |