Use the 2.0.0.rc branch for the custom_fields gem

This commit is contained in:
did 2012-01-26 02:41:31 +01:00
commit 50917a919e
21 changed files with 70 additions and 159 deletions

View File

@ -13,8 +13,8 @@ gem 'mongo', '~> 1.5.2'
gem 'bson_ext', '~> 1.5.2'
gem 'mongoid', '~> 2.4.2'
gem 'locomotive_mongoid_acts_as_tree', '~> 0.1.5.8'
gem 'custom_fields', :path => '../gems/custom_fields' # DEV
# gem 'custom_fields', :git => 'git://github.com/locomotivecms/custom_fields.git', :branch => 'experimental'
# gem 'custom_fields', :path => '../gems/custom_fields' # DEV
gem 'custom_fields', :git => 'git://github.com/locomotivecms/custom_fields.git', :branch => '2.0.0.rc'
gem 'kaminari'
gem 'haml', '~> 3.1.3'
@ -44,7 +44,6 @@ gem 'dragonfly', '~> 0.9.8'
gem 'rack-cache', '~> 1.1', :require => 'rack/cache'
gem 'mimetype-fu', '~> 0.1.2'
gem 'rubyzip'
gem 'actionmailer-with-request', '~> 0.3.0', :require => 'actionmailer_with_request'
gem 'httparty', '~> 0.8.1'
gem 'delayed_job_mongoid', '~> 1.0.8'
@ -69,6 +68,7 @@ group :test do
gem 'xpath', '~> 0.1.4'
gem 'capybara'
gem 'database_cleaner'
gem 'shoulda-matchers'
gem 'launchy'
gem 'mocha', '0.9.12' # :git => 'git://github.com/floehopper/mocha.git'

View File

@ -1,5 +1,7 @@
PATH
remote: ../gems/custom_fields
GIT
remote: git://github.com/locomotivecms/custom_fields.git
revision: 65c451abfc849dd665a556c68c8976c405e57b10
branch: 2.0.0.rc
specs:
custom_fields (2.0.0.rc2)
activesupport (~> 3.1.3)
@ -135,7 +137,7 @@ GEM
formtastic (2.0.2)
rails (~> 3.0)
fssm (0.2.8.1)
gherkin (2.7.4)
gherkin (2.7.6)
json (>= 1.4.6)
growl-glue (1.0.7)
haml (3.1.4)
@ -253,6 +255,7 @@ GEM
ffi (~> 1.0.9)
multi_json (~> 1.0.4)
rubyzip
shoulda-matchers (1.0.0)
sprockets (2.0.3)
hike (~> 1.2)
rack (~> 1.0)
@ -331,6 +334,7 @@ DEPENDENCIES
rubyzip
sanitize (~> 2.0.3)
sass-rails (~> 3.1.4)
shoulda-matchers
uglifier (~> 1.0.4)
unicorn
xpath (~> 0.1.4)

View File

@ -1,5 +1,4 @@
class Locomotive::MenuCell < Cell::Base
include ::Locomotive::Engine.routes.url_helpers
delegate :sections, :to => :parent_controller

View File

@ -27,7 +27,7 @@ module Locomotive
## named scopes ##
scope :visible, :where => { :_visible => true }
scope :latest_updated, :order_by => :updated_at.desc, :limit => Locomotive.config.ui.lastest_entries_nb
scope :latest_updated, :order_by => :updated_at.desc, :limit => Locomotive.config.ui.latest_entries_nb
## methods ##

View File

@ -43,7 +43,7 @@ module Locomotive
validates_exclusion_of :slug, :in => Locomotive.config.reserved_slugs, :if => Proc.new { |p| p.depth == 0 }
## named scopes ##
scope :latest_updated, :order_by => [[:updated_at, :desc]], :limit => Locomotive.config.ui.lastest_entries_nb
scope :latest_updated, :order_by => [[:updated_at, :desc]], :limit => Locomotive.config.ui.latest_entries_nb
scope :root, :where => { :slug => 'index', :depth => 0 }
scope :not_found, :where => { :slug => '404', :depth => 0 }
scope :published, :where => { :published => true }

View File

@ -4,7 +4,7 @@
.header
%p= link_to t('locomotive.pages.index.new'), new_page_url
.inner
%h2!= t('locomotive.pages.index.lastest_entries')
%h2!= t('locomotive.pages.index.latest_entries')
%ul
- current_site.pages.latest_updated.minimal_attributes.each do |page|
%li
@ -32,7 +32,7 @@
%p.edit= link_to t('locomotive.content_types.index.edit'), edit_content_type_url(content_type)
.inner
%h2!= t('locomotive.content_entries.index.lastest_entries')
%h2!= t('locomotive.content_entries.index.latest_entries')
%ul
- content_type.entries.latest_updated.each do |entry|
%li

View File

@ -1,82 +0,0 @@
# require File.dirname(__FILE__) + '/../../lib/locomotive.rb'
#
# Locomotive.configure do |config|
#
# # A single locomotive instance can serve one single site or many.
# # If you want to run many different websites, you will have to specify
# # your own domain name (ex: locomotivehosting.com).
# #
# # Ex:
# # config.multi_sites do |multi_sites|
# # # each new website you add will have a default entry based on a subdomain
# # # and the multi_site_domain value (ex: website_1.locomotivehosting.com).
# # multi_sites.domain = 'example.com' #'myhostingplatform.com'
# #
# # # define the reserved subdomains
# # # Ex:
# # multi_sites.reserved_subdomains = %w(www admin email blog webmail mail support help site sites)
# # end
# config.multi_sites = false
#
# # configure the hosting target for the production environment. Locomotive can be installed in:
# # - your own server
# # - Heroku (you need to create an account in this case)
# # - Bushi.do (see the bushi.do website for more explanations)
# #
# # the possible options are: server, heroku, bushido or auto (default)
# # if you select 'auto', Locomotive will look after specific ENV variables to check
# # the matching platform (Heroku and Bushido set their own ENV variables).
# #
# config.hosting = :auto
#
# # In case you host Locomotive in Heroku, the engine uses the heroku api to add / remove domains.
# # there are 2 ways of passing heroku credentials to Locomotive
# # - from ENV variables: HEROKU_LOGIN & HEROKU_PASSWORD
# # - from this file, see the example below and uncomment it if needed
# # config.heroku = {
# # :login => '<your_heroku_login>',
# # :password => '<your_heroku_password>'
# # }
#
# # Locomotive uses the DelayedJob gem for the site import module.
# # In case you want to deploy to Heroku, you will have to pay for an extra dyno.
# # If you do not mind about importing theme without DelayedJob, disable it.
# #
# # Warning: this option is not used if you deploy on bushi.do and we set automatically the value to true.
# config.delayed_job = false
#
# # configure how many items we display in sub menu in the "Contents" section.
# # config.lastest_entries = 5
#
# # default locale (for now, only en, de, fr, pt-BR and it are supported)
# config.default_locale = :en
#
# # tell if logs are enabled. Useful for debug purpose.
# config.enable_logs = true
#
# # Configure the e-mail address which will be shown in the DeviseMailer, NotificationMailer, ...etc
# # if you do not put the domain name in the email, Locomotive will take the default domain name depending
# # on your deployment target (server, Heroku, Bushido, ...etc)
# #
# # Ex:
# # config.mailer_sender = 'support'
# # # => 'support@heroku.com' (Heroku), 'support@bushi.do' (Bushido), 'support@example.com' (Dev) or 'support@<your_hosting_platform>' (Multi-sites)
# config.mailer_sender = 'support'
#
# # allow apps using the engine to add their own Liquid drops, variables and similar available
# # in Liquid templates, extending the assigns used while rendering.
# # follow the Dependency Injection pattern
# # config.context_assign_extensions = {}
#
# # Rack-cache settings, mainly used for the inline resizing image module. Default options:
# # config.rack_cache = {
# # :verbose => true,
# # :metastore => URI.encode("file:#{Rails.root}/tmp/dragonfly/cache/meta"), # URI encoded in case of spaces
# # :entitystore => URI.encode("file:#{Rails.root}/tmp/dragonfly/cache/body")
# # }
# # If you do want to disable it for good, just use the following syntax
# # config.rack_cache = false
# #
# # Note: by default, rack/cache is disabled in the Heroku platform
#
# end unless Locomotive.engine? || Rails.env.test?

View File

@ -93,7 +93,7 @@ de:
help: "Seiten sind als Baum organisiert. Du kannst die Seiten also wie Ordner sortieren und verschachteln."
no_items: "Momentan gibt es keine Seiten. Klicke einfach <a href='%{url}'>hier</a>, um die erste Seite zu erstellen."
new: neue Seite
lastest_entries: Neueste Seiten
latest_entries: Neueste Seiten
new:
title: Neue Seite
help: "Fülle das folgende Formular aus, um eine neue Seite zu erstellen. Nur zur Info: Die Seite wird nicht standardmäßig publiziert!"
@ -214,7 +214,7 @@ de:
help: "Der Name der Buchung kann durch darauf klicken bearbeitet werden."
new: neue Buchung
no_items: "Momentan gibt es keine Buchungen. Klicke einfach <a href='%{url}'>hier</a>, um eine neue Buchung zu erstellen."
lastest_entries: Letzte Buchungen
latest_entries: Letzte Buchungen
updated_at: bearbeitet am
new:
title: Neue Buchung
@ -252,7 +252,7 @@ de:
download: Elemente herunterladen
new: neues Element
category_noname: "Kein Name"
lastest_entries: "Neueste Elemente"
latest_entries: "Neueste Elemente"
updated_at: "Aktualisiert am"
list:
no_entries: "Momentan gibt es keine Elemente. Klicke einfach <a href='%{url}'>hier</a>, um das erste Element zu erstellen."

View File

@ -112,7 +112,7 @@ en:
help: "Pages are organized as a tree. You can order pages as well as folders"
no_items: "There are no pages for now. Just click <a href=\"%{url}\">here</a> to create the first one."
new: new page
lastest_entries: Lastest pages
latest_entries: Latest pages
new:
title: New page
help: "Please fill in the below form to create your page. Be careful, by default, the page is not published."
@ -251,7 +251,7 @@ en:
download: download entries
new: new entry
category_noname: "No name"
lastest_entries: "Lastest entries"
latest_entries: "Latest entries"
updated_at: "Updated at"
list:
no_items: "There are no entries for now. Just click <a href=\"%{url}\">here</a> to create the first one."

View File

@ -91,7 +91,7 @@ es:
no_items: "No se ha creado ninguna página aún. Pulse <a href=\"%{url}\">aquí</a> to para crear la primera."
new: Nueva página
lastest_entries: Últimas páginas
latest_entries: Últimas páginas
new:
title: Nueva página
help: "Por favor rellene el formulario de más abajo para crear su página. ¡Atención! Las páginas, por defecto, están 'no publicadas'."
@ -236,7 +236,7 @@ es:
download: descargar elementos
new: nuevo elemento
category_noname: "Sin nombre"
lastest_entries: "Últimos elementos"
latest_entries: "Últimos elementos"
updated_at: "Última actualización"
list:
no_entries: "No hay ningún elemento. Haga click <a href=\"%{url}\">aquí</a> para crear el primero."

View File

@ -104,7 +104,7 @@ fr:
help: "Les pages sont organisées sous forme d'un arbre. Vous pouvez classes les pages ainsi que les dossiers."
no_items: "Il n'existe pas de page. Vous pouvez commencer par créer une <a href='%{url}'>ici</a>."
new: nouvelle page
lastest_entries: Dernières pages
latest_entries: Dernières pages
new:
title: Nouvelle page
help: "Remplissez le formulaire ci-dessous pour créer votre page. Attention, par défaut, la page n'est pas publiée."
@ -241,7 +241,7 @@ fr:
download: télécharger éléments
new: nouvel élément
category_noname: "Pas de nom"
lastest_entries: "Eléments récents"
latest_entries: "Eléments récents"
updated_at: "Mis à jour le"
list:
no_entries: "Il n'existe pas d'éléments. Vous pouvez commencer par créer un <a href='%{url}'>ici</a>"

View File

@ -91,7 +91,7 @@ it:
help: "Le pagine sono organizzate ad albero. Puoi ordinarle come se fossero delle cartelle"
no_items: "Per ora non ci sono pagine. Clicca <a href=\"%{url}\">qui</a> per creare la prima pagina."
new: nuova pagina
lastest_entries: Ultime pagine
latest_entries: Ultime pagine
new:
title: Nuova pagina
help: "Prego, compila il seguente modulo per creare la tua pagina. Fai attenzione, per default, la pagina non è pubblicata."
@ -235,7 +235,7 @@ it:
download: scarica elementi
new: nuovo elemento
category_noname: "Senza nome"
lastest_entries: "Ultimi elementi"
latest_entries: "Ultimi elementi"
updated_at: "modificato il"
list:
no_entries: "Per ora non ci sono elementi. Clicca <a href=\"%{url}\">qui</a> per creare il primo."

View File

@ -84,7 +84,7 @@ nl:
help: "Pagina's zijn georganiseerd als een boom. U kunt zowel pagina's als mappen ordenen"
no_items: "Er zijn momenteel geen pagina's. Klik <a href=\"%{url}\">hier</a> om de eerste pagina te maken."
new: Nieuwe pagina
lastest_entries: Laatste pagina's
latest_entries: Laatste pagina's
new:
title: Nieuwe pagina
help: "Voer onderstaande formulier in om uw pagina te maken. Opgelet, de pagina is niet gepubliseerd"
@ -220,7 +220,7 @@ nl:
download: download items
new: nieuw item
category_noname: "Geen naam"
lastest_entries: "Laatste items"
latest_entries: "Laatste items"
updated_at: "Gewijzigd op"
list:
no_entries: "Er zijn momenteel geen items. Klik hier <a href=\"%{url}\">here</a> om de eerste te maken."

View File

@ -93,7 +93,7 @@
help: "Sidene er organisert i en trestruktur. Du kan sortere både sider og mapper."
no_items: "Det har ikke blitt opprettet noen sider ennå. Klikk <a href=\"%{url}\">her</a> for lage den første."
new: ny side
lastest_entries: Siste sider
latest_entries: Siste sider
new:
title: Ny side
help: "Fyll ut skjemaet nedenfor for å opprette en ny side. Publisering er skrudd av som standard."
@ -237,7 +237,7 @@
download: last ned elementer
new: nytt element
category_noname: "Navn mangler"
lastest_entries: "Siste elementer"
latest_entries: "Siste elementer"
updated_at: "Sist oppdatert"
list:
no_entries: "Det har ikke blitt opprettet noen elementer her ennå. Klikk <a href=\"%{url}\">her</a> for å opprette det første."

View File

@ -82,7 +82,7 @@ pt-BR:
help: "As páginas são organizadas como uma árvore. Você pode reordenar as páginas como se fossem pastas"
no_items: "Não existe nenhuma página ainda. Clique <a href=\"%{url}\">aqui</a> para criar a primeira."
new: nova página
lastest_entries: Últmas páginas
latest_entries: Últmas páginas
new:
title: Nova página
help: "Por favor, preencha o formulário a seguir para criar sua página. Atenção: Por padrão a página não é publicada."
@ -215,7 +215,7 @@ pt-BR:
download: download dos itens
new: novo item
category_noname: "Sem nome"
lastest_entries: "Últimos itens"
latest_entries: "Últimos itens"
updated_at: "Atualizado em"
list:
no_entries: "Não existem itens ainda. Clique <a href=\"%{url}\">aqui</a> para criar o primeiro."

View File

@ -93,7 +93,7 @@ ru:
help: "Страницы организованы в виде дерева. Вы можете сортировать как страницы, так и папки"
no_items: "There are no pages for now. Just click <a href=\"%{url}\">here</a> to create the first one."
new: новая страница
lastest_entries: Страницы за последнее время
latest_entries: Страницы за последнее время
new:
title: Новая страница
help: "Заполните форму, приведенную ниже, для создания страницы. Будьте осторожны, по умолчанию, страница не опубликована."
@ -236,7 +236,7 @@ ru:
download: скачать элементы
new: новый элемент
category_noname: "Без имени"
lastest_entries: "Элементы за последнее время"
latest_entries: "Элементы за последнее время"
updated_at: "Обновлено"
list:
no_entries: "На данный момент нет ни одного элемента. Нажмите <a href=\"%{url}\">здесь</a> для создания первого элемента."

View File

@ -45,7 +45,7 @@ Locomotive.configure do |config|
# configure how many items we display in sub menu in the "Contents" section.
# config.ui = {
# :lastest_entries_nb => 5,
# :latest_entries_nb => 5,
# :max_content_types => 4
# }

View File

@ -18,7 +18,7 @@ module Locomotive
:manage_subdomain => false,
:manage_manage_domains => false,
:ui => {
:lastest_entries_nb => 5,
:latest_entries_nb => 5,
:max_content_types => 2
},
:rack_cache => {

View File

@ -29,22 +29,22 @@ namespace :locomotive do
end
end
# desc 'Import a remote template described by its URL -- 2 options: SITE=name or id, RESET=by default false'
# task :import => :environment do
# url, site_name_or_id, reset = ENV['URL'], ENV['SITE'], Boolean.set(ENV['RESET']) || false
#
# if url.blank? || (url =~ /https?:\/\//).nil?
# raise "URL is missing or it is not a valid http url."
# end
#
# site = Locomotive::Site.find(site_name_or_id) || Locomotive::Site.where(:name => site_name_or_id).first || Locomotive::Site.first
#
# if site.nil?
# raise "No site found. Please give a correct value (name or id) for the SITE env variable."
# end
#
# ::Locomotive::Import::Job.run!(url, site, { :samples => true, :reset => reset })
# end
desc 'Import a remote template described by its URL -- 2 options: SITE=name or id, RESET=by default false'
task :import => :environment do
url, site_name_or_id, samples, reset = ENV['URL'], ENV['SITE'], (Boolean.set(ENV['SAMPLES']) || false), (Boolean.set(ENV['RESET']) || false)
if url.blank? || (url =~ /https?:\/\//).nil?
raise "URL is missing or it is not a valid http url."
end
site = Locomotive::Site.find(site_name_or_id) || Locomotive::Site.where(:name => site_name_or_id).first || Locomotive::Site.first
if site.nil?
raise "No site found. Please give a correct value (name or id) for the SITE env variable."
end
::Locomotive::Import::Job.run!(url, site, { :samples => samples, :reset => reset })
end
desc 'Add a new admin user (NOTE: currently only supports adding user to first site)'
task :add_admin => :environment do
@ -104,15 +104,10 @@ namespace :locomotive do
end
site.save!
puts "======="
# TODO https://github.com/mongodb/mongo-ruby-driver
Locomotive::Page.skip_callback(:validate, :before)
Locomotive::Page.skip_callback(:save, :after)
Locomotive::Page.all.each do |page|
begin
%w(title slug fullpath raw_template seo_title meta_keywords meta_description serialized_template template_dependencies snippet_dependencies).each do |attribute|
if !page.send(:"#{attribute}_translations").respond_to?(:keys)
page.changed_attributes.store attribute, page.attributes[attribute]
@ -120,11 +115,6 @@ namespace :locomotive do
end
end
page.save(:validate => false)
rescue Exception => e
puts "Error: #{e.message}, page = #{page.title}"
puts e.backtrace
raise "STOP a first error"
end
end
end

View File

@ -24,7 +24,7 @@ Gem::Specification.new do |s|
s.add_dependency 'mongo', '~> 1.5.2'
s.add_dependency 'bson_ext', '~> 1.5.2'
s.add_dependency 'mongoid', '~> 2.4.0'
s.add_dependency 'mongoid', '~> 2.4.2'
s.add_dependency 'locomotive_mongoid_acts_as_tree', '0.1.5.8'
s.add_dependency 'custom_fields', '~> 2.0.0.rc1'
@ -46,7 +46,7 @@ Gem::Specification.new do |s|
s.add_dependency 'locomotive_liquid', '2.2.2'
s.add_dependency 'formtastic', '~> 2.0.2'
s.add_dependency 'responders', '~> 0.6.4'
s.add_dependency 'cells', '~> 3.7.1'
s.add_dependency 'cells', '~> 3.8.0'
s.add_dependency 'RedCloth', '~> 4.2.8'
s.add_dependency 'sanitize', '~> 2.0.3'
s.add_dependency 'highline', '~> 1.6.2'

View File

@ -1,20 +1,20 @@
require 'spec_helper'
describe Locomotive::Account do
let!(:existing_account) { Factory(:account, :email => 'another@email.com') }
it 'should have a valid factory' do
FactoryGirl.build(:account).should be_valid
end
## Validations ##
%w{name email password}.each do |attr|
it "should validate presence of #{attr}" do
account = FactoryGirl.build(:account, attr.to_sym => nil)
account.should_not be_valid
account.errors[attr.to_sym].should include("can't be blank")
end
end
it { should validate_presence_of :name }
it { should validate_presence_of :email }
it { should validate_presence_of :password }
it { should validate_uniqueness_of(:email).with_message(/is already taken/) }
it { should allow_value('valid@email.com').for(:email) }
it { should allow_value('prefix+suffix@email.com').for(:email) }
it { should_not allow_value('not-an-email').for(:email) }
it "should have a default locale" do
account = Locomotive::Account.new