reorganized ui for tag subscriptions
This commit is contained in:
@@ -23,7 +23,7 @@ class TagSubscriptionsController < ApplicationController
|
||||
|
||||
def create
|
||||
@tag_subscription = TagSubscription.create(params[:tag_subscription])
|
||||
respond_with(@tag_subscription)
|
||||
respond_with(@tag_subscription, :location => tag_subscriptions_path)
|
||||
end
|
||||
|
||||
def update
|
||||
|
||||
@@ -4,7 +4,7 @@ class TagSubscription < ActiveRecord::Base
|
||||
before_validation :initialize_post_ids, :on => :create
|
||||
before_save :normalize_name
|
||||
before_save :limit_tag_count
|
||||
attr_accessible :name, :tag_query, :post_ids, :is_visible_on_profile
|
||||
attr_accessible :name, :tag_query, :post_ids, :is_public, :is_visible_on_profile
|
||||
validates_presence_of :name, :tag_query, :is_public, :creator_id
|
||||
|
||||
def normalize_name
|
||||
@@ -42,6 +42,10 @@ class TagSubscription < ActiveRecord::Base
|
||||
user.is_moderator? || creator_id == user.id
|
||||
end
|
||||
|
||||
def post_id_array
|
||||
post_ids.split(/,/)
|
||||
end
|
||||
|
||||
def self.search(params)
|
||||
q = scoped
|
||||
return q if params.blank?
|
||||
|
||||
@@ -7,14 +7,23 @@
|
||||
<th>Creator</th>
|
||||
<th>Name</th>
|
||||
<th>Tag Query</th>
|
||||
<% if CurrentUser.is_admin? %>
|
||||
<th>Count</th>
|
||||
<% end %>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @tag_subscriptions.each do |tag_subscription| %>
|
||||
<tr>
|
||||
<td><%= link_to tag_subscription.creator.name, user_path(tag_subscription.creator_id) %></td>
|
||||
<td><%= link_to tag_subscription.name, edit_tag_subscription_path(tag_subscription) %></td>
|
||||
<td><%= link_to tag_subscription.tag_query, posts_path(:tags => "sub:#{tag_subscription.creator.name}:#{tag_subscription.name}") %></td>
|
||||
<td><%= tag_subscription.name %></td>
|
||||
<td><%= tag_subscription.tag_query %></td>
|
||||
<td><%= tag_subscription.post_id_array.size %></td>
|
||||
<td>
|
||||
<%= link_to "edit", edit_tag_subscription_path(tag_subscription) %>
|
||||
| <%= link_to "posts", posts_path(:tags => "sub:#{tag_subscription.creator.name}:#{tag_subscription.name}") %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
</aside>
|
||||
|
||||
<section id="content">
|
||||
<h1>Tag Subscriptions</h1>
|
||||
<h1>Tag Subscriptions [<%= link_to "edit", tag_subscriptions_path %>]</h1>
|
||||
|
||||
<%= @post_set.presenter.post_previews_html(self) %>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user