From 7621b539374ce5d34c712a6a8fd8d9d1ce453798 Mon Sep 17 00:00:00 2001 From: Darius Foo Date: Mon, 13 Jul 2015 16:40:51 +0800 Subject: [PATCH] Hid link to new achievement conditions if none are valid --- app/views/course/achievements/_form.html.slim | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/views/course/achievements/_form.html.slim b/app/views/course/achievements/_form.html.slim index 206f0fc723a..476ada08b00 100644 --- a/app/views/course/achievements/_form.html.slim +++ b/app/views/course/achievements/_form.html.slim @@ -15,9 +15,10 @@ aria-haspopup="true"] span = t('course.condition.new.header') ul.dropdown-menu.dropdown-menu-right aria-labelledby="new-condition-dropdown-btn" - li = link_to t('course.condition.achievements.new.header'), - new_course_achievement_condition_achievement_path(current_course, - @achievement) + - if valid_achievement_conditions(@achievement).any? + li = link_to t('course.condition.achievements.new.header'), + new_course_achievement_condition_achievement_path(current_course, + @achievement) li = link_to t('course.condition.levels.new.header'), new_course_achievement_condition_level_path(current_course, @achievement)