not api endpoints, moved to button, fixed notifier message, fixed tests
This commit is contained in:
parent
443080d7b0
commit
44b08cc35d
6 changed files with 72 additions and 86 deletions
|
@ -81,21 +81,27 @@ class DiaryEntryController < ApplicationController
|
|||
end
|
||||
|
||||
def subscribe
|
||||
@entry = DiaryEntry.find(params[:id])
|
||||
diary_entry = DiaryEntry.find(params[:id])
|
||||
|
||||
if ! diary_entry.subscribers.exists?(@user.id)
|
||||
diary_entry.subscribers << @user
|
||||
end
|
||||
|
||||
redirect_to :controller => "diary_entry", :action => "view", :display_name => diary_entry.user.display_name, :id => diary_entry.id
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render :action => "no_such_entry", :status => :not_found
|
||||
end
|
||||
|
||||
def unsubscribe
|
||||
@entry = DiaryEntry.find(params[:id])
|
||||
diary_entry = DiaryEntry.find(params[:id])
|
||||
|
||||
if diary_entry.subscribers.exists?(@user.id)
|
||||
diary_entry.subscribers.delete(@user)
|
||||
end
|
||||
|
||||
redirect_to :controller => "diary_entry", :action => "view", :display_name => diary_entry.user.display_name, :id => diary_entry.id
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render :action => "no_such_entry", :status => :not_found
|
||||
end
|
||||
|
||||
def list
|
||||
|
|
|
@ -83,7 +83,6 @@ class Notifier < ActionMailer::Base
|
|||
end
|
||||
end
|
||||
|
||||
# FIXME mail should say your / their depending who's message it is
|
||||
def diary_comment_notification(comment, recipient)
|
||||
with_recipient_locale recipient do
|
||||
@to_user = recipient.display_name
|
||||
|
|
|
@ -35,11 +35,5 @@
|
|||
<%= link_to t('diary_entry.diary_entry.hide_link'), hide_diary_entry_path(:display_name => diary_entry.user.display_name, :id => diary_entry.id), :method => :post, :data => { :confirm => t('diary_entry.diary_entry.confirm') } %>
|
||||
<% end %>
|
||||
|
||||
<% if @user and diary_entry.subscribers.exists?(@user.id) %>
|
||||
<li><%= link_to t('javascripts.changesets.show.unsubscribe'), diary_entry_unsubscribe_url(diary_entry), :method => :post %></li>
|
||||
<% elsif @user %>
|
||||
<li><%= link_to t('javascripts.changesets.show.subscribe'), diary_entry_subscribe_url(diary_entry), :method => :post %></li>
|
||||
<% end %>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
|
|
|
@ -21,6 +21,11 @@
|
|||
<%= richtext_area :diary_comment, :body, :cols => 80, :rows => 15 %>
|
||||
<%= submit_tag t('diary_entry.view.save_button') %>
|
||||
<% end %>
|
||||
<% if @user and @entry.subscribers.exists?(@user.id) %>
|
||||
<div style='position:relative; top: -30px; left: 130px'><%= link_to t('javascripts.changesets.show.unsubscribe'), diary_entry_unsubscribe_path(:display_name => @entry.user.display_name, :id => @entry.id), :method => :post, :class => :button %></div>
|
||||
<% elsif @user %>
|
||||
<div style='position:relative; top: -30px; left: 130px'><%= link_to t('javascripts.changesets.show.subscribe'), diary_entry_subscribe_path(:display_name => @entry.user.display_name, :id => @entry.id), :method => :post, :class => :button %></div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<%= if_not_logged_in(:div) do %>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue