From 2db1f7e0b7f062100d7b017c4ea9886ba8d1a4bd Mon Sep 17 00:00:00 2001 From: julianguyen Date: Fri, 27 May 2016 17:39:40 -0700 Subject: [PATCH] Added warning messages in Categories/Moods show pages --- app/views/categories/show.html.erb | 9 +++++++++ app/views/moods/show.html.erb | 9 +++++++++ app/views/shared/_tag_usage.html.erb | 12 ++++-------- 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/app/views/categories/show.html.erb b/app/views/categories/show.html.erb index ff07b959a1..962a79270a 100644 --- a/app/views/categories/show.html.erb +++ b/app/views/categories/show.html.erb @@ -1,3 +1,12 @@ +<% if !@category.description.blank? && @category.description.length > 0 %> <%= raw(@category.description) %> +<% else %> +
+ <%= t('warnings.no_description') %> +
+
+ <%= t('warnings.yes_description') %> +
+<% end %> <%= render :partial => '/shared/tag_usage', locals: { data: @category.id, data_type: 'category', userid: @category.userid } %> \ No newline at end of file diff --git a/app/views/moods/show.html.erb b/app/views/moods/show.html.erb index a56fe78e14..51cffbd641 100644 --- a/app/views/moods/show.html.erb +++ b/app/views/moods/show.html.erb @@ -1,3 +1,12 @@ +<% if !@mood.description.blank? && @mood.description.length > 0 %> <%= raw(@mood.description) %> +<% else %> +
+ <%= t('warnings.no_description') %> +
+
+ <%= t('warnings.yes_description') %> +
+<% end %> <%= render :partial => '/shared/tag_usage', locals: { data: @mood.id, data_type: 'mood', userid: @mood.userid } %> diff --git a/app/views/shared/_tag_usage.html.erb b/app/views/shared/_tag_usage.html.erb index 0282e43385..890873a9a7 100644 --- a/app/views/shared/_tag_usage.html.erb +++ b/app/views/shared/_tag_usage.html.erb @@ -1,10 +1,7 @@ -<% if local_assigns[:data_type] == 'category' || local_assigns[:data_type] == 'mood' ||local_assigns[:data_type] == 'strategy' %> +<% if local_assigns[:data_type] == 'category' || local_assigns[:data_type] == 'mood' || local_assigns[:data_type] == 'strategy' %> + +
-<% if local_assigns[:data_type] == 'strategy' %> -
-<% else %> -
-<% end %> <% usage = tag_usage(local_assigns[:data], local_assigns[:data_type], local_assigns[:userid]) %> <% if local_assigns[:data_type] == 'category' %> @@ -64,5 +61,4 @@ <% end %>
- -<% end %> \ No newline at end of file +<% end %>