lesli_letter 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. checksums.yaml +7 -0
  2. data/Rakefile +5 -0
  3. data/app/assets/config/lesli_letter_manifest.js +39 -0
  4. data/app/assets/images/lesli_letter/letter-logo.svg +1 -0
  5. data/app/assets/javascripts/lesli_letter/application.js +3980 -0
  6. data/app/assets/stylesheets/lesli_letter/application.scss +37 -0
  7. data/app/assets/stylesheets/lesli_letter/notebooks.scss +43 -0
  8. data/app/assets/stylesheets/lesli_letter/notes.scss +71 -0
  9. data/app/controllers/lesli_letter/accounts_controller.rb +60 -0
  10. data/app/controllers/lesli_letter/application_controller.rb +4 -0
  11. data/app/controllers/lesli_letter/dashboards_controller.rb +4 -0
  12. data/app/controllers/lesli_letter/notebooks_controller.rb +98 -0
  13. data/app/controllers/lesli_letter/notes_controller.rb +114 -0
  14. data/app/helpers/lesli_letter/accounts_helper.rb +4 -0
  15. data/app/helpers/lesli_letter/application_helper.rb +4 -0
  16. data/app/helpers/lesli_letter/dashboards_helper.rb +4 -0
  17. data/app/helpers/lesli_letter/notebooks_helper.rb +4 -0
  18. data/app/helpers/lesli_letter/notes_helper.rb +4 -0
  19. data/app/jobs/lesli_letter/application_job.rb +4 -0
  20. data/app/mailers/lesli_letter/application_mailer.rb +6 -0
  21. data/app/models/lesli_letter/account.rb +39 -0
  22. data/app/models/lesli_letter/application_record.rb +5 -0
  23. data/app/models/lesli_letter/dashboard.rb +31 -0
  24. data/app/models/lesli_letter/note.rb +7 -0
  25. data/app/models/lesli_letter/notebook.rb +7 -0
  26. data/app/services/lesli_letter/note_service.rb +64 -0
  27. data/app/services/lesli_letter/notebook_service.rb +52 -0
  28. data/app/views/lesli_letter/accounts/_account.html.erb +2 -0
  29. data/app/views/lesli_letter/accounts/_form.html.erb +17 -0
  30. data/app/views/lesli_letter/accounts/edit.html.erb +10 -0
  31. data/app/views/lesli_letter/accounts/index.html.erb +14 -0
  32. data/app/views/lesli_letter/accounts/new.html.erb +9 -0
  33. data/app/views/lesli_letter/accounts/show.html.erb +10 -0
  34. data/app/views/lesli_letter/dashboards/show.html.erb +1 -0
  35. data/app/views/lesli_letter/notebooks/edit.html.erb +10 -0
  36. data/app/views/lesli_letter/notebooks/index.html.erb +1 -0
  37. data/app/views/lesli_letter/notebooks/new.html.erb +9 -0
  38. data/app/views/lesli_letter/notebooks/show.html.erb +10 -0
  39. data/app/views/lesli_letter/notes/edit.html.erb +10 -0
  40. data/app/views/lesli_letter/notes/index.html.erb +1 -0
  41. data/app/views/lesli_letter/notes/new.html.erb +9 -0
  42. data/app/views/lesli_letter/notes/show.html.erb +10 -0
  43. data/app/views/lesli_letter/partials/_engine-navigation.html.erb +37 -0
  44. data/config/locales/translations.en.yml +23 -0
  45. data/config/locales/translations.es.yml +23 -0
  46. data/config/routes.rb +57 -0
  47. data/db/migrate/v1/0305000110_create_lesli_letter_accounts.rb +42 -0
  48. data/db/migrate/v1/0305050110_create_lesli_letter_dashboards.rb +51 -0
  49. data/db/migrate/v1/0305050210_create_lesli_letter_dashboard_components.rb +53 -0
  50. data/db/migrate/v1/0305100110_create_lesli_letter_notebooks.rb +46 -0
  51. data/db/migrate/v1/0305110110_create_lesli_letter_notes.rb +48 -0
  52. data/db/seed/development.rb +53 -0
  53. data/db/seed/production.rb +35 -0
  54. data/db/seed/test.rb +35 -0
  55. data/db/seeds.rb +43 -0
  56. data/lib/lesli_letter/engine.rb +49 -0
  57. data/lib/lesli_letter/version.rb +4 -0
  58. data/lib/lesli_letter.rb +6 -0
  59. data/lib/tasks/lesli_letter_tasks.rake +4 -0
  60. data/lib/vue/application.js +77 -0
  61. data/lib/vue/apps/notebooks/index.vue +85 -0
  62. data/lib/vue/apps/notes/components/note-preview.vue +45 -0
  63. data/lib/vue/apps/notes/index.vue +102 -0
  64. data/lib/vue/stores/note.js +90 -0
  65. data/lib/vue/stores/notebooks.js +61 -0
  66. data/lib/vue/stores/notes.js +61 -0
  67. data/lib/vue/stores/translations.json +58 -0
  68. data/license +674 -0
  69. data/readme.md +76 -0
  70. metadata +128 -0
@@ -0,0 +1,35 @@
1
+ =begin
2
+ Lesli
3
+
4
+ Copyright (c) 2023, Lesli Technologies, S. A.
5
+
6
+ This program is free software: you can redistribute it and/or modify
7
+ it under the terms of the GNU General Public License as published by
8
+ the Free Software Foundation, either version 3 of the License, or
9
+ (at your option) any later version.
10
+
11
+ This program is distributed in the hope that it will be useful,
12
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ GNU General Public License for more details.
15
+
16
+ You should have received a copy of the GNU General Public License
17
+ along with this program. If not, see http://www.gnu.org/licenses/.
18
+
19
+ Lesli · Your Smart Business Assistant.
20
+
21
+ Made with ♥ by https://www.lesli.tech
22
+ Building a better future, one line of code at a time.
23
+
24
+ @contact hello@lesli.tech
25
+ @website https://lesli.tech
26
+ @license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
27
+
28
+ // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
29
+ // ·
30
+
31
+ =end
32
+
33
+ load "#{Rails.root}/db/seed/production/accounts.rb"
34
+ load "#{Rails.root}/db/seed/production/users.rb"
35
+ load "#{Rails.root}/db/seed/production/template.rb"
data/db/seed/test.rb ADDED
@@ -0,0 +1,35 @@
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 · Your Smart Business Assistant.
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://lesli.tech
27
+ @license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
28
+
29
+ // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
30
+ // ·
31
+
32
+ =end
33
+
34
+ load "#{Lesli::Engine.root}/db/seed/development/accounts.rb"
35
+ load "#{Lesli::Engine.root}/db/seed/development/users.rb"
data/db/seeds.rb ADDED
@@ -0,0 +1,43 @@
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
+
34
+ # IMPORTANT:
35
+ # Seed files are only for development, if you need to create default resources
36
+ # for production you must use the initializer method in the Engine account model
37
+ if Rails.env.development?
38
+ L2.msg(
39
+ "LesliLetter",
40
+ "Version: #{LesliLetter::VERSION}",
41
+ "Build: #{LesliLetter::BUILD}")
42
+ load(LesliLetter::Engine.root.join("db", "seed", "#{ Rails.env.downcase }.rb"))
43
+ end
@@ -0,0 +1,49 @@
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.dev
27
+ @license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
28
+
29
+ // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
30
+ // ·
31
+ =end
32
+ module LesliLetter
33
+ class Engine < ::Rails::Engine
34
+ isolate_namespace LesliLetter
35
+
36
+ initializer :lesli_letter do |app|
37
+
38
+ # register assets manifest
39
+ config.assets.precompile += %w[lesli_letter_manifest.js]
40
+
41
+ # register engine migrations path
42
+ unless app.root.to_s.match root.to_s
43
+ config.paths["db/migrate"].expanded.each do |expanded_path|
44
+ app.config.paths["db/migrate"] << expanded_path
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,4 @@
1
+ module LesliLetter
2
+ VERSION = "0.1.0"
3
+ BUILD = "1697000148"
4
+ end
@@ -0,0 +1,6 @@
1
+ require "lesli_letter/version"
2
+ require "lesli_letter/engine"
3
+
4
+ module LesliLetter
5
+ # Your code goes here...
6
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :lesli_letter do
3
+ # # Task goes here
4
+ # end
@@ -0,0 +1,77 @@
1
+ /*
2
+ Lesli
3
+
4
+ Copyright (c) 2023, Lesli Technologies, S. A.
5
+
6
+ This program is free software: you can redistribute it and/or modify
7
+ it under the terms of the GNU General Public License as published by
8
+ the Free Software Foundation, either version 3 of the License, or
9
+ (at your option) any later version.
10
+
11
+ This program is distributed in the hope that it will be useful,
12
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ GNU General Public License for more details.
15
+
16
+ You should have received a copy of the GNU General Public License
17
+ along with this program. If not, see http://www.gnu.org/licenses/.
18
+
19
+ Lesli · Ruby on Rails SaaS Development Framework.
20
+
21
+ Made with ♥ by https://www.lesli.tech
22
+ Building a better future, one line of code at a time.
23
+
24
+ @contact hello@lesli.tech
25
+ @website https://www.lesli.tech
26
+ @license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
27
+
28
+ // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
29
+ // ·
30
+ */
31
+
32
+
33
+ // · Import Lesli builders
34
+ import application from "Lesli/application"
35
+ import translation from "Lesli/translation"
36
+
37
+
38
+ // · Import engine translations
39
+ import translations from "LesliLetter/stores/translations.json"
40
+
41
+
42
+ // ·
43
+ import applicationNotesIndex from "LesliLetter/apps/notes/index.vue"
44
+ import applicationNotebooksIndex from "LesliLetter/apps/notebooks/index.vue"
45
+
46
+
47
+ //import appDashboardShow from "LesliAudit/apps/dashboards/show.vue"
48
+ import appDashboardShow from "Lesli/shared/dashboards/apps/show.vue"
49
+ import appDashboardEdit from "Lesli/shared/dashboards/apps/edit.vue"
50
+
51
+
52
+ // ·
53
+ // import componentDashboardUsers from "LesliAudit/apps/dashboards/components/users.vue"
54
+ // import componentDashboardRoles from "LesliAudit/apps/dashboards/components/roles.vue"
55
+
56
+
57
+ // ·
58
+ const dashboardProps = {
59
+ components: {
60
+ // "audit-users": componentDashboardUsers,
61
+ // "audit-roles": componentDashboardRoles
62
+ }
63
+ }
64
+
65
+
66
+ // · Buil Lesli translations
67
+ translation(translations)
68
+
69
+
70
+ // · Build a new Lesli application
71
+ application("LesliLetter", [{
72
+ path: "/notes",
73
+ component: applicationNotesIndex
74
+ }, {
75
+ path: "/notebooks",
76
+ component: applicationNotebooksIndex
77
+ }])
@@ -0,0 +1,85 @@
1
+ <script setup>
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
+ // · import vue tools
35
+ import { ref, reactive, onMounted, watch, computed, inject } from "vue"
36
+ import { useRouter, useRoute } from "vue-router"
37
+
38
+
39
+ // · initialize/inject plugins
40
+ const router = useRouter()
41
+ const route = useRoute()
42
+ const url = inject("url")
43
+
44
+
45
+ // · import lesli stores
46
+ import { useNotebooks } from "LesliLetter/stores/notebooks"
47
+
48
+
49
+ // ·
50
+ const storeNotebooks = useNotebooks()
51
+
52
+
53
+ // · translations
54
+ const translations = {
55
+ lesli: {
56
+ shared: i18n.t("lesli.shared")
57
+ },
58
+ notes: i18n.t("lesli_letter.notes")
59
+ }
60
+
61
+
62
+ // ·
63
+ onMounted(() => {
64
+ storeNotebooks.get()
65
+ console.log("works")
66
+ })
67
+ </script>
68
+ <template>
69
+ <lesli-application-container>
70
+ <lesli-header :title="translations.notes.view_title">
71
+ <lesli-button-link main icon="add" :to="url.letter('notes/new')">
72
+ {{ translations.lesli.shared.button_add_new }}
73
+ </lesli-button-link>
74
+ </lesli-header>
75
+ <lesli-toolbar :search-placeholder="translations.notes.toolbar_search_placeholder"></lesli-toolbar>
76
+ <div class="columns is-multiline mt-4 notebooks">
77
+ <div class="column is-3" v-for="notebook in storeNotebooks.index.records">
78
+ <lesli-card>
79
+ <h5>{{ notebook.name }}</h5>
80
+ <p>{{ notebook.description }}</p>
81
+ </lesli-card>
82
+ </div>
83
+ </div>
84
+ </lesli-application-container>
85
+ </template>
@@ -0,0 +1,45 @@
1
+ <script setup>
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
+ const props = defineProps({
36
+ note: {
37
+ type: Object,
38
+ required: true
39
+ }
40
+ })
41
+ </script>
42
+ <template>
43
+ holi
44
+ {{ note }}
45
+ </template>
@@ -0,0 +1,102 @@
1
+ <script setup>
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
+ // · import vue tools
35
+ import { ref, reactive, onMounted, watch, computed, inject } from "vue"
36
+ import { useRouter, useRoute } from "vue-router"
37
+
38
+
39
+ // · initialize/inject plugins
40
+ const router = useRouter()
41
+ const route = useRoute()
42
+ const url = inject("url")
43
+
44
+
45
+ // · import lesli stores
46
+ import { useNote } from "LesliLetter/stores/note"
47
+ import { useNotes } from "LesliLetter/stores/notes"
48
+
49
+
50
+ // · import lesli components
51
+ import { editorRichText } from "lesli-vue/components"
52
+
53
+
54
+ // ·
55
+ const storeNote = useNote()
56
+ const storeNotes = useNotes()
57
+
58
+
59
+ // · translations
60
+ const translations = {
61
+ lesli: {
62
+ shared: i18n.t("lesli.shared")
63
+ },
64
+ notes: i18n.t("lesli_letter.notes")
65
+ }
66
+
67
+
68
+ // ·
69
+ function selectNote(id) {
70
+ storeNote.get(id)
71
+ }
72
+
73
+
74
+ // ·
75
+ onMounted(() => {
76
+ storeNotes.get()
77
+ })
78
+ </script>
79
+ <template>
80
+ <lesli-application-container>
81
+ <lesli-header :title="translations.notes.view_title">
82
+ <lesli-link main icon="add" :to="url.letter('notes/new')">
83
+ {{ translations.lesli.shared.button_add_new }}
84
+ </lesli-link>
85
+ </lesli-header>
86
+ <lesli-toolbar :search-placeholder="translations.notes.toolbar_search_placeholder"></lesli-toolbar>
87
+ <div class="columns mt-4 notebooks-notes">
88
+ <div class="column is-3 has-background-white notes">
89
+ <div v-for="note in storeNotes.index.records" @click="selectNote(note.id)">
90
+ <h5>{{ note.title }}</h5>
91
+ <p>{{ note.excerpt }}</p>
92
+ </div>
93
+ </div>
94
+ <div class="column has-background-white editor">
95
+ <editor-rich-text
96
+ @save="storeNote.updateContent()"
97
+ v-model="storeNote.note.content">
98
+ </editor-rich-text>
99
+ </div>
100
+ </div>
101
+ </lesli-application-container>
102
+ </template>
@@ -0,0 +1,90 @@
1
+ /*
2
+ Lesli
3
+
4
+ Copyright (c) 2023, Lesli Technologies, S. A.
5
+
6
+ This program is free software: you can redistribute it and/or modify
7
+ it under the terms of the GNU General Public License as published by
8
+ the Free Software Foundation, either version 3 of the License, or
9
+ (at your option) any later version.
10
+
11
+ This program is distributed in the hope that it will be useful,
12
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ GNU General Public License for more details.
15
+
16
+ You should have received a copy of the GNU General Public License
17
+ along with this program. If not, see http://www.gnu.org/licenses/.
18
+
19
+ Lesli · Ruby on Rails SaaS Development Framework.
20
+
21
+ Made with ♥ by https://www.lesli.tech
22
+ Building a better future, one line of code at a time.
23
+
24
+ @contact hello@lesli.tech
25
+ @website https://www.lesli.tech
26
+ @license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
27
+
28
+ // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
29
+ // ·
30
+ */
31
+
32
+
33
+ // ·
34
+ import { defineStore } from "pinia"
35
+
36
+
37
+ // ·
38
+ export const useNote = defineStore("letter.note", {
39
+ state: () => {
40
+ return {
41
+ loading: false,
42
+ note: {
43
+ id: 0,
44
+ title: "",
45
+ excerpt: "",
46
+ content: "",
47
+ icon: ""
48
+ }
49
+ }
50
+ },
51
+ actions: {
52
+ get(id) {
53
+ this.loading = true
54
+ this.http.get(this.url.letter("notes/:id", id)).then(result => {
55
+ this.note = result
56
+ }).catch(error => {
57
+ console.log(error)
58
+ }).finally(() => {
59
+ this.loading = false
60
+ })
61
+ },
62
+
63
+ update() {
64
+ this.http.put(this.url.letter("notes/:id", this.note.id), {
65
+ note: {
66
+ id: this.note.id,
67
+ title: this.note.title,
68
+ excerpt: this.note.excerpt,
69
+ content: this.note.content
70
+ }
71
+ }).then(result => {
72
+ console.log(result)
73
+ }).catch(error => {
74
+ console.log(error)
75
+ })
76
+ },
77
+
78
+ updateContent() {
79
+ this.http.put(this.url.letter("notes/:id", this.note.id), {
80
+ note: {
81
+ content: this.note.content
82
+ }
83
+ }).then(result => {
84
+ console.log(result)
85
+ }).catch(error => {
86
+ console.log(error)
87
+ })
88
+ }
89
+ }
90
+ })
@@ -0,0 +1,61 @@
1
+ /*
2
+ Lesli
3
+
4
+ Copyright (c) 2023, Lesli Technologies, S. A.
5
+
6
+ This program is free software: you can redistribute it and/or modify
7
+ it under the terms of the GNU General Public License as published by
8
+ the Free Software Foundation, either version 3 of the License, or
9
+ (at your option) any later version.
10
+
11
+ This program is distributed in the hope that it will be useful,
12
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ GNU General Public License for more details.
15
+
16
+ You should have received a copy of the GNU General Public License
17
+ along with this program. If not, see http://www.gnu.org/licenses/.
18
+
19
+ Lesli · Ruby on Rails SaaS Development Framework.
20
+
21
+ Made with ♥ by https://www.lesli.tech
22
+ Building a better future, one line of code at a time.
23
+
24
+ @contact hello@lesli.tech
25
+ @website https://www.lesli.tech
26
+ @license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
27
+
28
+ // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
29
+ // ·
30
+ */
31
+
32
+
33
+ // ·
34
+ import { defineStore } from "pinia"
35
+
36
+
37
+ // ·
38
+ export const useNotebooks = defineStore("letter.notebooks", {
39
+ state: () => {
40
+ return {
41
+ index: {
42
+ loading: false,
43
+ pagination: {},
44
+ records: []
45
+ }
46
+ }
47
+ },
48
+ actions: {
49
+ get() {
50
+ this.loading = true
51
+ this.http.get(this.url.letter("notebooks")).then(result => {
52
+ this.index.pagination = result.pagination
53
+ this.index.records = result.records
54
+ }).catch(error => {
55
+ console.log(error)
56
+ }).finally(() => {
57
+ this.loading = false
58
+ })
59
+ }
60
+ }
61
+ })