Skip to content

Commit

Permalink
customize observation display
Browse files Browse the repository at this point in the history
  • Loading branch information
sheppard committed May 26, 2017
1 parent f3acccd commit a0cd5d2
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
15 changes: 14 additions & 1 deletion app/js/insideoutside/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,20 @@ config.router = {
config.template = {
'templates': templates,
'defaults': {
'version': version
'version': version,
'date': function() {
var date = new Date();
return (
date.getFullYear() + '-' +
(date.getMonth() < 9 ? '0' : '') +
(date.getMonth() + 1) + '-' +
(date.getDate() <= 9 ? '0' : '') +
date.getDate()
);
},
'is_gps': function() {
return this.name == 'gps';
}
}
};

Expand Down
8 changes: 8 additions & 0 deletions db/observation/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,14 @@ class Observation(models.Model):
verbose_name="Notes",
)

wq_label_template = "{{category_id}} on {{date}}"

def __str__(self):
if not self.category:
return "New Observation"
return "%s on %s" % (self.category, self.date)

class Meta:
verbose_name = "observation"
verbose_name_plural = "observations"
ordering = ('-pk',)
2 changes: 1 addition & 1 deletion templates/observation_edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ <h1>{{^id}}Add{{/id}}{{#id}}Edit{{/id}} observation</h1>
<fieldset data-xform-type='select one' data-role='controlgroup' data-type='horizontal'>
<legend>Location Mode</legend>
{{#toggle_choices}}
<input type='radio' id='observation-toggle-{{name}}' name='toggle' value='{{name}}'{{#selected}} checked{{/selected}}>
<input type='radio' id='observation-toggle-{{name}}' name='toggle' value='{{name}}'{{#selected}} checked{{/selected}}{{#is_gps}} checked{{/is_gps}}>
<label for='observation-toggle-{{name}}'>{{label}}</label>
{{/toggle_choices}}
</fieldset>
Expand Down

0 comments on commit a0cd5d2

Please sign in to comment.