Revision 5bd27846

b/cloudcms/models.py
177 177
        except:
178 178
            return None
179 179
        
180
    def get_first_entry(self):
181
        try:
182
            return self.userguideentries.filter(is_active=True)[0]
183
        except:
184
            return None
185
        
180 186
    def __unicode__(self):
181 187
        trans = translations.TranslatedObjectMixin.__unicode__(self)
182 188
        return trans or _('Unnamed category')
b/cloudcmsguide/models.py
93 93
    author = models.ForeignKey(User, related_name='guide_pages', verbose_name=_('author'))
94 94
    language = models.CharField(max_length=255, choices=settings.LANGUAGES)
95 95

  
96
    published_on = models.DateTimeField(_('published on'), blank=True, null=True, default=datetime.now,
96
    published_on = models.DateTimeField(_('published on'), blank=True, null=False, default=datetime.now,
97 97
        help_text=_('Will be filled in automatically when entry gets published.'))
98 98
    last_changed = models.DateTimeField(_('last change'), auto_now=True, editable=False)
99 99

  
......
112 112

  
113 113
    def __unicode__(self):
114 114
        return self.title
115
    
116
    def get_next(self):
117
        return self.get_next_by_published_on(service=self.service)
118

  
119
    def get_previous(self):
120
        return self.get_previous_by_published_on(service=self.service)
115 121

  
116 122
    def get_absolute_url(self):
117 123
        try:
b/cloudcmsguide/templates/cloudcmsguide/archive.html
1
{% load applicationcontent_tags pagination_tags i18n %}
1
{% load applicationcontent_tags pagination_tags i18n cloudcms_tags %}
2

  
3
<div class="faq">
4
 
5
	{% for service in services %}
6
    
7
    <div class="two-cols clearfix unequal-dotted">
8
    	<div class="rt">
9
    		<img src="{{ service.image_userguide.get_absolute_url }}" alt="{{ service.image_userguide.title }}" />
10
    	</div>
11
    	<div class="lt">
12
    		<div class="faq-category {{ service.class_name }}">
13
		        <h2>{{ service.translation.title_userguide|upper }}</h2>
14
			    <ul>
15
		            {% for e in service.userguideentries.active %}
16
		            <li {% if e == entry %}class="current"{% endif %}>
17
		                <a href="{{ e.get_absolute_url }}">{{ e.title }}</a>
18
		            </li>
19
		            {% endfor %}
20
		        </ul>
21
		    </div>
22
    	</div>
23
 
2 24

  
3
<div class="guide">
4
    {% for service in services %}
5
    <div class="guide-category">
6
        <h2>{{ service.translation.title|upper }}</h2>
7
        <ul>
8
            {% for e in service.userguideentries.active %}
9
            <li {% if e == entry %}class="current"{% endif %}>
10
                <a href="{{ e.get_absolute_url }}">{{ e.title }}</a>
11
            </li>
12
            {% endfor %}
13
        </ul>
14 25
    </div>
26
    
15 27
    {% endfor %}
16 28
</div>
b/cloudcmsguide/templates/cloudcmsguide/detail.html
1
{% load applicationcontent_tags i18n %}
1
{% load applicationcontent_tags pagination_tags i18n cloudcms_tags %}
2 2

  
3
{% fragment request "sidecol" %}
4
{% include "cloudcmsguide/archive.html" %}
5
{% endfragment %}
3
<div class="two-cols lt-small clearfix details faq">
4
	<div class="rt">
5
		<div class="question details {{ entry.service.class_name }}">
6
		    <h2>{{ entry.title|upper }}</h2>
7
		    <div class="content">
8
		        {% for content in entry.content.main %}
9
		            {{ content.render }}
10
		        {% endfor %}
11
		    </div>
12
		    <div class="clearfix next-prev">
13
	    	{% if entry.get_next %}
14
	    		<a href="{{ entry.get_next.get_absolute_url }}" class="next">Next ></a> 	
15
	        {% endif %} 
16
	    	{% if entry.get_previous %}
17
	    		<a href="{{ entry.get_previous.get_absolute_url }}" class="prev">< Previous</a>
18
	    	{% else %}
19
	    		<a href="{{ entry.back_url }}">{% trans "&lt; Back to User Guide" %}</a>
20
	    	{% endif%}
21
		    	
22
		    </div>
23
		</div>
24
		 
25
		<div class="extra-menu">
26
			{% for service in services %}
27
				{% if service == entry.service %}
28
				<div class="faq-category {{ service.class_name }}">				 
29
					   	<h3>{{ service.translation.title_userguide|upper }}</h3>
30
					 	{% if category == entry.category %}
31
					 	   
32
			              <ul>
33
			                   {% for e in service.userguideentries.active %}
34
			                  <li>
35
			                     {% if e != entry %}<a href="{{ e.get_absolute_url }}">{% endif %}{{ e.title }}{% if e != question %}</a>{% endif %}
36
			                  </li>
37
			                  {% endfor %}
38
			                  <br />
39
			              </ul>
40
			           {% endif %}
41
			          
42
				</div>
43
				{% endif %}
44
			{% endfor %}
45
		</div>
46
	</div>
47
	 
48
	<div class="lt">
49
		{% for service in services %}
50
		<div class="faq-category {{ service.class_name }}">
51
			<h2>
52
				{% if service != entry.service %}
53
					<a href="{{ service.get_first_entry.get_absolute_url }}">
54
				{% endif %}
55
					{{ service.translation.title_userguide|upper }}
56
				{% if service != entry.service %}
57
					</a>
58
				{% endif %}
59
			</h2>
60
			 
61
			 {% for category, questions in service|get_service_faqs %}
6 62

  
7
{% fragment request "maincol" %}
8
<div class="user-guide-entry">
9
    <h2>{{ entry.title|upper }}</h2>
10
    <div class="content">
11
        {% for content in entry.content.main %}
12
            {{ content.render }}
13
        {% endfor %}
14
    </div>
15
    <div class="bottom-content backlink">
16
        <a href="{{ entry.back_url }}">{% trans "&lt; Back to User guide" %}</a>
17
    </div>
18
</div>
19
{% endfragment %}
63
			 	{% if service == question.service %}
64
              <h3>{{ category.translation.title }}</h3>
65
              <ul>
66
                {% for q in questions %}
67
                  <li>
68
                     {% if q != question %}<a href="{{ q.get_absolute_url }}">{% endif %}{{ q.title }}{% if q != question %}</a>{% endif %}
69
                  </li>
70
                  {% endfor %}
71
                  <br />
72
              </ul>
73
	           {% endif %}
74
	         {% endfor %}
75
		</div>
76
		{% endfor %}
77
	</div>
78
</div>	
79

  
80
 
81

  
82
 

Also available in: Unified diff