tybo 0.1.2 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 19a15b6fd183a3db2358d6da62faaebeb078daf9b6966ba05c8c098e311d35ff
4
- data.tar.gz: 22c8a8d66b275c80c04fe63f016fbcad26fa1fff50fea299ae9c04517e0c1586
3
+ metadata.gz: 22d6c0fae60eed0eb777ab4adeffa5556470941180567062546ab55613ca50ba
4
+ data.tar.gz: c93f5582d498f8a941dbff97d72907ac9b5de9d15d7f51221503ebb7a72d0ed9
5
5
  SHA512:
6
- metadata.gz: 5d5932d7d1506b24465b9b82768fe1d2d2a91a6c657a6733537bc7cb094afe602f7e74ecd965aaf0c701cf8863aa8eee641e201d1ad99063d6c883e1133ac3e5
7
- data.tar.gz: 8d2b29f180b5c1acb7f54d3edd28c9c2e4f435f22acd13649a4240c7111c58243e21fd46deb7e85cd3e4266d050209ed9af5a0c55501af35a29c251e7e27cc38
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
  }
@@ -3,35 +3,6 @@
3
3
  def create_translations
4
4
  %w[en fr].each do |locale|
5
5
  locale_file = "config/locales/bo.#{locale}.yml"
6
- unless File.exist?(locale_file)
7
- File.write(locale_file, {
8
- locale => {
9
- 'bo' => {
10
- 'filters' => find_existing_translation('filters', locale),
11
- 'details' => find_existing_translation('details', locale),
12
- 'to' => find_existing_translation('to', locale),
13
- 'confirm_delete' => find_existing_translation('confirm_delete', locale),
14
- 'record' => {
15
- 'created' => find_existing_translation('created', locale),
16
- 'updated' => find_existing_translation('updated', locale),
17
- 'destroyed' => find_existing_translation('destroyed', locale),
18
- 'show' => find_existing_translation('show', locale),
19
- },
20
- 'nav' => {
21
- 'prev' => find_existing_translation('prev', locale),
22
- 'next' => find_existing_translation('next', locale),
23
- 'gap' => find_existing_translation('gap', locale)
24
- },
25
- 'devise' => {
26
- 'password' => find_existing_translation('password', locale),
27
- 'new' => find_existing_translation('new', locale),
28
- 'forgot_password' => find_existing_translation('forgot_password', locale),
29
- }
30
- }
31
- }
32
- }.to_yaml)
33
- end
34
-
35
6
  yaml_string = File.open locale_file
36
7
  data = YAML.load yaml_string
37
8
  data[locale]['bo'][file_name.underscore] = {
@@ -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
  }
@@ -20,6 +20,13 @@
20
20
  'next' => find_existing_translation('next', locale),
21
21
  'gap' => find_existing_translation('gap', locale)
22
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
+ },
23
30
  'devise' => {
24
31
  'password' => find_existing_translation('password', locale),
25
32
  'forgot_password' => find_existing_translation('forgot_password', locale),
data/lib/tybo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Tybo
2
- VERSION = '0.1.2'
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.2
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-05 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