diff --git a/Rakefile b/Rakefile index 73aef5a6..2c517441 100644 --- a/Rakefile +++ b/Rakefile @@ -17,7 +17,7 @@ begin gem.authors = ['Didier Lafforgue'] gem.email = ['didier@nocoffee.fr'] 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.files = Dir[ "Gemfile", diff --git a/VERSION b/VERSION index 6acbf68f..62cd6db1 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.0.1.4 \ No newline at end of file +0.0.2.3 \ No newline at end of file diff --git a/app/controllers/admin/base_controller.rb b/app/controllers/admin/base_controller.rb index 6153525f..0ba24f67 100644 --- a/app/controllers/admin/base_controller.rb +++ b/app/controllers/admin/base_controller.rb @@ -4,7 +4,7 @@ module Admin include Locomotive::Routing::SiteDispatcher layout 'admin/application' - + before_filter :authenticate_admin! before_filter :require_site @@ -15,6 +15,11 @@ module Admin 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 def flash_success!(options = {}) diff --git a/app/controllers/admin/passwords_controller.rb b/app/controllers/admin/passwords_controller.rb index 4858e63d..03e2348d 100644 --- a/app/controllers/admin/passwords_controller.rb +++ b/app/controllers/admin/passwords_controller.rb @@ -6,6 +6,8 @@ module Admin layout 'admin/login' before_filter :require_site + + helper 'admin/base', 'admin/login' end end \ No newline at end of file diff --git a/app/controllers/admin/sessions_controller.rb b/app/controllers/admin/sessions_controller.rb index c08056c1..79911a96 100644 --- a/app/controllers/admin/sessions_controller.rb +++ b/app/controllers/admin/sessions_controller.rb @@ -6,6 +6,8 @@ module Admin layout 'admin/login' before_filter :require_site + + helper 'admin/base', 'admin/login' protected diff --git a/app/helpers/admin/base_helper.rb b/app/helpers/admin/base_helper.rb index 410d80f9..54fa7579 100644 --- a/app/helpers/admin/base_helper.rb +++ b/app/helpers/admin/base_helper.rb @@ -7,7 +7,7 @@ module Admin::BaseHelper @content_for_title = title '' end - end + end def admin_menu_item(name, url) label = content_tag(:em) + escape_once(' ') + t("admin.shared.menu.#{name}") diff --git a/app/helpers/admin/sites_helper.rb b/app/helpers/admin/sites_helper.rb index 193efd9f..4369768e 100644 --- a/app/helpers/admin/sites_helper.rb +++ b/app/helpers/admin/sites_helper.rb @@ -8,11 +8,11 @@ module Admin::SitesHelper def main_site_url(site = current_site, options = {}) 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 end - + def error_on_domain(site, name) if (error = (site.errors[:domains] || []).detect { |n| n.include?(name) }) content_tag(:span, error, :class => 'inline-errors') diff --git a/app/views/admin/shared/_head.html.haml b/app/views/admin/shared/_head.html.haml index 2d9aa014..1bc20a26 100644 --- a/app/views/admin/shared/_head.html.haml +++ b/app/views/admin/shared/_head.html.haml @@ -8,9 +8,9 @@ / [if IE] = 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' } = find_and_preserve(growl_message) diff --git a/doc/TODO b/doc/TODO index fd7dd1ea..059a8acd 100644 --- a/doc/TODO +++ b/doc/TODO @@ -1,6 +1,10 @@ BOARD: - + - 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: @@ -12,6 +16,7 @@ BACKLOG: - theme assets: disable version if not image +- migrate content_instance to its collection - new custom field types - file - boolean diff --git a/lib/generators/locomotive/assets/assets_generator.rb b/lib/generators/locomotive/assets/assets_generator.rb new file mode 100644 index 00000000..b3edd1c3 --- /dev/null +++ b/lib/generators/locomotive/assets/assets_generator.rb @@ -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 \ No newline at end of file diff --git a/lib/generators/locomotive/install/install_generator.rb b/lib/generators/locomotive/install/install_generator.rb new file mode 100644 index 00000000..c1132a36 --- /dev/null +++ b/lib/generators/locomotive/install/install_generator.rb @@ -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 \ No newline at end of file diff --git a/lib/generators/locomotive/install/templates/locomotive.rb b/lib/generators/locomotive/install/templates/locomotive.rb new file mode 100644 index 00000000..683b26e8 --- /dev/null +++ b/lib/generators/locomotive/install/templates/locomotive.rb @@ -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 \ No newline at end of file diff --git a/lib/generators/locomotive_generator.rb b/lib/generators/locomotive_generator.rb deleted file mode 100644 index 365bc15a..00000000 --- a/lib/generators/locomotive_generator.rb +++ /dev/null @@ -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 \ No newline at end of file diff --git a/lib/locomotive/engine.rb b/lib/locomotive/engine.rb index bb378a5a..18469880 100644 --- a/lib/locomotive/engine.rb +++ b/lib/locomotive/engine.rb @@ -1,5 +1,6 @@ puts "...Locomotive engine loaded" +require 'mimetype_fu' require 'liquid' require 'devise' require 'carrierwave' @@ -7,15 +8,11 @@ require 'formtastic' require 'mongoid' 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' module Locomotive 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 \ No newline at end of file diff --git a/public/javascripts/admin/contents.js b/public/javascripts/admin/contents.js index a192c274..2c9b2867 100644 --- a/public/javascripts/admin/contents.js +++ b/public/javascripts/admin/contents.js @@ -21,7 +21,7 @@ $(document).ready(function() { href: link.attr('data-url'), padding: 0, onComplete: function() { SetupCustomFieldCategoryEditor(link.prev()); }, - onCleanup: function() { console.log('closing...'); } + onCleanup: function() { } }) }); }); \ No newline at end of file diff --git a/public/javascripts/admin/custom_fields/category.js b/public/javascripts/admin/custom_fields/category.js index 50420328..e122d2f4 100644 --- a/public/javascripts/admin/custom_fields/category.js +++ b/public/javascripts/admin/custom_fields/category.js @@ -56,7 +56,6 @@ var SetupCustomFieldCategoryEditor = function(target) { /* ___ submit ___ */ var updateSelectOptions = function(list) { - console.log('updateSelectOptions [begin]'); var options = ''; var selectedValue = target.val(); for (var i = 0; i < list.length; i++) { @@ -64,7 +63,6 @@ var SetupCustomFieldCategoryEditor = function(target) { } target.html(options); target.val(selectedValue); - console.log('updateSelectOptions [end]'); }; $('#edit-custom-field-category .popup-actions button').click(function(e) { @@ -76,7 +74,6 @@ var SetupCustomFieldCategoryEditor = function(target) { data: form.serialize(), url: form.attr('action'), success: function(data) { - console.log("success"); if (data.error == null) { list = data.category_items.sort(function(a, b) { return (a.position - b.position); }); updateSelectOptions(list);