lesli_babel 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.
Files changed (106) hide show
  1. checksums.yaml +7 -0
  2. data/Rakefile +5 -0
  3. data/app/assets/config/lesli_babel_manifest.js +7 -0
  4. data/app/assets/images/lesli_babel/babel-logo.svg +157 -0
  5. data/app/assets/javascripts/lesli_babel/application.js +3288 -0
  6. data/app/assets/stylesheets/lesli_babel/application.scss +41 -0
  7. data/app/assets/stylesheets/lesli_babel/dashboards.scss +55 -0
  8. data/app/assets/stylesheets/lesli_babel/modules.scss +33 -0
  9. data/app/assets/stylesheets/lesli_babel/translations.scss +58 -0
  10. data/app/controllers/lesli_babel/application_controller.rb +37 -0
  11. data/app/controllers/lesli_babel/buckets_controller.rb +79 -0
  12. data/app/controllers/lesli_babel/clones_controller.rb +80 -0
  13. data/app/controllers/lesli_babel/dashboards_controller.rb +38 -0
  14. data/app/controllers/lesli_babel/modules_controller.rb +91 -0
  15. data/app/controllers/lesli_babel/relevants_controller.rb +38 -0
  16. data/app/controllers/lesli_babel/strings_controller.rb +142 -0
  17. data/app/controllers/lesli_babel/translations_controller.rb +134 -0
  18. data/app/jobs/lesli_babel/application_job.rb +7 -0
  19. data/app/mailers/lesli_babel/application_mailer.rb +6 -0
  20. data/app/models/lesli_babel/application_record.rb +36 -0
  21. data/app/models/lesli_babel/bucket.rb +6 -0
  22. data/app/models/lesli_babel/clone.rb +24 -0
  23. data/app/models/lesli_babel/dashboard.rb +35 -0
  24. data/app/models/lesli_babel/module.rb +35 -0
  25. data/app/models/lesli_babel/relevant.rb +21 -0
  26. data/app/models/lesli_babel/string/activity.rb +5 -0
  27. data/app/models/lesli_babel/string/discussion.rb +68 -0
  28. data/app/models/lesli_babel/string.rb +225 -0
  29. data/app/models/lesli_babel/translation.rb +5 -0
  30. data/app/services/lesli_babel/module_service.rb +18 -0
  31. data/app/services/lesli_babel/old/translations_android_service.rb +82 -0
  32. data/app/services/lesli_babel/old/translations_clone_service.rb +161 -0
  33. data/app/services/lesli_babel/old/translations_flutter_service.rb +102 -0
  34. data/app/services/lesli_babel/old/translations_ios_service.rb +119 -0
  35. data/app/services/lesli_babel/old/translations_js_service.rb +114 -0
  36. data/app/services/lesli_babel/old/translations_middleman_service.rb +77 -0
  37. data/app/services/lesli_babel/old/translations_rails_service.rb +119 -0
  38. data/app/services/lesli_babel/old/translations_service.rb +97 -0
  39. data/app/services/lesli_babel/old/translations_synchronization_service.rb +215 -0
  40. data/app/services/lesli_babel/string_service.rb +80 -0
  41. data/app/views/lesli_babel/buckets/_form.html.erb +17 -0
  42. data/app/views/lesli_babel/buckets/edit.html.erb +6 -0
  43. data/app/views/lesli_babel/buckets/index.html.erb +25 -0
  44. data/app/views/lesli_babel/buckets/new.html.erb +5 -0
  45. data/app/views/lesli_babel/buckets/show.html.erb +4 -0
  46. data/app/views/lesli_babel/clones/_form.html.erb +19 -0
  47. data/app/views/lesli_babel/clones/edit.html.erb +20 -0
  48. data/app/views/lesli_babel/clones/index.html.erb +20 -0
  49. data/app/views/lesli_babel/clones/new.html.erb +20 -0
  50. data/app/views/lesli_babel/clones/show.html.erb +20 -0
  51. data/app/views/lesli_babel/dashboards/show.html.erb +1 -0
  52. data/app/views/lesli_babel/dashboards/stats..html.erb +1 -0
  53. data/app/views/lesli_babel/modules/_form.html.erb +17 -0
  54. data/app/views/lesli_babel/modules/edit.html.erb +1 -0
  55. data/app/views/lesli_babel/modules/index.html.erb +1 -0
  56. data/app/views/lesli_babel/modules/new.html.erb +1 -0
  57. data/app/views/lesli_babel/modules/show.html.erb +1 -0
  58. data/app/views/lesli_babel/partials/_engine-navigation.html.erb +37 -0
  59. data/app/views/lesli_babel/partials/_engine-sidebar.html.erb +45 -0
  60. data/app/views/lesli_babel/relevants/edit.html.erb +20 -0
  61. data/app/views/lesli_babel/relevants/index.html.erb +21 -0
  62. data/app/views/lesli_babel/relevants/new.html.erb +20 -0
  63. data/app/views/lesli_babel/relevants/show.html.erb +20 -0
  64. data/app/views/lesli_babel/string/activities/_form.html.erb +17 -0
  65. data/app/views/lesli_babel/string/activities/edit.html.erb +6 -0
  66. data/app/views/lesli_babel/string/activities/index.html.erb +25 -0
  67. data/app/views/lesli_babel/string/activities/new.html.erb +5 -0
  68. data/app/views/lesli_babel/string/activities/show.html.erb +4 -0
  69. data/app/views/lesli_babel/string/discussions/_form.html.erb +17 -0
  70. data/app/views/lesli_babel/string/discussions/edit.html.erb +6 -0
  71. data/app/views/lesli_babel/string/discussions/index.html.erb +25 -0
  72. data/app/views/lesli_babel/string/discussions/new.html.erb +5 -0
  73. data/app/views/lesli_babel/string/discussions/show.html.erb +4 -0
  74. data/app/views/lesli_babel/strings/_form.html.erb +17 -0
  75. data/app/views/lesli_babel/strings/edit.html.erb +6 -0
  76. data/app/views/lesli_babel/strings/index.html.erb +25 -0
  77. data/app/views/lesli_babel/strings/new.html.erb +5 -0
  78. data/app/views/lesli_babel/strings/show.html.erb +4 -0
  79. data/app/views/lesli_babel/translations/_form.html.erb +17 -0
  80. data/app/views/lesli_babel/translations/edit.html.erb +6 -0
  81. data/app/views/lesli_babel/translations/index.html.erb +1 -0
  82. data/app/views/lesli_babel/translations/new.html.erb +5 -0
  83. data/app/views/lesli_babel/translations/show.html.erb +1 -0
  84. data/config/routes.rb +63 -0
  85. data/db/migrate/v1.0/0901100110_create_lesli_babel_modules.rb +42 -0
  86. data/db/migrate/v1.0/0901110110_create_lesli_babel_buckets.rb +43 -0
  87. data/db/migrate/v1.0/0901120110_create_lesli_babel_strings.rb +80 -0
  88. data/lib/lesli_babel/engine.rb +54 -0
  89. data/lib/lesli_babel/version.rb +3 -0
  90. data/lib/lesli_babel.rb +6 -0
  91. data/lib/tasks/lesli_babel_tasks.rake +121 -0
  92. data/lib/vue/application.js +46 -0
  93. data/lib/vue/apps/dashboards/show.vue +85 -0
  94. data/lib/vue/apps/modules/show.vue +97 -0
  95. data/lib/vue/apps/relevants/index.vue +47 -0
  96. data/lib/vue/apps/translations/index.vue +64 -0
  97. data/lib/vue/components/actions.vue +29 -0
  98. data/lib/vue/components/form-label-editor.vue +439 -0
  99. data/lib/vue/components/form-string-new.vue +171 -0
  100. data/lib/vue/stores/module.js +49 -0
  101. data/lib/vue/stores/statistics.js +42 -0
  102. data/lib/vue/stores/strings.js +141 -0
  103. data/lib/vue/stores/translations.js +73 -0
  104. data/license +674 -0
  105. data/readme.md +19 -0
  106. metadata +149 -0
@@ -0,0 +1,41 @@
1
+ /*
2
+
3
+ Lesli
4
+
5
+ Copyright (c) 2023, Lesli Technologies, S. A.
6
+
7
+ This program is free software: you can redistribute it and/or modify
8
+ it under the terms of the GNU General Public License as published by
9
+ the Free Software Foundation, either version 3 of the License, or
10
+ (at your option) any later version.
11
+
12
+ This program is distributed in the hope that it will be useful,
13
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ GNU General Public License for more details.
16
+
17
+ You should have received a copy of the GNU General Public License
18
+ along with this program. If not, see http://www.gnu.org/licenses/.
19
+
20
+ Lesli · Ruby on Rails SaaS Development Framework.
21
+
22
+ Made with ♥ by https://www.lesli.tech
23
+ Building a better future, one line of code at a time.
24
+
25
+ @contact hello@lesli.tech
26
+ @website https://www.lesli.tech
27
+ @license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
28
+
29
+ // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
30
+ // ·
31
+ */
32
+
33
+
34
+ // // ·
35
+ body.lesli-babel-dashboard { @import "./dashboards"; }
36
+
37
+
38
+ // // ·
39
+ // body.cloud_babel-modules,
40
+ // body.cloud_babel-relevants,
41
+ // body.cloud_babel-translations { @import "./translations"; }
@@ -0,0 +1,55 @@
1
+ /*
2
+
3
+ Lesli
4
+
5
+ Copyright (c) 2023, Lesli Technologies, S. A.
6
+
7
+ This program is free software: you can redistribute it and/or modify
8
+ it under the terms of the GNU General Public License as published by
9
+ the Free Software Foundation, either version 3 of the License, or
10
+ (at your option) any later version.
11
+
12
+ This program is distributed in the hope that it will be useful,
13
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ GNU General Public License for more details.
16
+
17
+ You should have received a copy of the GNU General Public License
18
+ along with this program. If not, see http://www.gnu.org/licenses/.
19
+
20
+ Lesli · Ruby on Rails SaaS Development Framework.
21
+
22
+ Made with ♥ by https://www.lesli.tech
23
+ Building a better future, one line of code at a time.
24
+
25
+ @contact hello@lesli.tech
26
+ @website https://www.lesli.tech
27
+ @license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
28
+
29
+ // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
30
+ // ·
31
+ */
32
+
33
+
34
+ // ·
35
+ @import "lesli/templates/dashboards";
36
+ @import "flag-icon";
37
+
38
+ // ·
39
+ .locales {
40
+ @include lesli-css-flex-columns($column-width: 200px);
41
+ justify-content: start;
42
+
43
+ .card {
44
+ padding: 1.8rem 1rem;
45
+ text-align: center;
46
+ box-shadow: $lesli-box-shadow;
47
+ background-color: white;
48
+ border-radius: 4px;
49
+
50
+ span.flag-icon {
51
+ border-radius: 4px;
52
+ box-shadow: $lesli-box-shadow;
53
+ }
54
+ }
55
+ }
@@ -0,0 +1,33 @@
1
+ /*
2
+
3
+ Copyright (c) 2020, all rights reserved.
4
+
5
+ All the information provided by this platform is protected by international laws related to
6
+ industrial property, intellectual property, copyright and relative international laws.
7
+ All intellectual or industrial property rights of the code, texts, trade mark, design,
8
+ pictures and any other information belongs to the owner of this platform.
9
+
10
+ Without the written permission of the owner, any replication, modification,
11
+ transmission, publication is strictly forbidden.
12
+
13
+ For more information read the license file including with this software.
14
+
15
+ // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
16
+ // ·
17
+
18
+ */
19
+
20
+
21
+ // ·
22
+ @import "templates/component";
23
+
24
+
25
+ // ·
26
+ .card {
27
+ margin-bottom: 1.2rem;
28
+ }
29
+
30
+
31
+ .pagination-link {
32
+ justify-content: center;
33
+ }
@@ -0,0 +1,58 @@
1
+ /*
2
+
3
+ Copyright (c) 2020, all rights reserved.
4
+
5
+ All the information provided by this platform is protected by international laws related to
6
+ industrial property, intellectual property, copyright and relative international laws.
7
+ All intellectual or industrial property rights of the code, texts, trade mark, design,
8
+ pictures and any other information belongs to the owner of this platform.
9
+
10
+ Without the written permission of the owner, any replication, modification,
11
+ transmission, publication is strictly forbidden.
12
+
13
+ For more information read the license file including with this software.
14
+
15
+ // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
16
+ // ·
17
+ */
18
+
19
+
20
+ // ·
21
+ @import "templates/component";
22
+
23
+
24
+ // ·
25
+ #babel-translations {
26
+
27
+ tbody td {
28
+ padding: 0rem 1rem;
29
+ height: 60px;
30
+ input.input {
31
+ height: 60px;
32
+ border: none;
33
+ box-shadow: none;
34
+ border-radius: 3px;
35
+ background-color: transparent;
36
+ &::placeholder {
37
+ color: lesli-css-color(silver, 900);
38
+ }
39
+ }
40
+
41
+ &.detail-row {
42
+ padding-left: 1rem !important;
43
+ }
44
+ }
45
+
46
+ .copied:after{
47
+ display: inline;
48
+ position: absolute;
49
+ content: "Label copied to clipboard!";
50
+ animation: 1s ease-in-out 0s 1 normal forwards running copyit;
51
+ font-size: .8em;
52
+ }
53
+
54
+ @keyframes copyit{
55
+ 0%{ bottom:2em;opacity:1;}
56
+ 100%{bottom:4em;opacity:0;}
57
+ }
58
+ }
@@ -0,0 +1,37 @@
1
+ =begin
2
+
3
+ Lesli
4
+
5
+ Copyright (c) 2023, Lesli Technologies, S. A.
6
+
7
+ This program is free software: you can redistribute it and/or modify
8
+ it under the terms of the GNU General Public License as published by
9
+ the Free Software Foundation, either version 3 of the License, or
10
+ (at your option) any later version.
11
+
12
+ This program is distributed in the hope that it will be useful,
13
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ GNU General Public License for more details.
16
+
17
+ You should have received a copy of the GNU General Public License
18
+ along with this program. If not, see http://www.gnu.org/licenses/.
19
+
20
+ Lesli · Ruby on Rails SaaS Development Framework.
21
+
22
+ Made with ♥ by https://www.lesli.tech
23
+ Building a better future, one line of code at a time.
24
+
25
+ @contact hello@lesli.tech
26
+ @website https://www.lesli.tech
27
+ @license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
28
+
29
+ // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
30
+ // ·
31
+ =end
32
+
33
+ module LesliBabel
34
+ class ApplicationController < Lesli::ApplicationLesliController
35
+ protect_from_forgery with: :exception
36
+ end
37
+ end
@@ -0,0 +1,79 @@
1
+ require_dependency "cloud_babel/application_controller"
2
+
3
+ module LesliBabel
4
+ class BucketsController < ApplicationController
5
+ before_action :set_bucket, only: [:show, :edit, :update, :destroy]
6
+
7
+ def privileges
8
+ {
9
+ index: []
10
+ }
11
+ end
12
+
13
+ # GET /buckets
14
+ def index
15
+ respond_to do |format|
16
+ format.html { }
17
+ format.json {
18
+ respond_with_successful(
19
+ Module.find(params[:module_id]).buckets.order(name: :asc)
20
+ )
21
+ }
22
+ end
23
+ end
24
+
25
+ # GET /buckets/1
26
+ def show
27
+ end
28
+
29
+ # GET /buckets/new
30
+ def new
31
+ @bucket = Bucket.new
32
+ end
33
+
34
+ # GET /buckets/1/edit
35
+ def edit
36
+ end
37
+
38
+ # POST /buckets
39
+ def create
40
+ bucket = Bucket.new(bucket_params)
41
+ bucket.module = Module.find(params[:module_id])
42
+ bucket.reference_module = bucket.module.name
43
+
44
+ if bucket.save
45
+ respond_with_successful bucket
46
+ else
47
+ respond_with_error bucket.errors.full_messages
48
+ end
49
+ end
50
+
51
+ # PATCH/PUT /buckets/1
52
+ def update
53
+ if @bucket.update(bucket_params)
54
+ redirect_to @bucket, notice: 'Bucket was successfully updated.'
55
+ else
56
+ render :edit
57
+ end
58
+ end
59
+
60
+ # DELETE /buckets/1
61
+ def destroy
62
+ @bucket.destroy
63
+ redirect_to buckets_url, notice: 'Bucket was successfully destroyed.'
64
+ end
65
+
66
+ private
67
+
68
+ # Use callbacks to share common setup or constraints between actions.
69
+ def set_bucket
70
+ @bucket = Bucket.find(params[:id])
71
+ end
72
+
73
+ # Only allow a trusted parameter "white list" through.
74
+ def bucket_params
75
+ params.require(:bucket).permit(:name)
76
+ end
77
+
78
+ end
79
+ end
@@ -0,0 +1,80 @@
1
+ =begin
2
+
3
+ Copyright (c) 2021, all rights reserved.
4
+
5
+ All the information provided by this platform is protected by international laws related to
6
+ industrial property, intellectual property, copyright and relative international laws.
7
+ All intellectual or industrial property rights of the code, texts, trade mark, design,
8
+ pictures and any other information belongs to the owner of this platform.
9
+
10
+ Without the written permission of the owner, any replication, modification,
11
+ transmission, publication is strictly forbidden.
12
+
13
+ For more information read the license file including with this software.
14
+
15
+ // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
16
+ // ·
17
+
18
+ =end
19
+ require_dependency "cloud_babel/application_controller"
20
+
21
+ module LesliBabel
22
+ class ClonesController < ApplicationController
23
+
24
+ # GET /clones/1
25
+ def show
26
+ respond_to do |format|
27
+ format.html {}
28
+ format.json do
29
+ return respond_with_successful()
30
+ end
31
+ end
32
+ end
33
+
34
+ # GET /clones/new
35
+ def new
36
+ end
37
+
38
+ # GET /clones/1/edit
39
+ def edit
40
+ end
41
+
42
+ # POST /clones
43
+ def create
44
+
45
+ result = TranslationsCloneService.remote_clone(clone_params[:instance_code])
46
+ respond_with_successful if result.success?
47
+ respond_with_error if not result.success?
48
+
49
+ end
50
+
51
+ # PATCH/PUT /clones/1
52
+ def update
53
+ return respond_with_not_found unless @clone
54
+
55
+ if @clone.update(clone_params)
56
+ respond_with_successful(@clone.show(current_user, @query))
57
+ else
58
+ respond_with_error(@clone.errors.full_messages.to_sentence)
59
+ end
60
+ end
61
+
62
+ # DELETE /clones/1
63
+ def destroy
64
+ return respond_with_not_found unless @clone
65
+
66
+ if @clone.destroy
67
+ respond_with_successful
68
+ else
69
+ respond_with_error(@clone.errors.full_messages.to_sentence)
70
+ end
71
+ end
72
+
73
+ private
74
+
75
+ # Only allow a list of trusted parameters through.
76
+ def clone_params
77
+ params.require(:clone).permit(:instance_code)
78
+ end
79
+ end
80
+ end
@@ -0,0 +1,38 @@
1
+ =begin
2
+
3
+ Lesli
4
+
5
+ Copyright (c) 2023, Lesli Technologies, S. A.
6
+
7
+ This program is free software: you can redistribute it and/or modify
8
+ it under the terms of the GNU General Public License as published by
9
+ the Free Software Foundation, either version 3 of the License, or
10
+ (at your option) any later version.
11
+
12
+ This program is distributed in the hope that it will be useful,
13
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ GNU General Public License for more details.
16
+
17
+ You should have received a copy of the GNU General Public License
18
+ along with this program. If not, see http://www.gnu.org/licenses/.
19
+
20
+ Lesli · Ruby on Rails SaaS Development Framework.
21
+
22
+ Made with ♥ by https://www.lesli.tech
23
+ Building a better future, one line of code at a time.
24
+
25
+ @contact hello@lesli.tech
26
+ @website https://www.lesli.tech
27
+ @license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
28
+
29
+ // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
30
+ // ·
31
+ =end
32
+
33
+ module LesliBabel
34
+ class DashboardsController < ApplicationController
35
+ def show
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,91 @@
1
+ =begin
2
+
3
+ Copyright (c) 2022, all rights reserved.
4
+
5
+ All the information provided by this platform is protected by international laws related to
6
+ industrial property, intellectual property, copyright and relative international laws.
7
+ All intellectual or industrial property rights of the code, texts, trade mark, design,
8
+ pictures and any other information belongs to the owner of this platform.
9
+
10
+ Without the written permission of the owner, any replication, modification,
11
+ transmission, publication is strictly forbidden.
12
+
13
+ For more information read the license file including with this software.
14
+
15
+ // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
16
+ // ·
17
+ =end
18
+
19
+ require_dependency "cloud_babel/application_controller"
20
+
21
+ module LesliBabel
22
+ class ModulesController < ApplicationController
23
+ before_action :set_module, only: [:show, :edit, :update, :destroy]
24
+
25
+ def privileges
26
+ {
27
+ show: ['CloudBabel::StringsController#index']
28
+ }
29
+ end
30
+
31
+ # GET /modules
32
+ def index
33
+ respond_to do |format|
34
+ format.html { }
35
+ format.json { respond_with_successful(Module.index) }
36
+ end
37
+ end
38
+
39
+ # GET /modules/1
40
+ def show
41
+ respond_to do |format|
42
+ format.html { }
43
+ format.json { respond_with_successful(@module) }
44
+ end
45
+ end
46
+
47
+ # GET /modules/new
48
+ def new
49
+ @module = Module.new
50
+ end
51
+
52
+ # GET /modules/1/edit
53
+ def edit
54
+ end
55
+
56
+ # POST /modules
57
+ def create
58
+ new_module = Module.new(module_params)
59
+ if new_module.save
60
+ respond_with_successful(new_module)
61
+ else
62
+ respond_with_error("Error on create module", new_module.errors)
63
+ end
64
+ end
65
+
66
+ # PATCH/PUT /modules/1
67
+ def update
68
+ if @module.update(module_params)
69
+ redirect_to @module, notice: 'Module was successfully updated.'
70
+ else
71
+ render :edit
72
+ end
73
+ end
74
+
75
+ # DELETE /modules/1
76
+ def destroy
77
+ end
78
+
79
+ private
80
+
81
+ # Use callbacks to share common setup or constraints between actions.
82
+ def set_module
83
+ @module = Module.find(params[:id])
84
+ end
85
+
86
+ # Only allow a trusted parameter "white list" through.
87
+ def module_params
88
+ params.require(:module).permit(:name, :platform)
89
+ end
90
+ end
91
+ end
@@ -0,0 +1,38 @@
1
+ =begin
2
+ Copyright (c) 2023, all rights reserved.
3
+
4
+ All the information provided by this platform is protected by international laws related to
5
+ industrial property, intellectual property, copyright and relative international laws.
6
+ All intellectual or industrial property rights of the code, texts, trade mark, design,
7
+ pictures and any other information belongs to the owner of this platform.
8
+
9
+ Without the written permission of the owner, any replication, modification,
10
+ transmission, publication is strictly forbidden.
11
+
12
+ For more information read the license file including with this software.
13
+
14
+ // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
15
+ // ·
16
+
17
+ =end
18
+ require_dependency "cloud_babel/application_controller"
19
+
20
+ module LesliBabel
21
+ class RelevantsController < ApplicationController
22
+ before_action :set_relevant, only: [:show, :update, :destroy]
23
+
24
+ # GET /relevants
25
+ def index
26
+ end
27
+
28
+ private
29
+
30
+ # Use callbacks to share common setup or constraints between actions.
31
+ def set_relevant
32
+ end
33
+
34
+ # Only allow a list of trusted parameters through.
35
+ def relevant_params
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,142 @@
1
+
2
+ module LesliBabel
3
+ class StringsController < ApplicationController
4
+ before_action :set_string, only: [:show, :edit, :update, :destroy, :need_help, :need_translation]
5
+
6
+ # GET /strings
7
+ def index
8
+ respond_to do |format|
9
+ format.html { }
10
+ format.json {
11
+ respond_with_pagination(StringService.new(current_user, query).index(params))
12
+ }
13
+ end
14
+ end
15
+
16
+ # GET /strings/1
17
+ def show
18
+ end
19
+
20
+ # GET /strings/new
21
+ def new
22
+ @string = String.new
23
+ end
24
+
25
+ # GET /strings/1/edit
26
+ def edit
27
+ end
28
+
29
+ # POST /strings
30
+ def create
31
+
32
+ if String.find_by(label: string_params[:label],cloud_babel_buckets_id: string_params[:cloud_babel_buckets_id])
33
+ return respond_with_error("Duplicated string")
34
+ end
35
+
36
+ string = String.new(string_params)
37
+ if string.save
38
+ String.log_activity_create(current_user, string)
39
+ respond_with_successful(string)
40
+ else
41
+ respond_with_error("Error on create translation string", string.errors)
42
+ end
43
+ end
44
+
45
+ # PATCH/PUT /strings/1
46
+ def update
47
+ return respond_with_not_found unless @string
48
+
49
+ # We store the original attributes
50
+ old_attributes = @string.attributes
51
+
52
+ # if status changed
53
+ if @string["status"] != string_params["status"]
54
+
55
+ # saved update date
56
+ @string["last_update_status"] = Time.now
57
+
58
+ end
59
+
60
+ # if context changed
61
+ if @string["context"] != string_params["context"]
62
+
63
+ # saved update date
64
+ @string["last_update_context"] = Time.now
65
+
66
+ end
67
+
68
+ Rails.application.config.lesli_settings["configuration"]["locales"].each do |locale|
69
+
70
+ # if translation changed
71
+ if @string[locale] != string_params[locale]
72
+
73
+ # saved update date
74
+ @string["last_update_#{locale}"] = Time.now
75
+
76
+ end
77
+
78
+ end
79
+
80
+ if @string.update(string_params)
81
+
82
+ # We store the new attributes and compare the activities
83
+ new_attributes = @string.attributes
84
+ String.log_activity_update(current_user, @string, old_attributes, new_attributes)
85
+
86
+ respond_with_successful(@string)
87
+ else
88
+ respond_with_error(@string.errors.full_sentence)
89
+ end
90
+
91
+ end
92
+
93
+ # DELETE /strings/1
94
+ def destroy
95
+ return respond_with_not_found unless @string
96
+
97
+ if @string.destroy
98
+ respond_with_successful
99
+
100
+ String.log_activity_destroy(current_user, @string)
101
+ else
102
+ respond_with_error(@string.errors.full_messages.to_sentence)
103
+ end
104
+ end
105
+
106
+ def stats
107
+ respond_with_successful(StringService.new(current_user, query).stats())
108
+ end
109
+
110
+ def relevant
111
+ respond_with_pagination(String.relevant(current_user, @query, params))
112
+ end
113
+
114
+ # return a list of the locales available
115
+ def locales
116
+ respond_with_successful(Rails.application.config.lesli.dig(:configuration, :locales))
117
+ end
118
+
119
+ private
120
+
121
+ # Use callbacks to share common setup or constraints between actions.
122
+ def set_string
123
+ @string = String.find(params[:id])
124
+ end
125
+
126
+ # Only allow a trusted parameter "white list" through.
127
+ def string_params
128
+ params.require(:string).permit(
129
+ :id,
130
+ :label,
131
+ :status,
132
+ :context,
133
+ :priority,
134
+ :need_help,
135
+ :need_translation,
136
+ :cloud_babel_buckets_id,
137
+ Rails.application.config.lesli_settings["configuration"]["locales"]
138
+ )
139
+ end
140
+
141
+ end
142
+ end