Commit bd5d5f14 by Calen Pennington

Make location view state update as the state changes on the unit page

parent 81b6d757
...@@ -22,6 +22,11 @@ class CMS.Views.UnitEdit extends Backbone.View ...@@ -22,6 +22,11 @@ class CMS.Views.UnitEdit extends Backbone.View
model: @model model: @model
) )
@locationView = new CMS.Views.UnitEdit.LocationState(
el: @$('.section-item.editing a')
model: @model
)
@model.on('change:state', @render) @model.on('change:state', @render)
@$newComponentItem = @$('.new-component-item') @$newComponentItem = @$('.new-component-item')
...@@ -150,6 +155,13 @@ class CMS.Views.UnitEdit extends Backbone.View ...@@ -150,6 +155,13 @@ class CMS.Views.UnitEdit extends Backbone.View
@model.set('state', @$('#visibility').val()) @model.set('state', @$('#visibility').val())
) )
class CMS.Views.UnitEdit.LocationState extends Backbone.View
initialize: =>
@model.on('change:state', @render)
render: =>
@$el.toggleClass("#{@model.previous('state')}-item #{@model.get('state')}-item")
class CMS.Views.UnitEdit.Visibility extends Backbone.View class CMS.Views.UnitEdit.Visibility extends Backbone.View
initialize: => initialize: =>
@model.on('change:state', @render) @model.on('change:state', @render)
......
...@@ -173,13 +173,33 @@ ...@@ -173,13 +173,33 @@
background: #fffcf1; background: #fffcf1;
} }
.draft-item, .draft-item:after,
.hidden-item, .public-item:after,
.private-item:after {
margin-left: 3px;
font-size: 9px;
font-weight: 600;
text-transform: uppercase;
}
.draft-item:after {
content: "- draft";
}
.public-item:after {
content: "- public";
}
.private-item:after {
content: "- private";
}
.public-item,
.private-item { .private-item {
color: #a4aab7; color: #a4aab7;
} }
.has-new-draft-item { .draft-item {
color: #9f7d10; color: #9f7d10;
} }
} }
......
...@@ -117,9 +117,8 @@ ...@@ -117,9 +117,8 @@
} }
.draft-tag, .draft-tag,
.hidden-tag, .public-tag,
.private-tag, .private-tag {
.has-new-draft-tag {
margin-left: 3px; margin-left: 3px;
font-size: 9px; font-size: 9px;
font-weight: 600; font-weight: 600;
...@@ -127,7 +126,7 @@ ...@@ -127,7 +126,7 @@
color: #a4aab7; color: #a4aab7;
} }
.has-new-draft-tag { .draft-tag {
color: #9f7d10; color: #9f7d10;
} }
......
<%! from django.core.urlresolvers import reverse %> <%! from django.core.urlresolvers import reverse %>
<%! from contentstore.utils import compute_unit_state %>
<!-- <!--
This def will enumerate through a passed in subsection and list all of the units This def will enumerate through a passed in subsection and list all of the units
...@@ -8,16 +9,16 @@ This def will enumerate through a passed in subsection and list all of the units ...@@ -8,16 +9,16 @@ This def will enumerate through a passed in subsection and list all of the units
% for unit in subsection.get_children(): % for unit in subsection.get_children():
<li class="leaf unit" data-id="${unit.location}"> <li class="leaf unit" data-id="${unit.location}">
<% <%
unit_state = compute_unit_state(unit)
if unit.location == selected: if unit.location == selected:
selected_class = 'editing' selected_class = 'editing'
else: else:
selected_class = '' selected_class = ''
%> %>
<div class="section-item ${selected_class}"> <div class="section-item ${selected_class}">
<a href="${reverse('edit_unit', args=[unit.location])}" class="private-item"> <a href="${reverse('edit_unit', args=[unit.location])}" class="${unit_state}-item">
<span class="${unit.category}-icon"></span> <span class="${unit.category}-icon"></span>
${unit.display_name} ${unit.display_name}
<span class="private-tag wip">- private</span>
</a> </a>
% if actions: % if actions:
<div class="item-actions"> <div class="item-actions">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment