Commit df3abefe2af983e25900491192475f41b5cb927e

Authored by AntonioTerceiro
1 parent f6aa1bca

r251@sede: terceiro | 2007-07-29 19:54:31 -0300

ActionItem0: adapting to new design plugin
 


git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@255 3f533792-8f58-4932-b0fe-aaf55b0a4547
app/controllers/application.rb
... ... @@ -2,6 +2,8 @@
2 2 # available in all controllers.
3 3 class ApplicationController < ActionController::Base
4 4  
  5 + design :holder => 'virtual_community'
  6 +
5 7 # Be sure to include AuthenticationSystem in Application Controller instead
6 8 include AuthenticatedSystem
7 9  
... ...
app/controllers/features_controller.rb
1 1 class FeaturesController < ApplicationController
2 2  
3   - uses_flexible_template :owner => 'owner'
4 3  
  4 + # FIXME: temp test code, remove from here
  5 + design :holder => 'virtual_community'
  6 + def test
  7 + render :inline => '<%= design_display("bli") %>'
  8 + end
  9 + ################################
5 10  
6 11 acts_as_virtual_community_admin_controller
7 12  
... ...
app/controllers/home_controller.rb
1 1 class HomeController < ApplicationController
2 2  
3   - uses_flexible_template :owner => 'virtual_community'
  3 + design :holder => 'virtual_community'
4 4  
5 5 end
... ...
app/helpers/application_helper.rb
... ... @@ -77,17 +77,24 @@ module ApplicationHelper
77 77 content_tag('div', @virtual_community.name, :id => 'virtual_community_identification')
78 78 end
79 79  
  80 + def link_to_cms(text, profile = nil, options = {})
  81 + profile ||= current_user.login
  82 + link_to text, "/cms/#{profile}", options
  83 + end
  84 +
  85 + def link_to_profile(text, profile = nil, options = {})
  86 + profile ||= current_user.login
  87 + link_to text, "/#{profile}", options
  88 + end
  89 +
80 90 # TODO: add the actual links
81 91 # TODO: test this helper
82 92 def user_links
83 93 links = [
84   - [ _('My accont'), { :controller => 'account' } ],
85   - [ _('My profile'), { :controller => 'ble'} ],
86   - [ _('My groups'), { :controller => 'bli'} ],
87   - [ _('My enterprises'), { :controller => 'enterprise'}]
88   - ].map do |link|
89   - link_to link[0], link[1]
90   - end.join(' ')
  94 + [ link_to _('My accont'), { :controller => 'account' } ],
  95 + [ link_to_profile _('My home page') ],
  96 + [ link_to_cms _('Manage content') ],
  97 + ].join("\n")
91 98 content_tag('div', links, :id => 'user_links')
92 99 end
93 100  
... ...
app/models/virtual_community.rb
... ... @@ -16,6 +16,8 @@ class VirtualCommunity &lt; ActiveRecord::Base
16 16 # Relationships and applied behaviour
17 17 # #################################################
18 18  
  19 + acts_as_design
  20 +
19 21 # One VirtualCommunity can be reached by many domains
20 22 has_many :domains, :as => :owner
21 23  
... ...
app/views/layouts/application.rhtml
1 1 <html>
2 2 <head>
3 3 <%= javascript_include_tag :defaults %>
4   - <%= javascript_include_tag_for_template %>
5   - <%= stylesheet_link_tag_for_template %>
6   - <%= stylesheet_link_tag_for_theme %>
  4 + <%= design_all_header_tags %>
7 5  
8 6 </head>
9 7  
... ... @@ -27,12 +25,12 @@
27 25 <%= flash[:notice] %>
28 26 </div>
29 27 <a name='main_content'/>
30   - <%= display_boxes(yield) %>
  28 + <%= design_display(yield) %>
31 29  
32 30 <div id="footer">
33 31 <a name='footer'/>
34 32 <%= footer %>
35   - <%= display_icon('back')%>
  33 + <%= design_display_icon('back')%>
36 34 </div>
37 35 </div>
38 36 </div>
... ...
db/migrate/001_create_virtual_communities.rb
... ... @@ -4,6 +4,7 @@ class CreateVirtualCommunities &lt; ActiveRecord::Migration
4 4 t.column :name, :string
5 5 t.column :is_default, :boolean
6 6 t.column :settings, :text
  7 + t.column :design_data, :text
7 8 end
8 9 VirtualCommunity.create(:name => 'Default Virtual Community', :is_default => true)
9 10 end
... ...
db/migrate/005_add_design_support.rb
1   -class ManageTemplateMigration < ActiveRecord::Migration
  1 +class AddDesignSupport < ActiveRecord::Migration
2 2 def self.up
3 3  
4 4 create_table :design_boxes do |t|
... ...