Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add meetbot.fp.o format minutes/log catcher
- Loading branch information
Showing
9 changed files
with
251 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
/* | ||
# | ||
# Copyright © 2015 Chaoyi Zha <cydrobolt@fedoraproject.org> | ||
# | ||
# This copyrighted material is made available to anyone wishing to use, | ||
# modify, copy, or redistribute it subject to the terms and conditions | ||
# of the GNU General Public License v.2, or (at your option) any later | ||
# version. This program is distributed in the hope that it will be | ||
# useful, but WITHOUT ANY WARRANTY expressed or implied, including the | ||
# implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR | ||
# PURPOSE. See the GNU General Public License for more details. You | ||
# should have received a copy of the GNU General Public License along | ||
# with this program; if not, write to the Free Software Foundation, | ||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
# | ||
*/ | ||
|
||
var $eventSelect = $(".tpa"); | ||
|
||
function formatRes (res) { | ||
if (res.loading) return res.text; | ||
|
||
var markup = '<div class="clearfix">' + | ||
'<div>' + | ||
'<h4>' + res.name + '</h4>' + | ||
'<b>type: </b>' + res.type + | ||
'</div>' + | ||
'</div>'; | ||
|
||
if (res.description) { | ||
markup += '<div>' + res.description + '</div>'; | ||
} | ||
return markup; | ||
} | ||
|
||
function formatResSelection (res) { | ||
return res.name; | ||
} | ||
|
||
$(".tpa").select2({ | ||
ajax: { | ||
url: "/search_sugg", | ||
dataType: 'json', | ||
delay: 250, | ||
data: function (params) { | ||
return { | ||
q: params.term, // search term | ||
}; | ||
}, | ||
processResults: function (data, page) { | ||
// parse the results into the format expected by Select2. | ||
// since we are using custom formatting functions we do not need to | ||
// alter the remote JSON data | ||
return { | ||
results: data.items | ||
}; | ||
}, | ||
cache: true | ||
}, | ||
escapeMarkup: function (markup) { return markup; }, // let our custom formatter work | ||
minimumInputLength: 1, | ||
templateResult: formatRes, | ||
templateSelection: formatResSelection | ||
}); | ||
function redirectResults (group_id, type) { | ||
window.location = "/sresults?group_id=" + group_id + "&type=" + type; | ||
} | ||
|
||
$eventSelect.on("select2:select", function (e) { | ||
group_id = e.params.data.id; | ||
group_type = e.params.data.type; | ||
if (auto_search === true) { | ||
redirectResults(group_id, group_type); | ||
} | ||
else { | ||
window.group_id = group_id; | ||
window.group_type = group_type; | ||
} | ||
}); | ||
|
||
$("#search").click(function () { | ||
redirectResults(group_id, group_type); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
# | ||
# Copyright © 2015 Chaoyi Zha <cydrobolt@fedoraproject.org> | ||
# | ||
# This copyrighted material is made available to anyone wishing to use, | ||
# modify, copy, or redistribute it subject to the terms and conditions | ||
# of the GNU General Public License v.2, or (at your option) any later | ||
# version. This program is distributed in the hope that it will be | ||
# useful, but WITHOUT ANY WARRANTY expressed or implied, including the | ||
# implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR | ||
# PURPOSE. See the GNU General Public License for more details. You | ||
# should have received a copy of the GNU General Public License along | ||
# with this program; if not, write to the Free Software Foundation, | ||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
# | ||
*/ | ||
|
||
function loadLogContents() { | ||
// type == minutes or logs | ||
var data = { | ||
"group_type": current_group_type, | ||
"group_id": current_group_id, | ||
"date_stamp": current_date_stamp, | ||
"file_name": current_fname, | ||
}; | ||
$.ajax({ | ||
type: "POST", | ||
url: "/get_meeting_log", | ||
data: data, | ||
dataType: "html" | ||
}).done(function (res) { | ||
var markup; | ||
markup = res; | ||
$('.logdisplay').html(markup); | ||
return true; | ||
}); | ||
return true; | ||
} | ||
|
||
$(function () { | ||
loadLogContents(); | ||
if (window.current_log_type == "minutes") { | ||
$(".logdisplay").addClass("single-log-minutes"); | ||
} | ||
}); |
Oops, something went wrong.