Commit ee44123

mo <mo.khan@gmail.com>
2018-12-08 02:07:05
fix erblinter errors.
1 parent e6c70fa
app/views/application/_spinner.html.erb
@@ -1,1 +1,1 @@
-<div class="spinner"><svg xmlns="http://www.w3.org/2000/svg" width="25" height="25" viewBox="0 0 25 25"><defs><style>line{fill:none;stroke:#1a1a1a;stroke-linecap:round;stroke-miterlimit:10;stroke-width:2px;}.o25{opacity:0.25;}.o85{opacity:0.85;}.o7{opacity:0.7;}.o55{opacity:0.55;}.o35{opacity:0.35;}</style></defs><line x1="12.5" y1="2" x2="12.5" y2="7.05463"/><line class="o25" x1="12.5" y1="23" x2="12.5" y2="17.94537"/><line class="o85" x1="7.25" y1="3.40674" x2="9.77942" y2="7.78778"/><line class="o25" x1="17.75" y1="21.59326" x2="15.22058" y2="17.21222"/><line class="o25" x1="17.21222" y1="15.22058" x2="21.59326" y2="17.75"/><line class="o7" x1="7.78778" y1="9.77942" x2="3.40674" y2="7.25"/><line class="o25" x1="23" y1="12.5" x2="17.94537" y2="12.5"/><line class="o55" x1="7.05463" y1="12.5" x2="2" y2="12.5"/><line class="o35" x1="7.78778" y1="15.22058" x2="3.40674" y2="17.75"/><line class="o25" x1="21.59326" y1="7.25" x2="17.21222" y2="9.77942"/><line class="o25" x1="9.77942" y1="17.21222" x2="7.25" y2="21.59326"/><line class="o25" x1="17.75" y1="3.40674" x2="15.22058" y2="7.78778"/></svg></div>
+<div class="spinner"><svg xmlns="http://www.w3.org/2000/svg" width="25" height="25" viewBox="0 0 25 25"><defs><style>line{fill:none;stroke:#1a1a1a;stroke-linecap:round;stroke-miterlimit:10;stroke-width:2px;}.o25{opacity:0.25;}.o85{opacity:0.85;}.o7{opacity:0.7;}.o55{opacity:0.55;}.o35{opacity:0.35;}</style></defs><line x1="12.5" y1="2" x2="12.5" y2="7.05463" /><line class="o25" x1="12.5" y1="23" x2="12.5" y2="17.94537" /><line class="o85" x1="7.25" y1="3.40674" x2="9.77942" y2="7.78778" /><line class="o25" x1="17.75" y1="21.59326" x2="15.22058" y2="17.21222" /><line class="o25" x1="17.21222" y1="15.22058" x2="21.59326" y2="17.75" /><line class="o7" x1="7.78778" y1="9.77942" x2="3.40674" y2="7.25" /><line class="o25" x1="23" y1="12.5" x2="17.94537" y2="12.5" /><line class="o55" x1="7.05463" y1="12.5" x2="2" y2="12.5" /><line class="o35" x1="7.78778" y1="15.22058" x2="3.40674" y2="17.75" /><line class="o25" x1="21.59326" y1="7.25" x2="17.21222" y2="9.77942" /><line class="o25" x1="9.77942" y1="17.21222" x2="7.25" y2="21.59326" /><line class="o25" x1="17.75" y1="3.40674" x2="15.22058" y2="7.78778" /></svg></div>
app/views/errors/bad_request.html.erb
@@ -1,7 +1,7 @@
 <div class="container">
   <div class="row">
     <div class="col">
-      <h1>400 - Bad Request</h1>
+      <h1><%= t('.title') %></h1>
     </div>
   </div>
 </div>
app/views/errors/forbidden.html.erb
@@ -1,7 +1,7 @@
 <div class="container">
   <div class="row">
     <div class="col">
-      <h1>Forbidden</h1>
+      <h1><%= t('.title') %></h1>
       <% if @model %>
         <ul class="list-unstyled">
           <% @model.errors.full_messages.each do |message| %>
app/views/errors/not_found.html.erb
@@ -1,7 +1,7 @@
 <div class="container">
   <div class="row">
     <div class="col">
-      <h1>404 - Not Found</h1>
+      <h1><%= t('.title') %></h1>
     </div>
   </div>
 </div>
app/views/layouts/application.html.erb
@@ -2,7 +2,7 @@
 <html lang="<%= I18n.locale %>">
   <head>
     <title><%= t('.title') %></title>
-    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
+    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
     <%= csrf_meta_tags %>
 
     <%= javascript_pack_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
app/views/mfas/new.html.erb
@@ -1,7 +1,7 @@
 <div class="container">
   <div class="row">
     <div class="col">
-      <h1>MFA Login</h1>
+      <h1><%= t('.title') %></h1>
       <%= form_for :mfa, url: mfa_path, method: :post do |form| %>
         <div class="form-group">
           <%= form.number_field :code, class: 'form-control', autofocus: true, required: :required %>
app/views/my/audits/index.html.erb
@@ -4,20 +4,20 @@
       <h1><%= t('.title') %> <%= @audits.count %></h1>
       <table class="table">
         <thead>
-          <th>Action</th>
-          <th>Auditable</th>
-          <th>Changes</th>
-          <th>Associated</th>
-          <th>User</th>
-          <th>Version</th>
-          <th>Remote Address</th>
-          <th>Created At</th>
+          <th><%= t('.action') %></th>
+          <th><%= t('.auditable') %></th>
+          <th><%= t('.changes') %></th>
+          <th><%= t('.associated') %></th>
+          <th><%= t('.user') %></th>
+          <th><%= t('.version') %></th>
+          <th><%= t('.remote_address') %></th>
+          <th><%= t('.created_at') %></th>
         </thead>
         <tbody>
         <% @audits.each do |audit| %>
           <tr>
             <td><%= audit.action %></td>
-            <td><%= audit.auditable.class if audit.auditable %></td>
+            <td><%= audit&.auditable&.class %></td>
             <td><%= audit.audited_changes %></td>
             <td><%= audit.associated&.flipper_id %></td>
             <td><%= audit.user&.email %></td>
app/views/my/clients/index.html.erb
@@ -5,9 +5,9 @@
       <%= link_to t(".new"), new_my_client_path, class: 'btn' %>
       <table class="table">
         <thead>
-          <th>Client ID</th>
-          <th>Name</th>
-          <th>Redirect URIs</th>
+          <th><%= t('.client_id') %></th>
+          <th><%= t('.name') %></th>
+          <th><%= t('.redirect_uris') %></th>
         </thead>
         <tbody>
         <% @clients.each do |client| %>
app/views/my/clients/new.html.erb
@@ -1,7 +1,8 @@
 <div class="container">
   <div class="row">
     <div class="col">
-      <h1>Client</h1>
+      <h1><%= t('.title') %></h1>
+
       <div data-controller="clients--new">
         <%= form_for @client, url: my_clients_path, method: :post do |form| %>
           <div class="form-group">
app/views/my/dashboards/show.html.erb
@@ -1,10 +1,10 @@
 <div class="container">
   <div class="row">
     <div class="col">
-      <h1>Dashboard</h1>
+      <h1><%= t('.title') %></h1>
       <table class="table">
         <thead>
-          <th>Entity ID</th>
+          <th></th>
         </thead>
         <tbody>
         <% @metadatum.each do |metadata| %>
app/views/my/mfas/edit.html.erb
@@ -1,11 +1,11 @@
 <div class="container">
   <div class="row">
     <div class="col">
-      <h1>Multi-Factor Authentication (MFA)</h1>
+      <h1><%= t('.title') %></h1>
       <div data-controller="mfa--setup">
         <canvas id="canvas" data-target="mfa--setup.canvas"></canvas>
-        <p>Secret: <%= current_user.mfa.secret %></p>
-        <p>Provisioning URI: <%= current_user.mfa.provisioning_uri %></p>
+        <p><%= t('.secret') %> <%= current_user.mfa.secret %></p>
+        <p><%= t('.provisioning_uri') %> <%= current_user.mfa.provisioning_uri %></p>
 
         <%= form_for current_user, url: my_mfa_path, method: :delete do |form| %>
           <%= form.hidden_field :mfa_secret, data: { target: 'mfa--setup.secret' } %>
app/views/my/mfas/new.html.erb
@@ -1,11 +1,11 @@
 <div class="container">
   <div class="row">
     <div class="col">
-      <h1>Multi Factor Authentication - Setup</h1>
+      <h1><%= t('.title') %></h1>
       <div data-controller="mfa--setup">
         <canvas id="canvas" data-target="mfa--setup.canvas"></canvas>
-        <p>Secret: <%= current_user.mfa.secret %></p>
-        <p>Provisioning URI: <%= current_user.mfa.provisioning_uri %></p>
+        <p><%= t('.secret') %> <%= current_user.mfa.secret %></p>
+        <p><%= t('.provisioning_uri') %> <%= current_user.mfa.provisioning_uri %></p>
 
         <%= form_for current_user, url: my_mfa_path, method: :post do |form| %>
           <%= form.hidden_field :mfa_secret, data: { target: 'mfa--setup.secret' } %>
app/views/my/sessions/index.html.erb
@@ -4,9 +4,9 @@
       <h1><%= t('.title') %></h1>
       <table class="table">
         <thead>
-          <th>Last Used</th>
-          <th>User Agent</th>
-          <th>IP Address</th>
+          <th><%= t('.last_used') %></th>
+          <th><%= t('.user_agent') %></th>
+          <th><%= t('.ip_address') %></th>
         </thead>
         <tbody>
         <% @sessions.each do |user_session| %>
app/views/responses/_response.html.erb
@@ -1,7 +1,7 @@
 <div class="container">
   <div class="row">
     <div class="col">
-      <h1>Sending Response to Service Provider</h1>
+      <h1><%= t('.title') %></h1>
       <%= render partial: 'spinner' %>
       <%= form_tag(@url, data: { controller: 'sessions--response' }) do %>
         <% @saml_params.each do |(key, value)| %>
app/views/sessions/new.html.erb
@@ -1,7 +1,7 @@
 <div class="container">
   <div class="row">
     <div class="col">
-      <h1>Login</h1>
+      <h1><%= t('.title') %></h1>
       <%= form_for :user, url: session_path, method: :post, data: { controller: 'sessions--new' } do |form| %>
         <div class="form-group">
           <%= form.email_field :email, class: 'form-control', placeholder: User.human_attribute_name(:email), autofocus: true, required: :required, data: { target: 'sessions--new.email', action: "keyup->sessions--new#validate" } %>
bin/autofix
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+yarn lint:autofix
+bundle exec erblint --autocorrect --enable-all-linters --lint-all
+bundle exec rubocop -a
config/locales/en.yml
@@ -15,6 +15,13 @@ en:
       logout: Logout
       mfa: MFA
       sessions: Sessions
+  errors:
+    bad_request:
+      title: 400 - Bad Request
+    forbidden:
+      title: Forbidden
+    not_found:
+      title: 404 - Not Found
   layouts:
     application:
       title: Proof
@@ -22,26 +29,52 @@ en:
   mfas:
     new:
       login: Login
+      title: MFA Login
   my:
     audits:
       index:
+        action: Action
+        associated: Associated
+        auditable: Auditable
+        changes: Changes
+        created_at: Created at
+        remote_address: Remote address
         title: Audits
+        user: User
+        version: Version
     clients:
       create:
         success: Client ID %{client_id} Client Secret %{client_secret}
       index:
+        client_id: Client
+        name: Name
         new: New
+        redirect_uris: Redirect uris
         title: OAuth Clients
       new:
         cancel: Cancel
         enable: Enable
+        title: Title
+    dashboards:
+      show:
+        title: Dashboard
     mfas:
+      edit:
+        provisioning_uri: Provisioning uri
+        secret: Secret
+        title: Multi-Factor Authentication (MFA)
       new:
         cancel: Cancel
         enable: Enable
+        provisioning_uri: Provisioning URI
+        secret: Secret
+        title: Multi Factor Authentication - Setup
     sessions:
       index:
+        ip_address: Ip address
+        last_used: Last used
         title: Sessions
+        user_agent: User agent
   oauth:
     authorizations:
       show:
@@ -55,6 +88,9 @@ en:
     new:
       register: Register
       title: Register
+  responses:
+    response:
+      title: Sending Response to Service Provider
   scim:
     errors:
       user:
@@ -62,3 +98,4 @@ en:
   sessions:
     new:
       login: Login
+      title: Login
.erb-lint.yml
@@ -1,5 +1,6 @@
 ---
 exclude:
+  - "*/app/views/application/_flash*"
   - "*/doc/_includes*"
   - "*/pkg/*"
   - "*/vendor/bundle*"