Skip to content

Commit f5833c4

Browse files
committed
code to hide rooms that are empty
- Legacy-Id: 5413
1 parent 5927253 commit f5833c4

3 files changed

Lines changed: 45 additions & 2 deletions

File tree

v4.41/ietf/meeting/templatetags/agenda_custom_tags.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,10 @@ def get_col_width(dict, index):
2929
if index in dict:
3030
return len(dict[index])
3131
return 0
32+
33+
# used because html id's should not have spaces in them.
34+
@register.filter(name='nospace')
35+
def nospace(inp):
36+
return str(inp).replace(' ','_')
37+
3238

v4.41/ietf/templates/meeting/edit_agenda.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@
3030

3131

3232
function setup_slots(){
33+
{% for day in time_slices %}
34+
days.push("{{day}}");
35+
{% endfor %}
3336
{% for s in scheduledsessions %}
3437
console.log("{{s.timeslot.id}}");
3538
var e_obj = new event_obj( "{{ s.session.group.acronym }}","{{ s.session.group.name }}","{{s.timeslot.location|slugify}}" ,"{{ s.timeslot.time|date:'Hi' }}", "{{s.timeslot.time|date:'Y-m-d'}}","{{s.id}}", "{{s.timeslot.id}}", "{{s.owner.owner}}");
@@ -117,7 +120,7 @@
117120
{% endfor %}
118121
<tbody id="{{day}}tbody" class="cells">
119122
{% for r in rooms %}
120-
<tr id="{{r}}">
123+
<tr id="{{r|nospace}}">
121124
<th class="vert_time">{{r}}</th>
122125
{% for slot in date_slices|lookup:day %}
123126
<td id="{{r|slugify}}_{{day}}_{{slot.0|date:'Hi'}}" class="{% cycle 'alt' '' %}" style="background:#606060 "></td>

v4.41/static/js/agenda_edit.js

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
var meeting_objs = {}; // contains a list of event_obj's
44
var slot_status = {}; // the status of the slot, in format { room_year-month-day_hour: { free: t/f, timeslotid: id } }
5-
5+
var days = [];
66
/////////////-END-GLOBALS-///////////////////////////////////////
77

88
/* refactor this out into the html */
@@ -34,8 +34,29 @@ function initStuff(){
3434
log("droppable() ran");
3535
load_events();
3636
log("load_events() ran");
37+
hide_empty();
38+
}
39+
40+
/* hide_empty()
41+
looks for the rooms with no events in them and hides them.
42+
This is mostly a temp fix for hiding stuff. DOMs should just
43+
never be created. Allowing the toggle may be a nice feature though
44+
*/
45+
function hide_empty(){
46+
47+
for(i=0;i<days.length;i++){
48+
var childs = ($("#"+days[i]+"tbody").children());
49+
for(k=0;k<childs.length;k++){
50+
if($(childs[k]).find(".meeting_event").length == 0){
51+
$(childs[k]).toggle();
52+
}
53+
}
54+
}
55+
3756
}
3857

58+
59+
3960
function print_all(){
4061
console.log("all");
4162
console.log(meeting_objs.length);
@@ -78,9 +99,22 @@ function listeners(){
7899
$('#event_AllDay_no').click(function(){
79100
$('#event_AllDay_yes').attr('checked',false);
80101
});
102+
$('#get_ss').click(function(){
103+
get_ss();
104+
});
105+
81106

82107
}
83108

109+
function print_all_ss(objs){
110+
console.log(objs)
111+
112+
}
113+
function get_ss(){
114+
console.log("get_ss")
115+
Dajaxice.ietf.meeting.get_scheduledsessions(print_all_ss);
116+
}
117+
84118
function insert_cell(time,date,room,text){
85119
slot_id = ("#"+room+"_"+date+"_"+time);
86120
slot_id_status = (room+"_"+date+"_"+time);

0 commit comments

Comments
 (0)