trying to fix the big problem with jQuery UI modals (if modals have the same z-index, it causes weird behaviours) (WIP)

This commit is contained in:
Didier Lafforgue 2012-05-29 01:26:51 +02:00
parent ae16661286
commit b751e3d990
9 changed files with 20 additions and 11 deletions

View File

@ -36,7 +36,7 @@ PATH
haml (~> 3.1.4)
highline (~> 1.6.2)
httparty (~> 0.8.1)
jquery-rails (~> 1.0.16)
jquery-rails (~> 1.0.19)
kaminari (~> 0.13.0)
locomotive-aloha-rails (~> 0.20.1.4)
locomotive-mongoid-tree (~> 0.6.2)

View File

@ -70,10 +70,10 @@ class Locomotive.Views.ContentEntries.FormView extends Locomotive.Views.Shared.F
enable_has_many_fields: ->
unless @model.isNew()
_.each @model.get('has_many_custom_fields'), (field) =>
_.each @model.get('has_many_custom_fields'), (field, index) =>
name = field[0]; inverse_of = field[1]
new_entry = new Locomotive.Models.ContentEntry(@options["#{name}_new_entry"])
view = new Locomotive.Views.Shared.Fields.HasManyView model: @model, name: name, new_entry: new_entry, inverse_of: inverse_of
view = new Locomotive.Views.Shared.Fields.HasManyView model: @model, name: name, new_entry: new_entry, inverse_of: inverse_of, index: index
if view.ui_enabled()
@_has_many_field_views.push(view)

View File

@ -23,10 +23,13 @@ class Locomotive.Views.ContentEntries.PopupFormView extends Locomotive.Views.Con
@close()
create_dialog: ->
# FIXME (Did): each modal window should have a different zIndex, otherwise there will be conflicts
zIndex = 998 + @options.index
@dialog = $(@el).dialog
autoOpen: false
modal: true
zIndex: 998
zIndex: zIndex
width: 770,
create: (event, ui) =>
$('.ui-widget-overlay').bind 'click', => @close()
@ -71,6 +74,9 @@ class Locomotive.Views.ContentEntries.PopupFormView extends Locomotive.Views.Con
else
@refresh()
slugify_label_field: ->
# disabled in a popup form
enable_has_many_fields: ->
# disabled in a popup form

View File

@ -30,8 +30,9 @@ class Locomotive.Views.Shared.AssetPickerView extends Backbone.View
create_dialog: ->
@dialog = $(@el).dialog
autoOpen: false
modal: true
zIndex: 998
zIndex: 996
width: 650,
create: (event, ui) =>
$('.ui-widget-overlay').bind 'click', => @close()

View File

@ -70,6 +70,7 @@ class Locomotive.Views.Shared.Fields.HasManyView extends Backbone.View
el: $("##{@options.name}-template-entry")
parent_view: @
model: @options.new_entry.clone() # by default, it does not matter
index: @options.index
@target_entry_view.render()

View File

@ -60,7 +60,7 @@
.ui-dialog-content {
position: relative;
z-index: 999;
z-index: 1040;
text-align: left;

View File

@ -3,7 +3,7 @@ module Locomotive
class PagesController < BaseController
def index
@pages = current_site.pages.order([:depth, :asc], [:position, :asc])
@pages = current_site.pages.order_by([[:depth, :asc], [:position, :asc]])
respond_with(@pages)
end

View File

@ -11,9 +11,9 @@
= link_to t('locomotive.buttons.close'), '#', :id => 'close-link'
.button-wrapper.upload
= form_tag theme_assets_url(:json), :class => 'quick-upload' do
= file_field_tag 'theme_asset[source]', :multiple => 'multiple'
= link_to t('locomotive.theme_assets.image_picker.upload'), theme_assets_url(:json), :class => 'new', :id => 'upload-link'
= form_tag content_assets_url(:json), :class => 'quick-upload' do
= file_field_tag 'content_asset[source]', :multiple => 'multiple'
= link_to t('locomotive.content_assets.image_picker.upload'), content_assets_url(:json), :class => 'new', :id => 'upload-link'
%script{ :type => 'text/html', :id => 'content_asset' }

View File

@ -35,7 +35,8 @@ Gem::Specification.new do |s|
s.add_dependency 'kaminari', '~> 0.13.0'
s.add_dependency 'haml', '~> 3.1.4'
s.add_dependency 'jquery-rails', '~> 1.0.16'
# s.add_dependency 'jquery-rails', '~> 2.0.0' #'~> 1.0.16'
s.add_dependency 'jquery-rails', '~> 1.0.19'
s.add_dependency 'rails-backbone', '~> 0.6.1'
s.add_dependency 'codemirror-rails', '~> 2.21'
s.add_dependency 'locomotive-tinymce-rails', '~> 3.4.7.2'