From 9be87e8e15b0cca93b076a35b0a8ae971f4bc414 Mon Sep 17 00:00:00 2001 From: Jocelyn Fiat Date: Thu, 14 Feb 2013 13:11:34 +0100 Subject: [PATCH] Now also display sublinks if link is expanded. Updated theme --- draft/application/cms/src/theme/cms_theme.e | 47 +++++++-- .../cms/www/themes/default/res/ewfcms.js | 91 ++++++++++++++++++ .../www/themes/default/res/menu-collapsed.png | Bin 0 -> 108 bytes .../www/themes/default/res/menu-expanded.png | Bin 0 -> 106 bytes .../cms/www/themes/default/res/style.css | 85 +++++++++++++--- 5 files changed, 203 insertions(+), 20 deletions(-) create mode 100644 draft/application/cms/www/themes/default/res/ewfcms.js create mode 100644 draft/application/cms/www/themes/default/res/menu-collapsed.png create mode 100644 draft/application/cms/www/themes/default/res/menu-expanded.png diff --git a/draft/application/cms/src/theme/cms_theme.e b/draft/application/cms/src/theme/cms_theme.e index 81d9d4e2..5942c413 100644 --- a/draft/application/cms/src/theme/cms_theme.e +++ b/draft/application/cms/src/theme/cms_theme.e @@ -35,7 +35,7 @@ feature -- Conversion menu_html (a_menu: CMS_MENU; is_horizontal: BOOLEAN): STRING_8 do - create Result.make_from_string ("
") + create Result.make_from_string ("
") if is_horizontal then Result.append ("
    %N") else @@ -44,12 +44,7 @@ feature -- Conversion across a_menu as c loop - if c.item.is_active then - Result.append ("
  • ") - else - Result.append ("
  • ") - end - Result.append ("" + html_encoded (c.item.title) + "
  • ") + append_cms_link_to (c.item, Result) end Result.append ("
%N") Result.append ("
") @@ -59,4 +54,42 @@ feature -- Conversion deferred end +feature {NONE} -- Implementation + + append_cms_link_to (lnk: CMS_LINK; s: STRING_8) + local + cl: STRING + do + create cl.make_empty + if lnk.is_active then + cl.append ("active ") + end + if lnk.is_expandable then + cl.append ("expandable ") + end + if lnk.is_expanded then + cl.append ("expanded ") + end + if cl.is_empty then + s.append ("
  • ") + else + s.append ("
  • ") + end + s.append ("" + html_encoded (lnk.title) + "") + if + lnk.is_expanded and then + attached lnk.children as l_children + then + s.append ("
      %N") + across + l_children as c + loop + append_cms_link_to (c.item, s) + end + s.append ("
    ") + end + s.append ("
  • ") + end + + end diff --git a/draft/application/cms/www/themes/default/res/ewfcms.js b/draft/application/cms/www/themes/default/res/ewfcms.js new file mode 100644 index 00000000..d4ebbef7 --- /dev/null +++ b/draft/application/cms/www/themes/default/res/ewfcms.js @@ -0,0 +1,91 @@ +/* + * EWF CMS javascript based on JQuery + */ + +/** + * Override jQuery.fn.init to guard against XSS attacks. + * + * See http://bugs.jquery.com/ticket/9521 + */ + +(function () { + var jquery_init = jQuery.fn.init; + jQuery.fn.init = function (selector, context, rootjQuery) { + // If the string contains a "#" before a "<", treat it as invalid HTML. + if (selector && typeof selector === 'string') { + var hash_position = selector.indexOf('#'); + if (hash_position >= 0) { + var bracket_position = selector.indexOf('<'); + if (bracket_position > hash_position) { + throw 'Syntax error, unrecognized expression: ' + selector; + } + } + } + return jquery_init.call(this, selector, context, rootjQuery); + }; + jQuery.fn.init.prototype = jquery_init.prototype; +})(); + + +var EWFCMS = EWFCMS || { }; + +EWFCMS.toggleFieldset = function(fieldset) { + if ($(fieldset).is('.collapsed')) { + var content = $('> div:not(.action)', fieldset); + $(fieldset).removeClass('collapsed'); + content.hide(); + content.slideDown( { + duration: 'fast', + easing: 'linear', + complete: function() { + //Drupal.collapseScrollIntoView(this.parentNode); + this.parentNode.animating = false; + $('div.action', fieldset).show(); + }, + step: function() { + // Scroll the fieldset into view + //Drupal.collapseScrollIntoView(this.parentNode); + } + }); + } else { + var content = $('> div:not(.action)', fieldset).slideUp('fast', function() { + $(this.parentNode).addClass('collapsed'); + this.parentNode.animating = false; + }); + } + }; + +jQuery(document).ready(function(){ + //$('.collapsed').hide(); + $('fieldset.collapsible > legend').each(function() { + var fieldset = $(this.parentNode); + // turn legen into clickable link and wrap contents + var text = this.innerHTML; + $(this).empty() + .append($(''+ text + '').click(function() { + var fieldset = $(this).parents('fieldset:first')[0]; + if (!fieldset.animating) { + fieldset.animating = true; + EWFCMS.toggleFieldset(fieldset); + } + return false; + } + )) + .after($('
    ') + .append(fieldset.children(':not(legend):not(.action)'))) + .addClass('collapse-processed'); + }); + $('fieldset.collapsed').each(function() { + $(this).removeClass('collapsed'); + EWFCMS.toggleFieldset(this); + }); +}); + +jQuery(document).ready(function(){ + $('#tabs').tabs(); +}); + +//jQuery(document).ready(function(){ + //$('#second_sidebar').hide(); +//}); + diff --git a/draft/application/cms/www/themes/default/res/menu-collapsed.png b/draft/application/cms/www/themes/default/res/menu-collapsed.png new file mode 100644 index 0000000000000000000000000000000000000000..95a214a6e6d17fee2f098804997f3826ffc9d4ca GIT binary patch literal 108 zcmeAS@N?(olHy`uVBq!ia0vp^>>$j@3?%=}IXVGIu?6^qxc>kDAIJlF_r}R z1v5B2yO9Ruh>$j@3?%=}IXVGIu?6^qxc>kDAIJlF_r}R z1v5B2yO9Ru2zk0VhE&W+{&76uaKb@_0}N~oA{!VF-#vS9IZ&3t)78&qol`;+0EMF; ATL1t6 literal 0 HcmV?d00001 diff --git a/draft/application/cms/www/themes/default/res/style.css b/draft/application/cms/www/themes/default/res/style.css index 645cec4e..330b3446 100644 --- a/draft/application/cms/www/themes/default/res/style.css +++ b/draft/application/cms/www/themes/default/res/style.css @@ -70,8 +70,18 @@ div#main-wrapper { } div#main { margin: 0; padding: 0; clear: both; height:0; display: block; } +div#content { padding: 5px 3px 5px 20px; + margin-top: 10px; + min-width: 80%; + display: inline; + float: left; + position: relative; + background-color: #ffffff; + padding-bottom: 30px; +} + div#first_sidebar { - width: 20%; + width: 200px; margin: 5px; padding: 5px; display: inline; @@ -79,12 +89,13 @@ div#first_sidebar { position: relative; } div#second_sidebar { - width: 20%; + width: 100px; margin: 5px; padding: 5px; display: inline; - float: left; + float: right; position: relative; + background-color: #eee; } div.sidebar div.block { margin-bottom: 5px; @@ -101,16 +112,6 @@ div.sidebar div.block div.title { div.sidebar div.block div.inside { margin: 3px; } - -div#content { padding: 5px 3px 5px 20px; - margin-top: 10px; - width: 50%; - display: inline; - float: left; - position: relative; - background-color: #ffffff; - padding-bottom: 30px; -} div#footer { margin: 10px 0 10px 0; clear: both; display: block; text-align: center; padding: 10px; border-top: solid 1px #00f; color: #fff; background-color: #333;} div#footer a { color: #ff0; } @@ -180,3 +181,61 @@ div#message li.warning { color: #aa2200; background-color: #ffcc99; } + +div.columns { + margin-top: 10px; + display: inline-block; + clear: both; +} + +div.columns>* { + padding-left: 10px; + padding-top: 5px; + border-top: dotted 1px #999; + border-left: dotted 1px #999; + margin-left: 1px; + margin-right: 10px; + float: left; +} + +/* Link */ + +a { + text-decoration: none; +} +a:hover { + text-decoration: underline; +} + +div.menu ul.vertical { + margin: 0; + padding-left: 10px; + list-style-type: none; +} + +div.menu ul.vertical ul { + border-left: solid 3px #eee; + list-style-type: none; + margin: 0; + padding-left: 5px; + margin-left: 5px; + margin-bottom: 5px; +} + +/* Fieldset and collapsible */ + +fieldset.collapsible legend a { + padding-left: 15px; + background: url(menu-expanded.png) 5px 75% no-repeat; +} + +fieldset.collapsed legend a { + padding-left: 15px; + background: url(menu-collapsed.png) 5px 50% no-repeat; +} + +fieldset.collapsed { + border: none; + border-top: dotted 1px #000; +} +