Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
MOOC packages by hacklab
django-courses-legacy
Commits
4afdffa1
Commit
4afdffa1
authored
6 years ago
by
Bruno Martin
Browse files
Options
Download
Email Patches
Plain Diff
remove django from change app name
parent
02fd921f
Changes
25
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
197 additions
and
18 deletions
+197
-18
CONTRIBUTING.rst
CONTRIBUTING.rst
+2
-2
MANIFEST.in
MANIFEST.in
+1
-1
Makefile
Makefile
+3
-3
README.rst
README.rst
+3
-3
courses_legacy/__init__.py
courses_legacy/__init__.py
+0
-0
courses_legacy/apps.py
courses_legacy/apps.py
+6
-0
courses_legacy/models.py
courses_legacy/models.py
+0
-0
courses_legacy/static/css/django_courses_legacy.css
courses_legacy/static/css/django_courses_legacy.css
+0
-0
courses_legacy/static/img/.gitignore
courses_legacy/static/img/.gitignore
+0
-0
courses_legacy/static/js/notes/app.js
courses_legacy/static/js/notes/app.js
+14
-0
courses_legacy/static/js/notes/controllers.js
courses_legacy/static/js/notes/controllers.js
+127
-0
courses_legacy/static/js/notes/services.js
courses_legacy/static/js/notes/services.js
+20
-0
courses_legacy/templates/django_courses_legacy/base.html
courses_legacy/templates/django_courses_legacy/base.html
+0
-0
courses_legacy/urls.py
courses_legacy/urls.py
+1
-1
courses_legacy/utils.py
courses_legacy/utils.py
+12
-0
courses_legacy/views.py
courses_legacy/views.py
+0
-0
django_courses_legacy/static/js/django_courses_legacy.js
django_courses_legacy/static/js/django_courses_legacy.js
+0
-0
docs/conf.py
docs/conf.py
+3
-3
docs/usage.rst
docs/usage.rst
+3
-3
setup.cfg
setup.cfg
+2
-2
No files found.
CONTRIBUTING.rst
View file @
4afdffa1
...
...
@@ -77,7 +77,7 @@ Ready to contribute? Here's how to set up `django-courses-legacy` for local deve
5. When you're done making changes, check that your changes pass flake8 and the
tests, including testing other Python versions with tox::
$ flake8
django_
courses_legacy tests
$ flake8 courses_legacy tests
$ python setup.py test
$ tox
...
...
@@ -109,4 +109,4 @@ Tips
To run a subset of tests::
$ python -m unittest tests.test_
django_
courses_legacy
$ python -m unittest tests.test_courses_legacy
This diff is collapsed.
Click to expand it.
MANIFEST.in
View file @
4afdffa1
...
...
@@ -3,4 +3,4 @@ include CONTRIBUTING.rst
include HISTORY.rst
include LICENSE
include README.rst
recursive-include
django_
courses_legacy *.html *.png *.gif *js *.css *jpg *jpeg *svg *py
recursive-include courses_legacy *.html *.png *.gif *js *.css *jpg *jpeg *svg *py
This diff is collapsed.
Click to expand it.
Makefile
View file @
4afdffa1
...
...
@@ -28,7 +28,7 @@ clean-pyc: ## remove Python file artifacts
find
.
-name
'*~'
-exec
rm
-f
{}
+
lint
:
##
check style with flake8
flake8
django_
courses_legacy tests
flake8 courses_legacy tests
test
:
##
run tests quickly with the default Python
python runtests.py tests
...
...
@@ -37,7 +37,7 @@ test-all: ## run tests on every Python version with tox
tox
coverage
:
##
check code coverage quickly with the default Python
coverage run
--source
django_
courses_legacy runtests.py tests
coverage run
--source
courses_legacy runtests.py tests
coverage report
-m
coverage html
open htmlcov/index.html
...
...
@@ -45,7 +45,7 @@ coverage: ## check code coverage quickly with the default Python
docs
:
##
generate Sphinx HTML documentation
,
including API docs
rm
-f
docs/django-courses-legacy.rst
rm
-f
docs/modules.rst
sphinx-apidoc
-o
docs/
django_
courses_legacy
sphinx-apidoc
-o
docs/ courses_legacy
$(MAKE)
-C
docs clean
$(MAKE)
-C
docs html
$(BROWSER)
docs/_build/html/index.html
...
...
This diff is collapsed.
Click to expand it.
README.rst
View file @
4afdffa1
...
...
@@ -31,7 +31,7 @@ Add it to your `INSTALLED_APPS`:
INSTALLED_APPS = (
...
'
django_
courses_legacy.apps.
Django
CoursesLegacyConfig',
'courses_legacy.apps.CoursesLegacyConfig',
...
)
...
...
@@ -39,12 +39,12 @@ Add Django Courses Legacy's URL patterns:
.. code-block:: python
from
django_
courses_legacy import urls as
django_
courses_legacy_urls
from courses_legacy import urls as courses_legacy_urls
urlpatterns = [
...
url(r'^', include(
django_
courses_legacy_urls)),
url(r'^', include(courses_legacy_urls)),
...
]
...
...
This diff is collapsed.
Click to expand it.
django_
courses_legacy/__init__.py
→
courses_legacy/__init__.py
View file @
4afdffa1
File moved
This diff is collapsed.
Click to expand it.
django_
courses_legacy/apps.py
→
courses_legacy/apps.py
View file @
4afdffa1
...
...
@@ -2,5 +2,5 @@
from
django.apps
import
AppConfig
class
Django
CoursesLegacyConfig
(
AppConfig
):
name
=
'
django_
courses_legacy'
class
CoursesLegacyConfig
(
AppConfig
):
name
=
'courses_legacy'
This diff is collapsed.
Click to expand it.
django_
courses_legacy/models.py
→
courses_legacy/models.py
View file @
4afdffa1
File moved
This diff is collapsed.
Click to expand it.
django_
courses_legacy/static/css/django_courses_legacy.css
→
courses_legacy/static/css/django_courses_legacy.css
View file @
4afdffa1
File moved
This diff is collapsed.
Click to expand it.
django_
courses_legacy/static/img/.gitignore
→
courses_legacy/static/img/.gitignore
View file @
4afdffa1
File moved
This diff is collapsed.
Click to expand it.
courses_legacy/static/js/notes/app.js
0 → 100644
View file @
4afdffa1
(
function
(
angular
)
{
'
use strict
'
;
// Declare app level module which depends on filters, and services
angular
.
module
(
'
notes
'
,
[
'
notes.controllers
'
,
'
notes.services
'
,
'
django
'
,
'
header
'
,
'
gettext
'
,
'
ui.bootstrap
'
,
]);
})(
angular
);
This diff is collapsed.
Click to expand it.
courses_legacy/static/js/notes/controllers.js
0 → 100644
View file @
4afdffa1
(
function
(
angular
)
{
'
use strict
'
;
/* Controllers */
angular
.
module
(
'
notes.controllers
'
,
[]).
controller
(
'
NoteCtrl
'
,
[
'
$scope
'
,
'
$window
'
,
'
$location
'
,
'
LessonData
'
,
'
Note
'
,
function
(
$scope
,
$window
,
$location
,
LessonData
,
Note
)
{
$scope
.
show_notes
=
false
;
$scope
.
save_note
=
function
()
{
var
promisse
;
$scope
.
note
.
text
=
$scope
.
note_text
;
if
(
$scope
.
note
.
id
)
{
promisse
=
$scope
.
note
.
$update
({
note_id
:
$scope
.
note
.
id
});
}
else
{
promisse
=
$scope
.
note
.
$save
();
}
promisse
.
then
(
function
()
{
$
(
'
.notes.message.success
'
).
show
().
delay
(
2000
).
fadeOut
();
}).
catch
(
function
()
{
$
(
'
.notes.message.failure
'
).
show
().
delay
(
2000
).
fadeOut
();
});
};
function
load_note
()
{
LessonData
.
then
(
function
(
lesson
)
{
$scope
.
currentUnit
.
$promise
.
then
(
function
()
{
var
currentUnitId
=
$scope
.
currentUnit
.
id
;
$scope
.
currentUnitPos
=
$scope
.
findUnitPos
(
$scope
.
currentUnit
);
Note
.
get
({
content_type
:
window
.
unit_content_type_id
,
object_id
:
currentUnitId
},
function
(
notes
)
{
if
(
notes
.
length
>
0
){
$scope
.
note
=
notes
[
0
];
}
else
{
$scope
.
note
=
new
Note
();
$scope
.
note
.
content_type
=
window
.
unit_content_type_id
;
$scope
.
note
.
object_id
=
currentUnitId
;
}
$scope
.
note_text
=
$scope
.
note
.
text
;
});
});
});
}
var
prevUnitPos
=
$scope
.
currentUnitPos
;
$scope
.
$watch
(
function
()
{
return
$location
.
path
();
},
function
(){
if
(
prevUnitPos
!=
$scope
.
currentUnitPos
)
{
load_note
();
prevUnitPos
=
$scope
.
currentUnitPos
;
}
});
load_note
();
$scope
.
$on
(
'
$locationChangeStart
'
,
function
(
event
,
newVal
,
oldVal
)
{
if
(
$scope
.
note
&&
$scope
.
note
.
text
!=
$scope
.
note_text
)
$scope
.
save_note
();
});
}]).
controller
(
'
CourseNotesCtrl
'
,
[
'
$scope
'
,
'
$window
'
,
'
CourseUserNotes
'
,
'
Note
'
,
function
(
$scope
,
$window
,
CourseUserNotes
,
Note
)
{
var
course_slug
=
$window
.
location
.
pathname
.
split
(
'
/
'
)[
2
];
CourseUserNotes
.
query
({
course_slug
:
course_slug
},
function
(
lessons
){
function
compare
(
a
,
b
)
{
if
(
a
.
position
<
b
.
position
)
return
-
1
;
if
(
a
.
position
>
b
.
position
)
return
1
;
return
0
;
}
lessons
.
sort
(
compare
);
angular
.
forEach
(
lessons
,
function
(
lesson
)
{
lesson
.
units_notes
.
sort
(
compare
);
});
$scope
.
lessons
=
lessons
;
});
$scope
.
delele_note
=
function
(
course
,
lesson
,
unit
,
note
)
{
if
(
!
confirm
(
'
Tem certeza que deseja remover esta anotação?
'
))
return
;
Note
.
remove
({
note_id
:
note
.
id
},
function
(){
var
index
;
if
(
lesson
.
units_notes
.
length
>
1
)
{
index
=
lesson
.
units_notes
.
indexOf
(
unit
);
lesson
.
units_notes
.
splice
(
index
,
1
);
}
else
{
index
=
$scope
.
lessons
.
indexOf
(
lesson
);
$scope
.
lessons
.
splice
(
index
,
1
);
}
});
};
}]).
controller
(
'
UserNotesCtrl
'
,
[
'
$scope
'
,
'
$window
'
,
'
UserNotes
'
,
'
Note
'
,
function
(
$scope
,
$window
,
UserNotes
,
Note
)
{
function
compare
(
a
,
b
)
{
if
(
a
.
position
<
b
.
position
)
return
-
1
;
if
(
a
.
position
>
b
.
position
)
return
1
;
return
0
;
}
UserNotes
.
query
({},
function
(
courses
){
angular
.
forEach
(
courses
,
function
(
course
)
{
course
.
lessons_notes
.
sort
(
compare
);
angular
.
forEach
(
course
.
lessons_notes
,
function
(
lesson
)
{
lesson
.
units_notes
.
sort
(
compare
);
});
});
$scope
.
courses
=
courses
;
});
$scope
.
delele_note
=
function
(
course
,
lesson
,
unit
,
note
)
{
if
(
!
confirm
(
'
Tem certeza que deseja remover esta anotação?
'
))
return
;
Note
.
remove
({
note_id
:
note
.
id
},
function
(){
var
index
;
if
(
lesson
.
units_notes
.
length
>
1
)
{
index
=
lesson
.
units_notes
.
indexOf
(
unit
);
lesson
.
units_notes
.
splice
(
index
,
1
);
}
else
{
index
=
course
.
lessons_notes
.
indexOf
(
lesson
);
course
.
lessons_notes
.
splice
(
index
,
1
);
}
course
.
course_notes_number
-=
1
;
});
};
}]);
})(
angular
);
This diff is collapsed.
Click to expand it.
courses_legacy/static/js/notes/services.js
0 → 100644
View file @
4afdffa1
(
function
(
angular
)
{
'
use strict
'
;
/* Services */
angular
.
module
(
'
notes.services
'
,
[
'
ngResource
'
]).
factory
(
'
Note
'
,
function
(
$resource
){
return
$resource
(
'
/api/note/:note_id
'
,
{},
{
update
:
{
method
:
'
PUT
'
},
get
:
{
method
:
'
GET
'
,
isArray
:
true
}
});
}).
factory
(
'
CourseUserNotes
'
,
function
(
$resource
){
return
$resource
(
'
/api/user_notes/:course_slug
'
,
{},
{
});
}).
factory
(
'
UserNotes
'
,
function
(
$resource
){
return
$resource
(
'
/api/user_notes/
'
,
{},
{
});
});
})(
angular
);
This diff is collapsed.
Click to expand it.
django_
courses_legacy/templates/django_courses_legacy/base.html
→
courses_legacy/templates/django_courses_legacy/base.html
View file @
4afdffa1
File moved
This diff is collapsed.
Click to expand it.
django_
courses_legacy/urls.py
→
courses_legacy/urls.py
View file @
4afdffa1
...
...
@@ -5,7 +5,7 @@ from django.views.generic import TemplateView
from
.
import
views
app_name
=
'
django_
courses_legacy'
app_name
=
'courses_legacy'
urlpatterns
=
[
url
(
r
''
,
TemplateView
.
as_view
(
template_name
=
"base.html"
)),
]
This diff is collapsed.
Click to expand it.
courses_legacy/utils.py
0 → 100644
View file @
4afdffa1
from
django.conf
import
settings
from
django.urls
import
reverse_lazy
from
braces.views._access
import
AccessMixin
from
django.shortcuts
import
redirect
class
AcceptedTermsRequiredMixin
(
AccessMixin
):
"""Verify that the current user has accepted Terms of Service."""
def
dispatch
(
self
,
request
,
*
args
,
**
kwargs
):
if
not
self
.
request
.
user
.
accepted_terms
and
settings
.
TERMS_ACCEPTANCE_REQUIRED
:
return
redirect
(
reverse_lazy
(
'accept_terms'
))
return
super
(
AcceptedTermsRequiredMixin
,
self
).
dispatch
(
request
,
*
args
,
**
kwargs
)
This diff is collapsed.
Click to expand it.
django_
courses_legacy/views.py
→
courses_legacy/views.py
View file @
4afdffa1
File moved
This diff is collapsed.
Click to expand it.
django_courses_legacy/static/js/django_courses_legacy.js
deleted
100644 → 0
View file @
02fd921f
This diff is collapsed.
Click to expand it.
docs/conf.py
View file @
4afdffa1
...
...
@@ -22,7 +22,7 @@ cwd = os.getcwd()
parent
=
os
.
path
.
dirname
(
cwd
)
sys
.
path
.
append
(
parent
)
import
django_
courses_legacy
import
courses_legacy
# -- General configuration -----------------------------------------------------
...
...
@@ -54,9 +54,9 @@ copyright = u'2019, hacklab/'
# built documents.
#
# The short X.Y version.
version
=
django_
courses_legacy
.
__version__
version
=
courses_legacy
.
__version__
# The full version, including alpha/beta/rc tags.
release
=
django_
courses_legacy
.
__version__
release
=
courses_legacy
.
__version__
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
...
...
This diff is collapsed.
Click to expand it.
docs/usage.rst
View file @
4afdffa1
...
...
@@ -8,7 +8,7 @@ To use Django Courses Legacy in a project, add it to your `INSTALLED_APPS`:
INSTALLED_APPS = (
...
'
django_
courses_legacy.apps.
Django
CoursesLegacyConfig',
'courses_legacy.apps.CoursesLegacyConfig',
...
)
...
...
@@ -16,11 +16,11 @@ Add Django Courses Legacy's URL patterns:
.. code-block:: python
from
django_
courses_legacy import urls as
django_
courses_legacy_urls
from courses_legacy import urls as courses_legacy_urls
urlpatterns = [
...
url(r'^', include(
django_
courses_legacy_urls)),
url(r'^', include(courses_legacy_urls)),
...
]
This diff is collapsed.
Click to expand it.
setup.cfg
View file @
4afdffa1
...
...
@@ -5,7 +5,7 @@ tag = True
[bumpversion:file:setup.py]
[bumpversion:file:
django_
courses_legacy/__init__.py]
[bumpversion:file:courses_legacy/__init__.py]
[wheel]
universal = 1
...
...
@@ -13,7 +13,7 @@ universal = 1
[flake8]
ignore = D203
exclude =
django_
courses_legacy/migrations,
courses_legacy/migrations,
.git,
.tox,
docs/conf.py,
...
...
This diff is collapsed.
Click to expand it.
Prev
1
2
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment