-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Story/vspc 171 #266
base: develop
Are you sure you want to change the base?
Story/vspc 171 #266
Conversation
…ace content block
Can one of the admins verify this patch? |
} | ||
|
||
} | ||
return selectedSpaceForSpaceBlock; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is this method for? why does it retrieve space blocks again? (also if you. need to check the type of an object you should use instanceof
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed this method as it was not needed
|
||
} catch (BlockDoesNotExistException e) { | ||
logger.warn("Text Id does not exist, bad request.", e); | ||
return new ResponseEntity<String>(HttpStatus.BAD_REQUEST); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if a block doesn't exist, there should be a 404 returned
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
List<ISpace> spaces = new ArrayList<ISpace>(); | ||
spaceRepo.findAll().forEach(s -> { | ||
spaces.add(s); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are the spaces added to a new list? doesn't findAll
return a list?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
model.addAttribute("contentCount",slideContents.size()>0 ? slideContents.get(slideContents.size()-1).getContentOrder() : 0); | ||
if(slideManager.getSlide(id) instanceof BranchingPoint) { | ||
model.addAttribute("choices", ((IBranchingPoint)slide).getChoices()); | ||
} | ||
} | ||
System.out.println("the map is"+ selectedSpaceForSpaceBlock.get("CON000000007")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really? you even checked the box saying "I do not have any sysout statements in my code or commented out code that isn’t needed anymore" ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry about that, have removed it now
var blockId = $(this).closest("div").attr("id"); | ||
console.log('block id is'+ blockId) | ||
var selectedSpace = selectedSpaceForSpaceBlock[blockId] | ||
console.log('selected space is '+selectedSpace) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all console.log
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed
$(".open").css('display', 'none'); | ||
$(".open").css('overflow-y', 'scroll'); | ||
$(".open").css('height', '400px'); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix indentations in above block
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
model.addAttribute("slideContents", slideContents); | ||
model.addAttribute("selectedSpaceForSpaceBlock", selectedSpaceForSpaceBlock); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what are these needed for? each space block should have a space property with the linked space.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed this, initially had included this to make the user know which is the current selected space for a space content block, but I have figured a way around this.
Resolve conflicts please |
Make it so, Jenkins. |
current space should be selected in dropdown |
Make it so, Jenkins. |
1 similar comment
Make it so, Jenkins. |
Some slides don't seem to work: https://diging-dev.asu.edu/vspace-dev/staff/module/MOD000000002/slide/SLI000000021
|
Make it so, Jenkins. |
5 similar comments
Make it so, Jenkins. |
Make it so, Jenkins. |
Make it so, Jenkins. |
Make it so, Jenkins. |
Make it so, Jenkins. |
Make it so, Jenkins. |
url: "[(@{'/staff/module/'+${module.id}+'/slide/'+${slide.id}+'/space/'})]" + blockId, | ||
type: 'GET', | ||
success: function(result) { | ||
if (result != null && result.space != null && result.space.name != null){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think result.space.name != null
is needed here? If the space name is null, it shouldn't prevent the space block from being created. However, if there is no title, there should be some dummy text (in the space selection list as well as when displaying the block/link), e.g. ""
currentSpaceName = result.space.name; | ||
$("#selectedSpace").text(currentSpaceName); | ||
$("#editSpaceBlock").text(result.title); | ||
currentSpaceId = result.space.id; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
put this line together with line 162
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and honestly, not sure if you even need extra variables here. You can just use result.space.name
and result.space.id
everywhere.
} | ||
|
||
} | ||
async function spaceBlockDoubleClick(e) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this async
?
$("#editSpaceName").append(newOption).trigger('change'); | ||
} else { | ||
$("#editSpaceName").val(currentSpaceId).trigger('change'); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'm so confused, what is this if block for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This if block checks whether a specific option (with a value equal to currentSpaceId) already exists in the #editSpaceName dropdown menu. If the option is missing, a new one is created with currentSpaceName as the display text and currentSpaceId as the value.
$("#confirmDeleteTextAlert").find('input').remove(); | ||
$("#confirmDeleteImageAlert").find('input').remove(); | ||
$("#confirmDeleteChoiceBlockAlert").find('input').remove(); | ||
$("#confirmDeleteSpaceAlert").hide(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indentation
@@ -991,6 +1181,107 @@ | |||
}); | |||
}); | |||
|
|||
function getSpaceById(spaceId, callback) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
get space by id should use an api call that actually gets the space by its id, not search all and then iterate over all!
let spaceName = null; | ||
for (let i = 0; i < result.length; i++) { | ||
const space = result[i]; | ||
if (space.id === spaceId) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where is spaceId
defined?
}); | ||
} | ||
|
||
function getCurrentSpace(blockId) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this getting blockId
but is called getCurrentSpace
and what's the difference to getSpaceById
?
var spaceId = selectedSpace.options[selectedSpace.selectedIndex].value; | ||
formData.append('title', title); | ||
formData.append('spaceId', spaceId); | ||
getSpaceById(spaceId, function(spaceName){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for what does this need to be a callback?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In fact, why does getSpaceById
to be called here? The space block should only need the space and a title, which you have after selecting a space, don't you?
var addVideoClk=0; | ||
var editVideoClk=0; | ||
var currentBlockId; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm am fairly certain both currentSpaceId
and currentBlockId
do not need to be global variables.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
without currentBlockId as a global variable close Space Block does not work as it is not able to get the id of the block, if you have any other suggestion then lmk.
Guidelines for Pull Requests
If you haven't yet read our code review guidelines, please do so, You can find them here.
Please confirm the following by adding an x for each item (turn
[ ]
into[x]
).Please provide a brief description of your ticket
(you can copy the ticket if it hasn't changed)
https://diging.atlassian.net/browse/VSPC-171
Anything else the reviewer needs to know?
I have added a new content block type called Space Block, which has the same properties as the content block with an additional parameter for linking to a space. I have allowed the selection of a space for the Staff User from a drop down