Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code Review: CSS/JS Abstraction and Theme improvements #958

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
f2e4f71
Rename rapidxwpr div class to wrapper - since thats what it is #550
rjmackay Oct 28, 2012
27d0645
Move pngFix into global.js and remove runScheduler function #550
rjmackay Jun 28, 2012
3cfa8d9
Porting Requirements library #338
rjmackay Oct 26, 2012
6cea6a4
Convert existing frontend code to use Requirements library #338
rjmackay Oct 26, 2012
4a3563f
Clean up timeline on/off css/js #598
rjmackay Jun 25, 2012
3f248f7
Add theme inheritance #338
rjmackay Dec 3, 2012
05f4f2c
Split CSS into other files from style.css
rjmackay Jun 26, 2012
be48891
Switch themes to only include a limited set of CSS files by default #550
rjmackay Jun 27, 2012
3b0eb4d
Make Requirements::themedCSS() work and allow themes to override more…
rjmackay Jun 28, 2012
4f81622
Add support for IE stylesheets to Requirements #338
rjmackay Jun 28, 2012
0c1d810
Share images between frontend and admin where possible #550
rjmackay Jun 28, 2012
2e79990
Convert admin to use Requirements and move admin requirements into Th…
rjmackay Jun 29, 2012
acc0095
Convert members controllers to use requirements for js/css
rjmackay Nov 23, 2012
87b3bc1
Merge header css/feeds/js and admin_requirements into one function #338
rjmackay Jun 29, 2012
7e89c9a
Don't render header/footer blocks till the last minute
rjmackay Nov 30, 2012
ffb755a
Add custom jquery ui and switch to using this #265
rjmackay Jun 29, 2012
e0f95f9
Move Requirements config into a config file #338
rjmackay Jul 11, 2012
1cc5bfe
Move admin ie CSS in to media/css/ie6.css #550
rjmackay Oct 26, 2012
0eff814
More/Better theme requirements Events
rjmackay Nov 22, 2012
346fa82
Move hook/register_themes code into Themes library
rjmackay Nov 22, 2012
cfb5dcf
Combine header_block() and admin_header_block()
rjmackay Dec 3, 2012
d453e7c
Strip back Requirements library - remove combined files functions
rjmackay Nov 22, 2012
38240bb
Add option to combine CSS / JS files
rjmackay Nov 27, 2012
32f5e11
Add support for -rtl.css files #261
rjmackay Nov 28, 2012
c2f73b6
Combine the theme files
rjmackay Nov 30, 2012
931c528
Change view_pre_render event naming convention #958
rjmackay Dec 4, 2012
90c664f
Minor: Fix code formatting in Themes library #958
rjmackay Dec 4, 2012
c0c6841
Remove dupe copyright note in Requirements library #958
rjmackay Dec 4, 2012
6ff0098
Add unit tests for Requirements library
rjmackay Dec 5, 2012
a3e6b4d
Update requirements library to fix issues found by unit testing
rjmackay Dec 5, 2012
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion application/config/locale.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,11 @@
* Locale timezone. Defaults to use the server timezone.
* @see http://php.net/timezones
*/
$config['timezone'] = '';
$config['timezone'] = '';

/**
* Force text-direction to be either LTR or RTL
* Possible values: 'rtl' 'ltr' or FALSE
* @see Ush_Locale::is_rtl_language()
*/
$config['force_text_direction'] = FALSE;
41 changes: 41 additions & 0 deletions application/config/requirements.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php defined('SYSPATH') or die('No direct script access.');

/**
* REQUIREMENTS CONFIGURATION
*/

/**
* Do we want requirements to suffix modification time onto file names
* */
$config['suffix_requirements'] = TRUE;

/**
* Enable combining of css/javascript files.
**/
$config['combined_files_enabled'] = TRUE;

/**
* Using the JSMin library to minify any
* javascript file passed to {@link combine_files()}.
**/
$config['combine_js_with_jsmin'] = TRUE;

/**
* Using the CSSMin library to minify any
* css file passed to {@link combine_files()}.
**/
$config['combine_css_with_cssmin'] = TRUE;

/**
* Enable auto uploading combined css/js to CDN
**/
$config['cdn_store_combined_files'] = TRUE;

/**
* Put all javascript includes at the bottom of the template
* before the closing <body> tag instead of the <head> tag.
* This means script downloads won't block other HTTP-requests,
* which can be a performance improvement.
* @see Requirements_Backend::$write_js_to_body for details
**/
$config['write_js_to_body'] = FALSE;
47 changes: 30 additions & 17 deletions application/controllers/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ public function __construct()

// Themes Helper
$this->themes = new Themes();
$this->themes->admin = TRUE;

// Admin is not logged in, or this is a member (not admin)
if ( ! $this->auth->logged_in('login'))
Expand Down Expand Up @@ -118,24 +119,26 @@ public function __construct()
// Retrieve Default Settings
$this->template->site_name = Kohana::config('settings.site_name');
$this->template->mapstraction = Kohana::config('settings.mapstraction');
$this->template->api_url = Kohana::config('settings.api_url');
$this->themes->api_url = Kohana::config('settings.api_url');

// Javascript Header
$this->template->map_enabled = FALSE;
$this->template->datepicker_enabled = FALSE;
$this->template->flot_enabled = FALSE;
$this->template->treeview_enabled = FALSE;
$this->template->protochart_enabled = FALSE;
$this->template->colorpicker_enabled = FALSE;
$this->template->editor_enabled = FALSE;
$this->template->tablerowsort_enabled = FALSE;
$this->template->json2_enabled = FALSE;
$this->template->js = '';
$this->themes->map_enabled = FALSE;
$this->themes->datepicker_enabled = FALSE;
$this->themes->flot_enabled = FALSE;
$this->themes->treeview_enabled = FALSE;
$this->themes->protochart_enabled = FALSE;
$this->themes->colorpicker_enabled = FALSE;
$this->themes->editor_enabled = FALSE;
$this->themes->tablerowsort_enabled = FALSE;
$this->themes->json2_enabled = FALSE;
$this->themes->hovertip_enabled = TRUE;
$this->themes->slider_enabled = TRUE;
$this->themes->js = '';
$this->template->form_error = FALSE;

// Initialize some variables for raphael impact charts
$this->template->raphael_enabled = FALSE;
$this->template->impact_json = '';
$this->themes->raphael_enabled = FALSE;
$this->themes->impact_json = '';

// Generate main tab navigation list.
$this->template->main_tabs = admin::main_tabs();
Expand All @@ -152,12 +155,10 @@ public function __construct()
$this->template->header_nav->loggedin_role = $this->user->dashboard();
$this->template->header_nav->site_name = Kohana::config('settings.site_name');

// Header and Footer Blocks
$this->template->header_block = $this->themes->admin_header_block();
$this->template->footer_block = $this->themes->footer_block();

// Language switcher
$this->template->languages = $this->themes->languages();

Event::add('ushahidi_filter.view_pre_render.admin_layout', array($this, '_pre_render'));
}

public function index()
Expand Down Expand Up @@ -220,6 +221,18 @@ private function _new_or_not($release_version=NULL, $version_ushahidi=NULL)

return TRUE;
}

/**
* Trigger themes->admin_requirements() at the last minute
*
* This is in case features are enabled/disabled
*/
public function _pre_render()
{
$this->themes->requirements();
$this->template->header_block = $this->themes->header_block();
$this->template->footer_block = $this->themes->footer_block();
}


} // End Admin
Expand Down
2 changes: 1 addition & 1 deletion application/controllers/admin/addons/plugins.php
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ public function index()
$this->template->content->status = $status;

// Javascript Header
$this->template->js = new View('admin/addons/addons_js');
$this->themes->js = new View('admin/addons/addons_js');
}

}
2 changes: 1 addition & 1 deletion application/controllers/admin/checkins.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ function index()
$this->template->content->total_items = $pagination->total_items;

// Javascript Header
$this->template->js = new View('admin/checkins/checkins_js');
$this->themes->js = new View('admin/checkins/checkins_js');
}

}
2 changes: 1 addition & 1 deletion application/controllers/admin/comments.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ function index($page = 1)
$this->template->content->status = $status;

// Javascript Header
$this->template->js = new View('admin/comments/comments_js');
$this->themes->js = new View('admin/comments/comments_js');
}

}
4 changes: 2 additions & 2 deletions application/controllers/admin/dashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ public function index()
->find_all();

// Javascript Header
$this->template->protochart_enabled = TRUE;
$this->template->js = new View('admin/stats/stats_js');
$this->themes->protochart_enabled = TRUE;
$this->themes->js = new View('admin/stats/stats_js');

$this->template->content->failure = '';

Expand Down
22 changes: 11 additions & 11 deletions application/controllers/admin/manage.php
Original file line number Diff line number Diff line change
Expand Up @@ -351,13 +351,13 @@ public function index()
$this->template->content->parents_array = $parents_array;

// Javascript Header
$this->template->colorpicker_enabled = TRUE;
$this->template->tablerowsort_enabled = TRUE;
$this->template->js = new View('admin/manage/categories/categories_js');
$this->themes->colorpicker_enabled = TRUE;
$this->themes->tablerowsort_enabled = TRUE;
$this->themes->js = new View('admin/manage/categories/categories_js');
$this->template->form_error = $form_error;

$this->template->content->locale_array = $locales;
$this->template->js->locale_array = $locales;
$this->themes->js->locale_array = $locales;
}

/**
Expand Down Expand Up @@ -530,8 +530,8 @@ public function pages()
$this->template->content->errors = $errors;

// Javascript Header
$this->template->editor_enabled = TRUE;
$this->template->js = new View('admin/manage/pages/pages_js');
$this->themes->editor_enabled = TRUE;
$this->themes->js = new View('admin/manage/pages/pages_js');
}


Expand Down Expand Up @@ -634,8 +634,8 @@ public function feeds()
$this->template->content->errors = $errors;

// Javascript Header
$this->template->colorpicker_enabled = TRUE;
$this->template->js = new View('admin/manage/feeds/feeds_js');
$this->themes->colorpicker_enabled = TRUE;
$this->themes->js = new View('admin/manage/feeds/feeds_js');
}

/**
Expand Down Expand Up @@ -702,7 +702,7 @@ public function feeds_items()
$this->template->content->total_items = $pagination->total_items;

// Javascript Header
$this->template->js = new View('admin/manage/feeds/items_js');
$this->themes->js = new View('admin/manage/feeds/items_js');
}

/**
Expand Down Expand Up @@ -913,8 +913,8 @@ public function layers()
$this->template->content->layers = $layers;

// Javascript Header
$this->template->colorpicker_enabled = TRUE;
$this->template->js = new View('admin/manage/layers/layers_js');
$this->themes->colorpicker_enabled = TRUE;
$this->themes->js = new View('admin/manage/layers/layers_js');
}

/**
Expand Down
20 changes: 10 additions & 10 deletions application/controllers/admin/manage/actions.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,18 @@ function index()
$this->template->content = new View('admin/manage/actions/main');
$this->template->content->title = Kohana::lang('ui_admin.actions');

$this->template->map_enabled = TRUE;
$this->template->treeview_enabled = TRUE;
$this->themes->map_enabled = TRUE;
$this->themes->treeview_enabled = TRUE;

$this->template->js = new View('admin/manage/actions/actions_js');
$this->template->js->default_map = Kohana::config('settings.default_map');
$this->template->js->default_zoom = Kohana::config('settings.default_zoom');
$this->template->js->latitude = Kohana::config('settings.default_lat');
$this->template->js->longitude = Kohana::config('settings.default_lon');
$this->themes->js = new View('admin/manage/actions/actions_js');
$this->themes->js->default_map = Kohana::config('settings.default_map');
$this->themes->js->default_zoom = Kohana::config('settings.default_zoom');
$this->themes->js->latitude = Kohana::config('settings.default_lat');
$this->themes->js->longitude = Kohana::config('settings.default_lon');

// TODO: Figure out what to do with this
$this->template->js->incident_zoom = array();
$this->template->js->geometries = array();
$this->themes->js->incident_zoom = array();
$this->themes->js->geometries = array();

$trigger_options = $this->_trigger_options();
$response_options = $this->_response_options();
Expand Down Expand Up @@ -265,7 +265,7 @@ function index()
$this->template->content->errors = $errors;

// Enable date picker
$this->template->datepicker_enabled = TRUE;
$this->themes->datepicker_enabled = TRUE;
}

function changestate(){
Expand Down
2 changes: 1 addition & 1 deletion application/controllers/admin/manage/alerts.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,6 @@ public function index()
$this->template->content->keyword = $keyword;

// Javascript Header
$this->template->js = new View('admin/manage/alerts/alerts_js');
$this->themes->js = new View('admin/manage/alerts/alerts_js');
}
}
2 changes: 1 addition & 1 deletion application/controllers/admin/manage/badges.php
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,6 @@ function index()
$this->template->content->users = $users;

// Javascript Header
$this->template->js = new View('admin/manage/badges/badges_js');
$this->themes->js = new View('admin/manage/badges/badges_js');
}
}
4 changes: 2 additions & 2 deletions application/controllers/admin/manage/blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ function index()
$this->template->content->sorted_blocks = $sorted_blocks;

// Javascript Header
$this->template->tablerowsort_enabled = TRUE;
$this->template->js = new View('admin/manage/blocks/blocks_js');
$this->themes->tablerowsort_enabled = TRUE;
$this->themes->js = new View('admin/manage/blocks/blocks_js');
}

public function sort()
Expand Down
4 changes: 2 additions & 2 deletions application/controllers/admin/manage/forms.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,8 @@ public function index()
$this->template->content->errors = $errors;

// Javascript Header
$this->template->js = new View('admin/manage/forms/forms_js');
$this->template->js->form_id = $form_id;
$this->themes->js = new View('admin/manage/forms/forms_js');
$this->themes->js->form_id = $form_id;
$this->template->form_error = $form_error;
}

Expand Down
2 changes: 1 addition & 1 deletion application/controllers/admin/manage/scheduler.php
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ function index()
$this->template->content->errors = $errors;

// Javascript Header
$this->template->js = new View('admin/manage/scheduler/scheduler_js');
$this->themes->js = new View('admin/manage/scheduler/scheduler_js');
}


Expand Down
2 changes: 1 addition & 1 deletion application/controllers/admin/messages.php
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ public function index($service_id = 1)
$this->template->content->level = $level;

// Javascript Header
$this->template->js = new View('admin/messages/messages_js');
$this->themes->js = new View('admin/messages/messages_js');
}

/**
Expand Down
14 changes: 7 additions & 7 deletions application/controllers/admin/messages/reporters.php
Original file line number Diff line number Diff line change
Expand Up @@ -216,12 +216,12 @@ public function index($service_id = 1)
$this->template->content->service_array = Service_Model::get_array();

// Javascript Header
$this->template->map_enabled = TRUE;
$this->template->js = new View('admin/reporters/reporters_js');
$this->template->js->default_map = Kohana::config('settings.default_map');
$this->template->js->default_zoom = Kohana::config('settings.default_zoom');
$this->template->js->latitude = Kohana::config('settings.default_lat');
$this->template->js->longitude = Kohana::config('settings.default_lon');
$this->template->js->form_error = $form_error;
$this->themes->map_enabled = TRUE;
$this->themes->js = new View('admin/reporters/reporters_js');
$this->themes->js->default_map = Kohana::config('settings.default_map');
$this->themes->js->default_zoom = Kohana::config('settings.default_zoom');
$this->themes->js->latitude = Kohana::config('settings.default_lat');
$this->themes->js->longitude = Kohana::config('settings.default_lon');
$this->themes->js->form_error = $form_error;
}
}
Loading