mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-12-24 02:24:20 +00:00
color SCSS update social area+ decorator fix
This commit is contained in:
parent
b364480de6
commit
8a55ce902e
@ -1,8 +1,9 @@
|
||||
from flask import abort, current_app
|
||||
from flask import abort
|
||||
from flask_login import current_user
|
||||
from functools import wraps
|
||||
from app.models import Corpus, CorpusFollowerAssociation
|
||||
|
||||
|
||||
def corpus_follower_permission_required(*permissions):
|
||||
def decorator(f):
|
||||
@wraps(f)
|
||||
@ -20,15 +21,14 @@ def corpus_follower_permission_required(*permissions):
|
||||
return decorated_function
|
||||
return decorator
|
||||
|
||||
def corpus_owner_or_admin_required():
|
||||
def decorator(f):
|
||||
@wraps(f)
|
||||
def decorated_function(*args, **kwargs):
|
||||
corpus_id = kwargs.get('corpus_id')
|
||||
corpus = Corpus.query.get_or_404(corpus_id)
|
||||
if current_user == corpus.user or current_user.is_administrator():
|
||||
return f(*args, **kwargs)
|
||||
abort(403)
|
||||
return decorated_function
|
||||
return decorator
|
||||
|
||||
def corpus_owner_or_admin_required(f):
|
||||
@wraps(f)
|
||||
def decorated_function(*args, **kwargs):
|
||||
corpus_id = kwargs.get('corpus_id')
|
||||
corpus = Corpus.query.get_or_404(corpus_id)
|
||||
if current_user == corpus.user or current_user.is_administrator():
|
||||
return f(*args, **kwargs)
|
||||
abort(403)
|
||||
return decorated_function
|
||||
|
||||
|
@ -43,7 +43,7 @@ def fake_add():
|
||||
|
||||
@bp.route('/<hashid:corpus_id>/is_public', methods=['POST'])
|
||||
@login_required
|
||||
@corpus_owner_or_admin_required()
|
||||
@corpus_owner_or_admin_required
|
||||
def update_corpus_is_public(corpus_id):
|
||||
is_public = request.json
|
||||
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'])
|
||||
@login_required
|
||||
@corpus_owner_or_admin_required()
|
||||
@corpus_owner_or_admin_required
|
||||
def add_corpus_followers(corpus_id):
|
||||
usernames = request.json
|
||||
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'])
|
||||
@login_required
|
||||
@corpus_owner_or_admin_required()
|
||||
@corpus_owner_or_admin_required
|
||||
def delete_corpus(corpus_id):
|
||||
def _delete_corpus(app, corpus_id):
|
||||
with app.app_context():
|
||||
@ -238,7 +238,7 @@ def analyse_corpus(corpus_id):
|
||||
|
||||
@bp.route('/<hashid:corpus_id>/build', methods=['POST'])
|
||||
@login_required
|
||||
@corpus_owner_or_admin_required()
|
||||
@corpus_owner_or_admin_required
|
||||
def build_corpus(corpus_id):
|
||||
def _build_corpus(app, corpus_id):
|
||||
with app.app_context():
|
||||
|
@ -22,6 +22,11 @@ $color: (
|
||||
"surface": #ffffff,
|
||||
"error": #b00020
|
||||
),
|
||||
"social-area": (
|
||||
"base": #d6ae86,
|
||||
"darken": #C98536,
|
||||
"lighten": #EAE2DB
|
||||
),
|
||||
"service": (
|
||||
"corpus-analysis": (
|
||||
"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") {
|
||||
.service-color[data-service="#{$service-name}"] {
|
||||
background-color: map-get($color-palette, "base") !important;
|
||||
|
@ -20,7 +20,7 @@ class UserList extends ResourceList {
|
||||
<td><span class="organization"></span></td>
|
||||
<td><span class="corpora-online"></span></td>
|
||||
<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>
|
||||
</tr>
|
||||
`.trim();
|
||||
|
@ -1,6 +1,6 @@
|
||||
<ul class="sidenav sidenav-fixed" id="sidenav">
|
||||
<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="row">
|
||||
<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='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('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><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>
|
||||
|
@ -1,7 +1,7 @@
|
||||
{% extends "base.html.j2" %}
|
||||
{% 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 %}
|
||||
<div class="container">
|
||||
@ -14,14 +14,14 @@
|
||||
<div class="center-align">
|
||||
<p class="hide-on-small-only"> </p>
|
||||
<p class="hide-on-small-only"> </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>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<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="row">
|
||||
<div class="col s12">
|
||||
|
Loading…
Reference in New Issue
Block a user