Skip to content

Commit

Permalink
update layout
Browse files Browse the repository at this point in the history
  • Loading branch information
backface committed Aug 21, 2024
1 parent 58fdc92 commit 936c4eb
Show file tree
Hide file tree
Showing 11 changed files with 225 additions and 63 deletions.
72 changes: 72 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
{
/******************************************/
/**** Workspace-wide settings ****/
/******************************************/

// Exclude all files from workspace, enabling IntelliSense support for open files only
"python.analysis.exclude": ["**"],

// Disable indexing for workspace & third-party libraries
"python.analysis.indexing": false,

// Enable problem reporting only for open files, instead of all files in the workspace
"python.analysis.diagnosticMode": "openFilesOnly",

/**************************************/
/**** Features with custom support ****/
/**************************************/

// Disable custom parsing of reStructedText docstrings
"python.analysis.supportRestructuredText": false,

// Disable custom pytest IntelliSense features
"python.analysis.enablePytestSupport": false,


/**********************/
/**** Inlay hints ****/
/*********************/

// Disable inlay hints
"python.analysis.inlayHints.callArgumentNames": "off",
"python.analysis.inlayHints.functionReturnTypes": false,
"python.analysis.inlayHints.pytestParameters": false,
"python.analysis.inlayHints.variableTypes": false,

/************************/
/**** Type features ****/
/***********************/

// Disable type checking diagnostics
"python.analysis.typeCheckingMode": "off",

// Disable extracting type information from library implementations
"python.analysis.useLibraryCodeForTypes": false,

/*************************/
/**** Editor features ****/
/*************************/

// Disable semantic highlighting
"editor.semanticHighlighting.enabled": false,

// Disable occurrences highlighting when selecting a symbol
"editor.occurrencesHighlight": "off",

/************************************/
/*** Less perf intensive features ***/
/************************************/

// Whether to automatically complete parenthesis when accepting a function suggestion
"python.analysis.completeFunctionParens": false,

// Whether to automatically convert a string to an f-string when adding "{}"
"python.analysis.autoFormatStrings": false,

// Whether to enable auto import suggestions
"python.analysis.autoImportCompletions": false,

// Whether to enable code navigation for string literals that look like module names
"python.analysis.gotoDefinitionInStringLiteral": false,

}
87 changes: 86 additions & 1 deletion apps/classrooms/tests.py
Original file line number Diff line number Diff line change
@@ -1 +1,86 @@
# Create your tests here.
# tests.py
from django.test import TestCase
from django.urls import reverse
from django.contrib.auth import get_user_model
from django.contrib.auth.models import Group as AuthGroup
from .models import Group, Unit, Membership, TrainerRequest
from .forms import TrainerRequestForm

User = get_user_model()

class GroupViewTests(TestCase):
def setUp(self):
# Create test users and groups
self.teacher_group = AuthGroup.objects.create(name="Teachers")
self.teacher = User.objects.create_user(username='teacher', password='password')
self.teacher_group.user_set.add(self.teacher)
self.host = User.objects.create_user(username='host', password='password')
self.member = User.objects.create_user(username='member', password='password')
self.group = Group.objects.create(title='Test Group', description='Test description', introduction='Test intro', host=self.host)
self.group.members.add(self.host)

def test_group_create_view(self):
self.client.login(username='teacher', password='password')
response = self.client.post(reverse('groups:group_create'), {
'title': 'New Group',
'description': 'New description',
'introduction': 'New intro'
})
self.assertEqual(response.status_code, 302) # Check for redirect
self.assertTrue(Group.objects.filter(title='New Group').exists()) # Check if group was created

def test_group_detail_view(self):
self.client.login(username='host', password='password')
response = self.client.get(reverse('groups:group_detail', args=[self.group.id]))
self.assertEqual(response.status_code, 200) # Check if the page loads successfully
self.assertContains(response, self.group.title) # Check if the group title is in the response

def test_add_member_view(self):
self.client.login(username='host', password='password')
response = self.client.post(reverse('groups:add_member', args=[self.group.id]), {
'username': 'member'
})
self.assertEqual(response.status_code, 302) # Check for redirect after adding
self.assertTrue(Membership.objects.filter(group=self.group, user=self.member).exists()) # Check membership

def test_remove_member_view(self):
self.client.login(username='host', password='password')
self.group.members.add(self.member) # first add the member
response = self.client.post(reverse('groups:remove_member', args=[self.group.id, 'member']))
self.assertEqual(response.status_code, 302) # Check for redirect after removing
self.assertFalse(Membership.objects.filter(group=self.group, user=self.member).exists()) # Check membership removed

def test_trainer_request(self):
response = self.client.post(reverse('groups:trainer_request'), {
'full_name': 'John Doe',
'phone_number': '+1234567890',
'organization': 'Test Org',
'role': 'Teacher',
'type': 'Individual',
'website': 'https://example.com',
'tos': True,
'referer': '',
})
self.assertEqual(response.status_code, 302) # Redirect after submitting
self.assertEqual(TrainerRequest.objects.count(), 1) # Check if the trainer request is created

def test_bulk_add_view(self):
self.client.login(username='host', password='password')
csv_data = "name1,password1\nname2,password2\n"
response = self.client.post(reverse('groups:bulk_add', args=[self.group.id]), {
'data': csv_data
})
self.assertEqual(response.status_code, 302) # Check for redirect
self.assertTrue(User.objects.filter(username='group{}name1'.format(self.group.id)).exists()) # Check if users were created
self.assertTrue(User.objects.filter(username='group{}name2'.format(self.group.id)).exists())

def test_leave_view(self):
self.client.login(username='member', password='password')
response = self.client.get(reverse('groups:leave'))
self.assertEqual(response.status_code, 302) # Check for redirect
self.assertFalse(self.group.members.filter(username='member').exists()) # Check if member left


def tearDown(self):
User.objects.all().delete()
Group.objects.all().delete()
11 changes: 0 additions & 11 deletions apps/projects/templatetags/tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ def twittify(value):
),
)
)


twittify.mark_safe = True


Expand All @@ -41,14 +39,9 @@ def linktags(value):
),
)
)


linktags.mark_safe = True


register.filter(name="removetags")


def removetags(value):
"""Replace #tags with links to tag site using reverse"""
# regex = "#([a-zA-Z0-9_]+)"
Expand All @@ -60,8 +53,6 @@ def removetags(value):
value,
)
)


removetags.mark_safe = True


Expand All @@ -82,7 +73,5 @@ def link_uris(value):

@register.simple_tag
def scale_tag(value, min_out, max_out, max_in):
print(value, min_out, max_out, max_in)
size = max(min_out, (value / max_in * max_out))
print(size)
return f"{size}"
9 changes: 6 additions & 3 deletions input.css
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,16 @@
}

.search button {
@apply hover:text-blue bg-blue text-white hover:bg-white
@apply text-black bg-transparent hover:bg-primary hover:text-white
}
.search button.active {
@apply text-blue hover:bg-blue hover:text-white bg-white
@apply text-white hover:bg-primary hover:text-white bg-primary
}
.search button a {
@apply hover:text-white
}
.search input {
@apply text-blue text-left placeholder:text-blue
@apply text-black text-left placeholder:text-slate-300 border-b-2 border-primary border-t-0 border-l-0 border-r-0
}

.textarea {
Expand Down
46 changes: 23 additions & 23 deletions static/css/tw.css
Original file line number Diff line number Diff line change
Expand Up @@ -4771,8 +4771,8 @@ details.collapse summary::-webkit-details-marker {
height: 100%;
}

.w-1\/4 {
width: 25%;
.w-1\/3 {
width: 33.333333%;
}

.w-10 {
Expand Down Expand Up @@ -5012,11 +5012,6 @@ details.collapse summary::-webkit-details-marker {
border-color: rgb(209 213 219 / var(--tw-border-opacity));
}

.border-gray-700 {
--tw-border-opacity: 1;
border-color: rgb(55 65 81 / var(--tw-border-opacity));
}

.border-light {
--tw-border-opacity: 1;
border-color: rgb(246 246 246 / var(--tw-border-opacity));
Expand Down Expand Up @@ -5057,11 +5052,6 @@ details.collapse summary::-webkit-details-marker {
background-color: var(--fallback-b2,oklch(var(--b2)/var(--tw-bg-opacity)));
}

.bg-blue {
--tw-bg-opacity: 1;
background-color: rgb(74 108 212 / var(--tw-bg-opacity));
}

.bg-dark {
--tw-bg-opacity: 1;
background-color: rgb(44 44 44 / var(--tw-bg-opacity));
Expand Down Expand Up @@ -5607,47 +5597,57 @@ details.collapse summary::-webkit-details-marker {
}

.search button {
--tw-bg-opacity: 1;
background-color: rgb(74 108 212 / var(--tw-bg-opacity));
background-color: transparent;
--tw-text-opacity: 1;
color: rgb(255 255 255 / var(--tw-text-opacity));
color: rgb(0 0 0 / var(--tw-text-opacity));
}

.search button:hover {
--tw-bg-opacity: 1;
background-color: rgb(255 255 255 / var(--tw-bg-opacity));
background-color: rgb(89 179 95 / var(--tw-bg-opacity));
--tw-text-opacity: 1;
color: rgb(74 108 212 / var(--tw-text-opacity));
color: rgb(255 255 255 / var(--tw-text-opacity));
}

.search button.active {
--tw-bg-opacity: 1;
background-color: rgb(255 255 255 / var(--tw-bg-opacity));
background-color: rgb(89 179 95 / var(--tw-bg-opacity));
--tw-text-opacity: 1;
color: rgb(74 108 212 / var(--tw-text-opacity));
color: rgb(255 255 255 / var(--tw-text-opacity));
}

.search button.active:hover {
--tw-bg-opacity: 1;
background-color: rgb(74 108 212 / var(--tw-bg-opacity));
background-color: rgb(89 179 95 / var(--tw-bg-opacity));
--tw-text-opacity: 1;
color: rgb(255 255 255 / var(--tw-text-opacity));
}

.search button a:hover {
--tw-text-opacity: 1;
color: rgb(255 255 255 / var(--tw-text-opacity));
}

.search input {
border-bottom-width: 2px;
border-top-width: 0px;
border-left-width: 0px;
border-right-width: 0px;
--tw-border-opacity: 1;
border-color: rgb(89 179 95 / var(--tw-border-opacity));
text-align: left;
--tw-text-opacity: 1;
color: rgb(74 108 212 / var(--tw-text-opacity));
color: rgb(0 0 0 / var(--tw-text-opacity));
}

.search input::-moz-placeholder {
--tw-text-opacity: 1;
color: rgb(74 108 212 / var(--tw-text-opacity));
color: rgb(203 213 225 / var(--tw-text-opacity));
}

.search input::placeholder {
--tw-text-opacity: 1;
color: rgb(74 108 212 / var(--tw-text-opacity));
color: rgb(203 213 225 / var(--tw-text-opacity));
}

.textarea {
Expand Down
Binary file added static/img/feature_video.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 3 additions & 7 deletions templates/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@
</div>

<div class="mx-10">
<a href="/page/faq">FAQ</a><br />
<a href="/page/privacy">DMCA/Privacy</a><br />
<a href="/tos">Terms of Service</a><br />
<a href="/page/whatsnew">What's new?</a><br />
<br>
<a href="/page/contact">Contact</a><br>
<a class="custom-dbox-popup" href="https://donorbox.org/turtlestitch" target="_new">Donate!</a><br />
<a href="/page/contact">Contact</a><br>
<br>
<div class="text-primary text-2xl mb-2">
<a href="https://www.facebook.com/yarncoders/" class="hover:text-white mr-3"><i class="icon-[fa--facebook-square]"></i></a>
Expand All @@ -24,10 +23,7 @@
</div>

<div class="mx-10 relative">
<a href="/projects/g/newest">Projects</a><br />
<!-- <a href="/projects/tags">Tags</a><br />
<a href="/categories">Categories</a><br /> -->
<a href="/page/tutorials">Tutorials</a><br />
<a href="https://en.wikipedia.org/wiki/Turtlestitch">Wikipedia</a>
<a href="/page/moreresources">Links and Resources</a><br />
<a href="/page/offlineuse">Offline Usage</a><br />
<a href="https://github.com/backface/turtlestitch">Source Code</a><br />
Expand Down
Loading

0 comments on commit 936c4eb

Please sign in to comment.