diff --git a/app/assets/javascripts/calendar_widget.js b/app/assets/javascripts/calendar_widget.js index 571881a..4b1b5d2 100644 --- a/app/assets/javascripts/calendar_widget.js +++ b/app/assets/javascripts/calendar_widget.js @@ -237,7 +237,7 @@ if(today != 0 && last_inserted_date == today){ td.addClass("w-calendar-today"); } - td.find('div').text(last_inserted_date); + td.find('div').html(last_inserted_date<10 ? " "+last_inserted_date+" " : last_inserted_date); td.attr("data-date-node",last_inserted_date+"-"+firstDay.getMonth()+"-"+firstDay.getFullYear()); last_inserted_date++; }else{ @@ -254,7 +254,7 @@ if(today != 0 && last_inserted_date == today){ td.attr("class","w-calendar-today"); } - td.find('div').text(last_inserted_date); + td.find('div').html(last_inserted_date<10 ? " "+last_inserted_date+" " : last_inserted_date); td.attr("data-date-node",last_inserted_date+"-"+firstDay.getMonth()+"-"+firstDay.getFullYear()); last_inserted_date++; row.append(td); @@ -274,7 +274,7 @@ if(today != 0 && last_inserted_date == today){ td.attr("class","w-calendar-today"); } - td.find('div').text(last_inserted_date); + td.find('div').html(last_inserted_date<10 ? " "+last_inserted_date+" " : last_inserted_date); td.attr("data-date-node",last_inserted_date+"-"+firstDay.getMonth()+"-"+firstDay.getFullYear()); last_inserted_date++; }else{ diff --git a/app/assets/javascripts/calendar_widget2.js b/app/assets/javascripts/calendar_widget2.js index 4b04d00..7771578 100644 --- a/app/assets/javascripts/calendar_widget2.js +++ b/app/assets/javascripts/calendar_widget2.js @@ -376,7 +376,7 @@ if(today != 0 && last_inserted_date == today){ td.addClass("w-calendar-today"); } - td.find('div').text(last_inserted_date); + td.find('div').html(last_inserted_date<10 ? " "+last_inserted_date+" " : last_inserted_date); td.attr("data-date-node",last_inserted_date+"-"+firstDay.getMonth()+"-"+firstDay.getFullYear()); last_inserted_date++; }else{ @@ -393,7 +393,7 @@ if(today != 0 && last_inserted_date == today){ td.attr("class","w-calendar-today"); } - td.find('div').text(last_inserted_date); + td.find('div').html(last_inserted_date<10 ? " "+last_inserted_date+" " : last_inserted_date); td.attr("data-date-node",last_inserted_date+"-"+firstDay.getMonth()+"-"+firstDay.getFullYear()); last_inserted_date++; row.append(td); @@ -413,7 +413,7 @@ if(today != 0 && last_inserted_date == today){ td.attr("class","w-calendar-today"); } - td.find('div').text(last_inserted_date); + td.find('div').html(last_inserted_date<10 ? " "+last_inserted_date+" " : last_inserted_date); td.attr("data-date-node",last_inserted_date+"-"+firstDay.getMonth()+"-"+firstDay.getFullYear()); last_inserted_date++; }else{ diff --git a/app/assets/stylesheets/calendar_widget2.css b/app/assets/stylesheets/calendar_widget2.css deleted file mode 100644 index 65b4e32..0000000 --- a/app/assets/stylesheets/calendar_widget2.css +++ /dev/null @@ -1,235 +0,0 @@ -.w-calendar-table { - table-layout: fixed; - width: 100%; -} -a.event-container-one{ - color: inherit; -} -.close_box{ - font-weight: bold; - position: relative; - float: right; - padding: 0.5em; - cursor: pointer; -} -.close_box:hover{ - color: red; -} -.event-bullet-event { - width: 100%; - height: 100%; - border-radius: 50%; -} -.event-bullet-event { - width: 2em; - height: 2em; - border-radius: 1em; -} -.event-header{ - width: 100%; - text-align: center; - font-size: 1.7em; - font-weight: bold; - padding: 0.35em 0; -} -.event-info{ - padding-left: 15%; -} -.calendar-events{ - position: relative; - background: #fbfbfb; -} -.month_template{ - position: relative; -} -.w-calendar.widget-calendar-2{ - flex-wrap: wrap; - margin-top: 2em; - margin-bottom: 1em; -} -.widget-calendar-2 .w-calendar-table td:hover { - background-color: #eaeaea; - color: #333; -} -.widget-calendar-2 .w-calendar-table td { - background: inherit; - color: inherit; - cursor: pointer; - border: 0; -} -.widget-calendar-2 .w-calendar-table td div{ - display: inline-flex; - justify-content: center; - align-items: center; - margin: auto; - width: auto; - height: 3em; -} -.widget-calendar-2 .w-calendar-table th { - background: unset; - color: unset; - border: 0; - width: 3em; - height: 3em; -} -.widget-calendar-2.w-calendar .widget-title { - padding: 0.2em; - font-size: 1.5em; -} -.widget-calendar-2 table.w-calendar-table td.w-calendar-toggle div, .widget-calendar-2 table.w-calendar-table td.w-calendar-toggle div{ - background: #6f0007; - border-radius: 1.5em; - color: white; -} -.widget-calendar-2 .w-calendar-table td.w-calendar-event div{ - border: 1px #6f0007 solid; - background: #eee; - border-radius: 1.5em; -} -.widget-calendar-2 .w-calendar-title{ - background: rgb(146, 8, 17); - color: rgb(255, 255, 255); - padding: 0px 10%; - display: flex; - flex-flow: row-reverse wrap; - line-height: 2em; - justify-content: space-between; - font-size: 1.85em; - width: 100%; -} -.calendar-dialog div.ui-dialog-content { - max-height: 20em !important; - overflow-wrap: break-word; -} -.widget-calendar-2 table td.w-calendar-other-month { - color: #999797; -} -.widget-calendar-2 .event-header{ - display: flex; - background: #dadada; - cursor: default; -} -.widget-calendar-2 .event-header .date{ - width: 30%; -} -.widget-calendar-2 .event.active .event-header .day{ - color: #bf1f1f; -} -.widget-calendar-2 .event.active .event-header .date{ - color: #202427; -} -.widget-calendar-2 .event .event-header .day{ - font-size: 1.4em; -} -.widget-calendar-2 .event .event-header .month{ - font-size: 0.7em; -} -.widget-calendar-2 .event .event-header .date{ - color: #a08a70; -} -.widget-calendar-2 .event-title{ - width: 70%; - display: inline-flex; - flex-direction: column; - justify-content: space-between; -} -.widget-calendar-2 .event-title .duration{ - font-size: 0.7em; - text-align: left; - color: #a0a1a1; -} -.widget-calendar-2 .duration_temp,.widget-calendar-2 .title_temp{ - display: none; -} -.widget-calendar-2 .event-inner-title{ - line-height: 2em; - text-align: left; -} -.widget-calendar-2 .event-containers{ - height: 0; - min-height: unset; - display: flex; - justify-content: center; - align-items: center; - position: relative; - overflow: hidden; - margin: 0 10%; -} -.widget-calendar-2 .event-container-one { - position: absolute; - align-items: center; - justify-content: center; - display: flex; - width: calc(100% - 0.7em);; - height: calc(100% - 0.7em); - flex-wrap: wrap; - border-radius: 10px; - margin-bottom: 1em; - cursor: pointer; - padding: 0; - margin: 0; - color: rgba(50, 50, 50, 0.45); -} -.widget-calendar-2 .event-container-one:hover { - background-color: #fff; - box-shadow: 0 0.1em 0.7em 0em; -} -.widget-calendar-2 .event-container-one .event-content{ - color: #000000; -} -button.switch_button { - margin: 10%; - width: 2.5em; - height: 2.5em; - border-radius: 1.25em; - border: 0; - background: #96231a; - color: white; - outline: 0; -} -.widget-calendar-2 .switch_button:hover { - background: #c07b76; -} -.widget-calendar-2 .switch_button_wraper{ - position: absolute; - right: 0%; - margin-right: 2%; - width: 3em; - margin-bottom: 2%; - bottom: 0; - display: flex; - flex-direction: column; -} -.widget-calendar-2 .event-wraper{ - position: relative; - overflow: hidden; -} -.widget-calendar-2 .event-container-one:not(.active) { - right: -100%; -} -.widget-calendar-2 .event.active .event-containers{ - min-height: 19.2em; - height: auto; -} -.widget-calendar-2 .calendar-events.width-100 .switch_button_wraper{ - width: 100%; - height: 100%; - margin: 0; - flex-direction: row; - justify-content: space-between; - align-items: center; -} -.widget-calendar-2 .calendar-events.width-100 .switch_button{ - margin: 2%; -} -.widget-calendar-2 .calendar-events.width-100 .event-containers{ - z-index: 3; -} -.widget-calendar-2.w-calendar .month_template .widget-title { - border: 0; - border-bottom: 0.0625em solid #ddd; -} -.w-calendar.widget-calendar-2>div:first-child { - box-shadow: 0em 0.1em 0.3em 0em; - margin-bottom: 0.25em; -} diff --git a/app/assets/stylesheets/calendar_widget2.css.scss b/app/assets/stylesheets/calendar_widget2.css.scss new file mode 100644 index 0000000..e5655c0 --- /dev/null +++ b/app/assets/stylesheets/calendar_widget2.css.scss @@ -0,0 +1,234 @@ +.widget-calendar-2.w-calendar{ + .w-calendar-table { + table-layout: fixed; + width: 100%; + } + a.event-container-one{ + color: inherit; + } + .close_box{ + font-weight: bold; + position: relative; + float: right; + padding: 0.5em; + cursor: pointer; + } + .close_box:hover{ + color: red; + } + .event-bullet-event { + width: 100%; + height: 100%; + border-radius: 50%; + } + .event-bullet-event { + width: 2em; + height: 2em; + border-radius: 1em; + } + .event-header{ + width: 100%; + text-align: center; + font-size: 1.7em; + font-weight: bold; + padding: 0.35em 0; + } + .event-info{ + padding-left: 15%; + } + .calendar-events{ + position: relative; + background: #fbfbfb; + } + .month_template{ + position: relative; + } + flex-wrap: wrap; + margin-top: 2em; + margin-bottom: 1em; + .w-calendar-table td:hover { + background-color: #eaeaea; + color: #333; + } + .w-calendar-table td { + background: inherit; + color: inherit; + cursor: pointer; + border: 0; + } + .w-calendar-table td div{ + display: inline-flex; + justify-content: center; + align-items: center; + margin: auto; + padding: 10%; + line-height: 1.2; + } + .w-calendar-table th { + background: unset; + color: unset; + border: 0; + padding: 1.5% 0.5%; + } + .widget-title { + padding: 0.2em; + font-size: 1.5em; + } + table.w-calendar-table td.w-calendar-toggle div, table.w-calendar-table td.w-calendar-toggle div{ + background: #6f0007; + border-radius: 50%; + color: white; + } + .w-calendar-table td.w-calendar-event div{ + border: 1px #6f0007 solid; + border-radius: 50%; + background: #eee; + } + .w-calendar-title{ + background: rgb(146, 8, 17); + color: rgb(255, 255, 255); + padding: 0px 10%; + display: flex; + flex-flow: row-reverse wrap; + line-height: 2em; + justify-content: space-between; + font-size: 1.85em; + width: 100%; + } + .calendar-dialog div.ui-dialog-content { + max-height: 20em !important; + overflow-wrap: break-word; + } + table td.w-calendar-other-month { + color: #999797; + } + .event-header{ + display: flex; + background: #dadada; + cursor: default; + } + .event-header .date{ + width: 30%; + } + .event.active .event-header .day{ + color: #bf1f1f; + } + .event.active .event-header .date{ + color: #202427; + } + .event .event-header .day{ + font-size: 1.4em; + } + .event .event-header .month{ + font-size: 0.7em; + } + .event .event-header .date{ + color: #a08a70; + } + .event-title{ + width: 70%; + display: inline-flex; + flex-direction: column; + justify-content: space-between; + } + .event-title .duration{ + font-size: 0.7em; + text-align: left; + color: #a0a1a1; + } + .duration_temp,.title_temp{ + display: none; + } + .event-inner-title{ + line-height: 2em; + text-align: left; + } + .event-containers{ + height: 0; + min-height: unset; + display: flex; + justify-content: center; + align-items: center; + position: relative; + overflow: hidden; + margin: 0 10%; + } + .event-container-one { + position: absolute; + align-items: center; + justify-content: center; + display: flex; + width: calc(100% - 0.7em);; + height: calc(100% - 0.7em); + flex-wrap: wrap; + border-radius: 10px; + margin-bottom: 1em; + cursor: pointer; + padding: 0; + margin: 0; + color: rgba(50, 50, 50, 0.45); + } + .event-container-one:hover { + background-color: #fff; + box-shadow: 0 0.1em 0.7em 0em; + } + .event-container-one .event-content{ + color: #000000; + } + button.switch_button { + margin: 10%; + width: 2.5em; + height: 2.5em; + border-radius: 1.25em; + border: 0; + background: #96231a; + color: white; + outline: 0; + } + .switch_button:hover { + background: #c07b76; + } + .switch_button_wraper{ + position: absolute; + right: 0%; + margin-right: 2%; + width: 3em; + margin-bottom: 2%; + bottom: 0; + display: flex; + flex-direction: column; + } + .event-wraper{ + position: relative; + overflow: hidden; + } + .event-container-one:not(.active) { + right: -100%; + } + .event.active .event-containers{ + min-height: 19.2em; + height: auto; + } + .calendar-events.width-100 .switch_button_wraper{ + width: 100%; + height: 100%; + margin: 0; + flex-direction: row; + justify-content: space-between; + align-items: center; + } + .calendar-events.width-100 .switch_button{ + margin: 2%; + } + .calendar-events.width-100 .event-containers{ + z-index: 3; + } + .month_template .widget-title { + border: 0; + border-bottom: 0.0625em solid #ddd; + } + &>div:first-child { + box-shadow: 0em 0.1em 0.3em 0em; + margin-bottom: 0.25em; + } +} \ No newline at end of file diff --git a/app/models/event.rb b/app/models/event.rb index 5149306..982bb2f 100644 --- a/app/models/event.rb +++ b/app/models/event.rb @@ -191,7 +191,9 @@ class Event if (year_diff%re.frequency.to_i)==0 sd_tp = sd + year_diff.year ed_tp = ed + year_diff.year - @recurring << data.merge({:start => sd_tp, :end => ed_tp}) + if (start_date..end_date)&(sd_tp..ed_tp) + @recurring << data.merge({:start => sd_tp, :end => ed_tp}) + end end end end @@ -205,7 +207,7 @@ class Event def self.agenda_events(agenda_start, agenda_end) recurring = self.recurring_event(agenda_start,agenda_end) events = self.monthly_event(agenda_start, agenda_end).convert_front - all_events = recurring.concat(events) + recurring = recurring.concat(events) recurring end end \ No newline at end of file