lib/rest-ftp-daemon/helpers/views.rb in rest-ftp-daemon-0.400.0 vs lib/rest-ftp-daemon/helpers/views.rb in rest-ftp-daemon-0.410.0.pre.1
- old
+ new
@@ -28,22 +28,52 @@
return "label-info" if runs == 1
return "label-warning" if runs == 2
return "label-danger" if runs > 2
end
- def job_method_label method
- return if method.nil?
- klass = case method
- when JOB_METHOD_FILE
- "label-primary"
- when JOB_METHOD_FTP
- "label-warning"
- when JOB_METHOD_FTPS
- "label-success"
+ def location_style uri
+ case uri
+ when URI::FILE
+ "primary"
+ when URI::FTP
+ "warning"
+ when URI::FTPS
+ "success"
+ when URI::SFTP
+ "success"
else
- "label-default"
+ "default"
end
- "<div class=\"transfer-method label #{klass}\">#{method.upcase}</div>"
+ end
+
+ def job_style job
+ case job.type
+ when JOB_TYPE_TRANSFER
+ icon_klass = "transfer"
+ when JOB_TYPE_VIDEO
+ icon_klass = "facetime-video"
+ when JOB_TYPE_DUMMY
+ icon_klass = "question-sign"
+ else
+ icon_klass = "label-default"
+ end
+ end
+
+ def location_label uri
+ sprintf(
+ '<div class="transfer-type label label-%s">%s</div>',
+ location_style(uri),
+ uri.class.name.split('::').last
+ )
+ end
+
+ def job_type job
+ sprintf(
+ '<span class="glyphicon glyphicon-%s" alt="%s"></span> %s',
+ job_style(job),
+ job.type,
+ job.type
+ )
end
def datetime_short datetime
# return param.class
return "-" if datetime.nil?