Skip to content

Commit

Permalink
Merge df2fe77 into 703adce
Browse files Browse the repository at this point in the history
  • Loading branch information
rmader committed Jul 16, 2019
2 parents 703adce + df2fe77 commit 419ffe9
Show file tree
Hide file tree
Showing 193 changed files with 173 additions and 121 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
modernizr-custom.js
16 changes: 14 additions & 2 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,19 @@
{
"extends": ["standard", "standard-jsx"],
"env": {
"browser": true,
"commonjs": true,
"es6": true,
"jquery": true
},
"extends": [
"standard",
"standard-jsx",
"plugin:jsx-a11y/recommended"
],
"rules": {
"jsx-quotes": [2, "prefer-double"]
},
"parser": "babel-eslint"
"plugins": [
"jsx-a11y"
]
}
4 changes: 4 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[flake8]
max-complexity = 10
ignore = D100,D101,D102,D103,D104,D105,D106,D107,D200,D202,D204,D205,D210,D400,D401,W503,W504
exclude = .git,__pycache__,*/migrations/*,*/settings/*
2 changes: 1 addition & 1 deletion .stylelintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"comment-empty-line-before": "always",
"indentation": 4,
"max-empty-lines": 2,
"max-nesting-depth": 2,
"max-nesting-depth": 3,
"no-extra-semicolons": true
},
"ignoreFiles": [
Expand Down
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,11 @@ lint:
$(VIRTUAL_ENV)/bin/isort -rc -c $(SOURCE_DIRS) --diff || EXIT_STATUS=$$?; \
$(VIRTUAL_ENV)/bin/flake8 $(SOURCE_DIRS) --exclude migrations,settings || EXIT_STATUS=$$?; \
npm run lint --silent || EXIT_STATUS=$$?; \
exit $${EXIT_STATUS}

.PHONY: check-migrations
check-migrations:
EXIT_STATUS=0; \
$(VIRTUAL_ENV)/bin/python manage.py makemigrations --dry-run --check --noinput || EXIT_STATUS=$$?; \
exit $${EXIT_STATUS}

Expand Down
4 changes: 2 additions & 2 deletions euth/blueprints/blueprints.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,9 @@ class Accessibility(BlueprintEnum):
)

COMPLEXITY_VECTOR_E = ComplexityVector(
participants=(0, 1/3),
participants=(0, 1 / 3),
duration=(0, 0),
scope=(0, 1/3)
scope=(0, 1 / 3)
)

COMPLEXITY_VECTOR_F = ComplexityVector(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@
var $this = $(this)
var name = $this.attr('name')

if (!radioButtonsByName.hasOwnProperty(name)) {
if (!Object.prototype.hasOwnProperty.call(radioButtonsByName, name)) {
radioButtonsByName[name] = $()
}

radioButtonsByName[name] = radioButtonsByName[name].add($this)
})

for (var key in radioButtonsByName) {
if (radioButtonsByName.hasOwnProperty(key)) {
if (Object.prototype.hasOwnProperty.call(radioButtonsByName, key)) {
var $inputs = radioButtonsByName[key]
if (!$inputs.filter(':checked').length) {
return false
Expand Down
12 changes: 5 additions & 7 deletions euth/blueprints/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,16 @@ def filter_blueprints(aim, result, experience, motivation,
continue

timeneeded = compute_time_needed(
blueprint, participants, duration, scope,
motivation, accessibility, experience
)
blueprint, participants, duration, scope,
motivation, accessibility, experience)
candidates.append((name, blueprint, timeneeded))

if not candidates:
name = fallbacks[aim]
blueprint = dict(options)[name]
timeneeded = compute_time_needed(
blueprint, participants, duration, scope,
motivation, accessibility, experience
)
blueprint, participants, duration, scope,
motivation, accessibility, experience)
candidates.append((name, blueprint, timeneeded))

return candidates
Expand All @@ -72,7 +70,7 @@ def compute_complexity(blueprint, participants, duration, scope):

def compute_mobilisation(motivation, accessibility):
# modify to match different coding for motivation
return custom_round((5 - motivation.value + accessibility.value)/2)
return custom_round((5 - motivation.value + accessibility.value) / 2)


def compute_time_needed(
Expand Down
3 changes: 3 additions & 0 deletions euth/contrib/api/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@

class AllowPUTAsCreateMixin(object):
"""
PUT-as-create mixin.
The following mixin class may be used in order to support PUT-as-create
behavior for incoming requests.
"""

def update(self, request, *args, **kwargs):
partial = kwargs.pop('partial', False)
instance = self.get_object_or_none()
Expand Down
1 change: 1 addition & 0 deletions euth/contrib/api/permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
class IsInitiatorOrSuperUser(permissions.BasePermission):
"""
Object-level permission to only allow owners of an object to edit it.
Assumes the model instance has an `owner` attribute.
"""

Expand Down
4 changes: 1 addition & 3 deletions euth/contrib/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ class ArchivedFilter(filters.DefaultsFilterSet):
}

is_archived = django_filters.BooleanFilter(
field_name='is_archived',
widget=ArchivedFilterWidget
)
field_name='is_archived', widget=ArchivedFilterWidget)

class Meta:
model = models.Project
Expand Down
2 changes: 1 addition & 1 deletion euth/contrib/static/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ var ReactLanguageSwitch = require('../../../dashboard/static/language_switch/rea
var ReactUserList = require('../../../dashboard/static/user_list/react_user_list.jsx')
var $ = window.jQuery = window.$ = require('jquery')

require('../../../../euth_wagtail/static/js/euth_wagtail')
require('../../../../euth_wagtail/assets/js/euth_wagtail')

var getCurrentPath = function () {
return location.pathname
Expand Down
2 changes: 1 addition & 1 deletion euth/documents/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
urlpatterns = [
url(r'^(?P<pk>\d+)/$', views.ParagraphDetailView.as_view(),
name='paragraph-detail'),
]
]
2 changes: 1 addition & 1 deletion euth/ideas/phases.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class UniversalPhase(phases.PhaseContent):
features = {
'crud': (models.Idea,),
'comment': (models.Idea,),
'rate': (models.Idea,),
'rate': (models.Idea,),
}


Expand Down
4 changes: 2 additions & 2 deletions euth/ideas/templatetags/idea_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ def get_range(number, listcount):
if number < 3:
return range(1, 6)
elif number > listcount - 2:
return range(listcount-4, listcount+1)
return range(listcount - 4, listcount + 1)
else:
return range(number-2, number+3)
return range(number - 2, number + 3)


@register.simple_tag
Expand Down
2 changes: 1 addition & 1 deletion euth/memberships/projects_urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
urlpatterns = [
url(r'^(?P<slug>[-\w_]+)/$', views.RequestsProjectDetailView.as_view(),
name='project-detail'),
]
]
2 changes: 1 addition & 1 deletion euth/memberships/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@
views.InviteUpdateView.as_view(),
name='membership-invite-update'
),
]
]
2 changes: 1 addition & 1 deletion euth/offlinephases/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
def validate_file_type_and_size(upload):

file_max_mb = 5
max_size = file_max_mb*10**6
max_size = file_max_mb * 10**6
fileformats = settings.FILE_ALIASES['*']['fileformats']
mimetypes = [mimetype for name, mimetype in fileformats]
names = [name for name, mimetype in fileformats]
Expand Down
19 changes: 10 additions & 9 deletions euth/projects/templatetags/time_delta_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ def seconds_in_units(seconds):
unit_totals = []

unit_limits = [
([_('week'), _('weeks')], 7 * 24 * 3600),
([_('day'), _('days')], 24 * 3600),
([_('hour'), _('hours')], 3600),
([_('minute'), _('minutes')], 60),
([_('second'), _('seconds')], 1)
]
([_('week'), _('weeks')], 7 * 24 * 3600),
([_('day'), _('days')], 24 * 3600),
([_('hour'), _('hours')], 3600),
([_('minute'), _('minutes')], 60),
([_('second'), _('seconds')], 1)
]

for unit_name, limit in unit_limits:
if seconds >= limit:
Expand All @@ -34,8 +34,9 @@ def seconds_in_units(seconds):
time_delta = time - timezone.now()
seconds = time_delta.total_seconds()
time_delta_list = seconds_in_units(seconds)
time_delta_str = (_('and')+(' ')).join([(str(val[1]) + ' ' +
str(val[0]) + ' ')
for val in time_delta_list[:2]])
time_delta_str = (_('and') +
(' ')).join([(str(val[1]) + ' ' +
str(val[0]) + ' ')
for val in time_delta_list[:2]])

return time_delta_str
8 changes: 5 additions & 3 deletions euth/users/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ class User(auth_models.AbstractBaseUser, auth_models.PermissionsMixin):
verbose_name=_('Time zone'),
max_length=100,
choices=[(t, t) for t in common_timezones]
)
)

objects = auth_models.UserManager()

Expand Down Expand Up @@ -184,13 +184,15 @@ def age(self):

def get_full_name(self):
"""
Returns the first_name plus the last_name, with a space in between.
Return the first_name plus the last_name, with a space in between.
"""
full_name = '%s <%s>' % (self.username, self.email)
return full_name.strip()

def get_short_name(self):
"Returns the short name for the user."
"""
Return the short name for the user.
"""
return self.username

def signup(self, username, email, timezone, commit=True):
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ const datePickerController = require('datepicker')
const django = require('django')

$(function () {
let $inputs = $('.datepicker')
const $inputs = $('.datepicker')

$inputs.each(function (i, e) {
let initObject = { formElements: {} }
const initObject = { formElements: {} }
initObject.formElements[e.id] = django.get_format('DATE_INPUT_FORMATS')[0]
datePickerController.createDatePicker(initObject)
})
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,4 @@
.panel-body {
@include rem(padding, 0 22px 22px 22px);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.dashboard-left-nav {

.list-group{
.list-group {
background-color: $gray-lighter;
padding: 10px 10px 20px 10px;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

.dropdown {
color: white;

}

.nav-tabs {
Expand Down Expand Up @@ -58,7 +57,7 @@
margin-top: 40px;
}

.dashboard-content-header::after {
.dashboard-content-header:after {
display: block;
content: "";
clear: both;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
border-top-right-radius: 0.3em;
border-bottom-right-radius: 0.3em;
}

@extend .btn;
@extend .btn--light;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
margin-bottom: 1em;
position: relative;

input[type=checkbox]:checked + span {
font-weight: bold;
input[type="checkbox"]:checked + span {
font-weight: bold;
}
input[type=radio]:checked + span {
font-weight: bold;
input[type="radio"]:checked + span {
font-weight: bold;
}
}
.poll__actions {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,3 @@
@include select-state;
}


File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 419ffe9

Please sign in to comment.