Skip to content

Commit

Permalink
Changed return type of listThemes and listSets tags, added UI for dis…
Browse files Browse the repository at this point in the history
…playing theme+ui set info in tools
  • Loading branch information
marcpalmer committed Nov 30, 2012
1 parent 55ab74a commit af3cf1e
Show file tree
Hide file tree
Showing 12 changed files with 96 additions and 39 deletions.
2 changes: 1 addition & 1 deletion PlatformUiGrailsPlugin.groovy
Expand Up @@ -19,7 +19,7 @@ import org.springframework.core.io.FileSystemResource

class PlatformUiGrailsPlugin {
// the plugin version
def version = "1.0.RC1"
def version = "1.0.RC2"
// the version or versions of Grails the plugin is designed for
def grailsVersion = "1.3 > *"

Expand Down
6 changes: 4 additions & 2 deletions grails-app/conf/BuildConfig.groovy
Expand Up @@ -42,8 +42,10 @@ grails.project.dependency.resolution = {
export = false
}

compile(':platform-core:1.0.RC1')
runtime(':resources:1.2-RC1')
compile(':platform-core:1.0.RC2')
runtime(':resources:1.2.RC2')

// runtime(':bootstrap-theme:1.0.RC2')
/*
compile(':spock:0.6-SNAPSHOT'){
export = false
Expand Down
Expand Up @@ -30,7 +30,7 @@ class ThemeTagLib {
static REQ_ATTR_ZONE_LIST = 'zone.list'
static REQ_ATTR_TITLE = 'title'

static returnObjectForTags = ['name', 'current', 'list']
static returnObjectForTags = ['name', 'current', 'listThemes']

def grailsThemes
def grailsViewFinder
Expand Down Expand Up @@ -166,8 +166,8 @@ class ThemeTagLib {
out << grailsThemes.getRequestTheme(request).name
}

def list = { attrs ->
grailsThemes.availableThemes.name
def listThemes = { attrs ->
grailsThemes.availableThemes
}

void mustBeInALayout(tagName) {
Expand Down
Expand Up @@ -105,7 +105,7 @@ class UITagLib implements InitializingBean {
}

def listSets = { attrs ->
grailsUISets.availableUISets.name
grailsUISets.availableUISets
}

/**
Expand Down
2 changes: 1 addition & 1 deletion grails-app/views/platformUi/_themeSelector.gsp
Expand Up @@ -2,7 +2,7 @@
<p:uiOverlay>
<div id="themeselecta">
<form method="GET">
<label for="theme">Theme</label><g:select name="_debugThemeName" from="${theme.list()}" value="${theme.name()}"/>
<label for="theme">Theme</label><g:select name="_debugThemeName" from="${theme.listThemes().name}" value="${theme.name()}"/>
<%-- @todo include all layouts for all themes and show correct ones --%><br/>
<label for="layout">Layout</label><g:select name="_debugThemeLayout" from="${theme.current().layouts}" value="${params._debugThemeLayout ?: 'main'}"/><br/>
<g:checkBox name="_debugThemeUISample" checked="${params._debugThemeUISample != null}"/> UI Test<br/>
Expand Down
67 changes: 60 additions & 7 deletions grails-app/views/platformUi/index.gsp
@@ -1,21 +1,74 @@
<!doctype html>
<html>
<head>
<title>Plugin Platform UI</title>
<title>Grails Platform UI</title>
<meta name="layout" content="platform/dev"/>
<r:script>
$(".collapse").collapse();
</r:script>
</head>
<body>
<div class="hero-unit">
<h1>Grails Platform UI</h1>
<p>Welcome the the Grails Plugin Platform UI test page</p>
<p>Welcome the the Platform UI tools</p>
</div>

<p>Here's what you can do:

<section>
<h2>Tools</h2>
<ul>
<li><g:link mapping="platformUiNormal" controller="platformUi" action="themes">Theme previewer</g:link></li>
<li><g:link mapping="platformUiNormal" controller="platformUi" action="uisets">UI Set previewer</g:link></li>
<li><g:link mapping="platformUiNormal" controller="platformUi" action="themes">Open Theme previewer</g:link></li>
<li><g:link mapping="platformUiNormal" controller="platformUi" action="uisets">Open UI Set previewer</g:link></li>
</ul>
</p>
</section>

<section>
<h2>You have the following Themes installed:</h2>
<div class="accordion" id="themeList">
<g:each in="${theme.listThemes()}" var="t" status="i">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#themeList" href="#theme${i}">
${t.name.encodeAsHTML()}
</a>
</div>
<div id="theme${i}" class="accordion-body collapse in">
<div class="accordion-inner">
Uses UI Set [${t.uiSet.encodeAsHTML()}], defined by plugin [${t.definingPlugin?.name.encodeAsHTML()}], layouts:
<ul>
<g:each in="${t.layoutPaths}" var="l">
<li>
<strong>${l.key.encodeAsHTML()}</strong> &raquo; ${l.value.encodeAsHTML()}
</li>
</g:each>
</ul>
</div>
</div>
</div>
</g:each>
</div>

<h2>You have the following UI Sets installed:</h2>
<div class="accordion" id="uiSetList">
<g:each in="${ui.listSets()}" var="s" status="i">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#uiSetList" href="#uiSet${i}">
${s.name.encodeAsHTML()}
</a>
</div>
<div id="uiSet${i}" class="accordion-body collapse in">
<div class="accordion-inner">
Defined by plugin [${s.definingPlugin?.name.encodeAsHTML()}], layouts:
<ul>
<g:each in="${s.layoutPaths}" var="l">
<li><strong>${l.key.encodeAsHTML()}</strong> &raquo; ${l.value.encodeAsHTML()}</li>
</g:each>
</ul>
</div>
</div>
</div>
</g:each>
</div>
</section>
</body>
</html>
2 changes: 1 addition & 1 deletion grails-app/views/platformUi/themes.gsp
Expand Up @@ -13,7 +13,7 @@
<p:uiOverlay>
<div id="themeselecta">
<form method="GET">
<label for="theme">Theme</label><g:select name="theme" from="${theme.list()}" value="${theme.name()}"/>
<label for="theme">Theme</label><g:select name="theme" from="${theme.listThemes().name}" value="${theme.name()}"/>
<%-- @todo include all layouts for all themes and show correct ones --%><br/>
<label for="layout">Layout</label><g:select name="layout" from="${theme.current().layouts}" value="${params.layout ?: 'main'}"/><br/>
<g:checkBox name="uitest" checked="${params.uitest != null}"/> UI Test<br/>
Expand Down
2 changes: 1 addition & 1 deletion src/docs/guide/creatingThemes/themeRequirements.gdoc
Expand Up @@ -7,7 +7,7 @@ All themes must supply a minimum set of standard layouts.
Failure to do so means that plugins that rely on any missing layouts will break. However themes can provide a superset of the
required themes - so this list of required layouts is kept to a bare minimum.

Each required layout also has a [list of required zone names|guide:themeRequiredZones], so that plugins and apps know what they can/should provide for each.
Each required layout also has a list of required zone names|guide:themeRequiredZones], so that plugins and apps know what they can/should provide for each.

The required layouts are:

Expand Down
20 changes: 0 additions & 20 deletions src/docs/ref/Theme Tags/list.gdoc

This file was deleted.

20 changes: 20 additions & 0 deletions src/docs/ref/Theme Tags/listThemes.gdoc
@@ -0,0 +1,20 @@
h1. theme:listThemes

h2. Purpose

Returns a list of the available Theme definitions.

Useful if you want the user to be able to select the current theme, or inspect the loaded themes

h2. Example

{docx:xml}
Change theme: <g:select from="${theme.listThemes().name}"/>
{docx}

h2. Attributes

None.



4 changes: 2 additions & 2 deletions src/docs/ref/Ui Template Tags/listSets.gdoc
Expand Up @@ -2,12 +2,12 @@ h1. ui:listSets

h2. Purpose

Returns the list of available UI Set names.
Returns the list of available UI Set definitions.

h2. Example

{docx:xml}
<g:select name="allUiSets" from="${ui.listSets()}"/>
<g:select name="allUiSets" from="${ui.listSets().name}"/>
{docx}

h2. Attributes
Expand Down
2 changes: 2 additions & 0 deletions src/groovy/org/grails/plugin/platform/views/ViewInfo.groovy
Expand Up @@ -24,4 +24,6 @@ class ViewInfo {
String name
String plugin
String path

String toString() { "View at path [${path}] in [${plugin}] with name [${name}] owned by [${owner}]"}
}

0 comments on commit af3cf1e

Please sign in to comment.