Permalink
Browse files

Only show preview switch if states are available

We've removed all states from RedirectorPage in order to disable the redirect.
  • Loading branch information...
1 parent 80ee913 commit 76e233de705c936e8cee6990ea28469fa661ee30 @chillu chillu committed Jan 9, 2013
Showing with 22 additions and 20 deletions.
  1. +22 −20 admin/templates/Includes/LeftAndMain_SilverStripeNavigator.ss
@@ -19,25 +19,27 @@
</select>
</span>
- <% if Items.Count < 5 %>
- <fieldset id="preview-states" class="cms-preview-states switch-states size_{$Items.Count}">
- <div class="switch">
- <% loop Items %>
- <input id="$Title" data-name="$Name" class="state-name $FirstLast" data-link="$Link" name="view" type="radio" <% if First %>checked<% end_if %>>
- <label for="$Title"<% if First %> class="active"<% end_if %>><span>$Title</span></label>
- <% end_loop %>
- <span class="slide-button"></span>
- </div>
- </fieldset>
- <% else %>
- <span id="preview-state-dropdown" class="cms-preview-states field dropdown">
- <select title="<% _t('SilverStripeNavigator.PreviewState', 'Preview State') %>" id="preview-states" class="preview-state dropdown nolabel" autocomplete="off" name="preview-state">
- <% loop Items %>
- <option name="$Name" data-name="$Name" data-link="$Link" class="state-name $FirstLast" value="$Link" >
- $Title
- </option>
- <% end_loop %>
- </select>
- </span>
+ <% if Items %>
+ <% if Items.Count < 5 %>
+ <fieldset id="preview-states" class="cms-preview-states switch-states size_{$Items.Count}">
+ <div class="switch">
+ <% loop Items %>
+ <input id="$Title" data-name="$Name" class="state-name $FirstLast" data-link="$Link" name="view" type="radio" <% if First %>checked<% end_if %>>
+ <label for="$Title"<% if First %> class="active"<% end_if %>><span>$Title</span></label>
+ <% end_loop %>
+ <span class="slide-button"></span>
+ </div>
+ </fieldset>
+ <% else %>
+ <span id="preview-state-dropdown" class="cms-preview-states field dropdown">
+ <select title="<% _t('SilverStripeNavigator.PreviewState', 'Preview State') %>" id="preview-states" class="preview-state dropdown nolabel" autocomplete="off" name="preview-state">
+ <% loop Items %>
+ <option name="$Name" data-name="$Name" data-link="$Link" class="state-name $FirstLast" value="$Link" >
+ $Title
+ </option>
+ <% end_loop %>
+ </select>
+ </span>
+ <% end_if %>
<% end_if %>
</div>

0 comments on commit 76e233d

Please sign in to comment.