From f81632b9d91791a43cdc4ceb87b26d9ad2db31f1 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Wed, 22 Jun 2016 17:49:04 +0530 Subject: [PATCH] [redesign] removed website statics, www served like templates/pages --- frappe/commands/utils.py | 31 --- frappe/installer.py | 3 +- frappe/migrate.py | 6 +- frappe/patches.txt | 3 +- frappe/patches/v5_0/force_sync_website.py | 3 +- frappe/templates/includes/static_index.html | 2 +- frappe/templates/pages/404.html | 2 +- frappe/templates/pages/about.html | 2 +- frappe/templates/pages/contact.html | 2 +- frappe/templates/pages/edit-profile.html | 2 +- frappe/templates/pages/error.html | 2 +- frappe/templates/pages/login.html | 2 +- frappe/templates/pages/message.html | 2 +- frappe/templates/pages/update-password.html | 2 +- frappe/website/context.py | 9 +- frappe/website/doctype/web_page/web_page.py | 92 ++------- frappe/website/render.py | 6 +- frappe/website/router.py | 155 ++++++++++++--- frappe/website/statics.py | 200 -------------------- 19 files changed, 167 insertions(+), 359 deletions(-) delete mode 100644 frappe/website/statics.py diff --git a/frappe/commands/utils.py b/frappe/commands/utils.py index 986c0ffec5..51ac94ac70 100644 --- a/frappe/commands/utils.py +++ b/frappe/commands/utils.py @@ -65,35 +65,6 @@ def destroy_all_sessions(context): finally: frappe.destroy() -@click.command('sync-www') -@click.option('--force', help='Rebuild all pages', is_flag=True, default=False) -@pass_context -def sync_www(context, force=False): - "Sync files from static pages from www directory to Web Pages" - from frappe.website import statics - for site in context.sites: - try: - frappe.init(site=site) - frappe.connect() - statics.sync_statics(rebuild=force) - frappe.db.commit() - finally: - frappe.destroy() - -@click.command('build-website') -@pass_context -def build_website(context): - "Sync statics and clear cache" - from frappe.website import render, statics - for site in context.sites: - try: - frappe.init(site=site) - frappe.connect() - render.clear_cache() - statics.sync(verbose=context.verbose).start(rebuild=True) - frappe.db.commit() - finally: - frappe.destroy() @click.command('reset-perms') @pass_context @@ -409,7 +380,6 @@ def get_version(): commands = [ build, - build_website, clear_cache, clear_website_cache, console, @@ -429,7 +399,6 @@ commands = [ run_tests, serve, set_config, - sync_www, watch, _bulk_rename, add_to_email_queue, diff --git a/frappe/installer.py b/frappe/installer.py index bd0fb42781..fe1500313c 100755 --- a/frappe/installer.py +++ b/frappe/installer.py @@ -14,7 +14,7 @@ import importlib from frappe.model.db_schema import DbManager from frappe.model.sync import sync_for from frappe.utils.fixtures import sync_fixtures -from frappe.website import render, statics +from frappe.website import render from frappe.desk.doctype.desktop_icon.desktop_icon import sync_from_app from frappe.utils.password import create_auth_table @@ -208,7 +208,6 @@ def remove_app(app_name, dry_run=False): def post_install(rebuild_website=False): if rebuild_website: render.clear_cache() - statics.sync().start() init_singles() frappe.db.commit() diff --git a/frappe/migrate.py b/frappe/migrate.py index 33d20e8ffc..ef88944b7e 100644 --- a/frappe/migrate.py +++ b/frappe/migrate.py @@ -10,7 +10,7 @@ import frappe.model.sync from frappe.utils.fixtures import sync_fixtures from frappe.sessions import clear_global_cache from frappe.desk.notifications import clear_notifications -from frappe.website import statics, render +from frappe.website import render from frappe.desk.doctype.desktop_icon.desktop_icon import sync_desktop_icons def migrate(verbose=True, rebuild_website=False): @@ -34,10 +34,6 @@ def migrate(verbose=True, rebuild_website=False): # syncs statics render.clear_cache() - if rebuild_website: - statics.sync(verbose=verbose).start(True) - else: - statics.sync_statics() frappe.db.commit() diff --git a/frappe/patches.txt b/frappe/patches.txt index 72e1011205..36e26d03b7 100644 --- a/frappe/patches.txt +++ b/frappe/patches.txt @@ -129,4 +129,5 @@ frappe.patches.v7_0.desktop_icons_hidden_by_admin_as_blocked frappe.patches.v7_0.add_communication_in_doc frappe.patches.v7_0.update_send_after_in_bulk_email frappe.patches.v7_0.setup_list_settings -execute:frappe.db.sql('''delete from `tabSingles` where doctype="Email Settings"''') # 2016-06-13 \ No newline at end of file +execute:frappe.db.sql('''delete from `tabSingles` where doctype="Email Settings"''') # 2016-06-13 +execute:frappe.db.sql("delete from `tabWeb Page` where ifnull(template_path, '')!=''") diff --git a/frappe/patches/v5_0/force_sync_website.py b/frappe/patches/v5_0/force_sync_website.py index 652ba9d159..5dcd0d79c7 100644 --- a/frappe/patches/v5_0/force_sync_website.py +++ b/frappe/patches/v5_0/force_sync_website.py @@ -1,6 +1,5 @@ from __future__ import unicode_literals import frappe -from frappe.website import statics def execute(): - statics.sync_statics(rebuild=True) + pass diff --git a/frappe/templates/includes/static_index.html b/frappe/templates/includes/static_index.html index c61bb001a6..73a08fd752 100644 --- a/frappe/templates/includes/static_index.html +++ b/frappe/templates/includes/static_index.html @@ -1,4 +1,4 @@ - +
    diff --git a/frappe/templates/pages/404.html b/frappe/templates/pages/404.html index 70164412a4..2ebd230288 100644 --- a/frappe/templates/pages/404.html +++ b/frappe/templates/pages/404.html @@ -7,7 +7,7 @@ {%- endblock -%} {% block page_content %} - +

    {{_("We are very sorry for this, but the page you are looking for is missing (this could be because of a typo in the address) or moved.")}}

    diff --git a/frappe/templates/pages/about.html b/frappe/templates/pages/about.html index f65fc6b9ac..14ac0a216d 100644 --- a/frappe/templates/pages/about.html +++ b/frappe/templates/pages/about.html @@ -5,7 +5,7 @@ {% include "templates/pages/web_sidebar.html" %} {% endblock %} {% block page_content %} - +
    {{ doc.company_introduction or """

    Some Introduction about your company that you would like your website visitor to know. diff --git a/frappe/templates/pages/contact.html b/frappe/templates/pages/contact.html index 18a17b4a0c..5f6f0f7980 100644 --- a/frappe/templates/pages/contact.html +++ b/frappe/templates/pages/contact.html @@ -3,7 +3,7 @@ {% block title %}{{ heading or "Contact Us"}}{% endblock %} {% block page_content %} - +

    diff --git a/frappe/templates/pages/edit-profile.html b/frappe/templates/pages/edit-profile.html index 2e8756f3e9..f2b3ef4c83 100644 --- a/frappe/templates/pages/edit-profile.html +++ b/frappe/templates/pages/edit-profile.html @@ -41,6 +41,6 @@ frappe.ready(function() { }) }) - + {% endblock %} diff --git a/frappe/templates/pages/error.html b/frappe/templates/pages/error.html index 1a86d8e4d7..267c035fee 100644 --- a/frappe/templates/pages/error.html +++ b/frappe/templates/pages/error.html @@ -9,7 +9,7 @@ {% endblock %} {% block page_content %} - +
    {{ error }}
    diff --git a/frappe/templates/pages/login.html b/frappe/templates/pages/login.html index a6c2a630fa..0da1fe3ac1 100644 --- a/frappe/templates/pages/login.html +++ b/frappe/templates/pages/login.html @@ -8,7 +8,7 @@ {% block page_content %} - +