Commit 75b413b5 by Tom Giannattasio

reworked add component steps

parent 22a61cdf
...@@ -4,7 +4,6 @@ class CMS.Views.UnitEdit extends Backbone.View ...@@ -4,7 +4,6 @@ class CMS.Views.UnitEdit extends Backbone.View
'click .new-component .cancel-button': 'closeNewComponent' 'click .new-component .cancel-button': 'closeNewComponent'
'click .new-component-templates .new-component-template a': 'saveNewComponent' 'click .new-component-templates .new-component-template a': 'saveNewComponent'
'click .new-component-templates .cancel-button': 'closeNewComponent' 'click .new-component-templates .cancel-button': 'closeNewComponent'
'click .new-component-button': 'showNewComponentForm'
'click .delete-draft': 'deleteDraft' 'click .delete-draft': 'deleteDraft'
'click .create-draft': 'createDraft' 'click .create-draft': 'createDraft'
'click .publish-draft': 'publishDraft' 'click .publish-draft': 'publishDraft'
...@@ -54,30 +53,20 @@ class CMS.Views.UnitEdit extends Backbone.View ...@@ -54,30 +53,20 @@ class CMS.Views.UnitEdit extends Backbone.View
) )
) )
# New component creation
showNewComponentForm: (event) =>
event.preventDefault()
@$newComponentItem.addClass('adding')
$(event.target).fadeOut(150)
@$newComponentItem.css('height', @$newComponentTypePicker.outerHeight())
@$newComponentTypePicker.slideDown(250)
showComponentTemplates: (event) => showComponentTemplates: (event) =>
event.preventDefault() event.preventDefault()
type = $(event.currentTarget).data('type') type = $(event.currentTarget).data('type')
@$newComponentTypePicker.fadeOut(250) @$newComponentTypePicker.slideUp(250)
@$(".new-component-#{type}").fadeIn(250) @$(".new-component-#{type}").slideDown(250)
closeNewComponent: (event) => closeNewComponent: (event) =>
event.preventDefault() event.preventDefault()
@$newComponentTypePicker.slideUp(250) @$newComponentTypePicker.slideDown(250)
@$newComponentTemplatePickers.slideUp(250) @$newComponentTemplatePickers.slideUp(250)
@$newComponentButton.fadeIn(250)
@$newComponentItem.removeClass('adding') @$newComponentItem.removeClass('adding')
@$newComponentItem.find('.rendered-component').remove() @$newComponentItem.find('.rendered-component').remove()
@$newComponentItem.css('height', @$newComponentButton.outerHeight())
saveNewComponent: (event) => saveNewComponent: (event) =>
event.preventDefault() event.preventDefault()
......
...@@ -80,33 +80,22 @@ ...@@ -80,33 +80,22 @@
border-radius: 3px 3px 0 0; border-radius: 3px 3px 0 0;
} }
.new-component-type, .new-component-template { .new-component-type {
@include clearfix; a,
li { li {
display: inline-block; display: inline-block;
} }
a { a {
position: relative;
display: inline-block;
width: 100px; width: 100px;
height: 100px; height: 100px;
margin-right: 10px; margin-right: 10px;
margin-bottom: 10px; margin-bottom: 10px;
border-radius: 8px; border-radius: 8px;
border: 1px solid $darkGreen;
background: $green;
font-size: 13px; font-size: 13px;
line-height: 14px; line-height: 14px;
color: #fff;
text-align: center; text-align: center;
@include box-shadow(0 1px 1px rgba(0, 0, 0, .4), 0 1px 0 rgba(255, 255, 255, .4) inset); @include box-shadow(0 1px 1px rgba(0, 0, 0, .2), 0 1px 0 rgba(255, 255, 255, .4) inset);
@include transition(background-color .15s);
&:hover {
background: $brightGreen;
}
.name { .name {
position: absolute; position: absolute;
...@@ -119,9 +108,43 @@ ...@@ -119,9 +108,43 @@
} }
} }
.new-component-type,
.new-component-template { .new-component-template {
@include clearfix;
a {
position: relative;
border: 1px solid $darkGreen;
background: $green;
color: #fff;
@include transition(background-color .15s);
&:hover {
background: $brightGreen;
}
}
}
.new-component-template {
margin-bottom: 20px;
li:first-child {
a {
border-radius: 3px 3px 0 0;
}
}
li:last-child {
a {
border-radius: 0 0 3px 3px;
}
}
a { a {
height: 60px; display: block;
padding: 7px 20px;
border-bottom: none;
font-weight: 300;
} }
} }
...@@ -136,14 +159,11 @@ ...@@ -136,14 +159,11 @@
.new-component-templates { .new-component-templates {
display: none; display: none;
position: absolute;
width: 100%;
padding: 20px; padding: 20px;
@include clearfix; @include clearfix;
.cancel-button { .cancel-button {
@include blue-button; @include white-button;
border-color: #30649c;
} }
} }
} }
......
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