提交 ce02fd7a 编写于 作者: D Daniel Beck

Improve the 'noJob' view immediately after setup

上级 449c5ace
package hudson.model.AllView
import hudson.model.Computer
import hudson.model.Item
import jenkins.model.Jenkins
div {
h1(_("Welcome to Jenkins!"))
if (my.owner == Jenkins.get()) {
// we're a top-level 'All' view
if (Jenkins.get().hasPermission(Computer.CREATE) && Jenkins.get().clouds.isEmpty() && Jenkins.get().getNodes().isEmpty()) {
div(class: 'call-to-action') {
if (Jenkins.get().hasPermission(Jenkins.ADMINISTER)) {
raw(_("distributedBuildsWithCloud"))
} else {
raw(_("distributedBuilds"))
}
}
}
if (my.owner.hasPermission(Item.CREATE)) {
div(class: 'call-to-action') {
raw(_("newJob"))
}
}
} else {
// we're in a folder
if (my.owner.hasPermission(Item.CREATE)) {
div(class: 'call-to-action') {
raw(_("newJob"))
}
}
}
if (h.isAnonymous() && !my.owner.hasPermission(Item.CREATE)) {
div(class:'call-to-action') {
raw(_("login", rootURL, app.securityRealm.loginUrl, request.requestURI))
if (app.securityRealm.allowsSignup()) {
text(" ") // TODO make this nicer
raw(_("signup"))
}
}
}
}
<!--
The MIT License
Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-->
<?jelly escape-by-default='true'?>
<div>
<!--
This is a good place to add "welcome" materials, like pointers to the website and etc
-->
<h1>${%Welcome to Jenkins!}</h1>
<j:choose xmlns:j="jelly:core">
<!-- Only show the create new jobs link to those users that have permission to use it. -->
<j:getStatic var="permission" className="hudson.model.Item" field="CREATE"/>
<j:when test="${h.hasPermission(it.owner, permission)}">
<div class="call-to-action">${%newJob}</div>
</j:when>
<j:otherwise>
<!-- Offer anonymous users the chance to login, then they can create jobs. -->
<j:if test="${h.isAnonymous()}">
<div class="call-to-action">
${%login(rootURL, app.securityRealm.loginUrl, request.requestURI)}
<!-- Also offer them the opportunity to sign-up for an account, if this facility is available. -->
<j:if test="${app.securityRealm.allowsSignup()}">
${%signup}
</j:if>
</div>
</j:if>
</j:otherwise>
</j:choose>
</div>
\ No newline at end of file
...@@ -20,8 +20,14 @@ ...@@ -20,8 +20,14 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE. # THE SOFTWARE.
newJob=Please <a href="newJob">create new jobs</a> to get started. newJob=<a href="newJob">Create a job</a> to start building your software project.
login=<a href="{0}/{1}?from={2}">Log in</a> to create new jobs. distributedBuildsWithCloud=<a href="computer/new">Create an agent</a> or <a href="configureClouds">configure a cloud</a> to set up distributed builds. \
<a href="https://jenkins.io/redirects/distributed-builds">Learn more</a>.
signup=If you don\u2019t already have an account, you can <a href="signup">sign-up</a> now. distributedBuilds=<a href="computer/new">Create an agent</a> to set up distributed builds. \
<a href="https://jenkins.io/redirects/distributed-builds">Learn more</a>.
login=You are not logged in. <a href="{0}/{1}?from={2}">Log in now</a> to view or create jobs.
signup=If you don\u2019t already have an account, you can <a href="signup">sign up</a> now.
...@@ -196,7 +196,8 @@ a.tip:hover span { ...@@ -196,7 +196,8 @@ a.tip:hover span {
} }
.call-to-action { .call-to-action {
display: inline-block; display: table;
margin-bottom: 5px;
padding: 10px; padding: 10px;
background-color: #cdf0f2; background-color: #cdf0f2;
border-left: 4px solid #577baa; border-left: 4px solid #577baa;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册