Created
November 25, 2011 18:42
-
-
Save JanTvrdik/1394157 to your computer and use it in GitHub Desktop.
ScrumDo Workaround for missing features
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var initStory = function (block) { | |
var storyId = block.attr('story_id'); | |
var commentBoxId = 'story_comments_' + storyId; | |
var commentBox = block.find('#' + commentBoxId); | |
if (commentBox.length > 0) { | |
initComments(commentBox); | |
} else { | |
// Odkaz na zobrazení komentářů | |
var link = $('<a>', { | |
text: '? Comments', | |
href: '#', | |
className: 'tasks_link comment_link', | |
css: {textDecoration: 'none'}, | |
click: function (e) { | |
commentBox.slideToggle('fast'); | |
} | |
}); | |
block.find('.tasks_link') | |
.after(link) | |
.after('<span class="tasks_link"> - </span>'); | |
// Box s komentáři | |
commentBox = $('<div>').attr('id', commentBoxId); | |
block.append(commentBox); | |
showCommentsForStory(storyId, false); // preload komentářů | |
} | |
}; | |
var initComments = function (box) { | |
// if (box.data('initialized')) return; | |
var section = box.find('.comment_section'); | |
if (section.length == 0) return; | |
section.css({ | |
marginLeft: 0, | |
marginRight: 5 | |
}); | |
section.find('h2').css({ | |
marginLeft: 0 | |
}); | |
var responses = box.find('.responses'); | |
responses.find('p').css({ | |
margin: 0 | |
}); | |
box.closest('.scrum_board_story_block').find('.comment_link') | |
.text(responses.find('li').length + ' Comments'); | |
box.find('form table') | |
.attr('width', '100%'); | |
box.find('textarea') | |
.attr('cols', null) | |
.attr('rows', 7) | |
.css({ | |
boxSizing: 'border-box', | |
width: '100%', | |
margin: '5px 0 0 0', | |
fontSize: '12px', | |
fontFamily: 'sans-serif', | |
resize: 'vertical' | |
}) | |
.click(function (e) { | |
this.focus(); | |
}); | |
// box.data('initialized', true); | |
}; | |
var initAll = function () { | |
$('.scrum_board_story_block').each(function (i, block) { | |
var block = $(block); | |
initStory(block); | |
}); | |
}; | |
initAll(); | |
$(document.body).ajaxSuccess(function (event, request, options) { | |
initAll(); | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment