about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/controllers/settings/preferences_controller.rb1
-rw-r--r--app/javascript/flavours/glitch/styles/monsterpit.scss11
-rw-r--r--app/lib/formatter.rb3
-rw-r--r--app/lib/user_settings_decorator.rb5
-rw-r--r--app/models/account.rb1
-rw-r--r--app/models/user.rb5
-rwxr-xr-xapp/views/layouts/application.html.haml5
-rw-r--r--app/views/settings/preferences/show.html.haml3
8 files changed, 33 insertions, 1 deletions
diff --git a/app/controllers/settings/preferences_controller.rb b/app/controllers/settings/preferences_controller.rb
index 12bea3ec3..2ae90c7fb 100644
--- a/app/controllers/settings/preferences_controller.rb
+++ b/app/controllers/settings/preferences_controller.rb
@@ -56,6 +56,7 @@ class Settings::PreferencesController < Settings::BaseController
       :setting_roar_lifespan,
       :setting_delayed_roars,
       :setting_delayed_for,
+      :setting_show_cursor,
 
       :setting_default_privacy,
       :setting_default_sensitive,
diff --git a/app/javascript/flavours/glitch/styles/monsterpit.scss b/app/javascript/flavours/glitch/styles/monsterpit.scss
index 71b4f4910..6c9e30d47 100644
--- a/app/javascript/flavours/glitch/styles/monsterpit.scss
+++ b/app/javascript/flavours/glitch/styles/monsterpit.scss
@@ -19,6 +19,12 @@
       color: darken($secondary-text-color, 20%);
     }
   }
+  span.cursor {
+    color: lighten($dark-text-color, 20%);
+    font-family: $font-monospace, monospace;
+    /* animation: t_blink 1s linear infinite; */
+  }
+  /* span.cursor::before { content: " █" } */
 }
 
 .composer--reply > .content {
@@ -99,3 +105,8 @@ div.drawer__inner__admin {
     }
   }
 }
+
+@keyframes t_blink {
+  from { opacity: 1 }
+  to { opacity: 0 }
+}
diff --git a/app/lib/formatter.rb b/app/lib/formatter.rb
index bbe123b54..3456f30f8 100644
--- a/app/lib/formatter.rb
+++ b/app/lib/formatter.rb
@@ -249,7 +249,8 @@ class Formatter
   end
 
   def format_console(html)
-    "<pre><code>#{html}</code></pre>"
+    cursor = '<span class="cursor"></span>'
+    "<pre><code>#{html.strip.sub(/<\/p>\Z/, cursor)}</p></code></pre>"
   end
 
   def format_markdown(html)
diff --git a/app/lib/user_settings_decorator.rb b/app/lib/user_settings_decorator.rb
index 5aedf3a1c..d64a252e2 100644
--- a/app/lib/user_settings_decorator.rb
+++ b/app/lib/user_settings_decorator.rb
@@ -40,6 +40,7 @@ class UserSettingsDecorator
     user.settings['roar_lifespan']       = roar_lifespan_preference if change?('setting_roar_lifespan')
     user.settings['delayed_roars']       = delayed_roars_preference if change?('setting_delayed_roars')
     user.settings['delayed_for']         = delayed_for_preference if change?('setting_delayed_for')
+    user.settings['show_cursor']         = show_cursor_preference if change?('setting_show_cursor')
 
     user.settings['notification_emails'] = merged_notification_emails if change?('notification_emails')
     user.settings['interactions']        = merged_interactions if change?('interactions')
@@ -141,6 +142,10 @@ class UserSettingsDecorator
     settings['setting_delayed_for']
   end
 
+  def show_cursor_preference
+    settings['setting_show_cursor']
+  end
+
   def delayed_roars_preference
     settings['setting_delayed_roars']
   end
diff --git a/app/models/account.rb b/app/models/account.rb
index 05fb387aa..6528a7ae9 100644
--- a/app/models/account.rb
+++ b/app/models/account.rb
@@ -154,6 +154,7 @@ class Account < ApplicationRecord
            :hides_filtered_gap?,
            :hides_mascot?,
            :hides_captions?,
+           :shows_cursor?,
 
            to: :user,
            prefix: true,
diff --git a/app/models/user.rb b/app/models/user.rb
index c14c33567..cbe62d189 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -128,6 +128,7 @@ class User < ApplicationRecord
     :roar_lifespan,
     :delayed_roars,
     :delayed_for,
+    :show_cursor,
 
     :auto_play_gif,
     :default_sensitive,
@@ -314,6 +315,10 @@ class User < ApplicationRecord
     @_delayed_for ||= (settings.delayed_for || 60)
   end
 
+  def shows_cursor?
+    @show_cursor ||= (settings.show_cursor || false)
+  end
+
   def defaults_to_local_only?
     @defaults_to_local_only ||= (settings.default_local || false)
   end
diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml
index 1110942ac..f21d8dd97 100755
--- a/app/views/layouts/application.html.haml
+++ b/app/views/layouts/application.html.haml
@@ -81,5 +81,10 @@
         .status__content .emojione { width: 24px !important; height: 24px !important }
         .status__content .hoverplay:hover { padding-left: 24px !important }
 
+    -if current_account&.user_shows_cursor?
+      :css
+        span.cursor { animation: t_blink 1s linear infinite }
+        span.cursor::before { content: " █" }
+
   %body{ class: body_classes }
     = content_for?(:content) ? yield(:content) : yield
diff --git a/app/views/settings/preferences/show.html.haml b/app/views/settings/preferences/show.html.haml
index 99eac3abf..07c9fd86f 100644
--- a/app/views/settings/preferences/show.html.haml
+++ b/app/views/settings/preferences/show.html.haml
@@ -27,6 +27,8 @@
 
     = f.input :setting_default_content_type, collection: ['text/x-bbcode+markdown', 'text/markdown', 'text/x-bbcode', 'text/html', 'text/plain', 'text/console'], wrapper: :with_label, include_blank: false, label_method: lambda { |item| safe_join([t("simple_form.labels.defaults.setting_default_content_type_#{item.split('/')[1].gsub(/[+-]/, '_')}"), content_tag(:span, t("simple_form.hints.defaults.setting_default_content_type_#{item.split('/')[1].gsub(/[+-]/, '_')}_html"), class: 'hint')]) }, required: false, as: :radio_buttons, collection_wrapper_tag: 'ul', item_wrapper_tag: 'li'
 
+
+  .fields-group
     = f.input :setting_default_local, as: :boolean, wrapper: :with_label
     = f.input :setting_always_local, as: :boolean, wrapper: :with_label
     = f.input :setting_default_sensitive, as: :boolean, wrapper: :with_label
@@ -72,6 +74,7 @@
     = f.input :setting_larger_buttons, as: :boolean, wrapper: :with_label
     = f.input :setting_larger_drawer, as: :boolean, wrapper: :with_label
     = f.input :setting_larger_emoji, as: :boolean, wrapper: :with_label
+    = f.input :setting_show_cursor, as: :boolean, wrapper: :with_label
 
   .fields-group
     = f.input :setting_hide_mascot, as: :boolean, wrapper: :with_label