forked from eagerworks/rails-template
-
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.
Merge pull request #11 from eagerworks/show_gift
show gift
- Loading branch information
Showing
42 changed files
with
1,828 additions
and
19 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
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,31 @@ | ||
/* | ||
* Provides a drop-in pointer for the default Trix stylesheet that will format the toolbar and | ||
* the trix-editor content (whether displayed or under editing). Feel free to incorporate this | ||
* inclusion directly in any other asset bundle and remove this file. | ||
* | ||
*= require trix | ||
*/ | ||
|
||
/* | ||
* We need to override trix.css’s image gallery styles to accommodate the | ||
* <action-text-attachment> element we wrap around attachments. Otherwise, | ||
* images in galleries will be squished by the max-width: 33%; rule. | ||
*/ | ||
.trix-content .attachment-gallery > action-text-attachment, | ||
.trix-content .attachment-gallery > .attachment { | ||
flex: 1 0 33%; | ||
padding: 0 0.5em; | ||
max-width: 33%; | ||
} | ||
|
||
.trix-content .attachment-gallery.attachment-gallery--2 > action-text-attachment, | ||
.trix-content .attachment-gallery.attachment-gallery--2 > .attachment, .trix-content .attachment-gallery.attachment-gallery--4 > action-text-attachment, | ||
.trix-content .attachment-gallery.attachment-gallery--4 > .attachment { | ||
flex-basis: 50%; | ||
max-width: 50%; | ||
} | ||
|
||
.trix-content action-text-attachment .attachment { | ||
padding: 0 !important; | ||
max-width: 100% !important; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { Controller } from '@hotwired/stimulus' | ||
|
||
// Connects to data-controller="gift-amount" | ||
export default class extends Controller { | ||
static targets = ['amount', 'increaseButton', 'decreaseButton'] | ||
|
||
editButtons() { | ||
switch (this.amountTarget.value) { | ||
case '0': | ||
this.decreaseButtonTarget.disabled = true | ||
break | ||
case '5': | ||
this.increaseButtonTarget.disabled = true | ||
break | ||
default: | ||
this.decreaseButtonTarget.disabled = false | ||
this.increaseButtonTarget.disabled = false | ||
} | ||
} | ||
|
||
decrease() { | ||
if (this.amountTarget.value > 0) { | ||
this.amountTarget.value -- | ||
} | ||
this.editButtons() | ||
} | ||
|
||
increase() { | ||
if (this.amountTarget.value < 5) { | ||
this.amountTarget.value ++ | ||
} | ||
this.editButtons() | ||
} | ||
|
||
} |
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,4 @@ | ||
class Customization < ApplicationRecord | ||
has_many :gift_customizations | ||
has_many :gifts, through: :gift_customizations | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
class GiftCustomization < ApplicationRecord | ||
belongs_to :gift | ||
belongs_to :customization | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<figure class="attachment attachment--<%= blob.representable? ? "preview" : "file" %> attachment--<%= blob.filename.extension %>"> | ||
<% if blob.representable? %> | ||
<%= image_tag blob.representation(resize_to_limit: local_assigns[:in_gallery] ? [ 800, 600 ] : [ 1024, 768 ]) %> | ||
<% end %> | ||
|
||
<figcaption class="attachment__caption"> | ||
<% if caption = blob.try(:caption) %> | ||
<%= caption %> | ||
<% else %> | ||
<span class="attachment__name"><%= blob.filename %></span> | ||
<span class="attachment__size"><%= number_to_human_size blob.byte_size %></span> | ||
<% end %> | ||
</figcaption> | ||
</figure> |
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.