Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add (meta)Data []byte with size of 65532(same as body) to Message/Qor… #1

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions channels/database/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ func (database *Database) Send(message *notification.Message, context *qor.Conte
Title: message.Title,
Body: message.Body,
MessageType: message.MessageType,
Data: message.Data,
ResolvedAt: message.ResolvedAt,
}

Expand Down
2 changes: 2 additions & 0 deletions message.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ type Message struct {
Title string
Body string
MessageType string
Data []byte
ResolvedAt *time.Time
}

Expand All @@ -23,6 +24,7 @@ type QorNotification struct {
Title string
Body string `sql:"size:65532"`
MessageType string
Data []byte `sql:"size:65532"`
ResolvedAt *time.Time
}

Expand Down
50 changes: 25 additions & 25 deletions views/notifications/notification.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,42 +2,42 @@
{{$context := .}}

<div class="qor-fieldset qor-notifications__item{{if $message.IsResolved}} resolved{{end}} {{$message.MessageType}} clearfix" data-notification-id="{{$message.ID}}">
<h4 class="qor-notifications__title">
<h4 class="qor-notifications__title">
{{$message.Title}}
</h4>
</h4>

<div class="qor-notifications__body">
<div class="qor-notifications__body">
{{raw $message.Body}}
</div>
</div>

<div class="qor-notifications__actions">
<div class="qor-notifications__actions">
{{range $action := $message.Actions $context}}
{{if (and $action.URL (eq $action.Method "GET"))}}
{{if (and $action.URL (eq $action.Method "GET"))}}
<a class="mdl-button mdl-button--colored" href="{{call $action.URL $message $context}}" target="_blank">
{{t (printf "qor_notification.actions.%v" $action.Label) $action.Label}}
{{t (printf "qor_notification.actions.%v" $action.Label) $action.Label}}
</a>
{{else}}
{{else}}

<!-- Notification archived Restore -->
<!-- Notification archived Restore -->
<button class="mdl-button mdl-button--colored mdl-js-button qor-action-button"
type="button"
data-label="{{t (printf "qor_notification.actions.%v" $action.Label) $action.Label}}"
data-url="{{if $action.URL}}{{call $action.URL $message $context}}{{else}}{{$context.Admin.GetRouter.Prefix}}/!notifications/{{primary_key_of $message}}/{{$action.ToParam}}{{end}}"
{{if not $action.Resource}}
data-ajax-form="true"
data-dataType="json"
{{if $action.Undo}}
data-undo-url="{{if $action.URL}}{{call $action.URL $message $context}}{{else}}{{$context.Admin.GetRouter.Prefix}}/!notifications/{{primary_key_of $message}}/{{$action.ToParam}}{{end}}/undo"
data-undo-label="{{t "qor_notification.hints.undo" "undo"}}"
data-undo-type="notification"
{{else}}
data-confirm="{{t "qor_notification.confirm.are_you_sure" "Are You Sure?"}}"
{{end}}
data-method="{{$action.Method}}"
{{end}}>
{{t (printf "qor_notification.actions.%v" $action.Label) $action.Label}}
data-url="{{if $action.URL}}{{call $action.URL $message $context}}{{else}}{{patch_url $context.Admin.GetRouter.Prefix "/"}}!notifications/{{primary_key_of $message}}/{{$action.ToParam}}{{end}}"
{{if not $action.Resource}}
data-ajax-form="true"
data-dataType="json"
{{if $action.Undo}}
data-undo-url="{{if $action.URL}}{{call $action.URL $message $context}}{{else}}{{patch_url $context.Admin.GetRouter.Prefix "/"}}!notifications/{{primary_key_of $message}}/{{$action.ToParam}}{{end}}/undo"
data-undo-label="{{t "qor_notification.hints.undo" "undo"}}"
data-undo-type="notification"
{{else}}
data-confirm="{{t "qor_notification.confirm.are_you_sure" "Are You Sure?"}}"
{{end}}
data-method="{{$action.Method}}"
{{end}}>
{{t (printf "qor_notification.actions.%v" $action.Label) $action.Label}}
</button>
{{end}}
{{end}}
</div>
{{end}}
</div>
</div>