Add additional info to samples info modal [SCI-960]

This commit is contained in:
Oleksii Kriuchykhin 2017-05-11 22:20:06 +02:00
parent ab0d882be1
commit bb8c7c342c
4 changed files with 53 additions and 5 deletions

View file

@ -1,5 +1,6 @@
module Users
class InvitationsController < Devise::InvitationsController
include InputSanitizeHelper
include UsersGenerator
prepend_before_action :check_captcha, only: [:update]
@ -175,8 +176,8 @@ module Users
message = "#{I18n.t('search.index.team')} #{team.name}"
notification = Notification.create(
type_of: :assignment,
title: InputSanitizeHelper.sanitize_inpute(title),
message: InputSanitizeHelper.sanitize_input(message)
title: sanitize_inpute(title),
message: sanitize_input(message)
)
if target_user.assignments_notification

View file

@ -1,4 +1,6 @@
class Activity < ActiveRecord::Base
include InputSanitizeHelper
after_create :generate_notification
enum type_of: [
@ -104,11 +106,11 @@ class Activity < ActiveRecord::Base
notification = Notification.create(
type_of: notification_type,
title: InputSanitizeHelper.sanitize_input(message, tags: %w(strong a)),
message: InputSanitizeHelper.sanitize_input(
title: sanitize_input(message, %w(strong a)),
message: sanitize_input(
"#{I18n.t('search.index.project')}
#{project_m} #{experiment_m} #{task_m}",
tags: %w(strong a)
%w(strong a)
),
generator_user_id: user.id
)

View file

@ -7,6 +7,44 @@
</div>
<div class="modal-body">
<p>
<span>
<%= t "samples.modal_info.sample_type" %>
<% if @sample.sample_type.present? %>
<%= @sample.sample_type.name %>
<% else %>
<em><%= t "samples.modal_info.no_type" %></em>
<% end %>
</span>
<br>
<span>
<%= t "samples.modal_info.sample_group" %>
<span class="glyphicon glyphicon-asterisk" style="<%= "color: #{@sample.sample_group.color}" if @sample.sample_group.present? %>"></span>
<% if @sample.sample_group.present? %>
<%= @sample.sample_group.name %>
<% else %>
<em><%= t "samples.modal_info.no_group" %></em>
<% end %>
</span>
<br>
<span>
<%= t "samples.modal_info.added_on" %>
<%= l @sample.created_at, format: :full %>
</span>
<br>
<span>
<%= t "samples.modal_info.added_by" %>
<%= @sample.user.full_name %>
</span>
<% @sample.sample_custom_fields.each do |sample_custom_field| %>
<br>
<span>
<%= t "samples.modal_info.custom_field", cf: sample_custom_field.custom_field.name %>
<%= sample_custom_field.value %>
</span>
<% end %>
</p>
<% if @sample.my_modules.count > 0 %>
<div>
<%= t("samples.modal_info.title", nr: @sample.my_modules.count) %>

View file

@ -850,9 +850,16 @@ en:
add_new_sample_group: "Add sample group"
add_new_column: "Add column"
modal_info:
added_on: "Added on"
added_by: "Added by"
custom_field: "%{cf}: "
head_title: "Information for sample '%{sample}'"
title: "This sample is assigned to %{nr} tasks."
no_tasks: "This sample in not assigned to any task."
no_group: "No sample group"
no_type: "No sample type"
sample_group: "Sample group:"
sample_type: "Sample type:"
modal_import:
title: "Import samples"
notice: "You may upload .csv file (comma separated) or tab separated file (.txt or .tdv) or Excel file (.xls, .xlsx). First row should include header names, followed by rows with sample data."