Commits

Jackson Broussard committed 8499723 Merge with conflicts

Merge branch 'master' of bitbucket.org:djbouche/scribblepie

Conflicts:
layout/skeleton.mint

  • Participants
  • Parent commits 448b6e3, 1df8e5e

Comments (0)

Files changed (10)

 importTemplates = []
 stylesheets = []
 scripts = []
+menus = []
 
 html5 = mint.Markup("<!DOCTYPE html>")
 
             languages = json.loads(cf.read())
 
 def loadLayout():
-    global baseTemplate,importTemplates,stylesheets,scripts
+    global baseTemplate,importTemplates,stylesheets,scripts,menus
     tmp = {}
     if os.path.exists("layout/templates.json"):
         with open("layout/templates.json","r") as cf:
     importTemplates = tmp['importTemplates']
 
     if os.path.exists("layout/stylesheets.json"):
-        with open("layout/templates.json","r") as cf:
+        with open("layout/stylesheets.json","r") as cf:
             stylesheets = json.loads(cf.read())
 
     if os.path.exists("layout/scripts.json"):
-        with open("layout/templates.json","r") as cf:
+        with open("layout/scripts.json","r") as cf:
             scripts = json.loads(cf.read())
 
+    if os.path.exists("layout/menu.json"):
+        with open("layout/menu.json","r") as cf:
+            menus = json.loads(cf.read())
+
+
+def resolveStylesheets():
+    arr = []
+    for x in stylesheets:
+        if x.startswith('http:') or x.startswith('https:'):
+            arr.append(x)
+        else:
+            arr.append(css(x))
+    return arr
+
+def resolveScripts():
+    arr = []
+    for x in scripts:
+        if x.startswith('http:') or x.startswith('https:'):
+            arr.append(x)
+        else:
+            arr.append(js(x))
+    return arr
 
 def jsf(func,params=""):
     return '%s(%s)' % (func,params);
 def generateScope():
     return {
         'title': cfg['title'],
-        'stylesheets': stylesheets,
-        'scripts': scripts,
+        'stylesheets': resolveStylesheets(),
+        'scripts': resolveScripts(),
+        'menus': menus,
         'html5': html5,
         'js': js,
         'css': css,

File layout/dirpathpills.fragment.mint

-#if cwd == '':
-    @li.class(active) 
-        @a.href(#).onClick({{ loadPath('') }}) / 
-#else:
-    @li
-        @a.href(#).onClick({{ loadPath('') }}) / 
-    #for p in pathparts[0:len(pathparts)-1]
-        @li
-            @a.href(#).onClick({{ loadPath(p['path']) }}) {{ p['f'] }}
-    @li.class(active) 
-        @a.href(#).onClick({{ loadPath(pathparts[-1]['path']) }}) {{ pathparts[-1]['f'] }}

File layout/edit.mint

-{{ html5 }}
-@html.lang(en)
-    @head
-        @title {{ title }}
-
-        @link.rel(stylesheet).href({{ css('bootstrap.min') }})
-        @link.rel(stylesheet).href({{ css() }})
-
-        @script.src(http://code.jquery.com/jquery-1.9.1.min.js)
-        @script.src({{ js('bootstrap.min') }})
-        @script.src(http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js)
-        @script.src({{ js() }})
-
-    @body
-        @br
-        @div.class(container)
-            @div.class(row).id(main)
-                @div.id(side)
-                @div.id(edittop)
-                    @ul.class(breadcrumb)
-                        @li.id(buff)
-                    @div.id(editor)
-            @div.class(row)
-                @br

File layout/footer.mint

+@p.align(center) ScribblePie {{ symbols['copy'] }} Copyright No Limit Zone 2013

File layout/menu.json

+[
+    {
+        "id": "fileMenu", 
+        "title": "File",
+        "items": [
+            { 
+                "id": "fileMenuNewAction",
+                "title": "New",
+                "action": "newFile",
+                "icon": "icon-file"
+            },
+            { 
+                "id": "fileMenuSaveAction",
+                "title": "Save",
+                "action": "saveFile",
+                "icon": "icon-ok",
+                "group": "openFileActions"
+            },          
+            { 
+                "id": "fileMenuSaveAsAction",
+                "title": "Save As…",
+                "action": "saveAsFile",
+                "icon": "icon-ok",
+                "group": "openFileActions"
+            },
+            { 
+                "id": "sep",
+            },
+            { 
+                "id": "fileMenuCloseAction",
+                "title": "Close File",
+                "action": "closeFile",
+                "icon": "icon-remove",
+                "group": "openFileActions"
+            }
+        ]
+    },
+    {
+        "id": "testMenu", 
+        "title": "Test Menu",
+        "items": [
+            { 
+                "id": "testMenuItem1",
+                "title": "Test 1",
+                "action": "notImplemented"
+            },
+            { 
+                "id": "sep"
+            },
+            { 
+                "id": "testMenuItem2",
+                "title": "Test uuuu",
+                "action": "notImplemented"
+            }
+        ]
+    },
+    {
+        "id": "testMenu2", 
+        "title": "Test 2",
+        "action": "notImplemented"
+    }
+]

File layout/navbar.mint

+#def printMenuTitle(menu):
+    #if 'icon' in menu:
+        @i.class({{ menu['icon'] }})
+        {{ nbsp }}
+    {{ menu['title'] }}
+
+#def parseMenuItem(menu):
+    #if menu['id'] == 'sep':
+        @li.class(divider).data-group({{ menu['group'] if 'group' in menu else '' }})
+    #elif 'items' in menu:
+        @li.class(dropdown).id({{ menu['id'] }}).data-group({{ menu['group'] if 'group' in menu else '' }})
+            @a.href(#).class(dropdown-toggle).data-toggle(dropdown)
+                #printMenuTitle(menu)
+                @b.class(caret)
+            @ul.class(dropdown-menu)
+                #for subitem in menu['items']:
+                    #parseMenuItem(subitem)
+    #else:
+        @li.id({{ menu['id'] }}).data-group({{ menu['group'] if 'group' in menu else '' }})
+            @a.href(#).onClick({{ jsf(menu['action']) if 'action' in menu else ''}})
+                #printMenuTitle(menu)
+
 @div.class(navbar)
     @div.class(navbar-inner)
         @a.class(brand).href(#) {{ title }}
         @ul.class(nav)
-            @li.class(dropdown)
-                @a.href(#).class(dropdown-toggle).data-toggle(dropdown)
-                    File
-                    @b.class(caret)
-                @ul.class(dropdown-menu)
-                    @li
-                        @a.href(#).onClick({{ jsf('newFile') }})
-                            @i.class(icon-file)
-                            {{ nbsp }} New
-                    @li.data-group(openFileActions)
-                        @a.href(#).onClick({{ saveFile() }})
-                            @i.class(icon-ok)
-                            {{ nbsp }} Save
+            #for menu in menus:
+                #parseMenuItem(menu)
         @ul.class(nav pull-right)
             @li
                 @a.href(#).id(languagetitle) {{ nbsp }}

File layout/sidebar.fragment.mint

-@ul.class(nav nav-pills nav-stacked)
-    #for item in dirs:
-        @li
-            @a.href(#).onClick({{ loadPath(item['path']) }}) 
-                @i.class(icon-folder-open icon-white)
-                {{ nbsp }}
-                {{ item['f']}}
-    #for item in files:
-        @li
-            @a.href(#).onClick({{ editPath(item['path']) }})
-                @i.class(icon-file icon-white)
-                {{ nbsp }}
-                {{ item['f'] }}

File layout/skeleton.mint

-#def stylesheets():
-    @link.rel(stylesheet).href({{ css('bootstrap.min') }})
-    @link.rel(stylesheet).href({{ css() }})
+#def loadStylesheets():
+    #for css in stylesheets:
+        @link.rel(stylesheet).href({{ css }})
 
-#def scripts():
-    @script.src(http://code.jquery.com/jquery-1.9.1.min.js)
-    @script.src({{ js('bootstrap.min') }})
-    @script.src(http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js)
-    @script.src({{ js() }})
-
-#def footer():
-    @p.align(center) ScribblePie {{ symbols['copy'] }} Copyright No Limit Zone 2013
+#def loadScripts():
+    #for script in scripts:
+        @script.src({{ script }})
 
 {{ html5 }}
 @html.lang(en)
     @head
         @title {{ title }}
 
-        #stylesheets()
-        #scripts()
+        #loadStylesheets()
+        #loadScripts()
 
     @body
         {{ modal_confirmSaveModal }}

File layout/templates.json

 	"baseTemplate": "skeleton",
 	"importTemplates": [
 		"navbar",
+		"footer",
 		"modal/confirmSaveModal",
 		"modal/savingModal",
 		"modal/saveErrorModal"

File static/js/main.js

     editor.setSession(new EditSession("","ace/mode/text"));
     editor.setReadOnly(true);
 }
+
+function notImplemented() {
+    window.alert("Not Implemented");    
+}
+
+function newFile() {
+    notImplemented();
+}
+
+function saveAsFile() {
+    notImplemented();
+}
+
+
 function forceClose() {
     $('#confirmSaveModal').modal('hide');
     delete files[openfiles[editIndex]];