Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision a8814e0e

Von Sven Schöling vor etwa 12 Jahren hinzugefügt

  • ID a8814e0ef7175fef00ba18195ba2d457095b96ad
  • Vorgänger 0f69c726
  • Nachfolger 017c6569

besseres interface und delegating für layouts, inline accessoren

html menü in footer verschoben

Unterschiede anzeigen:

SL/Controller/Layout/Base.pm
5 5

  
6 6
use Rose::Object::MakeMethods::Generic (
7 7
  'scalar --get_set_init' => qw(menu),
8
  'array'                 => [
9
    'add_stylesheets_inline' => { interface => 'add', hash_key => 'stylesheets_inline' },
10
    'add_javascripts_inline' => { interface => 'add', hash_key => 'javascripts_inline' },
11
    'sub_layouts',
12
    'add_sub_layouts'         => { interface => 'add', hash_key => 'sub_layouts' },
13
  ],
8 14
);
9 15

  
10 16
use SL::Menu;
......
26 32
##########################################
27 33

  
28 34
sub pre_content {
35
  join '', map { $_->pre_content } $_[0]->sub_layouts;
29 36
}
30 37

  
31 38
sub start_content {
39
  join '', map { $_->start_content } $_[0]->sub_layouts;
32 40
}
33 41

  
34 42
sub end_content {
43
  join '', map { $_->end_content } $_[0]->sub_layouts;
35 44
}
36 45

  
37 46
sub post_content {
47
  join '', map { $_->post_content } $_[0]->sub_layouts;
38 48
}
39 49

  
40 50
sub stylesheets_inline {
51
  ( map { $_->stylesheets_inline } $_[0]->sub_layouts ),
52
  @{ $_[0]->{stylesheets_inline} || [] };
41 53
}
42 54

  
43
sub javascript_inline {
55
sub javascripts_inline {
56
  ( map { $_->javascripts_inline } $_[0]->sub_layouts ),
57
  @{ $_[0]->{javascripts_inline} || [] };
44 58
}
45 59

  
60

  
46 61
#########################################
47 62
# Interface
48 63
########################################
......
57 72
  my ($self) = @_;
58 73
  my $css_path = $self->get_stylesheet_for_user;
59 74

  
60
  return grep { $_ } map { $self->_find_stylesheet($_, $css_path)  } $self->use_stylesheet;
75
  return grep { $_ } map { $self->_find_stylesheet($_, $css_path)  }
76
    $self->use_stylesheet, map { $_->stylesheets } $self->sub_layouts;
61 77
}
62 78

  
63 79
sub _find_stylesheet {
......
89 105

  
90 106
sub use_javascript {
91 107
  my $self = shift;
92
  $::lxdebug->dump(0,  "class", \@_);
93 108
  push @{ $self->{javascripts} ||= [] }, @_ if @_;
94 109
  @{ $self->{javascripts} ||= [] };
95 110
}
......
97 112
sub javascripts {
98 113
  my ($self) = @_;
99 114

  
100
  return map { $self->_find_javascript($_)  } $self->use_javascript;
115
  return map { $self->_find_javascript($_)  }
116
    $self->use_javascript, map { $_->javascripts } $self->sub_layouts;
101 117
}
102 118

  
103 119
sub _find_javascript {

Auch abrufbar als: Unified diff