From 7025e340549d1f072dda9a8037f8d063c5a58106 Mon Sep 17 00:00:00 2001 From: Sven Slootweg Date: Wed, 14 Aug 2013 01:55:15 +0200 Subject: [PATCH] Fix up UI and assorted fixes --- public_html/modules/intro.php | 18 ++++++ public_html/rewrite.php | 13 +++- public_html/static/css/openng.css | 90 ++++++++++++++++++++++++++ public_html/static/js/openng.js | 58 +++++++++++++++++ public_html/templates/index.tpl | 32 ++++----- public_html/templates/static/intro.tpl | 1 + 6 files changed, 196 insertions(+), 16 deletions(-) create mode 100644 public_html/modules/intro.php create mode 100644 public_html/static/css/openng.css create mode 100644 public_html/static/js/openng.js create mode 100644 public_html/templates/static/intro.tpl diff --git a/public_html/modules/intro.php b/public_html/modules/intro.php new file mode 100644 index 0000000..f959ef2 --- /dev/null +++ b/public_html/modules/intro.php @@ -0,0 +1,18 @@ + NewTemplater::Render("static/intro", $locale->strings, array()) +); diff --git a/public_html/rewrite.php b/public_html/rewrite.php index cbded81..e9830fc 100644 --- a/public_html/rewrite.php +++ b/public_html/rewrite.php @@ -14,6 +14,8 @@ $_APP = true; require("includes/base.php"); +$sData = array(); + $router = new CPHPRouter(); $router->ignore_query = true; @@ -22,8 +24,17 @@ $router->allow_slash = true; $router->routes = array( 0 => array( "^/$" => "modules/index.php", - "^/editor$" => "modules/editor.php" + "^/editor$" => "modules/editor.php", + "^/intro$" => array( + 'target' => "modules/intro.php", + '_json' => true + ), ) ); $router->RouteRequest(); + +if(!empty($router->uVariables['json'])) +{ + echo(json_encode($sData)); +} diff --git a/public_html/static/css/openng.css b/public_html/static/css/openng.css new file mode 100644 index 0000000..ac1161b --- /dev/null +++ b/public_html/static/css/openng.css @@ -0,0 +1,90 @@ +#main_toolbar, #main_toolbar button +{ + font-family: "Istok Web"; +} + +#main_toolbar +{ + padding: 36px 24px; +} + +form.inline +{ + display: inline; +} + +#form_search +{ + float: left; + margin-left: 12px; +} + +#form_search input, #form_search button +{ + height: 37px; +} + +#form_search input +{ + margin-left: 12px; + font-size: 16px; + padding: 7px 14px; + border-top-right-radius: 0px; + border-bottom-right-radius: 0px; + width: 290px; +} + +#form_search button +{ + border-top-left-radius: 0px; + border-bottom-left-radius: 0px; +} + +#main_toolbar a.add +{ + float: left; +} + +.pure-button +{ + padding: 7px 14px; +} + +.pure-button.shadow +{ + text-shadow: 1px 1px 1px #424242; + -webkit-text-shadow: 1px 1px 1px #424242; + -moz-text-shadow: 1px 1px 2px #424242; + -o-text-shadow: 1px 1px 1px #424242; + -ms-text-shadow: 1px 1px 1px #424242; +} + +.pure-button.add +{ + background-color: #15BA31; + color: white; +} + +.pure-button.search +{ + background-color: #152DBA; + color: white; +} + +.pure-button i +{ + margin-right: 8px; + position: relative; + top: 1px; +} + +.element-group +{ + display: block; + float: left; +} + +.element-group * +{ + float: left; +} diff --git a/public_html/static/js/openng.js b/public_html/static/js/openng.js new file mode 100644 index 0000000..74e7824 --- /dev/null +++ b/public_html/static/js/openng.js @@ -0,0 +1,58 @@ +function hookSubmitEvent(form, callback, error) +{ + /* Hooks a form to be submitted via AJAX, executing the given + * callback if the request succeeds. + * + * form: a jQuery object containing one or more form elements + * callback: the function to run after a successful request + * error: optionally, a callback function to run when the + * request fails + */ + + form.each(function(index){ + var element = $(this); + var method = element.attr("method").toUpperCase(); + var target = element.attr("action"); + + element.submit(function(){ + var formdata = element.serialize(); + console.log(formdata); + $.ajax({ + type: method, + url: target, + data: formdata, + success: callback, + error: error + }); + + return false; + }); + }); +} + +$(function(){ + hookSubmitEvent($("#form_addnode")); + + $("#button_toolbar_addnode").click(function(){ + new JsdeWindow({ + width: 320, + height: 400, + x: 40, + y: 40, + title: "Create new node", + contents: "Loading...", + source_url: "/nodes/create" + }); + }); + + /* Intro screen */ + new JsdeWindow({ + width: 640, + height: 480, + x: ($(window).width() / 2) - (640 / 2), + y: ($(window).height() / 2) - (480 / 2), + title: "Welcome!", + contents: "Loading...", + source_url: "/intro" + }); +}); diff --git a/public_html/templates/index.tpl b/public_html/templates/index.tpl index bb557eb..573c725 100644 --- a/public_html/templates/index.tpl +++ b/public_html/templates/index.tpl @@ -6,6 +6,7 @@ + + - + + +
+ Create new node + + +