Просмотр исходного кода

My counter is in the list with different color

Denis Merigoux лет назад: 9
Родитель
Сommit
7b782e5783
2 измененных файлов с 8 добавлено и 5 удалено
  1. 3 3
      counter/templates/homeTemplate.html
  2. 5 2
      counter/views.py

+ 3 - 3
counter/templates/homeTemplate.html

86
 		</div>
86
 		</div>
87
 	</div>
87
 	</div>
88
 	<div class="row">
88
 	<div class="row">
89
-		{% for counter in counters %} {% if chooseCounter or not counter.id == myCounter.id %}
89
+		{% for counter in counters %}
90
 		<div class="col-md-4 col-sm-6 col-lg-3">
90
 		<div class="col-md-4 col-sm-6 col-lg-3">
91
 			<div class="panel panel-{{counter.CSSclass}}">
91
 			<div class="panel panel-{{counter.CSSclass}}">
92
 				<div class="panel-heading">
92
 				<div class="panel-heading">
96
 						<input type="hidden" name="redirect" value="{% url 'home' %}" />
96
 						<input type="hidden" name="redirect" value="{% url 'home' %}" />
97
 						<input type="hidden" name="reset" value="{{counter.lastReset.id}}" />
97
 						<input type="hidden" name="reset" value="{{counter.lastReset.id}}" />
98
 						<h2 class="panel-title">
98
 						<h2 class="panel-title">
99
-							<a class="counter-link" href="{% url 'counter' id_counter=counter.id %}">
99
+							<a class="counter-link panel-title" href="{% url 'counter' id_counter=counter.id %}">
100
 								<b>{{ counter.trigramme }}</b> <small>{{ counter.name }}</small>
100
 								<b>{{ counter.trigramme }}</b> <small>{{ counter.name }}</small>
101
 							</a>
101
 							</a>
102
 							{% if not counter.lastReset.noSeum %}
102
 							{% if not counter.lastReset.noSeum %}
130
 				</div>
130
 				</div>
131
 			</div>
131
 			</div>
132
 		</div>
132
 		</div>
133
-		{% endif %} {% endfor %}
133
+		{% endfor %}
134
 	</div>
134
 	</div>
135
 	<div class="row">
135
 	<div class="row">
136
 		<div class="col-sm-12">
136
 		<div class="col-sm-12">

+ 5 - 2
counter/views.py

98
                     maxJSS = (counter.lastReset.delta.total_seconds() /
98
                     maxJSS = (counter.lastReset.delta.total_seconds() /
99
                               (24 * 3600))
99
                               (24 * 3600))
100
             # Defining CSS attributes for the counter
100
             # Defining CSS attributes for the counter
101
-            counter.CSSclass = "default"
101
+            if counter.id == myCounter.id:
102
+                counter.CSSclass = 'primary'
103
+            else:
104
+                counter.CSSclass = 'default'
102
             # Computing the total number of likes for this counter
105
             # Computing the total number of likes for this counter
103
             counter.likeCount = Like.objects.filter(
106
             counter.likeCount = Like.objects.filter(
104
                 reset=counter.lastReset).count()
107
                 reset=counter.lastReset).count()
107
 
110
 
108
         counter.lastReset.formatted_delta = format_timedelta(
111
         counter.lastReset.formatted_delta = format_timedelta(
109
             counter.lastReset.delta, locale='fr', threshold=1)
112
             counter.lastReset.delta, locale='fr', threshold=1)
110
-        counter.isHidden = "hidden"
113
+        counter.isHidden = 'hidden'
111
 
114
 
112
     # Now we sort the counters according to a reddit-like ranking formula
115
     # Now we sort the counters according to a reddit-like ranking formula
113
     # We take into account the number of likes of a reset and its recentness
116
     # We take into account the number of likes of a reset and its recentness