recourse 1.4.1 → 1.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9268c576209f6f9800b0643d3e57b38bdb7016e3aa2916e77ede0279c17b7bf5
4
- data.tar.gz: 8ca59b6be751cdb6d39455dfbd59cef4712a17d7161c2cdd1d4f37a1eabf68e8
3
+ metadata.gz: 4b602626131fdcec3ce7c9dab393579463ccc47ad8221582508f9e83bf12e5a5
4
+ data.tar.gz: 20e1e873b1daeeb00c67c73386d187316b07672260eda464a5083b1cefb81daa
5
5
  SHA512:
6
- metadata.gz: acc7ad511d8934dd8b3e10fc3eea8c52965811ce1388125621300a81496914229c295503ce5452d9d06274fdddf5e6cbc88cd698a9c31ad243b6a05df1050c04
7
- data.tar.gz: 7242a4a4afebe23037595f1d59ea4f31f1a41b8be6c52d57c486171d787334e1c44f2b16c293ad19d343424c3492d8c952bab30319463b4471507fec959403c0
6
+ metadata.gz: 8ab09517eff7b4beb05bac482e28e41113e495eca0d7702f357d7fabc0428a4bfc796c738f6819339185c9a9347a5f6d158a23fe6643de0a6f1dfb6c67a37b0d
7
+ data.tar.gz: 033ccb3444c8460d6d78ab99501248edfa919f578ec2fd31eb269abd5ac140876378ea4de71a9f8804b5817df460a0504a8a4fd26ee2eda3a3dcd5dfda4e7541
@@ -1,9 +1,44 @@
1
1
  # A collection of helper to display root resources as a Bootstrap-styled navbar.
2
2
  module NavigableHelper
3
+ # Boostrap icons to be used for specific resources.
4
+ NAVIGATION_ICONS = {
5
+ 'Answers' => 'question-circle',
6
+ 'Apps' => 'window',
7
+ 'Assessments' => 'clipboard-check',
8
+ 'Bookings' => 'calendar-check',
9
+ 'Campaigns' => 'megaphone',
10
+ 'Conversations' => 'chat-dots',
11
+ 'Counties' => 'map',
12
+ 'Episodes' => 'collection-play',
13
+ 'Evaluations' => 'speedometer2',
14
+ 'Franchises' => 'shop',
15
+ 'Logout' => 'box-arrow-right',
16
+ 'Offer questions' => 'gift',
17
+ 'Optimizations' => 'sliders',
18
+ 'Prompts' => 'terminal',
19
+ 'Providers' => 'people-fill',
20
+ 'Satisfaction questions' => 'emoji-smile',
21
+ 'Searches' => 'search',
22
+ 'Settings' => 'gear',
23
+ 'Specialties' => 'award',
24
+ 'Specialty matches' => 'award',
25
+ 'Verticals' => 'bar-chart',
26
+ 'ZIPs' => 'geo-alt-fill',
27
+ }
28
+
3
29
  # @return [Array<String, String>] caption and URL of each link a top-level resource.
4
30
  def navigation_links
5
31
  Recourse.resources.select { |k, v| v[:routes].include? :index }.map do |resource, options|
6
- [resource.to_s.singularize.humanize.pluralize, url_for(resource)]
32
+ caption = resource.to_s.singularize.humanize.pluralize
33
+ [caption, url_for(resource), navigation_icon_for(caption)]
7
34
  end
8
35
  end
36
+
37
+ private
38
+
39
+ # @return [String] a meaningful icon based on the resource name, or a generic one if not found.
40
+ def navigation_icon_for(caption)
41
+ icon = NAVIGATION_ICONS.fetch caption, 'app'
42
+ tag.i class: "bi bi-#{icon}"
43
+ end
9
44
  end
@@ -1,6 +1,6 @@
1
1
  <% resources = instance_variable_get("@#{controller_path.split('/').last}") || @resources %>
2
2
 
3
- <% content_for :title, controller_path.split('/').last.humanize if @where&.empty? %>
3
+ <% content_for :title, controller_path.split('/').last.singularize.humanize.pluralize if @where&.empty? %>
4
4
 
5
5
  <% model = controller_name.classify.constantize %>
6
6
 
@@ -1,7 +1,16 @@
1
1
  # A module to manage administered resources.
2
2
  module Recourse
3
+ # Common acronyms
4
+ ACRONYMS = %w[API CRM OpenAI PIN URL ZIP]
5
+
3
6
  # Makes Recourse methods like `recourses` available in config/routes.rb
4
7
  class Engine < ::Rails::Engine
8
+ initializer 'recourse.inflections' do
9
+ ActiveSupport::Inflector.inflections do |inflect|
10
+ ACRONYMS.each { |acronym| inflect.acronym acronym }
11
+ end
12
+ end
13
+
5
14
  config.to_prepare do
6
15
  require 'recourse/routing'
7
16
  require 'recourse/recoursive'
@@ -1,3 +1,3 @@
1
1
  module Recourse
2
- VERSION = '1.4.1'
2
+ VERSION = '1.4.2'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: recourse
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.1
4
+ version: 1.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Claudio Baccigalupo