Skip to content

Commit

Permalink
tuning widokow
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomasz Stachewicz committed Dec 19, 2008
1 parent 50c495a commit 5583ce5
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 63 deletions.
5 changes: 5 additions & 0 deletions grails-app/domain/Exercise.groovy
@@ -1,11 +1,16 @@
class Exercise {
String title
String description

static mapping = { description type:"text" }

//static hasMany = [userexercises:UserExercise]
static hasMany = [participations:Participation]

static constraints = {
title(minLength:10, blank:false)
description(minLength:20, blank:false)
}

String toString() {"${this.id}: ${this.title}" }
}
2 changes: 2 additions & 0 deletions grails-app/domain/Participation.groovy
@@ -1,6 +1,8 @@
class Participation {
Date startDateTime
float endMark
Exercise exercise

static belongsTo = Exercise
static optionals = ["endMark"]
}
59 changes: 20 additions & 39 deletions grails-app/views/exercises/edit.gsp
@@ -1,5 +1,3 @@


<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
Expand All @@ -13,7 +11,7 @@
<span class="menuButton"><g:link class="create" action="create">New Exercise</g:link></span>
</div>
<div class="body">
<h1>Edit Exercise</h1>
<h1>Edytuj Ćwiczenie</h1>
<g:if test="${flash.message}">
<div class="message">${flash.message}</div>
</g:if>
Expand All @@ -22,50 +20,33 @@
<g:renderErrors bean="${exerciseInstance}" as="list" />
</div>
</g:hasErrors>
<g:form method="post" >
<g:form method="post" action="update" >
<input type="hidden" name="id" value="${exerciseInstance?.id}" />
<div class="dialog">
<table>
<tbody>

<tr class="prop">
<td valign="top" class="name">
<label for="description">Description:</label>
</td>
<td valign="top" class="value ${hasErrors(bean:exerciseInstance,field:'description','errors')}">
<input type="text" id="description" name="description" value="${fieldValue(bean:exerciseInstance,field:'description')}"/>
</td>
</tr>

<tr class="prop">
<td valign="top" class="name">
<label for="participations">Participations:</label>
</td>
<td valign="top" class="value ${hasErrors(bean:exerciseInstance,field:'participations','errors')}">

<ul>
<g:each var="p" in="${exerciseInstance?.participations?}">
<li><g:link controller="participation" action="show" id="${p.id}">${p?.encodeAsHTML()}</g:link></li>
</g:each>
</ul>
<g:link controller="participation" params="['exercise.id':exerciseInstance?.id]" action="create">Add Participation</g:link>

</td>
</tr>

<tr class="prop">
<td valign="top" class="name">
<label for="title">Title:</label>
</td>
<td valign="top" class="value ${hasErrors(bean:exerciseInstance,field:'title','errors')}">
<input type="text" id="title" name="title" value="${fieldValue(bean:exerciseInstance,field:'title')}"/>
</td>
</tr>

<tr class="prop">
<td valign="top" class="name">
<label for="title">Tytuł:</label>
</td>
<td valign="top" class="value ${hasErrors(bean:exerciseInstance,field:'title','errors')}">
<input type="text" id="title" name="title" value="${fieldValue(bean:exerciseInstance,field:'title')}"/>
</td>
</tr>

<tr class="prop">
<td valign="top" class="name">
<label for="description">Opis:</label>
</td>
<td valign="top" class="value ${hasErrors(bean:exerciseInstance,field:'description','errors')}">
<textarea id="description" name="description">${fieldValue(bean:exerciseInstance,field:'description')}</textarea>
</td>
</tr>
</tbody>
</table>
</div>
<div class="buttons">
<span class="button"><input class="save" type="submit" value="Aktualizuj" /></span>
<span class="button"><g:actionSubmit class="save" value="Update" /></span>
<span class="button"><g:actionSubmit class="delete" onclick="return confirm('Are you sure?');" value="Delete" /></span>
</div>
Expand Down
6 changes: 3 additions & 3 deletions grails-app/views/exercises/list.gsp
Expand Up @@ -21,7 +21,7 @@

<g:sortableColumn property="id" title="Id" />

<g:sortableColumn property="description" title="Description" />
<!--<g:sortableColumn property="description" title="Description" />-->

<g:sortableColumn property="title" title="Title" />

Expand All @@ -33,9 +33,9 @@

<td><g:link action="show" id="${exerciseInstance.id}">${fieldValue(bean:exerciseInstance, field:'id')}</g:link></td>

<td>${fieldValue(bean:exerciseInstance, field:'description')}</td>
<!--<td>${fieldValue(bean:exerciseInstance, field:'description')}</td>-->

<td>${fieldValue(bean:exerciseInstance, field:'title')}</td>
<td><g:link action="show" id="${exerciseInstance.id}">${fieldValue(bean:exerciseInstance, field:'title')}</g:link></td>

</tr>
</g:each>
Expand Down
32 changes: 18 additions & 14 deletions grails-app/views/exercises/show.gsp
Expand Up @@ -28,14 +28,21 @@
<td valign="top" class="value">${fieldValue(bean:exerciseInstance, field:'id')}</td>

</tr>

<tr class="prop">
<td valign="top" class="name">Tytuł:</td>

<td valign="top" class="value">${fieldValue(bean:exerciseInstance, field:'title')}</td>

</tr>

<tr class="prop">
<td valign="top" class="name">Description:</td>
<td valign="top" class="name">Opis:</td>

<td valign="top" class="value">${fieldValue(bean:exerciseInstance, field:'description')}</td>

</tr>

<!--
<tr class="prop">
<td valign="top" class="name">Participations:</td>
Expand All @@ -48,24 +55,21 @@
</td>
</tr>

<tr class="prop">
<td valign="top" class="name">Title:</td>

<td valign="top" class="value">${fieldValue(bean:exerciseInstance, field:'title')}</td>

</tr>
-->


</tbody>
</table>
</div>
<div class="buttons">
<g:form>
<input type="hidden" name="id" value="${exerciseInstance?.id}" />
<span class="button"><g:actionSubmit class="edit" value="Edit" /></span>
<span class="button"><g:actionSubmit class="delete" onclick="return confirm('Are you sure?');" value="Delete" /></span>
</g:form>
<span class="button"><g:link class="edit" action="edit" id="${exerciseInstance?.id}">Edytuj</g:link></span>
<span class="button"><g:link class="delete" action="delete" id="${menuInstance?.id}" onclick="return confirm('Czy jesteś pewny?');">Usuń</g:link></span>
</div>
</div>
</body>
</html>

<g:if test="${menuInstance && menuInstance.id}">
<span class="menuButton"><g:link class="edit" action="edit" id="${menuInstance?.id}">Edytuj pozycję</g:link></span>
<span class="menuButton"><g:link class="delete" action="delete" id="${menuInstance?.id}" onclick="return confirm('Czy jesteś pewny?');">Usuń pozycję</g:link></span>
</g:if>
21 changes: 14 additions & 7 deletions grails-app/views/participations/create.gsp
@@ -1,5 +1,3 @@


<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
Expand All @@ -9,10 +7,10 @@
<body>
<div class="nav">
<span class="menuButton"><a class="home" href="${createLinkTo(dir:'')}">Home</a></span>
<span class="menuButton"><g:link class="list" action="list">Participation List</g:link></span>
<span class="menuButton"><g:link class="list" action="list">Udziały</g:link></span>
</div>
<div class="body">
<h1>Create Participation</h1>
<h1>Stwórz udział</h1>
<g:if test="${flash.message}">
<div class="message">${flash.message}</div>
</g:if>
Expand All @@ -28,7 +26,7 @@

<tr class="prop">
<td valign="top" class="name">
<label for="endMark">End Mark:</label>
<label for="endMark">Ocena końcowa:</label>
</td>
<td valign="top" class="value ${hasErrors(bean:participationInstance,field:'endMark','errors')}">
<input type="text" id="endMark" name="endMark" value="${fieldValue(bean:participationInstance,field:'endMark')}" />
Expand All @@ -37,12 +35,21 @@

<tr class="prop">
<td valign="top" class="name">
<label for="startDateTime">Start Date Time:</label>
<label for="startDateTime">Dzień rozpoczęcia:</label>
</td>
<td valign="top" class="value ${hasErrors(bean:participationInstance,field:'startDateTime','errors')}">
<g:datePicker name="startDateTime" value="${participationInstance?.startDateTime}" ></g:datePicker>
</td>
</tr>
</tr>

<tr class="prop">
<td valign="top" class="name">
<label for="exercise">Ćwiczenie:</label>
</td>
<td valign="top" class="value ${hasErrors(bean:participationInstance,field:'exercise','errors')}">
<g:select optionKey="id" from="${Exercise.list()}" name="exercise.id" value="${participationInstance?.exercise?.id}" ></g:select>
</td>
</tr>

</tbody>
</table>
Expand Down

0 comments on commit 5583ce5

Please sign in to comment.