diff --git a/client/cypress/integration/join-class.spec.js b/client/cypress/integration/school-class.spec.js similarity index 90% rename from client/cypress/integration/join-class.spec.js rename to client/cypress/integration/school-class.spec.js index c7f9af70..a018e9f8 100644 --- a/client/cypress/integration/join-class.spec.js +++ b/client/cypress/integration/school-class.spec.js @@ -143,4 +143,17 @@ describe('Class Management', () => { cy.get('[data-cy=old-class-item]').should('have.length', 1); }); + + it.only('changes class name', () => { + cy.visit('/me/my-class'); + + let className = 'Gotta have class'; + + cy.get('[data-cy=edit-class-name-link]').click(); + cy.get('[data-cy=edit-class-name-input]').type('{selectall}{backspace}').type(className); + cy.get('[data-cy=save-button]').click(); + cy.get('[data-cy=class-name-heading]').should('equal', className); + + + }) }); diff --git a/client/src/App.vue b/client/src/App.vue index b4cf809e..3bf87810 100644 --- a/client/src/App.vue +++ b/client/src/App.vue @@ -18,8 +18,6 @@ import EditContentBlockWizard from '@/components/content-block-form/EditContentBlockWizard'; import NewRoomEntryWizard from '@/components/rooms/room-entries/NewRoomEntryWizard'; import EditRoomEntryWizard from '@/components/rooms/room-entries/EditRoomEntryWizard'; - import NewObjectiveGroupWizard from '@/components/objective-groups/NewObjectiveGroupWizard'; - import EditObjectiveGroupWizard from '@/components/objective-groups/EditObjectiveGroupWizard'; import NewProjectEntryWizard from '@/components/portfolio/NewProjectEntryWizard'; import EditProjectEntryWizard from '@/components/portfolio/EditProjectEntryWizard'; import NewObjectiveWizard from '@/components/objective-groups/NewObjectiveWizard'; @@ -46,9 +44,6 @@ EditContentBlockWizard, NewRoomEntryWizard, EditRoomEntryWizard, - // todo: remove - NewObjectiveGroupWizard, - EditObjectiveGroupWizard, NewProjectEntryWizard, EditProjectEntryWizard, NewObjectiveWizard, diff --git a/client/src/components/AddObjectiveGroupButton.vue b/client/src/components/AddObjectiveGroupButton.vue deleted file mode 100644 index 8fe426cc..00000000 --- a/client/src/components/AddObjectiveGroupButton.vue +++ /dev/null @@ -1,65 +0,0 @@ - - - - - diff --git a/client/src/components/objective-groups/EditObjectiveGroupWizard.vue b/client/src/components/objective-groups/EditObjectiveGroupWizard.vue deleted file mode 100644 index 9e67b362..00000000 --- a/client/src/components/objective-groups/EditObjectiveGroupWizard.vue +++ /dev/null @@ -1,107 +0,0 @@ - - - - - diff --git a/client/src/components/objective-groups/NewObjectiveGroupWizard.vue b/client/src/components/objective-groups/NewObjectiveGroupWizard.vue deleted file mode 100644 index a09c69f9..00000000 --- a/client/src/components/objective-groups/NewObjectiveGroupWizard.vue +++ /dev/null @@ -1,91 +0,0 @@ - - - - - diff --git a/client/src/components/objective-groups/ObjectiveGroup.vue b/client/src/components/objective-groups/ObjectiveGroup.vue index 434bbabf..a02ce908 100644 --- a/client/src/components/objective-groups/ObjectiveGroup.vue +++ b/client/src/components/objective-groups/ObjectiveGroup.vue @@ -56,12 +56,6 @@ return this.me.selectedClass; }, }, - - methods: { - editObjectiveGroup() { - this.$store.dispatch('editObjectiveGroup', this.group.id); - } - } } diff --git a/client/src/components/objective-groups/ObjectiveGroupForm.vue b/client/src/components/objective-groups/ObjectiveGroupForm.vue deleted file mode 100644 index b32ca67e..00000000 --- a/client/src/components/objective-groups/ObjectiveGroupForm.vue +++ /dev/null @@ -1,64 +0,0 @@ - - - - - diff --git a/client/src/graphql/gql/mutations/addObjectiveGroup.gql b/client/src/graphql/gql/mutations/addObjectiveGroup.gql deleted file mode 100644 index 69bf95dd..00000000 --- a/client/src/graphql/gql/mutations/addObjectiveGroup.gql +++ /dev/null @@ -1,16 +0,0 @@ -#import "../fragments/objectiveGroupParts.gql" -mutation AddObjectiveGroup($input: AddObjectiveGroupInput!) { - addObjectiveGroup(input: $input) { - objectiveGroup { - ...ObjectiveGroupParts - objectives { - edges { - node { - id - text - } - } - } - } - } -} diff --git a/client/src/graphql/gql/mutations/updateObjectiveGroup.gql b/client/src/graphql/gql/mutations/updateObjectiveGroup.gql deleted file mode 100644 index 4a0bfa68..00000000 --- a/client/src/graphql/gql/mutations/updateObjectiveGroup.gql +++ /dev/null @@ -1,16 +0,0 @@ -#import "../fragments/objectiveGroupParts.gql" -mutation UpdateObjectiveGroup($input: UpdateObjectiveGroupInput!) { - updateObjectiveGroup(input: $input) { - objectiveGroup { - ...ObjectiveGroupParts - objectives { - edges { - node { - id - text - } - } - } - } - } -} diff --git a/client/src/store/index.js b/client/src/store/index.js index 678d07a6..5c9a634d 100644 --- a/client/src/store/index.js +++ b/client/src/store/index.js @@ -19,7 +19,6 @@ export default new Vuex.Store({ currentRoomEntry: '', parentRoom: null, parentModule: '', - objectiveGroupType: '', currentObjectiveGroup: '', parentProject: null, currentNote: null, @@ -70,8 +69,6 @@ export default new Vuex.Store({ commit('setContentBlockPosition', {}); commit('setParentRoom', null); commit('setParentModule', ''); - // todo: remove - commit('setObjectiveGroupType', ''); commit('setCurrentObjectiveGroup', ''); commit('setParentProject', null); commit('setCurrentProjectEntry', null); @@ -110,16 +107,6 @@ export default new Vuex.Store({ commit('setCurrentRoomEntry', payload); dispatch('showModal', 'edit-room-entry-wizard'); }, - // todo: remove - addObjectiveGroup({commit, dispatch}, {module, type}) { - commit('setParentModule', module); - commit('setObjectiveGroupType', type); - dispatch('showModal', 'new-objective-group-wizard'); - }, - editObjectiveGroup({commit, dispatch}, payload) { - commit('setCurrentObjectiveGroup', payload); - dispatch('showModal', 'edit-objective-group-wizard'); - }, showModal({commit}, payload) { document.body.classList.add('no-scroll'); // won't get at the body any other way commit('setModal', payload); @@ -216,10 +203,6 @@ export default new Vuex.Store({ setParentModule(state, payload) { state.parentModule = payload; }, - // todo: remove - setObjectiveGroupType(state, payload) { - state.objectiveGroupType = payload; - }, setCurrentObjectiveGroup(state, payload) { state.currentObjectiveGroup = payload; }, diff --git a/server/objectives/inputs.py b/server/objectives/inputs.py index 56106574..3711ee0a 100644 --- a/server/objectives/inputs.py +++ b/server/objectives/inputs.py @@ -10,13 +10,3 @@ class ObjectiveInput(InputObjectType): class AddObjectiveArgument(InputObjectType): text = graphene.String(required=True) objective_group = graphene.ID(reuired=True) - -class AddObjectiveGroupArgument(InputObjectType): - title = graphene.String(required=True) - module = graphene.ID(required=True) - objectives = graphene.List(ObjectiveInput) - - -class UpdateObjectiveGroupArgument(InputObjectType): - id = graphene.ID(required=True) - objectives = graphene.List(ObjectiveInput) diff --git a/server/objectives/mutations.py b/server/objectives/mutations.py index f02df3c4..650b0b7e 100644 --- a/server/objectives/mutations.py +++ b/server/objectives/mutations.py @@ -1,13 +1,11 @@ import graphene -from graphene import relay, InputObjectType -from graphql_relay import from_global_id +from graphene import relay from rest_framework.exceptions import PermissionDenied from api.utils import get_object -from books.models import Module from books.schema.inputs import UserGroupBlockVisibility from core.utils import set_visible_for, set_hidden_for -from objectives.inputs import AddObjectiveGroupArgument, UpdateObjectiveGroupArgument, AddObjectiveArgument +from objectives.inputs import AddObjectiveArgument from objectives.models import ObjectiveProgressStatus, Objective, ObjectiveGroup from objectives.schema import ObjectiveNode, ObjectiveGroupNode @@ -105,75 +103,8 @@ class DeleteObjective(relay.ClientIDMutation): return cls(success=True) - -class AddObjectiveGroup(relay.ClientIDMutation): - class Input: - objective_group = graphene.Argument(AddObjectiveGroupArgument) - - objective_group = graphene.Field(ObjectiveGroupNode) - - @classmethod - def mutate_and_get_payload(cls, root, info, **kwargs): - - owner = info.context.user - if not owner.has_perm('users.can_manage_school_class_content'): - raise PermissionDenied('Missing permissions') - - objective_group_data = kwargs.get('objective_group') - title = objective_group_data.get('title') - if title != 'society': - title = 'language_communication' - module_id = objective_group_data.get('module') - module = get_object(Module, module_id) - - new_objective_group = ObjectiveGroup.objects.create(title=title, module=module, owner=owner) - objectives = objective_group_data.get('objectives') - for objective in objectives: - Objective.objects.create(text=objective.get('text'), group=new_objective_group) - return cls(objective_group=new_objective_group) - - -class UpdateObjectiveGroup(relay.ClientIDMutation): - class Input: - objective_group = graphene.Argument(UpdateObjectiveGroupArgument) - - objective_group = graphene.Field(ObjectiveGroupNode) - - @classmethod - def mutate_and_get_payload(cls, root, info, **kwargs): - - user = info.context.user - if not user.has_perm('users.can_manage_school_class_content'): - raise PermissionDenied('Missing permissions') - - objective_group_data = kwargs.get('objective_group') - id = objective_group_data.get('id') - objective_group = get_object(ObjectiveGroup, id) - - objectives = objective_group_data.get('objectives') - existing_objective_ids = list(objective_group.objectives.values_list('id', flat=True)) - for objective in objectives: - if objective.get('id') is not None: - objective_id = objective.get('id') - updated_objective = get_object(Objective, objective_id) - updated_objective.text = objective.get('text') - updated_objective.save() - existing_objective_ids.remove(int(from_global_id(objective_id)[1])) - else: - Objective.objects.create(text=objective.get('text'), group=objective_group) - - # remove existing items that are not in payload - for objective_id in existing_objective_ids: - objective = Objective.objects.get(pk=objective_id) - objective.delete() - - return cls(objective_group=objective_group) - - class ObjectiveMutations: update_objective_progress = UpdateObjectiveProgress.Field() update_objective_visibility = UpdateObjectiveVisibility.Field() add_objective = AddObjective.Field() delete_objective = DeleteObjective.Field() - add_objective_group = AddObjectiveGroup.Field() - update_objective_group = UpdateObjectiveGroup.Field()