Commit 07288102640183e748656ffe3271282d2d307734
1 parent
78cfdefb
Exists in
master
and in
29 other branches
ActionItem340: there are a better article editor layout
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1720 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
3 changed files
with
66 additions
and
2 deletions
Show diff stats
app/helpers/application_helper.rb
| ... | ... | @@ -454,16 +454,36 @@ module ApplicationHelper |
| 454 | 454 | def select_categories(object_name) |
| 455 | 455 | object = instance_variable_get("@#{object_name}") |
| 456 | 456 | |
| 457 | - result = content_tag('h4', _('Categories')) | |
| 457 | + result = content_tag 'h4', _('Categories') | |
| 458 | + result << javascript_tag( 'function open_close_cat( link ) { | |
| 459 | + var div = link.parentNode.getElementsByTagName("div")[0]; | |
| 460 | + var end = function(){ | |
| 461 | + if ( div.style.display == "none" ) { | |
| 462 | + this.link.className="button icon-button icon-down" | |
| 463 | + } else { | |
| 464 | + this.link.className="button icon-button icon-up" | |
| 465 | + } | |
| 466 | + } | |
| 467 | + Effect.toggle( div, "slide", { link:link, div:div, afterFinish:end } ) | |
| 468 | + }') | |
| 458 | 469 | environment.top_level_categories.each do |toplevel| |
| 459 | 470 | toplevel.map_traversal do |cat| |
| 460 | 471 | if cat.top_level? |
| 472 | + result << '<div class="categorie_box">' | |
| 473 | + result << icon_button( :down, _('open'), '#', :onclick => 'open_close_cat(this); return false' ) | |
| 461 | 474 | result << content_tag('h5', toplevel.name) |
| 475 | + result << '<div style="display:none"><ul class="categories">' | |
| 462 | 476 | else |
| 463 | 477 | checkbox_id = "#{object_name}_#{cat.full_name.downcase.gsub(/\s+|\//, '_')}" |
| 464 | - result << content_tag('label', check_box_tag("#{object_name}[category_ids][]", cat.id, object.category_ids.include?(cat.id), :id => checkbox_id) + cat.full_name_without_leading(1), :for => checkbox_id) | |
| 478 | + result << content_tag('li', labelled_check_box( | |
| 479 | + cat.full_name_without_leading(1, " → "), | |
| 480 | + "#{object_name}[category_ids][]", cat.id, | |
| 481 | + object.category_ids.include?(cat.id), :id => checkbox_id, | |
| 482 | + :onchange => 'this.parentNode.className=(this.checked?"cat_checked":"")' ), | |
| 483 | + :class => ( object.category_ids.include?(cat.id) ? 'cat_checked' : '' ) ) + "\n" | |
| 465 | 484 | end |
| 466 | 485 | end |
| 486 | + result << '</ul></div></div>' | |
| 467 | 487 | end |
| 468 | 488 | |
| 469 | 489 | content_tag('div', result) | ... | ... |
public/designs/themes/default/stylesheets/controller_cms.css
0 → 100644
| ... | ... | @@ -0,0 +1,27 @@ |
| 1 | + | |
| 2 | +.categorie_box { | |
| 3 | + -moz-border-radius: 4px; | |
| 4 | + border: 1px solid #729FCF; | |
| 5 | + margin-bottom: 2px; | |
| 6 | + padding: 2px 0px; | |
| 7 | +} | |
| 8 | + | |
| 9 | +#content .categorie_box h5 { | |
| 10 | + margin: 0px; | |
| 11 | + padding: 0px; | |
| 12 | + line-height: 22px; | |
| 13 | +} | |
| 14 | + | |
| 15 | +#content ul.categories { | |
| 16 | + padding: 5px 4px 3px 4px; | |
| 17 | +} | |
| 18 | + | |
| 19 | +ul.categories li { | |
| 20 | + -moz-border-radius: 9px; | |
| 21 | + border-bottom: 1px solid #FFF; | |
| 22 | +} | |
| 23 | + | |
| 24 | +ul.categories li.cat_checked { | |
| 25 | + border-bottom: 1px solid #729FCF; | |
| 26 | +} | |
| 27 | + | ... | ... |
public/stylesheets/controller_cms.css
| ... | ... | @@ -42,3 +42,20 @@ |
| 42 | 42 | top: -5px; |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | +.categorie_box .button { | |
| 46 | + float: left; | |
| 47 | +} | |
| 48 | +.categorie_box h5 { | |
| 49 | + line-height: 24px; | |
| 50 | +} | |
| 51 | + | |
| 52 | +#content ul.categories, | |
| 53 | +#content ul.categories li { | |
| 54 | + margin: 0px; | |
| 55 | + padding: 1px 0px 1px 4px; | |
| 56 | + list-style: none; | |
| 57 | +} | |
| 58 | +ul.categories li.cat_checked { | |
| 59 | + background: #B8CFE7; | |
| 60 | +} | |
| 61 | + | ... | ... |