Skip to content

Commit

Permalink
Added campaign index long view using view factory.
Browse files Browse the repository at this point in the history
  • Loading branch information
steveyken committed Nov 23, 2012
1 parent 8d3616f commit 42b8e1e
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 25 deletions.
24 changes: 1 addition & 23 deletions app/views/campaigns/_campaign.html.haml
Original file line number Diff line number Diff line change
@@ -1,27 +1,5 @@
- if (params['controller'] == 'campaigns') and (template = template_for_current_view).present?
= render(template, :campaign => campaign)
- else

-# default view
%li.highlight[campaign]
.strip{:class => campaign.status}= t(campaign.status)

%ul.tools
- if can?(:update, campaign)
%li= link_to_edit(campaign)

- if can?(:destroy, campaign)
%li= link_to_delete(campaign)

.indent
= link_to(campaign.name, campaign)
= render "campaigns/status", :campaign => campaign

- unless current_user.preference[:campaigns_outline] == "brief"
= render "campaigns/metrics", :campaign => campaign
- if campaign.tag_list.present?
%dt
.tags= tags_for_index(campaign)

= hook(:campaign_bottom, self, :campaign => campaign)
= render 'campaigns/index_brief', :campaign => campaign
15 changes: 15 additions & 0 deletions app/views/campaigns/_index_brief.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
%li.highlight[campaign]
.strip{:class => campaign.status}= t(campaign.status)

%ul.tools
- if can?(:update, campaign)
%li= link_to_edit(campaign)

- if can?(:destroy, campaign)
%li= link_to_delete(campaign)

.indent
= link_to(campaign.name, campaign)
= render "campaigns/status", :campaign => campaign

= hook(:campaign_bottom, self, :campaign => campaign)
20 changes: 20 additions & 0 deletions app/views/campaigns/_index_long.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
%li.highlight[campaign]
.strip{:class => campaign.status}= t(campaign.status)

%ul.tools
- if can?(:update, campaign)
%li= link_to_edit(campaign)

- if can?(:destroy, campaign)
%li= link_to_delete(campaign)

.indent
= link_to(campaign.name, campaign)
= render "campaigns/status", :campaign => campaign

= render "campaigns/metrics", :campaign => campaign
- if campaign.tag_list.present?
%dt
.tags= tags_for_index(campaign)

= hook(:campaign_bottom, self, :campaign => campaign)
6 changes: 4 additions & 2 deletions config/initializers/views.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@
{:name => 'leads_show_normal', :title => 'Normal format', :icon => 'long.png',
:controllers => ['leads'], :actions => ['show'], :template => nil}, # default show view

{:name => 'campaigns_index_normal', :title => 'Normal format', :icon => 'long.png',
:controllers => ['campaigns'], :actions => ['index'], :template => nil}, # default
{:name => 'campaigns_index_brief', :title => 'Brief format', :icon => 'brief.png',
:controllers => ['campaigns'], :actions => ['index'], :template => 'campaigns/index_brief'}, # default
{:name => 'campaigns_index_long', :title => 'Long format', :icon => 'long.png',
:controllers => ['campaigns'], :actions => ['index'], :template => 'campaigns/index_long'},
{:name => 'campaigns_show_normal', :title => 'Normal format', :icon => 'long.png',
:controllers => ['campaigns'], :actions => ['show'], :template => nil}, # default show view

Expand Down

0 comments on commit 42b8e1e

Please sign in to comment.