From c004d501f65493823f9435813f7641593314c2a8 Mon Sep 17 00:00:00 2001 From: shimamoto Date: Sun, 1 Mar 2015 23:38:08 +0900 Subject: [PATCH 1/3] (refs #632) Implement all the check of javascript. --- src/main/twirl/issues/list.scala.html | 9 ++++++++- src/main/twirl/issues/listparts.scala.html | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/main/twirl/issues/list.scala.html b/src/main/twirl/issues/list.scala.html index b1e36b3fc..7c3a39683 100644 --- a/src/main/twirl/issues/list.scala.html +++ b/src/main/twirl/issues/list.scala.html @@ -48,10 +48,17 @@ $(function(){ }); $('.table-issues input[type=checkbox]').change(function(){ - if($('.table-issues input[type=checkbox]').filter(':checked').length == 0){ + var count = $('.table-issues input[type=checkbox]').filter(':checked').length; + if(count == 0){ $('#table-issues-control').show(); $('#table-issues-batchedit').hide(); } else { + if($(this).val() == 'all'){ + var flag = $(this).is(":checked"); + $('.table-issues input[type=checkbox]').each(function(){ + $(this).prop("checked", flag); + }); + } $('#table-issues-control').hide(); $('#table-issues-batchedit').show(); } diff --git a/src/main/twirl/issues/listparts.scala.html b/src/main/twirl/issues/listparts.scala.html index 6c9378932..97af4c719 100644 --- a/src/main/twirl/issues/listparts.scala.html +++ b/src/main/twirl/issues/listparts.scala.html @@ -25,7 +25,7 @@
- + From 9019d93449e16600ec6910de756b7b7f782338b8 Mon Sep 17 00:00:00 2001 From: shimamoto Date: Mon, 2 Mar 2015 01:21:11 +0900 Subject: [PATCH 2/3] (refs #632) Revert. And remove all checked checkbox. --- src/main/twirl/issues/list.scala.html | 9 +-------- src/main/twirl/issues/listparts.scala.html | 1 - 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/src/main/twirl/issues/list.scala.html b/src/main/twirl/issues/list.scala.html index 7c3a39683..b1e36b3fc 100644 --- a/src/main/twirl/issues/list.scala.html +++ b/src/main/twirl/issues/list.scala.html @@ -48,17 +48,10 @@ $(function(){ }); $('.table-issues input[type=checkbox]').change(function(){ - var count = $('.table-issues input[type=checkbox]').filter(':checked').length; - if(count == 0){ + if($('.table-issues input[type=checkbox]').filter(':checked').length == 0){ $('#table-issues-control').show(); $('#table-issues-batchedit').hide(); } else { - if($(this).val() == 'all'){ - var flag = $(this).is(":checked"); - $('.table-issues input[type=checkbox]').each(function(){ - $(this).prop("checked", flag); - }); - } $('#table-issues-control').hide(); $('#table-issues-batchedit').show(); } diff --git a/src/main/twirl/issues/listparts.scala.html b/src/main/twirl/issues/listparts.scala.html index 97af4c719..6f553d400 100644 --- a/src/main/twirl/issues/listparts.scala.html +++ b/src/main/twirl/issues/listparts.scala.html @@ -25,7 +25,6 @@
- From 751a8703efbd58694ba76aca362f636ae9b06815 Mon Sep 17 00:00:00 2001 From: shimamoto Date: Mon, 2 Mar 2015 06:31:59 +0900 Subject: [PATCH 3/3] (refs #632) Implement all the check of javascript. --- src/main/twirl/issues/list.scala.html | 24 ++- src/main/twirl/issues/listparts.scala.html | 193 +++++++++++---------- 2 files changed, 115 insertions(+), 102 deletions(-) diff --git a/src/main/twirl/issues/list.scala.html b/src/main/twirl/issues/list.scala.html index 7c3a39683..dc727749d 100644 --- a/src/main/twirl/issues/list.scala.html +++ b/src/main/twirl/issues/list.scala.html @@ -48,24 +48,32 @@ $(function(){ }); $('.table-issues input[type=checkbox]').change(function(){ - var count = $('.table-issues input[type=checkbox]').filter(':checked').length; + var all = $('.table-issues input[type=checkbox][value]'); + + // check all + if($(this).val() == 'on'){ + var flag = $(this).is(":checked"); + all.each(function(){ + $(this).prop("checked", flag); + }); + } + + var count = all.filter(':checked').length; + // whether all check + $('.table-issues input[type=checkbox]').filter(':first').prop("checked", count > 0 && count == all.length); + if(count == 0){ $('#table-issues-control').show(); $('#table-issues-batchedit').hide(); } else { - if($(this).val() == 'all'){ - var flag = $(this).is(":checked"); - $('.table-issues input[type=checkbox]').each(function(){ - $(this).prop("checked", flag); - }); - } + $('#batchedit-selected').text(count); $('#table-issues-control').hide(); $('#table-issues-batchedit').show(); } }).filter(':first').change(); var submitBatchEdit = function(action, value) { - var checked = $('.table-issues input[type=checkbox]').filter(':checked').map(function(){ return this.value; }).get().join(); + var checked = $('.table-issues input[type=checkbox][value]').filter(':checked').map(function(){ return this.value; }).get().join(); var form = $('#batcheditForm'); form.find('input[name=value]').val(value); form.find('input[name=checked]').val(checked); diff --git a/src/main/twirl/issues/listparts.scala.html b/src/main/twirl/issues/listparts.scala.html index 97af4c719..175be35ef 100644 --- a/src/main/twirl/issues/listparts.scala.html +++ b/src/main/twirl/issues/listparts.scala.html @@ -25,8 +25,10 @@
- - + @if(hasWritePermission){ + + } + @openCount Open @@ -35,116 +37,119 @@ @closedCount Closed - -
- @helper.html.dropdown("Author", flat = true) { - @collaborators.map { collaborator => -
  • - - @helper.html.checkicon(condition.author == Some(collaborator)) - @avatar(collaborator, 20) @collaborator - -
  • - } - } - @helper.html.dropdown("Label", flat = true) { - @labels.map { label => -
  • - - @helper.html.checkicon(condition.labels.contains(label.labelName)) -    - @label.labelName - -
  • - } - } - @helper.html.dropdown("Milestone", flat = true) { -
  • - - @helper.html.checkicon(condition.milestone == Some(None)) Issues with no milestone - -
  • - @milestones.filter(_.closedDate.isEmpty).map { milestone => -
  • - - @helper.html.checkicon(condition.milestone == Some(Some(milestone.title))) @milestone.title - -
  • - } - } - @helper.html.dropdown("Assignee", flat = true) { - @collaborators.map { collaborator => -
  • - - @helper.html.checkicon(condition.assigned == Some(collaborator)) - @avatar(collaborator, 20) @collaborator - -
  • - } - } - @helper.html.dropdown("Sort", flat = true){ -
  • - - @helper.html.checkicon(condition.sort == "created" && condition.direction == "desc") Newest - -
  • -
  • - - @helper.html.checkicon(condition.sort == "created" && condition.direction == "asc") Oldest - -
  • -
  • - - @helper.html.checkicon(condition.sort == "comments" && condition.direction == "desc") Most commented - -
  • -
  • - - @helper.html.checkicon(condition.sort == "comments" && condition.direction == "asc") Least commented - -
  • -
  • - - @helper.html.checkicon(condition.sort == "updated" && condition.direction == "desc") Recently updated - -
  • -
  • - - @helper.html.checkicon(condition.sort == "updated" && condition.direction == "asc") Least recently updated - -
  • - } -
    - @if(hasWritePermission){ -
    - @helper.html.dropdown("Mark as", flat = true) { -
  • Open
  • -
  • Close
  • +
    + @helper.html.dropdown("Author", flat = true) { + @collaborators.map { collaborator => +
  • + + @helper.html.checkicon(condition.author == Some(collaborator)) + @avatar(collaborator, 20) @collaborator + +
  • + } } @helper.html.dropdown("Label", flat = true) { @labels.map { label =>
  • - - -   + + @helper.html.checkicon(condition.labels.contains(label.labelName)) +    @label.labelName
  • } } @helper.html.dropdown("Milestone", flat = true) { -
  • No milestone
  • +
  • + + @helper.html.checkicon(condition.milestone == Some(None)) Issues with no milestone + +
  • @milestones.filter(_.closedDate.isEmpty).map { milestone => -
  • @milestone.title
  • +
  • + + @helper.html.checkicon(condition.milestone == Some(Some(milestone.title))) @milestone.title + +
  • } } @helper.html.dropdown("Assignee", flat = true) { -
  • Clear assignee
  • @collaborators.map { collaborator => -
  • @avatar(collaborator, 20) @collaborator
  • +
  • + + @helper.html.checkicon(condition.assigned == Some(collaborator)) + @avatar(collaborator, 20) @collaborator + +
  • } } + @helper.html.dropdown("Sort", flat = true){ +
  • + + @helper.html.checkicon(condition.sort == "created" && condition.direction == "desc") Newest + +
  • +
  • + + @helper.html.checkicon(condition.sort == "created" && condition.direction == "asc") Oldest + +
  • +
  • + + @helper.html.checkicon(condition.sort == "comments" && condition.direction == "desc") Most commented + +
  • +
  • + + @helper.html.checkicon(condition.sort == "comments" && condition.direction == "asc") Least commented + +
  • +
  • + + @helper.html.checkicon(condition.sort == "updated" && condition.direction == "desc") Recently updated + +
  • +
  • + + @helper.html.checkicon(condition.sort == "updated" && condition.direction == "asc") Least recently updated + +
  • + }
    + + @if(hasWritePermission){ + + selected +
    + @helper.html.dropdown("Mark as", flat = true) { +
  • Open
  • +
  • Close
  • + } + @helper.html.dropdown("Label", flat = true) { + @labels.map { label => +
  • + + +   + @label.labelName + +
  • + } + } + @helper.html.dropdown("Milestone", flat = true) { +
  • No milestone
  • + @milestones.filter(_.closedDate.isEmpty).map { milestone => +
  • @milestone.title
  • + } + } + @helper.html.dropdown("Assign", flat = true) { +
  • Assign to nobody
  • + @collaborators.map { collaborator => +
  • @avatar(collaborator, 20) @collaborator
  • + } + } +
    +
    }