mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-10-07 20:40:26 +08:00
fixes email link [fixes SCI-765]
This commit is contained in:
parent
94732c6d18
commit
023b3213e8
9 changed files with 53 additions and 8 deletions
|
@ -30,6 +30,7 @@ $color-cloud: rgba(0, 0, 0, .1);
|
||||||
// Miscelaneous colors
|
// Miscelaneous colors
|
||||||
$color-mystic: #eaeff2;
|
$color-mystic: #eaeff2;
|
||||||
$color-candlelight: #ffda23;
|
$color-candlelight: #ffda23;
|
||||||
|
$color-orange: #ff900b;
|
||||||
$color-saturated-green: #008600;
|
$color-saturated-green: #008600;
|
||||||
|
|
||||||
// Red colors
|
// Red colors
|
||||||
|
|
|
@ -69,6 +69,17 @@
|
||||||
padding-top: 5px;
|
padding-top: 5px;
|
||||||
width: 30px;
|
width: 30px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.deliver {
|
||||||
|
background-color: $color-orange;
|
||||||
|
border-radius: 50%;
|
||||||
|
color: $color-wild-sand;
|
||||||
|
display: inline-block;
|
||||||
|
font-size: 13px;
|
||||||
|
height: 30px;
|
||||||
|
padding-top: 5px;
|
||||||
|
width: 30px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -149,6 +149,17 @@ table {
|
||||||
width: 45px;
|
width: 45px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.deliver {
|
||||||
|
background-color: $color-orange;
|
||||||
|
border-radius: 50%;
|
||||||
|
color: $color-wild-sand;
|
||||||
|
display: block;
|
||||||
|
font-size: 23px;
|
||||||
|
height: 45px;
|
||||||
|
padding-top: 5px;
|
||||||
|
width: 45px;
|
||||||
|
}
|
||||||
|
|
||||||
.system-message {
|
.system-message {
|
||||||
background-color: $color-theme-secondary;
|
background-color: $color-theme-secondary;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
|
|
|
@ -1,6 +1,3 @@
|
||||||
require 'zip'
|
|
||||||
require 'fileutils'
|
|
||||||
|
|
||||||
class ZipExportsController < ApplicationController
|
class ZipExportsController < ApplicationController
|
||||||
before_action :load_var
|
before_action :load_var
|
||||||
before_action :check_edit_permissions
|
before_action :check_edit_permissions
|
||||||
|
|
|
@ -2,7 +2,6 @@ require 'zip'
|
||||||
require 'fileutils'
|
require 'fileutils'
|
||||||
|
|
||||||
class ZipExport < ActiveRecord::Base
|
class ZipExport < ActiveRecord::Base
|
||||||
include Rails.application.routes.url_helpers
|
|
||||||
belongs_to :user
|
belongs_to :user
|
||||||
has_attached_file :zip_file
|
has_attached_file :zip_file
|
||||||
validates_attachment :zip_file,
|
validates_attachment :zip_file,
|
||||||
|
@ -70,7 +69,11 @@ class ZipExport < ActiveRecord::Base
|
||||||
notification = Notification.create(
|
notification = Notification.create(
|
||||||
type_of: :deliver,
|
type_of: :deliver,
|
||||||
title: I18n.t('zip_export.notification_title'),
|
title: I18n.t('zip_export.notification_title'),
|
||||||
message: "<a href='#{zip_exports_download_path(self)}'>" \
|
message: "<a data-id='#{id}' " \
|
||||||
|
"href='#{Rails.application
|
||||||
|
.routes
|
||||||
|
.url_helpers
|
||||||
|
.zip_exports_download_path(self)}'>" \
|
||||||
"#{zip_file_file_name}</a>"
|
"#{zip_file_file_name}</a>"
|
||||||
)
|
)
|
||||||
UserNotification.create(notification: notification, user: user)
|
UserNotification.create(notification: notification, user: user)
|
||||||
|
@ -85,4 +88,10 @@ class ZipExport < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
protected
|
||||||
|
|
||||||
|
def default_url_options
|
||||||
|
Rails.application.config.active_job.default_url_options
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-xs-3 col-md-1">
|
<div class="col-xs-3 col-md-1">
|
||||||
<span style="display: none;" data-hook="user-notification-list-item"></span>
|
<span style="display: none;" data-hook="user-notification-list-item"></span>
|
||||||
<% if notification.type_of == 'recent_changes' %>
|
<% if notification.type_of == 'recent_changes' %>
|
||||||
<div class="text-center">
|
<div class="text-center">
|
||||||
<%= image_tag avatar_path(notification.generator_user, :icon_small), class: 'avatar img-circle' %>
|
<%= image_tag avatar_path(notification.generator_user, :icon_small), class: 'avatar img-circle' %>
|
||||||
</div>
|
</div>
|
||||||
|
@ -18,6 +18,12 @@
|
||||||
<span class="system-message"><i class="glyphicon glyphicon-tower" aria-hidden="true"></i></span>
|
<span class="system-message"><i class="glyphicon glyphicon-tower" aria-hidden="true"></i></span>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
<% if notification.type_of == 'deliver' %>
|
||||||
|
<div class="text-center">
|
||||||
|
<span class="deliver"><%= fa_icon 'truck' %></span>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xs-9 col-md-11">
|
<div class="col-xs-9 col-md-11">
|
||||||
<strong><%= sanitize_input(notification.title) %></strong> <br>
|
<strong><%= sanitize_input(notification.title) %></strong> <br>
|
||||||
|
|
|
@ -18,6 +18,11 @@
|
||||||
<span class="system-message"><i class="glyphicon glyphicon-tower" aria-hidden="true"></i></span>
|
<span class="system-message"><i class="glyphicon glyphicon-tower" aria-hidden="true"></i></span>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<% if notification.type_of == 'deliver' %>
|
||||||
|
<div class="text-center">
|
||||||
|
<span class="deliver"><%= fa_icon 'truck' %></span>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-xs-10">
|
<div class="col-xs-10">
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<p>Type: <%= I18n.t("notifications.types.#{@notification.type_of}") %></p>
|
<p>Type: <%= I18n.t("notifications.types.#{@notification.type_of}") %></p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<% if @notification.system_message? %>
|
<% if @notification.system_message? || @notification.deliver? %>
|
||||||
<% # We assume the system notification is clean %>
|
<% # We assume the system notification is clean %>
|
||||||
<%= @notification.title.html_safe %>
|
<%= @notification.title.html_safe %>
|
||||||
<% else %>
|
<% else %>
|
||||||
|
@ -17,6 +17,10 @@
|
||||||
<% if @notification.system_message? %>
|
<% if @notification.system_message? %>
|
||||||
<% # We assume the system notification is clean %>
|
<% # We assume the system notification is clean %>
|
||||||
<%= @notification.message.html_safe %>
|
<%= @notification.message.html_safe %>
|
||||||
|
<% elsif @notification.deliver? %>
|
||||||
|
<% # work around the problem with inserting the link of zipExport %>
|
||||||
|
<% zip_id = /data-id='(\d*)'/.match(@notification.message)[1] %>
|
||||||
|
<%= @notification.message.gsub(/href='.+'/, "href='#{zip_exports_download_url(zip_id)}'").html_safe %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<%= sanitize_input(prepend_server_url_to_links(@notification.message)) %>
|
<%= sanitize_input(prepend_server_url_to_links(@notification.message)) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -1517,6 +1517,7 @@ en:
|
||||||
assignment: "Assignment"
|
assignment: "Assignment"
|
||||||
recent_changes: "Recent changes"
|
recent_changes: "Recent changes"
|
||||||
system_message: "sciNote system message"
|
system_message: "sciNote system message"
|
||||||
|
deliver: 'Exportable content'
|
||||||
email_title: "You've received a sciNote notification!"
|
email_title: "You've received a sciNote notification!"
|
||||||
assign_user_to_team: "<i>%{assigned_user}</i> was added as %{role} to team <strong>%{team}</strong> by <i>%{assigned_by_user}</i>."
|
assign_user_to_team: "<i>%{assigned_user}</i> was added as %{role} to team <strong>%{team}</strong> by <i>%{assigned_by_user}</i>."
|
||||||
unassign_user_from_team: "<i>%{unassigned_user}</i> was removed from team <strong>%{team}</strong> by <i>%{unassigned_by_user}</i>."
|
unassign_user_from_team: "<i>%{unassigned_user}</i> was removed from team <strong>%{team}</strong> by <i>%{unassigned_by_user}</i>."
|
||||||
|
|
Loading…
Add table
Reference in a new issue