From 5af8d78e195c7479769240b32703d5b76843db4d Mon Sep 17 00:00:00 2001 From: pdp8 Date: Sat, 1 Jul 2023 00:57:48 +0200 Subject: initial refactoring of client.rb --- views/collection.erb | 38 +++++++++++++++++++++++++++++++++++ views/index.erb | 39 ----------------------------------- views/item.erb | 54 ------------------------------------------------- views/object.erb | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 95 insertions(+), 93 deletions(-) create mode 100644 views/collection.erb delete mode 100644 views/index.erb delete mode 100644 views/item.erb create mode 100644 views/object.erb (limited to 'views') diff --git a/views/collection.erb b/views/collection.erb new file mode 100644 index 0000000..4455b31 --- /dev/null +++ b/views/collection.erb @@ -0,0 +1,38 @@ + + + + + + +

<%= @dir %> +
+ +
+

+ <% @threads.each do |object| + @object = object %> + <%= erb :object %> + <% end %> +
+ +
+ + + diff --git a/views/index.erb b/views/index.erb deleted file mode 100644 index b512911..0000000 --- a/views/index.erb +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - -

<%= @dir %> -
- -
-

- <% @threads.each do |item| %> - <%= html item %> - <% end %> - <% if @dir == 'inbox' %> -
- -
- <% end %> - - - diff --git a/views/item.erb b/views/item.erb deleted file mode 100644 index 8036b39..0000000 --- a/views/item.erb +++ /dev/null @@ -1,54 +0,0 @@ -
- <%= @item[:mention] %>  - <% if @item[:mention] != ACCOUNT %> -
- - #<%= @item[:nr] %>' /> - -
-   -
- - #<%= @item[:nr] %>' /> - -
- <% if @dir == 'inbox' %> -   -
- - #<%= @item[:nr] %>' /> - -
- <% end %> - <% end %> - <%= @item[:content] %> - <% if @item[:attachment] - @item[:attachment].each do |att| - case att['mediaType'] - when /audio/ %> -
- <% when /image/ %> -
'>'> - <% when /video/ %> -
- <% else %> - <%= att %>
- '><%= att['url'] %> - <% end %> - <% end %> - <% end %> -

- -

-
-<% @item[:replies].each do |reply| %> - <%= html reply %> -<% end %> diff --git a/views/object.erb b/views/object.erb new file mode 100644 index 0000000..744a518 --- /dev/null +++ b/views/object.erb @@ -0,0 +1,57 @@ + +<% mention = mention @object['attributedTo'] + following_path = File.join(FOLLOWING, "#{mention}.json") + follow = File.exist?(following_path) ? 'unfollow' : 'follow' +%> +
em' id='<%= @object['id'] %>'> + ', target='_blank'><%= mention %>  +
+ ' /> + ' /> + +
+   +
+ ' /> + ' /> + +
+   +
+ ' /> + ' /> + +
+ <%= @object['content'] %> + <% if @object['attachment'] + @object['attachment'].each do |att| + case att['mediaType'] + when /audio/ %> +
+ <% when /image/ %> +
'>'> + <% when /video/ %> +
+ <% else %> + <%= att %>
+ '><%= att['url'] %> + <% end %> + <% end %> + <% end %> +

+ +

' style='display:none;' > + ' /> + ' /> + ' /> + +
+ + +
+
+<% @object['replies'].each do |reply| + @object = reply %> + <%= erb :object %> +<% end %> + -- cgit v1.2.3