Commit 9cf16287 authored by Olga Brani's avatar Olga Brani
Browse files

Bug fixes

- Custom select
- Units etc for group details
- General fixes
parent c63fbb0c
......@@ -532,7 +532,7 @@ class AstakosGroupCreationForm(forms.ModelForm):
label="",
widget=forms.HiddenInput()
)
name = forms.URLField(widget=forms.TextInput(attrs={'placeholder': 'eg. foo.ece.ntua.gr'}))
name = forms.URLField(widget=forms.TextInput(attrs={'placeholder': 'eg. foo.ece.ntua.gr'}), help_text="Name should be in the form of dns",)
moderation_enabled = forms.BooleanField(
help_text="Check if you want to approve members participation manually",
required=False,
......
......@@ -10,21 +10,44 @@
/***** Begin Theme, feel free to edit in here! ******/
/* dropkick select extra styles */
.form-row .dk_container { border-radius:0; margin-bottom:0; border: 1px solid #ccc; height: 21px; letter-spacing: 1px; line-height: 22px; margin-bottom: -1px; width:240px; padding:5px 0; font-weight:normal; font-family: 'Didact Gothic', Verdana, sans-serif; font-size:1em; background:transparent; color:#808080;}
.form-row .dk_toggle { border-radius:0; padding:0; border:0 none; text-indent:1.5em; text-decoration:none;background-image:url(../images/arrow-down_black.png); background-position:90% 5px;}
.form-row .dk_toggle:hover { text-decoration:none; }
.form-row .dk_open { background:transparent; box-shadow: none; }
.form-row .dk_open .dk_toggle { background-color:transparent; border:0 none; color:#000; box-shadow: none;}
.form-row .dk_focus .dk_toggle { background-color:transparent; border:0 none; color:#000; box-shadow: none;}
.1form-row .dk_options { display:block; }
.form-row .dk_options { box-shadow:none; border-radius:0; z-index:3; margin:6px -1px 0; width:auto; left:0;}
.form-row .dk_options a { font-weight:normal;color:#808080; padding:5px 0; text-indent:1.5em; border-bottom-color: #ccc }
.form-row .dk_options a:hover { border-bottom-color: #ccc }
.form-row .dk_options_inner { padding:0; margin:0; box-shadow:none; text-shadow:none; border-radius:0; border:1px solid #ccc ; margin-top:4px;}
.form-row .dk-options_inner li { list-style:none outside; }
.form-row .dk_options a:hover,
.form-row .dk_option_current a { text-shadow:none; background-color: #fff; text-decoration:none; color:#F89A1C}
/* end custom theme */
/* One container to bind them... */
.dk_container {
font-family: 'Antic', sans-serif;
font-weight: normal;
line-height: 42px;
letter-spacing: 1px;
border: 1px solid #808080;
height:42px;
display: inline-block;
margin-bottom: -1px;
padding-left:21px;
z-index: 2;
width:308px;
background: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#f5f5f5));
background: -moz-linear-gradient(top, #fff, #f5f5f5);
background: -o-linear-gradient(top, #fff, #f5f5f5);
background-color: #f5f5f5;
font-family: 'Helvetica', Arial, sans-serif;
font-size: 12px;
font-weight: bold;
line-height: 14px;
margin-bottom: 18px;
border-radius: 5px;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
}
.dk_container:focus {
outline: 0;
......@@ -32,8 +55,6 @@
.dk_container a {
cursor: pointer;
text-decoration: none;
color:#808080;
}
/* Opens the dropdown and holds the menu label */
......@@ -42,23 +63,39 @@
* Help: Arrow image not appearing
* Try updating this property to your correct dk_arrows.png path
*/
background:url(../images/arrow_02.jpg) no-repeat 276px center;
background-image: url('images/dk_arrows.png');
background-repeat: no-repeat;
background-position: 90% center;
border: 1px solid #ccc;
color: #333;
padding: 7px 45px 7px 10px;
text-shadow: #fff 1px 1px 0;
border-radius: 5px;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
-webkit-transition: border-color .5s;
-moz-transition: border-color .5s;
-o-transition: border-color .5s;
transition: border-color .5s;
}
.dk_toggle:hover {
border-color: #8c8c8c;
}
/* Applied when the dropdown is focused */
.dk_focus .dk_toggle {
border-color: #40b5e2;
}
.dk_focus .dk_toggle {
box-shadow: 0 0 5px #40b5e2;
-moz-box-shadow: 0 0 5px #40b5e2;
-webkit-box-shadow: 0 0 5px #40b5e2;
}
/* Applied whenever the dropdown is open */
.dk_open {
box-shadow: 0 0 5px #40b5e2;
-moz-box-shadow: 0 0 5px #40b5e2;
-webkit-box-shadow: 0 0 5px #40b5e2;
/**
* Help: Dropdown menu is covered by something
* Try setting this value higher
......@@ -66,35 +103,54 @@
z-index: 10;
}
.dk_open .dk_toggle {
background-color: #ececec;
border-color: #8c8c8c;
color: #ccc;
box-shadow: inset 0 -2px 5px #ccc;
border-radius: 5px 5px 0 0;
-moz-border-radius: 5px 5px 0 0;
-webkit-border-radius: 5px 5px 0 0;
}
/* The outer container of the options */
.dk_options {
box-shadow: rgba(0, 0, 0, .2) 0 2px 8px;
-moz-box-shadow: rgba(0, 0, 0, .2) 0 2px 8px;
-webkit-box-shadow: rgba(0, 0, 0, .2) 0 2px 8px;
border-radius: 0 0 5px 5px;
-moz-border-radius: 0 0 5px 5px;
-webkit-border-radius: 0 0 5px 5px;
}
.dk_options a {
background-color: #fff;
border-bottom: 1px solid #999;
padding: 8px 20px;
font-weight: bold;
padding: 8px 10px;
}
.dk_options li:last-child a {
border-bottom: none;
}
.dk_options a:hover,
.dk_option_current a {
background-color: #0084c7;
border-bottom-color: #004c72;
color: #fff;
text-decoration: none;
text-shadow: rgba(0, 0, 0, .5) 0 1px 0;
}
/* Inner container for options, this is what makes the scrollbar possible. */
.dk_options_inner {
padding:0;
margin:0;
border: 1px solid #808080;
border-top:0 none;
.dk_options_inner {
border: 1px solid #8c8c8e;
border-bottom-width: 2px;
border-bottom-color: #999;
color: #333;
max-height: 250px;
text-shadow: #fff 0 1px 0;
border-radius: 0 0 5px 5px;
-moz-border-radius: 0 0 5px 5px;
-webkit-border-radius: 0 0 5px 5px;
}
.dk_options_inner li { list-style:none outside;}
/* Set a max-height on the options inner */
.dk_options_inner,
......@@ -108,6 +164,7 @@
.dk_container {
display: none;
float: left;
position: relative;
}
.dk_container a {
......
......@@ -5,7 +5,7 @@ input, textarea, .form-widget { background-color: #ffffff; color: #000;borde
#forms input:focus { position: relative; border: 1px solid #000; z-index: 100; }
#forms .input:focus label,
#forms input:focus label { z-index: 300; }
form.withlabels label { width: 224px; display: block; float: left; padding-top: 1em; }
form.withlabels label { width: 224px; display: block; float: left; padding-top: 0.8em; }
form.withlabels input[type=text],
form.withlabels input[type=password] { width: 270px; }
form.withlabels input[type=text].long,
......@@ -69,7 +69,7 @@ form .with-errors label { color: #e4776f; }
div.form-stacked { margin-bottom: 4em; }
.checkbox-widget.checked { background-color: #FF0000; background-image: url("../images/checkbox.png"); background-position: 50% 50%; }
.content a.checkbox-widget { border: 1px solid #808080; cursor: pointer; display: block; float: left; height: 25px; margin:5px 20px 0 0 ; width: 25px; }
form.withlabels .checkbox-widget { margin-top:20px; }
form.withlabels .checkbox-widget { margin-top:12px; }
form.innerlabels .checkbox-widget + label { position:static; line-height:36px; color:#808080; }
form.innerlabels .checkbox-widget + label + a { border-bottom:1px solid #F89A1C; font-size: 1.1em; }
form span.info { position:absolute;z-index:101; top:10px; }
......@@ -77,7 +77,7 @@ form.innerlabels span.info { left: 290px; }
form.withlabels span.info { left:485px; }
form span.info em { display:block; overflow:hidden; position:absolute; left:0; text-indent:-100px; top:0; height:21px; width:21px; background:url(../images/symbols.png) no-repeat -4px -31px;cursor:pointer; }
form span.info:hover em { background-position:-4px -3px; }
form span.info span { position:absolute; left:29px; top:-2px; width:120px; padding-left:30px; background:url(../images/black-line.jpg ) no-repeat left 12px; min-height:50px; display:none; font-size:0.846em;}
form span.info span { position:absolute; left:29px; top:-2px; width:120px; padding-left:30px; background:url(../images/black-line.jpg ) no-repeat left 8px; min-height:50px; display:none; font-size:0.846em;}
form span.info:hover span { display:block; }
form .with-errors span.info { display:none;}
form p { margin-bottom:0;position:relative;}
......@@ -133,21 +133,6 @@ form.withfieldset textarea { width: 224px; }
form.withfieldset select { width: 256px; background:#fff;}
form+p:first-child, form legend + p { margin-bottom:2em; }
/* dropkick select extra styles */
.form-row .dk_container { border-radius:0; margin-bottom:0; border: 1px solid #808080; height: 21px; letter-spacing: 1px; line-height: 22px; margin-bottom: -1px; width:300px; padding:0.8em 0; font-weight:normal; font-family: 'Didact Gothic', Verdana, sans-serif; font-size:1em; background:transparent; color:#808080;}
.form-row .dk_toggle { border-radius:0; padding:2px 0 10px; border:0 none; text-indent:1.5em; text-decoration:none;background-image:url(../images/arrow-down_black.png); background-position:90% 5px;}
.form-row .dk_toggle:hover { text-decoration:none; }
.form-row .dk_open { background:transparent; box-shadow: none; }
.form-row .dk_open .dk_toggle { background-color:transparent; border:0 none; color:#000; box-shadow: none;}
.form-row .dk_focus .dk_toggle { background-color:transparent; border:0 none; color:#000; box-shadow: none;}
.1form-row .dk_options { display:block; }
.form-row .dk_options { box-shadow:none; border-radius:0; z-index:3; margin:6px -1px 0; width:auto; left:0;}
.form-row .dk_options a { font-weight:normal;color:#808080 }
.form-row .dk_options_inner { padding:0; margin:0; box-shadow:none; text-shadow:none; border-radius:0; border:1px solid #8C8C8E ;}
.form-row .dk-options_inner li { list-style:none outside; }
.form-row .dk_options a:hover,
.form-row .dk_option_current a { text-shadow:none; background-color: #E7E7E3; text-decoration:none;}
form.link-like { display:inline-block; margin:0 5px; float:right;}
form.link-like input[type="submit"] { margin:0; padding:0 5px; background:transparent; color:#F89A1C; cursor:pointer; height:auto; line-height:120%; }
......@@ -159,7 +144,7 @@ form.link-like.alone input[type="submit"] { padding:0; }
.projects form .with-checkbox { margin:20px 0; }
.projects form .with-checkbox label { padding-top:7px; }
.projects form .with-checkbox span.info { bottom:24px; }
.projects .minimal { float:right; position:relative; margin-bottom:-20px;}
.projects .minimal { float:right; position:relative; margin-bottom:-28px;}
.projects .minimal select { padding:3px; width:250px; }
.projects .minimal label { position:absolute; right:290px; top:5px; white-space:nowrap}
......
......@@ -3,3 +3,4 @@
@import url(colorbox.css);
@import url(browser-fixes.css);
@import url(forms.css);
@import url(dropkick.css);
\ No newline at end of file
......@@ -224,7 +224,7 @@ a.button:hover { background-color: #F89A1C; border:0 none; color:#fff;}
/* Style for im/projects */
table.alt-style { color:#000; width:100%; }
table.alt-style caption { font-weight:normal; font-size:1.154em; }
table.alt-style caption { font-weight:normal; font-size:1.154em; margin-bottom:15px;}
table.alt-style tr th { font-weight:normal; color:#3582AC }
table.alt-style tr td { color:#222; }
table.alt-style tr td:first-child,
......@@ -374,13 +374,13 @@ table.alt-style tr td.info-td div { padding:15px; border:1px dashed #000 }
/* quotas-form */
.quotas-form fieldset { background:url(../images/dots.jpg) repeat-x scroll center bottom transparent; margin-bottom:3em; padding-bottom:3em; position:relative; }
.quotas-form legend { color:#55B577; font-size:1.154em; margin-bottom:3em; position:relative; }
.quotas-form legend { color:#55B577; font-size:1.308em; margin-bottom:3em; position:relative; }
.quotas-form legend span { color:#222; font-size:0.867em; }
form.quotas-form legend span.info { position:relative; display:inline-block; top:auto; left:auto; margin-left:10px;}
form.quotas-form legend span.info em { position:static; }
form.quotas-form legend span.info span { width:395px; }
.quotas-form .with-checkbox .checkbox-widget { margin-top:12px; }
.quotas-form .with-checkbox span.info { top:15px; }
.quotas-form .with-checkbox .checkbox-widget { margin-top:9px; }
.quotas-form .with-checkbox span.info { top:12px; }
.quotas-form .form-row.submit { text-align:center; }
.quotas-form input[type="submit"] { margin:15px 0; background-color:#B3B3B3 }
.quotas-form input[type="submit"]:hover { background:#55B577 }
......@@ -458,3 +458,6 @@ table .msg-wrap .dialog .submit { min-width:30px; padding:5px 22px; }
table .msg-wrap .dialog .no.submit { float:right; }
table.alt-style .centered { text-align:center; }
table.alt-style form.link-like { float:none }
form.quotas-form span.error-msg span { display:block; color:red; }
form.quotas-form span.error-msg em,
form.quotas-form span.error-msg:hover em { background-position:-58px -3px; }
......@@ -112,7 +112,11 @@ $(document).ready(function() {
});
//$('select').dropkick();
$('select.dropkicked').dropkick({
change: function (value, label) {
$(this).parents('form').submit();
}
});
$('.top-msg .success').parents('.top-msg').addClass('success');
$('.top-msg .error').parents('.top-msg').addClass('error');
......@@ -239,8 +243,19 @@ $(document).ready(function() {
if ($('.quotas-form .group .form-row.with-errors').length>0 ){
return false;
}
$('.quotas-form .group .form-row.with-errors')[0].focus();
var flag = 0;
$('.quotas-form .group input[type="text"]').each(function() {
// get value from input
var value = $(this).val();
if (value){
flag =1;
}
});
if (flag =='0') {
$('#icons span.info').addClass('error-msg');
return false;
}
});
......@@ -248,6 +263,7 @@ $(document).ready(function() {
$("input.leave, input.join").click(function () {
$(this).parents('.msg-wrap').find('.dialog').show();
return false;
});
$('.msg-wrap .no').click( function(e){
......
......@@ -9,7 +9,10 @@ function group_form_show_resources(el){
$(this).find('input')[0].focus()
}
});
if ($('.quotas-form .with-info .with-errors input[type="text"]')){
$(this)[0].focus();
}
}
......@@ -116,7 +119,7 @@ $(document).ready(function() {
value = value.replace(",",".");
var num = parseFloat(value);
if ( value && !num ) { flag = 1}
if ( value && !num ) { flag = 1 ; msg="Invalid format"}
var bytes = num;
......@@ -148,14 +151,16 @@ $(document).ready(function() {
bytes = num;
}
} else {
if (value) {
flag = 1;
}
if (num) {
flag = 1;
msg ="You must specify correct units"
}
}
if ( flag == '1' ){
$(this).parents('.form-row').addClass('with-errors');
$(this).parents('.form-row').find('.error-msg').html(msg);
bytes = value;
$(this).focus();
......@@ -173,7 +178,7 @@ $(document).ready(function() {
var is_int = value.match (new RegExp('^[0-9]*$'));
if ( !is_int ){
$(this).parents('.form-row').find('.error-msg').html('Enter a whole number');
$(this).parents('.form-row').find('.error-msg').html('Enter a positive intiger');
$(this).parents('.form-row').addClass('with-errors');
} else {
......
......@@ -17,7 +17,7 @@
{% endif %}
</em>
{% endif %}
<span>{{object.kindname|upper}}</span>
<span>{{ object.name|strip_http|upper }}</span>
</h2>
<div class="details">
......@@ -84,22 +84,23 @@
<h3>RESOURCES:</h3>
{% if quota %}
<dl class="alt-style">
{% for k in quota|dkeys %}
{% with resource_catalog|lookup:'resources' as resources %}
{% with resources|lookup_uni:k as info %}
{% with resource_presentation|lookup_uni:k as resource_info %}
<dt>
Max {% if resource_info.is_abbreviation %}{{ info.resource|upper }}{% else %}{{ r.resource }}{% endif %}{% if not info.unit %}s {% endif %} per user
Max {% if resource_info.is_abbreviation %}{{ info.name|upper }}{% else %}{{ info.name }}{% endif %}{% if not info.unit %}s {% endif %} per user
</dt>
<dd>
{% with quota|lookup:k as uplimit%}
{% if uplimit == "inf" %}
unlimited
{% else %}
{{ uplimit }}
{% endif %}
{% if uplimit %}
{% if info.unit %}
{{ uplimit|sizeof_fmt }}
{% else %}
{{ uplimit|isinf }}
{% endif %}
{% endif %}
{% endwith%}
</dd>
......@@ -119,7 +120,7 @@
{% if membership %}
<form method="GET" class="minimal" action="">
<div class="form-row">
<select name="sorting" onchange="this.form.submit();">
<select name="sorting" onchange="this.form.submit();" class="dropkicked">
<option value="">Sort by</option>
<option value="person__email" {% if sorting == 'person__email' %}selected{% endif %}>User Id</option>
<option value="person__first_name" {% if sorting == 'person__first_name' %}selected{% endif %}>Name</option>
......
......@@ -8,14 +8,14 @@
{% block page.body %}
<form action="" method="post" class="withlabels quotas-form" id="group_create_form">{% csrf_token %}
<form action="#top" method="post" class="withlabels quotas-form" id="group_create_form">{% csrf_token %}
<fieldset class="with-info">
<fieldset class="with-info" id="top">
<legend>
1. CREATE GROUP
<span class="info">
<em>more info</em>
<span>Help Text Help Text Help Text Help Text Help Text Help Text Help Text Help Text Help Text Help Text Help Text Help Text Help Text Help Text</span>
<span>Fill in the required fields to create a group. Group details will be visible to the users of the group.</span>
</span>
</legend>
......@@ -28,7 +28,7 @@
2. ADD RESOURCES
<span class="info">
<em>more info</em>
<span>Help Text Help Text Help Text Help Text Help Text Help Text Help Text Help Text Help Text Help Text Help Text Help Text Help Text Help Text</span>
<span>You need to specify at least one resource</span>
</span>
</legend>
......
......@@ -27,7 +27,7 @@
<a href="{% url group_search %}">Join an existing one</a>
or
<!--<a href="{% url group_create_list %}">Create a new group</a>-->
<a href="{% url group_add 'course' %}">create a new group</a>.
<a href="{% url group_add 'default' %}">create a new group</a>.
</p>
<div class="widjets">
......@@ -39,7 +39,7 @@
<h2>WELCOME!</h2>
<p><a href="{% url group_add 'course' %}"><img alt="THINK ABOUT IT" src="/static/im/images/create.png"></a></p>
<p class="txt">Connect with a world of people who share your passions.<br>With millions of groups at your fingertips, it's easy to find the group that's best for you -- no matter your interest.</p>
<p><a href="{% url group_add 'course' %}">create a group ></a></p>
<p><a href="{% url group_add 'default' %}">create a group ></a></p>
<!--<p class="btn"><a href="{% url group_create_list %}" class="submit">CREATE</a></p>-->
</div>
</div>
......@@ -65,7 +65,7 @@
<div class="full-dotted">
<form method="GET" class="minimal" action="#searchResults">
<div class="form-row">
<select name="sorting" onchange="this.form.submit();">
<select name="sorting" onchange="this.form.submit();" class="dropkicked">
<option value="">Sort by</option>
<option value="groupname" {% if sorting == 'groupname' %}selected{% endif %}>Name</option>
<!--option value="kindname" {% if sorting == 'kindname' %}selected{% endif %}>Type</option-->
......@@ -191,9 +191,9 @@
{% with q|paginate:args as page_obj %}
<div >
<form method="GET" class="minimal" action="#allGroups">
<form method="GET" class="minimal" action="#allGroups" id="mygroups">
<div class="form-row">
<select name="sorting" onchange="this.form.submit();">
<select name="sorting" class="dropkicked">
<option value="">Sort by</option>
<option value="groupname" {% if sorting == 'groupname' %}selected{% endif %}>Name</option>
<!--<option value="kindname" {% if sorting == 'kindname' %}selected{% endif %}>Type</option>-->
......
......@@ -33,6 +33,7 @@
import calendar
import datetime
import math
from collections import defaultdict
......@@ -40,8 +41,10 @@ from django import template
from django.core.paginator import Paginator, EmptyPage
from django.db.models.query import QuerySet
from astakos.im.settings import PAGINATE_BY
register = template.Library()
DELIM = ','
......@@ -76,6 +79,7 @@ def monthssince(joined_date):
@register.filter
def lookup(d, key):
print d, key
return d.get(key)
@register.filter
......@@ -165,16 +169,26 @@ unit_list = zip(['bytes', 'kB', 'MB', 'GB', 'TB', 'PB'], [0, 0, 0, 0, 0, 0])
@register.filter
def sizeof_fmt(num):
"""Human friendly file size"""
if math.isinf(num):
return 'Unlimited'
if num > 1:
exponent = min(int(log(num, 1024)), len(unit_list) - 1)
quotient = float(num) / 1024**exponent
unit, num_decimals = unit_list[exponent]
format_string = '{:.%sf} {0}' % (num_decimals)
format_string = '{0:.%sf} {1}' % (num_decimals)
return format_string.format(quotient, unit)
if num == 0:
return '0 bytes'
if num == 1:
return '1 byte'
else:
return '';
\ No newline at end of file
return '0';
@register.filter
def isinf(v):
if math.isinf(v):
return 'Unlimited'
else:
return v
\ No newline at end of file
......@@ -729,6 +729,7 @@ resource_presentation = {
@login_required
def group_add(request, kind_name='default'):
result = callpoint.list_resources()
print '###', result
resource_catalog = {'resources':defaultdict(defaultdict),
'groups':defaultdict(list)}
if result.is_success:
......@@ -764,6 +765,9 @@ def group_add(request, kind_name='default'):
form_class=AstakosGroupCreationForm
)
resources = resource_catalog['resources']
if request.method == 'POST':
form = form_class(request.POST, request.FILES)
if form.is_valid():
......@@ -772,8 +776,10 @@ def group_add(request, kind_name='default'):
context_instance=get_context(request),
form = AstakosGroupCreationSummaryForm(form.cleaned_data),
policies = form.policies(),
resource_catalog=resource_catalog,
resource_presentation=resource_presentation
resource_presentation=resource_presentation,
resource_catalog= resource_catalog,
resources = resources,
)
else:
now = datetime.now()
......@@ -850,6 +856,7 @@ def group_add_complete(request):
@login_required
def group_list(request):
none = request.user.astakos_groups.none()