Skip to content

Commit

Permalink
simple calendar setup
Browse files Browse the repository at this point in the history
  • Loading branch information
DaanVanVugt committed Aug 1, 2023
1 parent e5d940e commit 99c7e69
Show file tree
Hide file tree
Showing 8 changed files with 69 additions and 1 deletion.
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ gem 'friendly_id', '~> 5.2.4'
# gem 'sunspot_rails', '~> 2.5.0'
gem 'sunspot_rails', github: 'sunspot/sunspot', branch: 'master'

# https://github.com/excid3/simple_calendar
gem 'simple_calendar', '~> 2.4'

gem 'progress_bar', '~> 1.1.0'

gem 'activerecord-session_store'
Expand Down
3 changes: 3 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -662,6 +662,8 @@ GEM
sidekiq-status (3.0.2)
chronic_duration
sidekiq (>= 6.0, < 8)
simple_calendar (2.4.3)
rails (>= 3.0)
simple_form (5.1.0)
actionpack (>= 5.2)
activemodel (>= 5.2)
Expand Down Expand Up @@ -848,6 +850,7 @@ DEPENDENCIES
sdoc (>= 1.1.0)
sidekiq (< 8)
sidekiq-status (~> 3.0.2)
simple_calendar (~> 2.4)
simple_form
simple_token_authentication (~> 1.0)
simplecov
Expand Down
1 change: 1 addition & 0 deletions app/assets/stylesheets/application.scss
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
@import "jquery.qtip.min";
@import "select2";
@import "select2-bootstrap-theme";
@import "simple_calendar";

// Sticky but not fixed footer
// http://cbracco.me/css-sticky-footer-effect/
Expand Down
45 changes: 45 additions & 0 deletions app/views/events/_compact_event.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<li class="masonry-brick media-item long">
<%= link_to event, class: 'link-overlay with-right-icon' do %>
<div class="left-container">
<div class="masonry-brick-heading">
<div class="masonry-icons">
<% if current_user&.is_admin? %>
<%= missing_icon(event) %>
<%= scrape_status_icon(event) %>
<%= suggestion_icon(event) %>
<% end %>
<%= event_status_icon(event) %>
</div>
<% if event.event_types.any? %>
<% event.event_types.each do |t| %>
<div class="sub-heading"><%= EventTypeDictionary.instance.lookup_value(t, 'title') %></div>
<% end %>
<% end %>
<h4>
<%= event.title %>
</h4>
</div>

<% if event.has_node? -%>
<%= elixir_node_icon %>
<% end -%>

<p><%= l event.start, format: :time_short %> - <%= l event.end, format: :time_short %></p>

<% if event.online? %>
<p class="visible-xs-block">
<i class="icon icon-md virtual-event-icon"></i> <span class="muted">Online</span>
</p>
<% else %>
<% location = [event.city, event.country].reject { |field_value| field_value.blank? }.join(", ") %>
<% if location.present? %>
<p class="dont-break-out"><i class="fa fa-map-marker"></i> <%= location %></p>
<% end %>
<p class="visible-xs-block">
<i class="icon icon-md onsite-event-icon"></i> <span class="muted">Face-to-face</span>
</p>
<% end %>
</div>
<% end %>
</li>
5 changes: 5 additions & 0 deletions app/views/events/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<% content_for :display_options do %>
<ul class="nav nav-xs nav-pills index-display-options">
<%= tab('List', 'fa fa-list', 'home', active: true) %>
<%= tab('Calendar', 'fa fa-calendar', 'calendar') %>
<% if !TeSS::Config.feature['disabled'].include? 'events_map' %>
<%= tab('Map', 'fa fa-globe', 'map',
disabled: { check: (search_and_facet_params[:online] == 'true'),
Expand All @@ -42,6 +43,10 @@
<%= render partial: "search/common/pagination_bar", locals: { resources: @events } %>
</div>

<div id="calendar" class="tab-pane fade in">
<%= render partial: 'events/partials/simple_calendar', locals: { events: @events } %>
</div>

<% unless TeSS::Config.feature['disabled'].include?('events_map') %>
<div id="map" class="tab-pane fade">
<div id="map-count" class="search-results-count"></div>
Expand Down
7 changes: 7 additions & 0 deletions app/views/events/partials/_simple_calendar.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<%= month_calendar(events: events, attribute: :start, end_attribute: :end) do |date, events| %>
<%= date.day %>
<% events.each do |event| %>
<%= link_to "#{event.title} #{l event.start, format: :time_short} - #{l event.end, format: :time_short}", event, class: 'clear-both' %>
<% end %>
<% end %>
3 changes: 3 additions & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -547,3 +547,6 @@ en:
footer:
eu_funding: >
TeSS has received funding from the European Union’s Horizon 2020 research and innovation programme under grant agreement No. <a href="https://cordis.europa.eu/project/rcn/198519_en.html", target="_blank">676559</a>.
time:
formats:
time_short: "%H:%M"
3 changes: 2 additions & 1 deletion docs/docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ Create TeSS configuration files:

### Install gems and set up the database (migrations + seed data + create admin user)

docker-compose run app bundle install && bundle exec rake db:setup
docker-compose run app bundle install
docker-compose run app bundle exec rake db:setup

### Start services

Expand Down

0 comments on commit 99c7e69

Please sign in to comment.