-
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.
Feature/tf+ 157 notification event lending denied (#258)
* created new model for lending denied notifications Co-authored-by: kohlros <[email protected]> * denying a lend request now creates an according notification Co-authored-by: kohlros <[email protected]> * added tests and fixed linter Co-authored-by: kohlros <[email protected]> * fixed test after merge Co-authored-by: kohlros <[email protected]>
- Loading branch information
Showing
9 changed files
with
104 additions
and
6 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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# This class defines the specific lending denied notification, a notification | ||
# that additionally belongs to a borrower and an item. | ||
class LendingDeniedNotification < ApplicationRecord | ||
acts_as :notification | ||
|
||
belongs_to :item | ||
|
||
def title | ||
I18n.t "views.notifications.lending_denied.title" | ||
end | ||
|
||
def description | ||
owner = item.owning_user | ||
I18n.t "views.notifications.lending_denied.description", owner: owner.name, item: item.name | ||
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
39 changes: 39 additions & 0 deletions
39
app/views/notifications/_lending_denied_notification.html.erb
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,39 @@ | ||
<!-- Button trigger modal --> | ||
<button type="button" class="btn btn-notification" style= "background-color: <%= notification.unread == true ? "#cce4ec" : "#dddfe0c" %> !important" data-bs-toggle="modal" data-bs-target="#<%= "notificationModal#{notification.id}" %>"> | ||
<div class="notification"> | ||
<h2 class="subtitle"> | ||
<%= notification.title %> | ||
</h2> | ||
<p class="body-1"> | ||
<%= notification.description %> | ||
</p> | ||
<p class="timestamp"> | ||
<%= notification.parse_time %> | ||
</p> | ||
</div> | ||
</button> | ||
|
||
<!-- Modal --> | ||
<div class="modal fade" id="<%= "notificationModal#{notification.id}" %>" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true"> | ||
<div class="modal-dialog"> | ||
<div class="modal-content"> | ||
<div class="modal-header"> | ||
<h5 class="modal-title" id="exampleModalLabel"><%= notification.title %></h5> | ||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> | ||
</div> | ||
<div class="modal-body"> | ||
<p> | ||
<%= notification.description %> | ||
</p> | ||
</div> | ||
<div class="modal-footer"> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<script> | ||
$('<%="notificationModal#{notification.id}" %>').on('shown.bs.modal', function (e) { | ||
"<% notification.mark_as_read%>"; | ||
}) | ||
</script> |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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