From b72b5953881ba09ef6b8a440a8805c60d3de1fad Mon Sep 17 00:00:00 2001 From: yqbk Date: Wed, 3 Aug 2016 14:32:01 +0200 Subject: [PATCH 1/3] implement dropdown menu --- app/views/exercises/index.html.slim | 14 +++++++++++--- config/locales/de.yml | 1 + config/locales/en.yml | 1 + 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/app/views/exercises/index.html.slim b/app/views/exercises/index.html.slim index ae018e82..9c0b14ee 100644 --- a/app/views/exercises/index.html.slim +++ b/app/views/exercises/index.html.slim @@ -32,12 +32,20 @@ h1 = Exercise.model_name.human(count: 2) td = exercise.files.teacher_defined_tests.count td = exercise.maximum_score td.public data-value=exercise.public? = symbol_for(exercise.public?) - td = link_to(t('shared.show'), exercise) if policy(exercise).show? td = link_to(t('shared.edit'), edit_exercise_path(exercise)) if policy(exercise).edit? - td = link_to(t('shared.destroy'), exercise, data: {confirm: t('shared.confirm_destroy')}, method: :delete) if policy(exercise).destroy? - td = link_to(t('.clone'), clone_exercise_path(exercise), data: {confirm: t('shared.confirm_destroy')}, method: :post) if policy(exercise).clone? td = link_to(t('.implement'), implement_exercise_path(exercise)) if policy(exercise).implement? td = link_to(t('shared.statistics'), statistics_exercise_path(exercise)) if policy(exercise).statistics? + td + .btn-group + button.btn.btn-primary-outline.btn-xs.dropdown-toggle data-toggle="dropdown" type="button" = t('shared.actions_button') + span.caret + span.sr-only Toggle Dropdown + ul.dropdown-menu.pull-right role="menu" + li = link_to(t('shared.show'), exercise) if policy(exercise).show? + li = link_to(t('shared.destroy'), exercise, data: {confirm: t('shared.confirm_destroy')}, method: :delete) if policy(exercise).destroy? + li = link_to(t('.clone'), clone_exercise_path(exercise), data: {confirm: t('shared.confirm_destroy')}, method: :post) if policy(exercise).clone? + li = link_to(t('shared.statistics'), statistics_exercise_path(exercise)) if policy(exercise).statistics? + = render('shared/pagination', collection: @exercises) p = render('shared/new_button', model: Exercise) diff --git a/config/locales/de.yml b/config/locales/de.yml index 53df1858..06085b9d 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -402,6 +402,7 @@ de: created_at: Erstellt destroy: Löschen edit: Bearbeiten + actions_button: 'Andere Aktionen' errors_one: 'Beim Speichern ist ein Fehler aufgetreten' errors_other: 'Beim Speichern sind %{count} Fehler aufgetreten' help: diff --git a/config/locales/en.yml b/config/locales/en.yml index 1e72cb34..c37fcd80 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -402,6 +402,7 @@ en: created_at: Created At destroy: Delete edit: Edit + actions_button: 'Other actions' errors_one: 'An error prohibited this %{model} from being saved' errors_other: '%{count} errors prohibited this %{model} from being saved' help: From bc8abf851db6f0875e1fdc5d16d8ecf75b32f9ad Mon Sep 17 00:00:00 2001 From: yqbk Date: Wed, 3 Aug 2016 14:35:15 +0200 Subject: [PATCH 2/3] remove statistics --- app/views/exercises/index.html.slim | 1 - 1 file changed, 1 deletion(-) diff --git a/app/views/exercises/index.html.slim b/app/views/exercises/index.html.slim index 9c0b14ee..3a7bec22 100644 --- a/app/views/exercises/index.html.slim +++ b/app/views/exercises/index.html.slim @@ -45,7 +45,6 @@ h1 = Exercise.model_name.human(count: 2) li = link_to(t('shared.show'), exercise) if policy(exercise).show? li = link_to(t('shared.destroy'), exercise, data: {confirm: t('shared.confirm_destroy')}, method: :delete) if policy(exercise).destroy? li = link_to(t('.clone'), clone_exercise_path(exercise), data: {confirm: t('shared.confirm_destroy')}, method: :post) if policy(exercise).clone? - li = link_to(t('shared.statistics'), statistics_exercise_path(exercise)) if policy(exercise).statistics? = render('shared/pagination', collection: @exercises) p = render('shared/new_button', model: Exercise) From 37aac677d1369ae86fd247bd1e8c38a80a836b11 Mon Sep 17 00:00:00 2001 From: yqbk Date: Wed, 3 Aug 2016 14:37:55 +0200 Subject: [PATCH 3/3] remove author --- app/views/exercises/index.html.slim | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/views/exercises/index.html.slim b/app/views/exercises/index.html.slim index 3a7bec22..9ad5cc25 100644 --- a/app/views/exercises/index.html.slim +++ b/app/views/exercises/index.html.slim @@ -13,7 +13,6 @@ h1 = Exercise.model_name.human(count: 2) thead tr th = sort_link(@search, :title, t('activerecord.attributes.exercise.title')) - th = sort_link(@search, :user_id, t('activerecord.attributes.exercise.user')) th = sort_link(@search, :execution_environment_id, t('activerecord.attributes.exercise.execution_environment')) th = t('.test_files') th = t('activerecord.attributes.exercise.maximum_score') @@ -27,7 +26,6 @@ h1 = Exercise.model_name.human(count: 2) - @exercises.each do |exercise| tr data-id=exercise.id td = exercise.title - td = link_to_if(exercise.author && policy(exercise.author).show?, exercise.author, exercise.author) td = link_to_if(exercise.execution_environment && policy(exercise.execution_environment).show?, exercise.execution_environment, exercise.execution_environment) td = exercise.files.teacher_defined_tests.count td = exercise.maximum_score