Skip to content

Commit

Permalink
Add board connenction support in create page
Browse files Browse the repository at this point in the history
  • Loading branch information
ebadawy committed Jul 7, 2015
1 parent 94fef2c commit 52e2a9c
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 6 deletions.
22 changes: 20 additions & 2 deletions Support/bonecard/create/index.html
Expand Up @@ -2,9 +2,27 @@
layout: index
title: bone101
styles: ['/static/bonecard-create.css']
scripts: ['/static/third_party/ace/src/ace.js', '/static/third_party/ckeditor/ckeditor.js', '/static/third_party/ckeditor/adapters/jquery.js', '/static/jquery.sortable.min.js', '/static/third_party/contenthover/contenthover.min.js', '/static/third_party/blockui/jquery.blockUI.js']
scripts: ['/static/third_party/ace/src/ace.js', '/static/third_party/ckeditor/ckeditor.js', '/static/third_party/ckeditor/adapters/jquery.js', '/static/jquery.sortable.min.js', '/static/third_party/contenthover/contenthover.min.js', '/static/third_party/blockui/jquery.blockUI.js', '/static/connect.js', '/static/bonescript.js', '/static/beagle-ui.js']
scripts-after: ['/static/bonecard-create.js']
style: |
div#connect-status {
display: table;
margin: 0 auto;
padding-right: 10px;
margin-bottom: 30px;
}
div#browser-content button, input#connect-ip {
color: black !important;
}
---

<div class="row">
<div class="col-md-12">
<div id='connect-status'></div>
</div>
</div>


<div class="errors" style="color: red;">
<ul>
<li class="error-login" style="display: none;">You must login first</li>
Expand Down Expand Up @@ -45,7 +63,7 @@ <h3><b>Description:</b></h3>

<div class="view-content">
<!-- Cover card block -->
<div id="bonecard-block0" data-type="html">
<div id="bonecard-block0" data-type="cover">
<a class="img-upload" href="#cover-card" onclick="performClick('cover-card-input');">
<div class="bonecard">
<div style="padding-left: 14px;">
Expand Down
17 changes: 13 additions & 4 deletions static/bonecard-create.js
Expand Up @@ -3,6 +3,7 @@ $(document).ready(function() {
var editor = ace.edit("editor1");
editor.setTheme("ace/theme/monokai");
editor.getSession().setMode("ace/mode/javascript");
ace_editor_id = -1;

// make bonecard list sortable
$('.sortable').sortable();
Expand All @@ -20,6 +21,7 @@ $(document).ready(function() {

display_selected_card();
highlight_selected_card();
update_ace_editor_id();
});

// Initialize contenthover
Expand All @@ -38,10 +40,6 @@ $(document).ready(function() {
$('#bonecard-block0').find('p').text($(this).val());
});

$('a.prevent').on('click', function(e) {
e.preventDefault();
});

$('#cover-card-input').change(function() {
var filesSelected = document.getElementById("cover-card-input").files;
if (filesSelected.length > 0) {
Expand Down Expand Up @@ -129,6 +127,7 @@ $(document).ready(function() {

display_selected_card();
highlight_selected_card();
update_ace_editor_id();

bonecard_id++;
});
Expand All @@ -141,6 +140,7 @@ $(document).ready(function() {
selected_id = $this.attr('id').substring(19);
highlight_selected_card();
display_selected_card();
update_ace_editor_id();
});
$this.find('a').on('click', function(e) {
e.preventDefault();
Expand Down Expand Up @@ -193,6 +193,7 @@ $(document).ready(function() {
$this.find('div.code-card').show();
$this.find('div.html-card').hide();
}
update_ace_editor_id();
});
// get the ckeditor content to the bonecard when clicking on preview
$this.find('a.bonecard-preview').on('click', function() {
Expand Down Expand Up @@ -333,6 +334,14 @@ $(document).ready(function() {
return is_valid;
}

function update_ace_editor_id() {
$this = $('div.view-content').find('#bonecard-block' + selected_id);
if ($this.data('type') == 'code') {
ace_editor_id = 'editor' + selected_id;
} else
ace_editor_id = -1;
}


// html content for adding new bonecard-micro to the list
function bonecard_item(index) {
Expand Down

0 comments on commit 52e2a9c

Please sign in to comment.