locomotivecms_wagon 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/Gemfile +1 -0
- data/README.md +11 -23
- data/lib/locomotive/wagon/liquid/drops/site.rb +1 -1
- data/lib/locomotive/wagon/liquid/filters/translate.rb +1 -1
- data/lib/locomotive/wagon/misc/dragonfly.rb +0 -1
- data/lib/locomotive/wagon/server.rb +3 -4
- data/lib/locomotive/wagon/server/entry_submission.rb +5 -1
- data/lib/locomotive/wagon/server/middleware.rb +3 -1
- data/lib/locomotive/wagon/version.rb +1 -1
- data/locales/en.yml +1 -1
- data/locomotivecms_wagon.gemspec +2 -3
- data/spec/fixtures/default/README +0 -0
- data/spec/fixtures/default/app/content_types/bands.yml +19 -0
- data/spec/fixtures/default/app/content_types/events.yml +19 -0
- data/spec/fixtures/default/app/content_types/messages.yml +17 -0
- data/spec/fixtures/default/app/content_types/songs.yml +25 -0
- data/spec/fixtures/default/app/content_types/updates.yml +33 -0
- data/spec/fixtures/default/app/views/pages/404.liquid.haml +10 -0
- data/spec/fixtures/default/app/views/pages/about_us.fr.liquid.haml +7 -0
- data/spec/fixtures/default/app/views/pages/about_us.liquid.haml +20 -0
- data/spec/fixtures/default/app/views/pages/about_us.nb.liquid.haml +4 -0
- data/spec/fixtures/default/app/views/pages/about_us/jane_doe.liquid.haml +4 -0
- data/spec/fixtures/default/app/views/pages/about_us/john_doe.fr.liquid.haml +5 -0
- data/spec/fixtures/default/app/views/pages/about_us/john_doe.liquid.haml +4 -0
- data/spec/fixtures/default/app/views/pages/all.liquid.haml +13 -0
- data/spec/fixtures/default/app/views/pages/archives/news.liquid.haml +7 -0
- data/spec/fixtures/default/app/views/pages/contact.liquid.haml +54 -0
- data/spec/fixtures/default/app/views/pages/events.liquid.haml +29 -0
- data/spec/fixtures/default/app/views/pages/index.fr.liquid.haml +3 -0
- data/spec/fixtures/default/app/views/pages/index.liquid.haml +96 -0
- data/spec/fixtures/default/app/views/pages/music.liquid.haml +28 -0
- data/spec/fixtures/default/app/views/pages/songs/template.liquid.haml +13 -0
- data/spec/fixtures/default/app/views/pages/store.fr.liquid.haml +5 -0
- data/spec/fixtures/default/app/views/pages/store.liquid +5 -0
- data/spec/fixtures/default/app/views/snippets/header.liquid.haml +1 -0
- data/spec/fixtures/default/app/views/snippets/song.fr.liquid.haml +8 -0
- data/spec/fixtures/default/app/views/snippets/song.liquid +12 -0
- data/spec/fixtures/default/config/deploy.yml +12 -0
- data/spec/fixtures/default/config/deploy_example.yml +12 -0
- data/spec/fixtures/default/config/site.yml +15 -0
- data/spec/fixtures/default/config/translations.yml +3 -0
- data/spec/fixtures/default/data/bands.yml +10 -0
- data/spec/fixtures/default/data/events.yml +49 -0
- data/spec/fixtures/default/data/songs.yml +46 -0
- data/spec/fixtures/default/data/updates.yml +48 -0
- data/spec/fixtures/default/public/fonts/chunkfive-webfont.eot +0 -0
- data/spec/fixtures/default/public/fonts/chunkfive-webfont.svg +213 -0
- data/spec/fixtures/default/public/fonts/chunkfive-webfont.ttf +0 -0
- data/spec/fixtures/default/public/fonts/chunkfive-webfont.woff +0 -0
- data/spec/fixtures/default/public/fonts/chunkfive.css +8 -0
- data/spec/fixtures/default/public/fonts/chunkfive.otf +0 -0
- data/spec/fixtures/default/public/images/nav_on.png +0 -0
- data/spec/fixtures/default/public/images/photo_frame.png +0 -0
- data/spec/fixtures/default/public/images/sep.png +0 -0
- data/spec/fixtures/default/public/images/top.jpg +0 -0
- data/spec/fixtures/default/public/javascripts/application.js.coffee +2 -0
- data/spec/fixtures/default/public/javascripts/common.js +1 -0
- data/spec/fixtures/default/public/samples/asset_collections/cover.jpg +0 -0
- data/spec/fixtures/default/public/samples/photo.jpg +0 -0
- data/spec/fixtures/default/public/samples/photo_2.jpg +0 -0
- data/spec/fixtures/default/public/stylesheets/application.css +64 -0
- data/spec/fixtures/default/public/stylesheets/other/extra.css.less +8 -0
- data/spec/fixtures/default/public/stylesheets/other/style.css.scss +13 -0
- data/spec/fixtures/default/public/stylesheets/reboot.css +82 -0
- data/spec/integration/cassettes/push.yml +4 -4
- data/spec/integration/server/basic_spec.rb +53 -0
- data/spec/integration/server/contact_form_spec.rb +111 -0
- data/spec/spec_helper.rb +1 -0
- data/spec/support/helpers.rb +14 -0
- data/spec/support/matchers.rb +5 -0
- metadata +120 -26
- data/spec/integration/server_spec.rb +0 -38
data/.gitignore
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
# LocomotiveCMS::Wagon
|
2
2
|
|
3
|
-
|
3
|
+
Wagon is the officiel site generator for the LocomotiveCMS engine powered by all the efficient and modern HTML development tools (Haml, SASS, Compass, Less).
|
4
4
|
|
5
|
-
|
5
|
+
## Documentation
|
6
6
|
|
7
|
-
|
7
|
+
Please, visit the documentation website of LocomotiveCMS.
|
8
8
|
|
9
|
-
|
10
|
-
|
9
|
+
[http://doc.locomotivecms.com](http://doc.locomotivecms.com)
|
10
|
+
|
11
|
+
## Developers / Contributors
|
11
12
|
|
12
13
|
### Get the development of the mounter
|
13
14
|
|
@@ -19,7 +20,6 @@ Also, please, keep in mind, that is nearly an alpha version so it is not stable
|
|
19
20
|
|
20
21
|
$ git clone git://github.com/locomotivecms/wagon.git
|
21
22
|
$ cd wagon
|
22
|
-
$ git checkout wip
|
23
23
|
|
24
24
|
Note: Again, if you want to contribute, you may consider to fork it instead
|
25
25
|
|
@@ -33,11 +33,11 @@ Also, please, keep in mind, that is nearly an alpha version so it is not stable
|
|
33
33
|
|
34
34
|
$ bundle exec bin/wagon server <path to the mounter gem>/spec/fixtures/default
|
35
35
|
|
36
|
-
#### Push a site
|
36
|
+
#### Push a site
|
37
37
|
|
38
38
|
$ bundle exec bin/wagon push <path to your LocomotiveCMS local site> <url of your remote LocomotiveCMS site> <email of your admin account> <password>
|
39
39
|
|
40
|
-
#### Pull a site
|
40
|
+
#### Pull a site
|
41
41
|
|
42
42
|
$ bundle exec bin/wagon pull <url of your remote LocomotiveCMS site> <email of your admin account> <password>
|
43
43
|
|
@@ -49,20 +49,8 @@ Also, please, keep in mind, that is nearly an alpha version so it is not stable
|
|
49
49
|
4. Push to the branch (`git push origin my-new-feature`)
|
50
50
|
5. Create new Pull Request
|
51
51
|
|
52
|
-
##
|
53
|
-
|
54
|
-
Add this line to your application's Gemfile:
|
55
|
-
|
56
|
-
gem 'locomotive_wagon'
|
57
|
-
|
58
|
-
And then execute:
|
59
|
-
|
60
|
-
$ bundle
|
61
|
-
|
62
|
-
Or install it yourself as:
|
63
|
-
|
64
|
-
$ gem install locomotive_wagon
|
52
|
+
## Contact
|
65
53
|
|
66
|
-
|
54
|
+
Feel free to contact me at did at locomotivecms dot com.
|
67
55
|
|
68
|
-
|
56
|
+
Copyright (c) 2013 NoCoffee, released under the MIT license
|
@@ -8,7 +8,7 @@ module Locomotive
|
|
8
8
|
translation = @context.registers[:mounting_point].translations[key.to_s]
|
9
9
|
|
10
10
|
if translation
|
11
|
-
translation.get(locale) || translation.get(Locomotive::Mounter.locale)
|
11
|
+
translation.get(locale) || translation.get(Locomotive::Mounter.locale.to_s)
|
12
12
|
else
|
13
13
|
"[unknown translation key: #{key}]"
|
14
14
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require '
|
1
|
+
require 'better_errors'
|
2
2
|
require 'coffee_script'
|
3
3
|
|
4
4
|
require 'locomotive/wagon/listen'
|
@@ -40,12 +40,11 @@ module Locomotive::Wagon
|
|
40
40
|
|
41
41
|
def create_rack_app(reader)
|
42
42
|
Rack::Builder.new do
|
43
|
-
use
|
43
|
+
use BetterErrors::Middleware
|
44
44
|
use Rack::Lint
|
45
45
|
|
46
46
|
use Rack::Session::Cookie, {
|
47
|
-
key: '
|
48
|
-
domain: '0.0.0.0',
|
47
|
+
key: 'wagon.session',
|
49
48
|
path: '/',
|
50
49
|
expire_after: 2592000,
|
51
50
|
secret: 'uselessinlocal'
|
@@ -11,6 +11,8 @@ module Locomotive::Wagon
|
|
11
11
|
if self.request.post? && env['PATH_INFO'] =~ /^\/entry_submissions\/(.*)/
|
12
12
|
self.process_form($1)
|
13
13
|
|
14
|
+
# puts "html? #{html?} / json? #{json?} / #{self.callback_url} / #{params.inspect}"
|
15
|
+
|
14
16
|
if @entry.valid?
|
15
17
|
if self.html?
|
16
18
|
self.record_submitted_entry
|
@@ -73,7 +75,9 @@ module Locomotive::Wagon
|
|
73
75
|
|
74
76
|
raise "Unknown content type '#{@content_type.inspect}'" if @content_type.nil?
|
75
77
|
|
76
|
-
|
78
|
+
attributes = self.params[:entry] || self.params[:content] || {}
|
79
|
+
|
80
|
+
@entry = @content_type.build_entry(attributes)
|
77
81
|
|
78
82
|
# if not valid, we do not need to keep track of the entry
|
79
83
|
@content_type.entries.delete(@entry) if !@entry.valid?
|
@@ -37,7 +37,9 @@ module Locomotive::Wagon
|
|
37
37
|
end
|
38
38
|
|
39
39
|
def html?
|
40
|
-
|
40
|
+
['text/html', 'application/x-www-form-urlencoded'].include?(self.request.media_type) &&
|
41
|
+
!self.request.xhr? &&
|
42
|
+
!self.json?
|
41
43
|
end
|
42
44
|
|
43
45
|
def json?
|
data/locales/en.yml
CHANGED
data/locomotivecms_wagon.gemspec
CHANGED
@@ -29,10 +29,9 @@ Gem::Specification.new do |gem|
|
|
29
29
|
|
30
30
|
gem.add_dependency 'listen', '~> 0.7.0'
|
31
31
|
|
32
|
-
gem.add_dependency '
|
33
|
-
gem.add_dependency 'httmultiparty', '~> 0.3.8'
|
32
|
+
gem.add_dependency 'httmultiparty', '0.3.8'
|
34
33
|
gem.add_dependency 'will_paginate', '~> 3.0.3'
|
35
|
-
gem.add_dependency 'locomotivecms_mounter', '1.0.
|
34
|
+
gem.add_dependency 'locomotivecms_mounter', '1.0.2'
|
36
35
|
|
37
36
|
gem.add_dependency 'faker', '~> 0.9.5'
|
38
37
|
|
File without changes
|
@@ -0,0 +1,19 @@
|
|
1
|
+
name: Bands
|
2
|
+
description: List of bands
|
3
|
+
slug: bands
|
4
|
+
order_by: name
|
5
|
+
fields:
|
6
|
+
- name:
|
7
|
+
hint: Name of the band
|
8
|
+
- leader:
|
9
|
+
type: string
|
10
|
+
label: Fullname of the leader
|
11
|
+
- kind:
|
12
|
+
type: select
|
13
|
+
label: "Music kind (grunge, rock, pop, country)"
|
14
|
+
select_options: ['grunge', 'rock', 'country']
|
15
|
+
- songs:
|
16
|
+
type: has_many
|
17
|
+
class_name: songs
|
18
|
+
inverse_of: band
|
19
|
+
ui_enabled: true
|
@@ -0,0 +1,19 @@
|
|
1
|
+
name: Events
|
2
|
+
description: List of upcoming events
|
3
|
+
slug: events
|
4
|
+
order_by: created_at
|
5
|
+
label_field_name: place
|
6
|
+
fields:
|
7
|
+
- place:
|
8
|
+
hint: Name of the place
|
9
|
+
- date:
|
10
|
+
type: date
|
11
|
+
hint: Date of the event
|
12
|
+
- city:
|
13
|
+
type: string
|
14
|
+
label: City of the event
|
15
|
+
- state:
|
16
|
+
type: string
|
17
|
+
label: State of the event
|
18
|
+
- notes:
|
19
|
+
type: text
|
@@ -0,0 +1,17 @@
|
|
1
|
+
name: Messages
|
2
|
+
description: Messages posted by new potential customers
|
3
|
+
slug: messages
|
4
|
+
label_field_name: name
|
5
|
+
public_submission_enabled: true
|
6
|
+
order_by: created_at
|
7
|
+
fields:
|
8
|
+
- name:
|
9
|
+
hint: Full name
|
10
|
+
required: true
|
11
|
+
- email:
|
12
|
+
hint: Email
|
13
|
+
required: true
|
14
|
+
- message:
|
15
|
+
hint: Customer message
|
16
|
+
type: text
|
17
|
+
required: true
|
@@ -0,0 +1,25 @@
|
|
1
|
+
name: Songs
|
2
|
+
label_field_name: title
|
3
|
+
order_by: _position
|
4
|
+
slug: songs
|
5
|
+
fields:
|
6
|
+
- title:
|
7
|
+
type: string
|
8
|
+
required: true
|
9
|
+
hint: Title of your song
|
10
|
+
- band:
|
11
|
+
label: Band
|
12
|
+
type: belongs_to
|
13
|
+
target: bands
|
14
|
+
- cover:
|
15
|
+
label: Cover
|
16
|
+
type: file
|
17
|
+
required: true
|
18
|
+
- short_description:
|
19
|
+
type: text
|
20
|
+
text_formatting: html
|
21
|
+
- audio_url:
|
22
|
+
type: string
|
23
|
+
hint: Url to a service like Blip for instance
|
24
|
+
- duration:
|
25
|
+
hint: "format like: mm:ss"
|
@@ -0,0 +1,33 @@
|
|
1
|
+
name: Updates
|
2
|
+
description: List of updates
|
3
|
+
slug: updates
|
4
|
+
order_by: date
|
5
|
+
label_field_name: title
|
6
|
+
public_submission_enabled: false
|
7
|
+
fields:
|
8
|
+
- title:
|
9
|
+
hint: Not displayed in the website
|
10
|
+
localized: true
|
11
|
+
- text:
|
12
|
+
type: text
|
13
|
+
hint: Text displayed in the home page
|
14
|
+
localized: true
|
15
|
+
text_formatting: html
|
16
|
+
- category:
|
17
|
+
type: select
|
18
|
+
hint: Pick a category
|
19
|
+
localized: true
|
20
|
+
# select_options:
|
21
|
+
# en: ['General', 'Gigs', 'Bands']
|
22
|
+
# fr: ['Général', 'Concerts', 'Groupes']
|
23
|
+
select_options:
|
24
|
+
- en: General
|
25
|
+
fr: Général
|
26
|
+
- en: Gigs
|
27
|
+
fr: Concerts
|
28
|
+
- en: Bands
|
29
|
+
fr: Groupes
|
30
|
+
- Albums
|
31
|
+
- date:
|
32
|
+
type: date
|
33
|
+
hint: Date of the update
|
@@ -0,0 +1,20 @@
|
|
1
|
+
---
|
2
|
+
title: About Us
|
3
|
+
listed: true
|
4
|
+
position: 1
|
5
|
+
editable_elements:
|
6
|
+
'banner/page_image': "/samples/photo_2.jpg"
|
7
|
+
'banner/pitch': "<h2>About us</h2><p>Lorem ipsum...</p>"
|
8
|
+
---
|
9
|
+
{% extends parent %}
|
10
|
+
|
11
|
+
{% block content %}
|
12
|
+
|
13
|
+
{% editable_long_text 'content' %}
|
14
|
+
|
15
|
+
%p
|
16
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur vitae tincidunt urna. Nunc felis purus, ultricies et venenatis bibendum, fringilla eu lectus. Sed cursus, sem at blandit mattis, libero quam egestas tortor, eget cursus dolor tellus id nunc. Quisque mauris diam, tincidunt in commodo sed, feugiat eu nibh. Nulla erat nunc, dapibus vel eleifend et, egestas sed quam. Vestibulum mollis eros at dolor vulputate vel sollicitudin enim convallis. Etiam velit nisi, rutrum vel sagittis facilisis, pretium id lorem. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Pellentesque mauris nisl, consequat sed tincidunt nec, lacinia in odio. In hac habitasse platea dictumst. Nam semper libero aliquam turpis gravida vel varius erat vulputate. Integer consequat ipsum vitae augue porttitor ullamcorper. Nam vulputate aliquet ante at gravida. Vestibulum luctus urna et dui hendrerit eu suscipit velit varius. Sed ornare eleifend sem, vitae pharetra dolor sodales egestas. Mauris lobortis hendrerit odio, vitae porttitor urna rutrum at. Ut at lectus erat, nec dictum dolor. Praesent in sapien interdum nibh euismod vestibulum. Vestibulum tincidunt pulvinar accumsan.
|
17
|
+
|
18
|
+
{% endeditable_long_text %}
|
19
|
+
|
20
|
+
{% endblock %}
|
@@ -0,0 +1,54 @@
|
|
1
|
+
---
|
2
|
+
title: Contact Us
|
3
|
+
listed: true
|
4
|
+
position: 4
|
5
|
+
---
|
6
|
+
{% extends 'parent' %}
|
7
|
+
|
8
|
+
{% block content %}
|
9
|
+
|
10
|
+
.text
|
11
|
+
{% editable_long_text 'text' %}
|
12
|
+
%p
|
13
|
+
Ut imperdiet velit eu metus semper tristique. Vivamus risus nisi, tincidunt et euismod a, auctor pretium eros. Vestibulum sed magna et velit pulvinar euismod. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean sed velit quis nisl blandit vulputate id non tortor. Mauris nec placerat massa. Vivamus sed odio non ligula pharetra pretium. Ut convallis, purus et lobortis suscipit, mauris orci ullamcorper lectus, nec vulputate turpis mauris sed augue. Maecenas faucibus ultricies nisl, non ullamcorper justo bibendum nec. Duis vitae mauris condimentum risus commodo mattis vel sed libero. Fusce diam elit, porta id vestibulum ut, aliquet mattis neque.
|
14
|
+
{% endeditable_long_text %}
|
15
|
+
|
16
|
+
%form#contactform{ :name => 'contact', :action => '{{ contents.messages.public_submission_url }}.json', :method => 'post' }
|
17
|
+
/ %input{ type: 'hidden', name: 'success_callback', value: '/events' }
|
18
|
+
/ %input{ type: 'hidden', name: 'error_callback', value: '/contact' }
|
19
|
+
|
20
|
+
%p
|
21
|
+
%label{ :for => 'name' } Name
|
22
|
+
%input{ :type => 'text', :id => 'name', :name => 'content[name]', :placeholder => 'First and last name', :tabindex => '1', required: 'required', value: '{{ message.name }}' }
|
23
|
+
%span {{ message.errors.name }}
|
24
|
+
|
25
|
+
%p
|
26
|
+
%label{ :for => 'email' } Email
|
27
|
+
%input{ :type => 'text', :id => 'email', :name => 'content[email]', :placeholder => 'example@domain.com', :tabindex => '2', required: 'required', value: '{{ message.email }}' }
|
28
|
+
%span {{ message.errors.email }}
|
29
|
+
|
30
|
+
%p
|
31
|
+
%label{ :for => 'comment' } Your Message
|
32
|
+
%textarea{ :id => 'comment', :name => 'content[message]', :tabindex => '3', required: 'required' } {{ message.message }}
|
33
|
+
%span {{ message.errors.message }}
|
34
|
+
|
35
|
+
%p.action
|
36
|
+
%input{ :name => 'submit', :type => 'submit', :tabindex => '4', :value => 'Send Message' }
|
37
|
+
|
38
|
+
:javascript
|
39
|
+
$(document).ready(function() {
|
40
|
+
var form = $('form[name=contact]');
|
41
|
+
form.submit(function(e) {
|
42
|
+
e.stopPropagation();
|
43
|
+
e.preventDefault();
|
44
|
+
$.post(form.attr('action'),
|
45
|
+
form.serializeArray(),
|
46
|
+
function() {
|
47
|
+
alert("Thank you ! Your message have been received");
|
48
|
+
}, "json").error(function(response) {
|
49
|
+
alert("We are sorry but we were unable to treat your message. Please try later.");
|
50
|
+
});
|
51
|
+
});
|
52
|
+
});
|
53
|
+
|
54
|
+
{% endblock %}
|