Skip to content

Commit ab4dcbe

Browse files
committed
Working on editor
1 parent a5be359 commit ab4dcbe

File tree

6 files changed

+53
-37
lines changed

6 files changed

+53
-37
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
# Code Pad - A Chrome IDE
2-
An awesome multi-language IDE crafted for Chrome OS
1+
# Code Pad - Chrome based multi-lingual IDE
2+
An awesome multi-language IDE crafted for Chrome OS written in Vanilla JS and released under the GNU general public license!

manifest.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"minimum_chrome_version": "31",
55
"name": "Code Pad",
66
"description": "An awesome multi-language IDE crafted for Chrome OS",
7+
"author": "Andrew Borg",
78
"app": {
89
"background": {
910
"scripts": [

src/html/app.html

Lines changed: 12 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -240,33 +240,31 @@
240240
 Editor
241241
</a>
242242
<div class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
243-
<a class="dropdown-item modal-appearance" href="#"
244-
data-toggle="modal"
245-
data-target=".modal-lg-container">
243+
<a class="dropdown-item modal-appearance" href="#" data-toggle="modal" data-target=".modal-lg-container">
246244
<i class="fa fa-fw fa-magic"></i>
247245
&nbsp;Appearance & fonts
248246
</a>
249247

250-
<a class="dropdown-item modal-ide-settings" href="#"
251-
data-toggle="modal"
252-
data-target=".modal-lg-container">
248+
<a class="dropdown-item modal-ide-settings" href="#" data-toggle="modal" data-target=".modal-lg-container">
253249
<i class="fa fa-fw fa-cogs"></i>
254250
&nbsp;IDE preferences
255251
</a>
256252
</div>
257253
</li>
254+
255+
<li class="nav-item dropdown">
256+
<a class="nav-link modal-content-help" href="#" data-toggle="modal" data-target=".modal-md-container">
257+
<i class="fa fa-fw fa-life-ring"></i>
258+
&nbsp;About
259+
</a>
258260
</ul>
259261
</div>
260262
</nav>
261263

262264
<!-- Code navigation tabs -->
263265
<div class="nav-tabs bg-dark text-white add-file-container">
264266
<div class="dropdown pull-right" data-toggle="tooltip" title="Add file">
265-
<button class="btn btn-outline-secondary btn-sm dropdown-toggle"
266-
type="button"
267-
data-toggle="dropdown"
268-
aria-haspopup="true"
269-
aria-expanded="false">
267+
<button class="btn btn-outline-secondary btn-sm dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
270268
<i class="fa fa-fw fa-plus"></i> New
271269
</button>
272270
<div class="dropdown-menu add-tab-dropdown"></div>
@@ -281,10 +279,7 @@
281279
</main>
282280

283281
<!-- Modals -->
284-
<div class="modal fade modal-sm-container"
285-
tabindex="-1"
286-
role="dialog"
287-
aria-hidden="true">
282+
<div class="modal fade modal-sm-container" tabindex="-1" role="dialog" aria-hidden="true">
288283
<div class="modal-dialog modal-sm">
289284
<div class="modal-content bg-dark text-white">
290285
<div class="modal-header">
@@ -298,10 +293,7 @@ <h4 class="modal-title"></h4>
298293
</div>
299294
</div>
300295

301-
<div class="modal fade modal-md-container"
302-
tabindex="-1"
303-
role="dialog"
304-
aria-hidden="true">
296+
<div class="modal fade modal-md-container" tabindex="-1" role="dialog" aria-hidden="true">
305297
<div class="modal-dialog modal-md">
306298
<div class="modal-content bg-dark text-white">
307299
<div class="modal-header">
@@ -315,10 +307,7 @@ <h4 class="modal-title"></h4>
315307
</div>
316308
</div>
317309

318-
<div class="modal fade modal-lg-container"
319-
tabindex="-1"
320-
role="dialog"
321-
aria-hidden="true">
310+
<div class="modal fade modal-lg-container" tabindex="-1" role="dialog" aria-hidden="true">
322311
<div class="modal-dialog modal-lg">
323312
<div class="modal-content bg-dark text-white">
324313
<div class="modal-header">

src/html/modals/content/help.html

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<div class="container-fluid">
2+
<h4 class="text-center app-name"></h4>
3+
<p class="text-center">An awesome multi-language IDE written in Vanilla JS and released under the GNU general public license!</p>
4+
<p class="text-center"></p>
5+
<p class="text-center">Crafted with <i class='fa fa-heart text-danger'></i> by <span class="app-author"></span>, available on <a href="https://github.com/andrewbrg/codepad-chrome-app" target="_blank"><i class="fa fa-github"></i> GitHub</a></p>
6+
<p class="text-center">Current application version is <strong>v<span class="app-version"></span></strong>.</p>
7+
8+
</div>

src/js/app.js

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,26 @@ $(document).ready(function () {
9898

9999
// Push the template into the modal before showing it
100100
$(document).on('show.bs.modal', '.modal', function (e) {
101-
Modals.onShowBs(e.relatedTarget, function () {
102-
IdeSettings.decorateView();
103-
});
101+
102+
var $el = $(e.relatedTarget);
103+
var callback = function () {
104+
};
105+
106+
if ($el.hasClass('modal-ide-settings') || $el.hasClass('modal-appearance')) {
107+
callback = function () {
108+
IdeSettings.decorateView();
109+
};
110+
}
111+
112+
if ($el.hasClass('modal-content-help')) {
113+
callback = function () {
114+
$(document).find('.app-name').html(chrome.runtime.getManifest().name);
115+
$(document).find('.app-author').html(chrome.runtime.getManifest().author);
116+
$(document).find('.app-version').html(chrome.runtime.getManifest().version);
117+
};
118+
}
119+
120+
Modals.onShowBs(e.relatedTarget, callback);
104121
});
105122

106123
// Remove the template from the modal after closing it

src/js/handlers/modals.js

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,23 +25,24 @@ var ModalsHandler = function () {
2525

2626
var $el = $(el);
2727
var deferred = $.Deferred();
28+
var callback = function (data) {
29+
deferred.resolve({html: data, idx: $el.attr('data-idx')});
30+
};
2831

2932
if ($el.hasClass('modal-appearance')) {
30-
$.get('/src/html/modals/editor/appearance.html').done(function (data) {
31-
deferred.resolve({html: data, idx: $el.attr('data-idx')});
32-
});
33+
$.get('/src/html/modals/editor/appearance.html').done(callback);
3334
}
3435

3536
if ($el.hasClass('modal-ide-settings')) {
36-
$.get('/src/html/modals/editor/ide.settings.html').done(function (data) {
37-
deferred.resolve({html: data, idx: $el.attr('data-idx')});
38-
});
37+
$.get('/src/html/modals/editor/ide.settings.html').done(callback);
3938
}
4039

4140
if ($el.hasClass('modal-confirm-close-tab')) {
42-
$.get('/src/html/modals/file/confirm.close.tab.html').done(function (data) {
43-
deferred.resolve({html: data, idx: $el.attr('data-idx')});
44-
});
41+
$.get('/src/html/modals/file/confirm.close.tab.html').done(callback);
42+
}
43+
44+
if ($el.hasClass('modal-content-help')) {
45+
$.get('/src/html/modals/content/help.html').done(callback);
4546
}
4647

4748
return deferred.promise();

0 commit comments

Comments
 (0)