Skip to content
Merged
17 changes: 11 additions & 6 deletions app/assets/javascripts/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,20 @@ function eventCalendar() {
today: 'Today'
},
eventRender: function (event, element, view) {
var description = event.description ? event.description : '';
var location = event.location ? event.location : '';
element.find('.fc-event-dot').css('display','none');
element.find('.fc-list-item-title').append('<div></div><span style="font-size: 12px">' + description + '</span>');
element.find('.fc-list-item-title').append('<div></div><span style="font-size: 12px">' + location + '</span>');
element.find('.fc-event-dot').css('display', 'none');
if(event.description) {
element.find('.fc-list-item-title').append('<div></div><span style="font-size: 12px">' + event.description + '</span>');
}
if (event.location) {
element.find('.fc-list-item-title').append('<div></div><span style="font-size: 12px"><b>Location: </b>' + event.location + '</span>');
}
if (event.category) {
element.find('.fc-list-item-title').append('<div></div><span style="font-size: 12px"><b>Category: </b>' + event.category + '</span>');
}
},
events: {
url: '/manage/events.json',
success: function(response) {
success: function (response) {
// due to "end" being a keyword in ruby and what fullcalender uses it is stored as finish and than it is
// converted to "end" when sending it to fullcalendar
response = JSON.parse(JSON.stringify(response).split('"finish":').join('"end":'));
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/manage/events_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def destroy

def event_params
params.require(:event).permit(
:title, :description, :location, :public, :start, :finish, owner: []
:title, :description, :location, :category, :start, :finish
)
end
end
1 change: 1 addition & 0 deletions app/views/manage/events/_form.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
= f.input :title
= f.input :description
= f.input :location
= f.input :category
= f.input :start
= f.input :finish, include_blank: true
.center
Expand Down
5 changes: 5 additions & 0 deletions db/migrate/20210128025749_add_category_to_events.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddCategoryToEvents < ActiveRecord::Migration[5.2]
def change
add_column :events, :category, :string
end
end
3 changes: 2 additions & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 2020_12_18_010133) do
ActiveRecord::Schema.define(version: 2021_01_28_025749) do

create_table "active_storage_attachments", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
t.string "name", null: false
Expand Down Expand Up @@ -148,6 +148,7 @@
t.datetime "finish"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "category"
end

create_table "fips", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
Expand Down