Merge pull request #2829 from aignatov-bio/ai-sci-4983-add-descriptions-for-conditions

Add description for conditions [SCI-4983]
This commit is contained in:
aignatov-bio 2020-09-09 11:33:48 +02:00 committed by GitHub
commit 5d9d7d6a12
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 2 deletions

View file

@ -81,6 +81,7 @@
align-items: center;
display: grid;
grid-template-columns: 1fr min-content 1fr;
grid-template-rows: 28px;
justify-content: space-around;
position: relative;

View file

@ -4,7 +4,11 @@
module MyModuleStatusConditions
class Active < MyModuleStatusCondition
def call(my_module)
my_module.errors.add(:status_conditions, 'MyModule should be active') unless my_module.active?
my_module.errors.add(:status_conditions, I18n.t('my_module_statuses.conditions.error.my_module_not_active')) unless my_module.active?
end
def description
I18n.t('my_module_statuses.conditions.error.my_module_not_active')
end
end
end

View file

@ -14,7 +14,11 @@
<div class="status-block" style="background: <%= status[:color] %>">
<%= status[:name] %>
</div>
<div class="status-comment"><%= status[:status_comment] %></div>
<div class="status-comment">
<% status.next_status&.my_module_status_conditions&.each do |condition| %>
<%= condition.description %><br>
<% end %>
</div>
</div>
<% end %>

View file

@ -8,3 +8,6 @@ en:
update_status:
error:
no_permission: You dont have permission to change the status
conditions:
error:
my_module_not_active: 'Task should be active'