tybo 0.1.0 → 0.2.0

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: 137ef5fd100e4717b2e18d5d4172925f6fb46417c364edfdcf751825f744ea4f
4
- data.tar.gz: feaa2b04193b920be1b6299f4ce56f4c8d9e3cf8c91ea78746556488ac5b0f45
3
+ metadata.gz: 22d6c0fae60eed0eb777ab4adeffa5556470941180567062546ab55613ca50ba
4
+ data.tar.gz: c93f5582d498f8a941dbff97d72907ac9b5de9d15d7f51221503ebb7a72d0ed9
5
5
  SHA512:
6
- metadata.gz: c4d303e6b853091ea43824107ef5c3d2705ed7062330aba03b37cc83fdc6338abe3801ac7a936164982d48d2e10cc5dada3b6feed336df65d2e7a9afc204d885
7
- data.tar.gz: 1fb95391f3b3925847e32ac7c0da697ea689fa871ee9b9749dadfa0ba41ba4381569cb203120fe8a5dc3d940335e39e45076ae4f4eeca1a6ab643eba1fd5d047
6
+ metadata.gz: e6f65e79c9fff3d70cff9f097799dbcfb72e980577a991080197ac4279f4b0dd6ae867e283f371c83f3bc0ba7269cfe32b21c6d8a049d0bb58f8e357462d65d2
7
+ data.tar.gz: 8d1584568c6f3df187741547e83bc54c68abe08db27cf9109c8bb1a74db65af71e63cb918b66c0e906ba0987659bdf5300764ab89ca8ab540fc3fe61fa679cfa
@@ -1,34 +1,45 @@
1
- <% link = pagy_link_proc(pagy) -%>
2
- <nav class="mx-auto mt-6 flex max-w-7xl justify-between px-4 text-sm font-medium text-gray-700 sm:px-6 lg:px-8" role="navigation">
3
-
4
- <% if pagy.prev -%>
5
- <div class="min-w-0 flex-1">
6
- <%== link.call(pagy.prev, I18n.t('bo.nav.prev'), 'aria-label="previous" class="inline-flex h-10 items-center rounded-md border border-gray-300 bg-white px-4 hover:bg-gray-100 focus:border-tybo-600 focus:outline-none focus:ring-2 focus:ring-tybo-600 focus:ring-opacity-25 focus:ring-offset-1 focus:ring-offset-tybo-600""') %>
1
+ <% if pagy.next || pagy.prev %>
2
+ <% link = pagy_link_proc(pagy) %>
3
+ <div class="flex items-center justify-between bg-white py-3">
4
+ <div class="hidden sm:flex sm:flex-1 sm:items-center sm:justify-between">
5
+ <div>
6
+ <p class="text-sm text-gray-700">
7
+ <%= I18n.t('bo.pagy.showing').capitalize %>
8
+ <span class="font-bold text-tybo"><%= pagy.from %></span>
9
+ <%= I18n.t('bo.pagy.to') %>
10
+ <span class="font-bold text-tybo"><%= pagy.to %></span>
11
+ <%= I18n.t('bo.pagy.of') %>
12
+ <span class="font-bold text-tybo"><%= pagy.count %></span>
13
+ <%= I18n.t('bo.pagy.results') %>
14
+ </p>
15
+ </div>
16
+ <div>
17
+ <nav class="isolate inline-flex -space-x-px rounded-md shadow-sm" aria-label="Pagination">
18
+ <% if pagy.prev %>
19
+ <a href="<%= pagy_url_for(pagy, pagy.prev) %>" aria-label="precedent" class="relative inline-flex items-center rounded-l-md px-2 py-2 text-gray-400 ring-1 ring-inset ring-gray-300 hover:bg-gray-50 focus:z-20 focus:outline-offset-0">
20
+ <svg class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
21
+ <path fill-rule="evenodd" d="M12.79 5.23a.75.75 0 01-.02 1.06L8.832 10l3.938 3.71a.75.75 0 11-1.04 1.08l-4.5-4.25a.75.75 0 010-1.08l4.5-4.25a.75.75 0 011.06.02z" clip-rule="evenodd" />
22
+ </svg>
23
+ </a>
24
+ <% end %>
25
+ <% pagy.series.each do |item| %>
26
+ <% if item.is_a?(Integer) %>
27
+ <%== link.call(item, item.to_s, 'class="relative inline-flex items-center px-4 py-2 text-sm font-semibold text-gray-900 ring-1 ring-inset ring-gray-300 hover:bg-gray-50 focus:z-20 focus:outline-offset-0"') %>
28
+ <% elsif item.is_a?(String) %>
29
+ <span class="relative z-10 inline-flex items-center bg-tybo-600 px-4 py-2 text-sm font-semibold text-white focus:z-20 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-tybo-600"><%= item %></span>
30
+ <% elsif item == :gap %>
31
+ <span class="relative inline-flex items-center px-4 py-2 text-sm font-semibold text-gray-700 ring-1 ring-inset ring-gray-300 focus:outline-offset-0">...</span>
32
+ <% end %>
33
+ <% end %>
34
+ <% if pagy.next %>
35
+ <a href="<%= pagy_url_for(pagy, pagy.next) %>" aria-label="suivant" class="relative inline-flex items-center rounded-r-md px-2 py-2 text-gray-400 ring-1 ring-inset ring-gray-300 hover:bg-gray-50 focus:z-20 focus:outline-offset-0">
36
+ <svg class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
37
+ <path fill-rule="evenodd" d="M7.21 14.77a.75.75 0 01.02-1.06L11.168 10 7.23 6.29a.75.75 0 111.04-1.08l4.5 4.25a.75.75 0 010 1.08l-4.5 4.25a.75.75 0 01-1.06-.02z" clip-rule="evenodd" />
38
+ </svg>
39
+ </a>
40
+ <% end %>
41
+ </nav>
42
+ </div>
7
43
  </div>
8
- <% else -%>
9
- <div class="min-w-0 flex-1">
10
- <%== link.call(pagy.prev, I18n.t('bo.nav.prev'), 'aria-label="previous" class="hidden"') %>
11
- </div>
12
- <% end -%>
13
- <% if pagy.next -%>
14
- <% pagy.series.each do |item|
15
- # series example: [1, :gap, 7, 8, "9", 10, 11, :gap, 36] -%>
16
- <% if item.is_a?(Integer) -%>
17
- <%== link.call(item, item, 'class="inline-flex h-10 items-center rounded-md border border-gray-300 bg-white px-4 hover:bg-gray-100 focus:border-tybo-600 focus:outline-none focus:ring-2 focus:ring-tybo-600 focus:ring-opacity-25 focus:ring-offset-1 focus:ring-offset-tybo-600"') %>
18
- <% elsif item.is_a?(String) -%>
19
- <%== link.call(item, item, 'class="inline-flex h-10 items-center rounded-md border border-tybo-600 bg-white px-4 ring-1 ring-tybo-600 hover:bg-gray-100 focus:border-tybo-600 focus:outline-none focus:ring-2 focus:ring-tybo-600 focus:ring-opacity-25 focus:ring-offset-1 focus:ring-offset-tybo-600"') %>
20
- <% elsif item == :gap -%>
21
- <span class="inline-flex h-10 items-center px-1.5 text-gray-500">
22
- <%== I18n.t('bo.nav.gap') %>
23
- </span>
24
- <% end -%>
25
- <% end -%>
26
- <div class="flex min-w-0 flex-1 justify-end">
27
- <%== link.call(pagy.next, I18n.t('bo.nav.next'), 'aria-label="next" class="inline-flex h-10 items-center rounded-md border border-gray-300 bg-white px-4 hover:bg-gray-100 focus:border-tybo-600 focus:outline-none focus:ring-2 focus:ring-tybo-600 focus:ring-opacity-25 focus:ring-offset-1 focus:ring-offset-tybo-600"') %>
28
- </div>
29
- <% else -%>
30
- <div class="flex min-w-0 flex-1 justify-end">
31
- <%== link.call(pagy.next, I18n.t('bo.nav.next'), 'aria-label="next" class="hidden"') %>
32
- </div>
33
- <% end -%>
34
- </nav>
44
+ </div>
45
+ <% end %>
@@ -10,7 +10,7 @@
10
10
  <!-- Search Bar -->
11
11
  <%%= render('search_bar') %>
12
12
  <!-- Table -->
13
- <%%= turbo_frame_tag "<%= class_name.underscore.pluralize %>", target: '_top', class: "shadow overflow-hidden rounded border-b border-gray-200" do %>
13
+ <%%= turbo_frame_tag "<%= class_name.underscore.pluralize %>", class: "shadow overflow-hidden rounded border-b border-gray-200" do %>
14
14
  <%%= render('table') %>
15
15
  <div class="py-2">
16
16
  <%%== render partial: 'shared/pagination', locals: { pagy: @pagy } %>
@@ -1,14 +1,16 @@
1
- <%%= render(FormComponent.new(item: <%= class_name.underscore %>)) do |form| %>
2
- <%% current_page = if <%= class_name.underscore %>.persisted?
3
- { label: I18n.t('bo.show'), path: <%= "#{options[:namespace]}_#{class_name.underscore}_path(#{class_name.underscore})"%> }
4
- else
5
- { label: I18n.t('bo.<%= class_name.underscore %>.new').capitalize, path: <%= "new_#{options[:namespace]}_#{class_name.underscore}_path" %> }
6
- end
7
- form.with_title(<%= class_name.underscore %>.persisted? ? <%= class_name.underscore %>.<%=bo_model_title(bo_model)%> : I18n.t('bo.<%= class_name.underscore %>.new').capitalize)
8
- form.with_breadcrumb([
9
- { label: I18n.t('bo.<%= class_name.underscore %>.others').capitalize, path: <%= "#{options[:namespace]}_#{class_name.pluralize.underscore}_path"%> },
10
- current_page
11
- ]) %>
12
- <br>
13
- <%%= render "form", <%= class_name.underscore %>: @<%= class_name.underscore %> %>
1
+ <%%= turbo_frame_tag "<%= class_name.pluralize.underscore %>", target: '_top' do %>
2
+ <%%= render(FormComponent.new(item: <%= class_name.underscore %>)) do |form| %>
3
+ <%% current_page = if <%= class_name.underscore %>.persisted?
4
+ { label: I18n.t('bo.show'), path: <%= "#{options[:namespace]}_#{class_name.underscore}_path(#{class_name.underscore})"%> }
5
+ else
6
+ { label: I18n.t('bo.<%= class_name.underscore %>.new').capitalize, path: <%= "new_#{options[:namespace]}_#{class_name.underscore}_path" %> }
7
+ end
8
+ form.with_title(<%= class_name.underscore %>.persisted? ? <%= class_name.underscore %>.<%=bo_model_title(bo_model)%> : I18n.t('bo.<%= class_name.underscore %>.new').capitalize)
9
+ form.with_breadcrumb([
10
+ { label: I18n.t('bo.<%= class_name.underscore %>.others').capitalize, path: <%= "#{options[:namespace]}_#{class_name.pluralize.underscore}_path"%> },
11
+ current_page
12
+ ]) %>
13
+ <br>
14
+ <%%= render "form", <%= class_name.underscore %>: @<%= class_name.underscore %> %>
15
+ <%% end %>
14
16
  <%% end %>
@@ -22,5 +22,8 @@
22
22
  "next": "Suivant",
23
23
  "prev": "Précédent",
24
24
  "gap": "...",
25
- "show ": "Détails"
25
+ "show": "Détails",
26
+ "showing": "Affichage de",
27
+ "of": "de",
28
+ "results": "resultats"
26
29
  }
@@ -1,45 +1,16 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  def create_translations
4
- %w[en fr].each do |local|
5
- locale_file = "config/locales/bo.#{local}.yml"
6
- unless File.exist?(locale_file)
7
- File.write(locale_file, {
8
- local => {
9
- 'bo' => {
10
- 'filters' => find_existing_translation('filters', local),
11
- 'details' => find_existing_translation('details', local),
12
- 'to' => find_existing_translation('to', local),
13
- 'confirm_delete' => find_existing_translation('confirm_delete', local),
14
- 'record' => {
15
- 'created' => find_existing_translation('created', local),
16
- 'updated' => find_existing_translation('updated', local),
17
- 'destroyed' => find_existing_translation('destroyed', local),
18
- 'show' => find_existing_translation('show', local),
19
- },
20
- 'nav' => {
21
- 'prev' => find_existing_translation('prev', local),
22
- 'next' => find_existing_translation('next', local),
23
- 'gap' => find_existing_translation('gap', local)
24
- },
25
- 'devise' => {
26
- 'password' => find_existing_translation('password', local),
27
- 'new' => find_existing_translation('new', local),
28
- 'forgot_password' => find_existing_translation('forgot_password', local),
29
- }
30
- }
31
- }
32
- }.to_yaml)
33
- end
34
-
4
+ %w[en fr].each do |locale|
5
+ locale_file = "config/locales/bo.#{locale}.yml"
35
6
  yaml_string = File.open locale_file
36
7
  data = YAML.load yaml_string
37
- data[local]['bo'][file_name.underscore] = {
38
- 'one' => find_existing_translation(bo_model.to_s.downcase, local),
39
- 'others' => find_existing_translation(bo_model.to_s.pluralize.downcase, local),
40
- 'new' => find_existing_translation(nil, local),
41
- 'subtitle' => find_existing_translation("list of #{bo_model.to_s.pluralize.downcase}", local),
42
- 'attributes' => model_attributes(data, local)
8
+ data[locale]['bo'][file_name.underscore] = {
9
+ 'one' => find_existing_translation(bo_model.to_s.downcase, locale),
10
+ 'others' => find_existing_translation(bo_model.to_s.pluralize.downcase, locale),
11
+ 'new' => find_existing_translation(nil, locale),
12
+ 'subtitle' => find_existing_translation("list of #{bo_model.to_s.pluralize.downcase}", locale),
13
+ 'attributes' => model_attributes(data, locale)
43
14
 
44
15
  }
45
16
  output = YAML.dump data
@@ -47,17 +18,17 @@ def create_translations
47
18
  end
48
19
  end
49
20
 
50
- def model_attributes(data, local)
51
- hash = data.dig(local, 'bo', file_name.underscore, 'attributes') || {}
21
+ def model_attributes(data, locale)
22
+ hash = data.dig(locale, 'bo', file_name.underscore, 'attributes') || {}
52
23
  model_columns.each do |col|
53
- hash[col.to_s] ||= find_existing_translation(col, local)
24
+ hash[col.to_s] ||= find_existing_translation(col, locale)
54
25
  end
55
26
  hash
56
27
  end
57
28
 
58
- def find_existing_translation(col, local)
59
- return col.to_s.humanize.capitalize if local == 'en'
29
+ def find_existing_translation(col, locale)
30
+ return col.to_s.humanize.capitalize if locale == 'en'
60
31
 
61
- json = JSON.parse(File.read("#{__dir__}/files/#{local}.json"))
32
+ json = JSON.parse(File.read("#{__dir__}/files/#{locale}.json"))
62
33
  json[col.to_s]
63
34
  end
@@ -1,4 +1,4 @@
1
1
  {
2
- "sign_in_as_administator": "Sign in as administator",
2
+ "sign_in_as_administator": "Sign in as administrator",
3
3
  "sign_in_as_user": "Sign in as user"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "sign_in_as_administator": "Espace Administrateur",
3
- "sign_in_as_user": "Espace Utilisateurs"
3
+ "sign_in_as_user": "Espace Utilisateur"
4
4
  }
@@ -1,20 +1,20 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  def create_translations
4
- %w[en fr].each do |local|
5
- locale_file = "config/locales/bo.#{local}.yml"
4
+ %w[en fr].each do |locale|
5
+ locale_file = "config/locales/bo.#{locale}.yml"
6
6
  yaml_string = File.open locale_file
7
7
  data = YAML.load yaml_string
8
- if data[local]['bo']['devise']['sign_in_as']
9
- data[local]['bo']['devise']['sign_in_as'].merge!(
8
+ if data[locale]['bo']['devise']['sign_in_as']
9
+ data[locale]['bo']['devise']['sign_in_as'].merge!(
10
10
  {
11
- "#{singular_name}" => find_existing_translation("sign_in_as_#{singular_name.downcase}", local)
11
+ "#{singular_name}" => find_existing_translation("sign_in_as_#{singular_name.downcase}", locale)
12
12
  }
13
13
  )
14
14
  else
15
- data[local]['bo']['devise'].merge!(
15
+ data[locale]['bo']['devise'].merge!(
16
16
  'sign_in_as' => {
17
- "#{singular_name}" => find_existing_translation("sign_in_as_#{singular_name.downcase}", local)
17
+ "#{singular_name}" => find_existing_translation("sign_in_as_#{singular_name.downcase}", locale)
18
18
  }
19
19
  )
20
20
  end
@@ -24,16 +24,16 @@ def create_translations
24
24
  end
25
25
  end
26
26
 
27
- def find_existing_translation(col, local)
27
+ def find_existing_translation(col, locale)
28
28
  json = {
29
29
  sign_in_as_administrator:{
30
30
  fr: "Espace administrateur",
31
31
  en: "Namespace administrator"
32
32
  },
33
33
  sign_in_as_user: {
34
- fr: "Espace user",
34
+ fr: "Espace utilisateur",
35
35
  en: "Namespace user"
36
36
  }
37
37
  }
38
- json.dig(col.to_sym, local.to_sym)
38
+ json.dig(col.to_sym, locale.to_sym)
39
39
  end
@@ -32,7 +32,7 @@ module.exports = {
32
32
  '950': '#241065',
33
33
  },
34
34
  'red-alert': {
35
- DEFAULT: '#D0342C',
35
+ DEFAULT: '#d0342c',
36
36
  '50': '#fdf3f3',
37
37
  '100': '#fde4e3',
38
38
  '200': '#fbcfcd',
@@ -46,7 +46,5 @@ class TyboInstallGenerator < Rails::Generators::Base
46
46
  "application.register('dropdown', Dropdown)\napplication.register('flash', Flash)\napplication.register('search-form', SearchForm)\napplication.register('ts--search', TsSearch)\napplication.register('ts--select', TsSelect)\n"
47
47
  end
48
48
  end
49
-
50
- private
51
49
  end
52
50
 
@@ -14,7 +14,7 @@
14
14
  "full_name": "Full name",
15
15
  "updated": "Updated",
16
16
  "created": "Created",
17
- "destroyed": "Destroyed",
17
+ "destroyed": "Deleted",
18
18
  "filters": "Filters",
19
19
  "confirm_delete": "Are you sure?",
20
20
  "details": "Details",
@@ -27,5 +27,8 @@
27
27
  "remember_me": "Remember me?",
28
28
  "sign_in": "Sign in",
29
29
  "send_me_reset_password_instructions": "Send me reset password instructions",
30
- "save": "Save"
30
+ "save": "Save",
31
+ "showing": "Showing",
32
+ "of": "of",
33
+ "results": "results"
31
34
  }
@@ -27,5 +27,8 @@
27
27
  "remember_me": "Se souvenir de moi ?",
28
28
  "sign_in": "Connexion",
29
29
  "send_me_reset_password_instructions": "Réinitialiser mon mot de passe",
30
- "save": "Sauvegarder"
30
+ "save": "Sauvegarder",
31
+ "showing": "Affichage de",
32
+ "of": "de",
33
+ "results": "resultats"
31
34
  }
@@ -1,43 +1,49 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  def create_base_translation_files
4
- %w[en fr].each do |local|
5
- locale_file = "config/locales/bo.#{local}.yml"
4
+ %w[en fr].each do |locale|
5
+ locale_file = "config/locales/bo.#{locale}.yml"
6
6
  File.write(locale_file, {
7
- local => {
7
+ locale => {
8
8
  'bo' => {
9
- 'filters' => find_existing_translation('filters', local),
10
- 'show' => find_existing_translation('show', local),
11
- 'to' => find_existing_translation('to', local),
12
- 'confirm_delete' => find_existing_translation('confirm_delete', local),
9
+ 'filters' => find_existing_translation('filters', locale),
10
+ 'show' => find_existing_translation('show', locale),
11
+ 'to' => find_existing_translation('to', locale),
12
+ 'confirm_delete' => find_existing_translation('confirm_delete', locale),
13
13
  'record' => {
14
- 'created' => find_existing_translation('created', local),
15
- 'updated' => find_existing_translation('updated', local),
16
- 'destroyed' => find_existing_translation('destroyed', local),
14
+ 'created' => find_existing_translation('created', locale),
15
+ 'updated' => find_existing_translation('updated', locale),
16
+ 'destroyed' => find_existing_translation('destroyed', locale),
17
17
  },
18
- 'nav' => {
19
- 'prev' => find_existing_translation('prev', local),
20
- 'next' => find_existing_translation('next', local),
21
- 'gap' => find_existing_translation('gap', local)
22
- },
23
- 'devise' => {
24
- 'password' => find_existing_translation('password', local),
25
- 'forgot_password' => find_existing_translation('forgot_password', local),
26
- 'reset_password_instructions' => find_existing_translation('reset_password_instructions', local),
27
- 'remember_me' => find_existing_translation('remember_me', local),
28
- 'sign_in' => find_existing_translation('sign_in', local),
29
- 'send_me_reset_password_instructions' => find_existing_translation('send_me_reset_password_instructions', local),
30
- 'save' => find_existing_translation('save', local),
31
- }
18
+ 'nav' => {
19
+ 'prev' => find_existing_translation('prev', locale),
20
+ 'next' => find_existing_translation('next', locale),
21
+ 'gap' => find_existing_translation('gap', locale)
22
+ },
23
+ 'pagy' => {
24
+ 'showing' => find_existing_translation('showing', locale),
25
+ 'to' => find_existing_translation('to', locale),
26
+ 'of' => find_existing_translation('of', locale),
27
+ 'show' => find_existing_translation('show', locale),
28
+ 'results' => find_existing_translation('results', locale)
29
+ },
30
+ 'devise' => {
31
+ 'password' => find_existing_translation('password', locale),
32
+ 'forgot_password' => find_existing_translation('forgot_password', locale),
33
+ 'reset_password_instructions' => find_existing_translation('reset_password_instructions', locale),
34
+ 'remember_me' => find_existing_translation('remember_me', locale),
35
+ 'sign_in' => find_existing_translation('sign_in', locale),
36
+ 'send_me_reset_password_instructions' => find_existing_translation('send_me_reset_password_instructions', locale),
37
+ 'save' => find_existing_translation('save', locale),
32
38
  }
33
39
  }
34
- }.to_yaml
35
- )
40
+ }
41
+ }.to_yaml)
36
42
  end
37
43
  end
38
44
 
39
- def find_existing_translation(col, local)
40
- json = JSON.parse(File.read("#{__dir__}/files/#{local}.json"))
45
+ def find_existing_translation(col, locale)
46
+ json = JSON.parse(File.read("#{__dir__}/files/#{locale}.json"))
41
47
  json[col.to_s]
42
48
  end
43
49
 
data/lib/tybo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Tybo
2
- VERSION = '0.1.0'
2
+ VERSION = '0.2.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tybo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michel Delpierre
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2023-05-03 00:00:00.000000000 Z
12
+ date: 2023-05-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails