From cba6bdaf52c7fc57fdcaedbcda30c8a445930ac3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Hanol?= Date: Thu, 24 Jan 2019 12:25:37 +0100 Subject: [PATCH] UX: use solid circle to indicate selected option in polls --- lib/svg_sprite/svg_sprite.rb | 35 +++++++++---------- .../javascripts/widgets/discourse-poll.js.es6 | 2 +- 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/lib/svg_sprite/svg_sprite.rb b/lib/svg_sprite/svg_sprite.rb index f4a3335c8d6..3717d59944d 100644 --- a/lib/svg_sprite/svg_sprite.rb +++ b/lib/svg_sprite/svg_sprite.rb @@ -13,11 +13,11 @@ module SvgSprite "angle-right", "angle-up", "archive", + "arrow-down", + "arrow-left", + "arrow-up", "arrows-alt-h", "arrows-alt-v", - "arrow-down", - "arrow-up", - "arrow-left", "at", "backward", "ban", @@ -63,16 +63,16 @@ module SvgSprite "exclamation-circle", "exclamation-triangle", "external-link-alt", - "fab-apple", "fab-android", + "fab-apple", "fab-discourse", "fab-facebook-f", "fab-facebook-square", "fab-github", "fab-google-plus-square", "fab-instagram", - "fab-twitter", "fab-linux", + "fab-twitter", "fab-twitter-square", "fab-windows", "fab-yahoo", @@ -127,8 +127,8 @@ module SvgSprite "list-ol", "list-ul", "lock", - "map-marker-alt", "magic", + "map-marker-alt", "microphone-slash", "minus", "minus-circle", @@ -154,15 +154,14 @@ module SvgSprite "share", "shield-alt", "shower", - "signal", "sign-out-alt", + "signal", "step-backward", "step-forward", "sync", "table", "tag", "tasks", - "tv", "thermometer-three-quarters", "thumbs-down", "thumbs-up", @@ -170,6 +169,7 @@ module SvgSprite "times", "times-circle", "trash-alt", + "tv", "undo", "unlink", "unlock", @@ -193,8 +193,7 @@ module SvgSprite end def self.all_icons - icons = Set.new() - icons + Set.new() .merge(settings_icons) .merge(plugin_icons) .merge(badge_icons) @@ -203,13 +202,13 @@ module SvgSprite .delete_if { |i| i.blank? || i.include?("/") } .map! { |i| process(i.dup) } .merge(SVG_ICONS) - icons + .sort end def self.rebuild_cache icons = all_icons svg_sprite_cache['icons'] = icons - svg_sprite_cache['version'] = Digest::SHA1.hexdigest(icons.sort.join('|')) + svg_sprite_cache['version'] = Digest::SHA1.hexdigest(icons.join('|')) end def self.expire_cache @@ -244,7 +243,7 @@ Discourse SVG subset of #{fa_license} if icons.include? icon_id sym.attributes['id'].value = icon_id - sym.css('title').each { |t| t.remove } + sym.css('title').each(&:remove) svg_subset << sym.to_xml end end @@ -265,13 +264,13 @@ Discourse SVG subset of #{fa_license} if searched_icon == icon_id sym.attributes['id'].value = icon_id - sym.css('title').each { |t| t.remove } + sym.css('title').each(&:remove) return sym.to_xml end end end - return false + false end def self.prepare_symbol(symbol, svg_filename) @@ -313,7 +312,7 @@ Discourse SVG subset of #{fa_license} end def self.badge_icons - Badge.all.pluck(:icon).uniq + Badge.pluck(:icon).uniq end def self.group_icons @@ -340,11 +339,11 @@ Discourse SVG subset of #{fa_license} end def self.fa4_to_fa5_names - @db ||= File.open(fa4_shim_file, "r:UTF-8") { |f| JSON.parse(f.read); } + @db ||= File.open(fa4_shim_file, "r:UTF-8") { |f| JSON.parse(f.read) } end def self.process(icon_name) - icon_name = icon_name.strip + icon_name.strip! FA_ICON_MAP.each { |k, v| icon_name.sub!(k, v) } fa4_to_fa5_names[icon_name] || icon_name end diff --git a/plugins/poll/assets/javascripts/widgets/discourse-poll.js.es6 b/plugins/poll/assets/javascripts/widgets/discourse-poll.js.es6 index 240e883889e..9d74877adc2 100644 --- a/plugins/poll/assets/javascripts/widgets/discourse-poll.js.es6 +++ b/plugins/poll/assets/javascripts/widgets/discourse-poll.js.es6 @@ -45,7 +45,7 @@ createWidget("discourse-poll-option", { if (attrs.isMultiple) { contents.push(iconNode(chosen ? "far-check-square" : "far-square")); } else { - contents.push(iconNode(chosen ? "far-dot-circle" : "far-circle")); + contents.push(iconNode(chosen ? "circle" : "far-circle")); } contents.push(" ");