Skip to content
Browse files

Updated Edit page

Removed end date confusion,
changed elements to table (it is one, treat it as such)
Added fake notification display.
show either human defined label or ID for campaign.
bump to version 1
  • Loading branch information...
1 parent 79e85b6 commit 628982329a6eeef54a081e381d580267b3e7310b @jrconlin committed Jan 9, 2013
Showing with 17 additions and 12 deletions.
  1. +15 −10 campaign/templates/main.mako
  2. +1 −1 campaign/templates/style.css
  3. +1 −1 setup.py
View
25 campaign/templates/main.mako
@@ -62,8 +62,8 @@
<legend>When to show?</legend>
<span class="priority"><label for="priority">Priority(0=lowest):</label><input type="number" name="priority" value="0" /></span>
<label for="start_time">Start time:</label><input type="datetime-local" name="start_time" value="" placeholder="${nowstr}"/>
-<label for="end_time">End time:</label><input type="datetime-local" name="end_time" value="${campaign_end_str}" placeholder="${campaign_end_str}" />
<label for="idle_time">Idle time(days):</label><input type="number" name="idle_time" value="0" />
+<label for="end_time">Projected End time:</label><input type="datetime-local" name="end_time" value="${campaign_end_str}" placeholder="${campaign_end_str}" readonly />
</fieldset>
<fieldset class="note">
<legend>What should they see?</legend>
@@ -524,8 +524,7 @@
<button class="button" id="delete" name="delete">Delete Selected</button>
</div>
<table id="data">
-<tr>
-<th class="head row">
+<tr class="head row">
<th class="delete">Delete?</th>
<th class="id">ID</th>
<th class="priority">Priority</th>
@@ -590,7 +589,7 @@
<td class="id"><a href="/redirect/${vers}/${dnote['id']}">${rtitle}</a></td>
<td class="created">${strftime(time_format, gmtime(dnote['created']))}</td>
<td class="start_time" >${dnote['start_time']}</td>
-<td class="end_time" >${dnote['end_time']}</td>
+<!--td class="end_time" >${dnote['end_time']}</td -->
<td class="idle_time" >${dnote['idle_time']} days</td>
<td class="lang" >${dnote['lang']}</td>
<td class="locale" >${dnote['locale']}</td>
@@ -639,17 +638,19 @@
});
$("#new_item input").change(function() {
var dv;
+ var sday = 86400000; /* seconds in day */
var conflict = false;
var errors = [];
- var cstart = Math.floor(Date.now()/1000);
+ // round to start of day.
+ var cstart = Math.floor(Date.now()/sday) * sday;
var form = document.getElementById('new_item');
dv = form.start_time.value;
if (dv) {
try {
- cstart = Math.floor(Date.parse(dv)/1000);
+ cstart = Date.parse(dv);
} catch (e) {}
}
- var cend = 9999999999;
+/* var cend = 9999999999;
dv = form.end_time.value;
if (dv) {
try {
@@ -664,15 +665,19 @@ $("#new_item input").change(function() {
} else {
form.end_time.classList.remove('error');
}
-
+ */
+ form.start_time.value = new Date(cstart).toUTCString();
+ var cend = ((parseInt(form.idle_time.value)|1) * sday) + cstart;
+ console.debug(new Date(cend));
+ form.end_time.value = (new Date(cend)).toUTCString();
var rows=document.getElementById('data').getElementsByClassName('record');
for (var rl = 0; rl < rows.length; rl++){
var row = rows[rl];
if (row == undefined) continue;
var id = row.id;
var jqi = $('#'+id);
- var start = parseInt(row.dataset.start_time);
- var end = parseInt(row.dataset.end_time);
+ var start = parseInt(row.dataset.start_time) * 1000;
+ var end = parseInt(row.dataset.end_time) * 1000;
var idle = parseInt(row.dataset.idle_time) || 0;
var lang = (row.dataset.lang || form.lang.value || "").toLowerCase();
var locale = (row.dataset.locale || form.locale.value || "").toLowerCase();
View
2 campaign/templates/style.css
@@ -117,7 +117,7 @@ transition: all 0.25s linear 0s;
}
#browserid {margin: 1em;}
.priority {display:none !important;}
-.warning div {background-color: yellow;}
+.warning {background-color: yellow !important;}
.hidden {display:none !important;}
.error {border: 1px solid red;}
#new_item .error {background-color: red; }
View
2 setup.py
@@ -13,7 +13,7 @@
setup(name='campaign',
- version=0.9,
+ version=1.000,
description='campaign',
long_description=README,
classifiers=[

0 comments on commit 6289823

Please sign in to comment.
Something went wrong with that request. Please try again.