Module: Controller::Application
- Extended by:
- ActiveSupport::Concern
- Defined in:
- app/controllers/org/controller/application.rb
Instance Method Summary collapse
- #current_member ⇒ Object
- #current_organ ⇒ Object
- #current_organ_domain ⇒ Object
- #current_title ⇒ Object
- #default_ancestors_params ⇒ Object
- #default_filter_params ⇒ Object
- #default_form_params ⇒ Object
- #default_params ⇒ Object
- #other_organs ⇒ Object
Instance Method Details
#current_member ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'app/controllers/org/controller/application.rb', line 17 def current_member return @current_member if defined?(@current_member) if @current_member = .members.find_by(organ_id: current_organ&.id) end logger.debug " \e[35mLogin as member: #{@current_member&.id}\e[0m" @current_member end |
#current_organ ⇒ Object
27 28 29 30 31 32 33 34 35 |
# File 'app/controllers/org/controller/application.rb', line 27 def current_organ return @current_organ if defined?(@current_organ) if current_organ_domain @current_organ = @current_organ_domain.organ end logger.debug " \e[35mLogin as organ: #{@current_organ&.name}, ID: #{@current_organ&.id}\e[0m" @current_organ end |
#current_organ_domain ⇒ Object
37 38 39 40 41 |
# File 'app/controllers/org/controller/application.rb', line 37 def current_organ_domain return @current_organ_domain if defined?(@current_organ_domain) @current_organ_domain = OrganDomain.annotate('get organ domain in org application').find_by(identifier: request.host_with_port) end |
#current_title ⇒ Object
9 10 11 12 13 14 15 |
# File 'app/controllers/org/controller/application.rb', line 9 def current_title if current_organ current_organ.name else t('.title', default: :site_name) end end |
#default_ancestors_params ⇒ Object
75 76 77 78 79 80 81 |
# File 'app/controllers/org/controller/application.rb', line 75 def default_ancestors_params if current_organ { organ_id: current_organ.self_and_ancestor_ids } else default_params end end |
#default_filter_params ⇒ Object
67 68 69 70 71 72 73 |
# File 'app/controllers/org/controller/application.rb', line 67 def default_filter_params if current_organ { organ_id: current_organ.self_and_descendant_ids } else default_params end end |
#default_form_params ⇒ Object
59 60 61 62 63 64 65 |
# File 'app/controllers/org/controller/application.rb', line 59 def default_form_params if current_organ { organ_id: current_organ.id } else super end end |
#default_params ⇒ Object
51 52 53 54 55 56 57 |
# File 'app/controllers/org/controller/application.rb', line 51 def default_params if current_organ { organ_id: current_organ.id } else super end end |
#other_organs ⇒ Object
43 44 45 46 47 48 49 |
# File 'app/controllers/org/controller/application.rb', line 43 def other_organs if current_organ current_user.organs.where.not(id: current_organ.id) else current_user.organs end end |