From 7586f2746a712b3453009477683b0ffeb0db6892 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Sun, 23 Oct 2011 04:29:20 +0200 Subject: [PATCH] build static, move js files --- pandora/app/management/__init__.py | 0 pandora/app/management/commands/__init__.py | 0 .../app/management/commands/update_static.py | 15 +++ pandora/app/models.py | 26 ++++ pandora/templates/api.html | 4 +- pandora/templates/embed.html | 2 +- pandora/templates/index.html | 4 +- static/js/{ => api}/highlight.pack.js | 0 static/js/{pandora.api.js => api/pandora.js} | 0 .../js/{pandoraEmbed.js => embed/pandora.js} | 0 static/js/{pandora.js => init.js} | 49 ++++---- static/js/pandora/{ui => }/account.js | 0 static/js/pandora/{ui => }/appPanel.js | 0 static/js/pandora/{ui => }/backButton.js | 0 static/js/pandora/{ui => }/browser.js | 0 static/js/pandora/{ui => }/clipList.js | 0 static/js/pandora/{ui => }/clipPlayer.js | 0 static/js/pandora/{ui => }/contactForm.js | 0 static/js/pandora/{ui => }/contentPanel.js | 0 .../js/pandora/{ui => }/deleteListDialog.js | 0 static/js/pandora/{ui => }/editor.js | 0 static/js/pandora/{ui => }/eventsDialog.js | 0 static/js/pandora/{ui => }/filesView.js | 0 static/js/pandora/{ui => }/filter.js | 0 static/js/pandora/{ui => }/filterDialog.js | 0 static/js/pandora/{ui => }/findElement.js | 0 static/js/pandora/{ui => }/folderBrowser.js | 0 .../js/pandora/{ui => }/folderBrowserBar.js | 0 .../js/pandora/{ui => }/folderBrowserList.js | 0 static/js/pandora/{ui => }/folderList.js | 0 static/js/pandora/{ui => }/folders.js | 0 static/js/pandora/{ui => }/group.js | 0 static/js/pandora/{ui => }/helpDialog.js | 0 static/js/pandora/{ui => }/home.js | 0 static/js/pandora/{ui => }/homePage.js | 0 static/js/pandora/{ui => }/info.js | 0 static/js/pandora/{ui => }/infoView.js | 0 static/js/pandora/{ui => }/item.js | 44 +++---- static/js/pandora/{ui => }/itemClips.js | 0 static/js/pandora/{ui => }/leftPanel.js | 0 static/js/pandora/{ui => }/list.js | 0 static/js/pandora/{ui => }/listDialog.js | 0 static/js/pandora/{ui => }/mainPanel.js | 0 static/js/pandora/{ui => }/mediaView.js | 0 static/js/pandora/{ui => }/menu.js | 0 static/js/pandora/{ui => }/namesDialog.js | 0 static/js/pandora/{ui => }/navigationView.js | 0 static/js/pandora/{ui => }/orderButton.js | 0 static/js/pandora/{ui => }/placesDialog.js | 0 .../js/pandora/{ui => }/preferencesDialog.js | 0 static/js/pandora/{ui => }/publicLists.js | 0 static/js/pandora/{ui => }/rightPanel.js | 0 static/js/pandora/{ui => }/sectionButtons.js | 0 static/js/pandora/{ui => }/sectionSelect.js | 0 static/js/pandora/{ui => }/sectionbar.js | 0 static/js/pandora/{ui => }/siteDialog.js | 0 static/js/pandora/{ui => }/sortSelect.js | 0 static/js/pandora/{ui => }/status.js | 0 static/js/pandora/{ui => }/statusbar.js | 0 static/js/pandora/{ui => }/titlesDialog.js | 0 static/js/pandora/{ui => }/toolbar.js | 0 static/js/pandora/{ui => }/usersDialog.js | 0 static/js/pandora/{ui => }/videoPreview.js | 0 static/js/pandora/{ui => }/viewSelect.js | 0 static/json/pandora.json | 118 +++++++++--------- 65 files changed, 146 insertions(+), 116 deletions(-) create mode 100644 pandora/app/management/__init__.py create mode 100644 pandora/app/management/commands/__init__.py create mode 100644 pandora/app/management/commands/update_static.py rename static/js/{ => api}/highlight.pack.js (100%) rename static/js/{pandora.api.js => api/pandora.js} (100%) rename static/js/{pandoraEmbed.js => embed/pandora.js} (100%) rename static/js/{pandora.js => init.js} (83%) rename static/js/pandora/{ui => }/account.js (100%) rename static/js/pandora/{ui => }/appPanel.js (100%) rename static/js/pandora/{ui => }/backButton.js (100%) rename static/js/pandora/{ui => }/browser.js (100%) rename static/js/pandora/{ui => }/clipList.js (100%) rename static/js/pandora/{ui => }/clipPlayer.js (100%) rename static/js/pandora/{ui => }/contactForm.js (100%) rename static/js/pandora/{ui => }/contentPanel.js (100%) rename static/js/pandora/{ui => }/deleteListDialog.js (100%) rename static/js/pandora/{ui => }/editor.js (100%) rename static/js/pandora/{ui => }/eventsDialog.js (100%) rename static/js/pandora/{ui => }/filesView.js (100%) rename static/js/pandora/{ui => }/filter.js (100%) rename static/js/pandora/{ui => }/filterDialog.js (100%) rename static/js/pandora/{ui => }/findElement.js (100%) rename static/js/pandora/{ui => }/folderBrowser.js (100%) rename static/js/pandora/{ui => }/folderBrowserBar.js (100%) rename static/js/pandora/{ui => }/folderBrowserList.js (100%) rename static/js/pandora/{ui => }/folderList.js (100%) rename static/js/pandora/{ui => }/folders.js (100%) rename static/js/pandora/{ui => }/group.js (100%) rename static/js/pandora/{ui => }/helpDialog.js (100%) rename static/js/pandora/{ui => }/home.js (100%) rename static/js/pandora/{ui => }/homePage.js (100%) rename static/js/pandora/{ui => }/info.js (100%) rename static/js/pandora/{ui => }/infoView.js (100%) rename static/js/pandora/{ui => }/item.js (94%) rename static/js/pandora/{ui => }/itemClips.js (100%) rename static/js/pandora/{ui => }/leftPanel.js (100%) rename static/js/pandora/{ui => }/list.js (100%) rename static/js/pandora/{ui => }/listDialog.js (100%) rename static/js/pandora/{ui => }/mainPanel.js (100%) rename static/js/pandora/{ui => }/mediaView.js (100%) rename static/js/pandora/{ui => }/menu.js (100%) rename static/js/pandora/{ui => }/namesDialog.js (100%) rename static/js/pandora/{ui => }/navigationView.js (100%) rename static/js/pandora/{ui => }/orderButton.js (100%) rename static/js/pandora/{ui => }/placesDialog.js (100%) rename static/js/pandora/{ui => }/preferencesDialog.js (100%) rename static/js/pandora/{ui => }/publicLists.js (100%) rename static/js/pandora/{ui => }/rightPanel.js (100%) rename static/js/pandora/{ui => }/sectionButtons.js (100%) rename static/js/pandora/{ui => }/sectionSelect.js (100%) rename static/js/pandora/{ui => }/sectionbar.js (100%) rename static/js/pandora/{ui => }/siteDialog.js (100%) rename static/js/pandora/{ui => }/sortSelect.js (100%) rename static/js/pandora/{ui => }/status.js (100%) rename static/js/pandora/{ui => }/statusbar.js (100%) rename static/js/pandora/{ui => }/titlesDialog.js (100%) rename static/js/pandora/{ui => }/toolbar.js (100%) rename static/js/pandora/{ui => }/usersDialog.js (100%) rename static/js/pandora/{ui => }/videoPreview.js (100%) rename static/js/pandora/{ui => }/viewSelect.js (100%) diff --git a/pandora/app/management/__init__.py b/pandora/app/management/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/pandora/app/management/commands/__init__.py b/pandora/app/management/commands/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/pandora/app/management/commands/update_static.py b/pandora/app/management/commands/update_static.py new file mode 100644 index 000000000..f98c2b7da --- /dev/null +++ b/pandora/app/management/commands/update_static.py @@ -0,0 +1,15 @@ +# -*- coding: utf-8 -*- +# vi:si:et:sw=4:sts=4:ts=4 +from django.core.management.base import BaseCommand + +from ... import models + + +class Command(BaseCommand): + """ + """ + help = 'update static files' + args = '' + + def handle(self, **options): + models.update_static() diff --git a/pandora/app/models.py b/pandora/app/models.py index 77d0bc28f..bc5cbac6d 100644 --- a/pandora/app/models.py +++ b/pandora/app/models.py @@ -10,6 +10,7 @@ import thread from django.db import models from django.conf import settings import ox.jsonc +from ox.utils import json _win = (sys.platform == "win32") @@ -52,3 +53,28 @@ def reloader_thread(): time.sleep(1) thread.start_new_thread(reloader_thread, ()) + +def update_static(): + oxjs_build = os.path.join(settings.STATIC_ROOT, 'oxjs/tools/build/build.py') + if os.path.exists(oxjs_build): + os.system(oxjs_build) + + data = '' + js = [] + pandora_js = os.path.join(settings.STATIC_ROOT, 'js/pandora.js') + pandora_json = os.path.join(settings.STATIC_ROOT, 'json/pandora.json') + for root, folders, files in os.walk(os.path.join(settings.STATIC_ROOT, 'js/pandora')): + for f in files: + js.append(os.path.join(root, f)[len(settings.STATIC_ROOT)+1:]) + with open(os.path.join(root, f)) as j: + data += j.read() + '\n' + + print 'write', pandora_js + with open(pandora_js, 'w') as f: + #data = ox.js.minify(data) + f.write(data) + + print 'write', pandora_json + with open(pandora_json, 'w') as f: + json.dump(sorted(js), f, indent=2) + diff --git a/pandora/templates/api.html b/pandora/templates/api.html index 347773fb0..89fce8e2a 100644 --- a/pandora/templates/api.html +++ b/pandora/templates/api.html @@ -7,8 +7,8 @@ - - + +
diff --git a/pandora/templates/embed.html b/pandora/templates/embed.html index b63fa1d37..4c34e554b 100644 --- a/pandora/templates/embed.html +++ b/pandora/templates/embed.html @@ -4,7 +4,7 @@