Changeset 306 for trunk/grails-app
- Timestamp:
- Jan 31, 2010, 10:38:12 AM (15 years ago)
- Location:
- trunk/grails-app
- Files:
-
- 1 deleted
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/conf/Config.groovy
r291 r306 158 158 ] 159 159 ], 160 [order:40, controller:'assetDetailed', title:'assets', action:' overview',160 [order:40, controller:'assetDetailed', title:'assets', action:'search', 161 161 subItems: [ 162 [order:10, controller:'assetDetailed', title:'Overview', action:'overview', isVisible: { true }], 163 [order:11, controller:'assetDetailed', title:'Search', action:'search', isVisible: { true }], 162 [order:10, controller:'assetDetailed', title:'Search', action:'search', isVisible: { true }], 164 163 [order:20, controller:'assetDetailed', title:'Create', action:'create', isVisible: { true }], 165 164 [order:90, controller:'assetDetailed', title:'Show', action:'show', isVisible: { params.action == 'show' }], -
trunk/grails-app/controllers/AssetDetailedController.groovy
r305 r306 14 14 15 15 @Secured(['ROLE_AppAdmin', 'ROLE_Manager', 'ROLE_AssetManager', 'ROLE_AssetUser']) 16 def index = { redirect(action:overview,params:params) } 17 18 @Secured(['ROLE_AppAdmin', 'ROLE_Manager', 'ROLE_AssetManager', 'ROLE_AssetUser']) 19 def overview = { 20 } 16 def index = { redirect(action:search,params:params) } 21 17 22 18 def importAssetTree = { -
trunk/grails-app/taglib/AssetTreeTagLib.groovy
r286 r306 4 4 */ 5 5 class AssetTreeTagLib { 6 static namespace = 'gnu mims'6 static namespace = 'gnuMims' 7 7 8 8 def resources = { attrs -> … … 10 10 } 11 11 12 def assetTreeButton = { 13 def mkp = new groovy.xml.MarkupBuilder(out) //this line will be unnecessary in versions of Grails after version 1.2 14 15 mkp.div(class: "tree_button") { 16 a(href: showPane()) { 17 img(src: treeRootImg()) 18 } 19 } 20 } // mkp 21 12 22 def assetTree = { attrs -> 13 23 14 24 def sites = Site.list() 15 16 def assetInstance = Asset.get(1) /// @todo: remove this.17 25 18 26 def divIdCount = 0 … … 27 35 28 36 /// @todo: use a loop for the subItem levels. 29 mkp.div(class: 'tree') { 30 ul() { 31 img(src: treeRootImg(), alt: 'TreeRoot') 32 for(site in sites.sort { p1, p2 -> p1.name.compareToIgnoreCase(p2.name) }) { 33 li() { 34 if(site.sections) { 35 a(href: toggleBranch(nextDivId()) ) { 36 img( src: bulletTreePlusImg(), id: divId+'img' ) 37 } 38 } 39 else 40 img(src: dashImg()) 41 a( href: siteShowLink(site.id) ) { 42 yieldUnescaped( site.encodeAsHTML() ) 43 } 44 a(href: sectionCreateLink(site.id)) { 45 img(src: addImg(), alt: 'Add', title: 'Add Section') 46 } 47 } 48 if(site.sections) { 49 div(id: divId, style: 'display:none;') { 37 mkp.div(class: 'overlayPane', id: 'assetTreePane', style: 'display:none;') { 38 div(class: 'tree') { 39 table() { 40 tr() { 41 td( valign: 'top', class: 'value') { 50 42 ul() { 51 for(section in site.sections.sort { p1, p2 -> p1.name.compareToIgnoreCase(p2.name) }) { 43 img(src: treeRootImg(), alt: 'TreeRoot') 44 for(site in sites.sort { p1, p2 -> p1.name.compareToIgnoreCase(p2.name) }) { 52 45 li() { 53 if(s ection.assets) {46 if(site.sections) { 54 47 a(href: toggleBranch(nextDivId()) ) { 55 img( src: bulletTreePlusImg(), id: divId+'img' )48 img( src: bulletTreePlusImg(), id: divId+'img' ) 56 49 } 57 50 } 58 51 else 59 52 img(src: dashImg()) 60 a( href: s ectionShowLink(section.id) ) {61 yieldUnescaped( s ection.encodeAsHTML() )53 a( href: siteShowLink(site.id) ) { 54 yieldUnescaped( site.encodeAsHTML() ) 62 55 } 63 a(href: assetCreateLink(section.id)) {64 img(src: addImg(), alt: 'Add', title: 'Add Asset')56 a(href: sectionCreateLink(site.id)) { 57 img(src: addImg(), alt: 'Add', title: 'Add Section') 65 58 } 66 59 } 67 68 if(section.assets) { 69 div(id: divId, style: 'display:none;') { 60 if(site.sections) { 61 div(id: divId, style: 'display:none;') { 70 62 ul() { 71 for( asset in section.assets.sort { p1, p2 -> p1.name.compareToIgnoreCase(p2.name) }) {63 for(section in site.sections.sort { p1, p2 -> p1.name.compareToIgnoreCase(p2.name) }) { 72 64 li() { 73 if( asset.assetSubItems) {65 if(section.assets) { 74 66 a(href: toggleBranch(nextDivId()) ) { 75 67 img(src: bulletTreePlusImg(), id: divId+'img' ) … … 78 70 else 79 71 img(src: dashImg()) 80 a( href: assetShowLink(asset.id) ) {81 yieldUnescaped( asset.encodeAsHTML() )72 a( href: sectionShowLink(section.id) ) { 73 yieldUnescaped( section.encodeAsHTML() ) 82 74 } 83 a(href: asset SubItemCreateLink(asset.id)) {84 img(src: addImg(), alt: 'Add', title: 'Add Sub Item')75 a(href: assetCreateLink(section.id)) { 76 img(src: addImg(), alt: 'Add', title: 'Add Asset') 85 77 } 86 a(href: assetCopyLink(asset.id)) { 87 img(src: copyImg(), alt: 'Add', title: 'Copy Asset') 88 } 89 } // li 90 91 if(asset.assetSubItems) { 92 div(id: divId, style: 'display:none;') { 78 } 79 80 if(section.assets) { 81 div(id: divId, style: 'display:none;') { 93 82 ul() { 94 for(asset SubItemL1 in asset.assetSubItems.sort { p1, p2 -> p1.name.compareToIgnoreCase(p2.name) }) {83 for(asset in section.assets.sort { p1, p2 -> p1.name.compareToIgnoreCase(p2.name) }) { 95 84 li() { 96 if(asset SubItemL1.subItems) {85 if(asset.assetSubItems) { 97 86 a(href: toggleBranch(nextDivId()) ) { 98 87 img(src: bulletTreePlusImg(), id: divId+'img' ) … … 101 90 else 102 91 img(src: dashImg()) 103 a( href: assetS ubItemShowLink(assetSubItemL1.id) ) {104 yieldUnescaped( asset SubItemL1.encodeAsHTML() )92 a( href: assetShowLink(asset.id) ) { 93 yieldUnescaped( asset.encodeAsHTML() ) 105 94 } 106 a(href: assetSubItemCreate WithParentLink(assetSubItemL1.id)) {95 a(href: assetSubItemCreateLink(asset.id)) { 107 96 img(src: addImg(), alt: 'Add', title: 'Add Sub Item') 108 97 } 98 a(href: assetCopyLink(asset.id)) { 99 img(src: copyImg(), alt: 'Add', title: 'Copy Asset') 100 } 109 101 } // li 110 102 111 if(asset SubItemL1.subItems) {112 div(id: divId, 103 if(asset.assetSubItems) { 104 div(id: divId, style: 'display:none;') { 113 105 ul() { 114 for(assetSubItemL 2 in assetSubItemL1.subItems.sort { p1, p2 -> p1.name.compareToIgnoreCase(p2.name) }) {106 for(assetSubItemL1 in asset.assetSubItems.sort { p1, p2 -> p1.name.compareToIgnoreCase(p2.name) }) { 115 107 li() { 116 if(assetSubItemL 2.subItems) {108 if(assetSubItemL1.subItems) { 117 109 a(href: toggleBranch(nextDivId()) ) { 118 img( 110 img(src: bulletTreePlusImg(), id: divId+'img' ) 119 111 } 120 112 } 121 113 else 122 114 img(src: dashImg()) 123 a( href: assetSubItemShowLink(assetSubItemL 2.id) ) {124 yieldUnescaped( assetSubItemL 2.encodeAsHTML() )115 a( href: assetSubItemShowLink(assetSubItemL1.id) ) { 116 yieldUnescaped( assetSubItemL1.encodeAsHTML() ) 125 117 } 126 a(href: assetSubItemCreateWithParentLink(assetSubItemL 2.id)) {118 a(href: assetSubItemCreateWithParentLink(assetSubItemL1.id)) { 127 119 img(src: addImg(), alt: 'Add', title: 'Add Sub Item') 128 120 } 129 121 } // li 130 122 131 if(assetSubItemL 2.subItems) {132 div(id: divId, 123 if(assetSubItemL1.subItems) { 124 div(id: divId, style: 'display:none;') { 133 125 ul() { 134 for(assetSubItemL 3 in assetSubItemL2.subItems.sort { p1, p2 -> p1.name.compareToIgnoreCase(p2.name) }) {126 for(assetSubItemL2 in assetSubItemL1.subItems.sort { p1, p2 -> p1.name.compareToIgnoreCase(p2.name) }) { 135 127 li() { 136 if(assetSubItemL 3.subItems) {128 if(assetSubItemL2.subItems) { 137 129 a(href: toggleBranch(nextDivId()) ) { 138 130 img( src: bulletTreePlusImg(), id: divId+'img' ) … … 141 133 else 142 134 img(src: dashImg()) 143 a( href: assetSubItemShowLink(assetSubItemL 3.id) ) {144 yieldUnescaped( assetSubItemL 3.encodeAsHTML() )135 a( href: assetSubItemShowLink(assetSubItemL2.id) ) { 136 yieldUnescaped( assetSubItemL2.encodeAsHTML() ) 145 137 } 146 a(href: assetSubItemCreateWithParentLink(assetSubItemL 3.id)) {138 a(href: assetSubItemCreateWithParentLink(assetSubItemL2.id)) { 147 139 img(src: addImg(), alt: 'Add', title: 'Add Sub Item') 148 140 } 149 141 } // li 150 142 151 if(assetSubItemL 3.subItems) {152 div(id: divId, 143 if(assetSubItemL2.subItems) { 144 div(id: divId, style: 'display:none;') { 153 145 ul() { 154 for(assetSubItemL 4 in assetSubItemL3.subItems.sort { p1, p2 -> p1.name.compareToIgnoreCase(p2.name) }) {146 for(assetSubItemL3 in assetSubItemL2.subItems.sort { p1, p2 -> p1.name.compareToIgnoreCase(p2.name) }) { 155 147 li() { 156 // if(assetSubItemL4.subItems) { 157 // a(href: toggleBranch(nextDivId()) ) { 158 // img( src: bulletTreePlusImg(), id: divId+'img' ) 159 // } 160 // } 161 // else 162 img(src: dashImg()) 163 a( href: assetSubItemShowLink(assetSubItemL4.id) ) { 164 yieldUnescaped( assetSubItemL4.encodeAsHTML() ) 148 if(assetSubItemL3.subItems) { 149 a(href: toggleBranch(nextDivId()) ) { 150 img( src: bulletTreePlusImg(), id: divId+'img' ) 151 } 165 152 } 166 // a(href: assetSubItemCreateWithParentLink(assetSubItemL4.id)) { 167 // img(src: addImg(), alt: 'Add', title: 'Add Sub Item') 168 // } 153 else 154 img(src: dashImg()) 155 a( href: assetSubItemShowLink(assetSubItemL3.id) ) { 156 yieldUnescaped( assetSubItemL3.encodeAsHTML() ) 157 } 158 a(href: assetSubItemCreateWithParentLink(assetSubItemL3.id)) { 159 img(src: addImg(), alt: 'Add', title: 'Add Sub Item') 160 } 169 161 } // li 170 162 171 } // assetSubItemL4 163 if(assetSubItemL3.subItems) { 164 div(id: divId, style: 'display:none;') { 165 ul() { 166 for(assetSubItemL4 in assetSubItemL3.subItems.sort { p1, p2 -> p1.name.compareToIgnoreCase(p2.name) }) { 167 li() { 168 // if(assetSubItemL4.subItems) { 169 // a(href: toggleBranch(nextDivId()) ) { 170 // img( src: bulletTreePlusImg(), id: divId+'img' ) 171 // } 172 // } 173 // else 174 img(src: dashImg()) 175 a( href: assetSubItemShowLink(assetSubItemL4.id) ) { 176 yieldUnescaped( assetSubItemL4.encodeAsHTML() ) 177 } 178 // a(href: assetSubItemCreateWithParentLink(assetSubItemL4.id)) { 179 // img(src: addImg(), alt: 'Add', title: 'Add Sub Item') 180 // } 181 } // li 182 183 } // assetSubItemL4 184 } // ul 185 } // div 186 } // if(assetSubItemL3.subItems) 187 188 189 } // assetSubItemL3 172 190 } // ul 173 191 } // div 174 } // if(assetSubItemL3.subItems) 175 176 177 } // assetSubItemL3 192 } // if(assetSubItemL2.subItems) 193 194 } // assetSubItemL2 178 195 } // ul 179 196 } // div 180 } // if(assetSubItemL 2.subItems)181 182 } // assetSubItemL 2197 } // if(assetSubItemL1.subItems) 198 199 } // assetSubItemL1 183 200 } // ul 184 201 } // div 185 } // if(asset SubItemL1.subItems)186 187 } // asset SubItemL1202 } // if(asset.assetSubItems) 203 204 } // assets 188 205 } // ul 189 206 } // div 190 } // if( asset.assetSubItems)191 192 } // assets207 } // if(section.assets) 208 209 } //sections 193 210 } // ul 194 211 } // div 195 } // if(section.assets) 196 197 } //sections 212 } // if(site.sections) 213 } // sites 198 214 } // ul 199 } // div 200 } // if(site.sections) 201 } // sites 202 } // ul 215 } // td 216 } // tr 217 } // table 218 } // div 219 220 div( class: 'buttons') { 221 span(class: 'button') { 222 input(type: 'button', value: 'Close', onclick: 'return hideElement("assetTreePane");') 223 } 224 } 225 203 226 } // mkp 204 227 … … 231 254 /** js calls */ 232 255 256 def showPane() { 257 'javascript: showDiv(\"assetTreePane\");' 258 } 259 233 260 def toggleBranch(divId) { 234 261 /// @todo: toggleBranch is in overlayPane.js and should be moved to tree.js 235 'javascript: toggleBranch(\"' + divId + '\", \"' + divId + 'img' + '\");'262 'javascript: toggleBranch(\"' + divId + '\", \"' + divId + 'img' +'\", \"' + bulletTreeMinusImg() +'\", \"' + bulletTreePlusImg() + '\");' 236 263 } 237 264 -
trunk/grails-app/views/layouts/main.gsp
r182 r306 10 10 <g:javascript library="application" /> 11 11 <g:javascript library="prototype/effects" /> 12 <g:javascript src="overlayPane.js" /> 12 13 </head> 13 14 … … 33 34 <nav:render group="nav"/> 34 35 </div> 36 <gnuMims:assetTreeButton /> 35 37 </div> 36 </g:isLoggedIn> 38 </g:isLoggedIn> 37 39 38 40 <g:layoutBody /> … … 42 44 </div> 43 45 </div> <!-- wrapper --> 44 </body> 46 47 <!-- Asset Tree Pane --> 48 <gnuMims:assetTree /> 49 50 </body> 45 51 </html>
Note: See TracChangeset
for help on using the changeset viewer.