From 131b559a6136fc6f6f9b1c9aac54898b9a3aa74c Mon Sep 17 00:00:00 2001 From: ewinslow Date: Tue, 22 Feb 2011 07:00:35 +0000 Subject: Cleaned up blog js git-svn-id: http://code.elgg.org/elgg/trunk@8419 36083f99-b078-4883-b0ff-0f9b5a30f544 --- mod/blog/lib/blog.php | 8 +- mod/blog/views/default/forms/blog/save.php | 2 +- mod/blog/views/default/input/datetime.php | 10 +-- mod/blog/views/default/js/blog/save_draft.php | 121 ++++++++++---------------- 4 files changed, 57 insertions(+), 84 deletions(-) (limited to 'mod/blog') diff --git a/mod/blog/lib/blog.php b/mod/blog/lib/blog.php index 326b224bb..5287844ab 100644 --- a/mod/blog/lib/blog.php +++ b/mod/blog/lib/blog.php @@ -309,9 +309,11 @@ function blog_get_page_content_edit($page, $guid = 0, $revision = NULL) { elgg_push_breadcrumb($blog->title, $blog->getURL()); elgg_push_breadcrumb(elgg_echo('edit')); + + $blog_js = elgg_get_simplecache_url('js', 'blog/save_draft'); + elgg_register_js($blog_js, 'blog'); $content = elgg_view_form('blog/save', $vars, $body_vars); - $content .= elgg_view('js/blog/save_draft'); $sidebar = elgg_view('blog/sidebar/revisions', $vars); } else { $content = elgg_echo('blog:error:cannot_edit_post'); @@ -328,7 +330,9 @@ function blog_get_page_content_edit($page, $guid = 0, $revision = NULL) { $title = elgg_echo('blog:add'); $content = elgg_view_form('blog/save', $vars, $body_vars); - $content .= elgg_view('js/blog/save_draft'); + + $blog_js = elgg_get_simplecache_url('js', 'blog/save_draft'); + elgg_register_js($blog_js, 'blog'); } $return['title'] = $title; diff --git a/mod/blog/views/default/forms/blog/save.php b/mod/blog/views/default/forms/blog/save.php index 6020ad4b0..c0c9ea7cd 100644 --- a/mod/blog/views/default/forms/blog/save.php +++ b/mod/blog/views/default/forms/blog/save.php @@ -19,7 +19,7 @@ if ($vars['guid']) { $delete_link = elgg_view('output/confirmlink', array( 'href' => $delete_url, 'text' => elgg_echo('delete'), - 'class' => 'elgg-button-action elgg-state-disabled' + 'class' => 'elgg-button elgg-button-delete elgg-state-disabled' )); } diff --git a/mod/blog/views/default/input/datetime.php b/mod/blog/views/default/input/datetime.php index 3a7244b88..1f4a33ecd 100644 --- a/mod/blog/views/default/input/datetime.php +++ b/mod/blog/views/default/input/datetime.php @@ -18,31 +18,31 @@ $month = elgg_view('input/dropdown', array( 'name' => 'publish_month', 'value' => date('m', $publish_date), 'options_values' => $months, - 'class' => 'blog_publish_month', + 'class' => 'elgg-input-datetime-month', )); $day = elgg_view('input/text', array( 'name' => 'publish_day', 'value' => date('d', $publish_date), - 'class' => 'blog_publish_day', + 'class' => 'elgg-input-datetime-day', )); $year = elgg_view('input/text', array( 'name' => 'publish_year', 'value' => date('Y', $publish_date), - 'class' => 'blog_publish_year', + 'class' => 'elgg-input-datetime-year', )); $hour = elgg_view('input/text', array( 'name' => 'publish_hour', 'value' => date('H', $publish_date), - 'class' => 'blog_publish_hour', + 'class' => 'elgg-input-datetime-hour', )); $minute = elgg_view('input/text', array( 'name' => 'publish_minute', 'value' => date('i', $publish_date), - 'class' => 'blog_publish_minute', + 'class' => 'elgg-input-datetime-minute', )); echo "$month $day, $year @ $hour:$minute"; diff --git a/mod/blog/views/default/js/blog/save_draft.php b/mod/blog/views/default/js/blog/save_draft.php index 7f3c3bb12..990ab357d 100644 --- a/mod/blog/views/default/js/blog/save_draft.php +++ b/mod/blog/views/default/js/blog/save_draft.php @@ -3,97 +3,66 @@ * Save draft through ajax * * @package Blog - * - * @todo JS 1.8: no. Convert to use elgg.blog.* */ ?> - +elgg.register_event_handler('init', 'system', elgg.blog.init); \ No newline at end of file -- cgit v1.2.3