From 506496743dc04b6e600790b0b6fa00b656540349 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen <Paulus@PaulusSchoutsen.nl> Date: Fri, 24 Oct 2014 23:44:00 -0700 Subject: [PATCH] Cleaning up the code --- homeassistant/bootstrap.py | 2 +- homeassistant/components/http/__init__.py | 5 +- .../polymer/home-assistant-main.html | 3 +- .../components/http/www_static/script.js | 34 ----------- .../components/http/www_static/style.css | 57 ------------------- 5 files changed, 5 insertions(+), 96 deletions(-) delete mode 100644 homeassistant/components/http/www_static/script.js delete mode 100644 homeassistant/components/http/www_static/style.css diff --git a/homeassistant/bootstrap.py b/homeassistant/bootstrap.py index e2420824df6..99fc014e2ec 100644 --- a/homeassistant/bootstrap.py +++ b/homeassistant/bootstrap.py @@ -18,7 +18,7 @@ import homeassistant.components as core_components import homeassistant.components.group as group -# pylint: disable=too-many-branches +# pylint: disable=too-many-branches, too-many-statements def from_config_dict(config, hass=None): """ Tries to configure Home Assistant from a config dict. diff --git a/homeassistant/components/http/__init__.py b/homeassistant/components/http/__init__.py index 751194b2529..df7f85e82c9 100644 --- a/homeassistant/components/http/__init__.py +++ b/homeassistant/components/http/__init__.py @@ -164,6 +164,7 @@ def setup(hass, config): class HomeAssistantHTTPServer(ThreadingMixIn, HTTPServer): """ Handle HTTP requests in a threaded fashion. """ + # pylint: disable=too-many-arguments def __init__(self, server_address, RequestHandlerClass, hass, api_password, development=False): super().__init__(server_address, RequestHandlerClass) @@ -182,7 +183,6 @@ class HomeAssistantHTTPServer(ThreadingMixIn, HTTPServer): if development: self.logger.info("running frontend in development mode") - def start(self): """ Starts the server. """ @@ -405,8 +405,7 @@ class RequestHandler(BaseHTTPRequestHandler): " user-scalable=no, initial-scale=1.0, " " minimum-scale=1.0, maximum-scale=1.0' />" "</head>" - "<body unresolved fullbleed" - " style='background-color: #E5E5E5'>" + "<body>" "<home-assistant-main auth='{}'></home-assistant-main>" "</body></html>").format(app_url, self.server.api_password)) diff --git a/homeassistant/components/http/www_static/polymer/home-assistant-main.html b/homeassistant/components/http/www_static/polymer/home-assistant-main.html index 721b2daf766..b3d9aa995d1 100644 --- a/homeassistant/components/http/www_static/polymer/home-assistant-main.html +++ b/homeassistant/components/http/www_static/polymer/home-assistant-main.html @@ -19,6 +19,7 @@ height: 100%; overflow: auto; -webkit-overflow-scrolling: touch; + background-color: #E5E5E5; } core-toolbar { @@ -42,7 +43,7 @@ <home-assistant-api auth="{{auth}}" id="api"></home-assistant-api> - <core-header-panel layout> + <core-header-panel unresolved fullbleed> <core-toolbar> <div flex> diff --git a/homeassistant/components/http/www_static/script.js b/homeassistant/components/http/www_static/script.js deleted file mode 100644 index b9f4f1cf3d5..00000000000 --- a/homeassistant/components/http/www_static/script.js +++ /dev/null @@ -1,34 +0,0 @@ -// from http://stackoverflow.com/questions/1403888/get-escaped-url-parameter -function getURLParameter(name) { - return decodeURI( - (RegExp(name + '=' + '(.+?)(&|$)').exec(location.search)||[,null])[1] - ); -} - - -$(function() { - $("[data-service]").click(function() { - var form = $(".form-call-service"); - - var el = $(this); - var parts = el.attr("data-service").split("/"); - - form.find("#domain").val(parts[0]); - form.find("#service").val(parts[1]); - - var entity_id = el.attr("data-entity_id"); - - if(entity_id) { - form.find("#service_data").val(JSON.stringify({entity_id: entity_id})); - } else { - form.find("#service_data").val(""); - } - - // if it has the attirbute autofire we submit the form - if(el.is("[data-service-autofire]")) { - form.submit(); - } - - return false; - }) -}) \ No newline at end of file diff --git a/homeassistant/components/http/www_static/style.css b/homeassistant/components/http/www_static/style.css deleted file mode 100644 index 419ddcd4cdf..00000000000 --- a/homeassistant/components/http/www_static/style.css +++ /dev/null @@ -1,57 +0,0 @@ -@import url(//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.0.2/css/bootstrap.min.css); - -.states td .glyphicon, .services td .glyphicon { - margin-top: 2px; -} - -.states td:nth-child(1), .services td:nth-child(1) { - width: 22px; - padding-right: 0px; -} - -.states td:nth-child(4) { - max-width: 550px; - word-break: break-word; -} - -.states td:nth-child(5) { - white-space: nowrap; -} - -.panel > form, .panel > form > .table { - margin-bottom: 0; -} - -.panel .table { - font-size: inherit; -} - -.form-signin { - max-width: 330px; - margin: 0 auto; -} - -.form-signin .form-control { - margin-top: 40px; - position: relative; - font-size: 16px; - height: auto; - padding: 10px; - margin-bottom: -1px; - border-bottom-left-radius: 0; - border-bottom-right-radius: 0; - text-align: center; -} - -.form-signin .btn-primary { - border-top-left-radius: 0; - border-top-right-radius: 0; -} - -.form-fire-event, .form-call-service { - margin-bottom: 0px; -} - -.form-fire-event .form-group:last-child { - margin-bottom: 0; -} -- GitLab