accessd/rails-settings-ui

View on GitHub
app/views/rails_settings_ui/settings/index.html.erb

Summary

Maintainability
Test Coverage
<ol class="breadcrumb">
  <li class="active">
    <%= t('settings.index.title') %>
  </li>
</ol>
<% flash.each do |key, value| %>
  <div class="alert alert-<%= key %>"><%= value %></div>
<% end %>
<%= form_tag [:update_all], method: :put, class: 'form' do %>
  <table class="table table-striped">
    <thead>
      <tr>
        <th>
          <%= t('settings.index.description') %>
        </th>
        <th>
          <%= t('settings.index.value') %>
        </th>
      </tr>
    </thead>
    <tbody>
    <% @settings.each do |name, value| %>
      <% errors = @errors.has_key?(name.to_sym) ? @errors[name.to_sym].join(', ') : nil %>
      <tr data-name="<%= name %>">
        <td>
          <%= I18n.t("settings.attributes.#{name}.name") %>
        </td>
        <td class="setting-value">
          <div class="form-group <%= errors ? 'has-error' : '' %>">
            <%= setting_field(name, value) %>
            <%- if errors.present? %>
              <span class="help-block"><%= errors %></span>
            <% end %>
          </div>
        </td>
      </tr>
    <% end %>
    </tbody>
  </table>
  <%= submit_tag t('settings.index.save_all'), class: 'btn btn-primary btn-lg' %>
<% end %>