Changeset 521 for trunk/grails-app


Ignore:
Timestamp:
May 4, 2010, 12:35:41 AM (15 years ago)
Author:
gav
Message:

Add version information to about view.

Location:
trunk/grails-app
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/controllers/AppCoreController.groovy

    r439 r521  
    11import org.codehaus.groovy.grails.plugins.springsecurity.Secured
    22import org.codehaus.groovy.grails.commons.*
     3import org.apache.commons.lang.WordUtils
    34
    45/**
     
    3536    */
    3637    def start = {
     38        def grailsVersion = grailsApplication.metadata['app.grails.version']
     39        def applicationVersion = grailsApplication.metadata['app.version']
     40        def applicationName = grailsApplication.metadata['app.name']
     41        def applicationVcsRevision = grailsApplication.metadata['app.vcsRevision']
     42
     43        // Build the application string.
     44        def applicationString = WordUtils.capitalize(applicationName)
     45        if(applicationVersion)
     46            applicationString += "-" + applicationVersion
     47        if(applicationVcsRevision) {
     48            if(applicationVcsRevision.size() > 7)  { // Svn's $Rev: NUM $
     49                applicationVcsRevision = applicationVcsRevision[6..-3]
     50                applicationString += " (r" + applicationVcsRevision + ")"
     51            }
     52            else
     53                applicationString += " (" + applicationVcsRevision + ")"
     54        }
     55
     56        // Build the plugins string.
     57        def pluginProperties = grailsApplication.metadata.findAll {it.key.contains('plugin')}
     58        pluginProperties.each() {
     59            it.key = WordUtils.capitalize( (it.key + GString.EMPTY).split("\\.")[-1] )
     60        }
     61        pluginProperties = pluginProperties.sort { p1, p2 -> p1.key.compareToIgnoreCase(p2.key) }
     62        def plugins = pluginProperties.collect{ it.key + '-' + it.value }.join(", ")
     63
     64        return [grailsVersion: grailsVersion,
     65                    applicationString: applicationString,
     66                    plugins: plugins]
    3767    }
    3868
  • trunk/grails-app/views/_about.gsp

    r428 r521  
    55        <tbody>
    66            <tr><td>
    7                 GnuMims provides a powerful but simple to use Maintenance and Inventory Management Solution for your Assets.
     7                ${applicationString.encodeAsHTML()} provides a powerful but simple to use
     8                Maintenance and Inventory Management Solution for your Assets.
    89                Also known as a computerised maintenance management system or CMMS.
    910                Initially designed with an engineering department and mid-size industrial production enviroment in mind.
     
    183184    <table>
    184185        <tbody>
    185             <tr><td>
    186                 The Grails web framework and the plugins used are available under
    187                 their respective licenses from  <a href="http://www.grails.org">http://www.grails.org</a>
    188             </td></tr>
    189         </tbody>
    190     </table>
    191 </div>
     186            <tr>
     187                <td>
     188                The Grails-${grailsVersion.encodeAsHTML()} web framework and the plugins used are available under
     189                the <a href="http://www.apache.org/licenses/LICENSE-2.0.html">Apache 2.0</a>
     190                license from  <a href="http://www.grails.org">http://www.grails.org</a>
     191                </td>
     192            </tr>
     193                <tr>
     194                    <td>
     195                        Plugins: ${plugins}
     196                    </td>
     197                </tr>
     198        </tbody>
     199    </table>
     200</div>
Note: See TracChangeset for help on using the changeset viewer.