Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
d964d53
Added separate classes for channels and invitations
jayoshih May 2, 2017
7029033
Added template for pending invites
jayoshih May 2, 2017
a0839d6
Styled pending templates
jayoshih May 3, 2017
e99ecb8
Merge branch 'master' of https://github.com/jayoshih/content-curation…
jayoshih May 3, 2017
23d1d8c
Added message templates for invitation responses
jayoshih May 3, 2017
5b7c088
Updated loading text
jayoshih May 3, 2017
2a5a807
Added check for handling accepted invitations
jayoshih May 3, 2017
bd4fb29
Implemented accepting/declining invitations
jayoshih May 3, 2017
95b73ff
Merge branch 'master' of https://github.com/fle-internal/content-cura…
jayoshih May 3, 2017
3cedb2a
Merge branch 'develop' of https://github.com/fle-internal/content-cur…
jayoshih May 3, 2017
074063d
Merge branch 'master' of https://github.com/jayoshih/content-curation…
jayoshih May 4, 2017
c532260
Merge branch 'develop' of https://github.com/fle-internal/content-cur…
jayoshih May 4, 2017
b91dd9a
Merge branch 'develop' of https://github.com/fle-internal/content-cur…
jayoshih May 5, 2017
36bff05
Updated to use custom dialogs
jayoshih May 5, 2017
e28668b
Fixed tabbing to spaces
jayoshih May 13, 2017
4310fa9
Fixed alerts to have default function
jayoshih May 13, 2017
2c47c67
Fixed declining invitations
jayoshih May 13, 2017
fc10a84
Merge branch 'develop' of https://github.com/fle-internal/content-cur…
jayoshih May 13, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions contentcuration/contentcuration/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,3 +173,16 @@ def batch_add_tags(request):
ThroughModel.objects.bulk_create(bulk_list)

return HttpResponse("Tags are successfully saved.", status=200)


def add_editor_to_channel(invitation):

This comment was marked as spam.

if invitation.share_mode == models.VIEW_ACCESS:
if invitation.invited in invitation.channel.editors.all():
invitation.channel.editors.remove(invitation.invited)
invitation.channel.viewers.add(invitation.invited)
else:
if invitation.invited in invitation.channel.viewers.all():
invitation.channel.viewers.remove(invitation.invited)
invitation.channel.editors.add(invitation.invited)
invitation.channel.save()
invitation.delete()
5 changes: 4 additions & 1 deletion contentcuration/contentcuration/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
from rest_framework.authtoken.models import Token
from le_utils.constants import content_kinds,file_formats, format_presets, licenses, exercises

EDIT_ACCESS = "edit"

This comment was marked as spam.

VIEW_ACCESS = "view"

DEFAULT_USER_PREFERENCES = json.dumps({
'license': licenses.CC_BY,
'language': None,
Expand Down Expand Up @@ -611,7 +614,7 @@ class Invitation(models.Model):
""" Invitation to edit channel """
id = UUIDField(primary_key=True, default=uuid.uuid4)
invited = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.SET_NULL, null=True, related_name='sent_to')
share_mode = models.CharField(max_length=50, default='edit')
share_mode = models.CharField(max_length=50, default=EDIT_ACCESS)
email = models.EmailField(max_length=100, null=True)
sender = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.SET_NULL, related_name='sent_by', null=True)
channel = models.ForeignKey('Channel', on_delete=models.SET_NULL, null=True, related_name='pending_editors')
Expand Down
8 changes: 7 additions & 1 deletion contentcuration/contentcuration/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,12 @@ class Meta:
fields = ('email', 'first_name', 'last_name', 'id')

class InvitationSerializer(BulkSerializerMixin, serializers.ModelSerializer):
channel_name = serializers.SerializerMethodField('retrieve_channel_name')

This comment was marked as spam.

sender = UserSerializer(read_only=True)

def retrieve_channel_name(self, invitation):
return invitation.channel.name

class Meta:
model = Invitation
fields = ('id', 'invited', 'email', 'sender', 'channel', 'first_name', 'last_name', 'share_mode')
fields = ('id', 'invited', 'email', 'sender', 'channel', 'first_name', 'last_name', 'share_mode', 'channel_name')
Original file line number Diff line number Diff line change
Expand Up @@ -593,9 +593,7 @@ var FormatSlot = BaseViews.BaseListNodeItemView.extend({
},
file_failed:function(file, error){
var self = this;
dialog.dialog("Error Uploading File", error, {
"OK":function(){}
}, function(){
dialog.alert("Error Uploading File", error, function(){
self.render();
self.set_uploading(false);
self.containing_list_view.update_metadata();
Expand Down Expand Up @@ -832,8 +830,7 @@ var ThumbnailUploadView = BaseViews.BaseView.extend({
},
image_completed:function(){
if(this.image_error){
var self = this;
dialog.dialog("Image Error", this.image_error, { "OK":function(){} }, null);
dialog.alert("Image Error", this.image_error);
if(this.onerror){ this.onerror(); }
}else{
if(this.onsuccess){ this.onsuccess(this.image, this.image_formatted_name, this.image_url); }
Expand Down Expand Up @@ -1008,7 +1005,7 @@ var ImageUploadView = BaseViews.BaseModalView.extend({
},
file_complete:function(){
if(this.file_error){
dialog.dialog("Image Error", this.file_error, { "OK":function(){} }, null);
dialog.alert("Image Error", this.file_error);
}
this.render_dropzone();
}
Expand Down
Loading