Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
...
Checking mergeability… Don't worry, you can still create the pull request.
  • 2 commits
  • 8 files changed
  • 0 commit comments
  • 1 contributor
View
33 grails-app/controllers/se/lagrummet/PageController.groovy
@@ -142,32 +142,17 @@ class PageController {
def show = {
def url = (params.permalink) ? params.permalink.tokenize("/") : ["home"]
def permalink = url[url.size()-1]
-
- def page
+
def now = new Date()
- if (url.size() < 2) {
- page = Page.withCriteria(uniqueResult:true) {
- eq("permalink", permalink)
- eq("status", "published")
- le('publishStart', now)
- or {
- ge('publishStop', now)
- isNull('publishStop')
- }
- maxResults(1)
- }
- } else {
- def parentPermalink = (url[url.size()-2])
- page = Page.withCriteria(uniqueResult:true) {
- eq("permalink", permalink)
- eq("status", "published")
- le('publishStart', now)
- or {
- ge('publishStop', now)
- isNull('publishStop')
- }
- maxResults(1)
+ def page = Page.withCriteria(uniqueResult:true) {
+ eq("permalink", permalink)
+ eq("status", "published")
+ le('publishStart', now)
+ or {
+ ge('publishStop', now)
+ isNull('publishStop')
}
+ maxResults(1)
}
if(page != null && !page.metaPage) {
View
8 grails-app/domain/se/lagrummet/Page.groovy
@@ -42,7 +42,13 @@ class Page implements Comparable<Page>{
def isCurrentlyPublished() {
def now = new Date()
- return status == "published" && publishStart < now && (publishStop == null || publishStop > now)
+ def status = "published" && publishStart < now && (publishStop == null || publishStop > now)
+ if (!status && autoSaves) {
+ autoSaves.each { it ->
+ if (it.status == 'published' && it.publishStart <= now && (it.publishStop == null || it.publishStop >= now)) status = true
+ }
+ }
+ return status
}
def getCurrentPageStatus() {
View
10 grails-app/taglib/se/lagrummet/MenuTagLib.groovy
@@ -30,10 +30,16 @@ class MenuTagLib {
if(attrs.activePage) {
page = attrs.activePage
}
+
+ def now = new Date()
def rootNode = Page.withCriteria(uniqueResult:true) {
eq("permalink", attrs.root)
eq("status", "published")
- le('publishStart', new Date())
+ le('publishStart', now)
+ or {
+ ge('publishStop', now)
+ isNull('publishStop')
+ }
maxResults(1)
}
if(!rootNode){
@@ -95,7 +101,7 @@ class MenuTagLib {
def createListElement(builder, node) {
def active = ""
- if(node.id == page?.id){
+ if(node.permalink == page?.permalink){
active = "active"
}
builder.li('class':active) {
View
7 grails-app/views/layouts/main.gsp
@@ -2,9 +2,10 @@
<html>
<head>
<title><g:layoutTitle default="Grails" /></title>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" href="${resource(dir:'css',file:'main.css')}" />
<link rel="stylesheet" type="text/css" media="print" href="${resource(dir:'css',file:'print.css')}" />
- <META name="serverURL" content="${resource()}">
+ <META name="serverURL" content="${resource()}" />
<link href="${resource(dir:'images',file:'favicon.ico')}" rel="shortcut icon" />
<g:mobileDeviceWidth />
<g:layoutHead />
@@ -34,10 +35,10 @@
<select id="cat" name="cat">
<g:each in="${siteProps?.searchCats}">
<g:if test="${session?.cat == it}">
- <option value="${it}" selected="selected" rel="${message(code:"category.description.$it")}"><g:message code="category.${it}"/></option>
+ <option value="${it}" selected="selected" data-rel="${message(code:"category.description.$it")}"><g:message code="category.${it}"/></option>
</g:if>
<g:else>
- <option value="${it}" rel="${message(code:"category.description.$it")}"><g:message code="category.${it}"/></option>
+ <option value="${it}" data-rel="${message(code:"category.description.$it")}"><g:message code="category.${it}"/></option>
</g:else>
</g:each>
</select>
View
4 grails-app/views/layouts/mainEnglish.gsp
@@ -34,10 +34,10 @@
<select id="cat" name="cat">
<g:each in="${siteProps?.searchCats}">
<g:if test="${session?.cat == it}">
- <option value="${it}" selected="selected" rel="${message(code:"category.description.$it")}"><g:message code="category.${it}"/></option>
+ <option value="${it}" selected="selected" data-rel="${message(code:"category.description.$it")}"><g:message code="category.${it}"/></option>
</g:if>
<g:else>
- <option value="${it}" rel="${message(code:"category.description.$it")}"><g:message code="category.${it}"/></option>
+ <option value="${it}" data-rel="${message(code:"category.description.$it")}"><g:message code="category.${it}"/></option>
</g:else>
</g:each>
</select>
View
16 grails-app/views/page/_pageEditForm.gsp
@@ -65,16 +65,16 @@
</div>
<div class="aside publish">
- <g:if test="${pageInstance.id && pageInstance.status == 'draft'}">
+ <g:if test="${(pageInstance.id && pageInstance.status == 'draft') || (pageInstance.id && pageInstance.isCurrentlyPublished())}">
<div class="buttons">
- <g:actionSubmit class="delete" action="delete" value="${message(code: 'default.button.delete.label', default: 'Delete')}" onclick="return confirm('${message(code: 'page.button.delete.confirm.message', args:[pageInstance.title], default: 'Are you sure?')}');" />
+ <g:if test="${pageInstance.id && pageInstance.status == 'draft'}">
+ <g:actionSubmit class="delete" action="delete" value="${message(code: 'default.button.delete.label', default: 'Delete')}" onclick="return confirm('${message(code: 'page.button.delete.confirm.message', args:[pageInstance.title], default: 'Are you sure?')}');" />
+ </g:if>
+ <g:if test="${pageInstance.id && pageInstance.isCurrentlyPublished()}">
+ <g:actionSubmit name="unpublish" action="unpublish" class="delete" value="Avpublicera" />
+ </g:if>
</div>
</g:if>
- <g:if test="${pageInstance.id && pageInstance.isCurrentlyPublished()}">
- <div class="buttons">
- <g:actionSubmit name="unpublish" action="unpublish" class="delete" value="Avpublicera" />
- </div>
- </g:if>
<div class="input ${hasErrors(bean: pageInstance, field: 'status', 'errors')}">
<g:hiddenField name="status" value="${pageInstance?.status}" />
@@ -122,7 +122,7 @@
</div>
<div class="buttons">
- <span><g:actionSubmit name="preview" action="preview" class="information" value="Förhandsgranska" id="previewSubmit"/></span>
+ <span><g:actionSubmit name="preview" action="preview" value="Förhandsgranska" id="previewSubmit"/></span>
</div>
View
6 web-app/css/main.css
@@ -335,6 +335,10 @@ a.print:visited {
border-bottom: 2px groove #fff;
}
+#primaryNavigation ul li.active {
+ font-weight: bold;
+}
+
#primaryNavigation ul li a, #primaryNavigation ul li a:visited {
color: #585858;
}
@@ -570,7 +574,7 @@ article.faq .row nav:first-child {
}
article.faq .answer {
- width: 50em;
+ width: 35em;
border-bottom: 1px solid #ddd;
margin-bottom: 1em;
overflow: auto;
View
6 web-app/js/application.js
@@ -251,12 +251,12 @@ jQuery(document).ready(function($) {
$("#cat option").each(function() {
var selected = ($(this).attr("selected")) ? ' class="' + $(this).attr("selected") + '"' : "";
- $("#searchCategoryList").append('<li rel="'+$(this).val()+'"'+selected+'><p><strong rel="title">'+$(this).html()+'</strong></p><p>'+$(this).attr("rel")+'</p></li>');
+ $("#searchCategoryList").append('<li data-rel="'+$(this).val()+'"'+selected+'><p><strong data-rel="title">'+$(this).html()+'</strong></p><p>'+$(this).attr("data-rel")+'</p></li>');
});
$("#searchCategoryList li").click(function(e) {
e.stopPropagation();
- $("#cat").val($(this).attr("rel"));
- $("#searchCurrentCategory").html($(this).find("[rel=title]").html()).removeClass("active");
+ $("#cat").val($(this).attr("data-rel"));
+ $("#searchCurrentCategory").html($(this).find("[data-rel=title]").html()).removeClass("active");
$("#searchCategoryList > .selected").removeClass("selected");
$(this).addClass("selected")
$("#searchCategoryList").hide();

No commit comments for this range

Something went wrong with that request. Please try again.