This file contains 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
filter :reception_reception_date, as: :date_range, label: Reception.human_attribute_name(:reception_date_full) | |
collection_action :download_report, :method => :get do | |
services = Service.includes(:order, reception: [{medic: :clinic_medics}]).where{ orders.orderable_id != nil } # necessary model | |
if params[:q] && params[:q][:reception_reception_date_gte].length > 1 | |
services = services.where("receptions.reception_date >= ?", params[:q][:reception_reception_date_gte]) | |
end | |
if params[:q] && params[:q][:reception_reception_date_lte].length > 1 | |
services = services.where("receptions.reception_date < ?", params[:q][:reception_reception_date_lte]) | |
end |
This file contains 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
if f.object.errors.size > 0 | |
f.inputs I18n.t("active_admin.errors") do | |
content_tag(:li, f.object.errors.full_messages.join('<br/>').html_safe, class: 'errors_messages') | |
end | |
end |
This file contains 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
# in any ActiveAdmin Resource you need in form block add the following code | |
# change 'translations' with your association name | |
f.has_many :translations do |translation| | |
translation.inputs("Caption"){} # Adding caption for languages | |
translation.inputs(""){} # Spacer | |
translations.input # add necessary inputs here | |
end |
This file contains 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
# config/initializers/active_admin.rb | |
ActiveAdmin.setup do |config| | |
config.current_user_method = :current_user | |
config.authentication_method = :authenticate_user! | |
config.before_filter :admin_role_filter | |
end | |
# Adding all recource names to Permissions table after ActiveAdmin is loaded |
This file contains 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 is a dirty hack to fix Draper problem with kaminari | |
# Put this in app/decorators/collection_decorator.rb | |
class Draper::CollectionDecorator | |
delegate :current_page, :total_pages, :limit_value | |
def total_count | |
source.total_count | |
end | |
NewerOlder