Skip to content

Commit

Permalink
Subscription: unsubscribe
Browse files Browse the repository at this point in the history
  • Loading branch information
priit.mx.ee committed Jan 7, 2009
1 parent d753644 commit 5113721
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 1 deletion.
4 changes: 4 additions & 0 deletions engines/adva_cms/locale/adva_cms/en.yml
Expand Up @@ -751,9 +751,13 @@ en:
topics: Topics
subscription:
no_subscriptions: There are no subscribers.
confirm_delete: Are you sure you want unsubscribe?
flash:
destroy_success: Successfully unsubsribed.
link:
index: Subscribers
new: Add a new subscriber
destroy: Unsubscribe
label:
user: Users
subscriber: Subscriber
Expand Down
Expand Up @@ -20,4 +20,11 @@ def create
render :action => 'new'
end
end

def destroy
@subscription = Subscription.find(params[:id])
@subscription.destroy
flash[:notice] = t('adva.subscription.flash.destroy_success')
redirect_to admin_subscriptions_path(@site, @subscription.subscribable_id)
end
end
Expand Up @@ -14,7 +14,12 @@
<td><%= link_to h(subscription.user.name), admin_user_path(subscription.user_id) %></td>
<td><%= subscription.user.email %></td>
<td><%= subscription.created_at.to_s(:db) %></td>
<td>&nbsp;</td>
<td class='table_menu'>
<ul>
<li><%= link_to t('adva.subscription.link.destroy'), admin_subscription_path(@site, @newsletter, subscription),
:confirm => t('adva.subscription.confirm_delete'), :method => :delete %></li>
</ul>
</td>
</tr>
<% end %>
</tbody>
Expand Down
3 changes: 3 additions & 0 deletions engines/adva_newsletter/test/integration/subscription_test.rb
Expand Up @@ -37,6 +37,9 @@ def setup
assert_template 'admin/newsletter_subscriptions/new'
assert_content 'Site does not have any available user'
click_link 'Add a new user'

# admin unsubscribe John Doe
# TODO: bring on selenium test for that
end
end

Expand Down

0 comments on commit 5113721

Please sign in to comment.