forked from pupilfirst/pupilfirst
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Themes: Add support for themes and add dark theme (pupilfirst#1483)
Co-authored-by: Raj Suhail <[email protected]> Co-authored-by: vinu tv <[email protected]> Co-authored-by: yash-learner <[email protected]> Co-authored-by: Hari Gopal <[email protected]>
- Loading branch information
1 parent
271e997
commit 5045deb
Showing
63 changed files
with
1,240 additions
and
557 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,61 @@ | ||
module Schools | ||
class ImagesForm < Reform::Form | ||
property :logo_on_light_bg, virtual: true, validates: { image: true, file_size: { less_than: 2.megabytes } }, allow_nil: true | ||
property :cover_image, virtual: true, validates: { image: true, file_size: { less_than: 2.megabytes } }, allow_nil: true | ||
property :icon, virtual: true, validates: { image: true, file_size: { less_than: 2.megabytes } }, allow_nil: true | ||
property :logo_on_light_bg, | ||
virtual: true, | ||
validates: { | ||
image: true, | ||
file_size: { | ||
less_than: 2.megabytes | ||
} | ||
}, | ||
allow_nil: true | ||
property :logo_on_dark_bg, | ||
virtual: true, | ||
validates: { | ||
image: true, | ||
file_size: { | ||
less_than: 2.megabytes | ||
} | ||
}, | ||
allow_nil: true | ||
property :cover_image, | ||
virtual: true, | ||
validates: { | ||
image: true, | ||
file_size: { | ||
less_than: 2.megabytes | ||
} | ||
}, | ||
allow_nil: true | ||
property :icon_on_light_bg, | ||
virtual: true, | ||
validates: { | ||
image: true, | ||
file_size: { | ||
less_than: 2.megabytes | ||
} | ||
}, | ||
allow_nil: true | ||
property :icon_on_dark_bg, | ||
virtual: true, | ||
validates: { | ||
image: true, | ||
file_size: { | ||
less_than: 2.megabytes | ||
} | ||
}, | ||
allow_nil: true | ||
|
||
def save | ||
model.logo_on_light_bg.attach(logo_on_light_bg) if logo_on_light_bg.present? | ||
model.cover_image.attach(cover_image) if cover_image.present? | ||
model.icon.attach(icon) if icon.present? | ||
%i[ | ||
logo_on_light_bg | ||
logo_on_dark_bg | ||
cover_image | ||
icon_on_light_bg | ||
icon_on_dark_bg | ||
].each do |image| | ||
model.public_send(image).attach(send(image)) if send(image).present? | ||
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
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
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
Oops, something went wrong.