module RestFtpDaemon module ViewsHelper def dashboard_feature name, enabled, message_on = "enabled", message_of = "disabled" # Build classes class_status = enabled ? 'enabled' : 'disabled' classes = "btn btn-default feature-#{class_status}" # Build title title_status = enabled ? message_on : message_of title = "#{name}: #{title_status}" return sprintf( '
', classes, title, name, title ) end def dashboard_job_url job "#{MOUNT_JOBS}/#{job.id}" if job.respond_to? :id end def job_runs_style runs return "label-outline" if runs <= 0 return "label-info" if runs == 1 return "label-warning" if runs == 2 return "label-danger" if runs > 2 end def location_style uri case uri when URI::FILE "info" when URI::FTP "warning" when URI::FTPES, URI::FTPS, URI::SFTP "success" when URI::S3 "primary" else "default" end 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( '