From 952cf0fdb43bbf20684a1d13fef50fc2f846b16c Mon Sep 17 00:00:00 2001 From: Andy Allan Date: Wed, 3 Mar 2021 15:34:16 +0000 Subject: [PATCH 1/4] Remove the old richtext_area helper This has been superseded by the `f.richtext_field` custom form builder. --- app/helpers/application_helper.rb | 20 ------------------- app/views/site/_html_help.erb | 0 app/views/site/_markdown_help.html.erb | 26 ------------------------- config/locales/en.yml | 17 ---------------- test/helpers/application_helper_test.rb | 5 ----- 5 files changed, 68 deletions(-) delete mode 100644 app/views/site/_html_help.erb delete mode 100644 app/views/site/_markdown_help.html.erb diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index c8473adfc..ed01ad89b 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -17,26 +17,6 @@ module ApplicationHelper link_to(image_tag("RSS.png", :size => "16x16", :border => 0), args, :class => "rsssmall") end - def richtext_area(object_name, method, options = {}) - id = "#{object_name}_#{method}" - type = options.delete(:format) || "markdown" - - tag.div(:id => "#{id}_container", :class => "richtext_container") do - output_buffer << tag.div(:id => "#{id}_content", :class => "richtext_content") do - output_buffer << text_area(object_name, method, options.merge("data-preview-url" => preview_url(:type => type))) - output_buffer << tag.div("", :id => "#{id}_preview", :class => "richtext_preview richtext text-break") - end - - output_buffer << tag.div(:id => "#{id}_help", :class => "richtext_help") do - output_buffer << render("site/#{type}_help") - output_buffer << tag.div(:class => "buttons") do - output_buffer << submit_tag(I18n.t("site.richtext_area.edit"), :id => "#{id}_doedit", :class => "richtext_doedit deemphasize", :disabled => true) - output_buffer << submit_tag(I18n.t("site.richtext_area.preview"), :id => "#{id}_dopreview", :class => "richtext_dopreview deemphasize") - end - end - end - end - def dir if dir = params[:dir] dir == "rtl" ? "rtl" : "ltr" diff --git a/app/views/site/_html_help.erb b/app/views/site/_html_help.erb deleted file mode 100644 index e69de29bb..000000000 diff --git a/app/views/site/_markdown_help.html.erb b/app/views/site/_markdown_help.html.erb deleted file mode 100644 index 7dbadefe9..000000000 --- a/app/views/site/_markdown_help.html.erb +++ /dev/null @@ -1,26 +0,0 @@ -

<%= t ".title_html" %>

- diff --git a/config/locales/en.yml b/config/locales/en.yml index 298369c22..f7ee6d04a 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1995,23 +1995,6 @@ en: bicycle_shop: "Bicycle shop" bicycle_parking: "Bicycle parking" toilets: "Toilets" - richtext_area: - edit: Edit - preview: Preview - markdown_help: - title_html: Parsed with kramdown - headings: Headings - heading: Heading - subheading: Subheading - unordered: Unordered list - ordered: Ordered list - first: First item - second: Second item - link: Link - text: Text - image: Image - alt: Alt text - url: URL welcome: title: Welcome! introduction_html: | diff --git a/test/helpers/application_helper_test.rb b/test/helpers/application_helper_test.rb index fe4587b87..90fbaebc2 100644 --- a/test/helpers/application_helper_test.rb +++ b/test/helpers/application_helper_test.rb @@ -47,11 +47,6 @@ class ApplicationHelperTest < ActionView::TestCase assert_dom_equal "", link end - def test_richtext_area - html = richtext_area(:message, :body, :cols => 40, :rows => 20) - assert_not_nil html - end - def test_dir assert_equal "ltr", dir From 926576881ff4e18573e34827fa9e598b8cc29174 Mon Sep 17 00:00:00 2001 From: Andy Allan Date: Wed, 3 Mar 2021 15:51:11 +0000 Subject: [PATCH 2/4] Remove final uses of the deemphasize class --- app/assets/stylesheets/common.scss | 12 ------------ app/views/browse/changeset.html.erb | 2 +- app/views/diary_entries/comments.html.erb | 2 +- app/views/users/account.html.erb | 2 +- 4 files changed, 3 insertions(+), 15 deletions(-) diff --git a/app/assets/stylesheets/common.scss b/app/assets/stylesheets/common.scss index 281cd4ba5..a37074561 100644 --- a/app/assets/stylesheets/common.scss +++ b/app/assets/stylesheets/common.scss @@ -83,13 +83,6 @@ a { /* Utility for de-emphasizing content */ -.deemphasize { - color: $darkgrey; - a { - color: $blue; - } -} - .text-muted a { color: $blue; } @@ -1253,11 +1246,6 @@ tr.turn:hover { img.user_thumbnail { float: left; } - - small.deemphasize { - float: left; - display: block; - } } /* Rules for the diary entry page */ diff --git a/app/views/browse/changeset.html.erb b/app/views/browse/changeset.html.erb index 670c7dc32..d04d5e6bd 100644 --- a/app/views/browse/changeset.html.erb +++ b/app/views/browse/changeset.html.erb @@ -51,7 +51,7 @@ :when => friendly_date_ago(comment.created_at), :exact_time => l(comment.created_at), :user => link_to(comment.author.display_name, user_path(comment.author))) %> - — <%= t("javascripts.changesets.show.unhide_comment") %> + — <%= t("javascripts.changesets.show.unhide_comment") %> <%= comment.body.to_html %> diff --git a/app/views/diary_entries/comments.html.erb b/app/views/diary_entries/comments.html.erb index 67036050d..78f16eb8c 100644 --- a/app/views/diary_entries/comments.html.erb +++ b/app/views/diary_entries/comments.html.erb @@ -11,7 +11,7 @@ <% @comments.each do |comment| -%> - "> + "> <%= link_to comment.diary_entry.title, diary_entry_path(comment.diary_entry.user, comment.diary_entry) %> <%= time_ago_in_words(comment.created_at, :scope => :'datetime.distance_in_words_ago') %> <%= comment.body.to_html %> diff --git a/app/views/users/account.html.erb b/app/views/users/account.html.erb index bb30581f9..10b33063e 100644 --- a/app/views/users/account.html.erb +++ b/app/views/users/account.html.erb @@ -94,7 +94,7 @@
<%= t ".home location" -%>
class="nohome"<% end %>> -

<%= t ".no home location" %>

+

<%= t ".no home location" %>

<%= f.text_field :home_lat, :wrapper_class => "col-sm-4", :id => "home_lat" %> <%= f.text_field :home_lon, :wrapper_class => "col-sm-4", :id => "home_lon" %> From 3fdf1e204a50b6ebe45765ec9170cdd4d578254e Mon Sep 17 00:00:00 2001 From: Andy Allan Date: Wed, 3 Mar 2021 17:16:31 +0000 Subject: [PATCH 3/4] Remove unnecessary margin-tops --- app/assets/stylesheets/common.scss | 5 ----- 1 file changed, 5 deletions(-) diff --git a/app/assets/stylesheets/common.scss b/app/assets/stylesheets/common.scss index a37074561..411e6167b 100644 --- a/app/assets/stylesheets/common.scss +++ b/app/assets/stylesheets/common.scss @@ -1695,13 +1695,8 @@ div.secondary-actions { } } -.diary_post .richtext { - margin-top: $lineheight; - } - .comments .richtext { margin-left: 70px; - margin-top: 0; } /* Rules for the user notes list */ From 1c1bfd7488442ac2b05e0b12140f2d0d8852cfc0 Mon Sep 17 00:00:00 2001 From: Andy Allan Date: Wed, 3 Mar 2021 17:39:42 +0000 Subject: [PATCH 4/4] Add a small margin before the changesets more button See also #2717 --- app/views/changesets/index.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/changesets/index.html.erb b/app/views/changesets/index.html.erb index 3e946670d..e9e620062 100644 --- a/app/views/changesets/index.html.erb +++ b/app/views/changesets/index.html.erb @@ -3,7 +3,7 @@ <%= render @changesets %> <% if @changesets.size == 20 -%> -
+
<%= link_to t(".load_more"), url_for(@params.merge(:max_id => @changesets.last.id - 1)), :class => "btn btn-primary" %>
<%= image_tag "searching.gif" %>