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,37 @@
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/component";
36
+ @import "./notebooks";
37
+ @import "./notes";
@@ -0,0 +1,43 @@
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
+ .lesli-letter-notebooks {
36
+
37
+ .notebooks .column h5 {
38
+ font-weight: 600;
39
+ // padding: 1rem;
40
+ // border-radius: 8px;
41
+ // border: 1px solid lesli-css-color(silver);
42
+ }
43
+ }
@@ -0,0 +1,71 @@
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
+ .lesli-letter-notes {
36
+
37
+ .notebooks-notes {
38
+ padding: 0 12px;
39
+
40
+ .notes,
41
+ .editor,
42
+ .notebooks {
43
+ border: 1px solid;
44
+ }
45
+
46
+ .notes {
47
+ border-right: none;
48
+ border-radius: 10px 0 0 10px;
49
+ padding: .2rem 1rem 1rem;
50
+
51
+ div {
52
+ padding: .8rem .2rem;
53
+ border-bottom: 1px solid lesli-css-color(silver, 500);
54
+ }
55
+
56
+ p {
57
+ font-size: .9rem;
58
+ color: lesli-css-color(silver, 700);
59
+ }
60
+ }
61
+
62
+ .editor {
63
+ padding: .2rem;
64
+ border-radius: 0 10px 10px 0;
65
+ }
66
+
67
+ .component-editor-richtext {
68
+ border: none;
69
+ }
70
+ }
71
+ }
@@ -0,0 +1,60 @@
1
+ module LesliLetter
2
+ class AccountsController < ApplicationController
3
+ before_action :set_account, only: %i[ show edit update destroy ]
4
+
5
+ # GET /accounts
6
+ def index
7
+ @accounts = Account.all
8
+ end
9
+
10
+ # GET /accounts/1
11
+ def show
12
+ end
13
+
14
+ # GET /accounts/new
15
+ def new
16
+ @account = Account.new
17
+ end
18
+
19
+ # GET /accounts/1/edit
20
+ def edit
21
+ end
22
+
23
+ # POST /accounts
24
+ def create
25
+ @account = Account.new(account_params)
26
+
27
+ if @account.save
28
+ redirect_to @account, notice: "Account was successfully created."
29
+ else
30
+ render :new, status: :unprocessable_entity
31
+ end
32
+ end
33
+
34
+ # PATCH/PUT /accounts/1
35
+ def update
36
+ if @account.update(account_params)
37
+ redirect_to @account, notice: "Account was successfully updated.", status: :see_other
38
+ else
39
+ render :edit, status: :unprocessable_entity
40
+ end
41
+ end
42
+
43
+ # DELETE /accounts/1
44
+ def destroy
45
+ @account.destroy
46
+ redirect_to accounts_url, notice: "Account was successfully destroyed.", status: :see_other
47
+ end
48
+
49
+ private
50
+ # Use callbacks to share common setup or constraints between actions.
51
+ def set_account
52
+ @account = Account.find(params[:id])
53
+ end
54
+
55
+ # Only allow a list of trusted parameters through.
56
+ def account_params
57
+ params.fetch(:account, {})
58
+ end
59
+ end
60
+ end
@@ -0,0 +1,4 @@
1
+ module LesliLetter
2
+ class ApplicationController < Lesli::ApplicationLesliController
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module LesliLetter
2
+ class DashboardsController < Lesli::ApplicationLesliController # Lesli::Shared::DashboardsController
3
+ end
4
+ end
@@ -0,0 +1,98 @@
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
+
32
+ =end
33
+ module LesliLetter
34
+ class NotebooksController < ApplicationController
35
+ before_action :set_notebook, only: %i[ show edit update destroy ]
36
+
37
+ # GET /notebooks
38
+ def index
39
+ respond_to do |format|
40
+ format.html {}
41
+ format.json {
42
+ respond_with_pagination(NotebookService.new(current_user, query).index())
43
+ }
44
+ end
45
+ end
46
+
47
+ # GET /notebooks/1
48
+ def show
49
+ end
50
+
51
+ # GET /notebooks/new
52
+ def new
53
+ @notebook = Notebook.new
54
+ end
55
+
56
+ # GET /notebooks/1/edit
57
+ def edit
58
+ end
59
+
60
+ # POST /notebooks
61
+ def create
62
+ @notebook = Notebook.new(notebook_params)
63
+
64
+ if @notebook.save
65
+ redirect_to @notebook, notice: "Notebook was successfully created."
66
+ else
67
+ render :new, status: :unprocessable_entity
68
+ end
69
+ end
70
+
71
+ # PATCH/PUT /notebooks/1
72
+ def update
73
+ if @notebook.update(notebook_params)
74
+ redirect_to @notebook, notice: "Notebook was successfully updated.", status: :see_other
75
+ else
76
+ render :edit, status: :unprocessable_entity
77
+ end
78
+ end
79
+
80
+ # DELETE /notebooks/1
81
+ def destroy
82
+ @notebook.destroy
83
+ redirect_to notebooks_url, notice: "Notebook was successfully destroyed.", status: :see_other
84
+ end
85
+
86
+ private
87
+
88
+ # Use callbacks to share common setup or constraints between actions.
89
+ def set_notebook
90
+ @notebook = Notebook.find(params[:id])
91
+ end
92
+
93
+ # Only allow a list of trusted parameters through.
94
+ def notebook_params
95
+ params.fetch(:notebook, {})
96
+ end
97
+ end
98
+ end
@@ -0,0 +1,114 @@
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
+
32
+ =end
33
+ module LesliLetter
34
+ class NotesController < ApplicationController
35
+ before_action :set_note, only: %i[ show edit update destroy ]
36
+
37
+ # GET /notes
38
+ def index
39
+ respond_to do |format|
40
+ format.html {}
41
+ format.json {
42
+ respond_with_pagination(NoteService.new(current_user, query).index())
43
+ }
44
+ end
45
+ end
46
+
47
+ # GET /notes/1
48
+ def show
49
+ respond_to do |format|
50
+ format.html {}
51
+ format.json {
52
+ pp "--------"
53
+ respond_with_successful(@note.show())
54
+ pp "--------"
55
+ }
56
+ end
57
+ end
58
+
59
+ # GET /notes/new
60
+ def new
61
+ @note = Note.new
62
+ end
63
+
64
+ # GET /notes/1/edit
65
+ def edit
66
+ end
67
+
68
+ # POST /notes
69
+ def create
70
+ @note = Note.new(note_params)
71
+
72
+ if @note.save
73
+ redirect_to @note, notice: "Note was successfully created."
74
+ else
75
+ render :new, status: :unprocessable_entity
76
+ end
77
+ end
78
+
79
+ # PATCH/PUT /notes/1
80
+ def update
81
+
82
+ @note.update(note_params)
83
+
84
+ if @note.successful?
85
+ return respond_with_successful(@note)
86
+ end
87
+
88
+ respond_with_error(@note.errors)
89
+ end
90
+
91
+ # DELETE /notes/1
92
+ def destroy
93
+ @note.destroy
94
+ redirect_to notes_url, notice: "Note was successfully destroyed.", status: :see_other
95
+ end
96
+
97
+ private
98
+ # Use callbacks to share common setup or constraints between actions.
99
+ def set_note
100
+ @note = NoteService.new(current_user, query).find(params[:id])
101
+ respond_with_not_found unless @note.found?
102
+ end
103
+
104
+ # Only allow a list of trusted parameters through.
105
+ def note_params
106
+ params.fetch(:note, {}).permit(
107
+ :title,
108
+ :excerpt,
109
+ :content,
110
+ :icon
111
+ )
112
+ end
113
+ end
114
+ end
@@ -0,0 +1,4 @@
1
+ module LesliLetter
2
+ module AccountsHelper
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module LesliLetter
2
+ module ApplicationHelper
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module LesliLetter
2
+ module DashboardsHelper
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module LesliLetter
2
+ module NotebooksHelper
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module LesliLetter
2
+ module NotesHelper
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module LesliLetter
2
+ class ApplicationJob < ActiveJob::Base
3
+ end
4
+ end
@@ -0,0 +1,6 @@
1
+ module LesliLetter
2
+ class ApplicationMailer < ActionMailer::Base
3
+ default from: "from@example.com"
4
+ layout "mailer"
5
+ end
6
+ end
@@ -0,0 +1,39 @@
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
+
33
+ module LesliLetter
34
+ class Account < ApplicationRecord
35
+ belongs_to :account, class_name: "Lesli::Account"
36
+ has_many :notes
37
+ has_many :notebooks
38
+ end
39
+ end
@@ -0,0 +1,5 @@
1
+ module LesliLetter
2
+ class ApplicationRecord < ActiveRecord::Base
3
+ self.abstract_class = true
4
+ end
5
+ end
@@ -0,0 +1,31 @@
1
+ module LesliLetter
2
+ class Dashboard < Lesli::Shared::Dashboard
3
+ self.table_name = "lesli_letter_dashboards"
4
+ belongs_to :account
5
+
6
+ has_many :components, inverse_of: :dashboard, autosave: true, dependent: :destroy
7
+ accepts_nested_attributes_for :components, allow_destroy: true
8
+
9
+ def self.initialize_account(account)
10
+ self.create!(
11
+ account: account,
12
+ name: "Audit Default Dashboard",
13
+ default: true,
14
+ main: false,
15
+ components_attributes: [{
16
+ name: "Total users",
17
+ component_id: "audit-users",
18
+ layout: 3,
19
+ query_configuration: {},
20
+ custom_configuration: {}
21
+ }, {
22
+ name: "Roles",
23
+ component_id: "audit-roles",
24
+ layout: 3,
25
+ query_configuration: {},
26
+ custom_configuration: {}
27
+ }]
28
+ )
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,7 @@
1
+ module LesliLetter
2
+ class Note < Lesli::ApplicationLesliRecord
3
+ belongs_to :notebook
4
+ belongs_to :user, class_name: "Lesli::User"
5
+ belongs_to :account, class_name: "Lesli::Account"
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module LesliLetter
2
+ class Notebook < ApplicationRecord
3
+ belongs_to :account
4
+ belongs_to :user, class_name: "Lesli::User"
5
+ has_many :notes
6
+ end
7
+ end
@@ -0,0 +1,64 @@
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 platform.
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 LesliLetter
34
+ class NoteService < Lesli::ApplicationLesliService
35
+
36
+ def find id
37
+ super(current_user.account.letter.notes.find_by_id(id))
38
+ end
39
+
40
+ def index
41
+ current_user.account.letter.notes
42
+ .select(
43
+ "lesli_letter_notes.id as id",
44
+ "lesli_letter_notes.name as title",
45
+ "SUBSTRING(lesli_letter_notes.content, 1, 35) as excerpt"
46
+ )
47
+ .page(query[:pagination][:page])
48
+ .per(query[:pagination][:perPage])
49
+ #.order(updated_at: :desc, name: :asc)
50
+ .order(id: :asc)
51
+ end
52
+
53
+ def show
54
+ self.resource
55
+ end
56
+
57
+ def update params
58
+ if self.resource.update(params)
59
+ return self
60
+ end
61
+ self.error(self.resource.errors.full_messages.to_sentence)
62
+ end
63
+ end
64
+ end