Skip to content

Commit

Permalink
Added support for creating and editing shell scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
Uros Petrevski committed Apr 17, 2015
1 parent ed10165 commit 2740a52
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion handlers/editorHandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ def createNewFile(self, rq):
if ((".html" in name) or (".py" in name) or (".json" in name) or
(".css" in name) or (".txt" in name) or (".js" in name) or
(".md" in name) or (".svg" in name) or (".xml" in name) or
(".less" in name) or (".coffee" in name)):
(".less" in name) or (".coffee" in name) or (".sh" in name)):

weioFiles.saveRawContentToFile(confFile["last_opened_project"] + "/" + name, contents.encode('utf-8'))
else :
Expand Down
3 changes: 2 additions & 1 deletion weioLib/weioFiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ def getFileType(path):
".svg": "svg",
".xml":"xml",
".less":"less",
".coffee":"coffee"
".coffee":"coffee",
".sh":"shell"
}

images = {
Expand Down
3 changes: 3 additions & 0 deletions www/editor.html
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,9 @@ <h3 id="myModalCreateNewFileLabel">Create new file</h3>

<button type="button" class="btn" onclick="setFileType('json')" onmouseover="$(this).tooltip()"
data-placement="bottom" title="Javascript object notation">.json</button>

<button type="button" class="btn" onclick="setFileType('sh')" onmouseover="$(this).tooltip()"
data-placement="bottom" title="Shell script">.sh</button>
</div>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions www/libs/weio/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ $(document).ready(function () {
if ((path.indexOf(".css") != -1) || (path.indexOf(".py") != -1) || (path.indexOf(".js") != -1) ||
(path.indexOf(".html") != -1) || (path.indexOf(".txt") != -1) || (path.indexOf(".md") != -1) ||
(path.indexOf(".json") != -1) || (path.indexOf(".xml") != -1) || (path.indexOf(".less") != -1) ||
(path.indexOf(".cofee") != -1) || (path.indexOf(".svg") != -1) ||
(path.indexOf(".cofee") != -1) || (path.indexOf(".svg") != -1) || (path.indexOf(".sh") != -1) ||
// images
(path.indexOf(".png") != -1) || (path.indexOf(".jpg") != -1) || (path.indexOf(".bmp") != -1) ||
(path.indexOf(".gif") != -1)
Expand Down Expand Up @@ -560,7 +560,7 @@ function handleFileSelect(evt) {
if ((fileName.indexOf(".html") != -1) || (fileName.indexOf(".py") != -1) || (fileName.indexOf(".json") != -1) ||
(fileName.indexOf(".css") != -1) || (fileName.indexOf(".txt") != -1) || (fileName.indexOf(".js") != -1) ||
(fileName.indexOf(".md") != -1) || (fileName.indexOf(".svg") != -1) || (fileName.indexOf(".xml") != -1) ||
(fileName.indexOf(".less") != -1) || (fileName.indexOf(".coffee") != -1)) {
(fileName.indexOf(".less") != -1) || (fileName.indexOf(".coffee") != -1) || (fileName.indexOf(".sh") != -1)) {
reader.readAsText(f);
} else {
reader.readAsDataURL(f);
Expand Down

0 comments on commit 2740a52

Please sign in to comment.