inverse toggle effects + add missing redirect_url field + fix an anoying bug about the locomotive_media plugin

This commit is contained in:
did 2011-11-20 01:27:23 +01:00
parent a6211d594e
commit c267f8ccbc
6 changed files with 36 additions and 16 deletions

View File

@ -24,13 +24,15 @@ class Locomotive.Views.ContentAssets.PickerView extends Locomotive.Views.Shared.
success: (model) => @collection.add(model)
error: (msg) => @shake()
add_asset: (asset) ->
add_asset: (asset, first) ->
view = new Locomotive.Views.ContentAssets.PickerItemView model: asset, parent: @
(@_item_views ||= []).push(view)
@$('ul.list .clear').before(view.render().el)
@_refresh() & @_move_to_last_asset()
@_refresh()
@_move_to_last_asset() unless first == true
remove_asset: (asset) ->
view = _.find @_item_views, (tmp) -> tmp.model == asset

View File

@ -110,6 +110,10 @@ class Locomotive.Views.Pages.FormView extends Locomotive.Views.Shared.FormView
enable_redirect_checkbox: ->
@_enable_checkbox 'redirect',
features: ['templatized', 'cache_strategy']
on_callback: =>
@$('li#page_redirect_url_input').show()
off_callback: =>
@$('li#page_redirect_url_input').hide()
enable_other_checkboxes: ->
_.each ['published', 'listed'], (exp) =>

View File

@ -48,7 +48,7 @@ class Locomotive.Views.Shared.AssetPickerView extends Backbone.View
@build_uploader(el, link)
actions.find('.upload-button-wrapper').hover(
actions.find('.button-wrapper').hover(
=> link.addClass('hover'),
=> link.removeClass('hover')
)
@ -69,14 +69,15 @@ class Locomotive.Views.Shared.AssetPickerView extends Backbone.View
$(@el).dialog('option', 'position', 'center')
add_assets: (collection) ->
collection.each @add_asset
collection.each (asset) =>
@add_asset(asset, true)
@_refresh()
setTimeout (=> @create_dialog()), 30 # disable flickering
add_asset: (asset) ->
# please overide add_asset
add_asset: (asset, first) ->
# please overide add_asset (the 'first' param is to know if it comes from the first collection fetch)
remove_asset: (asset) ->
# please overide remove_asset

View File

@ -1,7 +1,20 @@
BOARD:
- namespace assets
-
x namespace assets
- bugs:
x toggler
x advanced options (redirect url missing)
x locomotive_media (not animating on open)
- editable_elements => view + mustache template
- editable_short_text => tinymce
- editable_image => new formtastic inputs
- create/edit page in ajax
- fix other pages
- content types
- edit my account
- create a new site
- edit my site
- theme assets
BACKLOG:

View File

@ -57,7 +57,7 @@
// if it's set to on
if(checked){
$(element).animate({marginLeft: '15px'}, 100,
$(element).animate({marginLeft: '0px'}, 100,
// callback function
function(){
@ -75,7 +75,7 @@
}else{
$(element).animate({marginLeft: '0px'}, 100,
$(element).animate({marginLeft: '15px'}, 100,
// callback function
function(){
@ -104,9 +104,9 @@
// insert the new toggle markup
if($(this).attr("checked") == "checked" || $(this).attr("checked") == true){
$(this).after('<div class="toggleSwitch"><span class="leftLabel">'+settings.on_label+'<\/span><div class="switchArea on" style="background-color: '+settings.on_bg_color+'"><span class="switchHandle left" style="margin-left: 0em;"><\/span><\/div><span class="rightLabel" style="color:#cccccc">'+settings.off_label+'<\/span><\/div>');
$(this).after('<div class="toggleSwitch"><span class="leftLabel">'+settings.on_label+'<\/span><div class="switchArea on" style="background-color: '+settings.on_bg_color+'"><span class="switchHandle left" style="margin-left: 15px;"><\/span><\/div><span class="rightLabel" style="color:#cccccc">'+settings.off_label+'<\/span><\/div>');
}else{
$(this).after('<div class="toggleSwitch"><span class="leftLabel" style="color:#cccccc;">'+settings.on_label+'<\/span><div class="switchArea" style="background-color: '+settings.off_bg_color+'"><span class="switchHandle right" style="margin-left:15px"><\/span><\/div><span class="rightLabel">'+settings.off_label+'<\/span><\/div>');
$(this).after('<div class="toggleSwitch"><span class="leftLabel" style="color:#cccccc;">'+settings.on_label+'<\/span><div class="switchArea" style="background-color: '+settings.off_bg_color+'"><span class="switchHandle right" style="margin-left:0px"><\/span><\/div><span class="rightLabel">'+settings.off_label+'<\/span><\/div>');
}
// Bind the switchHandle click events to the internal toggle function

View File

@ -22,14 +22,14 @@
height: 12px;
cursor: pointer;
border: 1px solid #1971af;
border: 1px solid #a3a3a3;
@include border-radius(3px);
@include background-image(linear-gradient(#218bd9, #2abbf2));
@include background-image(linear-gradient(top, #d2d1d1, #eeeeee 20%, #f1f1f1 25%, #f1f1f1));
@include box-shadow(rgba(255, 255, 255, 0.8) 0px 1px 0px 0px);
&.on {
border-color: #a3a3a3;
@include background-image(linear-gradient(top, #d2d1d1, #eeeeee 20%, #f1f1f1 25%, #f1f1f1));
border-color: #1971af;
@include background-image(linear-gradient(#218bd9, #2abbf2));
}
}