Skip to content

Commit

Permalink
Added warning messages in Categories/Moods show pages
Browse files Browse the repository at this point in the history
  • Loading branch information
julianguyen committed May 28, 2016
1 parent deab9c8 commit 2db1f7e
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 8 deletions.
9 changes: 9 additions & 0 deletions app/views/categories/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
<% if !@category.description.blank? && @category.description.length > 0 %>
<%= raw(@category.description) %>
<% else %>
<div class="main_message">
<%= t('warnings.no_description') %>
</div>
<div class="message_text no_margin_bottom">
<%= t('warnings.yes_description') %>
</div>
<% end %>

<%= render :partial => '/shared/tag_usage', locals: { data: @category.id, data_type: 'category', userid: @category.userid } %>
9 changes: 9 additions & 0 deletions app/views/moods/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
<% if !@mood.description.blank? && @mood.description.length > 0 %>
<%= raw(@mood.description) %>
<% else %>
<div class="main_message">
<%= t('warnings.no_description') %>
</div>
<div class="message_text no_margin_bottom">
<%= t('warnings.yes_description') %>
</div>
<% end %>

<%= render :partial => '/shared/tag_usage', locals: { data: @mood.id, data_type: 'mood', userid: @mood.userid } %>
12 changes: 4 additions & 8 deletions app/views/shared/_tag_usage.html.erb
Original file line number Diff line number Diff line change
@@ -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' %>

<div id="tag_usage" class="small_margin_top">

<% if local_assigns[:data_type] == 'strategy' %>
<div id="tag_usage" class="small_margin_top">
<% else %>
<div id="tag_usage">
<% end %>
<% usage = tag_usage(local_assigns[:data], local_assigns[:data_type], local_assigns[:userid]) %>

<% if local_assigns[:data_type] == 'category' %>
Expand Down Expand Up @@ -64,5 +61,4 @@
<% end %>

</div>

<% end %>
<% end %>

0 comments on commit 2db1f7e

Please sign in to comment.