Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add layout #291

Merged
merged 28 commits into from
Aug 10, 2023
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
735069f
Add layout
MarioRodrigues10 Jul 15, 2023
eec29b2
Implement suggestions
MarioRodrigues10 Jul 21, 2023
7ce4cf3
Resolve conflicts
MarioRodrigues10 Jul 21, 2023
b22ab05
Rebase with recent updates
MarioRodrigues10 Aug 1, 2023
ab233a3
Add some updates
MarioRodrigues10 Aug 2, 2023
1d9331d
Add login/register pages
MarioRodrigues10 Aug 4, 2023
40d6902
Add proper documentation
MarioRodrigues10 Aug 5, 2023
c6db5e1
Add organization show page and other stuff
MarioRodrigues10 Aug 5, 2023
d5bfa92
Fix mobile layout
MarioRodrigues10 Aug 5, 2023
5600472
Add department description
MarioRodrigues10 Aug 5, 2023
f944f90
Add session_image and fix associations
MarioRodrigues10 Aug 5, 2023
ef44a9b
Change sidebar based on role
MarioRodrigues10 Aug 5, 2023
6a2136b
Fix scanner and add role verifier
MarioRodrigues10 Aug 5, 2023
2224b08
Add news
MarioRodrigues10 Aug 6, 2023
14ce2fb
Implement suggestions
MarioRodrigues10 Aug 6, 2023
15c282f
Add organization logo
MarioRodrigues10 Aug 6, 2023
68bda5a
Implement suggestions
MarioRodrigues10 Aug 7, 2023
d852cc5
Change organization with live component
MarioRodrigues10 Aug 7, 2023
b4cd1d8
Add partners seeds
MarioRodrigues10 Aug 7, 2023
68a9132
Add collaborators
MarioRodrigues10 Aug 9, 2023
ee6a7ac
Add users settings page
MarioRodrigues10 Aug 9, 2023
f04e40a
Add partners show page
MarioRodrigues10 Aug 9, 2023
4f69414
Add organization index page
MarioRodrigues10 Aug 9, 2023
b804ae5
Add boards
MarioRodrigues10 Aug 9, 2023
9dab7ba
Fix some issues when running without seeds
MarioRodrigues10 Aug 9, 2023
734cf33
Implement suggestions
MarioRodrigues10 Aug 9, 2023
9531d16
Fix some issues
MarioRodrigues10 Aug 10, 2023
6c97f7b
Fix small issue
MarioRodrigues10 Aug 10, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion assets/tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,14 @@ module.exports = {
'../lib/*_web/**/*.*ex',
],
theme: {
extend: {},
extend: {
border: {
'1': '1px'
},
backgroundImage: {
'hero-pattern': "url('/images/atomic.png')",
},
},
},
plugins: [
require('@tailwindcss/forms'),
Expand Down
12 changes: 11 additions & 1 deletion config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,14 @@
import Config

config :atomic,
ecto_repos: [Atomic.Repo]
ecto_repos: [Atomic.Repo],
generators: [binary_id: true],
owner: %{
name: "Atomic",
time_zone: "Europe/Lisbon",
day_start: 0,
day_end: 24
}

# Configures the endpoint
config :atomic, AtomicWeb.Endpoint,
Expand Down Expand Up @@ -67,6 +74,9 @@ config :tailwind,
cd: Path.expand("../assets", __DIR__)
]

config :icons,
collection: [Heroicons, Ionicons]

config :atomic, Atomic.Scheduler,
jobs: [
# Runs every midnight:
Expand Down
104 changes: 98 additions & 6 deletions lib/atomic/accounts.ex
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,36 @@ defmodule Atomic.Accounts do
|> Repo.insert()
end

@doc """
List all users.

## Examples

iex > list_users()
{:ok, [%User{}]}

iex > list_users()
{:error, %Ecto.Changeset{}}

"""
def list_users do
User
|> Repo.all()
end

@doc """
Gets a course by id.

Raises `Ecto.NoResultsError` if the Course does not exist.

## Examples

iex> get_course(123)
%Course{}

iex> get_course(456)
** (Ecto.NoResultsError)
"""
def get_course(id) do
Repo.get(Course, id)
end
Expand Down Expand Up @@ -115,6 +140,35 @@ defmodule Atomic.Accounts do
end
end

@doc """
Return the first and last name of a name.

## Examples

iex> extract_first_last_name("John Doe")
"John Doe"

iex> extract_first_last_name("John")
"John"

iex> extract_first_last_name(nil)
""

"""
def extract_first_last_name(name) do
names =
name
|> String.split(" ")
|> Enum.filter(&String.match?(String.slice(&1, 0, 1), ~r/^\p{L}$/u))
|> Enum.map(&String.capitalize/1)

case length(names) do
0 -> ""
1 -> hd(names)
_ -> List.first(names) <> " " <> List.last(names)
end
end

@doc """
Returns an `%Ecto.Changeset{}` for tracking user changes.

Expand Down Expand Up @@ -388,29 +442,59 @@ defmodule Atomic.Accounts do
end
end

@doc """
Updates the user picture.

## Examples

iex> update_user_picture(user, %{profile_picture: ...})
{:ok, %User{}}

iex> update_user_picture(user, %{profile_picture: ...})
{:error, %Ecto.Changeset{}}

"""
def update_user_picture(%User{} = user, attrs \\ %{}) do
user
|> User.picture_changeset(attrs)
|> Repo.update()
end

@doc """
Updates the user.

## Examples

iex> update_user(user, %{field: value})
{:ok, %User{}}

iex> update_user(user, %{field: bad_value})
{:error, %Ecto.Changeset{}}

"""
def update_user(%User{} = user, attrs \\ %{}) do
user
|> User.changeset(attrs)
|> Repo.update()
end

def change_user(%User{} = user, attrs \\ %{}) do
user
|> User.changeset(attrs)
end
@doc """
Gets a list of courses.

## Examples

iex> list_courses()
{:ok,[%Course{}]}

iex> list_courses()
{:error, %Ecto.Changeset{}}
"""
def list_courses do
Repo.all(Course)
end

@doc """
Creates a course
Creates a course.

## Examples

Expand All @@ -428,7 +512,15 @@ defmodule Atomic.Accounts do
end

@doc """
Gets the user's organizations
Gets an user organizations.

## Examples

iex> get_user_organizations(user)
{:ok,[%Organization{}]}

iex> get_user_organizations(user)
{:error, %Ecto.Changeset{}}
"""
def get_user_organizations(user) do
Repo.all(Ecto.assoc(user, :organizations))
Expand Down
4 changes: 4 additions & 0 deletions lib/atomic/accounts/course.ex
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ defmodule Atomic.Accounts.Course do
timestamps()
end

@doc """
A changeset for a course.

MarioRodrigues10 marked this conversation as resolved.
Show resolved Hide resolved
"""
def changeset(course, attrs) do
course
|> cast(attrs, @required_fields)
Expand Down
3 changes: 3 additions & 0 deletions lib/atomic/accounts/user.ex
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ defmodule Atomic.Accounts.User do
|> cast_attachments(attrs, [:profile_picture])
end

@doc """
A user changeset for updating the user.
"""
def changeset(user, attrs) do
user
|> cast(attrs, @required_fields ++ @optional_fields)
Expand Down
Loading