Mission agent step status

James Peret %!s(int64=10) %!d(string=hace) años
padre
commit
323fcb154c

+ 9 - 0
app/assets/stylesheets/avalanche_theme.css.less

@@ -329,6 +329,15 @@ h4 {
329 329
 			padding-top: 6px;
330 330
 			font-weight: 200;
331 331
 		}
332
+		.label { 
333
+			margin-top: 5px;
334
+			font-family: Avenir-Oblique;
335
+			color: #000000;
336
+			font-style: oblique;
337
+			text-shadow: none;
338
+			padding: 5px;
339
+		}
340
+		.label.label-warning { background-color: #F2CB63; }
332 341
 		.caret {
333 342
 			float: left;
334 343
 			margin-top: 14px;

+ 17 - 0
app/models/agent_step.rb

@@ -18,4 +18,21 @@ class AgentStep < ActiveRecord::Base
18 18
     return submission
19 19
   end
20 20
   
21
+  def is_completed
22
+    self.step_submissions.each do |s|
23
+      if s.validated == true
24
+        return true
25
+      end
26
+    end
27
+    return false
28
+  end
29
+  
30
+  def is_validating
31
+    if self.step_submissions.count > 0 && self.step_submissions.last.validated == nil
32
+      return true
33
+    else
34
+      return false
35
+    end
36
+  end
37
+  
21 38
 end

+ 7 - 2
app/views/missions/show_agent_details.html.erb

@@ -87,9 +87,14 @@
87 87
 									
88 88
 								</a>
89 89
 								<% if step.step_validations.count > 0 %>
90
-									<%= f.button :submit, class: 'btn btn-small btn-success pull-right' %>
90
+									<% if step.is_completed %>
91
+										<span class="label label-success pull-right">Validated</span>
92
+									<% elsif step.is_validating %>
93
+										<span class="label label-warning pull-right">Waiting for validation</span>
94
+									<% else %>
95
+										<%= f.button :submit, class: 'btn btn-small btn-success pull-right' %>
96
+									<% end %>
91 97
 								<% end %>
92
-							
93 98
 							<% end %>
94 99
 						<% end %>
95 100
 						<%= content_tag(:div, class: 'panel-body collapse', id: ('collapse_step_'+ step.step.to_s)) do %>