diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index fa9eaa3..d529fce 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -45,6 +45,8 @@ jobs: run: bundle install - name: Prepare SQLite run: RAILS_ENV=test bundle exec rake db:migrate --trace + - name: Precompile assets + run: RAILS_ENV=test bundle exec rails app:assets:clobber app:assets:precompile - name: Run tests run: bundle exec rails test diff --git a/CHANGELOG.md b/CHANGELOG.md index 6943646..cb19bc1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## [Unreleased] -* no unreleased changes +### Changed +* new views with bootstrap 5 styles +* switch to bootstrap-icons as glyphicon no longer available in bootstrap 5 ## 2.3.2 / 2024-11-21 ### Fixed diff --git a/app/helpers/ndr_error/application_helper.rb b/app/helpers/ndr_error/application_helper.rb index 546a728..92915ea 100644 --- a/app/helpers/ndr_error/application_helper.rb +++ b/app/helpers/ndr_error/application_helper.rb @@ -2,11 +2,6 @@ module NdrError # Application-wide helpers. # TODO: await ndr_ui gem! module ApplicationHelper - # Bootstrap icon tag. - def glyphicon_tag(type) - content_tag(:span, '', class: "glyphicon glyphicon-#{type}") - end - # Pagination helper for will_paginate: def pagination_summary_for(collection) page = collection.current_page diff --git a/app/helpers/ndr_error/errors_helper.rb b/app/helpers/ndr_error/errors_helper.rb index 4296571..9b28641 100644 --- a/app/helpers/ndr_error/errors_helper.rb +++ b/app/helpers/ndr_error/errors_helper.rb @@ -56,9 +56,9 @@ def downstream_fingerprint_link(print) bootstrap_list_link_to hash + ' - ' + text, error_fingerprint_path(print) end - def ticket_link_for(fingerprint, small = false) - text = glyphicon_tag('asterisk') + ' View ticket' - css = 'btn btn-default' + def ticket_link_for(fingerprint, small = false) # rubocop:disable Style/OptionalBooleanParameter + text = "#{bootstrap_icon_tag('asterisk', :bi)} View ticket" + css = 'btn btn-outline-secondary' css << ' btn-xs' if small url = fingerprint.ticket_url @@ -66,15 +66,15 @@ def ticket_link_for(fingerprint, small = false) end def edit_button_for(fingerprint) - css = 'btn btn-default' - text = glyphicon_tag('pencil') + ' Edit Ticket' + css = 'btn btn-outline-secondary' + text = "#{bootstrap_icon_tag('pencil', :bi)} Edit Ticket" link_to(text, edit_error_fingerprint_path(fingerprint), class: css) end def purge_button_for(fingerprint) css = 'btn btn-danger' - text = glyphicon_tag('trash icon-white') + ' Purge' + text = "#{bootstrap_icon_tag('trash-fill', :bi)} Purge" options = { 'method' => :delete, @@ -86,18 +86,18 @@ def purge_button_for(fingerprint) end def previous_button_for(error) - css = 'btn btn-default' + css = 'btn btn-outline-secondary' css << ' disabled' if error.nil? - text = glyphicon_tag('chevron-left') + text = bootstrap_icon_tag('chevron-left', :bi) path = error.nil? ? '#' : error_fingerprint_path(error.error_fingerprint, log_id: error) link_to(text, path, class: css) end def next_button_for(error) - css = 'btn btn-default' + css = 'btn btn-outline-secondary' css << ' disabled' if error.nil? - text = glyphicon_tag('chevron-right') + text = bootstrap_icon_tag('chevron-right', :bi) path = error.nil? ? '#' : error_fingerprint_path(error.error_fingerprint, log_id: error) link_to(text, path, class: css) diff --git a/app/views/layouts/ndr_error/ndr_error.html.erb b/app/views/layouts/ndr_error/ndr_error.html.erb index ea98962..0e829f2 100644 --- a/app/views/layouts/ndr_error/ndr_error.html.erb +++ b/app/views/layouts/ndr_error/ndr_error.html.erb @@ -8,19 +8,14 @@ - <%= form.submit 'Update', class: 'btn btn-primary' %> - <%= link_to 'Cancel', error_fingerprint_path(@fingerprint), class: 'btn btn-default' %> + <%= link_to 'Cancel', error_fingerprint_path(@fingerprint), class: 'btn btn-outline-secondary' %> <% end %> diff --git a/app/views/ndr_error/errors/index.html.erb b/app/views/ndr_error/errors/index.html.erb index 1652f48..244b32b 100644 --- a/app/views/ndr_error/errors/index.html.erb +++ b/app/views/ndr_error/errors/index.html.erb @@ -5,16 +5,14 @@ %>
-
+
<%= form_tag(error_fingerprints_path, method: :get) do %>
<% if @keywords.any? %> - <%= link_to glyphicon_tag('list icon-white') + ' ' + glyphicon_tag('arrow-left icon-white'), error_fingerprints_path, class: 'btn btn-info input-group-addon' %> + <%= link_to bootstrap_icon_tag(:'list-task', :bi) + ' ' + bootstrap_icon_tag(:'arrow-left-circle-fill', :bi), error_fingerprints_path, class: 'btn btn-info' %> <% end %> <%= text_field_tag :q, @keywords.join(', '), class: 'form-control search-query' %> - - - +
<% end %>
@@ -45,7 +43,7 @@ <%= latest_user_for(fingerprint, @keywords) %> -
+
<%= ticket_link_for(fingerprint, true) if fingerprint.ticket_url.present? %>
@@ -57,7 +55,8 @@ - <%= pagination_summary_for(@fingerprints) %> + <%= pagination_summary_for(@fingerprints) %> + <%# TODO: use bootstrap_will_paginate %> <%= will_paginate(@fingerprints) %>
diff --git a/app/views/ndr_error/errors/show.html.erb b/app/views/ndr_error/errors/show.html.erb index 8ca669b..76fbf0b 100644 --- a/app/views/ndr_error/errors/show.html.erb +++ b/app/views/ndr_error/errors/show.html.erb @@ -7,7 +7,7 @@
-
+
<%= ticket_link_for(@fingerprint) if @fingerprint.ticket_url.present? %> <%= edit_button_for(@fingerprint) if user_can_edit_errors? %> @@ -22,7 +22,7 @@ <%= previous_button_for(@error.previous) %>
- + <%= pluralize(@error.similar_errors.length - 1, 'Similar Error') %> Stored @@ -39,13 +39,13 @@ <% if @fingerprint.causal_error_fingerprint %>
- <%= link_to bootstrap_icon_tag('arrow-up') + ' View Cause', error_fingerprint_path(@fingerprint.causal_error_fingerprint), class: 'btn btn-default' %> + <%= link_to bootstrap_icon_tag('arrow-up') + ' View Cause', error_fingerprint_path(@fingerprint.causal_error_fingerprint), class: 'btn btn-outline-secondary' %>
<% end %> <% if @fingerprint.caused_error_fingerprints.any? %>
- + <%= pluralize(@fingerprint.caused_error_fingerprints.length, 'Downstream Error') %> Stored @@ -117,7 +117,7 @@ <% end %>

- <%= check_box_tag :toggle_app_trace_only %> only app trace? + <%= check_box_tag :toggle_app_trace_only %> only app trace? Backtrace:

<% if (highlighted_trace = highlighted_trace_for(@error)).present? %> diff --git a/ndr_error.gemspec b/ndr_error.gemspec index b3cec27..b50b5b5 100644 --- a/ndr_error.gemspec +++ b/ndr_error.gemspec @@ -30,7 +30,7 @@ Gem::Specification.new do |s| s.add_dependency 'will_paginate' - s.add_dependency 'ndr_ui', '< 5.0' + s.add_dependency 'ndr_ui', '>= 5.0' s.add_development_dependency 'pry' s.add_development_dependency 'puma' diff --git a/test/unit/helpers/ndr_error/application_helper_test.rb b/test/unit/helpers/ndr_error/application_helper_test.rb index ca621aa..a538f8d 100644 --- a/test/unit/helpers/ndr_error/application_helper_test.rb +++ b/test/unit/helpers/ndr_error/application_helper_test.rb @@ -3,12 +3,6 @@ module NdrError # Test application-wide helpers class ApplicationHelperTest < ActionView::TestCase - test 'glyphicon_tag' do - expected = '' - actual = glyphicon_tag(:padlock) - assert_equal expected, actual - end - test 'pagination_summary_for within range' do collection = (1..10).to_a.paginate(per_page: 3, page: 2) assert_equal 'Showing 4 - 6 of 10', pagination_summary_for(collection)