euscanwww: Adding PoC switches for feed settings
Signed-off-by: volpino <fox91@anche.no>
This commit is contained in:
parent
225350f584
commit
78bc2520a7
@ -2,6 +2,7 @@ from django.contrib.syndication.views import Feed, FeedDoesNotExist
|
||||
from django.shortcuts import get_object_or_404
|
||||
from django.utils.feedgenerator import Atom1Feed
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.db.models import Q
|
||||
|
||||
from djeuscan.models import Package, Herd, Maintainer, VersionLog
|
||||
from djeuscan.helpers import get_profile, get_account_packages
|
||||
@ -157,10 +158,16 @@ class UserFeed(BaseFeed):
|
||||
return request.user
|
||||
|
||||
def items(self, user):
|
||||
profile = get_profile(user)
|
||||
packages = get_account_packages(user)
|
||||
overlays = [o.name for o in get_profile(user).overlays.all()]
|
||||
overlays = [o.name for o in profile.overlays.all()]
|
||||
|
||||
ret = VersionLog.objects.filter(package__in=packages).filter(
|
||||
overlay__in=overlays).order_by("-datetime")[:100]
|
||||
ret = VersionLog.objects.filter(
|
||||
Q(package__in=packages) | Q(overlay__in=overlays)
|
||||
)
|
||||
if not profile.upstream_info:
|
||||
ret = ret.exclude(overlay="")
|
||||
if not profile.portage_info:
|
||||
ret = ret.exclude(~Q(overlay=""))
|
||||
|
||||
return ret
|
||||
return ret.order_by("-datetime")[:100]
|
||||
|
@ -33,3 +33,6 @@ class PreferencesForm(forms.Form):
|
||||
first_name = forms.CharField(max_length=30, required=False)
|
||||
last_name = forms.CharField(max_length=30, required=False)
|
||||
email = forms.EmailField()
|
||||
|
||||
upstream_info = forms.BooleanField(required=False)
|
||||
portage_info = forms.BooleanField(required=False)
|
||||
|
@ -121,5 +121,4 @@ def get_account_packages(user):
|
||||
q_maintainers = Q(maintainers__in=profile.maintainers.all())
|
||||
packages = list(profile.packages.all()) + list(Package.objects.filter(
|
||||
q_categories | q_herds | q_maintainers))
|
||||
|
||||
return packages
|
||||
|
@ -0,0 +1,203 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import datetime
|
||||
from south.db import db
|
||||
from south.v2 import SchemaMigration
|
||||
from django.db import models
|
||||
|
||||
|
||||
class Migration(SchemaMigration):
|
||||
|
||||
def forwards(self, orm):
|
||||
# Adding field 'UserProfile.upstream_info'
|
||||
db.add_column('djeuscan_userprofile', 'upstream_info',
|
||||
self.gf('django.db.models.fields.BooleanField')(default=True),
|
||||
keep_default=False)
|
||||
|
||||
# Adding field 'UserProfile.portage_info'
|
||||
db.add_column('djeuscan_userprofile', 'portage_info',
|
||||
self.gf('django.db.models.fields.BooleanField')(default=False),
|
||||
keep_default=False)
|
||||
|
||||
def backwards(self, orm):
|
||||
# Deleting field 'UserProfile.upstream_info'
|
||||
db.delete_column('djeuscan_userprofile', 'upstream_info')
|
||||
|
||||
# Deleting field 'UserProfile.portage_info'
|
||||
db.delete_column('djeuscan_userprofile', 'portage_info')
|
||||
|
||||
models = {
|
||||
'auth.group': {
|
||||
'Meta': {'object_name': 'Group'},
|
||||
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
|
||||
'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
|
||||
},
|
||||
'auth.permission': {
|
||||
'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
|
||||
'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
|
||||
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
|
||||
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
|
||||
},
|
||||
'auth.user': {
|
||||
'Meta': {'object_name': 'User'},
|
||||
'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
|
||||
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
|
||||
'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
|
||||
'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
|
||||
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||
'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
|
||||
'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
|
||||
'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
|
||||
'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
|
||||
'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
|
||||
'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
|
||||
'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
|
||||
'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
|
||||
},
|
||||
'contenttypes.contenttype': {
|
||||
'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
|
||||
'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
|
||||
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||
'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
|
||||
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
|
||||
},
|
||||
'djeuscan.category': {
|
||||
'Meta': {'object_name': 'Category'},
|
||||
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '128'})
|
||||
},
|
||||
'djeuscan.categorylog': {
|
||||
'Meta': {'object_name': 'CategoryLog', '_ormbases': ['djeuscan.Log']},
|
||||
'category': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
|
||||
'log_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['djeuscan.Log']", 'unique': 'True', 'primary_key': 'True'})
|
||||
},
|
||||
'djeuscan.euscanresult': {
|
||||
'Meta': {'object_name': 'EuscanResult'},
|
||||
'datetime': ('django.db.models.fields.DateTimeField', [], {}),
|
||||
'ebuild': ('django.db.models.fields.CharField', [], {'max_length': '256', 'blank': 'True'}),
|
||||
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||
'package': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['djeuscan.Package']"}),
|
||||
'result': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
|
||||
'scan_time': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'})
|
||||
},
|
||||
'djeuscan.herd': {
|
||||
'Meta': {'object_name': 'Herd'},
|
||||
'email': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}),
|
||||
'herd': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '128'}),
|
||||
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||
'maintainers': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['djeuscan.Maintainer']", 'symmetrical': 'False'})
|
||||
},
|
||||
'djeuscan.herdlog': {
|
||||
'Meta': {'object_name': 'HerdLog', '_ormbases': ['djeuscan.Log']},
|
||||
'herd': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['djeuscan.Herd']"}),
|
||||
'log_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['djeuscan.Log']", 'unique': 'True', 'primary_key': 'True'})
|
||||
},
|
||||
'djeuscan.log': {
|
||||
'Meta': {'object_name': 'Log'},
|
||||
'datetime': ('django.db.models.fields.DateTimeField', [], {}),
|
||||
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||
'n_packages_gentoo': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
|
||||
'n_packages_outdated': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
|
||||
'n_packages_overlay': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
|
||||
'n_versions_gentoo': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
|
||||
'n_versions_overlay': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
|
||||
'n_versions_upstream': ('django.db.models.fields.IntegerField', [], {'default': '0'})
|
||||
},
|
||||
'djeuscan.maintainer': {
|
||||
'Meta': {'object_name': 'Maintainer'},
|
||||
'email': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '128'}),
|
||||
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||
'name': ('django.db.models.fields.CharField', [], {'max_length': '128'})
|
||||
},
|
||||
'djeuscan.maintainerlog': {
|
||||
'Meta': {'object_name': 'MaintainerLog', '_ormbases': ['djeuscan.Log']},
|
||||
'log_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['djeuscan.Log']", 'unique': 'True', 'primary_key': 'True'}),
|
||||
'maintainer': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['djeuscan.Maintainer']"})
|
||||
},
|
||||
'djeuscan.overlay': {
|
||||
'Meta': {'object_name': 'Overlay'},
|
||||
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '128'})
|
||||
},
|
||||
'djeuscan.package': {
|
||||
'Meta': {'unique_together': "(['category', 'name'],)", 'object_name': 'Package'},
|
||||
'category': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
|
||||
'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
|
||||
'herds': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['djeuscan.Herd']", 'symmetrical': 'False', 'blank': 'True'}),
|
||||
'homepage': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
|
||||
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||
'last_version_gentoo': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'last_version_gentoo'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['djeuscan.Version']"}),
|
||||
'last_version_overlay': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'last_version_overlay'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['djeuscan.Version']"}),
|
||||
'last_version_upstream': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'last_version_upstream'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['djeuscan.Version']"}),
|
||||
'maintainers': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['djeuscan.Maintainer']", 'symmetrical': 'False', 'blank': 'True'}),
|
||||
'n_overlay': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
|
||||
'n_packaged': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
|
||||
'n_versions': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
|
||||
'name': ('django.db.models.fields.CharField', [], {'max_length': '128'})
|
||||
},
|
||||
'djeuscan.problemreport': {
|
||||
'Meta': {'object_name': 'ProblemReport'},
|
||||
'datetime': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
|
||||
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||
'message': ('django.db.models.fields.TextField', [], {}),
|
||||
'package': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['djeuscan.Package']"}),
|
||||
'subject': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
|
||||
'version': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['djeuscan.Version']", 'null': 'True', 'blank': 'True'})
|
||||
},
|
||||
'djeuscan.refreshpackagequery': {
|
||||
'Meta': {'object_name': 'RefreshPackageQuery'},
|
||||
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||
'package': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['djeuscan.Package']"}),
|
||||
'priority': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
|
||||
'users': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.User']", 'symmetrical': 'False'})
|
||||
},
|
||||
'djeuscan.userprofile': {
|
||||
'Meta': {'object_name': 'UserProfile'},
|
||||
'categories': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['djeuscan.Category']", 'symmetrical': 'False'}),
|
||||
'herds': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['djeuscan.Herd']", 'symmetrical': 'False'}),
|
||||
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||
'maintainers': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['djeuscan.Maintainer']", 'symmetrical': 'False'}),
|
||||
'overlays': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['djeuscan.Overlay']", 'symmetrical': 'False'}),
|
||||
'packages': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['djeuscan.Package']", 'symmetrical': 'False'}),
|
||||
'portage_info': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
|
||||
'upstream_info': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
|
||||
'user': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['auth.User']", 'unique': 'True'})
|
||||
},
|
||||
'djeuscan.version': {
|
||||
'Meta': {'unique_together': "(['package', 'slot', 'revision', 'version', 'overlay'],)", 'object_name': 'Version'},
|
||||
'alive': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'db_index': 'True'}),
|
||||
'confidence': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
|
||||
'ebuild_path': ('django.db.models.fields.CharField', [], {'max_length': '256', 'blank': 'True'}),
|
||||
'handler': ('django.db.models.fields.CharField', [], {'max_length': '128', 'blank': 'True'}),
|
||||
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||
'metadata_path': ('django.db.models.fields.CharField', [], {'max_length': '256', 'blank': 'True'}),
|
||||
'overlay': ('django.db.models.fields.CharField', [], {'default': "'gentoo'", 'max_length': '128', 'db_index': 'True', 'blank': 'True'}),
|
||||
'package': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['djeuscan.Package']"}),
|
||||
'packaged': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
|
||||
'revision': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
|
||||
'slot': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '128', 'blank': 'True'}),
|
||||
'urls': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
|
||||
'version': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
|
||||
'vtype': ('django.db.models.fields.CharField', [], {'max_length': '128', 'blank': 'True'})
|
||||
},
|
||||
'djeuscan.versionlog': {
|
||||
'Meta': {'object_name': 'VersionLog'},
|
||||
'action': ('django.db.models.fields.IntegerField', [], {}),
|
||||
'datetime': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
|
||||
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||
'overlay': ('django.db.models.fields.CharField', [], {'default': "'gentoo'", 'max_length': '128', 'blank': 'True'}),
|
||||
'package': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['djeuscan.Package']"}),
|
||||
'packaged': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
|
||||
'revision': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
|
||||
'slot': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '128', 'blank': 'True'}),
|
||||
'version': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
|
||||
'vtype': ('django.db.models.fields.CharField', [], {'max_length': '128', 'blank': 'True'})
|
||||
},
|
||||
'djeuscan.worldlog': {
|
||||
'Meta': {'object_name': 'WorldLog', '_ormbases': ['djeuscan.Log']},
|
||||
'log_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['djeuscan.Log']", 'unique': 'True', 'primary_key': 'True'})
|
||||
}
|
||||
}
|
||||
|
||||
complete_apps = ['djeuscan']
|
@ -259,6 +259,9 @@ class UserProfile(models.Model):
|
||||
categories = models.ManyToManyField(Category)
|
||||
overlays = models.ManyToManyField(Overlay)
|
||||
|
||||
upstream_info = models.BooleanField(default=True)
|
||||
portage_info = models.BooleanField(default=False)
|
||||
|
||||
|
||||
class Log(models.Model):
|
||||
"""
|
||||
|
@ -5,6 +5,17 @@
|
||||
{{ block.super }} - Edit user preferences for {{ user }}
|
||||
{% endblock %}
|
||||
|
||||
{% block css %}
|
||||
{{ block.super }}
|
||||
<link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}css/toggle_buttons.css" media="screen" title="Normal" />
|
||||
{% endblock %}
|
||||
|
||||
{% block javascript %}
|
||||
{{ block.super }}
|
||||
<script type="text/javascript" language="javascript" src="{{STATIC_URL}}js/jquery.js"></script>
|
||||
<script type="text/javascript" language="javascript" src="{{STATIC_URL}}js/jquery.toggle.buttons.js"></script>
|
||||
{% endblock %}
|
||||
|
||||
|
||||
{% block content %}
|
||||
{% if updated %}
|
||||
@ -17,7 +28,7 @@
|
||||
Edit user preferences
|
||||
</h2>
|
||||
|
||||
<form method='post' action='.'>
|
||||
<form id="preferences_form" method='post' action='.'>
|
||||
{% csrf_token %}
|
||||
<table class="table">
|
||||
{{ form }}
|
||||
@ -29,4 +40,16 @@
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$("#preferences_form").find("input:checkbox").each(function () {
|
||||
var div = $("<div/>")
|
||||
, td = $(this).closest("td");
|
||||
$(this).remove();
|
||||
td.append(div.append($(this)));
|
||||
div.toggleButtons();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
@ -420,6 +420,8 @@ def accounts_index(request):
|
||||
@render_to('euscan/accounts/preferences.html')
|
||||
def accounts_preferences(request):
|
||||
user = request.user
|
||||
profile = get_profile(user)
|
||||
|
||||
updated = False
|
||||
if request.method == "POST":
|
||||
form = PreferencesForm(request.POST)
|
||||
@ -428,12 +430,20 @@ def accounts_preferences(request):
|
||||
user.last_name = form.cleaned_data["last_name"]
|
||||
user.email = form.cleaned_data["email"]
|
||||
user.save(force_update=True)
|
||||
|
||||
profile.upstream_info = form.cleaned_data["upstream_info"]
|
||||
profile.portage_info = form.cleaned_data["portage_info"]
|
||||
|
||||
profile.save(force_update=True)
|
||||
|
||||
updated = True
|
||||
else:
|
||||
initial_data = {
|
||||
"first_name": user.first_name,
|
||||
"last_name": user.last_name,
|
||||
"email": user.email
|
||||
"email": user.email,
|
||||
"upstream_info": profile.upstream_info,
|
||||
"portage_info": profile.portage_info,
|
||||
}
|
||||
form = PreferencesForm(initial_data)
|
||||
return {"form": form, "updated": updated}
|
||||
|
143
euscanwww/htdocs/css/toggle_buttons.css
Normal file
143
euscanwww/htdocs/css/toggle_buttons.css
Normal file
@ -0,0 +1,143 @@
|
||||
/* line 7, ../sass/screen.scss */
|
||||
.toggle-button {
|
||||
display: inline-block;
|
||||
cursor: pointer;
|
||||
background: #0088CC;
|
||||
background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #0088cc), color-stop(100%, #0055cc));
|
||||
background-image: -webkit-linear-gradient(top, #0088cc, #0055cc);
|
||||
background-image: -moz-linear-gradient(top, #0088cc, #0055cc);
|
||||
background-image: -o-linear-gradient(top, #0088cc, #0055cc);
|
||||
background-image: linear-gradient(top, #0088cc, #0055cc);
|
||||
-webkit-border-radius: 4px;
|
||||
-moz-border-radius: 4px;
|
||||
-ms-border-radius: 4px;
|
||||
-o-border-radius: 4px;
|
||||
border-radius: 4px;
|
||||
border: 1px solid;
|
||||
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
|
||||
position: relative;
|
||||
bottom: -2px;
|
||||
text-align: left;
|
||||
min-height: 25px;
|
||||
max-height: 25px;
|
||||
-webkit-touch-callout: none;
|
||||
-webkit-user-select: none;
|
||||
-khtml-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
/* line 29, ../sass/screen.scss */
|
||||
.toggle-button:before, .toggle-button:after {
|
||||
line-height: 25px;
|
||||
font-weight: bold;
|
||||
letter-spacing: .4px;
|
||||
}
|
||||
/* line 35, ../sass/screen.scss */
|
||||
.toggle-button:before {
|
||||
color: #fefefe;
|
||||
padding-left: 0%;
|
||||
margin-left: 10px;
|
||||
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.3);
|
||||
content: attr(data-enabled);
|
||||
}
|
||||
/* line 43, ../sass/screen.scss */
|
||||
.toggle-button.disabled {
|
||||
background: #fefefe;
|
||||
background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #fefefe), color-stop(100%, #e6e6e6));
|
||||
background-image: -webkit-linear-gradient(top, #fefefe, #e6e6e6);
|
||||
background-image: -moz-linear-gradient(top, #fefefe, #e6e6e6);
|
||||
background-image: -o-linear-gradient(top, #fefefe, #e6e6e6);
|
||||
background-image: linear-gradient(top, #fefefe, #e6e6e6);
|
||||
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
|
||||
}
|
||||
/* line 47, ../sass/screen.scss */
|
||||
.toggle-button.disabled:before {
|
||||
color: #555555;
|
||||
padding-left: 50%;
|
||||
margin-left: 10px;
|
||||
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.3);
|
||||
content: attr(data-disabled);
|
||||
}
|
||||
/* line 54, ../sass/screen.scss */
|
||||
.toggle-button.disabled label {
|
||||
margin-left: -1px;
|
||||
left: 0%;
|
||||
}
|
||||
/* line 60, ../sass/screen.scss */
|
||||
.toggle-button label {
|
||||
cursor: pointer;
|
||||
position: absolute;
|
||||
width: 50%;
|
||||
height: 25px;
|
||||
background: #fefefe;
|
||||
background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #fefefe), color-stop(100%, #e6e6e6));
|
||||
background-image: -webkit-linear-gradient(top, #fefefe, #e6e6e6);
|
||||
background-image: -moz-linear-gradient(top, #fefefe, #e6e6e6);
|
||||
background-image: -o-linear-gradient(top, #fefefe, #e6e6e6);
|
||||
background-image: linear-gradient(top, #fefefe, #e6e6e6);
|
||||
-webkit-border-radius: 4px;
|
||||
-moz-border-radius: 4px;
|
||||
-ms-border-radius: 4px;
|
||||
-o-border-radius: 4px;
|
||||
border-radius: 4px;
|
||||
border: 1px solid;
|
||||
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
|
||||
top: -1px;
|
||||
margin-left: 0;
|
||||
left: 50%;
|
||||
}
|
||||
/* line 75, ../sass/screen.scss */
|
||||
.toggle-button input[type=checkbox] {
|
||||
display: none;
|
||||
}
|
||||
/* line 84, ../sass/screen.scss */
|
||||
.toggle-button.primary:before, .toggle-button.info:before, .toggle-button.success:before, .toggle-button.warning:before, .toggle-button.danger:before {
|
||||
color: white;
|
||||
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
/* line 90, ../sass/screen.scss */
|
||||
.toggle-button.primary {
|
||||
background: #0088cc;
|
||||
background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #0088cc), color-stop(100%, #0055cc));
|
||||
background-image: -webkit-linear-gradient(top, #0088cc, #0055cc);
|
||||
background-image: -moz-linear-gradient(top, #0088cc, #0055cc);
|
||||
background-image: -o-linear-gradient(top, #0088cc, #0055cc);
|
||||
background-image: linear-gradient(top, #0088cc, #0055cc);
|
||||
}
|
||||
/* line 94, ../sass/screen.scss */
|
||||
.toggle-button.info {
|
||||
background: #5bc0de;
|
||||
background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #5bc0de), color-stop(100%, #2f96b4));
|
||||
background-image: -webkit-linear-gradient(top, #5bc0de, #2f96b4);
|
||||
background-image: -moz-linear-gradient(top, #5bc0de, #2f96b4);
|
||||
background-image: -o-linear-gradient(top, #5bc0de, #2f96b4);
|
||||
background-image: linear-gradient(top, #5bc0de, #2f96b4);
|
||||
}
|
||||
/* line 99, ../sass/screen.scss */
|
||||
.toggle-button.success {
|
||||
background: #62c462;
|
||||
background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #62c462), color-stop(100%, #51a351));
|
||||
background-image: -webkit-linear-gradient(top, #62c462, #51a351);
|
||||
background-image: -moz-linear-gradient(top, #62c462, #51a351);
|
||||
background-image: -o-linear-gradient(top, #62c462, #51a351);
|
||||
background-image: linear-gradient(top, #62c462, #51a351);
|
||||
}
|
||||
/* line 104, ../sass/screen.scss */
|
||||
.toggle-button.warning {
|
||||
background: #dbb450;
|
||||
background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #dbb450), color-stop(100%, #f89406));
|
||||
background-image: -webkit-linear-gradient(top, #dbb450, #f89406);
|
||||
background-image: -moz-linear-gradient(top, #dbb450, #f89406);
|
||||
background-image: -o-linear-gradient(top, #dbb450, #f89406);
|
||||
background-image: linear-gradient(top, #dbb450, #f89406);
|
||||
}
|
||||
/* line 109, ../sass/screen.scss */
|
||||
.toggle-button.danger {
|
||||
background: #ee5f5b;
|
||||
background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #ee5f5b), color-stop(100%, #bd362f));
|
||||
background-image: -webkit-linear-gradient(top, #ee5f5b, #bd362f);
|
||||
background-image: -moz-linear-gradient(top, #ee5f5b, #bd362f);
|
||||
background-image: -o-linear-gradient(top, #ee5f5b, #bd362f);
|
||||
background-image: linear-gradient(top, #ee5f5b, #bd362f);
|
||||
}
|
20
euscanwww/htdocs/js/jquery.js
vendored
20
euscanwww/htdocs/js/jquery.js
vendored
File diff suppressed because one or more lines are too long
105
euscanwww/htdocs/js/jquery.toggle.buttons.js
Normal file
105
euscanwww/htdocs/js/jquery.toggle.buttons.js
Normal file
@ -0,0 +1,105 @@
|
||||
!function ($) {
|
||||
"use strict";
|
||||
// version: 1.3
|
||||
|
||||
$.fn.toggleButtons = function (opt) {
|
||||
var $element
|
||||
, $labelEnabled
|
||||
, options
|
||||
, active
|
||||
, styleActive
|
||||
, styleDisabled
|
||||
, animationCss
|
||||
, transitionSpeed = 0.05
|
||||
, defaultSpeed = 0.05;
|
||||
|
||||
this.each(function () {
|
||||
$element = $(this);
|
||||
|
||||
options = $.extend({}, $.fn.toggleButtons.defaults, opt);
|
||||
|
||||
$element.addClass('toggle-button');
|
||||
|
||||
$labelEnabled = $('<label></label>').attr('for', $element.find('input').attr('id'));
|
||||
$element.append($labelEnabled);
|
||||
|
||||
if (options.animated) {
|
||||
$element.addClass('toggle-button-animated');
|
||||
|
||||
if (options.transitionSpeed !== undefined)
|
||||
if (/^(\d*%$)/.test(options.transitionSpeed)) // is a percent value?
|
||||
transitionSpeed = defaultSpeed * parseInt(options.transitionSpeed) / 100;
|
||||
else
|
||||
transitionSpeed = options.transitionSpeed;
|
||||
|
||||
animationCss = ["-webkit-", "-moz-", "-o-", ""];
|
||||
$(animationCss).each(function () {
|
||||
$element.find('label').css(this + 'transition', 'all ' + transitionSpeed + 's');
|
||||
});
|
||||
}
|
||||
|
||||
$element.css('width', options.width);
|
||||
|
||||
$element.attr("data-enabled", options.label.enabled === undefined ? "ON" : options.label.enabled);
|
||||
$element.attr("data-disabled", options.label.disabled === undefined ? "OFF " : options.label.disabled);
|
||||
|
||||
active = $element.find('input').is(':checked');
|
||||
|
||||
if (!active)
|
||||
$element.addClass('disabled');
|
||||
|
||||
styleActive = options.style.enabled === undefined ? "" : options.style.enabled;
|
||||
styleDisabled = options.style.disabled === undefined ? "" : options.style.disabled;
|
||||
|
||||
if (active && styleActive !== undefined)
|
||||
$element.addClass(styleActive);
|
||||
if (!active && styleDisabled !== undefined)
|
||||
$element.addClass(styleDisabled);
|
||||
|
||||
$element.on('click', function (e) {
|
||||
if ($(e.target).is('input'))
|
||||
return true;
|
||||
|
||||
e.stopPropagation();
|
||||
$(this).find('label').click();
|
||||
});
|
||||
|
||||
|
||||
$element.find('label').on('click', function (e) {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
|
||||
$element = $(this).parent();
|
||||
|
||||
$element
|
||||
.delay(transitionSpeed * 500).queue(function () {
|
||||
$(this).toggleClass('disabled')
|
||||
.toggleClass(styleActive)
|
||||
.toggleClass(styleDisabled)
|
||||
.dequeue();
|
||||
});
|
||||
|
||||
active = !($element.find('input').is(':checked'));
|
||||
|
||||
$element.find('input').attr('checked', active);
|
||||
options.onChange($element, active, e);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
$.fn.toggleButtons.defaults = {
|
||||
onChange: function () {
|
||||
},
|
||||
width: 100,
|
||||
animated: true,
|
||||
transitionSpeed: undefined,
|
||||
label: {
|
||||
enabled: undefined,
|
||||
disabled: undefined
|
||||
},
|
||||
style: {
|
||||
enabled: undefined,
|
||||
disabled: undefined
|
||||
}
|
||||
};
|
||||
}($);
|
Loading…
Reference in New Issue
Block a user