Skip to content

Commit 9702020

Browse files
committed
[Fix] refactor _mini and fix admin dashboard query
1 parent 2173325 commit 9702020

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

app/views/admin/index.html.slim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
h4 Pro tips created in networks in past week
7878
section
7979
ul.networks
80-
-Network.where('protips_count_cache =! 0').order('protips_count_cache desc').each do |network|
80+
-Network.where('protips_count_cache > 0').order('protips_count_cache desc').each do |network|
8181
li.network
8282
span.name= link_to network.name, network_path(network)
8383
span.created_at= network.protips.where('created_at > ?', 1.week.ago).count

app/views/protips/_mini.html.haml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,31 +4,35 @@
44
-unless protip.best_stat.nil? || best_stat_value(protip) == 0
55
%span{:class => protip_stat_class(protip)}
66
= formatted_best_stat_value(protip) unless best_stat_name(protip) =~ /hawt/
7+
8+
-# We should remove this to cache , deleting should be from dashboard
79
-if protip_owner?(protip, current_user)
810
=link_to(' ', protip_path(protip.public_id), :method => :delete, :class => 'delete-tip', :title => 'remove protip', :confirm => "Are you sure you permanently want to remove this pro tip?")
11+
912
= link_to protip.title, protip_or_link_path(protip), 'data-action' => 'view protip', 'data-from' => 'mini protip', :class => "title hyphenate track x-mode-#{mode || 'fullpage'}"
1013
%footer.cf
14+
-# We should remove this to cache
1115
-if is_admin?
1216
%ul
1317
%li.admin
1418
%p== #{distance_of_time_in_words_to_now(protip.created_at)} ago
1519
%ul.author
16-
-unless protip.user.nil?
20+
-if protip.user.present?
1721
%li.user
1822
by
1923
=link_to protip.user.username, profile_path(protip.user.username), 'data-action' => 'view protip author', 'data-from' => 'mini protip', :title => "Authored by: #{protip.user.username}", :class => "track"
20-
-unless protip.team.nil?
24+
-if protip.team.present?
2125
%li.team
2226
of
2327
=link_to protip.team.name, teamname_path(protip.team.slug), 'data-action' => 'view team', 'data-from' => 'mini protip', :class => "track"
2428
%ul.avatars
25-
-unless protip.user.nil?
29+
-if protip.user.present?
2630
%li.user
2731
=link_to profile_path(protip.user.username) do
2832
=image_tag(protip.user.avatar_url)
29-
-unless protip.team.nil?
33+
-if protip.team.present?
3034
%li.team
3135
=link_to teamname_path(protip.team.slug) do
32-
=image_tag(protip.team.avatar) unless protip.team.avatar.blank?
36+
=image_tag(protip.team.avatar.url)
3337
-if protip.team && protip.team.hiring
3438
%a.job{:href => teamname_path(protip.team.slug)}

0 commit comments

Comments
 (0)