about summary refs log tree commit diff
path: root/app/views
diff options
context:
space:
mode:
authorReverite <github@reverite.sh>2019-03-10 19:19:52 -0700
committerReverite <github@reverite.sh>2019-03-10 19:19:52 -0700
commit229e2726cad36066afb210d7087a40cd9f955483 (patch)
treea14d55e9469f1f339fc40b777827aa4886bb7889 /app/views
parent715c552fe4c1b2d59bf1f281d77b6e2546bdb531 (diff)
parent3cef04610cd809c7bd01adc00d34fb3d25261a16 (diff)
Merge branch 'glitch'
Diffstat (limited to 'app/views')
-rw-r--r--app/views/about/_forms.html.haml2
-rw-r--r--app/views/about/_links.html.haml2
-rw-r--r--app/views/stream_entries/_detailed_status.html.haml5
-rw-r--r--app/views/stream_entries/_poll.html.haml27
-rw-r--r--app/views/stream_entries/_simple_status.html.haml5
5 files changed, 37 insertions, 4 deletions
diff --git a/app/views/about/_forms.html.haml b/app/views/about/_forms.html.haml
index 81f7173f7..78a422690 100644
--- a/app/views/about/_forms.html.haml
+++ b/app/views/about/_forms.html.haml
@@ -1,7 +1,7 @@
 - if @instance_presenter.open_registrations
   = render 'registration'
 - else
-  = link_to t('auth.register_elsewhere'), 'https://joinmastodon.org', class: 'button button-primary'
+  = link_to t('auth.register_elsewhere'), 'https://joinmastodon.org/#getting-started', class: 'button button-primary'
 
   .closed-registrations-message
     - if @instance_presenter.closed_registrations_message.blank?
diff --git a/app/views/about/_links.html.haml b/app/views/about/_links.html.haml
index f79c37e65..381f301f9 100644
--- a/app/views/about/_links.html.haml
+++ b/app/views/about/_links.html.haml
@@ -11,6 +11,6 @@
         = link_to t('auth.login'), new_user_session_path, class: 'webapp-btn'
     %li= link_to t('about.about_this'), about_more_path
     %li
-      = link_to 'https://joinmastodon.org/' do
+      = link_to 'https://joinmastodon.org/#getting-started' do
         = "#{t('about.other_instances')}"
         %i.fa.fa-external-link{ style: 'padding-left: 5px;' }
diff --git a/app/views/stream_entries/_detailed_status.html.haml b/app/views/stream_entries/_detailed_status.html.haml
index e123d657f..b19d2452a 100644
--- a/app/views/stream_entries/_detailed_status.html.haml
+++ b/app/views/stream_entries/_detailed_status.html.haml
@@ -22,7 +22,10 @@
         %a.status__content__spoiler-link{ href: '#' }= t('statuses.show_more')
     .e-content{ lang: status.language, style: "display: #{!current_account&.user&.setting_expand_spoilers && status.spoiler_text? ? 'none' : 'block'}; direction: #{rtl_status?(status) ? 'rtl' : 'ltr'}" }= Formatter.instance.format(status, custom_emojify: true, autoplay: autoplay)
 
-  - if !status.media_attachments.empty?
+  - if status.poll
+    = react_component :poll, disabled: true, poll: ActiveModelSerializers::SerializableResource.new(status.poll, serializer: REST::PollSerializer, scope: current_user, scope_name: :current_user).as_json do
+      = render partial: 'stream_entries/poll', locals: { poll: status.poll }
+  - elsif !status.media_attachments.empty?
     - if status.media_attachments.first.video?
       - video = status.media_attachments.first
       = react_component :video, src: video.file.url(:original), preview: video.file.url(:small), sensitive: !current_account&.user&.show_all_media? && status.sensitive? || current_account&.user&.hide_all_media?, width: 670, height: 380, detailed: true, inline: true, alt: video.description do
diff --git a/app/views/stream_entries/_poll.html.haml b/app/views/stream_entries/_poll.html.haml
new file mode 100644
index 000000000..d6b2c0cd9
--- /dev/null
+++ b/app/views/stream_entries/_poll.html.haml
@@ -0,0 +1,27 @@
+- show_results = (user_signed_in? && poll.voted?(current_account)) || poll.expired?
+
+.poll
+  %ul
+    - poll.loaded_options.each do |option|
+      %li
+        - if show_results
+          - percent = poll.votes_count > 0 ? 100 * option.votes_count / poll.votes_count : 0
+          %span.poll__chart{ style: "width: #{percent}%" }
+
+          %label.poll__text><
+            %span.poll__number= percent.round
+            = option.title
+        - else
+          %label.poll__text><
+            %span.poll__input{ class: poll.multiple? ? 'checkbox' : nil}><
+            = option.title
+  .poll__footer
+    - unless show_results
+      %button.button.button-secondary{ disabled: true }
+        = t('statuses.poll.vote')
+
+    %span= t('statuses.poll.total_votes', count: poll.votes_count)
+
+    - unless poll.expires_at.nil?
+      ·
+      %span= l poll.expires_at
diff --git a/app/views/stream_entries/_simple_status.html.haml b/app/views/stream_entries/_simple_status.html.haml
index 28b4e3217..d3441ca90 100644
--- a/app/views/stream_entries/_simple_status.html.haml
+++ b/app/views/stream_entries/_simple_status.html.haml
@@ -27,7 +27,10 @@
     .e-content{ lang: status.language, style: "display: #{!current_account&.user&.setting_expand_spoilers && status.spoiler_text? ? 'none' : 'block'}; direction: #{rtl_status?(status) ? 'rtl' : 'ltr'}" }<
       = Formatter.instance.format(status, custom_emojify: true, autoplay: autoplay)
 
-  - if !status.media_attachments.empty?
+  - if status.poll
+    = react_component :poll, disabled: true, poll: ActiveModelSerializers::SerializableResource.new(status.poll, serializer: REST::PollSerializer, scope: current_user, scope_name: :current_user).as_json do
+      = render partial: 'stream_entries/poll', locals: { poll: status.poll }
+  - elsif !status.media_attachments.empty?
     - if status.media_attachments.first.video?
       - video = status.media_attachments.first
       = react_component :video, src: video.file.url(:original), preview: video.file.url(:small), sensitive: !current_account&.user&.show_all_media? && status.sensitive? || current_account&.user&.hide_all_media?, width: 610, height: 343, inline: true, alt: video.description do