mattyr/sidecloq

View on GitHub
web/views/recurring.erb

Summary

Maintainability
Test Coverage
<h3><%= t('RecurringJobs') %></h3>

<div class="table_container">
  <table class="table table-hover table-bordered table-striped table-white">
    <thead>
      <tr>
        <th><%= t('Name') %></th>
        <th><%= t('Cron') %></th>
        <th><%= t('Job') %></th>
        <th><%= t('Queue') %></th>
        <th><%= t('Arguments') %></th>
        <th><%= t('Actions') %></th>
      </tr>
    </thead>

    <tbody>
      <% @schedule.job_specs.each do |name, job_spec| %>
        <tr>
          <td><%= name %></td>
          <td><%= job_spec.fetch 'cron', job_spec['every'] %></td>
          <td><%= job_spec['class'] %></td>
          <td>
            <a href="<%= root_path %>queues/<%= job_spec.fetch('queue', 'default') %>"><%= job_spec.fetch('queue', 'default') %></a>
          </td>
          <td><%= job_spec['args'] %></td>
          <td>
            <form action="<%= root_path %>recurring/<%= CGI.escape(name).gsub('+', '%20') %>/enqueue" method="post">
              <%= csrf_tag if respond_to?(:csrf_tag) %>
              <input class='btn btn-primary btn-xs' type="submit" name="enque" value="<%= t('EnqueueNow') %>"/>
            </form>
          </td>
        </tr>
      <% end %>
    </tbody>
  </table>
</div>