Changeset 460


Ignore:
Timestamp:
May 25, 2010, 12:06:11 PM (9 years ago)
Author:
duh
Message:
  • fixed issue with the table editor
  • view for grouping page
Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/views/wizard/pages/_groups.gsp

    r451 r460  
    1717<wizard:pageContent>
    1818
    19         <div class="table">
    20                         <div class="header">
    21                                 <div class="column"></div>
    22                                 <g:if test="${eventGroups}"><g:each var="eventGroup" status="g" in="${eventGroups}">
    23                                 <div class="column">${eventGroup.name}</div>
    24                                 </g:each></g:if>
    25                         </div>
     19<div class="table">
     20        <div class="header">
     21                <div class="column"></div>
     22                <div class="column"></div>
     23                <g:if test="${eventGroups}"><g:each var="eventGroup" status="g" in="${eventGroups}">
     24                <div class="column">${eventGroup.name}</div>
     25                </g:each></g:if>
    2626        </div>
     27<g:each var="subjectTemplate" in="${subjectTemplates}">
     28  <g:set var="showHeader" value="${true}" />
     29  <g:each var="subjectId" in="${subjectTemplate.getValue().subjects}">
     30        <div class="row">
     31                <div class="column">
     32                        <g:if test="${showHeader}">
     33                                <g:set var="showHeader" value="${false}" />
     34                                ${subjectTemplate.getValue().name} template
     35                        </g:if>
     36                </div>
     37                <div class="column">${subjects[ subjectId ].name}</div>
     38                <g:if test="${eventGroups}"><g:each var="eventGroup" status="g" in="${eventGroups}">
     39                <div class="column"><input type="checkbox" name="subject_${subjectId}_group_${g}" /></div>
     40                </g:each></g:if>
     41        </div>
     42  </g:each>
     43</g:each>
     44</div>
    2745
    2846</wizard:pageContent>
  • trunk/web-app/js/table-editor.js

    r359 r460  
    9292        $(this.columnIdentifier, row).each(function() {
    9393            var input = $(':input', $(this));
     94            var inputElement = $(input)
     95            var type = inputElement.attr('type');
    9496
    9597            // does this column contain an input field
    96             if (input) {
    97                 var inputElement = $(input)
    98                 var type = inputElement.attr('type');
    99 
     98            if (input && type) {
    10099                switch (type) {
    101100                    case 'text':
  • trunk/web-app/js/table-editor.min.js

    r359 r460  
    1 function TableEditor(){}TableEditor.prototype={tableIdentifier:null,rowIdentifier:null,columnIdentifier:null,selected:null,init:function(d,a,b){this.tableIdentifier=d;this.rowIdentifier=a;this.columnIdentifier=b;var c=$(d);if(c){that=this;c.each(function(){that.initializeTable(this)})}},initializeTable:function(b){var a=this;$(b).selectable({filter:this.rowIdentifier,selected:function(c,d){a.attachColumnHandlers(d.selected)},unselected:function(c,d){a.deAttachColumnHandlers(d.selected)}})},deAttachColumnHandlers:function(b){var a=this;$(this.columnIdentifier,b).each(function(){var c=$(":input",$(this));if(c){$(c).unbind(".tableEditor")}})},attachColumnHandlers:function(d){var c=this;var b=0;var a=new RegExp("ui-autocomplete-input");$(this.columnIdentifier,d).each(function(){var e=$(":input",$(this));if(e){var h=$(e);var g=h.attr("type");switch(g){case"text":var f=b;if(a.test(h.attr("class"))){h.bind("autocompleteclose.tableEditor",function(){c.updateSingleInputElements(e,f,"input")})}else{h.bind("keyup.tableEditor",function(){c.updateSingleInputElements(e,f,"input")})}break;case"select-one":var f=b;h.bind("change.tableEditor",function(){c.updateSingleInputElements(e,f,"select")});break;case"checkbox":var f=b;h.bind("click.tableEditor",function(){c.updateSingleInputElements(e,f,"input")});break;case"hidden":break;case null:break;default:alert("unsupported element of type "+g+", please file a bug report containing this message and a screenshot for table-editor.js");break}}b++})},updateSingleInputElements:function(f,d,b){var g=this;var h=$(f);var i=h.parent();var a=i.parent();var k=a.parent();var j=this.getValue(h);$(".ui-selected",k).each(function(){$(g.columnIdentifier+":eq("+d+") "+b,$(this)).each(function(){var c=$(this);if(c.attr("type")!="hidden"){var e=g.getValue(c);if(e!=j){g.setValue(c,j)}}})})},getValue:function(a){var b=$(a);switch(b.attr("type")){case"checkbox":return b.attr("checked");break;default:return b.val();break}},setValue:function(a,c){var b=$(a);switch(b.attr("type")){case"checkbox":return b.attr("checked",c);break;default:return b.val(c);break}}};
     1function TableEditor(){}TableEditor.prototype={tableIdentifier:null,rowIdentifier:null,columnIdentifier:null,selected:null,init:function(d,a,b){this.tableIdentifier=d;this.rowIdentifier=a;this.columnIdentifier=b;var c=$(d);if(c){that=this;c.each(function(){that.initializeTable(this)})}},initializeTable:function(b){var a=this;$(b).selectable({filter:this.rowIdentifier,selected:function(c,d){a.attachColumnHandlers(d.selected)},unselected:function(c,d){a.deAttachColumnHandlers(d.selected)}})},deAttachColumnHandlers:function(b){var a=this;$(this.columnIdentifier,b).each(function(){var c=$(":input",$(this));if(c){$(c).unbind(".tableEditor")}})},attachColumnHandlers:function(d){var c=this;var b=0;var a=new RegExp("ui-autocomplete-input");$(this.columnIdentifier,d).each(function(){var e=$(":input",$(this));var h=$(e);var g=h.attr("type");if(e&&g){switch(g){case"text":var f=b;if(a.test(h.attr("class"))){h.bind("autocompleteclose.tableEditor",function(){c.updateSingleInputElements(e,f,"input")})}else{h.bind("keyup.tableEditor",function(){c.updateSingleInputElements(e,f,"input")})}break;case"select-one":var f=b;h.bind("change.tableEditor",function(){c.updateSingleInputElements(e,f,"select")});break;case"checkbox":var f=b;h.bind("click.tableEditor",function(){c.updateSingleInputElements(e,f,"input")});break;case"hidden":break;case null:break;default:alert("unsupported element of type "+g+", please file a bug report containing this message and a screenshot for table-editor.js");break}}b++})},updateSingleInputElements:function(f,d,b){var g=this;var h=$(f);var i=h.parent();var a=i.parent();var k=a.parent();var j=this.getValue(h);$(".ui-selected",k).each(function(){$(g.columnIdentifier+":eq("+d+") "+b,$(this)).each(function(){var c=$(this);if(c.attr("type")!="hidden"){var e=g.getValue(c);if(e!=j){g.setValue(c,j)}}})})},getValue:function(a){var b=$(a);switch(b.attr("type")){case"checkbox":return b.attr("checked");break;default:return b.val();break}},setValue:function(a,c){var b=$(a);switch(b.attr("type")){case"checkbox":return b.attr("checked",c);break;default:return b.val(c);break}}};
Note: See TracChangeset for help on using the changeset viewer.