Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update models.py #123

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion projects/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class Project(models.Model):
('Hea_oth', 'Other activity'),
('Soc_foo', 'Food security'),
('Soc_chi', 'Childcare'),
('Soc_eld', 'Eldercare'),
('Soc_eld', 'Senior Friendly'),
('Soc_ani', 'Animalcare'),
('Soc_oth', 'Other activity'),
('Env_gar', 'Gardening'),
Expand Down
12 changes: 10 additions & 2 deletions projects/templates/create_project.html
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,14 @@ <h5 style="margin-bottom:5px;">Organize a Community activity</h5>
</label>
</div>
</div>
<div class="row ">
<div class="col-9 offset-1">
<label class="container_radio" for="Cul_lei">
<input type="radio" name="sub_category" value="Cul_con" id="Cul_lei" required>
<span class="checkmark">Leisure</span>
</label>
</div>
</div>
<div class="row ">
<div class="col-9 offset-1">
<label class="container_radio" for="Cul_oth">
Expand Down Expand Up @@ -194,7 +202,7 @@ <h5 style="margin-bottom:5px;">Organize a Community activity</h5>
<div class="col-9 offset-1">
<label class="container_radio" for="Soc_eld">
<input type="radio" name="sub_category" value="Soc_eld" id="Soc_eld" required>
<span class="checkmark">Eldercare</span>
<span class="checkmark">Senior Friendly</span>
</label>
</div>
</div>
Expand Down Expand Up @@ -901,4 +909,4 @@ <h5 style="margin-bottom:5px;">Organize a Community activity</h5>
});
</script>

{% endblock script %}
{% endblock script %}
6 changes: 5 additions & 1 deletion projects/templates/detail_project.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,13 @@ <h5 id="project_cat"></h5>
<div class="col-3 offset-1">
<div class="row">
<span id="time_start"></span>
&nbsp;-&nbsp;
<span id="time_end"></span>
</div>
<div class="row">
<span id="date_start"></span>
&nbsp;-&nbsp;
<span id="date_end"></span>
</div>

</div>
Expand Down Expand Up @@ -141,4 +145,4 @@ <h5>Discussion:</h5>
<script src="{% static 'js/projects/detail_project.js' %}"></script>
<script src="{% static 'js/jquery.serialize-object.min.js' %}"></script>

{% endblock script %}
{% endblock script %}
16 changes: 13 additions & 3 deletions static/js/projects/create_project.js
Original file line number Diff line number Diff line change
Expand Up @@ -512,15 +512,25 @@ $(document).ready(function () {
$('#project_name').text($('#inputName').val());
var start = new Date($('#inputStartDate').val()),// convert string to date
locale = "en-us",//english
month = start.toLocaleString(locale, { month: "long" });//month name
var date = month + ' ' + start.getDate();
monthStart = start.toLocaleString(locale, { month: "long" });//month name
end = new Date($('#inputEndDate').val()),
monthEnd = end.toLocaleString(locale, { month: "long" });//month name
var dateStart = monthStart + ' ' + start.getDate(),
dateEnd = monthEnd + ' ' + end.getDate();
$('#date_start_template').text(date);//show date start
minutes = start.getMinutes(); // get minutes
if (minutes === 0) { //add another 0 if minutes = 0
minutes = '00';
}
var start_time_conv = start.getHours() + 'H' + minutes; //format hours
$('#date_end_template').text(dateEnd);//show date end
minutesEnd = end.getMinutes(); // get minutes
if (minutesEnd === 0) { //add another 0 if minutes = 0
minutesEnd = '00';
}
var start_time_conv = start.getHours() + ':' + minutes; //format hours
$('#time_start_template').text(start_time_conv);//show hours
var end_time_conv = end.getHours() + ':' + minutesEnd; //format hours
$('#time_end_template').text(end_time_conv);//show hours
var address = $('#inputNumber').val() + ' ' + $('#inputStreet').val() + ', ' + $('#inputZip').val(); // format address
$('#project_address').text(address); //show project address
$('#icon_category').append(
Expand Down
26 changes: 18 additions & 8 deletions static/js/projects/list_projects.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,27 @@ $(document).ready(function(){
function format_time(time){
var start = new Date(time),// convert string to date
locale = "en-us",//english
month = start.toLocaleString(locale, { month: "short" });//month name
var date = month + ' ' + start.getDate();
monthStart = start.toLocaleString(locale, { month: "short" });//month name
end = new Date($('#inputEndDate').val()),
monthEnd = end.toLocaleString(locale, { month: "short" }); //month name
var dateStart = monthStart + ' ' + start.getDate(),
dateEnd = monthEnd + ' ' + end.getDate();

minutes = start.getMinutes(); // get minutes
if(minutes===0){ //add another 0 if minutes = 0
minutes='00';
}
var start_time = start.getHours() + 'H' + minutes; //format hours
return date +' '+start_time
minutesStart = start.getMinutes(); // get minutes
if (minutesStart === 0) { //add another 0 if minutes = 0
minutesStart = '00';
}
minutesEnd = end.getMinutes(); // get minutes
if (minutesEnd === 0) { //add another 0 if minutes = 0
minutesEnd = '00';
}
var start_time = start.getHours() + ':' + minutesStart; //format hours
return dateStart +' '+start_time
var end_time = end.getHours() + ':' + minutesEnd;
return dateEnd +' '+end_time
}


function format_community(abb){
if(abb==='CP'){
return 'Community Project'
Expand Down