diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2016-02-29 19:42:08 +0100 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2016-02-29 19:42:08 +0100 |
commit | 0e8f59c16fcb21301c736ecbc4424cb4c5388c42 (patch) | |
tree | 344ac1e0b2d165ba4fe3870f786e854710970ce1 /app/views | |
parent | 11ff92c9d7b27c2c9ed86f649aef8d956cc8b989 (diff) |
Refactoring Grape API methods into normal controllers & other things
Diffstat (limited to 'app/views')
-rw-r--r-- | app/views/accounts/show.atom.ruby (renamed from app/views/atom/user_stream.xml.ruby) | 8 | ||||
-rw-r--r-- | app/views/accounts/show.html.haml (renamed from app/views/profile/show.html.haml) | 6 | ||||
-rw-r--r-- | app/views/profile/_status_footer.html.haml | 2 | ||||
-rw-r--r-- | app/views/profile/_status_header.html.haml | 7 | ||||
-rw-r--r-- | app/views/profile/entry.html.haml | 5 | ||||
-rw-r--r-- | app/views/stream_entries/_favourite.html.haml (renamed from app/views/profile/_favourite.html.haml) | 0 | ||||
-rw-r--r-- | app/views/stream_entries/_follow.html.haml (renamed from app/views/profile/_follow.html.haml) | 0 | ||||
-rw-r--r-- | app/views/stream_entries/_status.html.haml (renamed from app/views/profile/_status.html.haml) | 14 | ||||
-rw-r--r-- | app/views/stream_entries/show.atom.ruby (renamed from app/views/atom/entry.xml.ruby) | 0 | ||||
-rw-r--r-- | app/views/stream_entries/show.html.haml | 5 | ||||
-rw-r--r-- | app/views/xrd/webfinger.xml.ruby | 6 |
11 files changed, 25 insertions, 28 deletions
diff --git a/app/views/atom/user_stream.xml.ruby b/app/views/accounts/show.atom.ruby index 00b2cdc14..12d2bb233 100644 --- a/app/views/atom/user_stream.xml.ruby +++ b/app/views/accounts/show.atom.ruby @@ -1,6 +1,6 @@ Nokogiri::XML::Builder.new do |xml| feed(xml) do - simple_id xml, atom_user_stream_url(id: @account.id) + simple_id xml, account_url(@account, format: 'atom') title xml, @account.display_name subtitle xml, @account.note updated_at xml, stream_updated_at @@ -10,10 +10,10 @@ Nokogiri::XML::Builder.new do |xml| include_author xml, @account end - link_alternate xml, profile_url(@account) - link_self xml, atom_user_stream_url(id: @account.id) + link_alternate xml, url_for_target(@account) + link_self xml, account_url(@account, format: 'atom') link_hub xml, HUB_URL - link_salmon xml, salmon_url(@account) + link_salmon xml, api_salmon_url(@account.id) @account.stream_entries.order('id desc').each do |stream_entry| entry(xml, false) do diff --git a/app/views/profile/show.html.haml b/app/views/accounts/show.html.haml index c02bdddcf..113db12f6 100644 --- a/app/views/profile/show.html.haml +++ b/app/views/accounts/show.html.haml @@ -1,6 +1,6 @@ - content_for :header_tags do - %link{ rel: 'salmon', href: salmon_url(@account) }/ - %link{ rel: 'alternate', type: 'application/atom+xml', href: atom_user_stream_url(id: @account.id) }/ + %link{ rel: 'salmon', href: api_salmon_url(@account.id) }/ + %link{ rel: 'alternate', type: 'application/atom+xml', href: account_url(@account, format: 'atom') }/ .card .avatar= image_tag @account.avatar.url(:medium) @@ -11,4 +11,4 @@ .activity-stream - @account.statuses.order('id desc').each do |status| - = render partial: 'status', locals: { status: status, include_threads: false, is_successor: false, is_predecessor: false } + = render partial: 'stream_entries/status', locals: { status: status, include_threads: false, is_successor: false, is_predecessor: false } diff --git a/app/views/profile/_status_footer.html.haml b/app/views/profile/_status_footer.html.haml deleted file mode 100644 index a2333df15..000000000 --- a/app/views/profile/_status_footer.html.haml +++ /dev/null @@ -1,2 +0,0 @@ -- if status.reply? - = link_to "In response to #{status.thread.account.acct}", status_url(status.thread), class: 'conversation-link' diff --git a/app/views/profile/_status_header.html.haml b/app/views/profile/_status_header.html.haml deleted file mode 100644 index 225a89d71..000000000 --- a/app/views/profile/_status_header.html.haml +++ /dev/null @@ -1,7 +0,0 @@ -= link_to profile_url(status.account), class: 'name' do - %strong= display_name(status.account) - = "@#{status.account.acct}" - -= link_to status_url(status), class: 'time' do - %span{ title: status.created_at } - = relative_time(status.created_at) diff --git a/app/views/profile/entry.html.haml b/app/views/profile/entry.html.haml deleted file mode 100644 index e4d5db300..000000000 --- a/app/views/profile/entry.html.haml +++ /dev/null @@ -1,5 +0,0 @@ -- content_for :header_tags do - %link{ rel: 'alternate', type: 'application/atom+xml', href: atom_entry_url(id: @entry.id) }/ - -.activity-stream - = render partial: @type, locals: { @type.to_sym => @entry.activity, include_threads: true, is_predecessor: false, is_successor: false } diff --git a/app/views/profile/_favourite.html.haml b/app/views/stream_entries/_favourite.html.haml index 85e3a0824..85e3a0824 100644 --- a/app/views/profile/_favourite.html.haml +++ b/app/views/stream_entries/_favourite.html.haml diff --git a/app/views/profile/_follow.html.haml b/app/views/stream_entries/_follow.html.haml index c1c081374..c1c081374 100644 --- a/app/views/profile/_follow.html.haml +++ b/app/views/stream_entries/_follow.html.haml diff --git a/app/views/profile/_status.html.haml b/app/views/stream_entries/_status.html.haml index b089036b1..89dd53613 100644 --- a/app/views/profile/_status.html.haml +++ b/app/views/stream_entries/_status.html.haml @@ -6,17 +6,23 @@ .pre-header %i.fa.fa-retweet Shared by - = link_to display_name(status.account), profile_url(status.account), class: 'name' + = link_to display_name(status.account), url_for_target(status.account), class: 'name' + .entry__container .avatar = image_tag avatar_for_status_url(status) + .entry__container__container .header - = render partial: 'status_header', locals: { status: status.reblog? ? status.reblog : status } + = link_to url_for_target(status.reblog? ? status.reblog.account : status.account), class: 'name' do + %strong= display_name(status.reblog? ? status.reblog.account : status.account) + = "@#{status.reblog? ? status.reblog.account.acct : status.account.acct}" + = link_to url_for_target(status.reblog? ? status.reblog : status), class: 'time' do + %span{ title: status.reblog? ? status.reblog.created_at : status.created_at } + = relative_time(status.reblog? ? status.reblog.created_at : status.created_at) + .content = status.content.html_safe - .counters - = render partial: 'status_footer', locals: { status: status.reblog? ? status.reblog : status } - if include_threads - status.replies.each do |status| diff --git a/app/views/atom/entry.xml.ruby b/app/views/stream_entries/show.atom.ruby index e0e089f46..e0e089f46 100644 --- a/app/views/atom/entry.xml.ruby +++ b/app/views/stream_entries/show.atom.ruby diff --git a/app/views/stream_entries/show.html.haml b/app/views/stream_entries/show.html.haml new file mode 100644 index 000000000..6286daf53 --- /dev/null +++ b/app/views/stream_entries/show.html.haml @@ -0,0 +1,5 @@ +- content_for :header_tags do + %link{ rel: 'alternate', type: 'application/atom+xml', href: account_stream_entry_url(@account, @stream_entry, format: 'atom') }/ + +.activity-stream + = render partial: @type, locals: { @type.to_sym => @stream_entry.activity, include_threads: true, is_predecessor: false, is_successor: false } diff --git a/app/views/xrd/webfinger.xml.ruby b/app/views/xrd/webfinger.xml.ruby index 42adc6551..ac0fd3d0e 100644 --- a/app/views/xrd/webfinger.xml.ruby +++ b/app/views/xrd/webfinger.xml.ruby @@ -1,10 +1,10 @@ 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.Alias profile_url(@account) - xml.Link(rel: 'http://webfinger.net/rel/profile-page', type: 'text/html', href: profile_url(@account)) + xml.Alias url_for_target(@account) + xml.Link(rel: 'http://webfinger.net/rel/profile-page', type: 'text/html', href: url_for_target(@account)) 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: 'salmon', href: api_salmon_url(@account.id)) xml.Link(rel: 'magic-public-key', href: @magic_key) end end.to_xml |