fix js bug when changing layout in page editing + improve nav tag
This commit is contained in:
parent
c4f4979203
commit
35e0120cab
2
Gemfile
2
Gemfile
@ -13,7 +13,7 @@ gem 'mongoid_acts_as_tree', '0.1.5'
|
|||||||
gem 'mongo_session_store', '2.0.0.pre'
|
gem 'mongo_session_store', '2.0.0.pre'
|
||||||
gem 'warden'
|
gem 'warden'
|
||||||
gem 'devise', '1.1.rc1'
|
gem 'devise', '1.1.rc1'
|
||||||
gem 'haml', '3.0.1'
|
gem 'haml', '3.0.13'
|
||||||
gem 'rmagick', '2.12.2'
|
gem 'rmagick', '2.12.2'
|
||||||
gem 'aws'
|
gem 'aws'
|
||||||
gem 'mimetype-fu', :require => 'mimetype_fu'
|
gem 'mimetype-fu', :require => 'mimetype_fu'
|
||||||
|
@ -3,9 +3,12 @@ module Admin
|
|||||||
|
|
||||||
layout nil
|
layout nil
|
||||||
|
|
||||||
|
respond_to :json
|
||||||
|
|
||||||
def index
|
def index
|
||||||
parts = current_site.layouts.find(params[:layout_id]).parts
|
parts = current_site.layouts.find(params[:layout_id]).parts
|
||||||
render :json => { :parts => parts }
|
|
||||||
|
respond_with parts.collect(&:attributes)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -3,7 +3,7 @@ module Admin
|
|||||||
|
|
||||||
sections 'contents'
|
sections 'contents'
|
||||||
|
|
||||||
respond_to :json, :only => [:update, :sort]
|
respond_to :json, :only => [:update, :sort, :get_path]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@pages = current_site.pages.roots
|
@pages = current_site.pages.roots
|
||||||
|
@ -34,9 +34,6 @@ class Site
|
|||||||
named_scope :match_domain, lambda { |domain| { :where => { :domains => domain } } }
|
named_scope :match_domain, lambda { |domain| { :where => { :domains => domain } } }
|
||||||
named_scope :match_domain_with_exclusion_of, lambda { |domain, site| { :where => { :domains => domain, :_id.ne => site.id } } }
|
named_scope :match_domain_with_exclusion_of, lambda { |domain, site| { :where => { :domains => domain, :_id.ne => site.id } } }
|
||||||
|
|
||||||
## behaviours ##
|
|
||||||
liquid_methods :name, :meta_keywords, :meta_description
|
|
||||||
|
|
||||||
## methods ##
|
## methods ##
|
||||||
|
|
||||||
def accounts
|
def accounts
|
||||||
|
@ -5,5 +5,5 @@ site.memberships.build :account => account, :admin => true
|
|||||||
site.save!
|
site.save!
|
||||||
|
|
||||||
puts "Your first website has been created !"
|
puts "Your first website has been created !"
|
||||||
puts "Admin url: http://test.example.com/admin"
|
puts "Admin url: http://test.example.com:3000/admin"
|
||||||
puts "Crendetials: admin@example.com / locomotive"
|
puts "Crendetials: admin@example.com / locomotive"
|
15
lib/locomotive/liquid/drops/site.rb
Normal file
15
lib/locomotive/liquid/drops/site.rb
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
module Locomotive
|
||||||
|
module Liquid
|
||||||
|
module Drops
|
||||||
|
class Site < Base
|
||||||
|
|
||||||
|
liquid_attributes << :name << :meta_keywords << :meta_description
|
||||||
|
|
||||||
|
def index
|
||||||
|
@index ||= @source.pages.index.first
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -28,8 +28,6 @@ module Locomotive
|
|||||||
path = [path, File.join(dirname, 'content_type_template').gsub(/^\//, '')]
|
path = [path, File.join(dirname, 'content_type_template').gsub(/^\//, '')]
|
||||||
end
|
end
|
||||||
|
|
||||||
# TODO: path is not correctly built + find content instance in order to render a 404 page if not found
|
|
||||||
|
|
||||||
if page = current_site.pages.any_in(:fullpath => [*path]).first
|
if page = current_site.pages.any_in(:fullpath => [*path]).first
|
||||||
if not page.published? and current_admin.nil?
|
if not page.published? and current_admin.nil?
|
||||||
page = nil
|
page = nil
|
||||||
|
@ -65,7 +65,7 @@ $(document).ready(function() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// go to the first one if we hid the selected wrapper
|
// go to the first one if we hide the selected wrapper
|
||||||
var selectedNav = $('#page-parts .nav a.on');
|
var selectedNav = $('#page-parts .nav a.on');
|
||||||
if (selectedNav.size() == 1) {
|
if (selectedNav.size() == 1) {
|
||||||
var index = parseInt(selectedNav.attr('class').match(/part-(.+)/)[1]) + 1;
|
var index = parseInt(selectedNav.attr('class').match(/part-(.+)/)[1]) + 1;
|
||||||
@ -80,7 +80,7 @@ $(document).ready(function() {
|
|||||||
return ;
|
return ;
|
||||||
|
|
||||||
var url = $('#page_layout_id').attr('data_url').replace('_id_to_replace_', $('#page_layout_id').val());
|
var url = $('#page_layout_id').attr('data_url').replace('_id_to_replace_', $('#page_layout_id').val());
|
||||||
$.get(url, '', function(data) { refreshParts(data.parts); }, 'json');
|
$.get(url, '', function(data) { refreshParts(data); }, 'json');
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#page_layout_id').change(loadPartsFromLayout);
|
$('#page_layout_id').change(loadPartsFromLayout);
|
||||||
|
Loading…
Reference in New Issue
Block a user