tybo 0.0.40 → 0.1.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 +4 -4
- data/app/components/sidebar_item_component.html.erb +1 -3
- data/app/helpers/tybo/flash_helper.rb +1 -1
- data/app/views/devise/passwords/edit.html.erb +1 -1
- data/app/views/devise/passwords/new.html.erb +1 -1
- data/app/views/devise/sessions/new.html.erb +3 -3
- data/app/views/devise/shared/_links.html.erb +1 -1
- data/app/views/layouts/_errors.html.erb +5 -5
- data/app/views/shared/_pagination.html.erb +15 -13
- data/lib/generators/bo/templates/_table.html.erb +1 -1
- data/lib/generators/bo/utils/files/fr.json +2 -1
- data/lib/generators/bo/utils/translations.rb +12 -6
- data/lib/generators/bo_namespace/bo_namespace_generator.rb +3 -1
- data/lib/generators/bo_namespace/utils/files/en.json +4 -0
- data/lib/generators/bo_namespace/utils/files/fr.json +4 -0
- data/lib/generators/bo_namespace/utils/translations.rb +39 -0
- data/lib/generators/tybo_install/templates/simple_form_tailwind.rb +17 -17
- data/lib/generators/tybo_install/templates/tailwind.config.js +26 -11
- data/lib/generators/tybo_install/templates/tybo_config.rb +3 -3
- data/lib/generators/tybo_install/tybo_install_generator.rb +6 -0
- data/lib/generators/tybo_install/utils/files/en.json +31 -0
- data/lib/generators/tybo_install/utils/files/fr.json +31 -0
- data/lib/generators/tybo_install/utils/translations.rb +43 -0
- data/lib/tybo/version.rb +1 -1
- metadata +9 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 137ef5fd100e4717b2e18d5d4172925f6fb46417c364edfdcf751825f744ea4f
|
4
|
+
data.tar.gz: feaa2b04193b920be1b6299f4ce56f4c8d9e3cf8c91ea78746556488ac5b0f45
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c4d303e6b853091ea43824107ef5c3d2705ed7062330aba03b37cc83fdc6338abe3801ac7a936164982d48d2e10cc5dada3b6feed336df65d2e7a9afc204d885
|
7
|
+
data.tar.gz: 1fb95391f3b3925847e32ac7c0da697ea689fa871ee9b9749dadfa0ba41ba4381569cb203120fe8a5dc3d940335e39e45076ae4f4eeca1a6ab643eba1fd5d047
|
@@ -1,6 +1,4 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
<%= link_to @path, class: "#{current_class} group flex items-center px-2 py-2 text-sm font-medium rounded-md hover:bg-sidebar-200" do %>
|
1
|
+
<%= link_to @path, class: "#{current_page?(@path) ? 'bg-tybo-800 text-white hover:bg-tybo-800' : ''} group flex items-center px-2 py-2 text-sm font-medium rounded-md hover:bg-tybo-800" do %>
|
4
2
|
<%= render(@icon.new) %>
|
5
3
|
|
6
4
|
<span class="flex-1 text-white">
|
@@ -12,7 +12,7 @@
|
|
12
12
|
required: true,
|
13
13
|
class: 'block text-sm font-medium text-gray-700' %>
|
14
14
|
<div class="mt-5">
|
15
|
-
<%= f.button :submit, "
|
15
|
+
<%= f.button :submit, I18n.t("bo.devise.save"), class: "flex w-full justify-center rounded-md border border-transparent bg-tybo-600 py-2 px-4 text-sm font-medium text-white shadow-sm hover:bg-tybo-700 focus:outline-none focus:ring-2 focus:ring-tybo-500 focus:ring-offset-2", data: { turbo: false } %>
|
16
16
|
</div>
|
17
17
|
<% end %>
|
18
18
|
<% end %>
|
@@ -9,7 +9,7 @@
|
|
9
9
|
</div>
|
10
10
|
|
11
11
|
<div class="mt-5">
|
12
|
-
<%= f.button :submit, I18n.t("devise.
|
12
|
+
<%= f.button :submit, I18n.t("bo.devise.send_me_reset_password_instructions"), class: "flex w-full justify-center rounded-md border border-transparent bg-tybo-600 py-2 px-4 text-sm font-medium text-white shadow-sm hover:bg-tybo-700 focus:outline-none focus:ring-2 focus:ring-tybo-500 focus:ring-offset-2", data: { turbo: false } %>
|
13
13
|
</div>
|
14
14
|
<% end %>
|
15
15
|
<% end %>
|
@@ -18,18 +18,18 @@
|
|
18
18
|
<div class="flex items-center justify-between">
|
19
19
|
<div class="flex items-center">
|
20
20
|
<input id="remember_me" name="remember_me" type="checkbox" class="h-4 w-4 rounded border-gray-300 text-tybo-600 focus:ring-tybo-500">
|
21
|
-
<label for="remember_me" class="ml-2 block text-sm text-gray-900"><%=I18n.t("
|
21
|
+
<label for="remember_me" class="ml-2 block text-sm text-gray-900"><%=I18n.t("bo.devise.remember_me")%></label>
|
22
22
|
</div>
|
23
23
|
|
24
24
|
<div class="text-sm">
|
25
25
|
<a href="<%= new_password_path(resource)%>" class="font-medium text-tybo-600 hover:text-tybo-500", data-turbo='false' >
|
26
|
-
<%=I18n.t("devise.
|
26
|
+
<%=I18n.t("bo.devise.forgot_password")%>
|
27
27
|
</a>
|
28
28
|
</div>
|
29
29
|
</div>
|
30
30
|
|
31
31
|
<div class="mt-5">
|
32
|
-
<%= f.button :submit, I18n.t("devise.
|
32
|
+
<%= f.button :submit, I18n.t("bo.devise.sign_in"), class: "flex w-full justify-center rounded-md border border-transparent bg-tybo-600 py-2 px-4 text-sm font-medium text-white shadow-sm hover:bg-tybo-700 focus:outline-none focus:ring-2 focus:ring-tybo-500 focus:ring-offset-2", data: { turbo: false } %>
|
33
33
|
</div>
|
34
34
|
<% end %>
|
35
35
|
<% end %>
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<div class="space-y-1 mt-1">
|
2
2
|
<%- if controller_name != 'sessions' %>
|
3
|
-
<%= link_to I18n.t('devise.
|
3
|
+
<%= link_to I18n.t('bo.devise.sign_in'), new_session_path(resource_name), class: "inline-flex w-full justify-center rounded-md border border-gray-300 bg-white py-2 px-4 text-sm font-medium text-gray-500 shadow-sm hover:bg-gray-50" %><br />
|
4
4
|
<% end %>
|
5
5
|
|
6
6
|
<%- if devise_mapping.registerable? && controller_name != 'registrations' %>
|
@@ -1,16 +1,16 @@
|
|
1
|
-
<div class="rounded-md bg-red-
|
1
|
+
<div class="rounded-md bg-red-alert text-white p-4 my-3" data-controller="flash">
|
2
2
|
<div class="flex">
|
3
3
|
<div class="flex-shrink-0">
|
4
|
-
<svg class="h-5 w-5
|
4
|
+
<svg class="h-5 w-5" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
|
5
5
|
<path fill-rule="evenodd" d="M8.485 3.495c.673-1.167 2.357-1.167 3.03 0l6.28 10.875c.673 1.167-.17 2.625-1.516 2.625H3.72c-1.347 0-2.189-1.458-1.515-2.625L8.485 3.495zM10 6a.75.75 0 01.75.75v3.5a.75.75 0 01-1.5 0v-3.5A.75.75 0 0110 6zm0 9a1 1 0 100-2 1 1 0 000 2z" clip-rule="evenodd"/>
|
6
6
|
</svg>
|
7
7
|
</div>
|
8
8
|
<div class="ml-3">
|
9
|
-
<p class="text-sm font-medium
|
9
|
+
<p class="text-sm font-medium"><%= errors %></p>
|
10
10
|
</div>
|
11
11
|
<div class="ml-auto pl-3">
|
12
12
|
<div class="-mx-1.5 -my-1.5">
|
13
|
-
<button type="button" data-action="flash#dismiss" class="inline-flex bg-red-50 rounded-md p-1.5 text-red-
|
13
|
+
<button type="button" data-action="flash#dismiss" class="inline-flex bg-red-50 rounded-md p-1.5 text-red-alert hover:bg-red-100 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-red-50 focus:ring-red-600">
|
14
14
|
<span class="sr-only">Dismiss</span>
|
15
15
|
<svg class="h-5 w-5" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
|
16
16
|
<path d="M6.28 5.22a.75.75 0 00-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 101.06 1.06L10 11.06l3.72 3.72a.75.75 0 101.06-1.06L11.06 10l3.72-3.72a.75.75 0 00-1.06-1.06L10 8.94 6.28 5.22z"/>
|
@@ -19,4 +19,4 @@
|
|
19
19
|
</div>
|
20
20
|
</div>
|
21
21
|
</div>
|
22
|
-
</div>
|
22
|
+
</div>
|
@@ -1,26 +1,28 @@
|
|
1
1
|
<% link = pagy_link_proc(pagy) -%>
|
2
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
|
-
|
3
|
+
|
4
|
+
<% if pagy.prev -%>
|
4
5
|
<div class="min-w-0 flex-1">
|
5
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""') %>
|
6
7
|
</div>
|
7
|
-
<% else -%>
|
8
|
+
<% else -%>
|
8
9
|
<div class="min-w-0 flex-1">
|
9
10
|
<%== link.call(pagy.prev, I18n.t('bo.nav.prev'), 'aria-label="previous" class="hidden"') %>
|
10
11
|
</div>
|
11
12
|
<% end -%>
|
12
|
-
<% pagy.
|
13
|
-
<%
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
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 -%>
|
21
25
|
<% end -%>
|
22
|
-
<% end -%>
|
23
|
-
<% if pagy.next -%>
|
24
26
|
<div class="flex min-w-0 flex-1 justify-end">
|
25
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"') %>
|
26
28
|
</div>
|
@@ -13,7 +13,7 @@
|
|
13
13
|
<%- end -%>
|
14
14
|
<%%= tr.with_td do %>
|
15
15
|
<%%= link_to <%="#{options[:namespace]}_#{class_name.underscore}_path(#{class_name.underscore})"%>, class: "text-tybo-600 hover:text-tybo-900" do %>
|
16
|
-
<%%= I18n.t('bo.
|
16
|
+
<%%= I18n.t('bo.show') %>
|
17
17
|
<%% end %>
|
18
18
|
<%% end %>
|
19
19
|
<%%= tr.with_td do %>
|
@@ -15,11 +15,17 @@ def create_translations
|
|
15
15
|
'created' => find_existing_translation('created', local),
|
16
16
|
'updated' => find_existing_translation('updated', local),
|
17
17
|
'destroyed' => find_existing_translation('destroyed', local),
|
18
|
-
'
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
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),
|
23
29
|
}
|
24
30
|
}
|
25
31
|
}
|
@@ -50,7 +56,7 @@ def model_attributes(data, local)
|
|
50
56
|
end
|
51
57
|
|
52
58
|
def find_existing_translation(col, local)
|
53
|
-
return col.to_s.humanize.
|
59
|
+
return col.to_s.humanize.capitalize if local == 'en'
|
54
60
|
|
55
61
|
json = JSON.parse(File.read("#{__dir__}/files/#{local}.json"))
|
56
62
|
json[col.to_s]
|
@@ -2,7 +2,8 @@
|
|
2
2
|
|
3
3
|
class BoNamespaceGenerator < Rails::Generators::NamedBase
|
4
4
|
source_root File.expand_path("templates", __dir__)
|
5
|
-
|
5
|
+
require_relative "./utils/translations.rb"
|
6
|
+
|
6
7
|
def create_bo_namespace_files
|
7
8
|
run "bundle exec rails g devise #{file_name.capitalize}"
|
8
9
|
run 'bundle exec rails db:migrate'
|
@@ -11,6 +12,7 @@ class BoNamespaceGenerator < Rails::Generators::NamedBase
|
|
11
12
|
template 'admin_controller.rb', File.join('app/controllers/', "#{singular_name}_controller.rb")
|
12
13
|
template 'seeds.rb', File.join('db/seeds/', "#{plural_name}.rb")
|
13
14
|
template 'side_bar.html.erb', File.join('app/views/', "#{plural_name}/layouts/_side_bar.html.erb")
|
15
|
+
create_translations
|
14
16
|
remove_devise_registration
|
15
17
|
end
|
16
18
|
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
def create_translations
|
4
|
+
%w[en fr].each do |local|
|
5
|
+
locale_file = "config/locales/bo.#{local}.yml"
|
6
|
+
yaml_string = File.open locale_file
|
7
|
+
data = YAML.load yaml_string
|
8
|
+
if data[local]['bo']['devise']['sign_in_as']
|
9
|
+
data[local]['bo']['devise']['sign_in_as'].merge!(
|
10
|
+
{
|
11
|
+
"#{singular_name}" => find_existing_translation("sign_in_as_#{singular_name.downcase}", local)
|
12
|
+
}
|
13
|
+
)
|
14
|
+
else
|
15
|
+
data[local]['bo']['devise'].merge!(
|
16
|
+
'sign_in_as' => {
|
17
|
+
"#{singular_name}" => find_existing_translation("sign_in_as_#{singular_name.downcase}", local)
|
18
|
+
}
|
19
|
+
)
|
20
|
+
end
|
21
|
+
|
22
|
+
output = YAML.dump data
|
23
|
+
File.write(locale_file, output)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def find_existing_translation(col, local)
|
28
|
+
json = {
|
29
|
+
sign_in_as_administrator:{
|
30
|
+
fr: "Espace administrateur",
|
31
|
+
en: "Namespace administrator"
|
32
|
+
},
|
33
|
+
sign_in_as_user: {
|
34
|
+
fr: "Espace user",
|
35
|
+
en: "Namespace user"
|
36
|
+
}
|
37
|
+
}
|
38
|
+
json.dig(col.to_sym, local.to_sym)
|
39
|
+
end
|
@@ -45,10 +45,10 @@ SimpleForm.setup do |config|
|
|
45
45
|
b.optional :pattern
|
46
46
|
b.optional :min_max
|
47
47
|
b.optional :readonly
|
48
|
-
b.use :label, class: 'block text-sm font-medium text-gray-700', error_class: 'text-red-
|
48
|
+
b.use :label, class: 'block text-sm font-medium text-gray-700', error_class: 'text-red-alert'
|
49
49
|
b.use :input,
|
50
50
|
class: 'mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-tybo-500 focus:border-tybo-500 sm:text-sm', error_class: 'border-red-500', valid_class: 'border-green-400'
|
51
|
-
b.use :full_error, wrap_with: { tag: 'p', class: 'mt-2 text-red-
|
51
|
+
b.use :full_error, wrap_with: { tag: 'p', class: 'mt-2 text-red-alert text-xs italic' }
|
52
52
|
b.use :hint, wrap_with: { tag: 'p', class: 'mt-2 text-grey-700 text-xs italic' }
|
53
53
|
end
|
54
54
|
|
@@ -61,9 +61,9 @@ SimpleForm.setup do |config|
|
|
61
61
|
class: 'focus:ring-2 focus:ring-tybo-500:focus ring-offset-2 h-4 w-4 text-tybo-600 border-gray-300 rounded'
|
62
62
|
end
|
63
63
|
b.wrapper tag: 'div', class: 'ml-3 text-sm' do |bb|
|
64
|
-
bb.use :label, class: 'block', error_class: 'text-red-
|
64
|
+
bb.use :label, class: 'block', error_class: 'text-red-alert'
|
65
65
|
bb.use :hint, wrap_with: { tag: 'p', class: 'block text-grey-700 text-xs italic' }
|
66
|
-
bb.use :full_error, wrap_with: { tag: 'p', class: 'block text-red-
|
66
|
+
bb.use :full_error, wrap_with: { tag: 'p', class: 'block text-red-alert text-xs italic' }
|
67
67
|
end
|
68
68
|
end
|
69
69
|
|
@@ -73,12 +73,12 @@ SimpleForm.setup do |config|
|
|
73
73
|
b.use :html5
|
74
74
|
b.optional :readonly
|
75
75
|
b.wrapper :legend_tag, tag: 'legend', class: 'text-sm font-medium text-gray-600',
|
76
|
-
error_class: 'text-red-
|
76
|
+
error_class: 'text-red-alert' do |ba|
|
77
77
|
ba.use :label_text
|
78
78
|
end
|
79
79
|
b.use :input,
|
80
|
-
class: 'focus:ring-2 focus:ring-tybo-500 ring-offset-2 h-4 w-4 text-tybo-600 border-gray-300 rounded', error_class: 'text-red-
|
81
|
-
b.use :full_error, wrap_with: { tag: 'p', class: 'block mt-2 text-red-
|
80
|
+
class: 'focus:ring-2 focus:ring-tybo-500 ring-offset-2 h-4 w-4 text-tybo-600 border-gray-300 rounded', error_class: 'text-red-alert', valid_class: 'text-green-400'
|
81
|
+
b.use :full_error, wrap_with: { tag: 'p', class: 'block mt-2 text-red-alert text-xs italic' }
|
82
82
|
b.use :hint, wrap_with: { tag: 'p', class: 'mt-2 text-grey-700 text-xs italic' }
|
83
83
|
end
|
84
84
|
|
@@ -89,10 +89,10 @@ SimpleForm.setup do |config|
|
|
89
89
|
b.optional :maxlength
|
90
90
|
b.optional :minlength
|
91
91
|
b.optional :readonly
|
92
|
-
b.use :label, class: 'text-sm font-medium text-gray-600 block', error_class: 'text-red-
|
93
|
-
b.use :input, class: 'w-full text-gray-500 px-3 py-2 border rounded', error_class: 'text-red-
|
92
|
+
b.use :label, class: 'text-sm font-medium text-gray-600 block', error_class: 'text-red-alert'
|
93
|
+
b.use :input, class: 'w-full text-gray-500 px-3 py-2 border rounded', error_class: 'text-red-alert border-red-500',
|
94
94
|
valid_class: 'text-green-400'
|
95
|
-
b.use :full_error, wrap_with: { tag: 'p', class: 'mt-2 text-red-
|
95
|
+
b.use :full_error, wrap_with: { tag: 'p', class: 'mt-2 text-red-alert text-xs italic' }
|
96
96
|
b.use :hint, wrap_with: { tag: 'p', class: 'mt-2 text-grey-700 text-xs italic' }
|
97
97
|
end
|
98
98
|
|
@@ -101,31 +101,31 @@ SimpleForm.setup do |config|
|
|
101
101
|
b.use :html5
|
102
102
|
b.optional :readonly
|
103
103
|
b.wrapper :legend_tag, tag: 'legend', class: 'text-sm font-medium text-gray-600',
|
104
|
-
error_class: 'text-red-
|
104
|
+
error_class: 'text-red-alert' do |ba|
|
105
105
|
ba.use :label_text
|
106
106
|
end
|
107
107
|
b.wrapper tag: 'div', class: 'inline-flex space-x-1' do |ba|
|
108
|
-
# ba.use :input, class: 'flex w-auto w-auto text-gray-500 text-sm border-gray-300 rounded p-2', error_class: 'text-red-
|
108
|
+
# ba.use :input, class: 'flex w-auto w-auto text-gray-500 text-sm border-gray-300 rounded p-2', error_class: 'text-red-alert', valid_class: 'text-green-400'
|
109
109
|
ba.use :input,
|
110
110
|
class: 'flex w-auto w-auto shadow appearance-none border border-gray-300 rounded w-full p-2 bg-white focus:outline-none focus:border-blue-500 text-gray-400 leading-4 transition-colors duration-200 ease-in-out'
|
111
111
|
end
|
112
|
-
b.use :full_error, wrap_with: { tag: 'p', class: 'mt-2 text-red-
|
112
|
+
b.use :full_error, wrap_with: { tag: 'p', class: 'mt-2 text-red-alert text-xs italic' }
|
113
113
|
b.use :hint, wrap_with: { tag: 'p', class: 'mt-2 text-grey-700 text-xs italic' }
|
114
114
|
end
|
115
115
|
|
116
116
|
# vertical range input
|
117
|
-
config.wrappers :vertical_range, tag: 'div', class: 'my-4', error_class: 'text-red-
|
117
|
+
config.wrappers :vertical_range, tag: 'div', class: 'my-4', error_class: 'text-red-alert',
|
118
118
|
valid_class: 'text-green-400' do |b|
|
119
119
|
b.use :html5
|
120
120
|
b.use :placeholder
|
121
121
|
b.optional :readonly
|
122
122
|
b.optional :step
|
123
|
-
b.use :label, class: 'text-sm font-medium text-gray-600 block', error_class: 'text-red-
|
123
|
+
b.use :label, class: 'text-sm font-medium text-gray-600 block', error_class: 'text-red-alert'
|
124
124
|
b.wrapper tag: 'div', class: 'flex items-center h-5 my-100' do |ba|
|
125
125
|
ba.use :input, class: 'rounded-lg overflow-hidden appearance-none bg-gray-400 h-3 w-full text-gray-300',
|
126
|
-
error_class: 'text-red-
|
126
|
+
error_class: 'text-red-alert', valid_class: 'text-green-400'
|
127
127
|
end
|
128
|
-
b.use :full_error, wrap_with: { tag: 'p', class: 'mt-2 text-red-
|
128
|
+
b.use :full_error, wrap_with: { tag: 'p', class: 'mt-2 text-red-alert text-xs italic' }
|
129
129
|
b.use :hint, wrap_with: { tag: 'p', class: 'mt-2 text-grey-700 text-xs italic' }
|
130
130
|
end
|
131
131
|
|
@@ -18,17 +18,32 @@ module.exports = {
|
|
18
18
|
},
|
19
19
|
colors: {
|
20
20
|
tybo: {
|
21
|
-
DEFAULT: '#
|
22
|
-
50: '#
|
23
|
-
100: '#
|
24
|
-
200: '#
|
25
|
-
300: '#
|
26
|
-
400: '#
|
27
|
-
500: '#
|
28
|
-
600: '#
|
29
|
-
700: '#
|
30
|
-
800: '#
|
31
|
-
900: '#
|
21
|
+
DEFAULT: '#5626d9',
|
22
|
+
'50': '#f4f3ff',
|
23
|
+
'100': '#eae9fe',
|
24
|
+
'200': '#d8d6fe',
|
25
|
+
'300': '#bbb5fd',
|
26
|
+
'400': '#998bfa',
|
27
|
+
'500': '#785cf6',
|
28
|
+
'600': '#663aed',
|
29
|
+
'700': '#5626d9',
|
30
|
+
'800': '#4921b6',
|
31
|
+
'900': '#3d1d95',
|
32
|
+
'950': '#241065',
|
33
|
+
},
|
34
|
+
'red-alert': {
|
35
|
+
DEFAULT: '#D0342C',
|
36
|
+
'50': '#fdf3f3',
|
37
|
+
'100': '#fde4e3',
|
38
|
+
'200': '#fbcfcd',
|
39
|
+
'300': '#f8ada9',
|
40
|
+
'400': '#f17e78',
|
41
|
+
'500': '#e7544c',
|
42
|
+
'600': '#d0342c',
|
43
|
+
'700': '#b12b24',
|
44
|
+
'800': '#932721',
|
45
|
+
'900': '#7a2622',
|
46
|
+
'950': '#42100d',
|
32
47
|
}
|
33
48
|
}
|
34
49
|
},
|
@@ -3,7 +3,7 @@
|
|
3
3
|
Tybo.configure do |config|
|
4
4
|
# customise logo and cover url
|
5
5
|
# should be an external url or image should be present in (app/assets/images)
|
6
|
-
config.logo_url = '
|
7
|
-
config.nav_logo_url = '
|
8
|
-
config.cover_url = '
|
6
|
+
config.logo_url = 'logo.svg'
|
7
|
+
config.nav_logo_url = 'nav_logo.png'
|
8
|
+
config.cover_url = 'cover.svg'
|
9
9
|
end
|
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
class TyboInstallGenerator < Rails::Generators::Base
|
4
4
|
source_root File.expand_path("templates", __dir__)
|
5
|
+
require_relative "./utils/translations.rb"
|
5
6
|
|
6
7
|
def install_dependencies
|
7
8
|
gem 'tailwindcss-rails', '~> 2.0', '>= 2.0.21' unless Bundler.locked_gems.specs.any? { |gem| gem.name == 'tailwindcss-rails' }
|
@@ -12,6 +13,7 @@ class TyboInstallGenerator < Rails::Generators::Base
|
|
12
13
|
end
|
13
14
|
|
14
15
|
def create_configuration_files
|
16
|
+
create_base_translation_files
|
15
17
|
template 'application.tailwind.css', File.join('app/assets/stylesheets/application.tailwind.css'), force: true
|
16
18
|
template 'tailwind.config.js', File.join('config/tailwind.config.js'), force: true
|
17
19
|
template 'tom-select.css', File.join('app/assets/stylesheets/tom-select.css')
|
@@ -29,6 +31,8 @@ class TyboInstallGenerator < Rails::Generators::Base
|
|
29
31
|
route "mount Tybo::Engine => \"/tybo\""
|
30
32
|
end
|
31
33
|
|
34
|
+
|
35
|
+
|
32
36
|
def install_administrators
|
33
37
|
run 'rails g bo_namespace Administrator'
|
34
38
|
end
|
@@ -42,5 +46,7 @@ class TyboInstallGenerator < Rails::Generators::Base
|
|
42
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"
|
43
47
|
end
|
44
48
|
end
|
49
|
+
|
50
|
+
private
|
45
51
|
end
|
46
52
|
|
@@ -0,0 +1,31 @@
|
|
1
|
+
{
|
2
|
+
"id": "Identifier",
|
3
|
+
"email": "Email",
|
4
|
+
"password": "Password",
|
5
|
+
"created_at": "Creation date",
|
6
|
+
"updated_at": "Modification date",
|
7
|
+
"title": "Title",
|
8
|
+
"content": "Content",
|
9
|
+
"description": "Description",
|
10
|
+
"name": "Name",
|
11
|
+
"position": "Position",
|
12
|
+
"first_name": "First name",
|
13
|
+
"last_name": "Last name",
|
14
|
+
"full_name": "Full name",
|
15
|
+
"updated": "Updated",
|
16
|
+
"created": "Created",
|
17
|
+
"destroyed": "Destroyed",
|
18
|
+
"filters": "Filters",
|
19
|
+
"confirm_delete": "Are you sure?",
|
20
|
+
"details": "Details",
|
21
|
+
"to": "to",
|
22
|
+
"next": "Next",
|
23
|
+
"prev": "Previous",
|
24
|
+
"show": "Show",
|
25
|
+
"gap": "...",
|
26
|
+
"forgot_password": "Forgot password?",
|
27
|
+
"remember_me": "Remember me?",
|
28
|
+
"sign_in": "Sign in",
|
29
|
+
"send_me_reset_password_instructions": "Send me reset password instructions",
|
30
|
+
"save": "Save"
|
31
|
+
}
|
@@ -0,0 +1,31 @@
|
|
1
|
+
{
|
2
|
+
"id": "Identifiant",
|
3
|
+
"email": "Email",
|
4
|
+
"password": "Mot de passe",
|
5
|
+
"created_at": "Date de création",
|
6
|
+
"updated_at": "Date de modification",
|
7
|
+
"title": "Titre",
|
8
|
+
"content": "Contenu",
|
9
|
+
"description": "Description",
|
10
|
+
"name": "Nom",
|
11
|
+
"position": "Position",
|
12
|
+
"first_name": "Prénom",
|
13
|
+
"last_name": "Nom",
|
14
|
+
"full_name": "Nom complet",
|
15
|
+
"updated": "Modification effectuée",
|
16
|
+
"created": "Création effectuée",
|
17
|
+
"destroyed": "Suppression effectuée",
|
18
|
+
"filters": "Filtres",
|
19
|
+
"confirm_delete": "Êtes-vous sûr ?",
|
20
|
+
"details": "Détails",
|
21
|
+
"to": "à",
|
22
|
+
"next": "Suivant",
|
23
|
+
"prev": "Précédent",
|
24
|
+
"gap": "...",
|
25
|
+
"show": "Détails",
|
26
|
+
"forgot_password": "Mot de passe oublié ?",
|
27
|
+
"remember_me": "Se souvenir de moi ?",
|
28
|
+
"sign_in": "Connexion",
|
29
|
+
"send_me_reset_password_instructions": "Réinitialiser mon mot de passe",
|
30
|
+
"save": "Sauvegarder"
|
31
|
+
}
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
def create_base_translation_files
|
4
|
+
%w[en fr].each do |local|
|
5
|
+
locale_file = "config/locales/bo.#{local}.yml"
|
6
|
+
File.write(locale_file, {
|
7
|
+
local => {
|
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),
|
13
|
+
'record' => {
|
14
|
+
'created' => find_existing_translation('created', local),
|
15
|
+
'updated' => find_existing_translation('updated', local),
|
16
|
+
'destroyed' => find_existing_translation('destroyed', local),
|
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
|
+
}
|
32
|
+
}
|
33
|
+
}
|
34
|
+
}.to_yaml
|
35
|
+
)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def find_existing_translation(col, local)
|
40
|
+
json = JSON.parse(File.read("#{__dir__}/files/#{local}.json"))
|
41
|
+
json[col.to_s]
|
42
|
+
end
|
43
|
+
|
data/lib/tybo/version.rb
CHANGED
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.0
|
4
|
+
version: 0.1.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-
|
12
|
+
date: 2023-05-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -264,12 +264,18 @@ files:
|
|
264
264
|
- lib/generators/bo_namespace/templates/policy.rb
|
265
265
|
- lib/generators/bo_namespace/templates/seeds.rb
|
266
266
|
- lib/generators/bo_namespace/templates/side_bar.html.erb
|
267
|
+
- lib/generators/bo_namespace/utils/files/en.json
|
268
|
+
- lib/generators/bo_namespace/utils/files/fr.json
|
269
|
+
- lib/generators/bo_namespace/utils/translations.rb
|
267
270
|
- lib/generators/tybo_install/templates/application.tailwind.css
|
268
271
|
- lib/generators/tybo_install/templates/simple_form_tailwind.rb
|
269
272
|
- lib/generators/tybo_install/templates/tailwind.config.js
|
270
273
|
- lib/generators/tybo_install/templates/tom-select.css
|
271
274
|
- lib/generators/tybo_install/templates/tybo_config.rb
|
272
275
|
- lib/generators/tybo_install/tybo_install_generator.rb
|
276
|
+
- lib/generators/tybo_install/utils/files/en.json
|
277
|
+
- lib/generators/tybo_install/utils/files/fr.json
|
278
|
+
- lib/generators/tybo_install/utils/translations.rb
|
273
279
|
- lib/tybo.rb
|
274
280
|
- lib/tybo/configuration.rb
|
275
281
|
- lib/tybo/engine.rb
|
@@ -294,7 +300,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
294
300
|
- !ruby/object:Gem::Version
|
295
301
|
version: '0'
|
296
302
|
requirements: []
|
297
|
-
rubygems_version: 3.3.
|
303
|
+
rubygems_version: 3.0.3.1
|
298
304
|
signing_key:
|
299
305
|
specification_version: 4
|
300
306
|
summary: A tailwind custom admin engine for Ruby on Rails
|