Add support for product buying groups + many cosmetics and form pimping

This commit is contained in:
Skia
2016-08-20 22:12:46 +02:00
parent 00f05c71c5
commit dbf0653baf
19 changed files with 441 additions and 194 deletions

View File

@ -1,7 +1,8 @@
from ajax_select import register, LookupChannel
from core.views.site import search_user
from core.models import User
from core.models import User, Group
from club.models import Club
from counter.models import Product, Counter
@register('users')
@ -17,6 +18,32 @@ class UsersLookup(LookupChannel):
def format_item_display(self, item):
return item.get_display_name()
@register('groups')
class GroupsLookup(LookupChannel):
model = Group
def get_query(self, q, request):
return self.model.objects.filter(name__icontains=q)[:50]
def format_match(self, obj):
return obj.name
def format_item_display(self, item):
return item.name
@register('clubs')
class ClubLookup(LookupChannel):
model = Club
def get_query(self, q, request):
return self.model.objects.filter(name__icontains=q)[:50]
def format_match(self, obj):
return obj.name
def format_item_display(self, item):
return item.name
@register('counters')
class CountersLookup(LookupChannel):
model = Counter

View File

@ -368,7 +368,7 @@ class User(AbstractBaseUser):
<em>%s</em>
</a>
""" % (
self.profile_pict.get_download_url() if self.profile_pict else staticfiles_storage.url("core/img/na.gif"),
self.profile_pict.get_download_url() if self.profile_pict else staticfiles_storage.url("core/img/unknown.jpg"),
_("Profile"),
escape(self.get_display_name()),
)

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

View File

@ -183,10 +183,10 @@ tbody>tr:hover {
}
#user_profile h4 { border-bottom: 1px solid grey; max-width: 60%; }
#user_profile #left_column {
max-width: 59%;
width: 59%;
}
#user_profile #right_column {
max-width: 40%;
width: 40%;
float: right;
font-style: italic;
}

View File

@ -25,7 +25,7 @@
<a href="{{ url('core:user_tools') }}">{% trans %}Tools{% endtrans %}</a> |
<a href="{{ url('core:logout') }}">{% trans %}Logout{% endtrans %}</a>
<form action="{{ url('core:search') }}" method="GET">
<input type="text" placeholder="{% trans %}Search{% endtrans %}" name="query" />
<input type="text" placeholder="{% trans %}Search{% endtrans %}" name="query" id="search" />
<input type="submit" value="{% trans %}Search{% endtrans %}" style="display: none;" />
</form>
{% endif %}
@ -94,6 +94,13 @@ $('.select_date').datepicker({
monthNamesShort: $.datepicker.regional[ "{{ request.LANGUAGE_CODE }}" ].monthNamesShort,
monthNames: $.datepicker.regional[ "{{ request.LANGUAGE_CODE }}" ].monthNames,
}).datepicker( $.datepicker.regional[ "{{ request.LANGUAGE_CODE }}"] );
$(document).keydown(function (e) {
if ($(e.target).is('input')) { return }
if (e.keyCode == 83) {
$("#search").focus();
return false;
}
});
</script>
{% endblock %}
</body>

View File

@ -11,7 +11,9 @@
<div id="right_column">
<div id="pictures">
{% if profile.profile_pict %}
<img src="{{ profile.profile_pict.get_download_url() }}" alt="{% trans %}Profile{% endtrans %}" />
<img src="{{ profile.profile_pict.get_download_url() }}" alt="{% trans %}Profile{% endtrans %}" id="picture" />
{% else %}
<img src="{{ static('core/img/unknown.jpg') }}" alt="{% trans %}Profile{% endtrans %}" id="picture" />
{% endif %}
</div>
<p id="quote"><em>{{ profile.quote }}</em></p>
@ -53,4 +55,23 @@
{% endblock %}
{% block script %}
{{ super() }}
<script>
$( function() {
var keys = [];
var pattern = "71,85,89,71,85,89";
$(document).keydown(function (e) {
keys.push(e.keyCode);
if (keys.toString()==pattern) {
keys = [];
$("#right_column img").attr("src", "{{ static('core/img/yug.jpg') }}");
}
if (keys.length==6) {
keys.shift();
}
});
} );
</script>
{% endblock %}

View File

@ -7,7 +7,7 @@
{% block infos %}
{% if profile.permanencies %}
<div>
<h3>Permanencies</h3>
<h3>{% trans %}Permanencies{% endtrans %}</h3>
<p>Total: {{ total_perm_time }}</p>
<p>Foyer: {{ total_foyer_time }}</p>
<p>MDE: {{ total_mde_time }}</p>