make Locomotive compliant with Heroku + better names for generator + comment console.log in some js preventing js actions

This commit is contained in:
dinedine 2010-06-12 03:13:58 +02:00
parent 1d5786638b
commit 339d791e7d
16 changed files with 67 additions and 32 deletions

View File

@ -17,7 +17,7 @@ begin
gem.authors = ['Didier Lafforgue'] gem.authors = ['Didier Lafforgue']
gem.email = ['didier@nocoffee.fr'] gem.email = ['didier@nocoffee.fr']
gem.date = Date.today gem.date = Date.today
gem.description = "a brand new CMS system with super sexy UI and cool features" gem.description = "a brand new CMS system with super sexy UI and cool features (alpha version for now)"
gem.homepage = %q{http://github.com/did/locomotive} gem.homepage = %q{http://github.com/did/locomotive}
gem.files = Dir[ gem.files = Dir[
"Gemfile", "Gemfile",

View File

@ -1 +1 @@
0.0.1.4 0.0.2.3

View File

@ -4,7 +4,7 @@ module Admin
include Locomotive::Routing::SiteDispatcher include Locomotive::Routing::SiteDispatcher
layout 'admin/application' layout 'admin/application'
before_filter :authenticate_admin! before_filter :authenticate_admin!
before_filter :require_site before_filter :require_site
@ -15,6 +15,11 @@ module Admin
helper_method :sections helper_method :sections
# https://rails.lighthouseapp.com/projects/8994/tickets/1905-apphelpers-within-plugin-not-being-mixed-in
Dir[File.dirname(__FILE__) + "/../../helpers/**/*_helper.rb"].each do |file|
helper "admin/#{File.basename(file, '.rb').gsub(/_helper$/, '')}"
end
protected protected
def flash_success!(options = {}) def flash_success!(options = {})

View File

@ -6,6 +6,8 @@ module Admin
layout 'admin/login' layout 'admin/login'
before_filter :require_site before_filter :require_site
helper 'admin/base', 'admin/login'
end end
end end

View File

@ -6,6 +6,8 @@ module Admin
layout 'admin/login' layout 'admin/login'
before_filter :require_site before_filter :require_site
helper 'admin/base', 'admin/login'
protected protected

View File

@ -7,7 +7,7 @@ module Admin::BaseHelper
@content_for_title = title @content_for_title = title
'' ''
end end
end end
def admin_menu_item(name, url) def admin_menu_item(name, url)
label = content_tag(:em) + escape_once(' ') + t("admin.shared.menu.#{name}") label = content_tag(:em) + escape_once(' ') + t("admin.shared.menu.#{name}")

View File

@ -8,11 +8,11 @@ module Admin::SitesHelper
def main_site_url(site = current_site, options = {}) def main_site_url(site = current_site, options = {})
url = "http://#{site.subdomain}.#{Locomotive.config.default_domain}" url = "http://#{site.subdomain}.#{Locomotive.config.default_domain}"
url += ":#{request.port}" if request.port != 80 url += ":#{request.port}" if request.port != 80
url = File.join(url, controller.request.fullpath) if options.has_key?(:uri) && options[:uri] url = File.join(url, controller.request.fullpath) if options.has_key?(:uri) && options[:uri]
url url
end end
def error_on_domain(site, name) def error_on_domain(site, name)
if (error = (site.errors[:domains] || []).detect { |n| n.include?(name) }) if (error = (site.errors[:domains] || []).detect { |n| n.include?(name) })
content_tag(:span, error, :class => 'inline-errors') content_tag(:span, error, :class => 'inline-errors')

View File

@ -8,9 +8,9 @@
/ [if IE] / [if IE]
= stylesheet_link_tag 'admin/blueprint/ie', :media => 'screen' = stylesheet_link_tag 'admin/blueprint/ie', :media => 'screen'
= stylesheet_link_tag 'admin/layout', 'admin/plugins/toggle', 'admin/menu', 'admin/buttons', 'admin/formtastic', 'admin/formtastic_changes', 'admin/application', :media => 'screen', :cache => Rails.env.production? = stylesheet_link_tag 'admin/layout', 'admin/plugins/toggle', 'admin/menu', 'admin/buttons', 'admin/formtastic', 'admin/formtastic_changes', 'admin/application', :media => 'screen'
= javascript_include_tag 'admin/jquery', 'admin/jquery.ui', 'admin/rails', 'admin/utils', 'admin/plugins/toggle', 'admin/plugins/growl', 'admin/plugins/cookie', 'admin/application', :cache => Rails.env.production? = javascript_include_tag 'admin/jquery', 'admin/jquery.ui', 'admin/rails', 'admin/utils', 'admin/plugins/toggle', 'admin/plugins/growl', 'admin/plugins/cookie', 'admin/application'
%script{ :type => 'text/javascript' } %script{ :type => 'text/javascript' }
= find_and_preserve(growl_message) = find_and_preserve(growl_message)

View File

@ -1,6 +1,10 @@
BOARD: BOARD:
- deploy on Heroku - deploy on Heroku
- observers to add / remove domains
- truncate nom dans le menu de contents
x comment console.log
- missing translation for the edit categories popup
BACKLOG: BACKLOG:
@ -12,6 +16,7 @@ BACKLOG:
- theme assets: disable version if not image - theme assets: disable version if not image
- migrate content_instance to its collection
- new custom field types - new custom field types
- file - file
- boolean - boolean

View File

@ -0,0 +1,16 @@
module Locomotive
class AssetsGenerator < Rails::Generators::Base
def self.source_root
puts "(before) source_root = #{@_locomotive_source_root}"
@_locomotive_source_root ||= File.expand_path("../../../../../", __FILE__)
puts "(after) source_root = #{@_locomotive_source_root}"
@_locomotive_source_root
end
def copy_public_files
directory "public", "public", :recursive => true
end
end
end

View File

@ -0,0 +1,13 @@
module Locomotive
class InstallGenerator < Rails::Generators::Base
def self.source_root
@_locomotive_source_root ||= File.expand_path("../templates", __FILE__)
end
def copy_initializer
template "locomotive.rb", "config/initializers/locomotive.rb"
end
end
end

View File

@ -0,0 +1,12 @@
Locomotive.configure do |config|
# if not defined, locomotive will use example.com as main domain name. Remove prefix www from your domain name.
# Ex:
# config.default_domain = Rails.env.production? ? 'mydomain.com' : 'example.com'
config.default_domain = 'mydomain.com'
# configure how many items we display in sub menu in the "Contents" section.
config.lastest_items_nb = 5
# tell if logs are enabled. Useful for debug purpose.
config.enable_logs = true
end

View File

@ -1,14 +0,0 @@
class LocomotiveGenerator < Rails::Generators::Base
class_option :update, :type => :boolean, :default => false,
:desc => "Just update public files, do not create seed"
def self.source_root
@_locomotive_source_root ||= File.dirname(__FILE__)
end
def copy_public_files
directory "../../public", "public", :recursive => true
exit(0) if options.update?
end
end

View File

@ -1,5 +1,6 @@
puts "...Locomotive engine loaded" puts "...Locomotive engine loaded"
require 'mimetype_fu'
require 'liquid' require 'liquid'
require 'devise' require 'devise'
require 'carrierwave' require 'carrierwave'
@ -7,15 +8,11 @@ require 'formtastic'
require 'mongoid' require 'mongoid'
require 'mongoid_acts_as_tree' require 'mongoid_acts_as_tree'
# FIXME: get rid of it once custom_fields is a gem
require File.dirname(__FILE__) + '/../../vendor/plugins/custom_fields/init.rb' require File.dirname(__FILE__) + '/../../vendor/plugins/custom_fields/init.rb'
module Locomotive module Locomotive
class Engine < Rails::Engine class Engine < Rails::Engine
initializer "locomotive.add_helpers" do |app|
path = [*ActionController::Base.helpers_path] << File.dirname(__FILE__) + "/../../app/helpers"
ActionController::Base.helpers_path = path
end
end end
end end

View File

@ -21,7 +21,7 @@ $(document).ready(function() {
href: link.attr('data-url'), href: link.attr('data-url'),
padding: 0, padding: 0,
onComplete: function() { SetupCustomFieldCategoryEditor(link.prev()); }, onComplete: function() { SetupCustomFieldCategoryEditor(link.prev()); },
onCleanup: function() { console.log('closing...'); } onCleanup: function() { }
}) })
}); });
}); });

View File

@ -56,7 +56,6 @@ var SetupCustomFieldCategoryEditor = function(target) {
/* ___ submit ___ */ /* ___ submit ___ */
var updateSelectOptions = function(list) { var updateSelectOptions = function(list) {
console.log('updateSelectOptions [begin]');
var options = ''; var options = '';
var selectedValue = target.val(); var selectedValue = target.val();
for (var i = 0; i < list.length; i++) { for (var i = 0; i < list.length; i++) {
@ -64,7 +63,6 @@ var SetupCustomFieldCategoryEditor = function(target) {
} }
target.html(options); target.html(options);
target.val(selectedValue); target.val(selectedValue);
console.log('updateSelectOptions [end]');
}; };
$('#edit-custom-field-category .popup-actions button').click(function(e) { $('#edit-custom-field-category .popup-actions button').click(function(e) {
@ -76,7 +74,6 @@ var SetupCustomFieldCategoryEditor = function(target) {
data: form.serialize(), data: form.serialize(),
url: form.attr('action'), url: form.attr('action'),
success: function(data) { success: function(data) {
console.log("success");
if (data.error == null) { if (data.error == null) {
list = data.category_items.sort(function(a, b) { return (a.position - b.position); }); list = data.category_items.sort(function(a, b) { return (a.position - b.position); });
updateSelectOptions(list); updateSelectOptions(list);