avo 2.9.1.pre3 → 2.9.1.pre6
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of avo might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Gemfile.lock +3 -1
- data/app/assets/builds/avo.css +28 -0
- data/app/assets/builds/avo.js +63 -63
- data/app/assets/builds/avo.js.map +2 -2
- data/app/components/avo/actions_component.rb +6 -2
- data/app/components/avo/fields/common/key_value_component.html.erb +2 -2
- data/app/components/avo/fields/common/single_file_viewer_component.rb +1 -1
- data/app/components/avo/fields/date_field/edit_component.html.erb +1 -0
- data/app/components/avo/fields/date_time_field/edit_component.html.erb +9 -11
- data/app/components/avo/fields/date_time_field/index_component.html.erb +1 -9
- data/app/components/avo/fields/date_time_field/show_component.html.erb +1 -9
- data/app/components/avo/index/ordering/button_component.rb +5 -13
- data/app/components/avo/index/resource_controls_component.html.erb +2 -2
- data/app/components/avo/index/resource_controls_component.rb +5 -1
- data/app/components/avo/views/resource_edit_component.rb +1 -1
- data/app/components/avo/views/resource_index_component.rb +2 -2
- data/app/controllers/avo/application_controller.rb +24 -3
- data/app/javascript/avo.js +5 -1
- data/app/javascript/js/controllers/fields/date_field_controller.js +24 -68
- data/app/javascript/js/controllers/tabs_controller.js +80 -0
- data/app/views/avo/partials/_javascript.html.erb +1 -1
- data/config/routes.rb +1 -1
- data/lib/avo/app.rb +11 -4
- data/lib/avo/base_card.rb +1 -7
- data/lib/avo/base_resource.rb +1 -1
- data/lib/avo/concerns/handles_field_args.rb +1 -1
- data/lib/avo/concerns/model_class_constantized.rb +23 -0
- data/lib/avo/dashboards/base_dashboard.rb +1 -1
- data/lib/avo/fields/date_field.rb +2 -0
- data/lib/avo/fields/date_time_field.rb +9 -13
- data/lib/avo/fields/has_base_field.rb +3 -1
- data/lib/avo/fields/has_one_field.rb +4 -1
- data/lib/avo/menu/builder.rb +8 -7
- data/lib/avo/services/uri_service.rb +71 -0
- data/lib/avo/version.rb +1 -1
- data/lib/avo.rb +1 -0
- data/lib/generators/avo/templates/locales/avo.fr.yml +115 -0
- data/public/avo-assets/avo.js +63 -63
- data/public/avo-assets/avo.js.map +2 -2
- metadata +6 -2
@@ -2,29 +2,25 @@ module Avo
|
|
2
2
|
module Fields
|
3
3
|
class DateTimeField < DateField
|
4
4
|
attr_reader :format
|
5
|
-
attr_reader :picker_format
|
6
5
|
attr_reader :time_24hr
|
7
6
|
attr_reader :timezone
|
8
7
|
|
9
8
|
def initialize(id, **args, &block)
|
10
9
|
super(id, **args, &block)
|
11
10
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
add_string_prop args, :timezone
|
11
|
+
@picker_format = args[:picker_format].present? ? args[:picker_format] : "Y-m-d H:i:S"
|
12
|
+
@time_24hr = args[:time_24hr].present? ? args[:time_24hr] : false
|
13
|
+
@timezone = args[:timezone].present? ? args[:timezone] : Rails.application.config.time_zone
|
16
14
|
end
|
17
15
|
|
18
16
|
def formatted_value
|
19
17
|
return nil if value.nil?
|
20
18
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
value.utc.to_formatted_s(:db)
|
19
|
+
if @format.is_a?(Symbol)
|
20
|
+
value.to_time.in_time_zone(timezone).to_formatted_s(@format)
|
21
|
+
else
|
22
|
+
value.to_time.in_time_zone(timezone).strftime(@format)
|
23
|
+
end
|
28
24
|
end
|
29
25
|
|
30
26
|
def fill_field(model, key, value, params)
|
@@ -36,7 +32,7 @@ module Avo
|
|
36
32
|
|
37
33
|
return model if value.blank?
|
38
34
|
|
39
|
-
model[id] = value.in_time_zone(
|
35
|
+
model[id] = value.to_time.in_time_zone(Rails.application.config.time_zone)
|
40
36
|
|
41
37
|
model
|
42
38
|
end
|
@@ -29,7 +29,9 @@ module Avo
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def frame_url
|
32
|
-
|
32
|
+
Avo::Services::URIService.parse(@resource.record_path)
|
33
|
+
.append_path(id.to_s)
|
34
|
+
.append_query(turbo_frame: turbo_frame.to_s).to_s
|
33
35
|
end
|
34
36
|
|
35
37
|
# The value
|
@@ -22,7 +22,10 @@ module Avo
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def frame_url
|
25
|
-
|
25
|
+
Avo::Services::URIService.parse(@resource.record_path)
|
26
|
+
.append_paths(id, value.id)
|
27
|
+
.append_query(turbo_frame: turbo_frame)
|
28
|
+
.to_s
|
26
29
|
end
|
27
30
|
|
28
31
|
def fill_field(model, key, value, params)
|
data/lib/avo/menu/builder.rb
CHANGED
@@ -5,6 +5,13 @@ class Avo::Menu::Builder
|
|
5
5
|
end
|
6
6
|
end
|
7
7
|
|
8
|
+
delegate :context, to: Avo::App
|
9
|
+
delegate :current_user, to: Avo::App
|
10
|
+
delegate :params, to: Avo::App
|
11
|
+
delegate :request, to: Avo::App
|
12
|
+
delegate :root_path, to: Avo::App
|
13
|
+
delegate :view_context, to: Avo::App
|
14
|
+
|
8
15
|
def initialize(name: nil, items: [])
|
9
16
|
@menu = Avo::Menu::Menu.new
|
10
17
|
|
@@ -60,7 +67,7 @@ class Avo::Menu::Builder
|
|
60
67
|
# Add all the tools
|
61
68
|
def all_tools(**args)
|
62
69
|
Avo::App.tools_for_navigation.each do |tool|
|
63
|
-
link tool.humanize, path:
|
70
|
+
link tool.humanize, path: root_path(paths: [tool])
|
64
71
|
end
|
65
72
|
end
|
66
73
|
|
@@ -68,10 +75,4 @@ class Avo::Menu::Builder
|
|
68
75
|
def build
|
69
76
|
@menu
|
70
77
|
end
|
71
|
-
|
72
|
-
protected
|
73
|
-
|
74
|
-
def root_path
|
75
|
-
Avo::App.root_path
|
76
|
-
end
|
77
78
|
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
module Avo
|
2
|
+
module Services
|
3
|
+
class URIService
|
4
|
+
class << self
|
5
|
+
def parse(path)
|
6
|
+
self.new path
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
attr_reader :uri
|
11
|
+
|
12
|
+
def initialize(path = '')
|
13
|
+
@uri = Addressable::URI.parse(path)
|
14
|
+
end
|
15
|
+
|
16
|
+
def append_paths(*paths)
|
17
|
+
paths = Array.wrap(paths).flatten
|
18
|
+
|
19
|
+
return self if paths.blank?
|
20
|
+
|
21
|
+
# Add the intermediary forward slash
|
22
|
+
@uri.path = @uri.path.concat("/") unless @uri.path.ends_with? "/"
|
23
|
+
|
24
|
+
# Add the paths to the URI
|
25
|
+
@uri.merge!(path: @uri.path.concat(join_paths(paths)))
|
26
|
+
|
27
|
+
self
|
28
|
+
end
|
29
|
+
alias_method :append_path, :append_paths
|
30
|
+
|
31
|
+
def append_query(params)
|
32
|
+
params = if params.is_a? Hash
|
33
|
+
params.map do |key, value|
|
34
|
+
"#{key}=#{value}"
|
35
|
+
end
|
36
|
+
else
|
37
|
+
{}
|
38
|
+
end
|
39
|
+
|
40
|
+
return self if params.blank?
|
41
|
+
|
42
|
+
# Add the query params to the URI
|
43
|
+
@uri.merge!(query: [@uri.query, *params].compact.join("&"))
|
44
|
+
|
45
|
+
self
|
46
|
+
end
|
47
|
+
|
48
|
+
def to_s
|
49
|
+
@uri.to_s
|
50
|
+
end
|
51
|
+
|
52
|
+
private
|
53
|
+
|
54
|
+
def join_paths(paths)
|
55
|
+
paths.map do |path|
|
56
|
+
sanitize_path path
|
57
|
+
end
|
58
|
+
.join("/")
|
59
|
+
end
|
60
|
+
|
61
|
+
# Removes the forward slash if it's present at the start of the path
|
62
|
+
def sanitize_path(path)
|
63
|
+
if path.to_s.starts_with? '/'
|
64
|
+
path = path[1..-1]
|
65
|
+
end
|
66
|
+
|
67
|
+
path
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
data/lib/avo/version.rb
CHANGED
data/lib/avo.rb
CHANGED
@@ -0,0 +1,115 @@
|
|
1
|
+
fr:
|
2
|
+
avo:
|
3
|
+
dashboard: 'Tableau de bord'
|
4
|
+
dashboards: 'Tableaux de bord'
|
5
|
+
choose_a_country: 'Sélectionnez un pays'
|
6
|
+
choose_an_option: 'Sélectionnez une option'
|
7
|
+
are_you_sure_you_want_to_run_this_option: 'Etes-vous sûr de vouloir exécuter cette action ?'
|
8
|
+
are_you_sure_detach_item: 'Êtes-vous sûr de vouloir détacher %{item}.'
|
9
|
+
run: 'Exécuter'
|
10
|
+
cancel: 'Annuler'
|
11
|
+
action_ran_successfully: "L'action s'est exécutée avec succès !"
|
12
|
+
details: "détails"
|
13
|
+
unauthorized: 'Non autorisé'
|
14
|
+
attachment_class_attached: '%{attachment_class} attaché.'
|
15
|
+
attachment_class_detached: '%{attachment_class} détaché.'
|
16
|
+
resource_updated: 'Ressource mise à jour'
|
17
|
+
resource_created: 'Ressource créee'
|
18
|
+
resource_destroyed: 'Ressource détruite'
|
19
|
+
switch_to_view: "Passez à la vue %{view_type}"
|
20
|
+
click_to_reveal_filters: "Cliquez pour révéler les filtres"
|
21
|
+
attachment_destroyed: 'Pièce jointe détruite'
|
22
|
+
failed_to_find_attachment: 'Impossible de trouver la pièce jointe'
|
23
|
+
you_missed_something_check_form: 'Vous avez peut-être oublié quelque chose. Veuillez vérifier le formulaire'
|
24
|
+
remove_selection: 'Supprimer la sélection'
|
25
|
+
select_item: 'Sélectionnez un élément'
|
26
|
+
select_all: 'Sélectionner tout sur la page'
|
27
|
+
delete_file: 'Supprimer le fichier'
|
28
|
+
delete: 'supprimer'
|
29
|
+
delete_item: 'Supprimer %{item}'
|
30
|
+
download_item: 'Télécharger %{item}'
|
31
|
+
download_file: 'Télécharger le fichier'
|
32
|
+
download: 'Télécharger'
|
33
|
+
view: 'Vue'
|
34
|
+
view_item: 'voir %{item}'
|
35
|
+
edit: 'éditer'
|
36
|
+
edit_item: 'éditer %{item}'
|
37
|
+
detach_item: 'détacher %{item}'
|
38
|
+
number_of_items:
|
39
|
+
zero: 'aucun %{item}'
|
40
|
+
one: 'un %{item}'
|
41
|
+
other: '%{count} %{item}'
|
42
|
+
x_items_more:
|
43
|
+
zero: 'aucun élément supplémentaire'
|
44
|
+
one: 'un élément de plus'
|
45
|
+
other: '%{count} éléments en plus'
|
46
|
+
are_you_sure: 'Êtes-vous sûr ?'
|
47
|
+
filters: 'Filtres'
|
48
|
+
per_page: 'Par page'
|
49
|
+
more: 'Plus'
|
50
|
+
attach: 'Attacher'
|
51
|
+
cancel: 'Annuler'
|
52
|
+
save: 'Enregistrer'
|
53
|
+
attach_and_attach_another: 'joindre et joindre un autre'
|
54
|
+
hide_content: 'Cacher le contenu'
|
55
|
+
show_content: 'Afficher le contenu'
|
56
|
+
no_related_item_found: "Aucun %{item} apparenté n'a été trouvé"
|
57
|
+
no_item_found: 'Aucun %{item} trouvé'
|
58
|
+
loading: 'Chargement'
|
59
|
+
confirm: 'Confirmer'
|
60
|
+
actions: 'Actions'
|
61
|
+
resources: 'Ressources'
|
62
|
+
oops_nothing_found: "Oups ! Rien n'a été trouvé..."
|
63
|
+
type_to_search: 'Type à rechercher.'
|
64
|
+
and_x_other_resources: 'et %{count} autres ressources'
|
65
|
+
go_back: 'Retourner en arrière'
|
66
|
+
home: 'Accueil'
|
67
|
+
new: 'Nouveau'
|
68
|
+
attach_item: 'Attacher %{item}'
|
69
|
+
choose_item: 'Choisir %{item}'
|
70
|
+
create_new_item: 'Créer un nouveau %{item}'
|
71
|
+
table_view: 'Vue table'
|
72
|
+
grid_view: 'Vue grille'
|
73
|
+
next_page: 'Page suivante'
|
74
|
+
prev_page: 'Page précédente'
|
75
|
+
list_is_empty: 'La liste est vide'
|
76
|
+
field_translations:
|
77
|
+
file:
|
78
|
+
zero: 'fichier'
|
79
|
+
one: 'fichier'
|
80
|
+
other: 'fichiers'
|
81
|
+
people:
|
82
|
+
zero: 'personne'
|
83
|
+
one: 'personne'
|
84
|
+
other: 'personnes'
|
85
|
+
resource_translations:
|
86
|
+
user:
|
87
|
+
zero: 'utilisateur'
|
88
|
+
one: 'utilisateurs'
|
89
|
+
other: 'utilisateurs'
|
90
|
+
reset_filters: 'Réinitialiser les filtres'
|
91
|
+
not_authorized: "Vous n'êtes pas autorisé à effectuer cette action."
|
92
|
+
search:
|
93
|
+
placeholder: 'Rechercher'
|
94
|
+
cancel_button: 'Annuler'
|
95
|
+
sign_out: 'Se déconnecter'
|
96
|
+
failed: 'Échec'
|
97
|
+
failed_to_load: 'Impossible de charger'
|
98
|
+
key_value_field:
|
99
|
+
key: 'Clé'
|
100
|
+
value: 'Valeur'
|
101
|
+
add_row: 'Ajouter une ligne'
|
102
|
+
delete_row: 'Supprimer une ligne'
|
103
|
+
was_successfully_created: 'a été créé avec succès'
|
104
|
+
was_successfully_updated: 'a été mis à jour avec succès'
|
105
|
+
clear_value: "Effacer la valeur"
|
106
|
+
tools: Outils
|
107
|
+
order:
|
108
|
+
reorder_record: Réorganiser
|
109
|
+
higher: Déplacer plus haut
|
110
|
+
lower: Déplacer plus bas
|
111
|
+
to_top: Déplacer tout en haut
|
112
|
+
to_bottom: Déplacer tout en bas
|
113
|
+
empty_dashboard_message: Ajouter des cartes à ce tableau de bord
|
114
|
+
no_cards_present: Aucune carte présente
|
115
|
+
no_options_available: Aucune option disponible
|