app/assets/javascripts/tree_display.jsx
File tree_display.jsx
has 1153 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
jQuery(document).ready(function() {
// This preloadedImages function is refered from http://jsfiddle.net/slashingweapon/8jAeu/
// Actually I am not using the values in preloadedImages, but image loading speed is indeed getting faster
var preloadedImages = []
function preloadImages() {
Function render
has 223 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render: function() {
var _rows = []
var _this = this
var colWidthArray = ["30%", "0%", "0%", "0%", "25%", "25%", "20%"]
var colDisplayStyle = {
Function render
has 190 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render: function() {
var moreContent = []
var buttonContent = ""
var moreButtonStyle = {
"display": "",
Function render
has 109 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render: function() {
var _rows = []
var _this = this
var colWidthArray = ["30%", "0%", "0%", "0%", "25%", "25%", "20%"]
var colDisplayStyle = {
Function render
has 83 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render: function () {
var creation_date;
var updated_date;
var colWidthArray = ["30%", "0%", "0%", "0%", "25%", "25%", "20%"]
var colDisplayStyle = {
Function render
has 78 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render: function () {
var creation_date;
var updated_date;
var colWidthArray = ["30%", "0%", "0%", "0%", "25%", "25%", "20%"]
var colDisplayStyle = {
Function componentWillMount
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
componentWillMount: function() {
var _this = this
preloadImages('/assets/tree_view/edit-icon-24.png',
'/assets/tree_view/delete-icon-24.png',
'/assets/tree_view/lock-off-disabled-icon-24.png',
Consider simplifying this complex logical expression. Open
Open
if (((entry.name && entry.name.indexOf(_this.props.filterText) !== -1) ||
(entry.creation_date && entry.creation_date.indexOf(_this.props.filterText) !== -1) ||
(entry.institution && entry.institution.indexOf(_this.props.filterText) !== -1) ||
(entry.updated_date && entry.updated_date.indexOf(_this.props.filterText) !== -1)) &&
(entry.private == true || entry.type == 'FolderNode')) {
Consider simplifying this complex logical expression. Open
Open
if (((entry.name && entry.name.indexOf(_this.props.filterText) !== -1) ||
(entry.creation_date && entry.creation_date.indexOf(_this.props.filterText) !== -1) ||
(entry.institution && entry.institution.indexOf(_this.props.filterText) !== -1) ||
(entry.updated_date && entry.updated_date.indexOf(_this.props.filterText) !== -1)) &&
(entry.private == false)) {
Function render
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render: function() {
var colSpan = "5"
var colDisplayStyle = {
"display": ""
}
Function handleUserClick
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
handleUserClick: function(colName, order) {
var tmpData = this.state.tableData
tmpData.sort(function(a, b) {
var a_val = eval("a."+colName)
var b_val = eval("b."+colName)
Function render
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render: function() {
var renderContent = []
var formStyle = {
margin: 0,
padding: 0,
Function render
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render: function() {
return (
<div className="filterable_table">
<SearchBar
filterText={this.state.filterText}
Consider simplifying this complex logical expression. Open
Open
if (((entry.name && entry.name.indexOf(_this.props.filterText) !== -1) ||
(entry.creation_date && entry.creation_date.indexOf(_this.props.filterText) !== -1) ||
(entry.updated_date && entry.updated_date.indexOf(_this.props.filterText) !== -1)) &&
(entry.private == false)) {
_rows.push(<ContentTableRow
Avoid deeply nested control flow statements. Open
Open
if(this.props.is_intelligent) {
moreContent.push(
<a title="Intelligent Assignment" href={"/lottery/run_intelligent_assignment/"+(parseInt(this.props.id)/2).toString()}>
<img src="/assets/tree_view/run-lottery.png" />
</a>
Avoid deeply nested control flow statements. Open
Open
if (this.props.require_quiz) {
moreContent.push(
<span>
<a title="View quiz questions" href={"/student_quizzes/review_questions?id="+(parseInt(this.props.id)/2).toString()+"&type=Assignment"}>
<img src="/assets/tree_view/view-survey-24.png" />
Avoid deeply nested control flow statements. Open
Open
if (((entry.name && entry.name.indexOf(_this.props.filterText) !== -1) ||
(entry.creation_date && entry.creation_date.indexOf(_this.props.filterText) !== -1) ||
(entry.updated_date && entry.updated_date.indexOf(_this.props.filterText) !== -1)) &&
(entry.private == false)) {
_rows.push(<ContentTableRow
Avoid deeply nested control flow statements. Open
Open
if (parseInt(this.props.max_team_size) > 1) {
moreContent.push(
<span>
<a title="Create teams" href={"/teams/list?id="+(parseInt(this.props.id)/2).toString()+"&type=Assignment"}>
<img src="/assets/tree_view/create-teams-24.png" />
Avoid deeply nested control flow statements. Open
Open
if (this.props.allow_suggestions) {
moreContent.push(
<span>
<a title="View suggestions" href={"/suggestion/list?id="+(parseInt(this.props.id)/2).toString()+"&type=Assignment"}>
<img src="/assets/tree_view/view-suggestion-24.png" />
Avoid deeply nested control flow statements. Open
Open
if (this.props.has_topic) {
// Moved content out of this to the block outside this containing "if" statement
}
Avoid too many return
statements within this function. Open
Open
return 0;
Avoid too many return
statements within this function. Open
Open
return 1;
Avoid too many return
statements within this function. Open
Open
return (a_val.localeCompare(b_val))
Avoid too many return
statements within this function. Open
Open
return -1;