prettify tagsub names

This commit is contained in:
albert
2013-02-22 14:22:56 -05:00
parent 358b2383f1
commit 127c0874fc
3 changed files with 6 additions and 4 deletions

View File

@@ -12,6 +12,10 @@ class TagSubscription < ActiveRecord::Base
self.name = name.gsub(/\W/, "_") self.name = name.gsub(/\W/, "_")
end end
def pretty_name
name.tr("_", " ")
end
def initialize_creator def initialize_creator
self.creator_id = CurrentUser.id self.creator_id = CurrentUser.id
end end

View File

@@ -4,7 +4,6 @@
<table class="striped" width="100%"> <table class="striped" width="100%">
<thead> <thead>
<tr> <tr>
<th>Creator</th>
<th>Name</th> <th>Name</th>
<th>Tag Query</th> <th>Tag Query</th>
<% if CurrentUser.is_admin? %> <% if CurrentUser.is_admin? %>
@@ -16,8 +15,7 @@
<tbody> <tbody>
<% @tag_subscriptions.each do |tag_subscription| %> <% @tag_subscriptions.each do |tag_subscription| %>
<tr> <tr>
<td><%= link_to tag_subscription.creator.name, user_path(tag_subscription.creator_id) %></td> <td><%= tag_subscription.pretty_name %></td>
<td><%= tag_subscription.name %></td>
<td><%= tag_subscription.tag_query %></td> <td><%= tag_subscription.tag_query %></td>
<td><%= tag_subscription.post_id_array.size %></td> <td><%= tag_subscription.post_id_array.size %></td>
<td> <td>

View File

@@ -34,7 +34,7 @@
<h2>Subscriptions</h2> <h2>Subscriptions</h2>
<% @presenter.subscriptions.each do |subscription| %> <% @presenter.subscriptions.each do |subscription| %>
<div class="box"> <div class="box">
<h3><%= link_to subscription.name, posts_path(:tags => "sub:#{@user.name}:#{subscription.name}") %></h3> <h3><%= link_to subscription.pretty_name, posts_path(:tags => "sub:#{@user.name}:#{subscription.name}") %></h3>
<div> <div>
<% @presenter.posts_for_subscription(subscription).each do |post| %> <% @presenter.posts_for_subscription(subscription).each do |post| %>