From c64d4924d1fe3923ae3e4949bbce71ebd34ca2e5 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Thu, 11 Apr 2019 14:45:31 +0200 Subject: [PATCH 1/2] Add description slug field for events Signed-off-by: Thomas Citharel --- lib/mobilizon/events/event.ex | 2 ++ lib/mobilizon_web/schema/event.ex | 1 + .../20190411124138_event-add-description-slug.exs | 9 +++++++++ 3 files changed, 12 insertions(+) create mode 100644 priv/repo/migrations/20190411124138_event-add-description-slug.exs diff --git a/lib/mobilizon/events/event.ex b/lib/mobilizon/events/event.ex index 05fbfe3a8..b926b6e0a 100644 --- a/lib/mobilizon/events/event.ex +++ b/lib/mobilizon/events/event.ex @@ -41,6 +41,7 @@ defmodule Mobilizon.Events.Event do field(:url, :string) field(:local, :boolean, default: true) field(:begins_on, :utc_datetime) + field(:slug, :string) field(:description, :string) field(:ends_on, :utc_datetime) field(:title, :string) @@ -70,6 +71,7 @@ defmodule Mobilizon.Events.Event do event |> Ecto.Changeset.cast(attrs, [ :title, + :slug, :description, :url, :begins_on, diff --git a/lib/mobilizon_web/schema/event.ex b/lib/mobilizon_web/schema/event.ex index bcddfd98c..c4bcb1c6c 100644 --- a/lib/mobilizon_web/schema/event.ex +++ b/lib/mobilizon_web/schema/event.ex @@ -17,6 +17,7 @@ defmodule MobilizonWeb.Schema.EventType do field(:url, :string, description: "The ActivityPub Event URL") field(:local, :boolean, description: "Whether the event is local or not") field(:title, :string, description: "The event's title") + field(:slug, :string, description: "The event's description's slug") field(:description, :string, description: "The event's description") field(:begins_on, :datetime, description: "Datetime for when the event begins") field(:ends_on, :datetime, description: "Datetime for when the event ends") diff --git a/priv/repo/migrations/20190411124138_event-add-description-slug.exs b/priv/repo/migrations/20190411124138_event-add-description-slug.exs new file mode 100644 index 000000000..39160225e --- /dev/null +++ b/priv/repo/migrations/20190411124138_event-add-description-slug.exs @@ -0,0 +1,9 @@ +defmodule Elixir.Mobilizon.Repo.Migrations.EventAddDescriptionSlug do + use Ecto.Migration + + def change do + alter table(:events) do + add(:slug, :string) + end + end +end From fb145d10330fcfa3a3a85444820460236b47d385 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Thu, 11 Apr 2019 14:57:13 +0200 Subject: [PATCH 2/2] Show slug in the interface Signed-off-by: Thomas Citharel --- js/src/graphql/event.ts | 1 + js/src/types/event.model.ts | 2 ++ js/src/views/Event/Event.vue | 3 +-- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/js/src/graphql/event.ts b/js/src/graphql/event.ts index 2ce2de7c4..d4c5dafbe 100644 --- a/js/src/graphql/event.ts +++ b/js/src/graphql/event.ts @@ -18,6 +18,7 @@ export const FETCH_EVENT = gql` url, local, title, + slug, description, beginsOn, endsOn, diff --git a/js/src/types/event.model.ts b/js/src/types/event.model.ts index 44e2f589a..25289c0b3 100644 --- a/js/src/types/event.model.ts +++ b/js/src/types/event.model.ts @@ -49,6 +49,7 @@ export interface IEvent { local: boolean; title: string; + slug: string; description: string; category: Category; @@ -77,6 +78,7 @@ export interface IEvent { export class EventModel implements IEvent { beginsOn: Date = new Date(); category: Category = Category.MEETING; + slug: string = ''; description: string = ''; endsOn: Date = new Date(); joinOptions: EventJoinOptions = EventJoinOptions.FREE; diff --git a/js/src/views/Event/Event.vue b/js/src/views/Event/Event.vue index 846b4e634..fb8d77685 100644 --- a/js/src/views/Event/Event.vue +++ b/js/src/views/Event/Event.vue @@ -46,8 +46,7 @@

- Lorem ipsum dolor sit amet, consectetur adipiscing elit. - In aliquam libero quam, ut ultricies velit porttitor a. Maecenas mollis vestibulum dolor. + {{ event.slug }}