Merge pull request #617 from okriuchykhin/ok_SCI_960

Add additional info to samples info modal [SCI-960]
This commit is contained in:
okriuchykhin 2017-05-12 10:14:55 +02:00 committed by GitHub
commit 213425b493
4 changed files with 53 additions and 5 deletions

View file

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

View file

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

View file

@ -7,6 +7,44 @@
</div> </div>
<div class="modal-body"> <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 %> <% if @sample.my_modules.count > 0 %>
<div> <div>
<%= t("samples.modal_info.title", nr: @sample.my_modules.count) %> <%= 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_sample_group: "Add sample group"
add_new_column: "Add column" add_new_column: "Add column"
modal_info: modal_info:
added_on: "Added on"
added_by: "Added by"
custom_field: "%{cf}: "
head_title: "Information for sample '%{sample}'" head_title: "Information for sample '%{sample}'"
title: "This sample is assigned to %{nr} tasks." title: "This sample is assigned to %{nr} tasks."
no_tasks: "This sample in not assigned to any task." 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: modal_import:
title: "Import samples" 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." 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."