Noosfero/noosfero

View on GitHub
plugins/spaminator/views/spaminator_plugin_admin/index.html.erb

Summary

Maintainability
Test Coverage
<h1><%= _('Spaminator settings')%></h1>

<%= form_for(:settings) do |f| %>

  <div id="spaminator-config-fields">
    <%= labelled_form_field _('Period (days) for scanning spammers'), f.text_field(:period, :size => 4) %>

    <p id="deploy-status">
      <% if @settings.deployed.nil? %>
        <%= _("Spaminator was never deployed. While deployed, Spaminator will periodically scan your social network for spams. Do it now!") %>
      <% elsif @settings.deployed %>
        <%= _("Spaminator is deployed.") %>
      <% else %>
        <%= _("Spaminator is withhold.") %>
      <% end %>
    </p>
    <p id="next-run-status">
      <% if @settings.scanning %>
        <%= _("Spaminator is scanning...") %>
      <% elsif @settings.deployed %>
        <%= _("Next scan on %s days.") % @next_run %>
      <% end %>
    </p>

    <% content = @settings.scanning ? _('Scanning...') : _('Scan now!') %>
    <% klass = @settings.scanning ? 'disabled' : '' %>
    <%= button(:search, content, {:action => 'scan'}, :class => klass, :disabled => @settings.scanning) %>
    <% if !@settings.scanning %>
      <%= button(:right, _('Deploy'), {:action => 'deploy'}, :title => _('Schedule next scan for the period defined')) if !@settings.deployed %>
      <%= button(:cancel, _('Withhold'), {:action => 'withhold'}, :title => _('Cancel next scheduled scans')) if @settings.deployed %>
    <% end %>

    <%= button_bar do %>
      <%= submit_button(:save, c_('Save'), :cancel => {:controller => 'plugins', :action => 'index'}) %>
    <% end %>
  </div>

  <table id="spaminator-report-table">
    <tr>
      <th><%= _('Date') %></th>
      <th><%= _('Spams') %></th>
      <th><%= _('Spammers')%></th>
    </tr>
    <% @reports.each do |report| %>
      <tr>
        <td><%= report.formated_date %></td>
        <td title='<%= _('Spam comments found / number of comments verified') %>'><%= "#{report.spams} / #{report.total_comments}" %></td>
        <td title='<%= _('Spammers found / number of users verified') %>'><%= "#{report.spammers} / #{report.total_people}" %></td>
      </tr>
    <% end %>
    <tr id="spaminator-reports-see-all">
      <% content = @reports_count > 0 ? link_to(_('SEE FULL REPORTS (%s)') % @reports_count, :action => 'reports') : _('No Report') %>
      <td colspan='3'><%= content %></td>
    </tr>
  </table>

  <br style='clear: both'/>

<% end %>