about summary refs log tree commit diff
path: root/app/views
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2016-02-22 16:00:20 +0100
committerEugen Rochko <eugen@zeonfederated.com>2016-02-22 16:00:20 +0100
commit709c6685a90bb819696566cc9e42e587546d72dc (patch)
tree272783009e0a0c8b13b8003dc4bc4e58f3b0b84b /app/views
parent9c4856bdb11fc9311ab30a97224cee3dfaec492f (diff)
Made some progress
Diffstat (limited to 'app/views')
-rw-r--r--app/views/atom/user_stream.xml.ruby35
-rw-r--r--app/views/home/index.html.haml1
-rw-r--r--app/views/layouts/application.html.erb14
-rw-r--r--app/views/layouts/application.html.haml10
-rw-r--r--app/views/profile/show.html.haml2
-rw-r--r--app/views/xrd/host_meta.xml.ruby5
-rw-r--r--app/views/xrd/webfinger.xml.ruby8
7 files changed, 61 insertions, 14 deletions
diff --git a/app/views/atom/user_stream.xml.ruby b/app/views/atom/user_stream.xml.ruby
new file mode 100644
index 000000000..d418ea0ec
--- /dev/null
+++ b/app/views/atom/user_stream.xml.ruby
@@ -0,0 +1,35 @@
+Nokogiri::XML::Builder.new do |xml|
+  xml.feed(xmlns: 'http://www.w3.org/2005/Atom', 'xmlns:thr': 'http://purl.org/syndication/thread/1.0', 'xmlns:activity': 'http://activitystrea.ms/spec/1.0/') do
+    xml.id_ atom_user_stream_url(id: @account.id)
+    xml.title @account.display_name
+    xml.subtitle @account.note
+    xml.updated stream_updated_at
+
+    xml.author do
+      xml['activity'].send('object-type', 'http://activitystrea.ms/schema/1.0/person')
+      xml.uri profile_url(name: @account.username)
+      xml.name @account.username
+      xml.summary @account.note
+
+      xml.link(rel: 'alternate', type: 'text/html', href: profile_url(name: @account.username))
+    end
+
+    xml.link(rel: 'alternate', type: 'text/html', href: profile_url(name: @account.username))
+    xml.link(rel: 'hub', href: '')
+    xml.link(rel: 'salmon', href: salmon_url(@account))
+    xml.link(rel: 'self', type: 'application/atom+xml', href: atom_user_stream_url(id: @account.id))
+
+    @account.stream_entries.each do |stream_entry|
+      xml.entry do
+        xml.id_ unique_tag(stream_entry.created_at, stream_entry.activity_id, stream_entry.activity_type)
+        xml.published stream_entry.activity.created_at.iso8601
+        xml.updated   stream_entry.activity.updated_at.iso8601
+        xml.content({ type: 'html' }, stream_entry.content)
+        xml.title
+
+        xml['activity'].send('verb', "http://activitystrea.ms/schema/1.0/#{stream_entry.verb}")
+        xml['activity'].send('object-type', "http://activitystrea.ms/schema/1.0/#{stream_entry.object_type}")
+      end
+    end
+  end
+end.to_xml
diff --git a/app/views/home/index.html.haml b/app/views/home/index.html.haml
new file mode 100644
index 000000000..862374a98
--- /dev/null
+++ b/app/views/home/index.html.haml
@@ -0,0 +1 @@
+Mastodon
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb
deleted file mode 100644
index ff0d4c865..000000000
--- a/app/views/layouts/application.html.erb
+++ /dev/null
@@ -1,14 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-  <title>Mastodon</title>
-  <%= stylesheet_link_tag    'application', media: 'all', 'data-turbolinks-track' => true %>
-  <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
-  <%= csrf_meta_tags %>
-</head>
-<body>
-
-<%= yield %>
-
-</body>
-</html>
diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml
new file mode 100644
index 000000000..0cb4e96e8
--- /dev/null
+++ b/app/views/layouts/application.html.haml
@@ -0,0 +1,10 @@
+!!!
+%html
+  %head
+    %meta{:content => "text/html; charset=UTF-8", "http-equiv" => "Content-Type"}/
+    %title Mastodon
+    = stylesheet_link_tag    'application', media: 'all'
+    = javascript_include_tag 'application'
+    = csrf_meta_tags
+  %body
+    = yield
diff --git a/app/views/profile/show.html.haml b/app/views/profile/show.html.haml
new file mode 100644
index 000000000..dcb5764ec
--- /dev/null
+++ b/app/views/profile/show.html.haml
@@ -0,0 +1,2 @@
+%h1 Profile#show
+%p Find me in app/views/profile/show.html.haml
diff --git a/app/views/xrd/host_meta.xml.ruby b/app/views/xrd/host_meta.xml.ruby
new file mode 100644
index 000000000..07d026471
--- /dev/null
+++ b/app/views/xrd/host_meta.xml.ruby
@@ -0,0 +1,5 @@
+Nokogiri::XML::Builder.new do |xml|
+  xml.XRD(xmlns: 'http://docs.oasis-open.org/ns/xri/xrd-1.0') do
+    xml.Link(rel: 'lrdd', type: 'application/xrd+xml', template: @webfinger_template)
+  end
+end.to_xml
diff --git a/app/views/xrd/webfinger.xml.ruby b/app/views/xrd/webfinger.xml.ruby
new file mode 100644
index 000000000..7a1e9a1d3
--- /dev/null
+++ b/app/views/xrd/webfinger.xml.ruby
@@ -0,0 +1,8 @@
+Nokogiri::XML::Builder.new do |xml|
+  xml.XRD(xmlns: 'http://docs.oasis-open.org/ns/xri/xrd-1.0') do
+    xml.Subject @canonical_account_uri
+    xml.Link(rel: 'http://schemas.google.com/g/2010#updates-from', type: 'application/atom+xml', href: atom_user_stream_url(id: @account.id))
+    xml.Link(rel: 'salmon', href: salmon_url(@account))
+    xml.Link(rel: 'magic-public-key', href: @magic_key)
+  end
+end.to_xml