Merge branch 'feature/event-slug' into 'master'

Feature/event slug

Closes #102

See merge request framasoft/mobilizon!109
This commit is contained in:
Thomas Citharel 2019-04-11 15:11:27 +02:00
commit 36069ee085
6 changed files with 16 additions and 2 deletions

View File

@ -18,6 +18,7 @@ export const FETCH_EVENT = gql`
url, url,
local, local,
title, title,
slug,
description, description,
beginsOn, beginsOn,
endsOn, endsOn,

View File

@ -49,6 +49,7 @@ export interface IEvent {
local: boolean; local: boolean;
title: string; title: string;
slug: string;
description: string; description: string;
category: Category; category: Category;
@ -77,6 +78,7 @@ export interface IEvent {
export class EventModel implements IEvent { export class EventModel implements IEvent {
beginsOn: Date = new Date(); beginsOn: Date = new Date();
category: Category = Category.MEETING; category: Category = Category.MEETING;
slug: string = '';
description: string = ''; description: string = '';
endsOn: Date = new Date(); endsOn: Date = new Date();
joinOptions: EventJoinOptions = EventJoinOptions.FREE; joinOptions: EventJoinOptions = EventJoinOptions.FREE;

View File

@ -46,8 +46,7 @@
</a> </a>
</div> </div>
<p class="slug"> <p class="slug">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. {{ event.slug }}
In aliquam libero quam, ut ultricies velit porttitor a. Maecenas mollis vestibulum dolor.
</p> </p>
</div> </div>
<div class="column sidebar"> <div class="column sidebar">

View File

@ -41,6 +41,7 @@ defmodule Mobilizon.Events.Event do
field(:url, :string) field(:url, :string)
field(:local, :boolean, default: true) field(:local, :boolean, default: true)
field(:begins_on, :utc_datetime) field(:begins_on, :utc_datetime)
field(:slug, :string)
field(:description, :string) field(:description, :string)
field(:ends_on, :utc_datetime) field(:ends_on, :utc_datetime)
field(:title, :string) field(:title, :string)
@ -70,6 +71,7 @@ defmodule Mobilizon.Events.Event do
event event
|> Ecto.Changeset.cast(attrs, [ |> Ecto.Changeset.cast(attrs, [
:title, :title,
:slug,
:description, :description,
:url, :url,
:begins_on, :begins_on,

View File

@ -17,6 +17,7 @@ defmodule MobilizonWeb.Schema.EventType do
field(:url, :string, description: "The ActivityPub Event URL") field(:url, :string, description: "The ActivityPub Event URL")
field(:local, :boolean, description: "Whether the event is local or not") field(:local, :boolean, description: "Whether the event is local or not")
field(:title, :string, description: "The event's title") 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(:description, :string, description: "The event's description")
field(:begins_on, :datetime, description: "Datetime for when the event begins") field(:begins_on, :datetime, description: "Datetime for when the event begins")
field(:ends_on, :datetime, description: "Datetime for when the event ends") field(:ends_on, :datetime, description: "Datetime for when the event ends")

View File

@ -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