bmc 1.0.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.
Files changed (97) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +10 -0
  3. data/README.md +28 -0
  4. data/Rakefile +41 -0
  5. data/app/assets/config/bmc_manifest.js +2 -0
  6. data/app/controllers/bmc/application_controller.rb +3 -0
  7. data/app/controllers/bmc/filters_controller.rb +38 -0
  8. data/app/controllers/concerns/bmc/api_controller_concern.rb +69 -0
  9. data/app/controllers/concerns/bmc/back_url_concern.rb +26 -0
  10. data/app/emails/bmc/email.rb +113 -0
  11. data/app/filters/bmc/filter/by_date.rb +6 -0
  12. data/app/filters/bmc/filter/by_date_begin.rb +7 -0
  13. data/app/filters/bmc/filter/by_date_end.rb +7 -0
  14. data/app/filters/bmc/filter/by_date_or_datetime_period.rb +56 -0
  15. data/app/filters/bmc/filter/by_date_period.rb +5 -0
  16. data/app/filters/bmc/filter/by_datetime_period.rb +5 -0
  17. data/app/filters/bmc/filter/by_key_value.rb +27 -0
  18. data/app/filters/bmc/filter/by_key_values.rb +13 -0
  19. data/app/filters/bmc/filter.rb +86 -0
  20. data/app/forms/bmc/mini_form_object.rb +29 -0
  21. data/app/helpers/bmc/all_helpers.rb +15 -0
  22. data/app/helpers/bmc/bootstrap_helper.rb +63 -0
  23. data/app/helpers/bmc/button_helper.rb +150 -0
  24. data/app/helpers/bmc/filters_helper.rb +16 -0
  25. data/app/helpers/bmc/font_awesome_helper.rb +67 -0
  26. data/app/helpers/bmc/form_helper.rb +24 -0
  27. data/app/helpers/bmc/i18n_helper.rb +5 -0
  28. data/app/helpers/bmc/link_helper.rb +42 -0
  29. data/app/helpers/bmc/pagination_helper.rb +22 -0
  30. data/app/helpers/bmc/routes_helper.rb +24 -0
  31. data/app/helpers/bmc/sorting_helper.rb +55 -0
  32. data/app/helpers/bmc/text_helper.rb +127 -0
  33. data/app/helpers/h.rb +3 -0
  34. data/app/jobs/concerns/bmc/setup_job_concern.rb +35 -0
  35. data/app/libs/bmc/collection_update.rb +38 -0
  36. data/app/libs/bmc/fcm/notifier.rb +32 -0
  37. data/app/libs/bmc/fcm/request.rb +54 -0
  38. data/app/libs/bmc/mini_model_serializer/serialize.rb +30 -0
  39. data/app/libs/bmc/mini_model_serializer/serializer.rb +23 -0
  40. data/app/libs/bmc/monkey.rb +39 -0
  41. data/app/libs/bmc/sortable_uuid_generator.rb +11 -0
  42. data/app/libs/bmc/token_generator.rb +37 -0
  43. data/app/mailers/bmc/application_mailer.rb +2 -0
  44. data/app/mailers/bmc/generic_mailer.rb +9 -0
  45. data/app/models/concerns/bmc/active_record_uuid_concern.rb +17 -0
  46. data/app/models/concerns/bmc/default_values_concern.rb +14 -0
  47. data/app/models/concerns/bmc/model_i18n.rb +56 -0
  48. data/app/models/concerns/bmc/model_to_s.rb +9 -0
  49. data/app/models/concerns/bmc/pluck_distinct.rb +13 -0
  50. data/app/models/concerns/bmc/pluck_to_hash.rb +9 -0
  51. data/app/models/concerns/bmc/polymorphic_id.rb +37 -0
  52. data/app/models/concerns/bmc/search.rb +28 -0
  53. data/app/models/concerns/bmc/timestamp_helpers.rb +17 -0
  54. data/app/serializers/bmc/serializers/base.rb +63 -0
  55. data/app/serializers/bmc/serializers/xlsx.rb +38 -0
  56. data/app/serializers/bmc/serializers.rb +2 -0
  57. data/app/sms/bmc/sms/application_sms.rb +42 -0
  58. data/app/sms/bmc/sms/message.rb +25 -0
  59. data/app/sms/bmc/sms/strategies/amazon_sns.rb +48 -0
  60. data/app/sms/bmc/sms/strategies/base.rb +15 -0
  61. data/app/sms/bmc/sms/strategies/test.rb +10 -0
  62. data/app/sms/bmc/sms.rb +35 -0
  63. data/app/sorters/bmc/sorter.rb +26 -0
  64. data/app/views/bmc/search/_form.html.slim +1 -0
  65. data/app/views/bmc/search/_form_bs3.html.slim +13 -0
  66. data/app/views/bmc/search/_form_bs4.html.slim +9 -0
  67. data/app/views/bmc/search/_form_bs5.html.slim +8 -0
  68. data/app/views/kaminari/bootstrap4/_first_page.html.slim +2 -0
  69. data/app/views/kaminari/bootstrap4/_gap.html.slim +2 -0
  70. data/app/views/kaminari/bootstrap4/_last_page.html.slim +2 -0
  71. data/app/views/kaminari/bootstrap4/_next_page.html.slim +2 -0
  72. data/app/views/kaminari/bootstrap4/_page.html.slim +6 -0
  73. data/app/views/kaminari/bootstrap4/_paginator.html.slim +12 -0
  74. data/app/views/kaminari/bootstrap4/_prev_page.html.slim +2 -0
  75. data/config/locales/actions.en.yml +76 -0
  76. data/config/locales/actions.fr.yml +76 -0
  77. data/config/locales/attributes.en.yml +108 -0
  78. data/config/locales/attributes.fr.yml +108 -0
  79. data/config/locales/common.en.yml +39 -0
  80. data/config/locales/common.fr.yml +39 -0
  81. data/config/locales/dates.fr.yml +8 -0
  82. data/config/locales/errors.en.yml +5 -0
  83. data/config/locales/errors.fr.yml +5 -0
  84. data/config/routes.rb +3 -0
  85. data/db/migrate/20000101000000_enable_bmc_extensions.rb +7 -0
  86. data/lib/bmc/active_model_custom_error_messages.rb +23 -0
  87. data/lib/bmc/active_model_type_cast.rb +52 -0
  88. data/lib/bmc/config.rb +19 -0
  89. data/lib/bmc/core_and_rails_ext.rb +3 -0
  90. data/lib/bmc/engine.rb +36 -0
  91. data/lib/bmc/engine_file.rb +10 -0
  92. data/lib/bmc/errors_middleware.rb +50 -0
  93. data/lib/bmc/form_back_url.rb +18 -0
  94. data/lib/bmc/version.rb +3 -0
  95. data/lib/bmc.rb +5 -0
  96. data/lib/tasks/bmc_tasks.rake +4 -0
  97. metadata +236 -0
@@ -0,0 +1,13 @@
1
+ form.search.bs3 method="get" action=action
2
+ = hidden_inputs_for_get_form(action, except: [:q])
3
+ = form_hidden_submit
4
+
5
+ p.input-group.search
6
+ input.form-control name="q" placeholder=t("actions.search") size=25 value=params[:q]
7
+
8
+ span.input-group-btn
9
+ button.btn.btn-default.search-reset.reset type="submit"
10
+ = icon :times
11
+
12
+ button.btn.btn-default.search-submit type="submit"
13
+ = icon :search
@@ -0,0 +1,9 @@
1
+ form.search.bs4 method="get" action=action
2
+ = hidden_inputs_for_get_form(action, except: [:q])
3
+ = form_hidden_submit
4
+
5
+ .input-group.search
6
+ input.form-control.form-control-sm type="text" name="q" placeholder=ta(:search) value=params[:q]
7
+ span.input-group-append
8
+ button.btn.btn-sm.bg-light.border.search-reset.reset type="submit" = icon(:times)
9
+ button.btn.btn-sm.bg-light.border.search-submit type="submit" = icon(:search)
@@ -0,0 +1,8 @@
1
+ form.search.bs5.mb-3 method="get" action=action
2
+ = hidden_inputs_for_get_form(action, except: [:q])
3
+ = form_hidden_submit
4
+
5
+ .input-group.search
6
+ input.form-control.form-control-sm type="text" name="q" placeholder=ta(:search) value=params[:q]
7
+ button.btn.btn-sm.bg-light.border.search-reset.reset type="submit" = icon(:times)
8
+ button.btn.btn-sm.bg-light.border.search-submit type="submit" = icon(:search)
@@ -0,0 +1,2 @@
1
+ li.page-item
2
+ = link_to_unless current_page.first?, raw(t 'views.pagination.first'), url, remote: remote, class: 'page-link'
@@ -0,0 +1,2 @@
1
+ li.page-item.disabled
2
+ = link_to raw(t 'views.pagination.truncate'), '#', class: 'page-link'
@@ -0,0 +1,2 @@
1
+ li.page-item
2
+ = link_to_unless current_page.last?, raw(t 'views.pagination.last'), url, remote: remote, class: 'page-link'
@@ -0,0 +1,2 @@
1
+ li.page-item
2
+ = link_to_unless current_page.last?, raw(t 'views.pagination.next'), url, rel: 'next', remote: remote, class: 'page-link'
@@ -0,0 +1,6 @@
1
+ - if page.current?
2
+ li.page-item.active
3
+ = content_tag :a, page, data: { remote: remote }, rel: page.rel, class: 'page-link'
4
+ - else
5
+ li.page-item
6
+ = link_to page, url, remote: remote, rel: page.rel, class: 'page-link'
@@ -0,0 +1,12 @@
1
+ = paginator.render do
2
+ nav
3
+ ul.pagination
4
+ == first_page_tag unless current_page.first?
5
+ == prev_page_tag unless current_page.first?
6
+ - each_page do |page|
7
+ - if page.left_outer? || page.right_outer? || page.inside_window?
8
+ == page_tag page
9
+ - elsif !page.was_truncated?
10
+ == gap_tag
11
+ == next_page_tag unless current_page.last?
12
+ == last_page_tag unless current_page.last?
@@ -0,0 +1,2 @@
1
+ li.page-item
2
+ = link_to_unless current_page.first?, raw(t 'views.pagination.previous'), url, rel: 'prev', remote: remote, class: 'page-link'
@@ -0,0 +1,76 @@
1
+ en:
2
+ actions: &actions
3
+ actions : "Actions"
4
+ index : "Index"
5
+ list : "List"
6
+ new : "New"
7
+ create : "Create"
8
+ read : "Read"
9
+ show : "Show"
10
+ details : "Détails"
11
+ edit : "Edit"
12
+ update : "Update"
13
+ delete : "Delete"
14
+ destroy : "Destroy"
15
+ add : "Add"
16
+ filter : "Filter"
17
+ filter_by : "Filter by"
18
+ sort : "Sort"
19
+ sort_by : "Sort by"
20
+ reset : "Reset"
21
+ back : "Back"
22
+ save : "Save"
23
+ open : "Open"
24
+ close : "Close"
25
+ lock : "Lock"
26
+ unlock : "Unlock"
27
+ snooze : "Snooze"
28
+ alert : "Alert"
29
+ complete : "Complete"
30
+ done : "Done"
31
+ download : "Download"
32
+ upload : "Upload"
33
+ preview : "Preview"
34
+ confirm : "Confirm this action ?"
35
+ cancel : "Cancel"
36
+ search : "Search"
37
+ sign_in : "Sign in"
38
+ signin : "Sign in"
39
+ log_in : "Log in"
40
+ login : "Log in"
41
+ sign_out : "Sign out"
42
+ signout : "Sign out"
43
+ log_out : "Log out"
44
+ logout : "Log out"
45
+ sign_up : "Sign up"
46
+ signup : "Sign up"
47
+ browse : "Choose file..."
48
+ cut : "Cut"
49
+ copy : "Copy"
50
+ paste : "Paste"
51
+ duplicate : "Duplicate"
52
+ export : "Export"
53
+ export_csv : "Export CSV"
54
+ export_xls : "Export XLS"
55
+ export_xlsx: "Export XLSX"
56
+ export_pdf : "Export PDF"
57
+ import : "Import"
58
+ import_csv : "Import CSV"
59
+ import_xls : "Import XLS"
60
+ import_xlsx: "Import XLSX"
61
+ import_pdf : "Import PDF"
62
+ send : "Send"
63
+ comment : "Comment"
64
+ add_line : "Add line"
65
+ remove_line: "Remove line"
66
+ pay : "Pay"
67
+ paid : "Payd"
68
+ continue : "Continue"
69
+ rename : "Rename"
70
+ email : "Send by email"
71
+ print : "Print"
72
+ submit : "Submit"
73
+ accept : "Accept"
74
+ refuse : "Refuse"
75
+ show_more : "Show more"
76
+ select : "Select"
@@ -0,0 +1,76 @@
1
+ fr:
2
+ actions: &actions
3
+ actions : "Actions"
4
+ index : "Liste"
5
+ list : "Liste"
6
+ new : "Nouveau"
7
+ create : "Créer"
8
+ read : "Afficher"
9
+ show : "Afficher"
10
+ details : "Détails"
11
+ edit : "Modifier"
12
+ update : "Modifier"
13
+ delete : "Supprimer"
14
+ destroy : "Supprimer"
15
+ add : "Ajouter"
16
+ filter : "Filtrer"
17
+ filter_by : "Filtrer par"
18
+ sort : "Trier"
19
+ sort_by : "Trier par"
20
+ reset : "Mettre à zéro"
21
+ back : "Retour"
22
+ save : "Enregistrer"
23
+ open : "Ouvrir"
24
+ close : "Fermer"
25
+ lock : "Fermer"
26
+ unlock : "Ouvrir"
27
+ snooze : "Reporter"
28
+ alert : "Alerter"
29
+ complete : "Marquer terminé"
30
+ done : "Terminer"
31
+ download : "Télécharger"
32
+ upload : "Envoyer"
33
+ preview : "Aperçu"
34
+ confirm : "Confirmer cette action ?"
35
+ cancel : "Annuler"
36
+ search : "Rechercher"
37
+ sign_in : "Se connecter"
38
+ signin : "Se connecter"
39
+ log_in : "Se connecter"
40
+ login : "Se connecter"
41
+ sign_out : "Se déconnecter"
42
+ signout : "Se déconnecter"
43
+ log_out : "Se déconnecter"
44
+ logout : "Se déconnecter"
45
+ sign_up : "S'enregistrer"
46
+ signup : "S'enregistrer"
47
+ browse : "Sélectionner le fichier..."
48
+ cut : "Couper"
49
+ copy : "Copier"
50
+ paste : "Coller"
51
+ duplicate : "Dupliquer"
52
+ export : "Exporter"
53
+ export_csv : "Export CSV"
54
+ export_xls : "Export XLS"
55
+ export_xlsx: "Export XLSX"
56
+ export_pdf : "Export PDF"
57
+ import : "Importer"
58
+ import_csv : "Import CSV"
59
+ import_xls : "Import XLS"
60
+ import_xlsx: "Import XLSX"
61
+ import_pdf : "Import PDF"
62
+ send : "Envoyer"
63
+ comment : "Commenter"
64
+ add_line : "Ajouter une ligne"
65
+ remove_line: "Supprimer la ligne"
66
+ pay : "Payer"
67
+ paid : "Payée"
68
+ continue : "Continuer"
69
+ rename : "Renommer"
70
+ email : "Envoyer par email"
71
+ print : "Imprimer"
72
+ submit : "Soumettre"
73
+ accept : "Accepter"
74
+ refuse : "Refuser"
75
+ show_more : "Afficher plus"
76
+ select : "Sélectionner"
@@ -0,0 +1,108 @@
1
+ en:
2
+ attributes: &attributes
3
+ access : "Access"
4
+ actions : "Actions"
5
+ active : "Active ?"
6
+ address : "Address"
7
+ address1 : "Address"
8
+ address2 : "Address (rest)"
9
+ addressable : "Origin"
10
+ amount : "Amount"
11
+ attachable : "Origin"
12
+ attachment : "Attachment"
13
+ author : "Author"
14
+ avatar : "Avatar"
15
+ body : "Message"
16
+ budget : "Budget"
17
+ category : "Category"
18
+ city : "City"
19
+ code : "Code"
20
+ color : "Color"
21
+ comment : "Comment"
22
+ commentable : "Origin"
23
+ comments : "Comments"
24
+ corporation_name : "Name"
25
+ count : "Number"
26
+ country : "Country"
27
+ created_at : "Created at"
28
+ current_avatar : "Current avatar"
29
+ customer : "Customer"
30
+ customer_guid : "Customer"
31
+ data : "Data"
32
+ date : "Date"
33
+ date_begin : "Date begin"
34
+ date_end : "Date end"
35
+ date_start : "Date start"
36
+ day : "Day"
37
+ description : "Description"
38
+ details : "Datails"
39
+ due_date : "Due date"
40
+ email : "E-mail"
41
+ email_attachment : "Attachment"
42
+ email_body : "Message"
43
+ email_from : "Sender"
44
+ email_subject : "Subject"
45
+ email_to : "Recipient"
46
+ facebook : "Facebook"
47
+ fax : "Fax"
48
+ file : "File"
49
+ first_name : "First name"
50
+ id : "Id"
51
+ is_active : "Active ?"
52
+ label : "Label"
53
+ last_name : "Last name"
54
+ length : "Number"
55
+ linkedin : "Linkedin"
56
+ logo : "Logo"
57
+ message : "Message"
58
+ mobile : "Mobile"
59
+ month : "Month"
60
+ name : "Name"
61
+ number : "Number"
62
+ paid : "Paid ?"
63
+ password : "Password"
64
+ password_confirmation : "Password (confirm)"
65
+ phone : "Phone"
66
+ probability : "Probability"
67
+ quantity : "Quantity"
68
+ reference : "Réference"
69
+ sender : "Author"
70
+ short_name : "Short name"
71
+ skype : "Skype"
72
+ state : "State"
73
+ status : "Status"
74
+ street : "Address"
75
+ street_bis : "Address (rest)"
76
+ subject : "Subject"
77
+ tag_list : "Tags"
78
+ tags : "Tags"
79
+ text : "Text"
80
+ title : "Title"
81
+ total : "Total"
82
+ tracking : "Tracking ID"
83
+ tracking_id : "Tracking ID"
84
+ twitter : "Twitter"
85
+ type : "Type"
86
+ unique_index : "Tracking ID"
87
+ updated_at : "Updated at"
88
+ user : "User"
89
+ version : "Version"
90
+ viadeo : "Viadeo"
91
+ written_by : "Written by"
92
+ www : "Web site"
93
+ zip : "Zip"
94
+
95
+ labels:
96
+ <<: *attributes
97
+
98
+ activemodel:
99
+ attributes:
100
+ bmc/email:
101
+ from: "From"
102
+ reply_to: "Reply to"
103
+ to: "To"
104
+ cc: "Copy"
105
+ subject: "Subject"
106
+ body: "Message"
107
+ attachments: "Attachments"
108
+ attachment_names: "Attachments"
@@ -0,0 +1,108 @@
1
+ fr:
2
+ attributes: &attributes
3
+ access : "Accès"
4
+ actions : "Actions"
5
+ active : "Actif ?"
6
+ address : "Adresse"
7
+ address1 : "Adresse"
8
+ address2 : "Adresse (suite)"
9
+ addressable : "Origine"
10
+ amount : "Montant"
11
+ attachable : "Origine"
12
+ attachment : "Pièce jointe"
13
+ author : "Auteur"
14
+ avatar : "Avatar"
15
+ body : "Message"
16
+ budget : "Budget"
17
+ category : "Catégorie"
18
+ city : "Ville"
19
+ code : "Code"
20
+ color : "Couleur"
21
+ comment : "Commentaire"
22
+ commentable : "Origine"
23
+ comments : "Commentaires"
24
+ corporation_name : "Nom"
25
+ count : "Nombre"
26
+ country : "Pays"
27
+ created_at : "Créé le"
28
+ current_avatar : "Avatar actuel"
29
+ customer : "Client"
30
+ customer_guid : "Client"
31
+ data : "Informations"
32
+ date : "Date"
33
+ date_begin : "Date de début"
34
+ date_end : "Date de fin"
35
+ date_start : "Date de début"
36
+ day : "Jour"
37
+ description : "Description"
38
+ details : "Détails"
39
+ due_date : "Échéance"
40
+ email : "E-mail"
41
+ email_attachment : "Pièce jointe"
42
+ email_body : "Message"
43
+ email_from : "Expéditeur"
44
+ email_subject : "Object"
45
+ email_to : "Destinataire"
46
+ facebook : "Facebook"
47
+ fax : "Fax"
48
+ file : "Fichier"
49
+ first_name : "Prénom"
50
+ id : "Id"
51
+ is_active : "Actif ?"
52
+ label : "Libellé"
53
+ last_name : "Nom"
54
+ length : "Nombre"
55
+ linkedin : "Linkedin"
56
+ logo : "Logo"
57
+ message : "Message"
58
+ mobile : "Mobile"
59
+ month : "Mois"
60
+ name : "Nom"
61
+ number : "Nombre"
62
+ paid : "Payée ?"
63
+ password : "Mot de passe"
64
+ password_confirmation : "Mot de passe (confirmer)"
65
+ phone : "Téléphone"
66
+ probability : "Probabilité"
67
+ quantity : "Quantité"
68
+ reference : "Référence"
69
+ sender : "Auteur"
70
+ short_name : "Initiales"
71
+ skype : "Skype"
72
+ state : "État"
73
+ status : "État"
74
+ street : "Adresse"
75
+ street_bis : "Adresse (suite)"
76
+ subject : "Objet"
77
+ tag_list : "Tags"
78
+ tags : "Tags"
79
+ text : "Description"
80
+ title : "Titre"
81
+ total : "Total"
82
+ tracking : "Numéro"
83
+ tracking_id : "Numéro"
84
+ twitter : "Twitter"
85
+ type : "Type"
86
+ unique_index : "Numéro"
87
+ updated_at : "Modifié le"
88
+ user : "Utilisateur"
89
+ version : "Version"
90
+ viadeo : "Viadeo"
91
+ written_by : "écrit par"
92
+ www : "Site web"
93
+ zip : "Code postal"
94
+
95
+ labels:
96
+ <<: *attributes
97
+
98
+ activemodel:
99
+ attributes:
100
+ bmc/email:
101
+ from: "Expéditeur"
102
+ reply_to: "Répondre à"
103
+ to: "Destinataire"
104
+ cc: "Copie"
105
+ subject: "Objet"
106
+ body: "Message"
107
+ attachments: "Pièces jointes"
108
+ attachment_names: "Pièces jointes"
@@ -0,0 +1,39 @@
1
+ en:
2
+ "yes" : "Yes"
3
+ "no" : "No"
4
+ "true" : "Yes"
5
+ "false" : "No"
6
+
7
+ errors:
8
+ messages:
9
+ extension_white_list_error : "This file type is not supported"
10
+
11
+ filters:
12
+ all_customers: "All customers"
13
+ all_owners: "All all owners"
14
+ date_begin: "Date begin"
15
+ date_end: "Date end"
16
+
17
+ time_periods:
18
+ all_time: "All time"
19
+ tomorrow: "Tomorrow"
20
+ today: "Today"
21
+ yesterday: "Yesterday"
22
+ this_week: "This week"
23
+ this_month: "This month"
24
+ this_year: "This year"
25
+ last_week: "Last week"
26
+ last_month: "Last month"
27
+ last_year: "Last year"
28
+ delayed: "Delayed"
29
+ next_week: "Next week"
30
+ next_next_week: "In two weeks"
31
+ custom_date: "Custom date"
32
+
33
+ simple_form:
34
+ "yes" : 'Yes'
35
+ "no" : 'No'
36
+
37
+ required:
38
+ text: 'Required'
39
+ mark: '*'
@@ -0,0 +1,39 @@
1
+ fr:
2
+ "yes" : "Oui"
3
+ "no" : "Non"
4
+ "true" : "Oui"
5
+ "false" : "Non"
6
+
7
+ errors:
8
+ messages:
9
+ extension_white_list_error : "Ce type de fichier n'est pas prit en charge"
10
+
11
+ filters:
12
+ all_customers: "Tous les clients"
13
+ all_owners: "Tout le monde"
14
+ date_begin: "Date début"
15
+ date_end: "Date fin"
16
+
17
+ time_periods:
18
+ all_time: "Depuis toujours"
19
+ tomorrow: "Demain"
20
+ today: "Aujourd'hui"
21
+ yesterday: "Hier"
22
+ this_week: "Cette semaine"
23
+ this_month: "Ce mois"
24
+ this_year: "Cette année"
25
+ last_week: "La semaine dernière"
26
+ last_month: "Le mois dernier"
27
+ last_year: "L'année dernière"
28
+ delayed: "En retard"
29
+ next_week: "La semaine prochaine"
30
+ next_next_week: "Dans deux semaines"
31
+ custom_date: "Choisir une date"
32
+
33
+ simple_form:
34
+ "yes" : 'Oui'
35
+ "no" : 'Non'
36
+
37
+ required:
38
+ text: 'Requis'
39
+ mark: '*'
@@ -0,0 +1,8 @@
1
+ fr:
2
+ date:
3
+ formats:
4
+ default: "%d/%m/%Y"
5
+
6
+ time:
7
+ formats:
8
+ default: "%d/%m/%Y à %H:%M"
@@ -0,0 +1,5 @@
1
+ en:
2
+ errors:
3
+ not_found: "Page not found"
4
+ unauthorized: "You must log in to access this page"
5
+ forbidden: "You are not authorized to access this page"
@@ -0,0 +1,5 @@
1
+ fr:
2
+ errors:
3
+ not_found: "La page demandée n'existe pas ou plus"
4
+ unauthorized: "Vous devez être connecté pour accéder à cette page"
5
+ forbidden: "Vous n'êtes pas autorisé à accéder à cette page"
data/config/routes.rb ADDED
@@ -0,0 +1,3 @@
1
+ BMC::Engine.routes.draw do
2
+ resources :filters, only: [:create]
3
+ end
@@ -0,0 +1,7 @@
1
+ class EnableBMCExtensions < ActiveRecord::Migration[5.1]
2
+ def change
3
+ enable_extension "pgcrypto"
4
+ enable_extension "unaccent"
5
+ enable_extension "uuid-ossp"
6
+ end
7
+ end
@@ -0,0 +1,23 @@
1
+ module BMC::ActiveModelCustomErrorMessages
2
+ # Rails <= 6.0
3
+ module ForErrors
4
+ def full_message(attribute, message)
5
+ return message[1..] if message[0] == "^"
6
+ super
7
+ end
8
+ end
9
+
10
+ ActiveModel::Errors.prepend(ForErrors)
11
+
12
+ # Rails >= 6.1
13
+ module ForError
14
+ def full_message
15
+ return message[1..] if message[0] == "^"
16
+ super
17
+ end
18
+ end
19
+
20
+ if Module.const_defined?("ActiveModel::Error")
21
+ ActiveModel::Error.prepend(ForError)
22
+ end
23
+ end
@@ -0,0 +1,52 @@
1
+ module BMC::ActiveModelTypeCast
2
+ module Decimal
3
+ def cast_value(value)
4
+ if value.is_a?(String)
5
+ super value.tr(",", ".").gsub(/[^-0-9.]/, "")
6
+ else
7
+ super value
8
+ end
9
+ end
10
+ end
11
+
12
+ module Date
13
+ # rubocop:disable Style/RegexpLiteral
14
+ SANITIZABLE_FORMATS = [
15
+ /^[0-9]{2}\/[0-9]{2}\/[0-9]{4}$/,
16
+ /^[0-9]{4}-[0-9]{2}-[0-9]{2}$/,
17
+ ]
18
+ # rubocop:enable Style/RegexpLiteral
19
+
20
+ def cast_value(value)
21
+ if sanitizable?(value)
22
+ super sanitize(value)
23
+ else
24
+ super value
25
+ end
26
+ end
27
+
28
+ private
29
+
30
+ def sanitize(value)
31
+ value.delete(" ")
32
+ end
33
+
34
+ def sanitizable?(value)
35
+ return false unless value.is_a?(String)
36
+ sanitized = sanitize(value)
37
+ SANITIZABLE_FORMATS.any? { |r| r =~ sanitized }
38
+ end
39
+ end
40
+
41
+ module Boolean
42
+ def cast_value(value)
43
+ value = value.strip if value.is_a?(String)
44
+ super value
45
+ end
46
+ end
47
+ end
48
+
49
+ ActiveModel::Type::Date.prepend(BMC::ActiveModelTypeCast::Date)
50
+ ActiveModel::Type::Boolean.prepend(BMC::ActiveModelTypeCast::Boolean)
51
+ ActiveModel::Type::Decimal.prepend(BMC::ActiveModelTypeCast::Decimal)
52
+ ActiveModel::Type::Float.prepend(BMC::ActiveModelTypeCast::Decimal)
data/lib/bmc/config.rb ADDED
@@ -0,0 +1,19 @@
1
+ class << BMC
2
+ attr_writer :parent_controller
3
+
4
+ def parent_controller
5
+ @parent_controller ||= [
6
+ "ApplicationController",
7
+ "ActionController::Base",
8
+ ].map(&:safe_constantize).compact.first
9
+ end
10
+
11
+ attr_writer :parent_mailer
12
+
13
+ def parent_mailer
14
+ @parent_mailer ||= [
15
+ "ApplicationMailer",
16
+ "ActionMailer::Base",
17
+ ].map(&:safe_constantize).compact.first
18
+ end
19
+ end
@@ -0,0 +1,3 @@
1
+ require_relative "active_model_custom_error_messages"
2
+ require_relative "active_model_type_cast"
3
+ require_relative "form_back_url"