lesli_calendar 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,5 @@
1
1
  /*!************************************************************************************************************************************************************!*\
2
- !*** css ./node_modules/css-loader/dist/cjs.js??clonedRuleSet-23.use[1]!./node_modules/sass-loader/dist/cjs.js!../LesliCalendar/lib/scss/application.scss ***!
2
+ !*** css ./node_modules/css-loader/dist/cjs.js??clonedRuleSet-27.use[1]!./node_modules/sass-loader/dist/cjs.js!../LesliCalendar/lib/scss/application.scss ***!
3
3
  \************************************************************************************************************************************************************/
4
4
  @charset "UTF-8";
5
5
  /*
@@ -128,36 +128,6 @@ body.lesli-calendar {
128
128
  /*
129
129
  Lesli
130
130
 
131
- Copyright (c) 2022, Lesli Technologies, S. A.
132
-
133
- This program is free software: you can redistribute it and/or modify
134
- it under the terms of the GNU General Public License as published by
135
- the Free Software Foundation, either version 3 of the License, or
136
- (at your option) any later version.
137
-
138
- This program is distributed in the hope that it will be useful,
139
- but WITHOUT ANY WARRANTY; without even the implied warranty of
140
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
141
- GNU General Public License for more details.
142
-
143
- You should have received a copy of the GNU General Public License
144
- along with this program. If not, see <http://www.gnu.org/licenses/>.
145
-
146
- LesliCSS - SCSS Utilities for websites, apps and web applications
147
-
148
- Powered by https://www.lesli.tech
149
- Building a better future, one line of code at a time.
150
-
151
- @contact <hello@lesli.tech>
152
- @website <https://lesli.tech>
153
- @license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
154
-
155
- // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
156
- // ·
157
- */
158
- /*
159
- Lesli
160
-
161
131
  Copyright (c) 2020, Lesli Technologies, S. A.
162
132
 
163
133
  This program is free software: you can redistribute it and/or modify
@@ -55,7 +55,7 @@ module LesliCalendar
55
55
  def set_calendar
56
56
 
57
57
  if params[:id].blank? || params[:id] == "default"
58
- @calendar = CalendarService.new(current_user).find_default
58
+ @calendar = CalendarService.new(current_user,query).find_default
59
59
  elsif params[:id]
60
60
  @calendar = CalendarService.new(current_user).find(params[:id])
61
61
  end
@@ -1,5 +1,6 @@
1
1
  module LesliCalendar
2
2
  class Calendar < ApplicationRecord
3
3
  belongs_to :account
4
+ has_many :events, foreign_key: "calendar_id"
4
5
  end
5
6
  end
@@ -1,4 +1,5 @@
1
1
  module LesliCalendar
2
- class Event < ApplicationRecord
3
- end
2
+ class Event < ApplicationRecord
3
+ belongs_to :calendar
4
+ end
4
5
  end
@@ -48,8 +48,8 @@ module LesliCalendar
48
48
  id: self.resource.id,
49
49
  name: self.resource.name,
50
50
  user_id: self.resource.user_id,
51
- events: [],
52
- events_support: LesliSupport::TicketService.new(current_user).with_deadline
51
+ events: EventService.new(current_user, query).index(),
52
+ events_support: [] # LesliSupport::TicketService.new(current_user).with_deadline
53
53
  }
54
54
  end
55
55
  end
@@ -0,0 +1,57 @@
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 LesliCalendar
34
+ class EventService < Lesli::ApplicationLesliService
35
+
36
+ def find calendar_id
37
+ #super(current_user.account.calendar.calendar.find_by(id: calendar_id))
38
+ super(current_user.account.calendar.calendars.first)
39
+ end
40
+
41
+ def index()
42
+ events = current_user.account.calendar.calendars.first.events
43
+ .select(:id, :title, :description, :date, :start, :end, :url, :location, :status, "'lesli-calendar' as classNames")
44
+
45
+ tickets = ::LesliSupport::TicketService.new(current_user, query).index.map do |ticket|
46
+ {
47
+ id: ticket.id,
48
+ title: ticket.subject,
49
+ date: ticket.deadline,
50
+ classNames: 'lesli-support'
51
+ }
52
+ end
53
+
54
+ return events + tickets
55
+ end
56
+ end
57
+ end
@@ -15,3 +15,22 @@ For more information read the license file including with this software.
15
15
  // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
16
16
  // ·
17
17
  =end
18
+
19
+ current_user = ::Lesli::User.first
20
+ calendar = LesliCalendar::Calendar.first
21
+
22
+ 10.times do |index|
23
+ LesliCalendar::Event.create!({
24
+ title: "Birthday party number: #{ index }",
25
+ description: "Join us to celebrate John's milestone 30th birthday! We'll have a fun-filled evening with music, games, delicious food, and great company. Don't miss out on the birthday cake and the chance to make unforgettable memories. Please RSVP by [RSVP Date] to let us know if you can make it. Looking forward to seeing you there!",
26
+ date: index.day.from_now,
27
+ start: index.day.from_now,
28
+ end: index.day.from_now,
29
+ url: "",
30
+ location: "Guatemala",
31
+ status: "",
32
+ public: true,
33
+ calendar: calendar,
34
+ #user: current_user
35
+ })
36
+ end
data/db/seeds.rb CHANGED
@@ -21,7 +21,7 @@ For more information read the license file including with this software.
21
21
  # you must use the initializer method in the Engine account model
22
22
  if Rails.env.development?
23
23
  L2.msg(
24
- "Loading seeds for LesliCalendar environment",
24
+ "LesliCalendar",
25
25
  "Version: #{LesliCalendar::VERSION}",
26
26
  "Build: #{LesliCalendar::BUILD}")
27
27
  load LesliCalendar::Engine.root.join("db", "seed", "#{ Rails.env.downcase }.rb")
@@ -1,4 +1,4 @@
1
1
  module LesliCalendar
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  BUILD = "1713121383"
4
4
  end
@@ -37,7 +37,7 @@ import translation from "Lesli/vue/translation"
37
37
 
38
38
 
39
39
  // · Import engine translations
40
- import translations from "LesliBabel/vue/stores/translations.json"
40
+ import translations from "LesliCalendar/vue/stores/translations.json"
41
41
 
42
42
 
43
43
  // · Import apps and components
@@ -129,9 +129,7 @@ onMounted(() => {
129
129
  setTimeout(() => { storeCalendar.calendar.render(); }, 200)
130
130
 
131
131
  })
132
-
133
132
  </script>
134
-
135
133
  <template>
136
134
  <div id="lesli-calendar"></div>
137
135
  </template>
@@ -94,10 +94,21 @@ export const useCalendar = defineStore("calendar.calendar", {
94
94
 
95
95
  getCalendar() {
96
96
  this.http.get(this.url.calendar("calendar")).then(result => {
97
-
98
97
  this.calendarData = result
99
98
 
100
- this.calendarData.events_support = this.calendarData.events_support.map(event => {
99
+ // Add calendar events
100
+ this.calendarData.events.forEach(event => {
101
+ this.calendar.addEvent({
102
+ title: event.title,
103
+ start: event.date,
104
+ description: event.description,
105
+ classNames: event.classNames
106
+ })
107
+ })
108
+
109
+ return
110
+
111
+ this.calendarData.events_support = this.calendarData.events.map(event => {
101
112
  return {
102
113
  title: event.subject,
103
114
  start: event.deadline,
@@ -107,10 +118,6 @@ export const useCalendar = defineStore("calendar.calendar", {
107
118
  classNames: "lesli-support"
108
119
  }
109
120
  })
110
-
111
- result.events_support.forEach(event => {
112
- this.calendar.addEvent(event)
113
- })
114
121
  }).catch(error => {
115
122
  console.log(error)
116
123
  })
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lesli_calendar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - The Lesli Development Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-05-10 00:00:00.000000000 Z
11
+ date: 2024-06-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -66,6 +66,7 @@ files:
66
66
  - app/models/lesli_calendar/dashboard.rb
67
67
  - app/models/lesli_calendar/event.rb
68
68
  - app/services/lesli_calendar/calendar_service.rb
69
+ - app/services/lesli_calendar/event_service.rb
69
70
  - app/views/lesli_calendar/calendars/_calendar.html.erb
70
71
  - app/views/lesli_calendar/calendars/_form.html.erb
71
72
  - app/views/lesli_calendar/calendars/edit.html.erb