Commit a3f7b47957e500c98066380c32874320b96185c3
1 parent
a5bb8fc7
Exists in
master
and in
28 other branches
ActionItem18: customizing comatose
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@383 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
5 changed files
with
21 additions
and
16 deletions
Show diff stats
app/controllers/application.rb
@@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
2 | # available in all controllers. | 2 | # available in all controllers. |
3 | class ApplicationController < ActionController::Base | 3 | class ApplicationController < ActionController::Base |
4 | 4 | ||
5 | -# helper :all | 5 | + helper :document |
6 | 6 | ||
7 | design :holder => 'virtual_community' | 7 | design :holder => 'virtual_community' |
8 | 8 |
app/helpers/document_helper.rb
1 | module DocumentHelper | 1 | module DocumentHelper |
2 | 2 | ||
3 | + # displays an icon corresponding to the document passed in +doc+. | ||
4 | + # | ||
5 | + # The class of the document can define its icon by providing an +icon+ | ||
6 | + # method (i.e. +doc.class.icon+ will be called) | ||
3 | def icon_for_document(doc) | 7 | def icon_for_document(doc) |
4 | - design_display_icon(doc.class.icon) | 8 | + icon = |
9 | + case doc | ||
10 | + when Comatose::Page | ||
11 | + 'text-x-generic' | ||
12 | + else | ||
13 | + if doc.class.respond_to?(:icon) | ||
14 | + doc.class.icon | ||
15 | + else | ||
16 | + 'none' | ||
17 | + end | ||
18 | + end | ||
19 | + design_display_icon(icon) | ||
5 | end | 20 | end |
6 | 21 | ||
7 | end | 22 | end |
app/views/comatose_admin/_page_list_item.rhtml
@@ -23,24 +23,21 @@ collapse_children = (level >= Comatose.config.default_tree_level) | @@ -23,24 +23,21 @@ collapse_children = (level >= Comatose.config.default_tree_level) | ||
23 | <li id="page_<%= page.id %>"> | 23 | <li id="page_<%= page.id %>"> |
24 | <table cellpadding="0" cellspacing="0"> | 24 | <table cellpadding="0" cellspacing="0"> |
25 | <tr> | 25 | <tr> |
26 | - <td rowspan="2" valign="center"> | 26 | + <td valign="center"> |
27 | <% if !page.children.empty? %> | 27 | <% if !page.children.empty? %> |
28 | <%= image_tag( ((collapse_children) ? 'comatose/collapsed.gif' : 'comatose/expanded.gif'), :title=>'Expand/Collapse', :onclick=>"ComatoseList.toggle_tree_nodes(this,#{page.id});", :class=>'tree-controller', :size=>'12x12', :id=>"page_controller_#{page.id}" ) %> | 28 | <%= image_tag( ((collapse_children) ? 'comatose/collapsed.gif' : 'comatose/expanded.gif'), :title=>'Expand/Collapse', :onclick=>"ComatoseList.toggle_tree_nodes(this,#{page.id});", :class=>'tree-controller', :size=>'12x12', :id=>"page_controller_#{page.id}" ) %> |
29 | <% else %> | 29 | <% else %> |
30 | <%= image_tag 'comatose/no-children.gif', :size=>'12x12', :class=>'tree-controller' %> | 30 | <%= image_tag 'comatose/no-children.gif', :size=>'12x12', :class=>'tree-controller' %> |
31 | <% end %> | 31 | <% end %> |
32 | </td> | 32 | </td> |
33 | - <td rowspan="2" valign="center"> | ||
34 | - <%= image_tag 'comatose/page.gif', :size=>'25x31', :align=>"absmiddle" %> | 33 | + <td valign="center"> |
34 | + <%= icon_for_document(page) %> | ||
35 | <span class="handle">DRAG</span> | 35 | <span class="handle">DRAG</span> |
36 | </td> | 36 | </td> |
37 | <td> | 37 | <td> |
38 | <%= link_to page.title, {:action=>'edit', :id=>page}, :title=>"Path:#{page.full_path}", :class=>'page' %> | 38 | <%= link_to page.title, {:action=>'edit', :id=>page}, :title=>"Path:#{page.full_path}", :class=>'page' %> |
39 | </td> | 39 | </td> |
40 | - </tr> | ||
41 | - <tr> | ||
42 | <td class="commands"> | 40 | <td class="commands"> |
43 | - Updated <span title="Created on <%= page.created_on %>"><%= time_ago_in_words page.updated_on, true %> ago</span><%= " by #{page.author}" unless page.author.nil? or page.author.empty? %>, | ||
44 | <%= links.join(', ') %>. | 41 | <%= links.join(', ') %>. |
45 | </td> | 42 | </td> |
46 | </tr> | 43 | </tr> |
config/environment.rb
@@ -80,4 +80,4 @@ Comatose::AdminController.before_filter do |controller| | @@ -80,4 +80,4 @@ Comatose::AdminController.before_filter do |controller| | ||
80 | end | 80 | end |
81 | controller.instance_variable_set('@virtual_community', virtual_community) | 81 | controller.instance_variable_set('@virtual_community', virtual_community) |
82 | end | 82 | end |
83 | -#require 'comatose_extensions' | 83 | + |