-
-
Notifications
You must be signed in to change notification settings - Fork 270
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
♻️ Refactor to concern + add both sides
- Loading branch information
Showing
5 changed files
with
34 additions
and
16 deletions.
There are no files selected for viewing
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 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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# frozen_string_literal: true | ||
|
||
module Avo | ||
module Concerns | ||
module ControlsPlacement | ||
extend ActiveSupport::Concern | ||
|
||
def controls_placement | ||
resource.controls_placement || Avo.configuration.resource_controls_placement | ||
end | ||
|
||
def resource_controls_render_on_the_right? | ||
controls_placement == :right || resource_controls_render_on_both_sides? | ||
end | ||
|
||
def resource_controls_render_on_the_left? | ||
controls_placement == :left || resource_controls_render_on_both_sides? | ||
end | ||
|
||
private | ||
|
||
def resource_controls_render_on_both_sides? | ||
controls_placement == :both | ||
end | ||
end | ||
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
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