From 7ed78a2cfd909255d0b74987b90097c790fb2b34 Mon Sep 17 00:00:00 2001 From: Maximilian Grundke Date: Wed, 13 Dec 2017 07:37:49 +0100 Subject: [PATCH] Add UI for anomaly detection flag --- app/controllers/exercise_collections_controller.rb | 2 +- app/views/exercise_collections/_form.html.slim | 3 +++ app/views/exercise_collections/show.html.slim | 1 + config/locales/de.yml | 1 + config/locales/en.yml | 1 + 5 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/controllers/exercise_collections_controller.rb b/app/controllers/exercise_collections_controller.rb index 415c77f8..6747480d 100644 --- a/app/controllers/exercise_collections_controller.rb +++ b/app/controllers/exercise_collections_controller.rb @@ -47,6 +47,6 @@ class ExerciseCollectionsController < ApplicationController end def exercise_collection_params - params[:exercise_collection].permit(:name, :user_id, :user_type, :exercise_ids => []) + params[:exercise_collection].permit(:name, :use_anomaly_detection, :user_id, :user_type, :exercise_ids => []) end end diff --git a/app/views/exercise_collections/_form.html.slim b/app/views/exercise_collections/_form.html.slim index f13174a7..c204db47 100644 --- a/app/views/exercise_collections/_form.html.slim +++ b/app/views/exercise_collections/_form.html.slim @@ -6,6 +6,9 @@ .form-group = f.label(t('activerecord.attributes.exercise_collections.name')) = f.text_field(:name, class: 'form-control', required: true) + .form-group + = f.label(t('activerecord.attributes.exercise_collections.use_anomaly_detection')) + = f.check_box(:use_anomaly_detection, {class: 'form-control'}) .form-group = f.label(t('activerecord.attributes.exercise_collections.user')) = f.collection_select(:user_id, users, :id, :name, {}, {class: 'form-control'}) diff --git a/app/views/exercise_collections/show.html.slim b/app/views/exercise_collections/show.html.slim index fd643f3f..6de1695f 100644 --- a/app/views/exercise_collections/show.html.slim +++ b/app/views/exercise_collections/show.html.slim @@ -4,6 +4,7 @@ h1 = row(label: 'exercise_collections.name', value: @exercise_collection.name) = row(label: 'exercise_collections.user', value: link_to(@exercise_collection.user.name, @exercise_collection.user)) += row(label: 'exercise_collections.use_anomaly_detection', value: @exercise_collection.use_anomaly_detection) = row(label: 'exercise_collections.updated_at', value: @exercise_collection.updated_at) h4 = t('activerecord.attributes.exercise_collections.exercises') diff --git a/config/locales/de.yml b/config/locales/de.yml index 320e3df4..e372481b 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -125,6 +125,7 @@ de: id: "ID" name: "Name" user: "Verantwortlicher" + use_anomaly_detection: "Abweichungen in der Arbeitszeit erkennen" updated_at: "Letzte Änderung" exercises: "Aufgaben" models: diff --git a/config/locales/en.yml b/config/locales/en.yml index 0427403d..647eed3f 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -125,6 +125,7 @@ en: id: "ID" name: "Name" user: "Associated User" + use_anomaly_detection: "Enable Worktime Anomaly Detection" updated_at: "Last Update" exercises: "Exercises" models: