-
Notifications
You must be signed in to change notification settings - Fork 174
/
showPlugin.gsp
182 lines (168 loc) · 7.65 KB
/
showPlugin.gsp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
<%@ page import="org.grails.plugin.Plugin" %>
<g:setProvider library="yui"/>
<html>
<head>
<meta name="layout" content="pluginDetails">
</head>
<body>
<div id="pluginDetailsBox">
<div id="pluginDetailsTop"></div>
<div id="pluginDetailsContainer">
<g:if test="${plugin.zombie}">
<div id="pluginZombie">
<h1><g:message code="plugin.zombie"/></h1>
<!%-- TODO Add 'Revive' link --%>
</div>
</g:if>
<gui:dialog id='loginDialog' title="Login required" modal="true">
<div id='loginFormDiv'></div>
</gui:dialog>
<div id="downloadBox">
<a href="${plugin.downloadUrl}"><r:img uri="/images/new/plugins/Buttons/downloadBox_btn.png" alt="Download" border="0"/></a>
</div>
<h1 id="pluginBoxTitle">${plugin?.title?.encodeAsHTML()}</h1>
<div class="ratingBox">
<shiro:isLoggedIn>
<rateable:ratings bean="${plugin}"/>
</shiro:isLoggedIn>
<shiro:isNotLoggedIn>
<div id="ratingDisplay">
<rateable:ratings bean="${plugin}" active="false" href="${createLink(controller:'user', action:'login', params:[targetUri:request.forwardURI])}"/>
</div>
</shiro:isNotLoggedIn>
</div>
<div class="pluginDetail">
<g:if test="${plugin.usage}">
<div class="pluginUsage">
<div>Used by approximately</div>
<div class="value"><g:formatNumber number="${plugin.usage}" type="percent"/></div>
<div>of Grails users</div>
</div>
</g:if>
<table>
<tr>
<th>Author(s)</th>
<td>${plugin.author?.encodeAsHTML()}</td>
</tr>
<tr>
<th>Current Release</th>
<td>${plugin.currentRelease?.encodeAsHTML()}<g:if test="${plugin.lastReleased}"> (<prettytime:display date="${plugin.lastReleased}"/>)</g:if></td>
</tr>
<tr>
<th>Grails Version</th>
<td>${plugin.grailsVersion?.encodeAsHTML() ?: '?'}</td>
</tr>
<g:if test="${plugin.licenses?.size()}">
<tr>
<th>License(s)</th>
<td>${plugin.licenses.sort { it.name }.collect { l -> '<a href="' + l.url.encodeAsHTML() + '">' + l.name.encodeAsHTML() + '</a>' }.join(', ') }</td>
</tr>
</g:if>
<g:if test="${plugin.organization}">
<tr>
<th>Organization</th>
<td>
<g:if test="${plugin.organizationUrl}"><a href="${plugin.organizationUrl.encodeAsHTML()}"></g:if>
${plugin.organization.encodeAsHTML()}
<g:if test="${plugin.organizationUrl}"></a></g:if>
</tr>
</g:if>
<tr>
<th>Tags</th>
<td class='tags'>
<span id='pluginTags'>
<g:render template='tags' var='plugin' bean="${plugin}"/>
</span>
<span id='addTagTrigger'><r:img uri="/images/famfamfam/add.png"/></span>
</td>
</tr>
<tr>
<th>Dependency</th>
<td><pre>${plugin.defaultDependencyScope} "${plugin.dependencyDeclaration.encodeAsHTML()}"</pre></td>
</tr>
<g:if test="${plugin.customRepositoriesDeclaration}">
<tr>
<th>Custom repositories</th>
<td><pre>${plugin.customRepositoriesDeclaration.encodeAsHTML()}</pre></td>
</tr>
</g:if>
</table>
</div>
<ul class="links">
<tmpl:pluginLinks plugin="${plugin}" />
<li>
<g:link controller="plugin" action="editPlugin" id="${plugin.id}">
<r:img uri="/images/new/plugins/icons/16x16_icons/edit.png" border="0" /> Edit Plugin
</g:link>
</li>
</ul>
</div>
<div class="description">
<wiki:text key="${'pluginInfo_' + plugin?.name}">${plugin?.summary}</wiki:text>
</div>
</div>
</div>
%{--
Logged in users will be able to add tags
--}%
<shiro:isLoggedIn>
<gui:dialog id='addTagDialog'
title='Add Tags'
form='true' url="${createLink(controller:'plugin', action:'addTag', params:[id:plugin.id])}"
triggers="[show:[id:'addTagTrigger',on:'click']]"
update='pluginTags'
>
<gui:autoComplete id='newTag'
controller='tag' action='autoCompleteNames'
resultName='tagResults'
labelField='name'
minQueryLength='1'
queryDelay='1'
/>
</gui:dialog>
<script>
YAHOO.util.Event.onDOMReady(function() {
// on show, put the dialog in the right place
GRAILSUI.addTagDialog.subscribe('show', function() {
var pos = YAHOO.util.Dom.getXY('addTagTrigger');
this.cfg.setProperty('x',pos[0]+20);
this.cfg.setProperty('y',pos[1]+20);
});
// on hide, clear out the text within it
GRAILSUI.addTagDialog.subscribe('hide', function() {
document.getElementById('newTag').value = ''
});
});
</script>
</shiro:isLoggedIn>
%{-- Unauthenticated users get defered to the login screen --}%
<shiro:isNotLoggedIn>
<script>
YAHOO.util.Event.onDOMReady(function() {
// on show, put the dialog in the right place
YAHOO.util.Event.on('addTagTrigger', 'click', function() {
window.location = "${createLink(controller:'user', action:'login', params:[targetUri:request.forwardURI])}";
});
// also hang up rating click if not logged in, redirect to login page with targetUri of this page
// for redirect
YAHOO.util.Event.on('ratingdiv', 'click', function(e) {
YAHOO.util.Event.stopEvent(e);
window.location = "${createLink(controller:'user', action:'login', params:[targetUri:request.forwardURI])}";
});
});
</script>
</shiro:isNotLoggedIn>
<div id="pluginContent">
<cache:text key="pluginTabs_${plugin.id}">
<gui:tabView>
<g:each var="wiki" in="${Plugin.WIKIS}">
<gui:tab id="${wiki}Tab" label="${wiki[0].toUpperCase() + wiki[1..-1]}" active="${wiki == 'description'}">
<g:include controller="pluginTab" action="index"
id="${plugin[wiki].title}" params="[_ul: wiki + 'Tab']"/>
</gui:tab>
</g:each>
</gui:tabView>
</cache:text>
</div>
</body>
</html>