Skip to content

Commit

Permalink
Merge pull request #757 from ae-utbm/taiste
Browse files Browse the repository at this point in the history
Taiste
  • Loading branch information
imperosol authored Aug 4, 2024
2 parents 0790ae2 + 7b97f0b commit eb04e26
Show file tree
Hide file tree
Showing 31 changed files with 471 additions and 231 deletions.
3 changes: 1 addition & 2 deletions club/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
# OR WITHIN THE LOCAL FILE "LICENSE"
#
#
from ajax_select import make_ajax_form
from django.contrib import admin

from club.models import Club, Membership
Expand All @@ -32,4 +31,4 @@ class MembershipAdmin(admin.ModelAdmin):
"user__last_name",
"club__name",
)
form = make_ajax_form(Membership, {"user": "users"})
autocomplete_fields = ("user",)
11 changes: 2 additions & 9 deletions com/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
# OR WITHIN THE LOCAL FILE "LICENSE"
#
#
from ajax_select import make_ajax_form
from django.contrib import admin
from haystack.admin import SearchModelAdmin

Expand All @@ -23,19 +22,13 @@
class NewsAdmin(SearchModelAdmin):
list_display = ("title", "type", "club", "author")
search_fields = ("title", "summary", "content")
form = make_ajax_form(
News,
{
"author": "users",
"moderator": "users",
},
)
autocomplete_fields = ("author", "moderator")


@admin.register(Poster)
class PosterAdmin(SearchModelAdmin):
list_display = ("name", "club", "date_begin", "date_end", "moderator")
form = make_ajax_form(Poster, {"moderator": "users"})
autocomplete_fields = ("moderator",)


@admin.register(Weekmail)
Expand Down
51 changes: 19 additions & 32 deletions core/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,56 +13,43 @@
#
#

from ajax_select import make_ajax_form
from django.contrib import admin
from django.contrib.auth.models import Group as AuthGroup
from haystack.admin import SearchModelAdmin

from core.models import MetaGroup, Page, RealGroup, SithFile, User
from core.models import Group, Page, SithFile, User

admin.site.unregister(AuthGroup)
admin.site.register(MetaGroup)
admin.site.register(RealGroup)


@admin.register(Group)
class GroupAdmin(admin.ModelAdmin):
list_display = ("name", "description", "is_meta")
list_filter = ("is_meta",)
search_fields = ("name",)


@admin.register(User)
class UserAdmin(SearchModelAdmin):
class UserAdmin(admin.ModelAdmin):
list_display = ("first_name", "last_name", "username", "email", "nick_name")
form = make_ajax_form(
User,
{
"godfathers": "users",
"home": "files", # ManyToManyField
"profile_pict": "files", # ManyToManyField
"avatar_pict": "files", # ManyToManyField
"scrub_pict": "files", # ManyToManyField
},
autocomplete_fields = (
"godfathers",
"home",
"profile_pict",
"avatar_pict",
"scrub_pict",
)
search_fields = ["first_name", "last_name", "username"]


@admin.register(Page)
class PageAdmin(admin.ModelAdmin):
list_display = ("name", "_full_name", "owner_group")
form = make_ajax_form(
Page,
{
"lock_user": "users",
"owner_group": "groups",
"edit_groups": "groups",
"view_groups": "groups",
},
)
search_fields = ("name",)
autocomplete_fields = ("lock_user", "owner_group", "edit_groups", "view_groups")


@admin.register(SithFile)
class SithFileAdmin(admin.ModelAdmin):
list_display = ("name", "owner", "size", "date", "is_in_sas")
form = make_ajax_form(
SithFile,
{
"parent": "files",
"owner": "users",
"moderator": "users",
},
) # ManyToManyField
autocomplete_fields = ("parent", "owner", "moderator")
search_fields = ("name", "parent__name")
4 changes: 3 additions & 1 deletion core/static/core/colors.scss
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,6 @@ $twitblue: hsl(206, 82%, 63%);

$shadow-color: rgb(223, 223, 223);

$background-button-color: hsl(0, 0%, 95%);
$background-button-color: hsl(0, 0%, 95%);

$deepblue: #354a5f;
9 changes: 5 additions & 4 deletions core/static/core/header.scss
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
@import "colors";

$hovered-text-color: #c2c2c2;
$text-color: white;

$background-color: #354a5f;
$background-color-hovered: #283747;

$red-text-color: #eb2f06;
$hovered-red-text-color: #ff4d4d;

.header {
box-sizing: border-box;
background-color: $background-color;
background-color: $deepblue;
box-shadow: 3px 3px 3px 0 #dfdfdf;
border-radius: 0;
width: 100%;
Expand Down Expand Up @@ -98,7 +99,7 @@ $hovered-red-text-color: #ff4d4d;
border-radius: 0;
margin: 0;
box-sizing: border-box;
background-color: $background-color;
background-color: $deepblue;
width: 45px;
height: 25px;
padding: 0;
Expand Down Expand Up @@ -213,7 +214,7 @@ $hovered-red-text-color: #ff4d4d;
background-position: center center;
background-size: cover;
background-repeat: no-repeat;
background-color: $background-color;
background-color: $deepblue;
}

>.options {
Expand Down
1 change: 0 additions & 1 deletion core/static/core/js/jszip/jszip-utils.min.js

This file was deleted.

13 changes: 0 additions & 13 deletions core/static/core/js/jszip/jszip.min.js

This file was deleted.

28 changes: 28 additions & 0 deletions core/static/core/js/zipjs/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
BSD 3-Clause License

Copyright (c) 2023, Gildas Lormeau

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 changes: 28 additions & 0 deletions core/static/core/js/zipjs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Built scripts of zip.js

**Warning**: These files are not compatible with ES modules, i.e. they cannot be imported with `import`. Instead, import `index.js` in the root folder of the project or one of the files prefixed with `zip-` in the [`/lib`](../lib) folder (e.g. `/lib/zip-no-worker-inflate.js`).

- for production (minified):

| | [`ZipReader`](https://gildas-lormeau.github.io/zip.js/api/classes/ZipReader.html) API | [`ZipWriter`](https://gildas-lormeau.github.io/zip.js/api/classes/ZipWriter.html) API | [`zip.fs`](https://gildas-lormeau.github.io/zip.js/api/classes/FS.html) API | Web Workers | No Web Workers | Usage |
|--------------------------------|-----------------|-----------------|--------------|-------------|----------------|-------------------------------------------------------|
| `zip.min.js` | x | x | | x | | compression/decompression with web workers |
| `zip-no-worker.min.js` | x | x | | | x | compression/decompression without web workers |
| `zip-no-worker-inflate.min.js` | x | | | | x | decompression without web workers |
| `zip-no-worker-deflate.min.js` | | x | | | x | compression without web workers |
| `zip-full.min.js` | x | x | | x | x | compression/decompression with or without web workers |
| `zip-fs.min.js` | x | x | x | x | | compression/decompression with web workers |
| `zip-fs-full.min.js` | x | x | x | x | x | compression/decompression with or without web workers |

- for development/debugging:

| | `zip` API | [`zip.fs`](https://gildas-lormeau.github.io/zip.js/api/classes/FS.html) API | Web Workers | No Web Workers |
|-----------------------|-----------|--------------|-------------|----------------|
| `zip.js` | x | | x | |
| `zip-full.js` | x | | x | x |
| `zip-fs.js` | x | x | x | |
| `zip-fs-full.js` | x | x | x | x |

- `z-worker.js` can be used as a web worker script if the [Content Security Policy](https://developer.mozilla.org/docs/Web/HTTP/CSP) blocks scripts loaded with a `blob:` scheme
- `z-worker-fflate.js` is the web worker script for using [fflate](https://gildas-lormeau.github.io/zip.js/core-api.html#alternative-codec-fflate)
- `z-worker-pako.js` is the web worker script for using [pako](https://gildas-lormeau.github.io/zip.js/core-api.html#alternative-codec-pako)
1 change: 1 addition & 0 deletions core/static/core/js/zipjs/zip-fs-full.min.js

Large diffs are not rendered by default.

34 changes: 18 additions & 16 deletions core/static/core/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ a:not(.button) {

.collapse-header {
color: white;
background-color: #354a5f;
background-color: $deepblue;
padding: 5px 10px;
display: flex;
align-items: center;
Expand Down Expand Up @@ -206,34 +206,36 @@ a:not(.button) {
width: 90%;
margin: 20px auto 0;
/*---------------------------------NAV---------------------------------*/

.btn {
font-size: 15px;
font-weight: normal;
color: white;
min-width: 60px;
padding: 5px 10px;
padding: 9px 13px;
border: none;
text-decoration: none;

&.btn-blue {
background-color: #354a5f;
}

&.btn-blue:disabled {
background-color: rgba(70, 90, 126, 0.4);
}

&.btn-blue.clickable:not(:disabled):hover {
background-color: #2c3646;
background-color: $deepblue;
&:not(:disabled):hover {
background-color: darken($deepblue, 10%);
}
&:disabled {
background-color: rgba(70, 90, 126, 0.4);
}
}

&.btn-grey {
background-color: grey;
&:not(:disabled):hover {
background-color: darken(gray, 15%);
}
&:disabled {
background-color: lighten(gray, 15%);
}
}

&.btn-grey.clickable:not(:disabled):hover {
background-color: hsl(210, 5%, 30%);
i {
margin-right: 4px;
}
}

Expand Down Expand Up @@ -977,7 +979,7 @@ thead td {
}

thead {
background-color: #354a5f;
background-color: $deepblue;
color: white;
}

Expand Down
Loading

0 comments on commit eb04e26

Please sign in to comment.