| |
@@ -111,6 +111,32 @@
|
| |
<h3 class="team">{{hub.name}}</h3>
|
| |
{% endif %}
|
| |
</div>
|
| |
+
|
| |
+ {%- with messages = get_flashed_messages(with_categories=true) -%}
|
| |
+ {%- if category, messages -%}
|
| |
+ <div class="container">
|
| |
+ <div class="row">
|
| |
+ <div class="col-md-6 col-md-offset-3">
|
| |
+ <ul id="flashes" class="list-group">
|
| |
+ {%- for category, message in messages -%}
|
| |
+ <div class="alert {%
|
| |
+ if category == 'error' %}alert-warning{%
|
| |
+ else %}alert-info{%
|
| |
+ endif %} alert-dismissible" role="alert">
|
| |
+ <button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
| |
+ <span aria-hidden="true">×</span>
|
| |
+ <span class="sr-only">Close</span>
|
| |
+ </button>
|
| |
+ {{ message }}
|
| |
+ </div>
|
| |
+ {%- endfor -%}
|
| |
+ </ul>
|
| |
+ </div>
|
| |
+ </div>
|
| |
+ </div>
|
| |
+ {%- endif -%}
|
| |
+ {%- endwith -%}
|
| |
+
|
| |
<div class="container">
|
| |
<div class="row">
|
| |
</div>
|
| |
@@ -176,31 +202,64 @@
|
| |
</div>
|
| |
</div>
|
| |
|
| |
+ <div id="edit_modal" class="modal fade" role="dialog">
|
| |
+ <div class="modal-dialog" id="edit_modal_content">
|
| |
+ </div>
|
| |
+ </div>
|
| |
+
|
| |
<script src="{{ url_for('static', filename='js/jquery-1.10.2.min.js') }}"></script>
|
| |
<script src="{{ url_for('static', filename='bootstrap/js/bootstrap.min.js') }}"></script>
|
| |
<script src="{{ url_for('static', filename='js/utils.js') }}"></script>
|
| |
- <script>
|
| |
- var widgets = [{% for widget in hub.widgets %}'{{ widget.idx }}',{% endfor %}];
|
| |
- $.each(widgets, function(i, widget) {
|
| |
+ <script type="text/javascript">
|
| |
+ function setup_edit_btns() {
|
| |
+ $(".edit_widget").unbind();
|
| |
+ $(".edit_widget").click(function() {
|
| |
+ console.log($(this));
|
| |
+ var _idx = $(this).attr('data-idx');
|
| |
+
|
| |
$.ajax({
|
| |
- {% if edit %}
|
| |
- url: widget + '/edit/',
|
| |
- {% else %}
|
| |
- url: widget,
|
| |
- {% endif %}
|
| |
+ url: _idx + '/edit',
|
| |
dataType: 'html',
|
| |
success: function(html) {
|
| |
- $('#widget-' + widget).html(html);
|
| |
- setTimeout(function() {
|
| |
- $('#widget-' + widget + ' .panel').toggleClass('panel-visible');
|
| |
- }, 100);
|
| |
+ $('#edit_modal_content').html(html);
|
| |
+ $('#edit_modal').modal();
|
| |
},
|
| |
error: function() {
|
| |
- $('#widget-' + widget).html('Got an error retrieving this widget. Sorry :(');
|
| |
+ $('#edit_modal_content').html(
|
| |
+ '<div class="modal-dialog"><div class="modal-content"> \
|
| |
+ <div class="modal-body"> \
|
| |
+ Nothing to configure for this widget\
|
| |
+ </div></div></div>'
|
| |
+ );
|
| |
console.log('error');
|
| |
console.trace();
|
| |
+ $('#edit_modal').modal();
|
| |
},
|
| |
});
|
| |
+ return false;
|
| |
+ });
|
| |
+ }
|
| |
+ var widgets = [{% for widget in hub.widgets %}'{{ widget.idx }}',{% endfor %}];
|
| |
+ $.each(widgets, function(i, widget) {
|
| |
+ $.ajax({
|
| |
+ url: widget,
|
| |
+ dataType: 'html',
|
| |
+ success: function(html) {
|
| |
+ $('#widget-' + widget).html(html);
|
| |
+ setTimeout(function() {
|
| |
+ $('#widget-' + widget + ' .panel').toggleClass('panel-visible');
|
| |
+ }, 100);
|
| |
+ setup_edit_btns()
|
| |
+ },
|
| |
+ error: function() {
|
| |
+ $('#widget-' + widget).html('Got an error retrieving this widget. Sorry :(');
|
| |
+ console.log('error');
|
| |
+ console.trace();
|
| |
+ },
|
| |
+ });
|
| |
+ setup_edit_btns();
|
| |
});
|
| |
+
|
| |
+
|
| |
</script>
|
| |
</body></html>
|
| |
:thumbsup: