Skip to content

Commit

Permalink
Merge branch 'project-page-header' of https://github.com/hasgeek/funnel
Browse files Browse the repository at this point in the history
… into project-page-header
  • Loading branch information
vidya-ram committed May 31, 2024
2 parents caf711f + 4ca4b0d commit 01e01fd
Show file tree
Hide file tree
Showing 30 changed files with 139 additions and 85 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ repos:
- id: pyupgrade
args: ['--keep-runtime-typing', '--py311-plus']
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.4.5
rev: v0.4.6
hooks:
- id: ruff
args: ['--fix', '--exit-non-zero-on-fix']
Expand Down
3 changes: 2 additions & 1 deletion funnel/assets/js/schedule_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,8 @@ const Schedule = {
this.config.slotInterval
);
if (this.config.schedule[session.eventDay]) {
this.config.schedule[session.eventDay].sessions[session.startTime].showLabel = true;
this.config.schedule[session.eventDay].sessions[session.startTime].showLabel =
true;
this.config.schedule[session.eventDay].sessions[session.startTime].rooms[
session.room_scoped_name
].talk = session;
Expand Down
7 changes: 7 additions & 0 deletions funnel/assets/sass/components/_button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,13 @@
border: 1px solid $mui-text-danger;
}

.mui-btn__icon {
display: flex;
flex-direction: row;
gap: $mui-grid-padding/2;
align-items: center;
}

.mui-btn--accent.mui--is-disabled,
.mui-btn--accent.mui--is-disabled:hover,
.mui-btn--accent.mui--is-disabled:active,
Expand Down
2 changes: 2 additions & 0 deletions funnel/assets/sass/components/_card.scss
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@

.mui-btn + .mui-btn {
margin-left: 0;
padding: 2px 10px;
border-radius: 4px;
}
}

Expand Down
5 changes: 5 additions & 0 deletions funnel/assets/sass/pages/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@
.spotlight-container__details {
margin-top: 40px;
}
.mui-btn + .mui-btn {
margin-left: 0;
padding: 2px 10px;
border-radius: 4px;
}
}
}

Expand Down
14 changes: 14 additions & 0 deletions funnel/assets/sass/pages/project.scss
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,14 @@
}
}

.follow-form {
.mui-btn--accent {
margin-left: 0;
padding: 2px 10px;
border-radius: 4px;
}
}

@media (min-width: 768px) {
.project-header {
position: relative;
Expand Down Expand Up @@ -299,6 +307,12 @@
.project-banner__profile-details__badge {
margin-left: auto;
}
.mui-btn + .mui-btn,
.mui-btn--accent {
margin-left: 0;
padding: 2px 10px;
border-radius: 4px;
}
}

.project-banner__profile-details--center {
Expand Down
4 changes: 3 additions & 1 deletion funnel/devtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
from .typing import ReturnView

if TYPE_CHECKING:
from multiprocessing.process import BaseProcess

from _typeshed.wsgi import StartResponse, WSGIEnvironment

__all__ = ['AppByHostWsgi', 'BackgroundWorker', 'devtest_app']
Expand Down Expand Up @@ -338,7 +340,7 @@ def __init__(
self.timeout = timeout
self.clean_stop = clean_stop
self.daemon = daemon
self._process: multiprocessing.process.BaseProcess | None = None
self._process: BaseProcess | None = None
self.mock_transports = mock_transports

manager = mpcontext.Manager()
Expand Down
2 changes: 1 addition & 1 deletion funnel/forms/auth_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class AuthClientForm(forms.Form):

title = forms.StringField(
__("Application title"),
validators=[forms.validators.DataRequired()],
validators=[forms.validators.DataRequired(), forms.validators.Length(max=250)],
filters=[forms.filters.strip()],
description=__("The name of your application"),
)
Expand Down
5 changes: 4 additions & 1 deletion funnel/forms/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ class ProjectForm(forms.Form):

title = forms.StringField(
__("Title"),
validators=[forms.validators.DataRequired()],
validators=[
forms.validators.DataRequired(),
forms.validators.Length(max=Project.__title_length__),
],
filters=[forms.filters.strip()],
)
tagline = forms.StringField(
Expand Down
5 changes: 4 additions & 1 deletion funnel/forms/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ class SessionForm(forms.Form):

title = forms.StringField(
__("Title"),
validators=[forms.validators.DataRequired()],
validators=[
forms.validators.DataRequired(),
forms.validators.Length(max=Session.__title_length__),
],
filters=[forms.filters.strip()],
)
venue_room_id = forms.SelectField(
Expand Down
5 changes: 4 additions & 1 deletion funnel/forms/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ class UpdateForm(forms.Form):

title = forms.StringField(
__("Title"),
validators=[forms.validators.DataRequired()],
validators=[
forms.validators.DataRequired(),
forms.validators.Length(max=Update.__title_length__),
],
filters=[forms.filters.strip()],
)
body = forms.MarkdownField(
Expand Down
10 changes: 8 additions & 2 deletions funnel/forms/venue.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ class VenueForm(forms.Form):
title = forms.StringField(
__("Name"),
description=__("Name of the venue"),
validators=[forms.validators.DataRequired(), forms.validators.Length(max=250)],
validators=[
forms.validators.DataRequired(),
forms.validators.Length(max=Venue.__title_length__),
],
filters=[forms.filters.strip()],
)
description = forms.MarkdownField(
Expand Down Expand Up @@ -88,7 +91,10 @@ class VenueRoomForm(forms.Form):
title = forms.StringField(
__("Name"),
description=__("Name of the room"),
validators=[forms.validators.DataRequired(), forms.validators.Length(max=250)],
validators=[
forms.validators.DataRequired(),
forms.validators.Length(max=VenueRoom.__title_length__),
],
filters=[forms.filters.strip()],
)
description = forms.MarkdownField(
Expand Down
2 changes: 1 addition & 1 deletion funnel/templates/index.html.jinja2
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% extends "profile_layout.html.jinja2" %}
{% block title %}{{ config['SITE_TITLE'] }}{% endblock title %}
{%- from "macros.html.jinja2" import faicon, calendarwidget, saveprojectform, profilecard %}
{%- from "macros.html.jinja2" import faicon, calendarwidget, profilecard %}

{%- block pageheaders %}
<link rel="stylesheet" type="text/css" href="{{ webpack('css/index.css') }}" />
Expand Down
11 changes: 3 additions & 8 deletions funnel/templates/macros.html.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -144,17 +144,13 @@
</div>
{% endmacro %}

{% macro projectcard(project, include_calendar=true, calendarwidget_compact=true, include_profile=true, include_details=true, save_form_id_prefix='spf_', add_bookmark=true, snippet_html=none) %}
{% macro projectcard(project, include_calendar=true, calendarwidget_compact=true, include_profile=true, include_details=true, snippet_html=none) %}
<a class="card card--upcoming clickable-card" href="{{ project.url_for() }}" aria-label="{{ project.title }}" data-cy-title="{{ project.title }}" data-ga="View project">
{%- if include_profile %}
<div class="flex-wrapper flex-wrapper--center flex-wrapper--space-between margin-top margin-bottom margin-right margin-left">
<div class="flex-wrapper flex-wrapper--center flex-wrapper-full-width">
{{ profileavatar(project.account, add_profile_link=false, css_class='flex-item-align-end margin-right') }}
{{ profileavatar(project.account, add_profile_link=false, css_class='flex-item-align-end') }}
</div>
{%- if not current_auth.is_anonymous and add_bookmark %}
{% set save_form_id = save_form_id_prefix + project.uuid_b58 %}
<div class="card__body__bookmark card__body__bookmark--pushup">{{ saveprojectform(project, formid=save_form_id) }}</div>
{% endif %}
</div>
{% endif %}
<div class="card__image-wrapper {% if not project.bg_image.url %}card__image-wrapper--default{% endif %}">
Expand Down Expand Up @@ -184,8 +180,7 @@
<h3 class="card__body__title mui--text-subhead {% if not project.start_at %} card__body__subtitle {% endif %}"><span class="text-bold">{{ project.title_inline }}</span> <span class="mui--text-light js-truncate" data-truncate-lines="2">{{ project.tagline }}</span></h3>
{% endif %}
{% elif include_details %}
<h3 class="card__body__subtitle mui--text-subhead text-bold">{{ project.title }}</h3>
<p class="mui--text-caption mui--text-light js-truncate" data-truncate-lines="2">{{ project.tagline }}</p>
<h3 class="card__body__title mui--text-subhead {% if not project.start_at %} card__body__subtitle {% endif %}"><span class="text-bold">{{ project.title_inline }}</span> <span class="mui--text-light js-truncate" data-truncate-lines="2">{{ project.tagline }}</span></h3>
{% if project.cfp_state.OPEN and project.cfp_end_at_localized %}
<hr class="separator" />
<p class="mui--text-caption zero-bottom-margin secondary-color-txt">{% trans date=project.cfp_end_at_localized|datetime(format='dd MMM YYYY, hh:mm a') %}Accepting submissions till {{ date }}{% endtrans %}</p>
Expand Down
17 changes: 5 additions & 12 deletions funnel/templates/profile.html.jinja2
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% extends "profile_layout.html.jinja2" %}
{%- from "macros.html.jinja2" import faicon, calendarwidget, saveprojectform, useravatar, proposal_card %}
{%- from "macros.html.jinja2" import faicon, calendarwidget, useravatar, proposal_card %}

{%- block pageheaders %}
<link rel="stylesheet" type="text/css" href="{{ webpack('css/index.css') }}" />
Expand Down Expand Up @@ -101,14 +101,7 @@
<a class="card card--upcoming card--new clickable-card" href="{{ profile.url_for('new_project') }}" aria-label="{% trans %}Create a new project{% endtrans %}" data-cy="new-project" data-ga="Add new project">
<div class="flex-wrapper flex-wrapper--center flex-wrapper--space-between margin-top margin-bottom margin-right margin-left">
<div class="flex-wrapper flex-wrapper--center">
<span class="profile-avatar margin-right">
{%- if profile.logo_url.url %}
<img src="{{ profile.logo_url.resize(img_size.profile_logo_small) }}" alt="{{ profile.title }}"/>
{% else %}
<img src="{{ url_for('static', filename='img/default-profile-logo.png') }}" alt="{{ profile.title }}"/>
{% endif %}
</span>
<span class="profile-avatar-title mui--text-body2 text-bold mui--text-dark">{{ profile.title }}</span>
{{ profileavatar(profile, add_profile_link=false, css_class='flex-item-align-end margin-right') }}
</div>
</div>
<div class="card__image-wrapper">
Expand All @@ -128,7 +121,7 @@
{% endif %}
{% for project in draft_projects %}
<li class="grid__col-12 grid__col-xs-12 grid__col-sm-6 grid__col-lg-4 js-draft-projects {% if loop.index > 2 %}mui--hide{% endif %}" role="listitem">
{{ projectcard(project, include_calendar=false, save_form_id_prefix='draft_spf_') }}
{{ projectcard(project, include_calendar=false) }}
</li>
{%- endfor -%}
</ul>
Expand All @@ -152,7 +145,7 @@
<ul class="grid projects" role="list">
{% for project in unscheduled_projects %}
<li class="grid__col-12 grid__col-xs-12 grid__col-sm-6 grid__col-lg-4 js-unscheduled-projects {% if loop.index > 3 %}mui--hide{% endif %}" role="listitem">
{{ projectcard(project, save_form_id_prefix='unsched_spf_') }}
{{ projectcard(project) }}
</li>
{% endfor %}
</ul>
Expand Down Expand Up @@ -189,7 +182,7 @@
<ul class="grid projects" role="list">
{% for project in sponsored_projects %}
<li class="grid__col-12 grid__col-xs-12 grid__col-sm-6 grid__col-lg-4 js-supported-projects {% if loop.index > 6 %}mui--hide{% endif %}" role="listitem">
{{ projectcard(project, save_form_id_prefix='support_pro_') }}
{{ projectcard(project) }}
</li>
{% endfor %}
</ul>
Expand Down
2 changes: 1 addition & 1 deletion funnel/templates/profile_calendar.html.jinja2
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% extends "profile_layout.html.jinja2" %}
{%- from "macros.html.jinja2" import faicon, calendarwidget, saveprojectform, useravatar, proposal_card %}
{%- from "macros.html.jinja2" import faicon, calendarwidget, useravatar, proposal_card %}

{%- block pageheaders %}
<link rel="stylesheet" type="text/css" href="{{ webpack('css/index.css') }}" />
Expand Down
20 changes: 6 additions & 14 deletions funnel/templates/profile_layout.html.jinja2
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% extends "layout.html.jinja2" %}
{%- from "macros.html.jinja2" import faicon, img_size, saveprojectform, calendarwidget, projectcard, video_thumbnail, profileavatar %}
{%- from "macros.html.jinja2" import faicon, img_size, calendarwidget, projectcard, video_thumbnail, profileavatar %}
{%- from "js/schedule.js.jinja2" import schedule_template %}
{% block title %}{{ profile.title }}{% endblock title %}

Expand Down Expand Up @@ -77,10 +77,6 @@
<div class="flex-wrapper flex-wrapper--center">
{{ profileavatar(featured_project.account, css_class='margin-left') }}
</div>
{%- if not current_auth.is_anonymous %}
{% set save_form_id = "spotlight_spfm_desktop_" + featured_project.uuid_b58 %}
<div>{{ saveprojectform(featured_project, formid=save_form_id) }}</div>
{% endif %}
</div>
<h3 class="mui--text-headline text-bold" data-cy="spotlight-project"><a href="{{ featured_project.url_for() }}" class="mui--text-dark nounderline">{{ featured_project.title }}</a></h3>
<p class="mui--text-subhead mui--text-light js-truncate" data-truncate-lines="2">{{ featured_project.tagline }}</p>
Expand All @@ -102,10 +98,6 @@
</span>
<span class="profile-avatar-title mui--text-body2 text-bold mui--text-dark">{{ featured_project.account.title }}</span>
</div>
{%- if not current_auth.is_anonymous %}
{% set save_form_id = "spotlight_spfm_mobile_" + featured_project.uuid_b58 %}
<div class="card__body__bookmark card__body__bookmark--pushup">{{ saveprojectform(featured_project, formid=save_form_id) }}</div>
{% endif %}
</div>
<div class="card__image-wrapper {% if not featured_project.bg_image.url %}card__image-wrapper--default{% endif %}">
<a href="{{ featured_project.url_for() }}" data-cy-title="{{ featured_project.title }}" data-ga="View featured project">
Expand Down Expand Up @@ -173,7 +165,7 @@
<ul class="mui-list--unstyled grid upcoming" role="list">
{% for project in upcoming_projects %}
<li class="grid__col-xs-12 grid__col-sm-6 grid__col-md-4" role="listitem">
{{ projectcard(project, save_form_id_prefix='upcoming_spf_') }}
{{ projectcard(project) }}
</li>
{%- endfor -%}
</ul>
Expand All @@ -197,7 +189,7 @@
{% for project in open_cfp_projects %}
<li class="grid__col-xs-12 grid__col-sm-6 grid__col-md-4 js-cfp-projects {% if loop.index > 3 %}mui--hide{% endif %}"
role="listitem">
{{ projectcard(project, include_calendar=false, save_form_id_prefix='open_spf_') }}
{{ projectcard(project, include_calendar=false) }}
</li>
{%- endfor -%}
</ul>
Expand Down Expand Up @@ -381,13 +373,13 @@
{% endif %}
<form id="follow-form-{{ profile.uuid_b58 }}" action="{{ profile.url_for('follow') }}" class="follow-form js-follow-form {% if css_class %}{{ css_class }}{% endif %}" data-account-id="{{ profile.uuid_b58 }}" method="post">
{%- if current_auth.is_anonymous %}
<a class="mui-btn mui-btn--dark mui-btn--raised" href="{{ url_for('login', next=request.path) }}" data-ga="Login to follow account" aria-label="{% trans %}Login to follow this account{% endtrans %}">{% trans %}Follow{% endtrans %}</a>
<a class="mui-btn mui-btn--dark mui-btn__icon mui-btn--raised" href="{{ url_for('login', next=request.path) }}" data-ga="Login to follow account" aria-label="{% trans %}Login to follow this account{% endtrans %}">{% trans %}Follow{% endtrans %}</a>
{%- elif profile != current_auth.user and not profile.features.is_private() %}
<input type="hidden" name="follow" value=""/>
{% if not hide_unfollow %}
<button type="submit" value="false" class="mui-btn mui-btn--danger zero-bottom-margin zero-top-margin {% if buttonclass %}{{ buttonclass }}{% endif %} js-unfollow-btn {% if not profile.current_roles.follower %}mui--hide{%- endif %}" href="{{ profile.url_for('follow') }}" onclick="this.form.follow.value=this.value">{{ faicon(icon='user-xmark', icon_size='caption') }} {% trans %}Unfollow{% endtrans %}</button>
<button type="submit" value="false" class="mui-btn mui-btn--danger mui-btn__icon zero-bottom-margin zero-top-margin {% if buttonclass %}{{ buttonclass }}{% endif %} js-unfollow-btn {% if not profile.current_roles.follower %}mui--hide{%- endif %}" href="{{ profile.url_for('follow') }}" onclick="this.form.follow.value=this.value">{{ faicon(icon='user-xmark', icon_size='subhead', baseline=false, css_class='icon_left') }} {% trans %}Unfollow{% endtrans %}</button>
{% endif %}
<button type="submit" value="true" class="mui-btn mui-btn--primary mui-btn--raised zero-bottom-margin zero-top-margin {% if buttonclass %}{{ buttonclass }}{% endif %} zero-left-margin js-follow-btn {% if profile.current_roles.follower %}mui--hide{%- endif %}" href="{{ profile.url_for('follow') }}" onclick="this.form.follow.value=this.value">{{ faicon(icon='user-plus', icon_size='caption') }} {% trans %}Follow{% endtrans %}</button>
<button type="submit" value="true" class="mui-btn mui-btn--primary mui-btn--raised mui-btn__icon zero-bottom-margin zero-top-margin {% if buttonclass %}{{ buttonclass }}{% endif %} zero-left-margin js-follow-btn {% if profile.current_roles.follower %}mui--hide{%- endif %}" href="{{ profile.url_for('follow') }}" onclick="this.form.follow.value=this.value">{{ faicon(icon='user-plus', icon_size='subhead', baseline=false, css_class='icon-left') }} {% trans %}Follow{% endtrans %}</button>
{%- endif %}
</form>
</div>
Expand Down
2 changes: 1 addition & 1 deletion funnel/templates/project.html.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
</li>
</ul>
{%- endif %}{%- endwith %}
{% if project.view_for('edit').is_available() and project.state.DRAFT %}
{% if project.state.DRAFT and project.view_for('settings').is_available() %}
<div class="page-card page-card--nooverflow">
<div class="alert alert--warning zero-top-margin zero-bottom-margin">
<a href="{{ project.url_for('settings') }}" class="alert__text nounderline">{% trans %}This project is not published. Visit settings to publish{% endtrans %} {{ faicon(icon='arrow-right') }}</a>
Expand Down
Loading

0 comments on commit 01e01fd

Please sign in to comment.