Compare commits
No commits in common. "master" and "no_require" have entirely different histories.
master
...
no_require
16
Gemfile
@ -9,9 +9,7 @@ gemspec # Include gemspec dependencies
|
||||
|
||||
group :development do
|
||||
# gem 'custom_fields', :path => '../gems/custom_fields' # for Developers
|
||||
# gem 'custom_fields', :git => 'git://github.com/locomotivecms/custom_fields.git', :branch => '2.0.0.rc' # Branch on Github
|
||||
|
||||
# gem 'locomotive-aloha-rails', :path => '../gems/aloha-rails' # for Developers
|
||||
gem 'custom_fields', :git => 'git://github.com/locomotivecms/custom_fields.git', :branch => '2.0.0.rc' # Branch on Github
|
||||
|
||||
gem 'rspec-rails', '~> 2.8.0' # In order to have rspec tasks and generators
|
||||
gem 'rspec-cells'
|
||||
@ -22,8 +20,9 @@ end
|
||||
group :assets do
|
||||
gem 'sass-rails', '~> 3.2.4'
|
||||
gem 'coffee-rails', '~> 3.2.2'
|
||||
gem 'uglifier', '~> 1.2.4'
|
||||
gem 'compass-rails'
|
||||
gem 'uglifier', '~> 1.2.3'
|
||||
gem 'compass', :git => 'git://github.com/chriseppstein/compass.git', :branch => 'no_rails_integration'
|
||||
gem 'compass-rails', :git => 'git://github.com/Compass/compass-rails.git'
|
||||
end
|
||||
|
||||
group :test do
|
||||
@ -35,7 +34,6 @@ group :test do
|
||||
# gem 'growl-glue'
|
||||
|
||||
gem 'cucumber-rails', :require => false
|
||||
gem 'poltergeist'
|
||||
gem 'rspec-rails', '~> 2.8.0'
|
||||
gem 'shoulda-matchers'
|
||||
|
||||
@ -47,9 +45,5 @@ group :test do
|
||||
|
||||
gem 'xpath', '~> 0.1.4'
|
||||
|
||||
gem 'json_spec'
|
||||
|
||||
gem 'database_cleaner'
|
||||
|
||||
# gem 'debugger', :git => 'git://github.com/cldwalker/debugger.git'
|
||||
end
|
||||
end
|
238
Gemfile.lock
@ -1,36 +1,62 @@
|
||||
GIT
|
||||
remote: git://github.com/Compass/compass-rails.git
|
||||
revision: 47d889ad8dabdab1e9f44da4447f94846c089c50
|
||||
specs:
|
||||
compass-rails (1.0.0.rc.3)
|
||||
compass (~> 0.12.rc.0)
|
||||
|
||||
GIT
|
||||
remote: git://github.com/chriseppstein/compass.git
|
||||
revision: 0f96e881019c364aa6124845cbd83b1fd75c4ffe
|
||||
branch: no_rails_integration
|
||||
specs:
|
||||
compass (0.12.rc.4.0f96e88)
|
||||
chunky_png (~> 1.2)
|
||||
fssm (>= 0.2.7)
|
||||
sass (~> 3.1)
|
||||
|
||||
GIT
|
||||
remote: git://github.com/locomotivecms/custom_fields.git
|
||||
revision: 5b0e68859eaca41ac9d7a0231c6cd68ad66018b8
|
||||
branch: 2.0.0.rc
|
||||
specs:
|
||||
custom_fields (2.0.0.rc9)
|
||||
activesupport (~> 3.2.1)
|
||||
carrierwave-mongoid (~> 0.1.3)
|
||||
mongoid (~> 2.4.7)
|
||||
|
||||
PATH
|
||||
remote: .
|
||||
specs:
|
||||
locomotive_cms (2.0.0.rc8)
|
||||
locomotive_cms (2.0.0.rc4)
|
||||
RedCloth (~> 4.2.8)
|
||||
actionmailer-with-request (~> 0.3.0)
|
||||
bson_ext (~> 1.5.2)
|
||||
cancan (~> 1.6.7)
|
||||
carrierwave-mongoid (~> 0.2.1)
|
||||
carrierwave (~> 0.6.0)
|
||||
carrierwave-mongoid (~> 0.1.3)
|
||||
cells (~> 3.8.0)
|
||||
codemirror-rails (~> 2.21)
|
||||
custom_fields (~> 2.0.0.rc12)
|
||||
devise (~> 2.1.0)
|
||||
devise-encryptable (~> 0.1.1)
|
||||
custom_fields (~> 2.0.0.rc9)
|
||||
devise (~> 1.5.3)
|
||||
dragonfly (~> 0.9.8)
|
||||
flash_cookie_session (~> 1.1.1)
|
||||
fog (~> 1.3.1)
|
||||
fog (~> 1.1.2)
|
||||
formtastic (~> 2.0.2)
|
||||
haml (~> 3.1.6)
|
||||
haml (~> 3.1.4)
|
||||
highline (~> 1.6.2)
|
||||
httparty (~> 0.8.1)
|
||||
jquery-rails (~> 1.0.19)
|
||||
jquery-rails (~> 1.0.16)
|
||||
kaminari (~> 0.13.0)
|
||||
locomotive-aloha-rails (~> 0.20.1.4)
|
||||
locomotive-aloha-rails (~> 0.20.1.1)
|
||||
locomotive-mongoid-tree (~> 0.6.2)
|
||||
locomotive-tinymce-rails (~> 3.4.7.2)
|
||||
locomotive-tinymce-rails (~> 3.4.7.1)
|
||||
locomotive_liquid (= 2.2.2)
|
||||
mimetype-fu (~> 0.1.2)
|
||||
mongo (~> 1.5.2)
|
||||
mongoid (~> 2.4.9)
|
||||
multi_json (~> 1.3.4)
|
||||
mongoid (~> 2.4.6)
|
||||
rack-cache (~> 1.1)
|
||||
rails (~> 3.2.5)
|
||||
rails (~> 3.2.3)
|
||||
rails-backbone (~> 0.6.1)
|
||||
rake (~> 0.9.2)
|
||||
responders (~> 0.6.4)
|
||||
@ -42,36 +68,36 @@ GEM
|
||||
remote: http://rubygems.org/
|
||||
specs:
|
||||
RedCloth (4.2.9)
|
||||
actionmailer (3.2.5)
|
||||
actionpack (= 3.2.5)
|
||||
actionmailer (3.2.3)
|
||||
actionpack (= 3.2.3)
|
||||
mail (~> 2.4.4)
|
||||
actionmailer-with-request (0.3.0)
|
||||
rails (>= 3)
|
||||
actionpack (3.2.5)
|
||||
activemodel (= 3.2.5)
|
||||
activesupport (= 3.2.5)
|
||||
actionpack (3.2.3)
|
||||
activemodel (= 3.2.3)
|
||||
activesupport (= 3.2.3)
|
||||
builder (~> 3.0.0)
|
||||
erubis (~> 2.7.0)
|
||||
journey (~> 1.0.1)
|
||||
rack (~> 1.4.0)
|
||||
rack-cache (~> 1.2)
|
||||
rack-test (~> 0.6.1)
|
||||
sprockets (~> 2.1.3)
|
||||
activemodel (3.2.5)
|
||||
activesupport (= 3.2.5)
|
||||
sprockets (~> 2.1.2)
|
||||
activemodel (3.2.3)
|
||||
activesupport (= 3.2.3)
|
||||
builder (~> 3.0.0)
|
||||
activerecord (3.2.5)
|
||||
activemodel (= 3.2.5)
|
||||
activesupport (= 3.2.5)
|
||||
activerecord (3.2.3)
|
||||
activemodel (= 3.2.3)
|
||||
activesupport (= 3.2.3)
|
||||
arel (~> 3.0.2)
|
||||
tzinfo (~> 0.3.29)
|
||||
activeresource (3.2.5)
|
||||
activemodel (= 3.2.5)
|
||||
activesupport (= 3.2.5)
|
||||
activesupport (3.2.5)
|
||||
activeresource (3.2.3)
|
||||
activemodel (= 3.2.3)
|
||||
activesupport (= 3.2.3)
|
||||
activesupport (3.2.3)
|
||||
i18n (~> 0.6)
|
||||
multi_json (~> 1.0)
|
||||
addressable (2.2.8)
|
||||
addressable (2.2.7)
|
||||
arel (3.0.2)
|
||||
bcrypt-ruby (3.0.1)
|
||||
bson (1.5.2)
|
||||
@ -86,19 +112,19 @@ GEM
|
||||
rack-test (>= 0.5.4)
|
||||
selenium-webdriver (~> 2.0)
|
||||
xpath (~> 0.1.4)
|
||||
carrierwave (0.6.2)
|
||||
carrierwave (0.6.0)
|
||||
activemodel (>= 3.2.0)
|
||||
activesupport (>= 3.2.0)
|
||||
carrierwave-mongoid (0.2.1)
|
||||
carrierwave (~> 0.6.1)
|
||||
carrierwave-mongoid (0.1.3)
|
||||
carrierwave (>= 0.5.6)
|
||||
mongoid (~> 2.1)
|
||||
cells (3.8.5)
|
||||
cells (3.8.3)
|
||||
actionpack (~> 3.0)
|
||||
railties (~> 3.0)
|
||||
childprocess (0.3.2)
|
||||
childprocess (0.3.1)
|
||||
ffi (~> 1.0.6)
|
||||
chunky_png (1.2.5)
|
||||
codemirror-rails (2.24)
|
||||
codemirror-rails (2.22)
|
||||
railties (~> 3.0)
|
||||
coffee-rails (3.2.2)
|
||||
coffee-script (>= 2.2.0)
|
||||
@ -106,85 +132,66 @@ GEM
|
||||
coffee-script (2.2.0)
|
||||
coffee-script-source
|
||||
execjs
|
||||
coffee-script-source (1.3.3)
|
||||
compass (0.12.1)
|
||||
chunky_png (~> 1.2)
|
||||
fssm (>= 0.2.7)
|
||||
sass (~> 3.1)
|
||||
compass-rails (1.0.2)
|
||||
compass (>= 0.12.0, < 0.14)
|
||||
cucumber (1.2.1)
|
||||
coffee-script-source (1.2.0)
|
||||
cucumber (1.1.9)
|
||||
builder (>= 2.1.2)
|
||||
diff-lcs (>= 1.1.3)
|
||||
gherkin (~> 2.11.0)
|
||||
diff-lcs (>= 1.1.2)
|
||||
gherkin (~> 2.9.0)
|
||||
json (>= 1.4.6)
|
||||
term-ansicolor (>= 1.0.6)
|
||||
cucumber-rails (1.3.0)
|
||||
capybara (>= 1.1.2)
|
||||
cucumber (>= 1.1.8)
|
||||
nokogiri (>= 1.5.0)
|
||||
custom_fields (2.0.0.rc12)
|
||||
activesupport (~> 3.2.1)
|
||||
carrierwave-mongoid (~> 0.2.1)
|
||||
mongoid (~> 2.4.9)
|
||||
database_cleaner (0.8.0)
|
||||
devise (2.1.0)
|
||||
database_cleaner (0.7.2)
|
||||
devise (1.5.3)
|
||||
bcrypt-ruby (~> 3.0)
|
||||
orm_adapter (~> 0.0.7)
|
||||
railties (~> 3.1)
|
||||
warden (~> 1.1.1)
|
||||
devise-encryptable (0.1.1)
|
||||
devise (>= 2.1.0.rc)
|
||||
orm_adapter (~> 0.0.3)
|
||||
warden (~> 1.1)
|
||||
diff-lcs (1.1.3)
|
||||
dragonfly (0.9.12)
|
||||
dragonfly (0.9.11)
|
||||
rack
|
||||
ejs (1.0.0)
|
||||
erubis (2.7.0)
|
||||
eventmachine (0.12.10)
|
||||
excon (0.13.4)
|
||||
execjs (1.4.0)
|
||||
excon (0.9.6)
|
||||
execjs (1.3.0)
|
||||
multi_json (~> 1.0)
|
||||
factory_girl (2.5.2)
|
||||
activesupport (>= 2.3.9)
|
||||
factory_girl_rails (1.6.0)
|
||||
factory_girl (~> 2.5.0)
|
||||
railties (>= 3.0.0)
|
||||
faye-websocket (0.4.5)
|
||||
eventmachine (>= 0.12.0)
|
||||
ffi (1.0.11)
|
||||
flash_cookie_session (1.1.3)
|
||||
rails (~> 3.0)
|
||||
fog (1.3.1)
|
||||
fog (1.1.2)
|
||||
builder
|
||||
excon (~> 0.13.0)
|
||||
excon (~> 0.9.0)
|
||||
formatador (~> 0.2.0)
|
||||
mime-types
|
||||
multi_json (~> 1.0)
|
||||
multi_json (~> 1.0.3)
|
||||
net-scp (~> 1.0.4)
|
||||
net-ssh (>= 2.1.3)
|
||||
nokogiri (~> 1.5.0)
|
||||
ruby-hmac
|
||||
formatador (0.2.3)
|
||||
formatador (0.2.1)
|
||||
formtastic (2.0.2)
|
||||
rails (~> 3.0)
|
||||
fssm (0.2.9)
|
||||
gherkin (2.11.0)
|
||||
fssm (0.2.8.1)
|
||||
gherkin (2.9.3)
|
||||
json (>= 1.4.6)
|
||||
haml (3.1.6)
|
||||
highline (1.6.12)
|
||||
haml (3.1.4)
|
||||
highline (1.6.11)
|
||||
hike (1.2.1)
|
||||
http_parser.rb (0.5.3)
|
||||
httparty (0.8.3)
|
||||
multi_json (~> 1.0)
|
||||
httparty (0.8.1)
|
||||
multi_json
|
||||
multi_xml
|
||||
i18n (0.6.0)
|
||||
journey (1.0.3)
|
||||
jquery-rails (1.0.19)
|
||||
railties (~> 3.0)
|
||||
thor (~> 0.14)
|
||||
json (1.7.3)
|
||||
json_spec (1.0.3)
|
||||
multi_json (~> 1.0)
|
||||
rspec (~> 2.0)
|
||||
json (1.6.6)
|
||||
kaminari (0.13.0)
|
||||
actionpack (>= 3.0.0)
|
||||
activesupport (>= 3.0.0)
|
||||
@ -192,14 +199,12 @@ GEM
|
||||
kgio (2.7.4)
|
||||
launchy (2.1.0)
|
||||
addressable (~> 2.2.6)
|
||||
libwebsocket (0.1.3)
|
||||
addressable
|
||||
locomotive-aloha-rails (0.20.1.4)
|
||||
locomotive-aloha-rails (0.20.1.1)
|
||||
actionpack (~> 3.2.1)
|
||||
locomotive-mongoid-tree (0.6.2)
|
||||
mongoid (~> 2.0)
|
||||
locomotive-tinymce-rails (3.4.7.2)
|
||||
actionpack (~> 3.0)
|
||||
locomotive-tinymce-rails (3.4.7.1)
|
||||
actionpack (~> 3.2.1)
|
||||
locomotive_liquid (2.2.2)
|
||||
mail (2.4.4)
|
||||
i18n (>= 0.4.0)
|
||||
@ -210,26 +215,20 @@ GEM
|
||||
mocha (0.9.12)
|
||||
mongo (1.5.2)
|
||||
bson (= 1.5.2)
|
||||
mongoid (2.4.11)
|
||||
mongoid (2.4.7)
|
||||
activemodel (~> 3.1)
|
||||
mongo (<= 1.6.2)
|
||||
mongo (~> 1.3)
|
||||
tzinfo (~> 0.3.22)
|
||||
multi_json (1.3.6)
|
||||
multi_xml (0.5.1)
|
||||
multi_json (1.0.4)
|
||||
multi_xml (0.4.2)
|
||||
net-scp (1.0.4)
|
||||
net-ssh (>= 1.99.1)
|
||||
net-ssh (2.5.2)
|
||||
nokogiri (1.5.3)
|
||||
net-ssh (2.3.0)
|
||||
nokogiri (1.5.2)
|
||||
orm_adapter (0.0.7)
|
||||
pickle (0.4.10)
|
||||
cucumber (>= 0.8)
|
||||
rake
|
||||
poltergeist (0.6.0)
|
||||
capybara (~> 1.0)
|
||||
childprocess (~> 0.3)
|
||||
faye-websocket (~> 0.4, >= 0.4.4)
|
||||
http_parser.rb (~> 0.5.3)
|
||||
multi_json (~> 1.0)
|
||||
polyglot (0.3.3)
|
||||
rack (1.4.1)
|
||||
rack-cache (1.2)
|
||||
@ -238,26 +237,26 @@ GEM
|
||||
rack
|
||||
rack-test (0.6.1)
|
||||
rack (>= 1.0)
|
||||
rails (3.2.5)
|
||||
actionmailer (= 3.2.5)
|
||||
actionpack (= 3.2.5)
|
||||
activerecord (= 3.2.5)
|
||||
activeresource (= 3.2.5)
|
||||
activesupport (= 3.2.5)
|
||||
rails (3.2.3)
|
||||
actionmailer (= 3.2.3)
|
||||
actionpack (= 3.2.3)
|
||||
activerecord (= 3.2.3)
|
||||
activeresource (= 3.2.3)
|
||||
activesupport (= 3.2.3)
|
||||
bundler (~> 1.0)
|
||||
railties (= 3.2.5)
|
||||
railties (= 3.2.3)
|
||||
rails-backbone (0.6.1)
|
||||
coffee-script (~> 2.2.0)
|
||||
ejs (~> 1.0.0)
|
||||
railties (>= 3.1.0)
|
||||
railties (3.2.5)
|
||||
actionpack (= 3.2.5)
|
||||
activesupport (= 3.2.5)
|
||||
railties (3.2.3)
|
||||
actionpack (= 3.2.3)
|
||||
activesupport (= 3.2.3)
|
||||
rack-ssl (~> 1.3.2)
|
||||
rake (>= 0.8.7)
|
||||
rdoc (~> 3.4)
|
||||
thor (>= 0.14.6, < 2.0)
|
||||
raindrops (0.9.0)
|
||||
thor (~> 0.14.6)
|
||||
raindrops (0.8.0)
|
||||
rake (0.9.2.2)
|
||||
rdoc (3.12)
|
||||
json (~> 1.4)
|
||||
@ -281,36 +280,35 @@ GEM
|
||||
railties (>= 3.0)
|
||||
rspec (~> 2.8.0)
|
||||
ruby-hmac (0.4.0)
|
||||
rubyzip (0.9.8)
|
||||
rubyzip (0.9.6.1)
|
||||
sanitize (2.0.3)
|
||||
nokogiri (>= 1.4.4, < 1.6)
|
||||
sass (3.1.19)
|
||||
sass (3.1.15)
|
||||
sass-rails (3.2.5)
|
||||
railties (~> 3.2.0)
|
||||
sass (>= 3.1.10)
|
||||
tilt (~> 1.3)
|
||||
selenium-webdriver (2.22.2)
|
||||
selenium-webdriver (2.20.0)
|
||||
childprocess (>= 0.2.5)
|
||||
ffi (~> 1.0)
|
||||
libwebsocket (~> 0.1.3)
|
||||
multi_json (~> 1.0)
|
||||
rubyzip
|
||||
shoulda-matchers (1.1.0)
|
||||
activesupport (>= 3.0.0)
|
||||
sprockets (2.1.3)
|
||||
shoulda-matchers (1.0.0)
|
||||
sprockets (2.1.2)
|
||||
hike (~> 1.2)
|
||||
rack (~> 1.0)
|
||||
tilt (~> 1.1, != 1.3.0)
|
||||
thor (0.15.2)
|
||||
term-ansicolor (1.0.7)
|
||||
thor (0.14.6)
|
||||
tilt (1.3.3)
|
||||
treetop (1.4.10)
|
||||
polyglot
|
||||
polyglot (>= 0.3.1)
|
||||
tzinfo (0.3.33)
|
||||
tzinfo (0.3.32)
|
||||
uglifier (1.2.4)
|
||||
execjs (>= 0.3.0)
|
||||
multi_json (>= 1.0.2)
|
||||
unicorn (4.3.1)
|
||||
unicorn (4.2.1)
|
||||
kgio (~> 2.6)
|
||||
rack
|
||||
raindrops (~> 0.7)
|
||||
@ -326,20 +324,20 @@ PLATFORMS
|
||||
DEPENDENCIES
|
||||
capybara
|
||||
coffee-rails (~> 3.2.2)
|
||||
compass-rails
|
||||
compass!
|
||||
compass-rails!
|
||||
cucumber-rails
|
||||
custom_fields!
|
||||
database_cleaner
|
||||
factory_girl_rails (~> 1.6.0)
|
||||
json_spec
|
||||
launchy
|
||||
locomotive_cms!
|
||||
mocha (= 0.9.12)
|
||||
pickle
|
||||
poltergeist
|
||||
rspec-cells
|
||||
rspec-rails (~> 2.8.0)
|
||||
sass-rails (~> 3.2.4)
|
||||
shoulda-matchers
|
||||
uglifier (~> 1.2.4)
|
||||
uglifier (~> 1.2.3)
|
||||
unicorn
|
||||
xpath (~> 0.1.4)
|
||||
|
@ -24,8 +24,8 @@ h2. Gems
|
||||
|
||||
Here is a short list of main gems / technologies used in the application.
|
||||
|
||||
* Rails 3.2.5
|
||||
* Mongoid 2.4.9 (with MongoDB 2.0)
|
||||
* Rails 3.2.3
|
||||
* Mongoid 2.4.6 (with MongoDB 2.0)
|
||||
* Liquid
|
||||
* Devise
|
||||
* Carrierwave
|
||||
@ -46,7 +46,7 @@ h2. Community
|
||||
|
||||
* Get help or discuss locomotive CMS at the "LocomotiveCMS Google group":https://groups.google.com/forum/?fromgroups#!forum/locomotivecms or the "LocomotiveCMS Discussion Forums":http://locomotive.vanillaforums.com/ (deprecated)
|
||||
* Join us on IRC "#locomotivecms at irc.freenode.net!":http://webchat.freenode.net/
|
||||
* "Follow us on twitter":http://twitter.com/locomotivecms
|
||||
* "Follow us on twitter":http://twitter.com/locomotiveapp
|
||||
|
||||
h2. Contributing to Locomotive
|
||||
|
||||
@ -55,7 +55,6 @@ Locomotive CMS is an open source project, we encourage contributions. If you hav
|
||||
* Install ruby and mongoDB
|
||||
* Clone the project <code>git clone git@github.com:locomotivecms/engine.git</code>
|
||||
* Setup a virtual host entry for <code>test.example.com</code> to point to localhost
|
||||
* Install PhantomJS (Required for the cucumber suite See: https://github.com/jonleighton/poltergeist)
|
||||
* Run the tests <code>rake</code>
|
||||
* Write your failing tests
|
||||
* Make the tests pass
|
||||
|
Before Width: | Height: | Size: 611 B After Width: | Height: | Size: 611 B |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 347 B |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 346 B |
@ -1,3 +0,0 @@
|
||||
button.aloha-locomotive-media-insert {
|
||||
background: url(../img/image.gif) !important;
|
||||
}
|
Before Width: | Height: | Size: 621 B |
@ -1,96 +0,0 @@
|
||||
define(
|
||||
['aloha/jquery', 'aloha/plugin', 'aloha/floatingmenu', 'i18n!aloha/nls/i18n', 'i18n!locomotive_media/nls/i18n', 'css!locomotive_media/css/image.css'],
|
||||
function(aQuery, Plugin, FloatingMenu, i18nCore, i18n) {
|
||||
var jQuery = aQuery;
|
||||
var $ = aQuery;
|
||||
var GENTICS = window.GENTICS, Aloha = window.Aloha;
|
||||
|
||||
return Plugin.create('locomotive_media', {
|
||||
init: function() {
|
||||
FloatingMenu.createScope(this.name, 'Aloha.continuoustext');
|
||||
|
||||
this._addUIInsertButton(i18nCore.t('floatingmenu.tab.insert'));
|
||||
},
|
||||
|
||||
openDialog: function() {
|
||||
var that = this;
|
||||
var picker = window.parent.application_view.content_assets_picker_view;
|
||||
|
||||
picker.options.on_select = function(asset) {
|
||||
if (asset.get('image') == true)
|
||||
that.insertImg(asset);
|
||||
else
|
||||
that.insertLink(asset);
|
||||
|
||||
picker.close();
|
||||
}
|
||||
|
||||
picker.fetch_assets();
|
||||
},
|
||||
|
||||
/**
|
||||
* This method will insert a new image dom element into the dom tree
|
||||
*/
|
||||
insertImg: function(asset) {
|
||||
var range = Aloha.Selection.getRangeObject(),
|
||||
imageUrl = asset.get('url'),
|
||||
imagestyle, imagetag, newImg;
|
||||
|
||||
if (range.isCollapsed()) {
|
||||
imagestyle = "max-width: " + asset.get('width') + "; max-height: " + asset.get('height');
|
||||
imagetag = '<img style="'+ imagestyle + '" src="' + imageUrl + '" title="" />';
|
||||
newImg = jQuery(imagetag);
|
||||
GENTICS.Utils.Dom.insertIntoDOM(newImg, range, jQuery(Aloha.activeEditable.obj));
|
||||
} else {
|
||||
Aloha.Log.error('media cannot markup a selection');
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* This method will insert a new link dom element into the dom tree
|
||||
*/
|
||||
insertLink: function(asset) {
|
||||
var range = Aloha.Selection.getRangeObject(),
|
||||
linkText = asset.get('filename'),
|
||||
linkUrl = asset.get('url'),
|
||||
linktag, newLink;
|
||||
|
||||
if (range.isCollapsed()) {
|
||||
linktag = '<a href="' + linkUrl + '">' + linkText + '</a>';
|
||||
newLink = jQuery(linktag);
|
||||
GENTICS.Utils.Dom.insertIntoDOM(newLink, range, jQuery(Aloha.activeEditable.obj));
|
||||
range.startContainer = range.endContainer = newLink.contents().get(0);
|
||||
range.startOffset = 0;
|
||||
range.endOffset = linkText.length;
|
||||
} else {
|
||||
linktag = '<a href="' + linkUrl + '"></a>';
|
||||
newLink = jQuery(linktag);
|
||||
GENTICS.Utils.Dom.addMarkup(range, newLink, false);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Adds the insert button to the floating menu
|
||||
*/
|
||||
_addUIInsertButton: function(tabId) {
|
||||
var that = this;
|
||||
this.insertMediaButton = new Aloha.ui.Button({
|
||||
'name' : 'insertlocomotivemedia',
|
||||
'iconClass': 'aloha-button aloha-locomotive-media-insert',
|
||||
'size' : 'small',
|
||||
'onclick' : function () { that.openDialog(); },
|
||||
'tooltip' : i18n.t('button.addimg.tooltip'),
|
||||
'toggle' : false
|
||||
});
|
||||
|
||||
FloatingMenu.addButton(
|
||||
'Aloha.continuoustext',
|
||||
this.insertMediaButton,
|
||||
tabId,
|
||||
1
|
||||
);
|
||||
},
|
||||
|
||||
});
|
||||
}
|
||||
);
|
@ -1 +0,0 @@
|
||||
define({ 'button.addimg.tooltip': 'insérer média' });
|
@ -1,4 +0,0 @@
|
||||
define({
|
||||
root: { "button.addimg.tooltip": "insert media" },
|
||||
fr: true
|
||||
});
|
@ -1 +0,0 @@
|
||||
{}
|
@ -1,2 +1,2 @@
|
||||
#= require ./utils/aloha_settings
|
||||
#= require aloha
|
||||
#= require aloha
|
||||
|
@ -12,7 +12,6 @@
|
||||
#= require_self
|
||||
#= require_tree ./utils
|
||||
#= require_tree ./models
|
||||
#= require_tree ./views/content_assets
|
||||
#= require_tree ./views/inline_editor
|
||||
|
||||
window.Locomotive =
|
||||
|
@ -16,7 +16,7 @@ class Locomotive.Models.Page extends Backbone.Model
|
||||
|
||||
toJSON: ->
|
||||
_.tap super, (hash) =>
|
||||
_.each ['fullpath', 'localized_fullpaths', 'templatized_from_parent', 'target_klass_name_text', 'content_type_id_text', 'edit_url', 'parent_id_text', 'response_type_text'], (key) => delete hash[key]
|
||||
_.each ['content_type_id_text', 'edit_url', 'parent_id_text', 'response_type_text'], (key) => delete hash[key]
|
||||
|
||||
delete hash['editable_elements']
|
||||
hash.editable_elements = @get('editable_elements').toJSONForSave() if @get('editable_elements')? && @get('editable_elements').length > 0
|
||||
|
@ -23,11 +23,6 @@ window.Aloha.settings =
|
||||
editables:
|
||||
'.editable-short-text': [ ]
|
||||
|
||||
image:
|
||||
ui:
|
||||
insert: false
|
||||
crop: false
|
||||
|
||||
i18n:
|
||||
available: ['en', 'fr', 'pt-BR', 'es', 'de', 'no', 'ru', 'nl']
|
||||
|
||||
|
@ -18,9 +18,9 @@
|
||||
|
||||
String.prototype.slugify = function(sep) {
|
||||
if (typeof sep == 'undefined') sep = '_';
|
||||
var alphaNumRegexp = new RegExp('[^\\w\\' + sep + ']', 'g');
|
||||
var alphaNumRegexp = new RegExp('[^\w\\' + sep + ']', 'g');
|
||||
var avoidDuplicateRegexp = new RegExp('[\\' + sep + ']{2,}', 'g');
|
||||
return this.replace(/\s/g, sep).replace(alphaNumRegexp, '').replace(avoidDuplicateRegexp, sep).toLowerCase();
|
||||
return this.replace(/\s/g, sep).replace(alphaNumRegexp, '').replace(avoidDuplicateRegexp, sep).toLowerCase()
|
||||
}
|
||||
|
||||
window.addParameterToURL = function(key, value, context) { // code from http://stackoverflow.com/questions/486896/adding-a-parameter-to-the-url-with-javascript
|
||||
@ -69,7 +69,5 @@
|
||||
doc.head.appendChild(stylesheet);
|
||||
}
|
||||
|
||||
$.ui.dialog.prototype.overlayEl = function() { return this.overlay.$el; }
|
||||
|
||||
})();
|
||||
|
||||
|
@ -83,10 +83,3 @@ class Locomotive.Views.ApplicationView extends Backbone.View
|
||||
locale = $(@).attr('data-locale')
|
||||
window.addParameterToURL 'content_locale', locale
|
||||
|
||||
unique_dialog_zindex: ->
|
||||
# returns the number of jQuery UI modals created in order to set a valid zIndex for each of them.
|
||||
# Each modal window should have a different zIndex, otherwise there will be conflicts between them.
|
||||
window.Locomotive.jQueryModals ||= 0
|
||||
|
||||
998 + window.Locomotive.jQueryModals++
|
||||
|
||||
|
@ -12,10 +12,7 @@ class Locomotive.Views.ContentAssets.PickerView extends Locomotive.Views.Shared.
|
||||
ich.content_asset_picker
|
||||
|
||||
fetch_assets: ->
|
||||
@_reset()
|
||||
@collection.fetch
|
||||
success: () =>
|
||||
@open()
|
||||
@collection.fetch()
|
||||
|
||||
build_uploader: (el, link) ->
|
||||
link.bind 'click', (event) ->
|
||||
|
@ -50,13 +50,11 @@ class Locomotive.Views.ContentEntries.FormView extends Locomotive.Views.Shared.F
|
||||
settings = _.extend {}, @tinyMCE_settings(),
|
||||
oninit: ((editor) =>
|
||||
$.cmd 'S', (() =>
|
||||
editor.save()
|
||||
$(textarea).trigger('changeSilently')
|
||||
$(textarea).val(editor.getBody().innerHTML).trigger('change')
|
||||
@$('form').trigger('submit')
|
||||
), [], ignoreCase: true, document: editor.dom.doc),
|
||||
onchange_callback: (editor) =>
|
||||
editor.save()
|
||||
$(textarea).trigger('changeSilently')
|
||||
$(textarea).val(editor.getBody().innerHTML).trigger('change')
|
||||
|
||||
$(textarea).tinymce(settings)
|
||||
|
||||
|
@ -26,9 +26,11 @@ class Locomotive.Views.ContentEntries.PopupFormView extends Locomotive.Views.Con
|
||||
@dialog = $(@el).dialog
|
||||
autoOpen: false
|
||||
modal: true
|
||||
zIndex: window.application_view.unique_dialog_zindex()
|
||||
zIndex: 998
|
||||
width: 770,
|
||||
create: (event, ui) =>
|
||||
$('.ui-widget-overlay').bind 'click', => @close()
|
||||
|
||||
$(@el).prev().find('.ui-dialog-title').html(@$('h2').html())
|
||||
@$('h2').remove()
|
||||
actions = @$('.dialog-actions').appendTo($(@el).parent()).addClass('ui-dialog-buttonpane ui-widget-content ui-helper-clearfix')
|
||||
@ -37,7 +39,6 @@ class Locomotive.Views.ContentEntries.PopupFormView extends Locomotive.Views.Con
|
||||
actions.find('input[type=submit]').click (event) => @save(event)
|
||||
|
||||
open: (event, ui, extra) =>
|
||||
$(@el).dialog('overlayEl').bind 'click', => @close()
|
||||
# nothing to do
|
||||
|
||||
open: ->
|
||||
@ -49,14 +50,11 @@ class Locomotive.Views.ContentEntries.PopupFormView extends Locomotive.Views.Con
|
||||
parent_el.find('.new-section').hide()
|
||||
parent_el.find('.edit-section').show()
|
||||
|
||||
@clear_errors()
|
||||
|
||||
$(@el).dialog('open')
|
||||
|
||||
close: (event) ->
|
||||
event.stopPropagation() & event.preventDefault() if event?
|
||||
@clear_errors()
|
||||
$(@el).dialog('overlayEl').unbind('click')
|
||||
$(@el).dialog('close')
|
||||
|
||||
center: ->
|
||||
@ -71,9 +69,6 @@ class Locomotive.Views.ContentEntries.PopupFormView extends Locomotive.Views.Con
|
||||
else
|
||||
@refresh()
|
||||
|
||||
slugify_label_field: ->
|
||||
# disabled in a popup form
|
||||
|
||||
enable_has_many_fields: ->
|
||||
# disabled in a popup form
|
||||
|
||||
|
@ -12,6 +12,8 @@ class Locomotive.Views.ContentTypes.FormView extends Locomotive.Views.Shared.For
|
||||
initialize: ->
|
||||
@model = new Locomotive.Models.ContentType(@options.content_type)
|
||||
|
||||
window.foo = @model
|
||||
|
||||
Backbone.ModelBinding.bind @
|
||||
|
||||
render: ->
|
||||
|
@ -58,18 +58,11 @@ class Locomotive.Views.ContentTypes.CustomFieldEntryView extends Backbone.View
|
||||
fetch_inverse_of_list: ->
|
||||
@$('li.input.inverse-of select option').remove()
|
||||
|
||||
list = @inverse_of_list[@model.get('type')] || []
|
||||
|
||||
_.each list, (data) =>
|
||||
_.each @inverse_of_list[@model.get('type')], (data) =>
|
||||
if data.class_name == @model.get('class_name')
|
||||
option = new Option(data.label, data.name, data.name == @model.get('inverse_of') || list.length == 1)
|
||||
option = new Option(data.label, data.name, data.class_name == @model.get('inverse_of') || @inverse_of_list.length == 1)
|
||||
@$('li.input.inverse-of select').append(option)
|
||||
|
||||
# by default, select the first option
|
||||
if !@model.get('inverse_of')? && list.length > 0
|
||||
@model.set
|
||||
inverse_of: list[0].name
|
||||
|
||||
render_select_options_view: ->
|
||||
@select_options_view = new Locomotive.Views.ContentTypes.SelectOptionsView
|
||||
model: @model
|
||||
@ -85,10 +78,8 @@ class Locomotive.Views.ContentTypes.CustomFieldEntryView extends Backbone.View
|
||||
form = @$('ol')
|
||||
|
||||
if form.is(':hidden')
|
||||
@$('a.toggle').addClass('open')
|
||||
form.slideDown()
|
||||
else
|
||||
@$('a.toggle').removeClass('open')
|
||||
form.slideUp()
|
||||
|
||||
show_error: (message) ->
|
||||
|
@ -11,4 +11,5 @@ class Locomotive.Views.ContentTypes.EditView extends Locomotive.Views.ContentTyp
|
||||
|
||||
if custom_field.isNew() # assign an id for each new custom field
|
||||
custom_field.set id: data._id, _id: data._id
|
||||
console.log(custom_field)
|
||||
|
||||
|
@ -15,6 +15,8 @@ class Locomotive.Views.CurrentSite.EditView extends Locomotive.Views.Shared.Form
|
||||
|
||||
Backbone.ModelBinding.bind @, checkbox: 'class'
|
||||
|
||||
window.foo = @model
|
||||
|
||||
render: ->
|
||||
super()
|
||||
|
||||
@ -55,16 +57,15 @@ class Locomotive.Views.CurrentSite.EditView extends Locomotive.Views.Shared.Form
|
||||
@$('#site_memberships_input').append(@memberships_view.render().el)
|
||||
|
||||
enable_liquid_editing: ->
|
||||
if($('#site_robots_txt').length)
|
||||
input = @$('#site_robots_txt')
|
||||
@editor = CodeMirror.fromTextArea input.get()[0],
|
||||
mode: 'liquid'
|
||||
autoMatchParens: false
|
||||
lineNumbers: false
|
||||
passDelay: 50
|
||||
tabMode: 'shift'
|
||||
theme: 'default'
|
||||
onChange: (editor) => @model.set(robots_txt: editor.getValue())
|
||||
input = @$('#site_robots_txt')
|
||||
@editor = CodeMirror.fromTextArea input.get()[0],
|
||||
mode: 'liquid'
|
||||
autoMatchParens: false
|
||||
lineNumbers: false
|
||||
passDelay: 50
|
||||
tabMode: 'shift'
|
||||
theme: 'default'
|
||||
onChange: (editor) => @model.set(robots_txt: editor.getValue())
|
||||
|
||||
save: (event) ->
|
||||
if @model.includes_domain(window.location.host)
|
||||
|
@ -38,8 +38,7 @@ class Locomotive.Views.EditableElements.FileView extends Backbone.View
|
||||
on_change: =>
|
||||
@$('a:first').hide() & @$('input[type=file]').show() & @$('a.delete').hide()
|
||||
on_cancel: =>
|
||||
@model.set(source: null)
|
||||
@$('a:first').show() & @$('input[type=file]').val('').hide() & @$('a.delete').show()
|
||||
@$('a:first').show() & @$('input[type=file]').hide() & @$('a.delete').show()
|
||||
|
||||
toggle_delete: (event) ->
|
||||
@_toggle event, 'delete',
|
||||
|
@ -2,35 +2,7 @@
|
||||
|
||||
Locomotive.Views.EditableElements ||= {}
|
||||
|
||||
class Locomotive.Views.EditableElements.LongTextView extends Backbone.View
|
||||
|
||||
tagName: 'li'
|
||||
|
||||
className: 'text input html'
|
||||
|
||||
render: ->
|
||||
$(@el).html(ich.editable_text_input(@model.toJSON()))
|
||||
|
||||
return @
|
||||
|
||||
after_render: ->
|
||||
settings = _.extend {}, @tinymce_settings(),
|
||||
oninit: ((editor) =>
|
||||
$.cmd 'S', (() =>
|
||||
@model.set(content: editor.getBody().innerHTML)
|
||||
$(@el).parents('form').trigger('submit')
|
||||
), [], ignoreCase: true, document: editor.dom.doc),
|
||||
onchange_callback: (editor) =>
|
||||
@model.set(content: editor.getBody().innerHTML)
|
||||
|
||||
@$('textarea').tinymce(settings)
|
||||
class Locomotive.Views.EditableElements.LongTextView extends Locomotive.Views.EditableElements.ShortTextView
|
||||
|
||||
tinymce_settings: ->
|
||||
window.Locomotive.tinyMCE.defaultSettings
|
||||
|
||||
refresh: ->
|
||||
# do nothing
|
||||
|
||||
remove: ->
|
||||
@$('textarea').tinymce().destroy()
|
||||
super
|
||||
window.Locomotive.tinyMCE.defaultSettings
|
@ -4,19 +4,31 @@ class Locomotive.Views.EditableElements.ShortTextView extends Backbone.View
|
||||
|
||||
tagName: 'li'
|
||||
|
||||
className: 'text input short'
|
||||
className: 'text input html'
|
||||
|
||||
render: ->
|
||||
$(@el).html(ich.editable_text_input(@model.toJSON()))
|
||||
|
||||
@$('textarea').bind 'keyup', (event) =>
|
||||
input = $(event.target)
|
||||
@model.set(content: input.val())
|
||||
|
||||
return @
|
||||
|
||||
after_render: ->
|
||||
# do nothing
|
||||
settings = _.extend {}, @tinymce_settings(),
|
||||
oninit: ((editor) =>
|
||||
$.cmd 'S', (() =>
|
||||
@model.set(content: editor.getBody().innerHTML)
|
||||
$(@el).parents('form').trigger('submit')
|
||||
), [], ignoreCase: true, document: editor.dom.doc),
|
||||
onchange_callback: (editor) =>
|
||||
@model.set(content: editor.getBody().innerHTML)
|
||||
|
||||
@$('textarea').tinymce(settings)
|
||||
|
||||
tinymce_settings: ->
|
||||
window.Locomotive.tinyMCE.minimalSettings
|
||||
|
||||
refresh: ->
|
||||
# do nothing
|
||||
# do nothing
|
||||
|
||||
remove: ->
|
||||
@$('textarea').tinymce().destroy()
|
||||
super
|
@ -1,8 +1,8 @@
|
||||
Locomotive.Views.InlineEditor ||= {}
|
||||
Locomotive.Views.InlinEditor ||= {}
|
||||
|
||||
#= require ./toolbar_view
|
||||
|
||||
class Locomotive.Views.InlineEditor.ApplicationView extends Backbone.View
|
||||
class Locomotive.Views.InlinEditor.ApplicationView extends Backbone.View
|
||||
|
||||
el: 'body'
|
||||
|
||||
@ -13,9 +13,7 @@ class Locomotive.Views.InlineEditor.ApplicationView extends Backbone.View
|
||||
|
||||
_.bindAll(@, '_$')
|
||||
|
||||
@toolbar_view = new Locomotive.Views.InlineEditor.ToolbarView(target: @iframe)
|
||||
|
||||
@content_assets_picker_view = new Locomotive.Views.ContentAssets.PickerView(collection: new Locomotive.Models.ContentAssetsCollection())
|
||||
@toolbar_view = new Locomotive.Views.InlinEditor.ToolbarView(target: @iframe)
|
||||
|
||||
render: ->
|
||||
super
|
||||
@ -24,19 +22,19 @@ class Locomotive.Views.InlineEditor.ApplicationView extends Backbone.View
|
||||
|
||||
@toolbar_view.render()
|
||||
|
||||
@content_assets_picker_view.render()
|
||||
|
||||
enable_iframe_autoheight: ->
|
||||
iframe = @iframe
|
||||
|
||||
iframe.load =>
|
||||
console.log('iframe loading')
|
||||
|
||||
if @_$('meta[name=inline-editor]').size() > 0
|
||||
# bind the resize event. When the iFrame's size changes, update its height
|
||||
iframe_content = iframe.contents()
|
||||
iframe_content = iframe.contents().find('body')
|
||||
iframe_content.resize ->
|
||||
elem = $(this)
|
||||
|
||||
if elem.outerHeight(true) > iframe.outerHeight(true) # Resize the iFrame.
|
||||
if elem.outerHeight(true) > $('body').outerHeight(true) # Resize the iFrame.
|
||||
iframe.css height: elem.outerHeight(true)
|
||||
|
||||
# Resize the iFrame immediately.
|
||||
@ -48,6 +46,8 @@ class Locomotive.Views.InlineEditor.ApplicationView extends Backbone.View
|
||||
@enhance_iframe_links()
|
||||
|
||||
set_page: (attributes) ->
|
||||
console.log('set_page')
|
||||
|
||||
@page = new Locomotive.Models.Page(attributes)
|
||||
|
||||
@toolbar_view.model = @page
|
||||
@ -78,7 +78,7 @@ class Locomotive.Views.InlineEditor.ApplicationView extends Backbone.View
|
||||
_jQuery('a').each ->
|
||||
link = _jQuery(this)
|
||||
url = link.attr('href')
|
||||
if url? && url.indexOf('#') != 0 && /^(www|http)/.exec(url) == null && /(\/_edit)$/.exec(url) == null && /^\/sites\//.exec(url) == null
|
||||
if url? && url.indexOf('#') != 0 && /^(www|http)/.exec(url) == null && /(\/_edit)$/.exec(url) == null
|
||||
url = '/index' if url == '/'
|
||||
|
||||
unless url.indexOf('_edit') > 0
|
||||
@ -91,13 +91,6 @@ class Locomotive.Views.InlineEditor.ApplicationView extends Backbone.View
|
||||
toolbar_view.show_status 'loading'
|
||||
window.history.pushState('Object', 'Title', link.attr('href').replace('_edit', '_admin'))
|
||||
|
||||
unique_dialog_zindex: ->
|
||||
# returns the number of jQuery UI modals created in order to set a valid zIndex for each of them.
|
||||
# Each modal window should have a different zIndex, otherwise there will be conflicts between them.
|
||||
window.Locomotive.jQueryModals ||= 0
|
||||
|
||||
1050 + window.Locomotive.jQueryModals++
|
||||
|
||||
_$: (selector) ->
|
||||
$(selector, @iframe[0].contentWindow.document)
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
Locomotive.Views.InlineEditor ||= {}
|
||||
Locomotive.Views.InlinEditor ||= {}
|
||||
|
||||
class Locomotive.Views.InlineEditor.ToolbarView extends Backbone.View
|
||||
class Locomotive.Views.InlinEditor.ToolbarView extends Backbone.View
|
||||
|
||||
el: '#toolbar .inner'
|
||||
|
||||
@ -13,6 +13,8 @@ class Locomotive.Views.InlineEditor.ToolbarView extends Backbone.View
|
||||
render: ->
|
||||
super
|
||||
|
||||
console.log('render toolbar')
|
||||
|
||||
@enable_editing_mode_checkbox()
|
||||
|
||||
@enable_content_locale_picker()
|
||||
@ -20,6 +22,8 @@ class Locomotive.Views.InlineEditor.ToolbarView extends Backbone.View
|
||||
@
|
||||
|
||||
notify: (aloha_editable) ->
|
||||
console.log('editable_element has been modified...')
|
||||
|
||||
window.bar = aloha_editable
|
||||
|
||||
element_id = aloha_editable.obj.attr('data-element-id')
|
||||
@ -121,6 +125,8 @@ class Locomotive.Views.InlineEditor.ToolbarView extends Backbone.View
|
||||
context.find('span.text').html(values[1])
|
||||
|
||||
refresh: ->
|
||||
console.log('refreshing toolbar...')
|
||||
|
||||
@$('h1').html(@model.get('title')).removeClass()
|
||||
|
||||
if @$('.editing-mode input[type=checkbox]').is(':checked')
|
||||
|
@ -16,14 +16,14 @@ class Locomotive.Views.Pages.FormView extends Locomotive.Views.Shared.FormView
|
||||
|
||||
@model = new Locomotive.Models.Page(@options.page)
|
||||
|
||||
window.foo = @model
|
||||
|
||||
@touched_url = false
|
||||
|
||||
@image_picker_view = new Locomotive.Views.ThemeAssets.ImagePickerView
|
||||
collection: new Locomotive.Models.ThemeAssetsCollection()
|
||||
on_select: @insert_image
|
||||
|
||||
@image_picker_view.render()
|
||||
|
||||
Backbone.ModelBinding.bind @
|
||||
|
||||
@editable_elements_view = new Locomotive.Views.EditableElements.EditAllView(collection: @model.get('editable_elements'))
|
||||
@ -58,7 +58,7 @@ class Locomotive.Views.Pages.FormView extends Locomotive.Views.Shared.FormView
|
||||
open_image_picker: (event) ->
|
||||
event.stopPropagation() & event.preventDefault()
|
||||
@image_picker_view.editor = @editor
|
||||
@image_picker_view.fetch_assets()
|
||||
@image_picker_view.render()
|
||||
|
||||
insert_image: (path) ->
|
||||
text = "{{ '#{path}' | theme_image_url }}"
|
||||
@ -116,7 +116,7 @@ class Locomotive.Views.Pages.FormView extends Locomotive.Views.Shared.FormView
|
||||
@$('li#page_slug_input').show()
|
||||
@$('li#page_templatized_input, li#page_target_klass_name_input').hide()
|
||||
else
|
||||
@$('li#page_templatized_input').show() unless @model.get('redirect')
|
||||
@$('li#page_templatized_input, li#page_target_klass_name_input').show()
|
||||
|
||||
enable_response_type_select: ->
|
||||
@$('li#page_response_type_input').change (event) =>
|
||||
|
@ -5,14 +5,10 @@ class Locomotive.Views.Pages.EditView extends Locomotive.Views.Pages.FormView
|
||||
save: (event) ->
|
||||
event.stopPropagation() & event.preventDefault()
|
||||
|
||||
form = $(event.target).trigger('ajax:beforeSend')
|
||||
|
||||
@clear_errors()
|
||||
|
||||
@model.save {},
|
||||
success: (model, response, xhr) =>
|
||||
form.trigger('ajax:complete')
|
||||
|
||||
model._normalize()
|
||||
|
||||
if model.get('template_changed') == true
|
||||
@ -21,8 +17,9 @@ class Locomotive.Views.Pages.EditView extends Locomotive.Views.Pages.FormView
|
||||
@refresh_editable_elements()
|
||||
|
||||
error: (model, xhr) =>
|
||||
form.trigger('ajax:complete')
|
||||
|
||||
errors = JSON.parse(xhr.responseText)
|
||||
|
||||
@show_errors errors
|
||||
|
||||
|
||||
|
||||
|
@ -11,9 +11,11 @@ class Locomotive.Views.Shared.AssetPickerView extends Backbone.View
|
||||
@collection.bind('remove', @remove_asset)
|
||||
|
||||
render: ->
|
||||
@_reset()
|
||||
|
||||
$(@el).html(@template()())
|
||||
|
||||
@create_dialog()
|
||||
@fetch_assets()
|
||||
|
||||
return @
|
||||
|
||||
@ -27,32 +29,33 @@ class Locomotive.Views.Shared.AssetPickerView extends Backbone.View
|
||||
# please overide build_uploader
|
||||
|
||||
create_dialog: ->
|
||||
@dialog ||= $(@el).dialog
|
||||
autoOpen: false
|
||||
@dialog = $(@el).dialog
|
||||
modal: true
|
||||
zIndex: window.application_view.unique_dialog_zindex()
|
||||
zIndex: 998
|
||||
width: 650,
|
||||
create: (event, ui) =>
|
||||
$('.ui-widget-overlay').bind 'click', => @close()
|
||||
|
||||
$(@el).prev().find('.ui-dialog-title').html(@$('h2').html())
|
||||
@$('h2').remove()
|
||||
actions = @$('.dialog-actions').appendTo($(@el).parent()).addClass('ui-dialog-buttonpane ui-widget-content ui-helper-clearfix')
|
||||
|
||||
actions.find('#close-link').click (event) => @close(event)
|
||||
|
||||
input = actions.find('input[type=file]')
|
||||
link = actions.find('#upload-link')
|
||||
|
||||
@build_uploader(input, link)
|
||||
|
||||
open: (event, ui, extra) =>
|
||||
$(@el).dialog('overlayEl').bind 'click', => @close()
|
||||
actions = $(@el).parent().find('.ui-dialog-buttonpane')
|
||||
el = actions.find('input[type=file]')
|
||||
link = actions.find('#upload-link')
|
||||
|
||||
@build_uploader(el, link)
|
||||
|
||||
@open()
|
||||
|
||||
open: ->
|
||||
$(@el).dialog('open')
|
||||
|
||||
close: (event) ->
|
||||
event.stopPropagation() & event.preventDefault() if event?
|
||||
$(@el).dialog('overlayEl').unbind('click')
|
||||
$(@el).dialog('close')
|
||||
|
||||
shake: ->
|
||||
@ -67,6 +70,8 @@ class Locomotive.Views.Shared.AssetPickerView extends Backbone.View
|
||||
|
||||
@_refresh()
|
||||
|
||||
setTimeout (=> @create_dialog()), 30 # disable flickering
|
||||
|
||||
add_asset: (asset, first) ->
|
||||
# please overide add_asset (the 'first' param is to know if it comes from the first collection fetch)
|
||||
|
||||
@ -89,4 +94,6 @@ class Locomotive.Views.Shared.AssetPickerView extends Backbone.View
|
||||
_on_refresh: ->
|
||||
|
||||
_reset: ->
|
||||
# for nothing to do
|
||||
$('.ui-widget-overlay').unbind 'click'
|
||||
@$('.actions input[type=file]').remove()
|
||||
@dialog.dialog('destroy') if @dialog?
|
@ -24,6 +24,10 @@ class Locomotive.Views.Shared.Fields.ManyToManyView extends Backbone.View
|
||||
@collection = @model.get(@options.name)
|
||||
@all_entries = @options.all_entries
|
||||
|
||||
window.collection = @collection
|
||||
window.bar = @all_entries
|
||||
window.model = @model
|
||||
|
||||
render: ->
|
||||
$(@el).html(@template()())
|
||||
|
||||
|
@ -16,9 +16,6 @@ class Locomotive.Views.Shared.FormView extends Backbone.View
|
||||
# allow users to save with CTRL+S or CMD+s
|
||||
@enable_save_with_keys_combination()
|
||||
|
||||
# enable form notifications
|
||||
@enable_form_notifications()
|
||||
|
||||
return @
|
||||
|
||||
save: (event) ->
|
||||
@ -27,8 +24,6 @@ class Locomotive.Views.Shared.FormView extends Backbone.View
|
||||
save_in_ajax: (event, options) ->
|
||||
event.stopPropagation() & event.preventDefault()
|
||||
|
||||
form = $(event.target).trigger('ajax:beforeSend')
|
||||
|
||||
@clear_errors()
|
||||
|
||||
options ||= { headers: {}, on_success: null, on_error: null }
|
||||
@ -36,18 +31,13 @@ class Locomotive.Views.Shared.FormView extends Backbone.View
|
||||
previous_attributes = _.clone @model.attributes
|
||||
|
||||
@model.save {},
|
||||
headers: options.headers
|
||||
silent: true # since we pass an empty hash above, no need to trigger the callbacks
|
||||
headers: options.headers
|
||||
success: (model, response, xhr) =>
|
||||
form.trigger('ajax:complete')
|
||||
|
||||
model.attributes = previous_attributes
|
||||
|
||||
options.on_success(response, xhr) if options.on_success
|
||||
|
||||
error: (model, xhr) =>
|
||||
form.trigger('ajax:complete')
|
||||
|
||||
errors = JSON.parse(xhr.responseText)
|
||||
|
||||
@show_errors errors
|
||||
@ -82,10 +72,7 @@ class Locomotive.Views.Shared.FormView extends Backbone.View
|
||||
content.slideUp 100, -> parent.addClass('folded')
|
||||
|
||||
enable_save_with_keys_combination: ->
|
||||
$.cmd 'S', (() => @$('form input[type=submit]').trigger('click')), [], ignoreCase: true
|
||||
|
||||
enable_form_notifications: ->
|
||||
@$('form').formSubmitNotification()
|
||||
$.cmd 'S', (() => @$('form').trigger('submit')), [], ignoreCase: true
|
||||
|
||||
after_inputs_fold: ->
|
||||
# overide this method if necessary
|
||||
|
@ -19,8 +19,6 @@ class Locomotive.Views.Snippets.FormView extends Locomotive.Views.Shared.FormVie
|
||||
collection: new Locomotive.Models.ThemeAssetsCollection()
|
||||
on_select: @insert_image
|
||||
|
||||
@image_picker_view.render()
|
||||
|
||||
Backbone.ModelBinding.bind @
|
||||
|
||||
render: ->
|
||||
@ -40,7 +38,7 @@ class Locomotive.Views.Snippets.FormView extends Locomotive.Views.Shared.FormVie
|
||||
open_image_picker: (event) ->
|
||||
event.stopPropagation() & event.preventDefault()
|
||||
@image_picker_view.editor = @editor
|
||||
@image_picker_view.fetch_assets()
|
||||
@image_picker_view.render()
|
||||
|
||||
insert_image: (path) ->
|
||||
text = "{{ '#{path}' | theme_image_url }}"
|
||||
|
@ -15,9 +15,9 @@ class Locomotive.Views.ThemeAssets.FormView extends Locomotive.Views.Shared.Form
|
||||
|
||||
@model = new Locomotive.Models.ThemeAsset(@options.theme_asset)
|
||||
|
||||
@image_picker_view = new Locomotive.Views.ThemeAssets.ImagePickerView on_select: @insert_image
|
||||
window.foo = @model
|
||||
|
||||
@image_picker_view.render()
|
||||
@image_picker_view = new Locomotive.Views.ThemeAssets.ImagePickerView on_select: @insert_image
|
||||
|
||||
Backbone.ModelBinding.bind @
|
||||
|
||||
@ -72,10 +72,10 @@ class Locomotive.Views.ThemeAssets.FormView extends Locomotive.Views.Shared.Form
|
||||
open_image_picker: (event) ->
|
||||
event.stopPropagation() & event.preventDefault()
|
||||
@image_picker_view.editor = @editor
|
||||
@image_picker_view.fetch_assets()
|
||||
@image_picker_view.render()
|
||||
|
||||
insert_image: (path) ->
|
||||
text = "'#{path}'"
|
||||
text = "{{ '#{path}' | theme_image_url }}"
|
||||
@editor.replaceSelection(text)
|
||||
@image_picker_view.close()
|
||||
|
||||
|
@ -15,12 +15,7 @@ class Locomotive.Views.ThemeAssets.ImagePickerView extends Locomotive.Views.Shar
|
||||
ich.theme_image_picker
|
||||
|
||||
fetch_assets: ->
|
||||
@_reset()
|
||||
@collection.fetch
|
||||
data:
|
||||
content_type: 'image'
|
||||
success: () =>
|
||||
@open()
|
||||
@collection.fetch data: { content_type: 'image' }
|
||||
|
||||
build_uploader: (el, link) ->
|
||||
link.bind 'click', (event) ->
|
||||
@ -42,7 +37,4 @@ class Locomotive.Views.ThemeAssets.ImagePickerView extends Locomotive.Views.Shar
|
||||
|
||||
add_asset: (asset) ->
|
||||
@$('ul.list').append(ich.theme_asset(asset.toJSON()))
|
||||
@_refresh()
|
||||
|
||||
_reset: ->
|
||||
@$('ul.list').empty()
|
||||
@_refresh()
|
@ -7,7 +7,7 @@ class Locomotive.Views.ThemeAssets.IndexView extends Backbone.View
|
||||
_lists_views: []
|
||||
|
||||
initialize: ->
|
||||
_.bindAll(@, 'insert_asset')
|
||||
_.bindAll(@, 'add_asset')
|
||||
|
||||
render: ->
|
||||
@build_uploader()
|
||||
@ -29,24 +29,16 @@ class Locomotive.Views.ThemeAssets.IndexView extends Backbone.View
|
||||
input = form.find('input[type=file]')
|
||||
link = form.find('a.new')
|
||||
|
||||
form.formSubmitNotification()
|
||||
|
||||
link.bind 'click', (event) ->
|
||||
event.stopPropagation() & event.preventDefault()
|
||||
input.click()
|
||||
|
||||
input.bind 'change', (event) =>
|
||||
form.trigger('ajax:beforeSend')
|
||||
_.each event.target.files, (file) =>
|
||||
asset = new Locomotive.Models.ThemeAsset(source: file)
|
||||
asset.save {},
|
||||
success: (model, response, xhr) =>
|
||||
form.trigger('ajax:complete')
|
||||
@insert_asset(model)
|
||||
error: (() => form.trigger('ajax:complete'))
|
||||
headers: { 'X-Flash': true }
|
||||
asset.save {}, success: @add_asset, headers: { 'X-Flash': true }
|
||||
|
||||
insert_asset: (model) ->
|
||||
add_asset: (model) ->
|
||||
list_view = @pick_list_view(model.get('content_type'))
|
||||
list_view.collection.add(model)
|
||||
|
||||
|
@ -43,16 +43,13 @@
|
||||
'collection': new Locomotive.Models.ContentAssetsCollection()
|
||||
});
|
||||
|
||||
view.render();
|
||||
|
||||
// Register commands
|
||||
ed.addCommand('locomotiveMedia', function() {
|
||||
view.options.on_select = function(asset) {
|
||||
insertImage(ed, asset);
|
||||
view.close();
|
||||
}
|
||||
|
||||
view.fetch_assets();
|
||||
view.render();
|
||||
});
|
||||
|
||||
// Register buttons
|
||||
|
@ -33,6 +33,24 @@
|
||||
|
||||
/* ___ list ___ */
|
||||
|
||||
p.no-items {
|
||||
background: #fffbe6;
|
||||
border: 5px solid #eee3a8;
|
||||
@include border-radius(25px);
|
||||
|
||||
padding: 15px 0px;
|
||||
|
||||
text-align: center;
|
||||
color: #9d8963;
|
||||
font-size: 16px !important;
|
||||
@include single-text-shadow(rgba(255, 255, 255, 1), 1px, 1px, 1px);
|
||||
|
||||
a {
|
||||
@include hover-link;
|
||||
color: #ff2900;
|
||||
}
|
||||
}
|
||||
|
||||
ul.list {
|
||||
background: #fff;
|
||||
list-style: none;
|
||||
@ -296,29 +314,6 @@ ul.list {
|
||||
}
|
||||
}
|
||||
|
||||
/* ___ form notification ___ */
|
||||
|
||||
#form-submit-notification {
|
||||
position: fixed;
|
||||
top: 0px;
|
||||
right: 0px;
|
||||
z-index: 9999;
|
||||
|
||||
> div {
|
||||
padding: 5px 10px;
|
||||
|
||||
background-color: #fffbe5;
|
||||
border-left: 4px solid #efe4a5;
|
||||
border-bottom: 4px solid #efe4a5;
|
||||
|
||||
text-align: center;
|
||||
@include single-text-shadow(rgba(255, 255, 255, 1), 0px, 1px, 0px);
|
||||
font-weight: bold;
|
||||
font-size: 12px;
|
||||
color: #aa9a79;
|
||||
}
|
||||
}
|
||||
|
||||
/* ___ paragraph (for help for example) ___ */
|
||||
|
||||
p span.code {
|
||||
@ -328,3 +323,19 @@ p span.code {
|
||||
color: #8B8D9A;
|
||||
@include single-text-shadow(#fff, 0px, 0px, 1px);
|
||||
}
|
||||
|
||||
/* ___ quick upload ___ */
|
||||
|
||||
form.quick-upload {
|
||||
display: inline;
|
||||
|
||||
input[type=file] {
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -7,7 +7,6 @@
|
||||
|
||||
font-size: 13px;
|
||||
font-weight: normal;
|
||||
line-height: 15px;
|
||||
|
||||
@include background-image(linear-gradient(top, #f0f0f0, #f9f9f9 4px, #f9f9f9 4px, #ffffff 12px, #ffffff));
|
||||
|
||||
|
@ -6,10 +6,6 @@
|
||||
|
||||
ul.content-assets {
|
||||
|
||||
list-style: none;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
|
||||
li.asset {
|
||||
position: relative;
|
||||
float: left;
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
width: auto;
|
||||
|
||||
z-index: 1001 !important;
|
||||
z-index: 999 !important;
|
||||
|
||||
background: #f1f1f1;
|
||||
|
||||
|
@ -60,7 +60,7 @@
|
||||
|
||||
.ui-dialog-content {
|
||||
position: relative;
|
||||
z-index: 1200;
|
||||
z-index: 999;
|
||||
|
||||
text-align: left;
|
||||
|
||||
@ -84,12 +84,6 @@
|
||||
width: 530px;
|
||||
}
|
||||
} // li.string
|
||||
|
||||
li.date {
|
||||
input[type=text] {
|
||||
width: 90px;
|
||||
}
|
||||
} // li.string
|
||||
}
|
||||
}
|
||||
} // .form.formtastic
|
||||
@ -124,14 +118,14 @@
|
||||
top: 8px;
|
||||
right: 10px;
|
||||
|
||||
z-index: 1203;
|
||||
z-index: 1003;
|
||||
|
||||
a, input[type=submit] {
|
||||
@include light-button;
|
||||
}
|
||||
|
||||
input[type=file] {
|
||||
z-index: 1203;
|
||||
z-index: 1003;
|
||||
}
|
||||
|
||||
} // .button-wrapper
|
||||
|
@ -157,10 +157,6 @@ form.formtastic {
|
||||
&:hover {
|
||||
background-image: image-url("locomotive/list/icons/toggle.png");
|
||||
}
|
||||
&.open {
|
||||
@include rotate(180deg);
|
||||
}
|
||||
@include single-transition(transform, 0.5s);
|
||||
}
|
||||
|
||||
&.drag {
|
||||
@ -295,17 +291,6 @@ form.formtastic {
|
||||
}
|
||||
} // li.string, li.password
|
||||
|
||||
&.text {
|
||||
|
||||
&.short textarea {
|
||||
padding: 5px;
|
||||
height: 28px;
|
||||
width: 696px;
|
||||
overflow-y: hidden;
|
||||
}
|
||||
|
||||
} // li.text
|
||||
|
||||
&.locale, &.locales {
|
||||
.list {
|
||||
margin-left: 150px;
|
||||
@ -421,10 +406,8 @@ form.formtastic {
|
||||
}
|
||||
|
||||
&.no-label {
|
||||
padding-top: 12px;
|
||||
|
||||
> textarea, .CodeMirror, .CodeMirror-scroll {
|
||||
margin-top: 0px;
|
||||
margin-top: 12px;
|
||||
width: 868px;
|
||||
}
|
||||
}
|
||||
|
@ -176,7 +176,7 @@ body {
|
||||
}
|
||||
}
|
||||
|
||||
input[type=submit], button[type=submit] {
|
||||
input[type=submit] {
|
||||
@include light-button;
|
||||
}
|
||||
|
||||
|
@ -3,10 +3,7 @@
|
||||
* and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
|
||||
* the top of the compiled file, but it's generally better to create a new file per style scope.
|
||||
*= require locomotive/blueprint/screen.css
|
||||
*= require locomotive/jquery
|
||||
*= require locomotive/toggle.css
|
||||
*= require locomotive/backoffice/dialog_changes.css
|
||||
*= require locomotive/backoffice/content_assets.css
|
||||
*= require_tree ./shared
|
||||
*= require_tree ./inline_editor
|
||||
*/
|
@ -1,34 +0,0 @@
|
||||
@import "compass/css3/border-radius";
|
||||
@import "compass/css3/text-shadow";
|
||||
@import "locomotive/shared/helpers";
|
||||
|
||||
/* ___ quick upload ___ */
|
||||
|
||||
form.quick-upload {
|
||||
display: inline;
|
||||
|
||||
input[type=file] {
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* ___ list ___ */
|
||||
|
||||
p.no-items {
|
||||
background: #fffbe6;
|
||||
border: 5px solid #eee3a8;
|
||||
@include border-radius(25px);
|
||||
|
||||
padding: 15px 0px;
|
||||
|
||||
text-align: center;
|
||||
color: #9d8963;
|
||||
font-size: 16px !important;
|
||||
@include single-text-shadow(rgba(255, 255, 255, 1), 1px, 1px, 1px);
|
||||
|
||||
a {
|
||||
@include hover-link;
|
||||
color: #ff2900;
|
||||
}
|
||||
}
|
@ -24,7 +24,7 @@ module Locomotive
|
||||
add :switch, :url => '#', :id => 'sites-picker-link'
|
||||
end
|
||||
|
||||
add :help, :url => 'http://doc.locomotivecms.com/templates/basics', :class => 'tutorial', :id => 'help'
|
||||
add :help, :url => '#', :class => 'tutorial', :id => 'help'
|
||||
add :logout, :url => destroy_locomotive_session_url, :confirm => t('locomotive.messages.confirm'), :method => :delete
|
||||
end
|
||||
|
||||
|
@ -7,13 +7,15 @@ module Locomotive
|
||||
|
||||
skip_before_filter :verify_authenticity_token
|
||||
|
||||
skip_load_and_authorize_resource
|
||||
|
||||
before_filter :require_account
|
||||
|
||||
before_filter :require_site
|
||||
|
||||
before_filter :set_locale
|
||||
|
||||
before_filter :set_current_thread_variables
|
||||
# before_filter :validate_site_membership
|
||||
|
||||
self.responder = Locomotive::ActionController::Responder # custom responder
|
||||
|
||||
@ -21,11 +23,6 @@ module Locomotive
|
||||
|
||||
protected
|
||||
|
||||
def set_current_thread_variables
|
||||
Thread.current[:account] = current_locomotive_account
|
||||
Thread.current[:site] = current_site
|
||||
end
|
||||
|
||||
def current_ability
|
||||
@current_ability ||= Ability.new(current_locomotive_account, current_site)
|
||||
end
|
||||
@ -43,4 +40,4 @@ module Locomotive
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -2,18 +2,11 @@ module Locomotive
|
||||
module Api
|
||||
class ContentAssetsController < BaseController
|
||||
|
||||
load_and_authorize_resource :class => Locomotive::ContentAsset
|
||||
|
||||
def index
|
||||
@content_assets = current_site.content_assets
|
||||
respond_with(@content_assets)
|
||||
end
|
||||
|
||||
def show
|
||||
@content_asset = current_site.content_assets.find(params[:id])
|
||||
respond_with(@content_asset)
|
||||
end
|
||||
|
||||
def create
|
||||
@content_asset = current_site.content_assets.create(params[:content_asset])
|
||||
respond_with @content_asset, :location => main_app.locomotive_api_content_assets_url
|
||||
@ -25,12 +18,6 @@ module Locomotive
|
||||
respond_with @content_asset, :location => main_app.locomotive_api_content_assets_url
|
||||
end
|
||||
|
||||
def destroy
|
||||
@content_asset = current_site.content_assets.find(params[:id])
|
||||
@content_asset.destroy
|
||||
respond_with @content_asset
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -2,18 +2,11 @@ module Locomotive
|
||||
module Api
|
||||
class ContentTypesController < BaseController
|
||||
|
||||
load_and_authorize_resource :class => Locomotive::ContentType
|
||||
|
||||
def index
|
||||
@content_types = current_site.content_types.order_by([[:name, :asc]])
|
||||
@content_types = current_site.content_types
|
||||
respond_with(@content_types)
|
||||
end
|
||||
|
||||
def show
|
||||
@content_type = current_site.content_types.find(params[:id])
|
||||
respond_with @content_type
|
||||
end
|
||||
|
||||
def create
|
||||
@content_type = current_site.content_types.create(params[:content_type])
|
||||
respond_with @content_type, :location => main_app.locomotive_api_content_types_url
|
||||
@ -25,12 +18,6 @@ module Locomotive
|
||||
respond_with @content_type, :location => main_app.locomotive_api_content_types_url
|
||||
end
|
||||
|
||||
def destroy
|
||||
@content_type = current_site.content_types.find(params[:id])
|
||||
@content_type.destroy
|
||||
respond_with @content_type
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -3,9 +3,7 @@ module Locomotive
|
||||
class CurrentSiteController < BaseController
|
||||
|
||||
def show
|
||||
@site = current_site
|
||||
authorize! :show, @site
|
||||
respond_with(@site)
|
||||
respond_with(current_site)
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -1,49 +0,0 @@
|
||||
module Locomotive
|
||||
module Api
|
||||
class MembershipsController < BaseController
|
||||
|
||||
# It's an embedded document, so we'll just load manually
|
||||
before_filter :load_membership, :only => [ :show, :update, :destroy ]
|
||||
before_filter :load_memberships, :only => [ :index ]
|
||||
|
||||
authorize_resource :class => Locomotive::Membership
|
||||
|
||||
def index
|
||||
respond_with(@memberships)
|
||||
end
|
||||
|
||||
def show
|
||||
respond_with(@membership)
|
||||
end
|
||||
|
||||
def create
|
||||
build_params = params[:membership].merge({ :role => 'author' }) # force author by default
|
||||
@membership = current_site.memberships.create(build_params)
|
||||
respond_with(@membership)
|
||||
end
|
||||
|
||||
def update
|
||||
@membership.update_attributes(params[:membership])
|
||||
respond_with(@membership)
|
||||
end
|
||||
|
||||
def destroy
|
||||
@membership.destroy
|
||||
respond_with(@membership)
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def load_membership
|
||||
@membership ||= load_memberships.find(params[:id])
|
||||
end
|
||||
|
||||
def load_memberships
|
||||
@memberships ||= current_site.memberships
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
@ -2,18 +2,11 @@ module Locomotive
|
||||
module Api
|
||||
class PagesController < BaseController
|
||||
|
||||
load_and_authorize_resource :class => Locomotive::Page
|
||||
|
||||
def index
|
||||
@pages = current_site.pages.order_by([[:depth, :asc], [:position, :asc]])
|
||||
@pages = current_site.pages.all
|
||||
respond_with(@pages)
|
||||
end
|
||||
|
||||
def show
|
||||
@page = current_site.pages.find(params[:id])
|
||||
respond_with(@page)
|
||||
end
|
||||
|
||||
def create
|
||||
@page = current_site.pages.create(params[:page])
|
||||
respond_with @page, :location => main_app.locomotive_api_pages_url
|
||||
@ -25,12 +18,6 @@ module Locomotive
|
||||
respond_with @page, :location => main_app.locomotive_api_pages_url
|
||||
end
|
||||
|
||||
def destroy
|
||||
@page = current_site.pages.find(params[:id])
|
||||
@page.destroy
|
||||
respond_with @page
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -1,44 +0,0 @@
|
||||
module Locomotive
|
||||
module Api
|
||||
class SitesController < BaseController
|
||||
|
||||
load_and_authorize_resource :class => Locomotive::Site
|
||||
|
||||
# FIXME: the auto-loaded site won't pass authorization for show, update, or destroy
|
||||
skip_load_and_authorize_resource :only => [ :show, :update, :destroy ]
|
||||
|
||||
def index
|
||||
@sites = Locomotive::Site.all
|
||||
respond_with(@sites)
|
||||
end
|
||||
|
||||
def show
|
||||
@site = Locomotive::Site.find(params[:id])
|
||||
authorize! :show, @site
|
||||
respond_with(@site)
|
||||
end
|
||||
|
||||
def create
|
||||
@site = Locomotive::Site.create(params[:site])
|
||||
respond_with(@site)
|
||||
end
|
||||
|
||||
def update
|
||||
@site = Locomotive::Site.find(params[:id])
|
||||
authorize! :update, @site
|
||||
@site.update_attributes(params[:site])
|
||||
respond_with @site
|
||||
end
|
||||
|
||||
def destroy
|
||||
@site = Locomotive::Site.find(params[:id])
|
||||
authorize! :destroy, @site
|
||||
@site.destroy
|
||||
respond_with @site
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
@ -2,18 +2,11 @@ module Locomotive
|
||||
module Api
|
||||
class SnippetsController < BaseController
|
||||
|
||||
load_and_authorize_resource :class => Locomotive::Snippet
|
||||
|
||||
def index
|
||||
@snippets = current_site.snippets.order_by([[:name, :asc]])
|
||||
@snippets = current_site.snippets.all
|
||||
respond_with(@snippets)
|
||||
end
|
||||
|
||||
def show
|
||||
@snippet = current_site.snippets.find(params[:id])
|
||||
respond_with @snippet
|
||||
end
|
||||
|
||||
def create
|
||||
@snippet = current_site.snippets.create(params[:snippet])
|
||||
respond_with @snippet, :location => main_app.locomotive_api_snippets_url
|
||||
@ -25,12 +18,6 @@ module Locomotive
|
||||
respond_with @snippet, :location => main_app.locomotive_api_snippets_url
|
||||
end
|
||||
|
||||
def destroy
|
||||
@snippet = current_site.snippets.find(params[:id])
|
||||
@snippet.destroy
|
||||
respond_with @snippet
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -2,18 +2,11 @@ module Locomotive
|
||||
module Api
|
||||
class ThemeAssetsController < BaseController
|
||||
|
||||
load_and_authorize_resource :class => Locomotive::ThemeAsset
|
||||
|
||||
def index
|
||||
@theme_assets = current_site.theme_assets.all
|
||||
respond_with(@theme_assets)
|
||||
end
|
||||
|
||||
def show
|
||||
@theme_asset = current_site.theme_assets.find(params[:id])
|
||||
respond_with @theme_asset
|
||||
end
|
||||
|
||||
def create
|
||||
@theme_asset = current_site.theme_assets.create(params[:theme_asset])
|
||||
respond_with @theme_asset, :location => main_app.locomotive_api_theme_assets_url
|
||||
@ -25,12 +18,6 @@ module Locomotive
|
||||
respond_with @theme_asset, :location => main_app.locomotive_api_theme_assets_url
|
||||
end
|
||||
|
||||
def destroy
|
||||
@theme_asset = current_site.theme_assets.find(params[:id])
|
||||
@theme_asset.destroy
|
||||
respond_with @theme_asset
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -6,7 +6,7 @@ module Locomotive
|
||||
|
||||
before_filter :sanitize_entry_params, :only => :create
|
||||
|
||||
skip_load_and_authorize_resource
|
||||
skip_before_filter :verify_authenticity_token
|
||||
|
||||
self.responder = Locomotive::ActionController::PublicResponder # custom responder
|
||||
|
||||
@ -45,13 +45,6 @@ module Locomotive
|
||||
end
|
||||
end
|
||||
|
||||
def handle_unverified_request
|
||||
if Locomotive.config.csrf_protection
|
||||
reset_session
|
||||
redirect_to '/', :status => 302
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -27,10 +27,6 @@ module Locomotive
|
||||
end
|
||||
|
||||
visible << content_type
|
||||
|
||||
end.each do |content_type|
|
||||
# make sure to have a fresh copy of the content types because for now we don't have the full content types (ie: content_types.only(...))
|
||||
::Mongoid::IdentityMap.remove(content_type)
|
||||
end
|
||||
|
||||
if visible.size > 0
|
||||
|
@ -44,7 +44,7 @@ module Locomotive
|
||||
|
||||
def options_for_content_type
|
||||
current_site.content_types.map do |c|
|
||||
[c.name, c.klass_with_custom_fields(:entries).to_s]
|
||||
c != @content_type ? [c.name, c.klass_with_custom_fields(:entries).to_s] : nil
|
||||
end.compact
|
||||
end
|
||||
|
||||
|
@ -4,7 +4,7 @@ module Locomotive
|
||||
default :from => Locomotive.config.mailer_sender
|
||||
|
||||
def new_content_entry(account, entry)
|
||||
@account, @entry, @type = account, entry, entry.content_type
|
||||
@account, @entry, @type = account, entry.to_presenter, entry.content_type
|
||||
|
||||
subject = t('locomotive.notifications.new_content_entry.subject', :type => @type.name, :locale => account.locale)
|
||||
|
||||
|
@ -37,8 +37,6 @@ module Locomotive
|
||||
can :touch, Site do |site|
|
||||
site == @site
|
||||
end
|
||||
|
||||
can :read, ContentType
|
||||
end
|
||||
|
||||
def setup_designer_permissions!
|
||||
|
@ -5,20 +5,6 @@ module Locomotive
|
||||
|
||||
devise *Locomotive.config.devise_modules
|
||||
|
||||
## devise fields (need to be declared since 2.x) ##
|
||||
field :remember_created_at, :type => Time
|
||||
field :email, :type => String, :null => false
|
||||
field :encrypted_password, :type => String, :null => false
|
||||
field :authentication_token, :type => String
|
||||
field :reset_password_token, :type => String
|
||||
field :reset_password_sent_at, :type => Time
|
||||
field :password_salt, :type => String
|
||||
field :sign_in_count, :type => Integer
|
||||
field :current_sign_in_at, :type => Time
|
||||
field :last_sign_in_at, :type => Time
|
||||
field :current_sign_in_ip, :type => String
|
||||
field :last_sign_in_ip, :type => String
|
||||
|
||||
## attributes ##
|
||||
field :name
|
||||
field :locale, :default => Locomotive.config.default_locale.to_s or 'en'
|
||||
|
@ -45,11 +45,9 @@ module Locomotive
|
||||
self.send((type || self.content_type).label_field_name.to_sym)
|
||||
end
|
||||
|
||||
value.respond_to?(:to_label) ? value.to_label : value.to_s
|
||||
value.respond_to?(:to_label) ? value.to_label : value
|
||||
end
|
||||
|
||||
alias :to_label :_label
|
||||
|
||||
def translated?
|
||||
if self.respond_to?(:"#{self._label_field_name}_translations")
|
||||
self.send(:"#{self._label_field_name}_translations").key?(::Mongoid::Fields::I18n.locale.to_s) #rescue false
|
||||
@ -88,7 +86,7 @@ module Locomotive
|
||||
end
|
||||
|
||||
def as_json(options = {})
|
||||
self.to_presenter(options).as_json
|
||||
self.to_presenter.as_json
|
||||
end
|
||||
|
||||
protected
|
||||
@ -148,7 +146,7 @@ module Locomotive
|
||||
return if !self.content_type.public_submission_enabled? || self.content_type.public_submission_accounts.blank?
|
||||
|
||||
self.site.accounts.each do |account|
|
||||
next unless self.content_type.public_submission_accounts.map(&:to_s).include?(account._id.to_s)
|
||||
next unless self.content_type.public_submission_accounts.include?(account._id)
|
||||
|
||||
Locomotive::Notifications.new_content_entry(account, self).deliver
|
||||
end
|
||||
|
@ -84,13 +84,6 @@ module Locomotive
|
||||
self.class.class_name_to_content_type(class_name, self.site)
|
||||
end
|
||||
|
||||
def label_field_id=(value)
|
||||
# update the label_field_name if the label_field_id is changed
|
||||
new_label_field_name = self.entries_custom_fields.where(:_id => value).first.try(:name)
|
||||
self.label_field_name = new_label_field_name
|
||||
super(value)
|
||||
end
|
||||
|
||||
def label_field_name=(value)
|
||||
# mandatory if we allow the API to set the label field name without an id of the field
|
||||
@new_label_field_name = value unless value.blank?
|
||||
|
@ -27,7 +27,7 @@ module Locomotive
|
||||
|
||||
def set_label_field
|
||||
if @new_label_field_name.present?
|
||||
self.label_field_id = self.entries_custom_fields.detect { |f| f.name == @new_label_field_name.underscore }.try(:_id)
|
||||
self.label_field_id = self.entries_custom_fields.detect { |f| f.name == @new_label_field_name.underscore }._id
|
||||
end
|
||||
|
||||
# unknown label_field_name, get the first one instead
|
||||
|
@ -71,11 +71,6 @@ module Locomotive
|
||||
new_el.copy_attributes_from(el)
|
||||
else
|
||||
existing_el.disabled = false
|
||||
|
||||
# only the type and hint properties can be modified from the parent element
|
||||
%w(_type hint).each do |attr|
|
||||
existing_el.send(:"#{attr}=", el.send(attr.to_sym))
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -9,7 +9,7 @@ module Locomotive
|
||||
|
||||
## fields ##
|
||||
field :redirect, :type => Boolean, :default => false
|
||||
field :redirect_url, :type => String, :localize => true
|
||||
field :redirect_url, :type => String
|
||||
|
||||
## validations ##
|
||||
validates_presence_of :redirect_url, :if => :redirect
|
||||
|
@ -19,14 +19,11 @@ module Locomotive
|
||||
## indexes ##
|
||||
index :position
|
||||
index [[:depth, Mongo::ASCENDING], [:position, Mongo::ASCENDING]]
|
||||
|
||||
alias_method_chain :rearrange, :identity_map
|
||||
alias_method_chain :rearrange_children, :identity_map
|
||||
end
|
||||
|
||||
module ClassMethods
|
||||
|
||||
# Returns the tree of pages from the site with the most minimal amount of queries.
|
||||
# Returns the pages tree from the site with the most minimal amount of queries.
|
||||
# This method should only be used for read-only purpose since
|
||||
# the mongodb returns the minimal set of required attributes to build
|
||||
# the tree.
|
||||
@ -104,16 +101,6 @@ module Locomotive
|
||||
|
||||
protected
|
||||
|
||||
def rearrange_with_identity_map
|
||||
::Mongoid::IdentityMap.clear
|
||||
rearrange_without_identity_map
|
||||
end
|
||||
|
||||
def rearrange_children_with_identity_map
|
||||
self.children.reset
|
||||
rearrange_children_without_identity_map
|
||||
end
|
||||
|
||||
def persist_depth
|
||||
self.attributes['depth'] = self.depth
|
||||
self.depth_will_change!
|
||||
|
@ -10,12 +10,8 @@ module Locomotive
|
||||
## fields ##
|
||||
field :locales, :type => 'RawArray', :default => []
|
||||
|
||||
## validations ##
|
||||
validate :can_not_remove_default_locale
|
||||
|
||||
## callbacks ##
|
||||
after_validation :add_default_locale
|
||||
before_update :verify_localized_default_pages_integrity
|
||||
after_validation :add_default_locale
|
||||
|
||||
end
|
||||
|
||||
@ -52,10 +48,6 @@ module Locomotive
|
||||
self.locales.first || Locomotive.config.site_locales.first
|
||||
end
|
||||
|
||||
def default_locale_was
|
||||
self.locales_was.first || Locomotive.config.site_locales.first
|
||||
end
|
||||
|
||||
def locale_fallbacks(locale)
|
||||
[locale.to_s] + (locales - [locale.to_s])
|
||||
end
|
||||
@ -66,29 +58,6 @@ module Locomotive
|
||||
self.locales = [Locomotive.config.site_locales.first] if self.locales.blank?
|
||||
end
|
||||
|
||||
def can_not_remove_default_locale
|
||||
if self.persisted? && !self.locales.include?(self.default_locale_was)
|
||||
self.errors.add :locales, I18n.t(:default_locale_removed, :scope => [:errors, :messages, :site])
|
||||
end
|
||||
end
|
||||
|
||||
def verify_localized_default_pages_integrity
|
||||
if self.persisted? && self.locales_changed?
|
||||
self.pages.where(:"slug.#{self.default_locale_was}".in => %w(index 404), :depth => 0).each do |page|
|
||||
modifications = { 'title' => {}, 'slug' => {} }
|
||||
|
||||
self.locales.each do |locale|
|
||||
slug = page.attributes['slug'][self.default_locale_was]
|
||||
|
||||
modifications['slug'][locale] = slug
|
||||
modifications['title'][locale] = page.attributes['title'][locale] || ::I18n.t("attributes.defaults.pages.#{slug}.title", :locale => locale)
|
||||
end
|
||||
|
||||
page.collection.update({ :_id => page._id }, { '$set' => modifications })
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -52,7 +52,7 @@ module Locomotive
|
||||
scope :published, :where => { :published => true }
|
||||
scope :fullpath, lambda { |fullpath| { :where => { :fullpath => fullpath } } }
|
||||
scope :handle, lambda { |handle| { :where => { :handle => handle } } }
|
||||
scope :minimal_attributes, lambda { |attrs = []| { :only => (attrs || []) + %w(title slug fullpath position depth published templatized redirect listed response_type parent_id parent_ids site_id created_at updated_at) } }
|
||||
scope :minimal_attributes, lambda { |attrs = []| { :only => (attrs || []) + %w(title slug fullpath position depth published templatized redirect listed response_type parent_id site_id created_at updated_at) } }
|
||||
scope :dependent_from, lambda { |id| { :where => { :template_dependencies.in => [id] } } }
|
||||
|
||||
## methods ##
|
||||
|
@ -54,12 +54,8 @@ module Locomotive
|
||||
Locomotive::Liquid::Drops::Site.new(self)
|
||||
end
|
||||
|
||||
def to_presenter(options = {})
|
||||
Locomotive::SitePresenter.new(self, options)
|
||||
end
|
||||
|
||||
def as_json(options = {})
|
||||
self.to_presenter(options).as_json
|
||||
Locomotive::SitePresenter.new(self, options).as_json
|
||||
end
|
||||
|
||||
protected
|
||||
|
@ -145,7 +145,7 @@ module Locomotive
|
||||
def escape_shortcut_urls(text)
|
||||
return if text.blank?
|
||||
|
||||
text.gsub(/[("'](\/(stylesheets|javascripts|images|media)\/(([^;.]+)\/)*([a-zA-Z_\-0-9]+)\.[a-z]{2,3})[)"']/) do |path|
|
||||
text.gsub(/[("'](\/(stylesheets|javascripts|images|media)\/(([^;.]+)\/)*([a-z_\-0-9]+)\.[a-z]{2,3})[)"']/) do |path|
|
||||
|
||||
sanitized_path = path.gsub(/[("')]/, '').gsub(/^\//, '')
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
module Locomotive
|
||||
class ContentAssetPresenter < BasePresenter
|
||||
|
||||
delegate :content_type, :width, :height, :vignette_url, :to => :source
|
||||
delegate :content_type, :vignette_url, :to => :source
|
||||
|
||||
def full_filename
|
||||
self.source.source_filename
|
||||
@ -29,7 +29,7 @@ module Locomotive
|
||||
end
|
||||
|
||||
def included_methods
|
||||
super + %w(full_filename filename short_name extname content_type content_type_text url vignette_url width height)
|
||||
super + %w(full_filename filename short_name extname content_type content_type_text url vignette_url)
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -1,7 +1,7 @@
|
||||
module Locomotive
|
||||
class MembershipPresenter < BasePresenter
|
||||
|
||||
delegate :role, :account_id, :to => :source
|
||||
delegate :role, :to => :source
|
||||
|
||||
def name
|
||||
self.source.account.name
|
||||
@ -26,13 +26,8 @@ module Locomotive
|
||||
end
|
||||
|
||||
def included_methods
|
||||
super + %w(account_id name email role role_name can_update grant_admin)
|
||||
super + %w(name email role role_name can_update grant_admin)
|
||||
end
|
||||
|
||||
# def light_as_json
|
||||
# methods = included_methods.clone - %w(name email)
|
||||
# self.as_json(methods)
|
||||
# end
|
||||
|
||||
end
|
||||
end
|
@ -15,10 +15,5 @@ module Locomotive
|
||||
super + %w(name locales domain_name subdomain domains robots_txt seo_title meta_keywords meta_description domains_without_subdomain memberships)
|
||||
end
|
||||
|
||||
def as_json_for_html_view
|
||||
methods = included_methods.clone - %w(memberships)
|
||||
self.as_json(methods)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
@ -11,9 +11,9 @@
|
||||
= link_to t('locomotive.buttons.close'), '#', :id => 'close-link'
|
||||
|
||||
.button-wrapper.upload
|
||||
= form_tag content_assets_url(:json), :class => 'quick-upload' do
|
||||
= file_field_tag 'content_asset[source]', :multiple => 'multiple'
|
||||
= link_to t('locomotive.content_assets.image_picker.upload'), content_assets_url(:json), :class => 'new', :id => 'upload-link'
|
||||
= form_tag theme_assets_url(:json), :class => 'quick-upload' do
|
||||
= file_field_tag 'theme_asset[source]', :multiple => 'multiple'
|
||||
= link_to t('locomotive.theme_assets.image_picker.upload'), theme_assets_url(:json), :class => 'new', :id => 'upload-link'
|
||||
|
||||
%script{ :type => 'text/html', :id => 'content_asset' }
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
- content_for :backbone_view_data do
|
||||
:plain
|
||||
content_entry: #{j @content_entry.to_json.html_safe}
|
||||
content_entry: #{@content_entry.to_json}
|
||||
|
||||
= f.inputs :name => :attributes do
|
||||
- @content_type.ordered_entries_custom_fields.each_with_index do |field, index|
|
||||
|
@ -3,8 +3,8 @@
|
||||
|
||||
- content_for :backbone_view_data do
|
||||
:plain
|
||||
content_type: #{j @content_type.persisted? ? @content_type.to_json.html_safe : 'null'},
|
||||
inverse_of_list: #{j options_for_content_type_inverse_of.to_json.html_safe}
|
||||
content_type: #{@content_type.persisted? ? @content_type.to_json : 'null'},
|
||||
inverse_of_list: #{options_for_content_type_inverse_of.to_json}
|
||||
|
||||
= f.inputs :name => :information do
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
- content_for :backbone_view_data do
|
||||
:plain
|
||||
site: #{j @site.to_json(:current_account => current_locomotive_account, :current_site => current_site).html_safe},
|
||||
site: #{@site.to_json(:current_account => current_locomotive_account, :current_site => current_site)},
|
||||
errors: #{@site.errors.to_json}
|
||||
|
||||
= f.inputs :name => :information do
|
||||
|
@ -1,10 +1,10 @@
|
||||
- if field.ui_enabled?
|
||||
- target_content_type = Locomotive::ContentType.class_name_to_content_type(field.class_name, current_site)
|
||||
|
||||
= f.input name.to_sym,
|
||||
:label => field.label,
|
||||
:hint => field.hint,
|
||||
:as => :'Locomotive::Empty',
|
||||
= f.input name.to_sym,
|
||||
:label => field.label,
|
||||
:hint => field.hint,
|
||||
:as => :'Locomotive::Empty',
|
||||
:wrapper_html => { :id => "content_entry_#{name}_input", :class => 'empty relationship input' }
|
||||
|
||||
- content_for :head do
|
||||
@ -38,4 +38,4 @@
|
||||
|
||||
- content_for :backbone_view_data do
|
||||
:plain
|
||||
, all_#{name}_entries: #{j target_content_type.list_or_group_entries.to_json(:depth => 1).html_safe}
|
||||
, all_#{name}_entries: #{target_content_type.list_or_group_entries.to_json}
|
@ -2,7 +2,7 @@
|
||||
|
||||
- content_for :backbone_view_data do
|
||||
:plain
|
||||
account: #{j @account.to_json.html_safe}
|
||||
account: #{@account.to_json}
|
||||
|
||||
- content_for :submenu do
|
||||
= render_cell 'locomotive/settings_menu', :show
|
||||
|
@ -10,20 +10,13 @@
|
||||
%hr
|
||||
|
||||
%ul
|
||||
- @type.ordered_entries_custom_fields.each do |field|
|
||||
- value = @entry.send(field.name)
|
||||
- @type.entries_custom_fields.each do |field|
|
||||
- value = @entry.value_for(field)
|
||||
%li
|
||||
%strong= field.label
|
||||
-
|
||||
%i
|
||||
- case field.type.to_s
|
||||
- when 'string', 'text', 'boolean', 'date'
|
||||
- if field.type == 'file'
|
||||
= link_to File.basename(value), value
|
||||
- else
|
||||
= value
|
||||
- when 'file'
|
||||
= link_to File.basename(value.to_s), value.to_s
|
||||
- when 'select'
|
||||
= value
|
||||
- when 'belongs_to'
|
||||
= value.try(:_label)
|
||||
- when 'has_many', 'many_to_many'
|
||||
= value.map(&:_label).join(', ')
|
@ -5,7 +5,7 @@
|
||||
|
||||
- content_for :backbone_view_data do
|
||||
:plain
|
||||
page: #{j @page.to_presenter.as_json_for_html_view.to_json.html_safe}
|
||||
page: #{@page.to_presenter.as_json_for_html_view.to_json}
|
||||
|
||||
- if can?(:manage, @page)
|
||||
|
||||
@ -36,7 +36,7 @@
|
||||
|
||||
= f.input :templatized, :as => :'Locomotive::Toggle', :style => "#{'display: none' if @page.redirect? || @page.templatized_from_parent?}"
|
||||
|
||||
= f.input :target_klass_name, :as => :select, :collection => options_for_target_klass_name, :include_blank => false, :wrapper_html => { :style => "#{'display: none' if !@page.templatized? || @page.templatized_from_parent?}" }
|
||||
= f.input :target_klass_name, :as => :select, :collection => options_for_target_klass_name, :include_blank => false, :wrapper_html => { :style => "#{'display: none' unless @page.templatized? && !@page.templatized_from_parent?}" }
|
||||
|
||||
= f.input :published, :as => :'Locomotive::Toggle'
|
||||
|
||||
|
@ -20,18 +20,16 @@
|
||||
window.content_locale = '#{::Mongoid::Fields::I18n.locale}';
|
||||
|
||||
Locomotive.mounted_on = '#{Locomotive.mounted_on}';
|
||||
Locomotive.current_site = new Locomotive.Models.Site(#{j current_site.to_json.html_safe});
|
||||
Locomotive.current_account = new Locomotive.Models.Account(#{j current_locomotive_account.to_json.html_safe});
|
||||
Locomotive.current_site = new Locomotive.Models.Site(#{current_site.to_json});
|
||||
Locomotive.current_account = new Locomotive.Models.Account(#{current_locomotive_account.to_json});
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
window.application_view = new Locomotive.Views.InlineEditor.ApplicationView();
|
||||
window.application_view = new Locomotive.Views.InlinEditor.ApplicationView();
|
||||
window.application_view.render();
|
||||
|
||||
});
|
||||
|
||||
= render '/locomotive/content_assets/picker'
|
||||
|
||||
%body
|
||||
#page
|
||||
%iframe{ :src => request.fullpath.gsub('_admin', '_edit'), :scrolling => 'no', :frameborder => '0' }
|
||||
|
@ -11,14 +11,14 @@ xml.urlset "xmlns" => "http://www.sitemaps.org/schemas/sitemap/0.9" do
|
||||
if page.templatized?
|
||||
page.content_type.entries.visible.each do |c|
|
||||
xml.url do
|
||||
xml.loc page_url(page, { :content => c })
|
||||
xml.loc page_url(page, { :content => c, :host => true })
|
||||
xml.lastmod c.updated_at.to_date.to_s('%Y-%m-%d')
|
||||
xml.priority 0.9
|
||||
end
|
||||
end
|
||||
else
|
||||
xml.url do
|
||||
xml.loc page_url(page)
|
||||
xml.loc page_url(page, { :host => true })
|
||||
xml.lastmod page.updated_at.to_date.to_s('%Y-%m-%d')
|
||||
xml.priority 0.9
|
||||
end
|
||||
|
@ -9,6 +9,6 @@
|
||||
|
||||
.span-12.last
|
||||
%p
|
||||
= submit_tag button_label.is_a?(Symbol) ? t(".#{button_label}") : button_label, :'data-disable-with' => t('.disable_with'), :'data-sending-form-message' => t('locomotive.messages.sending_form')
|
||||
= submit_tag button_label.is_a?(Symbol) ? t(".#{button_label}") : button_label
|
||||
|
||||
.clear
|
@ -19,8 +19,8 @@
|
||||
window.locale = '#{I18n.locale}';
|
||||
window.content_locale = '#{::Mongoid::Fields::I18n.locale}';
|
||||
|
||||
Locomotive.current_site = new Locomotive.Models.Site(#{j current_site.to_presenter.as_json_for_html_view.to_json.html_safe});
|
||||
Locomotive.current_account = new Locomotive.Models.Account(#{j current_locomotive_account.to_json.html_safe});
|
||||
Locomotive.current_site = new Locomotive.Models.Site(#{current_site.to_json});
|
||||
Locomotive.current_account = new Locomotive.Models.Account(#{current_locomotive_account.to_json});
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
- content_for :backbone_view_data do
|
||||
:plain
|
||||
snippet: #{j @snippet.persisted? ? @snippet.to_presenter.as_json_for_html_view.to_json.html_safe : 'null'}
|
||||
snippet: #{@snippet.persisted? ? @snippet.to_presenter.as_json_for_html_view.to_json : 'null'}
|
||||
|
||||
= f.inputs :name => :information do
|
||||
= f.input :name, :wrapper_html => { :class => 'highlighted' }
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
- content_for :backbone_view_data do
|
||||
:plain
|
||||
theme_asset: #{j @theme_asset.persisted? ? @theme_asset.to_json.html_safe : 'null'}
|
||||
theme_asset: #{@theme_asset.persisted? ? @theme_asset.to_json : 'null'}
|
||||
|
||||
= f.hidden_field :performing_plain_text
|
||||
|
||||
|
@ -16,18 +16,18 @@
|
||||
|
||||
- content_for :backbone_view_data do
|
||||
:plain
|
||||
snippets: #{j can?(:manage, Locomotive::Snippet) ? @snippets.map { |snippet| snippet.to_presenter.as_json_for_html_view }.to_json.html_safe : 'null'},
|
||||
images: #{j theme_assets_to_json(@assets[:images]).html_safe},
|
||||
media: #{j theme_assets_to_json(@assets[:media]).html_safe},
|
||||
js_and_css_assets: #{j can?(:manage, Locomotive::ThemeAsset) ? theme_assets_to_json(@js_and_css_assets).html_safe : 'null'},
|
||||
fonts: #{j can?(:manage, Locomotive::ThemeAsset) ? theme_assets_to_json(@assets[:fonts]).html_safe : 'null'}
|
||||
snippets: #{can?(:manage, Locomotive::Snippet) ? @snippets.map { |snippet| snippet.to_presenter.as_json_for_html_view }.to_json : 'null'},
|
||||
images: #{theme_assets_to_json(@assets[:images])},
|
||||
media: #{theme_assets_to_json(@assets[:media])},
|
||||
js_and_css_assets: #{can?(:manage, Locomotive::ThemeAsset) ? theme_assets_to_json(@js_and_css_assets) : 'null'},
|
||||
fonts: #{can?(:manage, Locomotive::ThemeAsset) ? theme_assets_to_json(@assets[:fonts]) : 'null'}
|
||||
|
||||
- content_for :submenu do
|
||||
= render_cell 'locomotive/settings_menu', :show
|
||||
|
||||
- content_for :buttons do
|
||||
- if can?(:manage, Locomotive::ThemeAsset)
|
||||
= form_tag theme_assets_url(:json), :id => 'theme-assets-quick-upload', :class => 'quick-upload', :'data-sending-form-message' => t('locomotive.messages.sending_form') do
|
||||
= form_tag theme_assets_url(:json), :id => 'theme-assets-quick-upload', :class => 'quick-upload' do
|
||||
= file_field_tag 'theme_asset[source]', :multiple => 'multiple'
|
||||
= local_action_button :quick_upload, '#', :class => 'new'
|
||||
|
||||
|
@ -1,2 +1 @@
|
||||
Haml::Template.options[:format] = :html5
|
||||
Haml::Template.options[:ugly] = true # improve performance in dev
|
||||
# Haml::Template.options[:ugly] = true # improve performance in dev
|
@ -1,26 +1,5 @@
|
||||
de:
|
||||
locomotive:
|
||||
errors:
|
||||
"500":
|
||||
title: Anwendungs-Fehler
|
||||
notice: "Entschuldigung, irgendetwas ist hier schief gelaufen."
|
||||
link: "→ Zurück zur Anwendung"
|
||||
"404":
|
||||
title: Seite nicht gefunden
|
||||
notice: "Die angefragte Seite existiert nicht."
|
||||
link: "→ Zurück zur Anwendung"
|
||||
|
||||
locales:
|
||||
en: Englisch
|
||||
de: Deutsch
|
||||
fr: Französisch
|
||||
pt-BR: "Bras. Portugiesisch"
|
||||
it: Italienisch
|
||||
nl: Niederländisch
|
||||
nb: Norwegisch
|
||||
es: Spanisch
|
||||
ru: Russisch
|
||||
|
||||
buttons:
|
||||
login: Einloggen
|
||||
send_password: Senden
|
||||
@ -30,9 +9,19 @@ de:
|
||||
delete: "Löschen"
|
||||
close: "Schließen"
|
||||
|
||||
locales:
|
||||
en: Englisch
|
||||
de: Deutsch
|
||||
fr: Französisch
|
||||
pt-BR: "Bras. Portugiesisch"
|
||||
it: Italienisch
|
||||
nl: Niederländisch
|
||||
"no": Norwegisch
|
||||
es: Spanisch
|
||||
ru: Russisch
|
||||
|
||||
messages:
|
||||
confirm: Sind Sie sicher ?
|
||||
sending_form: "Formular wird gesendet"
|
||||
|
||||
shared:
|
||||
header:
|
||||
@ -50,10 +39,8 @@ de:
|
||||
account: Mein Zugang
|
||||
site: Webseite
|
||||
theme_assets: Dateien
|
||||
list:
|
||||
untranslated: "Nicht übersetzt"
|
||||
form:
|
||||
change_file: ändern
|
||||
change_file: Ändern
|
||||
delete_file: Löschen
|
||||
cancel: Abbrechen
|
||||
form_actions:
|
||||
@ -61,14 +48,23 @@ de:
|
||||
create: Neu
|
||||
update: Speichern
|
||||
send: Senden
|
||||
disable_with: "Transfer..."
|
||||
footer:
|
||||
who_is_behind: "LocomitveCMS - entwickelt von %{development} und entworfen von <a href=\"http://www.sachagreif.com\">Sacha Greif</a> — <small>version</small> %{version}"
|
||||
who_is_behind: "Dienst entwickelt von %{development} und entworfen von <a href=\"http://www.sachagreif.com\">Sacha Greif</a> — <small>version</small> %{version}"
|
||||
|
||||
errors:
|
||||
"500":
|
||||
title: Anwendungs-Fehler
|
||||
notice: "Entschuldigung, irgendetwas ist hier schief gelaufen."
|
||||
link: "→ Zurück zur Anwendung"
|
||||
"404":
|
||||
title: Seite nicht gefunden
|
||||
notice: "Die angefragte Seite existiert nicht."
|
||||
link: "→ Zurück zur Anwendung"
|
||||
|
||||
notifications:
|
||||
new_content_entry:
|
||||
subject: "[%{type}] neu"
|
||||
title: "Hi %{name}, nur damit Sie Bescheid wissen, am %{date} wurde eine neue Instanz erstellt."
|
||||
title: "Hi %{name}, nur damit Sie Bescheid wissen! Am %{date} wurde folgende neue Instanz erstellt."
|
||||
type: "Model: %{type}"
|
||||
|
||||
sites_picker:
|
||||
@ -160,16 +156,16 @@ de:
|
||||
|
||||
sites:
|
||||
new:
|
||||
title: Neue Webseite
|
||||
help: "Füllen Sie das folgende Formular aus, um eine neue Webseite zu erstellen."
|
||||
title: Neuer Webseite
|
||||
help: "Fülle das folgende Formular aus, um einen neuen Webseiteen zu erstellen."
|
||||
domains:
|
||||
empty: "Bisher sind keine Domains/Hostnamen an diese Seite gebunden. Wenn Sie unten Domains/Hostnamen angeben, achten Sie bitte darauf <b>Ihren DNS Server zu prüfen/aktualisieren.</b>"
|
||||
|
||||
current_site:
|
||||
edit:
|
||||
new_membership: Account hinzufügen
|
||||
help: "Der Name der Webseiten kann durch einen Klick auf den Namen bearbeitet werden."
|
||||
ask_for_name: "Bitte geben Sie den neuen Namen der Webseite ein"
|
||||
help: "Der Name des Webseiteen kann durch einen Klick auf den Namen bearbeitet werden."
|
||||
ask_for_name: "Bitte geben Sie den neuen Namen der Webseite an"
|
||||
|
||||
memberships:
|
||||
roles:
|
||||
@ -198,11 +194,10 @@ de:
|
||||
new: neue Datei
|
||||
snippets: Snippets
|
||||
css_and_js: Style und Javascript
|
||||
fonts: Fonts
|
||||
images: Bilder
|
||||
media: Medien
|
||||
fonts: Fonts
|
||||
no_items: "Momentan gibt es keine Dateien. Klicken Sie einfach <a href='%{url}'>hier</a>, um die erste Datei zu erstellen."
|
||||
quick_upload: Schneller Upload
|
||||
asset:
|
||||
updated_at: Aktualisiert am
|
||||
new:
|
||||
@ -295,15 +290,13 @@ de:
|
||||
explanations: "Es ist fast geschafft. Bitte geben Sie Ihrer ersten Webseite einen Namen und wählen Sie eine Sprache aus."
|
||||
default_site_locale: Sprachauswahl
|
||||
default_site_locales_hints: Sie können später weitere Sprachen im Einstellungsdialog vornehmen.
|
||||
next: Webseite erstellen
|
||||
back_to_default_template: "Klicken Sie <a href='#'>hier</a> um die Standardeinstellungen wieder herzustellen"
|
||||
|
||||
next: Webseite erstellen
|
||||
|
||||
public:
|
||||
pages:
|
||||
show_toolbar:
|
||||
statuses:
|
||||
loading: "Laden..."
|
||||
loading: "Lade...."
|
||||
disabled: "Inline Editor deaktiviert"
|
||||
labels:
|
||||
save_changes: "Änderungen speichern: "
|
||||
|
@ -16,13 +16,12 @@ en:
|
||||
pt-BR: "Brazilian Portuguese"
|
||||
it: Italian
|
||||
nl: Dutch
|
||||
nb: Norwegian
|
||||
"no": Norwegian
|
||||
es: Spanish
|
||||
ru: Russian
|
||||
|
||||
messages:
|
||||
confirm: Are you sure ?
|
||||
sending_form: Your form is being submitted
|
||||
|
||||
shared:
|
||||
header:
|
||||
@ -49,7 +48,6 @@ en:
|
||||
create: Create
|
||||
update: Save
|
||||
send: Send
|
||||
disable_with: Pending...
|
||||
list:
|
||||
untranslated: untranslated
|
||||
footer:
|
||||
@ -195,7 +193,6 @@ en:
|
||||
index:
|
||||
title: Listing theme files
|
||||
help: "The theme files section is the place where you manage the files needed by your layout, snippets...etc. If you need to manage an image gallery, create a new content type instead.<br/><b>Warning:</b> you may not see all the assets depending on your rights."
|
||||
quick_upload: Quick upload
|
||||
new: new file
|
||||
snippets: Snippets
|
||||
css_and_js: Style and javascript
|
||||
|
@ -20,7 +20,6 @@ es:
|
||||
|
||||
messages:
|
||||
confirm: Por favor confirme
|
||||
sending_form: "locomotive.messages.sending_form"
|
||||
|
||||
shared:
|
||||
header:
|
||||
@ -38,7 +37,6 @@ es:
|
||||
account: Mi Cuenta
|
||||
site: Sitio
|
||||
theme_assets: Ficheros del Tema
|
||||
disable_with: "locomotive.disable_with.form_actions"
|
||||
footer:
|
||||
who_is_behind: "Servicio desarrollado por %{development} y diseñado por <a href=\"http://www.sachagreif.com\">Sacha Greif</a>"
|
||||
form_actions:
|
||||
@ -166,7 +164,7 @@ es:
|
||||
pt-BR: "Portugués (Brasil)"
|
||||
it: Italiano
|
||||
nl: holandés
|
||||
nb: Noruego
|
||||
"no": Noruego
|
||||
es: Español
|
||||
ru: Ruso
|
||||
ask_for_name: "Por favor escriba su nuevo nombre"
|
||||
|
@ -17,7 +17,7 @@ fr:
|
||||
pt-BR: "Portugais"
|
||||
it: "Italien"
|
||||
nl: "Hollandais"
|
||||
nb: "Norvégien"
|
||||
"no": "Norvégien"
|
||||
es: Espagnol
|
||||
ru: Russe
|
||||
|
||||
@ -31,7 +31,6 @@ fr:
|
||||
|
||||
messages:
|
||||
confirm: "Êtes-vous sûr(e) ?"
|
||||
sending_form: "Votre formulaire est en cours d'envoi"
|
||||
|
||||
shared:
|
||||
header:
|
||||
@ -58,7 +57,6 @@ fr:
|
||||
create: Créer
|
||||
update: Mettre à jour
|
||||
send: Envoyer
|
||||
disable_with: En cours...
|
||||
|
||||
notifications:
|
||||
new_content_entry:
|
||||
|
@ -10,7 +10,6 @@ it:
|
||||
|
||||
messages:
|
||||
confirm: Sicuro?
|
||||
sending_form: "locomotive.messages.sending_form"
|
||||
|
||||
shared:
|
||||
header:
|
||||
@ -35,7 +34,6 @@ it:
|
||||
create: Crea
|
||||
update: Salva
|
||||
send: Invia
|
||||
disable_with: "locomotive.disable_with.form_actions"
|
||||
|
||||
errors:
|
||||
"500":
|
||||
@ -166,7 +164,7 @@ it:
|
||||
pt-BR: "Portoghese Brasiliano"
|
||||
it: Italiano
|
||||
nl: Olandese
|
||||
nb: Norvegese
|
||||
"no": Norvegese
|
||||
es: Spagnolo
|
||||
ru: Russo
|
||||
ask_for_name: "Prego, digita il tuo nome"
|
||||
|
@ -9,7 +9,6 @@ nl:
|
||||
|
||||
messages:
|
||||
confirm: Weet u het zeker ?
|
||||
sending_form: "locomotive.messages.sending_form"
|
||||
|
||||
shared:
|
||||
header:
|
||||
@ -32,7 +31,6 @@ nl:
|
||||
create: Maak
|
||||
update: Update
|
||||
send: Verstuur
|
||||
disable_with: "locomotive.disable_with.form_actions"
|
||||
|
||||
errors:
|
||||
"500":
|
||||
@ -154,7 +152,7 @@ nl:
|
||||
pt-BR: "Braziliaans Portugees"
|
||||
it: Italiaans
|
||||
nl: Nederlands
|
||||
nb: Noors
|
||||
"no": Noors
|
||||
ru: Russisch
|
||||
ask_for_name: "Voer uw nieuwe naam in"
|
||||
|
||||
|