summaryrefslogtreecommitdiff
path: root/views/object.erb
diff options
context:
space:
mode:
Diffstat (limited to 'views/object.erb')
-rw-r--r--views/object.erb35
1 files changed, 21 insertions, 14 deletions
diff --git a/views/object.erb b/views/object.erb
index 744a518..3e6e617 100644
--- a/views/object.erb
+++ b/views/object.erb
@@ -1,26 +1,31 @@
-
-<% mention = mention @object['attributedTo']
- following_path = File.join(FOLLOWING, "#{mention}.json")
- follow = File.exist?(following_path) ? 'unfollow' : 'follow'
+<% @idx +=1
+ mention = mention @object['attributedTo']
+ follow = File.exist?(File.join(FOLLOWING_DIR, "#{mention}.json")) ? 'unfollow' : 'follow'
%>
-<div style='margin-left:<%= @object['indent']%>em' id='<%= @object['id'] %>'>
+<div style='margin-left:<%= @object['indent']%>em' id='<%= @idx %>'>
<b><a href='<%= @object['attributedTo'] %>', target='_blank'><%= mention %></a></b>&nbsp;
<form action='/<%= follow %>' method='post'>
<input type='hidden' name='follow' value='<%= @object['attributedTo'] %>' />
- <input type='hidden' name='redirect' value='/#<%= @object['id'] %>' />
+ <input type='hidden' name='anchor' value='/<%= @dir %>#<%= @idx %>' />
<button><%= follow.capitalize %></button>
</form>
&nbsp;
+ <em><%= @object['published'] %></em>
+ &nbsp;
<form action='/delete' method='post'>
<input type='hidden' name='id' value='<%= @object['id'] %>' />
- <input type='hidden' name='redirect' value='/#<%= @object['id'] %>' />
+ <input type='hidden' name='dir' value='<%= @dir %>' />
+ <input type='hidden' name='anchor' value='/<%= @dir %>#<%= @idx %>' />
<button>Delete</button>
</form>
&nbsp;
- <form action='/like' method='post'>
+ <% unless @dir == 'shared' %>
+ <form action='/share' method='post'>
<input type='hidden' name='id' value='<%= @object['id'] %>' />
- <input type='hidden' name='redirect' value='/#<%= @object['id'] %>' />
- <button>Like</button>
+ <input type='hidden' name='dir' value='<%= @dir %>' />
+ <input type='hidden' name='anchor' value='/<%= @dir %>#<%= @idx %>' />
+ <button>Share</button>
+ <% end %>
</form>
<%= @object['content'] %>
<% if @object['attachment']
@@ -39,16 +44,18 @@
<% end %>
<% end %>
<p>
- <button class='reply' data-index='<%= @object['id'] %>'>Reply</button>
- <form action='/' method='post' id='form<%= @object['id'] %>' style='display:none;' >
+ <% unless @dir == 'shared' %>
+ <button class='reply' data-index='<%= @idx %>'>Reply</button>
+ <form action='/' method='post' id='form<%= @idx %>' style='display:none;' >
<input type='hidden' name='to' value='<%= @object['attributedTo'] %>' />
<input type='hidden' name='inReplyTo' value='<%= @object['id'] %>' />
- <input type='hidden' name='redirect' value='/#<%= @object['id'] %>' />
+ <input type='hidden' name='anchor' value='/<%= @dir %>#<%= @idx %>' />
<textarea name='content'></textarea>
<br>
- <button class='cancel' data-index='<%= @object['id'] %>'>Cancel</button>
+ <button class='cancel' data-index='<%= @idx %>'>Cancel</button>
<input type='submit' value='Send'>
</form>
+ <% end %>
</div>
<% @object['replies'].each do |reply|
@object = reply %>