color SCSS update social area+ decorator fix

This commit is contained in:
Inga Kirschnick 2023-03-02 15:08:50 +01:00
parent b364480de6
commit 8a55ce902e
6 changed files with 37 additions and 22 deletions

View File

@ -1,8 +1,9 @@
from flask import abort, current_app from flask import abort
from flask_login import current_user from flask_login import current_user
from functools import wraps from functools import wraps
from app.models import Corpus, CorpusFollowerAssociation from app.models import Corpus, CorpusFollowerAssociation
def corpus_follower_permission_required(*permissions): def corpus_follower_permission_required(*permissions):
def decorator(f): def decorator(f):
@wraps(f) @wraps(f)
@ -20,15 +21,14 @@ def corpus_follower_permission_required(*permissions):
return decorated_function return decorated_function
return decorator return decorator
def corpus_owner_or_admin_required():
def decorator(f): def corpus_owner_or_admin_required(f):
@wraps(f) @wraps(f)
def decorated_function(*args, **kwargs): def decorated_function(*args, **kwargs):
corpus_id = kwargs.get('corpus_id') corpus_id = kwargs.get('corpus_id')
corpus = Corpus.query.get_or_404(corpus_id) corpus = Corpus.query.get_or_404(corpus_id)
if current_user == corpus.user or current_user.is_administrator(): if current_user == corpus.user or current_user.is_administrator():
return f(*args, **kwargs) return f(*args, **kwargs)
abort(403) abort(403)
return decorated_function return decorated_function
return decorator

View File

@ -43,7 +43,7 @@ def fake_add():
@bp.route('/<hashid:corpus_id>/is_public', methods=['POST']) @bp.route('/<hashid:corpus_id>/is_public', methods=['POST'])
@login_required @login_required
@corpus_owner_or_admin_required() @corpus_owner_or_admin_required
def update_corpus_is_public(corpus_id): def update_corpus_is_public(corpus_id):
is_public = request.json is_public = request.json
if not isinstance(is_public, bool): if not isinstance(is_public, bool):
@ -58,7 +58,7 @@ def update_corpus_is_public(corpus_id):
@bp.route('/<hashid:corpus_id>/followers/add', methods=['POST']) @bp.route('/<hashid:corpus_id>/followers/add', methods=['POST'])
@login_required @login_required
@corpus_owner_or_admin_required() @corpus_owner_or_admin_required
def add_corpus_followers(corpus_id): def add_corpus_followers(corpus_id):
usernames = request.json usernames = request.json
if not (isinstance(usernames, list) or all(isinstance(u, str) for u in usernames)): if not (isinstance(usernames, list) or all(isinstance(u, str) for u in usernames)):
@ -207,7 +207,7 @@ def generate_corpus_share_link(corpus_id):
@bp.route('/<hashid:corpus_id>', methods=['DELETE']) @bp.route('/<hashid:corpus_id>', methods=['DELETE'])
@login_required @login_required
@corpus_owner_or_admin_required() @corpus_owner_or_admin_required
def delete_corpus(corpus_id): def delete_corpus(corpus_id):
def _delete_corpus(app, corpus_id): def _delete_corpus(app, corpus_id):
with app.app_context(): with app.app_context():
@ -238,7 +238,7 @@ def analyse_corpus(corpus_id):
@bp.route('/<hashid:corpus_id>/build', methods=['POST']) @bp.route('/<hashid:corpus_id>/build', methods=['POST'])
@login_required @login_required
@corpus_owner_or_admin_required() @corpus_owner_or_admin_required
def build_corpus(corpus_id): def build_corpus(corpus_id):
def _build_corpus(app, corpus_id): def _build_corpus(app, corpus_id):
with app.app_context(): with app.app_context():

View File

@ -22,6 +22,11 @@ $color: (
"surface": #ffffff, "surface": #ffffff,
"error": #b00020 "error": #b00020
), ),
"social-area": (
"base": #d6ae86,
"darken": #C98536,
"lighten": #EAE2DB
),
"service": ( "service": (
"corpus-analysis": ( "corpus-analysis": (
"base": #aa9cc9, "base": #aa9cc9,
@ -108,6 +113,16 @@ $color: (
} }
} }
@each $key, $color-code in map-get($color, "social-area") {
.social-area-color-#{$key} {
background-color: $color-code !important;
}
.social-area-color-border-#{$key} {
border-color: $color-code !important;
}
}
@each $service-name, $color-palette in map-get($color, "service") { @each $service-name, $color-palette in map-get($color, "service") {
.service-color[data-service="#{$service-name}"] { .service-color[data-service="#{$service-name}"] {
background-color: map-get($color-palette, "base") !important; background-color: map-get($color-palette, "base") !important;

View File

@ -20,7 +20,7 @@ class UserList extends ResourceList {
<td><span class="organization"></span></td> <td><span class="organization"></span></td>
<td><span class="corpora-online"></span></td> <td><span class="corpora-online"></span></td>
<td class="right-align"> <td class="right-align">
<a class="list-action-trigger btn-floating waves-effect waves-light" data-list-action="view" style="background-color:#D9A36D"><i class="material-icons">send</i></a> <a class="list-action-trigger btn-floating waves-effect waves-light social-area-color-darken" data-list-action="view"><i class="material-icons">send</i></a>
</td> </td>
</tr> </tr>
`.trim(); `.trim();

View File

@ -1,6 +1,6 @@
<ul class="sidenav sidenav-fixed" id="sidenav"> <ul class="sidenav sidenav-fixed" id="sidenav">
<li> <li>
<div class="user-view" style="padding-top: 8px;"> <div class="user-view" style="padding-top: 3px;">
<div class="background primary-color"></div> <div class="background primary-color"></div>
<div class="row"> <div class="row">
<div class="col s4"> <div class="col s4">
@ -26,7 +26,7 @@
<li><a href="{{ url_for('main.dashboard', _anchor='corpora') }}" style="padding-left: 47px;"><i class="nopaque-icons">I</i>My Corpora</a></li> <li><a href="{{ url_for('main.dashboard', _anchor='corpora') }}" style="padding-left: 47px;"><i class="nopaque-icons">I</i>My Corpora</a></li>
<li><a href="{{ url_for('main.dashboard', _anchor='jobs') }}" style="padding-left: 47px;"><i class="nopaque-icons">J</i>My Jobs</a></li> <li><a href="{{ url_for('main.dashboard', _anchor='jobs') }}" style="padding-left: 47px;"><i class="nopaque-icons">J</i>My Jobs</a></li>
<li><a href="{{ url_for('contributions.contributions') }}"><i class="material-icons">new_label</i>Contribute</a></li> <li><a href="{{ url_for('contributions.contributions') }}"><i class="material-icons">new_label</i>Contribute</a></li>
<li><a href="{{ url_for('main.social_area') }}"><i class="material-icons">group</i>Social Area</a></li> <li class="social-area-color-base social-area-color-border-darken" style="border-left: 10px solid; margin-top: 5px;"><a href="{{ url_for('main.social_area') }}"><i class="material-icons">group</i>Social Area</a></li>
<li><div class="divider"></div></li> <li><div class="divider"></div></li>
<li><a class="subheader">Processes & Services</a></li> <li><a class="subheader">Processes & Services</a></li>
<li class="service-color service-color-border border-darken" data-service="file-setup-pipeline" style="border-left: 10px solid; margin-top: 5px;"><a href="{{ url_for('services.file_setup_pipeline') }}"><i class="nopaque-icons service-icons" data-service="file-setup-pipeline"></i>File setup</a></li> <li class="service-color service-color-border border-darken" data-service="file-setup-pipeline" style="border-left: 10px solid; margin-top: 5px;"><a href="{{ url_for('services.file_setup_pipeline') }}"><i class="nopaque-icons service-icons" data-service="file-setup-pipeline"></i>File setup</a></li>

View File

@ -1,7 +1,7 @@
{% extends "base.html.j2" %} {% extends "base.html.j2" %}
{% import "materialize/wtf.html.j2" as wtf %} {% import "materialize/wtf.html.j2" as wtf %}
{% block main_attribs %} style="background-color:#d8c9ba86" {% endblock main_attribs %} {% block main_attribs %} class="social-area-color-lighten" {% endblock main_attribs %}
{% block page_content %} {% block page_content %}
<div class="container"> <div class="container">
@ -14,14 +14,14 @@
<div class="center-align"> <div class="center-align">
<p class="hide-on-small-only">&nbsp;</p> <p class="hide-on-small-only">&nbsp;</p>
<p class="hide-on-small-only">&nbsp;</p> <p class="hide-on-small-only">&nbsp;</p>
<a class="btn-floating btn-large btn-scale-x2 waves-effect waves-light" style="background-color:#D9A36D"> <a class="btn-floating btn-large btn-scale-x2 waves-effect waves-light social-area-color-darken">
<i class="left material-icons">group</i> <i class="left material-icons">group</i>
</a> </a>
</div> </div>
</div> </div>
<div class="col s12 m9 pull-m3"> <div class="col s12 m9 pull-m3">
<div class="card" style="border-top: 10px solid #D9A36D;"> <div class="card social-area-color-border-darken" style="border-top: 10px solid">
<div class="card-content"> <div class="card-content">
<div class="row"> <div class="row">
<div class="col s12"> <div class="col s12">