Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
27b9ba6
Merge branch 'develop' of https://github.com/prjts/openbudgets into d…
Tudmotu Dec 23, 2013
6f3e3a5
Merge branch 'develop' of https://github.com/prjts/openbudgets into d…
Tudmotu Jan 13, 2014
877e8e6
BREAKING; Removed vendor dir.
Tudmotu Feb 3, 2014
975919e
Added bower files.
Tudmotu Feb 3, 2014
154a93f
STILL BREAKING; Added new bower deps.
Tudmotu Feb 3, 2014
7a62df1
idos tired commit
idoivri Feb 7, 2014
07e736b
fix
idoivri Feb 7, 2014
de224fd
Fixed jqScroll and setImmediate dependencies.
Tudmotu Feb 7, 2014
f60101e
Migrated all files [hopefully] to use the new dir structure of bower.
Tudmotu Feb 7, 2014
6a71cc2
Merge branch 'develop' of https://github.com/hasadna/omuni-budget int…
Tudmotu Feb 7, 2014
8dc9189
Merge branch 'develop' into feature/volo-to-bower
Tudmotu Feb 7, 2014
9cd4dd7
fix 355
dovp Feb 7, 2014
234cd85
fix 166 - Home page design implementation
dovp Feb 7, 2014
2358b76
Added social auth...
Feb 7, 2014
d83e4d8
Added requirements, removed unneeded imports from exception middlewar…
Feb 7, 2014
f941e4d
Added strict unique email constraint
Feb 10, 2014
69a839b
Removed break point
Feb 10, 2014
2ad75db
Added message param
Feb 10, 2014
7d4b614
Type fix, paramaterized unique email excpetion
Feb 10, 2014
eefeeaf
Reset requirements to project's default + django-social-auth 0.7.28
Feb 11, 2014
95000c8
Removed uneeded balnk spaces, and a markup error
Feb 11, 2014
61f7512
Some more aliasing and shim fixes.
Tudmotu Feb 16, 2014
a68a8d7
Added alias for spin.js.
Tudmotu Feb 16, 2014
4074506
Merge branch 'develop' of https://github.com/hasadna/omuni-budget int…
Tudmotu Feb 16, 2014
6fc8016
Merge pull request #403 from idoivri/develop
pwalsh Mar 7, 2014
abeb563
Merge pull request #404 from dovp/develop
pwalsh Mar 7, 2014
05ef643
Last enhancements towrds a merge
Mar 9, 2014
fb1ee77
added an explanation about social credentials
Mar 9, 2014
ac18294
Cleaned up and updated JS dependencies
ydaniv Mar 11, 2014
ee71430
Updated uijet to 0.0.34
ydaniv Mar 11, 2014
9a5c366
Fixed explorer app to use updated dependencies
ydaniv Mar 11, 2014
650f643
Updated JS dependencies
ydaniv Mar 11, 2014
9c3c79b
Merge branch 'develop' of https://github.com/hasadna/openmuni-budgets…
ydaniv Mar 11, 2014
66cd83e
Updated processed base css files
ydaniv Mar 11, 2014
1441faf
Update requirements.txt
pwalsh Mar 17, 2014
6749cd0
Making the pattern to loading local.py much easier so it is on by def…
pwalsh Mar 17, 2014
3faba06
Merge branch 'develop' of https://bitbucket.org/pwalsh/openbudgets in…
pwalsh Mar 17, 2014
f0b76ea
clean
pwalsh Mar 17, 2014
841760f
Merge branch 'develop' of github.com:hasadna/openmuni-budgets into de…
pwalsh Mar 17, 2014
44d074e
Merge branch 'social_auth' of github.com:BeOleg/openmuni-budgets into…
Mar 24, 2014
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 3 additions & 0 deletions .bowerrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"directory": "./openbudgets/commons/static/vendor"
}
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
*.pyc
.coverage
openbudgets/settings/deploy.py
openbudgets/settings/local.py
fabfile/sensitive.yaml
docs/_build
docs/_static
Expand Down
24 changes: 24 additions & 0 deletions bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "openmuni-budgets",
"version": "0.0.1",
"dependencies": {
"uijet": "~0.0.30",
"eventbox": "~0.1.2",
"mustache": "0.7.3",
"jquery": "~2.1.0",
"adaptabl": "latest",
"jquery-mousewheel": "~3.1.3",
"jqScroll": "ydaniv/jqScroll",
"spin": "spinjs#~1.3.3",
"requirejs": "~2.1.11",
"q": "~1.0.0",
"backbone": "amdjs/backbone#~1.1.0",
"setImmediate": "git://github.com/NobleJS/setImmediate.git#1.0.1",
"backbone-fetch-cache": "~1.4.0",
"d3": "~3.4.1",
"underscore": "lodash#~2.4.1"
},
"resolutions": {
"jquery": "~2.1.0"
}
}
7 changes: 2 additions & 5 deletions docs/guide/start.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ Start

.. image:: https://coveralls.io/repos/prjts/openbudgets/badge.png?branch=develop
:alt: Coverage Status
:target: https://coveralls.io/r/prjts/openbudgets?branch=develop

:target: https://coveralls.io/r/prjts/openbudgets?branch=developboo

Open Budgets is a web app and web API for storing, accessing, visualizing and comparing budgetary data.

Expand All @@ -25,13 +24,11 @@ Server

The server is written in Python using Django and Django REST Framework.


Client
------

The client is written in Javascript makes use of Uijet, Backbone, JQuery, and D3.


System requirements
===================

Expand Down Expand Up @@ -371,7 +368,7 @@ Ok, so contining, let's bootstrap the environment. Run the following commands::
fab e local.db.createuser

# build out the project
fab e local.bootstrap:initial=yes
fab e local.bootstrap:initial=yes

Now, Let's start the server:

Expand Down
7 changes: 7 additions & 0 deletions openbudgets/apps/accounts/middleware.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from social_auth.middleware import SocialAuthExceptionMiddleware
from django.conf import settings


class OpenBudgetsSocialAuthExceptionMiddleware(SocialAuthExceptionMiddleware):
def get_redirect_uri(self, request, exception):
return settings.LOGIN_URL
7 changes: 7 additions & 0 deletions openbudgets/apps/accounts/social_exceptions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from social_auth.exceptions import SocialAuthBaseException
from django.utils.translation import ugettext as _


class NonIdenticalEmailAddress(SocialAuthBaseException):
def __unicode__(self):
return _(u'Identical email error: {message}').format(message=self.message)
56 changes: 56 additions & 0 deletions openbudgets/apps/accounts/social_pipeline.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
from django.core.exceptions import MultipleObjectsReturned, ObjectDoesNotExist
from django.utils.translation import ugettext
from social_auth.models import UserSocialAuth
from .models import Account
from social_auth.exceptions import AuthException
from social_exceptions import NonIdenticalEmailAddress


def associate_by_email(details, user=None, *args, **kwargs):
"""Return user entry with same email address as one returned on details."""
email = details.get('email', None)

if user and user.email == email:
return None
elif not email or (user and user.email != email):
msg = ugettext('Social email address and account email ' +
'address must be idnetical')
raise NonIdenticalEmailAddress(msg)
if email:
# Try to associate accounts registered with the same email address,
# only if it's a single object. AuthException is raised if multiple
# objects are returned.
try:
return {'user': UserSocialAuth.get_user_by_email(email=email)}
except MultipleObjectsReturned:
raise AuthException(kwargs['backend'], 'Not unique email address.')
except ObjectDoesNotExist:
pass


def create_user(backend, details, response, uid, username, user=None, *args,
**kwargs):
"""Create user. Depends on get_username pipeline."""
if user:
return {'user': user}
if not username:
return None

# Avoid hitting field max length
email = details.get('email')
original_email = None
if email and UserSocialAuth.email_max_length() < len(email):
original_email = email
email = ''
first_name = details.get('first_name', 'John')
last_name = details.get('last_name', 'Doe')
password = Account.objects.make_random_password()

return {
'user': UserSocialAuth.create_user(username=username, email=email,
first_name=first_name,
last_name=last_name,
password=password),
'original_email': original_email,
'is_new': True
}
14 changes: 13 additions & 1 deletion openbudgets/apps/accounts/templates/accounts/account_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,19 @@
</div>
</div>


<div class="social-accounts">
{% for provider,account in social_auth.items %}
{% if account and provider %}
<div class="account">
<form method="POST" action="{% url "socialauth_disconnect_individual" provider account.id %}"
class="social-revoke-form">
{% csrf_token %}
<input type="submit" class="social-revoke-control" value="-"> {{ provider }}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@BeOleg <input> is a non-content element. Perhaps it would be better to replace it with a <button> tag and put the {{ provider }} as its content?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea is to have a - sign side by side with the network's name, to symbolize the revoke of the credentials of this certain network.

Same thing can be achieved by placing {{provider}} in the 'value' attribute of the input element, a button element will work as well, as long as it's has a type='submit' attribute, since I only accept POST request to the credentials revoke resource to prevent XSS.

Wanted to enhance the design of this entire thing, but frankly could not figure out which less file applies to this section :(

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't worry abut UI behaviour, until we do new UI work with Ran.

</form>
</div>
{% endif %}
{% endfor %}
</div>



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

<div class="account{% if user.is_authenticated %} auth{% endif %}">
{% if user.is_authenticated %}
<div class="dead-area-catcher"></div>
<a class="avatar" href="{% url 'account_detail' user.uuid %}"><img src="{{ user.avatar }}" /></a>
<div class="name">
{{ user.first_name }}
Expand Down
1 change: 1 addition & 0 deletions openbudgets/apps/accounts/urls/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

urlpatterns = patterns('',


url(r'^activate/complete/$',
TemplateView.as_view(template_name='registration/activation_complete.html'),
name='registration_activation_complete'),
Expand Down
2 changes: 1 addition & 1 deletion openbudgets/apps/accounts/views/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
CustomRegistrationForm, CustomAuthenticationForm, CustomPasswordChangeForm,\
CustomPasswordResetForm
from openbudgets.commons.mixins.views import UserDataObjectMixin, JSONResponseMixin
from django.contrib.messages import get_messages


class AccountDetailView(LoginRequiredMixin, UserDataObjectMixin, DetailView):
Expand Down Expand Up @@ -153,7 +154,6 @@ def account_login(request, template_name='registration/login.html',
redirect_field_name=REDIRECT_FIELD_NAME,
authentication_form=CustomAuthenticationForm,
current_app=None, extra_context=None):

redirect_to = request.REQUEST.get(redirect_field_name, '')

if request.method == "POST":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ define([

return this.publish('scope_changed', item_model);
},
setScope : function (scope) {
setScope : function (scope){
scope = scope || null;
if ( scope !== this.scope ) {
this.scope = scope;
if ( this.has_data ) {
if ( this.resource.length ) {
this._publishScope();
}
else {
Expand All @@ -52,21 +52,21 @@ define([
}
return this;
},
redraw : function (scope) {
var filter = this.active_filters ?
this.resource.byAncestor :
this.resource.byParent;
this.setScope(scope);
return this.filter(filter, this.scope)
.render();
},
// redraw : function (scope) {
// var filter = this.active_filters ?
// this.resource.byAncestor :
// this.resource.byParent;
// this.setScope(scope);
// return this.filter(filter, this.scope)
// .render();
// },
sortItems : function (data) {
var sorting_key = (data.desc ? '-' : '') + data.column,
is_comparator_function = uijet.utils.isFunc(this.options.sorting[sorting_key]);
this.desc = data.desc;
this.sort(sorting_key);

if ( this.has_data ) {
if ( this.resource.length ) {
if ( ! this.filtered ) {
this.filtered = this.resource.models;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
@import url(http://fonts.googleapis.com/css?family=Alef:400,700);
@import url(http://fonts.googleapis.com/earlyaccess/alefhebrew.css);

@import url('/static/vendor/uijet/uijet.css');
@import url('/static/vendor/uijet/src/uijet.css');
@import url('globals.css');
@import url('right.css');
@import url('main-section.css');
Expand Down
48 changes: 31 additions & 17 deletions openbudgets/apps/entities/static/entities/explorer/main.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,40 @@
requirejs.config({
baseUrl : '/static/vendor',
paths : {
jqscroll : 'jqScroll/jqscroll',
'jquery.mousewheel' : 'jquery-mousewheel',
uijet_dir : 'uijet',
widgets : 'uijet/widgets',
composites : 'uijet/composites',
modules : 'uijet/modules',
explorer : '../entities/explorer/explorer',
ui : '../entities/explorer/ui',
resources : '../entities/explorer/resources',
controllers : '../entities/explorer/controllers',
project_modules : '../entities/explorer/modules',
project_widgets : '../entities/explorer/widgets',
project_mixins : '../entities/explorer/mixins',
dictionary : '../entities/explorer/dictionary',
api : '../src/api',
i18n : '../src/i18n'
jquery : 'jquery/dist/jquery',
jqscroll : 'jqScroll/jqscroll',
'jquery.mousewheel' : 'jquery-mousewheel/jquery.mousewheel',
backbone : 'backbone/backbone',
'backbone-fetch-cache' : 'backbone-fetch-cache/backbone.fetch-cache',
d3 : 'd3/d3',
underscore : 'underscore/dist/lodash.underscore',
mustache : 'mustache/mustache',
q : 'q/q',
spin : 'spin/spin',
setImmediate : 'setImmediate/setImmediate',
eventbox : 'eventbox/eventbox',
uijet_dir : 'uijet/src',
widgets : 'uijet/src/widgets',
composites : 'uijet/src/composites',
modules : 'uijet/src/modules',
explorer : '../entities/explorer/explorer',
ui : '../entities/explorer/ui',
resources : '../entities/explorer/resources',
controllers : '../entities/explorer/controllers',
project_modules : '../entities/explorer/modules',
project_widgets : '../entities/explorer/widgets',
project_mixins : '../entities/explorer/mixins',
dictionary : '../entities/explorer/dictionary',
api : '../src/api',
i18n : '../src/i18n'
},
shim : {
eventbox : ['setImmediate'],
'backbone-fetch-cache' : 'modules/data/backbone'
'backbone-fetch-cache' : 'modules/data/backbone',
backbone : {
deps: ['underscore', 'jquery'],
exports: 'Backbone'
}
}
});
requirejs([
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{{/stache}}

{{^stache}}
{{#.}}
{{#Breadcrumbs}}
<li data-id="{{attributes.node}}">{{attributes.name}}</li>
{{/.}}
{{/Breadcrumbs}}
{{/stache}}
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@
{{/stache}}

{{^stache}}
{{#.}}
{{#attributes}}
<li data-id="{{node}}" data-item="{{id}}" {{#leaf_item}}data-leaf{{/leaf_item}}>
<span class="item_cell item_cell_type"></span><span
class="item_cell item_cell_code">{{code}}</span><span
class="item_cell item_cell_name">{{name}}</span><span
class="item_cell item_cell_direction">{{direction}}</span><span
class="item_cell item_cell_budget amount{{#is_empty}}{{budget}}{{/is_empty}}">{{#commas}}{{budget}}{{/commas}}</span><span
class="item_cell item_cell_actual amount{{#is_empty}}{{actual}}{{/is_empty}}">{{#commas}}{{actual}}{{/commas}}</span><span
class="item_cell item_cell_comment"><span class="td_filler">
<span class="item_comment_button {{#has_comments}}has_comments{{/has_comments}}">{{comment_count}}</span>
</span></span>
</li>
{{/attributes}}
{{/.}}
{{#LatestSheet}}
{{#attributes}}
<li data-id="{{node}}" data-item="{{id}}" {{#leaf_item}}data-leaf{{/leaf_item}}>
<span class="item_cell item_cell_type"></span><span
class="item_cell item_cell_code">{{code}}</span><span
class="item_cell item_cell_name">{{name}}</span><span
class="item_cell item_cell_direction">{{direction}}</span><span
class="item_cell item_cell_budget amount{{#is_empty}}{{budget}}{{/is_empty}}">{{#commas}}{{budget}}{{/commas}}</span><span
class="item_cell item_cell_actual amount{{#is_empty}}{{actual}}{{/is_empty}}">{{#commas}}{{actual}}{{/commas}}</span><span
class="item_cell item_cell_comment"><span class="td_filler">
<span class="item_comment_button {{#has_comments}}has_comments{{/has_comments}}">{{comment_count}}</span>
</span></span>
</li>
{{/attributes}}
{{/LatestSheet}}
{{/stache}}
Loading