diff --git a/.travis.yml b/.travis.yml
index 1a2513bf..8abce396 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -11,4 +11,4 @@ notifications:
branches:
only:
- master
- - 2.0.0.rc
+ - 1.0-stable
diff --git a/Gemfile b/Gemfile
index 8f63a03f..d195c600 100755
--- a/Gemfile
+++ b/Gemfile
@@ -10,7 +10,9 @@ gemspec # Include gemspec dependencies
group :development do
# gem 'locomotive-mongoid-tree', :path => '../gems/custom_fields' # for Developers
# 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 '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 'rspec-rails', '~> 2.8.0' # In order to have rspec tasks and generators
gem 'rspec-cells'
@@ -46,5 +48,7 @@ group :test do
gem 'xpath', '~> 0.1.4'
+ gem 'json_spec'
+
gem 'database_cleaner'
end
\ No newline at end of file
diff --git a/Gemfile.lock b/Gemfile.lock
index f008fc46..911a190e 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -15,20 +15,10 @@ GIT
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.rc4)
+ locomotive_cms (2.0.0.rc7)
RedCloth (~> 4.2.8)
actionmailer-with-request (~> 0.3.0)
bson_ext (~> 1.5.2)
@@ -37,7 +27,7 @@ PATH
carrierwave-mongoid (~> 0.1.3)
cells (~> 3.8.0)
codemirror-rails (~> 2.21)
- custom_fields (~> 2.0.0.rc9)
+ custom_fields (~> 2.0.0.rc10)
devise (~> 1.5.3)
dragonfly (~> 0.9.8)
flash_cookie_session (~> 1.1.1)
@@ -48,13 +38,14 @@ PATH
httparty (~> 0.8.1)
jquery-rails (~> 1.0.16)
kaminari (~> 0.13.0)
- locomotive-aloha-rails (~> 0.20.1.1)
+ locomotive-aloha-rails (~> 0.20.1.4)
locomotive-mongoid-tree (~> 0.6.2)
- locomotive-tinymce-rails (~> 3.4.7.1)
+ locomotive-tinymce-rails (~> 3.4.7.2)
locomotive_liquid (= 2.2.2)
mimetype-fu (~> 0.1.2)
mongo (~> 1.5.2)
- mongoid (~> 2.4.6)
+ mongoid (~> 2.4.9)
+ multi_json (= 1.2.0)
rack-cache (~> 1.1)
rails (~> 3.2.3)
rails-backbone (~> 0.6.1)
@@ -62,6 +53,7 @@ PATH
responders (~> 0.6.4)
rmagick (~> 2.12.2)
sanitize (~> 2.0.3)
+ unidecoder (~> 1.1.1)
GEM
remote: http://rubygems.org/
@@ -112,8 +104,6 @@ GEM
selenium-webdriver (~> 2.0)
xpath (~> 0.1.4)
carrierwave (0.6.1)
- activemodel (>= 3.2.0)
- activesupport (>= 3.2.0)
carrierwave-mongoid (0.1.3)
carrierwave (>= 0.5.6)
mongoid (~> 2.1)
@@ -123,7 +113,7 @@ GEM
childprocess (0.3.1)
ffi (~> 1.0.6)
chunky_png (1.2.5)
- codemirror-rails (2.22)
+ codemirror-rails (2.24)
railties (~> 3.0)
coffee-rails (3.2.2)
coffee-script (>= 2.2.0)
@@ -131,7 +121,7 @@ GEM
coffee-script (2.2.0)
coffee-script-source
execjs
- coffee-script-source (1.2.0)
+ coffee-script-source (1.3.1)
cucumber (1.1.9)
builder (>= 2.1.2)
diff-lcs (>= 1.1.2)
@@ -142,6 +132,10 @@ GEM
capybara (>= 1.1.2)
cucumber (>= 1.1.8)
nokogiri (>= 1.5.0)
+ custom_fields (2.0.0.rc10)
+ activesupport (~> 3.2.1)
+ carrierwave-mongoid (~> 0.1.3)
+ mongoid (~> 2.4.7)
database_cleaner (0.7.2)
devise (1.5.3)
bcrypt-ruby (~> 3.0)
@@ -182,8 +176,8 @@ GEM
haml (3.1.4)
highline (1.6.11)
hike (1.2.1)
- httparty (0.8.1)
- multi_json
+ httparty (0.8.3)
+ multi_json (~> 1.0)
multi_xml
i18n (0.6.0)
journey (1.0.3)
@@ -191,6 +185,9 @@ GEM
railties (~> 3.0)
thor (~> 0.14)
json (1.6.6)
+ json_spec (1.0.0)
+ multi_json (~> 1.0)
+ rspec (~> 2.0)
kaminari (0.13.0)
actionpack (>= 3.0.0)
activesupport (>= 3.0.0)
@@ -198,12 +195,14 @@ GEM
kgio (2.7.4)
launchy (2.1.0)
addressable (~> 2.2.6)
- locomotive-aloha-rails (0.20.1.1)
+ libwebsocket (0.1.3)
+ addressable
+ locomotive-aloha-rails (0.20.1.4)
actionpack (~> 3.2.1)
locomotive-mongoid-tree (0.6.2)
mongoid (~> 2.0)
- locomotive-tinymce-rails (3.4.7.1)
- actionpack (~> 3.2.1)
+ locomotive-tinymce-rails (3.4.7.2)
+ actionpack (~> 3.0)
locomotive_liquid (2.2.2)
mail (2.4.4)
i18n (>= 0.4.0)
@@ -214,12 +213,12 @@ GEM
mocha (0.9.12)
mongo (1.5.2)
bson (= 1.5.2)
- mongoid (2.4.8)
+ mongoid (2.4.9)
activemodel (~> 3.1)
mongo (~> 1.3)
tzinfo (~> 0.3.22)
- multi_json (1.0.4)
- multi_xml (0.4.2)
+ multi_json (1.2.0)
+ multi_xml (0.4.4)
net-scp (1.0.4)
net-ssh (>= 1.99.1)
net-ssh (2.3.0)
@@ -287,12 +286,14 @@ GEM
railties (~> 3.2.0)
sass (>= 3.1.10)
tilt (~> 1.3)
- selenium-webdriver (2.20.0)
+ selenium-webdriver (2.21.1)
childprocess (>= 0.2.5)
ffi (~> 1.0)
- multi_json (~> 1.0)
+ libwebsocket (~> 0.1.3)
+ multi_json (< 1.3)
rubyzip
- shoulda-matchers (1.0.0)
+ shoulda-matchers (1.1.0)
+ activesupport (>= 3.0.0)
sprockets (2.1.2)
hike (~> 1.2)
rack (~> 1.0)
@@ -311,6 +312,7 @@ GEM
kgio (~> 2.6)
rack
raindrops (~> 0.7)
+ unidecoder (1.1.1)
warden (1.1.1)
rack (>= 1.0)
xpath (0.1.4)
@@ -325,9 +327,9 @@ DEPENDENCIES
compass!
compass-rails!
cucumber-rails
- custom_fields!
database_cleaner
factory_girl_rails (~> 1.6.0)
+ json_spec
launchy
locomotive_cms!
mocha (= 0.9.12)
diff --git a/app/assets/images/locomotive/list/icons/toggle.png b/app/assets/images/locomotive/list/icons/toggle.png
index 0fbbfeea..130a62ce 100644
Binary files a/app/assets/images/locomotive/list/icons/toggle.png and b/app/assets/images/locomotive/list/icons/toggle.png differ
diff --git a/app/assets/images/locomotive/list/icons/toggle_off.png b/app/assets/images/locomotive/list/icons/toggle_off.png
index 11bdcd4b..749f4014 100644
Binary files a/app/assets/images/locomotive/list/icons/toggle_off.png and b/app/assets/images/locomotive/list/icons/toggle_off.png differ
diff --git a/app/assets/javascripts/aloha/plugins/custom/locomotive_media/css/image.css b/app/assets/javascripts/aloha/plugins/custom/locomotive_media/css/image.css
new file mode 100644
index 00000000..8af94055
--- /dev/null
+++ b/app/assets/javascripts/aloha/plugins/custom/locomotive_media/css/image.css
@@ -0,0 +1,3 @@
+button.aloha-locomotive-media-insert {
+ background: url(../img/image.gif) !important;
+}
\ No newline at end of file
diff --git a/app/assets/javascripts/aloha/plugins/custom/locomotive_media/img/image.gif b/app/assets/javascripts/aloha/plugins/custom/locomotive_media/img/image.gif
new file mode 100644
index 00000000..d5924f4b
Binary files /dev/null and b/app/assets/javascripts/aloha/plugins/custom/locomotive_media/img/image.gif differ
diff --git a/app/assets/javascripts/aloha/plugins/custom/locomotive_media/lib/locomotive_media-plugin.js b/app/assets/javascripts/aloha/plugins/custom/locomotive_media/lib/locomotive_media-plugin.js
new file mode 100644
index 00000000..0edfc470
--- /dev/null
+++ b/app/assets/javascripts/aloha/plugins/custom/locomotive_media/lib/locomotive_media-plugin.js
@@ -0,0 +1,96 @@
+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.render()
+ },
+
+ /**
+ * 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 = '';
+ 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 = '' + linkText + '';
+ 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 = '';
+ 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
+ );
+ },
+
+ });
+ }
+);
\ No newline at end of file
diff --git a/app/assets/javascripts/aloha/plugins/custom/locomotive_media/nls/fr/i18n.js b/app/assets/javascripts/aloha/plugins/custom/locomotive_media/nls/fr/i18n.js
new file mode 100644
index 00000000..c43891b0
--- /dev/null
+++ b/app/assets/javascripts/aloha/plugins/custom/locomotive_media/nls/fr/i18n.js
@@ -0,0 +1 @@
+define({ 'button.addimg.tooltip': 'insérer média' });
diff --git a/app/assets/javascripts/aloha/plugins/custom/locomotive_media/nls/i18n.js b/app/assets/javascripts/aloha/plugins/custom/locomotive_media/nls/i18n.js
new file mode 100644
index 00000000..317d57ce
--- /dev/null
+++ b/app/assets/javascripts/aloha/plugins/custom/locomotive_media/nls/i18n.js
@@ -0,0 +1,4 @@
+define({
+ root: { "button.addimg.tooltip": "insert media" },
+ fr: true
+});
diff --git a/app/assets/javascripts/aloha/plugins/custom/locomotive_media/package.json b/app/assets/javascripts/aloha/plugins/custom/locomotive_media/package.json
new file mode 100644
index 00000000..0967ef42
--- /dev/null
+++ b/app/assets/javascripts/aloha/plugins/custom/locomotive_media/package.json
@@ -0,0 +1 @@
+{}
diff --git a/app/assets/javascripts/locomotive/aloha.js.coffee b/app/assets/javascripts/locomotive/aloha.js.coffee
index 2e6a956c..c6c3b0c3 100644
--- a/app/assets/javascripts/locomotive/aloha.js.coffee
+++ b/app/assets/javascripts/locomotive/aloha.js.coffee
@@ -1,2 +1,2 @@
#= require ./utils/aloha_settings
-#= require aloha
+#= require aloha
\ No newline at end of file
diff --git a/app/assets/javascripts/locomotive/application.js.coffee b/app/assets/javascripts/locomotive/application.js.coffee
index ea35ecea..6590be79 100644
--- a/app/assets/javascripts/locomotive/application.js.coffee
+++ b/app/assets/javascripts/locomotive/application.js.coffee
@@ -4,9 +4,9 @@
#= require_tree ./views
window.Locomotive =
- mounted_on: '/locomotive' # default path
+ mounted_on: window.Locomotive.mounted_on
Models: {}
Collections: {}
Views: {}
-window.Locomotive.Views.Memberships = {}
\ No newline at end of file
+window.Locomotive.Views.Memberships = {}
diff --git a/app/assets/javascripts/locomotive/inline_editor.js.coffee b/app/assets/javascripts/locomotive/inline_editor.js.coffee
index 51c3057f..6d4e8a48 100644
--- a/app/assets/javascripts/locomotive/inline_editor.js.coffee
+++ b/app/assets/javascripts/locomotive/inline_editor.js.coffee
@@ -12,6 +12,7 @@
#= require_self
#= require_tree ./utils
#= require_tree ./models
+#= require_tree ./views/content_assets
#= require_tree ./views/inline_editor
window.Locomotive =
diff --git a/app/assets/javascripts/locomotive/models/page.js.coffee b/app/assets/javascripts/locomotive/models/page.js.coffee
index 49c0169a..28b2fb72 100644
--- a/app/assets/javascripts/locomotive/models/page.js.coffee
+++ b/app/assets/javascripts/locomotive/models/page.js.coffee
@@ -16,7 +16,7 @@ class Locomotive.Models.Page extends Backbone.Model
toJSON: ->
_.tap super, (hash) =>
- _.each ['fullpath', 'localized_fullpaths', 'edit_url', 'parent_id_text', 'response_type_text'], (key) => delete hash[key]
+ _.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]
delete hash['editable_elements']
hash.editable_elements = @get('editable_elements').toJSONForSave() if @get('editable_elements')? && @get('editable_elements').length > 0
diff --git a/app/assets/javascripts/locomotive/utils/aloha_settings.js.coffee b/app/assets/javascripts/locomotive/utils/aloha_settings.js.coffee
index 5beb6b5b..ea2e4b3f 100644
--- a/app/assets/javascripts/locomotive/utils/aloha_settings.js.coffee
+++ b/app/assets/javascripts/locomotive/utils/aloha_settings.js.coffee
@@ -23,6 +23,11 @@ window.Aloha.settings =
editables:
'.editable-short-text': [ ]
+ image:
+ ui:
+ insert: false
+ crop: false
+
i18n:
available: ['en', 'fr', 'pt-BR', 'es', 'de', 'no', 'ru', 'nl']
diff --git a/app/assets/javascripts/locomotive/utils/core_ext.js b/app/assets/javascripts/locomotive/utils/core_ext.js
index 2a6e4f46..bededa0c 100644
--- a/app/assets/javascripts/locomotive/utils/core_ext.js
+++ b/app/assets/javascripts/locomotive/utils/core_ext.js
@@ -18,9 +18,9 @@
String.prototype.slugify = function(sep) {
if (typeof sep == 'undefined') sep = '_';
- var alphaNumRegexp = new RegExp('[^a-zA-Z0-9\\' + 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
diff --git a/app/assets/javascripts/locomotive/views/content_entries/_popup_form_view.js.coffee b/app/assets/javascripts/locomotive/views/content_entries/_popup_form_view.js.coffee
index 975e587a..b7c8f94c 100644
--- a/app/assets/javascripts/locomotive/views/content_entries/_popup_form_view.js.coffee
+++ b/app/assets/javascripts/locomotive/views/content_entries/_popup_form_view.js.coffee
@@ -50,6 +50,8 @@ 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) ->
diff --git a/app/assets/javascripts/locomotive/views/content_types/custom_field_entry_view.js.coffee b/app/assets/javascripts/locomotive/views/content_types/custom_field_entry_view.js.coffee
index d10a06fe..07f707ad 100644
--- a/app/assets/javascripts/locomotive/views/content_types/custom_field_entry_view.js.coffee
+++ b/app/assets/javascripts/locomotive/views/content_types/custom_field_entry_view.js.coffee
@@ -78,8 +78,10 @@ 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) ->
diff --git a/app/assets/javascripts/locomotive/views/content_types/edit_view.coffee b/app/assets/javascripts/locomotive/views/content_types/edit_view.coffee
index 4ea76c59..293f9a61 100644
--- a/app/assets/javascripts/locomotive/views/content_types/edit_view.coffee
+++ b/app/assets/javascripts/locomotive/views/content_types/edit_view.coffee
@@ -11,5 +11,4 @@ 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)
diff --git a/app/assets/javascripts/locomotive/views/editable_elements/file_view.js.coffee b/app/assets/javascripts/locomotive/views/editable_elements/file_view.js.coffee
index 821f6f68..400b2ea7 100644
--- a/app/assets/javascripts/locomotive/views/editable_elements/file_view.js.coffee
+++ b/app/assets/javascripts/locomotive/views/editable_elements/file_view.js.coffee
@@ -38,7 +38,8 @@ class Locomotive.Views.EditableElements.FileView extends Backbone.View
on_change: =>
@$('a:first').hide() & @$('input[type=file]').show() & @$('a.delete').hide()
on_cancel: =>
- @$('a:first').show() & @$('input[type=file]').hide() & @$('a.delete').show()
+ @model.set(source: null)
+ @$('a:first').show() & @$('input[type=file]').val('').hide() & @$('a.delete').show()
toggle_delete: (event) ->
@_toggle event, 'delete',
diff --git a/app/assets/javascripts/locomotive/views/editable_elements/long_text_view.js.coffee b/app/assets/javascripts/locomotive/views/editable_elements/long_text_view.js.coffee
index 5c0e9925..86147c12 100644
--- a/app/assets/javascripts/locomotive/views/editable_elements/long_text_view.js.coffee
+++ b/app/assets/javascripts/locomotive/views/editable_elements/long_text_view.js.coffee
@@ -2,7 +2,35 @@
Locomotive.Views.EditableElements ||= {}
-class Locomotive.Views.EditableElements.LongTextView extends Locomotive.Views.EditableElements.ShortTextView
+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)
tinymce_settings: ->
- window.Locomotive.tinyMCE.defaultSettings
\ No newline at end of file
+ window.Locomotive.tinyMCE.defaultSettings
+
+ refresh: ->
+ # do nothing
+
+ remove: ->
+ @$('textarea').tinymce().destroy()
+ super
diff --git a/app/assets/javascripts/locomotive/views/editable_elements/short_text_view.js.coffee b/app/assets/javascripts/locomotive/views/editable_elements/short_text_view.js.coffee
index 4c5a5eed..09649c82 100644
--- a/app/assets/javascripts/locomotive/views/editable_elements/short_text_view.js.coffee
+++ b/app/assets/javascripts/locomotive/views/editable_elements/short_text_view.js.coffee
@@ -4,31 +4,19 @@ class Locomotive.Views.EditableElements.ShortTextView extends Backbone.View
tagName: 'li'
- className: 'text input html'
+ className: 'text input short'
render: ->
$(@el).html(ich.editable_text_input(@model.toJSON()))
+ @$('textarea').bind 'keyup', (event) =>
+ input = $(event.target)
+ @model.set(content: input.val())
+
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)
-
- tinymce_settings: ->
- window.Locomotive.tinyMCE.minimalSettings
-
- refresh: ->
# do nothing
- remove: ->
- @$('textarea').tinymce().destroy()
- super
\ No newline at end of file
+ refresh: ->
+ # do nothing
\ No newline at end of file
diff --git a/app/assets/javascripts/locomotive/views/inline_editor/application_view.js.coffee b/app/assets/javascripts/locomotive/views/inline_editor/application_view.js.coffee
index 9ed71b53..2e3cb346 100644
--- a/app/assets/javascripts/locomotive/views/inline_editor/application_view.js.coffee
+++ b/app/assets/javascripts/locomotive/views/inline_editor/application_view.js.coffee
@@ -1,8 +1,8 @@
-Locomotive.Views.InlinEditor ||= {}
+Locomotive.Views.InlineEditor ||= {}
#= require ./toolbar_view
-class Locomotive.Views.InlinEditor.ApplicationView extends Backbone.View
+class Locomotive.Views.InlineEditor.ApplicationView extends Backbone.View
el: 'body'
@@ -13,7 +13,9 @@ class Locomotive.Views.InlinEditor.ApplicationView extends Backbone.View
_.bindAll(@, '_$')
- @toolbar_view = new Locomotive.Views.InlinEditor.ToolbarView(target: @iframe)
+ @toolbar_view = new Locomotive.Views.InlineEditor.ToolbarView(target: @iframe)
+
+ @content_assets_picker_view = new Locomotive.Views.ContentAssets.PickerView(collection: new Locomotive.Models.ContentAssetsCollection())
render: ->
super
@@ -26,15 +28,13 @@ class Locomotive.Views.InlinEditor.ApplicationView extends Backbone.View
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().find('body')
+ iframe_content = iframe.contents()
iframe_content.resize ->
elem = $(this)
- if elem.outerHeight(true) > $('body').outerHeight(true) # Resize the iFrame.
+ if elem.outerHeight(true) > iframe.outerHeight(true) # Resize the iFrame.
iframe.css height: elem.outerHeight(true)
# Resize the iFrame immediately.
@@ -46,8 +46,6 @@ class Locomotive.Views.InlinEditor.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 +76,7 @@ class Locomotive.Views.InlinEditor.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
+ if url? && url.indexOf('#') != 0 && /^(www|http)/.exec(url) == null && /(\/_edit)$/.exec(url) == null && /^\/sites\//.exec(url) == null
url = '/index' if url == '/'
unless url.indexOf('_edit') > 0
diff --git a/app/assets/javascripts/locomotive/views/inline_editor/toolbar_view.js.coffee b/app/assets/javascripts/locomotive/views/inline_editor/toolbar_view.js.coffee
index f156e552..e2efbfd7 100644
--- a/app/assets/javascripts/locomotive/views/inline_editor/toolbar_view.js.coffee
+++ b/app/assets/javascripts/locomotive/views/inline_editor/toolbar_view.js.coffee
@@ -1,6 +1,6 @@
-Locomotive.Views.InlinEditor ||= {}
+Locomotive.Views.InlineEditor ||= {}
-class Locomotive.Views.InlinEditor.ToolbarView extends Backbone.View
+class Locomotive.Views.InlineEditor.ToolbarView extends Backbone.View
el: '#toolbar .inner'
@@ -13,8 +13,6 @@ class Locomotive.Views.InlinEditor.ToolbarView extends Backbone.View
render: ->
super
- console.log('render toolbar')
-
@enable_editing_mode_checkbox()
@enable_content_locale_picker()
@@ -22,8 +20,6 @@ class Locomotive.Views.InlinEditor.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')
@@ -125,8 +121,6 @@ class Locomotive.Views.InlinEditor.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')
diff --git a/app/assets/javascripts/locomotive/views/pages/edit_view.js.coffee b/app/assets/javascripts/locomotive/views/pages/edit_view.js.coffee
index 78871d00..46d74629 100644
--- a/app/assets/javascripts/locomotive/views/pages/edit_view.js.coffee
+++ b/app/assets/javascripts/locomotive/views/pages/edit_view.js.coffee
@@ -5,10 +5,14 @@ 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
@@ -17,9 +21,8 @@ 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
-
-
-
diff --git a/app/assets/javascripts/locomotive/views/shared/fields/many_to_many_view.js.coffee b/app/assets/javascripts/locomotive/views/shared/fields/many_to_many_view.js.coffee
index 01c5c681..ab94fad7 100644
--- a/app/assets/javascripts/locomotive/views/shared/fields/many_to_many_view.js.coffee
+++ b/app/assets/javascripts/locomotive/views/shared/fields/many_to_many_view.js.coffee
@@ -24,10 +24,6 @@ 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()())
diff --git a/app/assets/javascripts/locomotive/views/shared/form_view.js.coffee b/app/assets/javascripts/locomotive/views/shared/form_view.js.coffee
index aa4e0017..0034de82 100644
--- a/app/assets/javascripts/locomotive/views/shared/form_view.js.coffee
+++ b/app/assets/javascripts/locomotive/views/shared/form_view.js.coffee
@@ -16,6 +16,9 @@ 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) ->
@@ -24,6 +27,8 @@ 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 }
@@ -33,11 +38,15 @@ class Locomotive.Views.Shared.FormView extends Backbone.View
@model.save {},
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
@@ -72,7 +81,10 @@ class Locomotive.Views.Shared.FormView extends Backbone.View
content.slideUp 100, -> parent.addClass('folded')
enable_save_with_keys_combination: ->
- $.cmd 'S', (() => @$('form').trigger('submit')), [], ignoreCase: true
+ $.cmd 'S', (() => @$('form input[type=submit]').trigger('click')), [], ignoreCase: true
+
+ enable_form_notifications: ->
+ @$('form').formSubmitNotification()
after_inputs_fold: ->
# overide this method if necessary
diff --git a/app/assets/javascripts/locomotive/views/theme_assets/index_view.js.coffee b/app/assets/javascripts/locomotive/views/theme_assets/index_view.js.coffee
index aca117db..27613fc4 100644
--- a/app/assets/javascripts/locomotive/views/theme_assets/index_view.js.coffee
+++ b/app/assets/javascripts/locomotive/views/theme_assets/index_view.js.coffee
@@ -7,7 +7,7 @@ class Locomotive.Views.ThemeAssets.IndexView extends Backbone.View
_lists_views: []
initialize: ->
- _.bindAll(@, 'add_asset')
+ _.bindAll(@, 'insert_asset')
render: ->
@build_uploader()
@@ -29,16 +29,24 @@ 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: @add_asset, headers: { 'X-Flash': true }
+ asset.save {},
+ success: (model, response, xhr) =>
+ form.trigger('ajax:complete')
+ @insert_asset(model)
+ error: (() => form.trigger('ajax:complete'))
+ headers: { 'X-Flash': true }
- add_asset: (model) ->
+ insert_asset: (model) ->
list_view = @pick_list_view(model.get('content_type'))
list_view.collection.add(model)
diff --git a/app/assets/stylesheets/locomotive/backoffice/application.css.scss b/app/assets/stylesheets/locomotive/backoffice/application.css.scss
index df7cebf8..2d9d5120 100644
--- a/app/assets/stylesheets/locomotive/backoffice/application.css.scss
+++ b/app/assets/stylesheets/locomotive/backoffice/application.css.scss
@@ -33,24 +33,6 @@
/* ___ 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;
@@ -314,6 +296,29 @@ 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 {
@@ -323,19 +328,3 @@ 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;
- }
-
-}
-
-
-
-
-
diff --git a/app/assets/stylesheets/locomotive/backoffice/content_assets.css.scss b/app/assets/stylesheets/locomotive/backoffice/content_assets.css.scss
index 63be3fa1..69b556ee 100644
--- a/app/assets/stylesheets/locomotive/backoffice/content_assets.css.scss
+++ b/app/assets/stylesheets/locomotive/backoffice/content_assets.css.scss
@@ -6,6 +6,10 @@
ul.content-assets {
+ list-style: none;
+ margin: 0px;
+ padding: 0px;
+
li.asset {
position: relative;
float: left;
diff --git a/app/assets/stylesheets/locomotive/backoffice/datepicker.css.scss b/app/assets/stylesheets/locomotive/backoffice/datepicker.css.scss
index 81dc01d3..d1fcfa32 100644
--- a/app/assets/stylesheets/locomotive/backoffice/datepicker.css.scss
+++ b/app/assets/stylesheets/locomotive/backoffice/datepicker.css.scss
@@ -8,7 +8,7 @@
width: auto;
- z-index: 999 !important;
+ z-index: 1001 !important;
background: #f1f1f1;
diff --git a/app/assets/stylesheets/locomotive/backoffice/dialog_changes.css.scss b/app/assets/stylesheets/locomotive/backoffice/dialog_changes.css.scss
index c400569d..bf719788 100644
--- a/app/assets/stylesheets/locomotive/backoffice/dialog_changes.css.scss
+++ b/app/assets/stylesheets/locomotive/backoffice/dialog_changes.css.scss
@@ -84,6 +84,12 @@
width: 530px;
}
} // li.string
+
+ li.date {
+ input[type=text] {
+ width: 90px;
+ }
+ } // li.string
}
}
} // .form.formtastic
diff --git a/app/assets/stylesheets/locomotive/backoffice/formtastic_changes.css.scss b/app/assets/stylesheets/locomotive/backoffice/formtastic_changes.css.scss
index 4841dc0a..c256b071 100644
--- a/app/assets/stylesheets/locomotive/backoffice/formtastic_changes.css.scss
+++ b/app/assets/stylesheets/locomotive/backoffice/formtastic_changes.css.scss
@@ -157,6 +157,10 @@ form.formtastic {
&:hover {
background-image: image-url("locomotive/list/icons/toggle.png");
}
+ &.open {
+ @include rotate(180deg);
+ }
+ @include single-transition(transform, 0.5s);
}
&.drag {
@@ -291,6 +295,17 @@ 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;
diff --git a/app/assets/stylesheets/locomotive/backoffice/layout.css.scss b/app/assets/stylesheets/locomotive/backoffice/layout.css.scss
index 4ccbd8d1..c252e73b 100644
--- a/app/assets/stylesheets/locomotive/backoffice/layout.css.scss
+++ b/app/assets/stylesheets/locomotive/backoffice/layout.css.scss
@@ -176,7 +176,7 @@ body {
}
}
- input[type=submit] {
+ input[type=submit], button[type=submit] {
@include light-button;
}
diff --git a/app/assets/stylesheets/locomotive/inline_editor.css b/app/assets/stylesheets/locomotive/inline_editor.css
index e54c4713..508fbad6 100644
--- a/app/assets/stylesheets/locomotive/inline_editor.css
+++ b/app/assets/stylesheets/locomotive/inline_editor.css
@@ -3,7 +3,10 @@
* 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
*/
\ No newline at end of file
diff --git a/app/assets/stylesheets/locomotive/shared/common.css.scss b/app/assets/stylesheets/locomotive/shared/common.css.scss
new file mode 100644
index 00000000..43f076e8
--- /dev/null
+++ b/app/assets/stylesheets/locomotive/shared/common.css.scss
@@ -0,0 +1,34 @@
+@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;
+ }
+}
\ No newline at end of file
diff --git a/app/controllers/locomotive/public/content_entries_controller.rb b/app/controllers/locomotive/public/content_entries_controller.rb
index 8544cac1..605c15a6 100644
--- a/app/controllers/locomotive/public/content_entries_controller.rb
+++ b/app/controllers/locomotive/public/content_entries_controller.rb
@@ -8,6 +8,8 @@ module Locomotive
skip_before_filter :verify_authenticity_token
+ skip_load_and_authorize_resource
+
self.responder = Locomotive::ActionController::PublicResponder # custom responder
respond_to :html, :json
@@ -15,6 +17,7 @@ module Locomotive
def create
@entry = @content_type.entries.create(params[:entry] || params[:content])
flash[@content_type.slug.singularize] = @entry.to_presenter(:include_errors => true).as_json
+ Rails.logger.debug @entry.to_presenter(:include_errors => true).as_json
respond_with @entry, :location => self.callback_url
end
diff --git a/app/helpers/locomotive/content_types_helper.rb b/app/helpers/locomotive/content_types_helper.rb
index 20eb07cf..443cde41 100644
--- a/app/helpers/locomotive/content_types_helper.rb
+++ b/app/helpers/locomotive/content_types_helper.rb
@@ -27,6 +27,10 @@ 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
diff --git a/app/helpers/locomotive/custom_fields_helper.rb b/app/helpers/locomotive/custom_fields_helper.rb
index 712884d2..1a46e8a3 100644
--- a/app/helpers/locomotive/custom_fields_helper.rb
+++ b/app/helpers/locomotive/custom_fields_helper.rb
@@ -44,7 +44,7 @@ module Locomotive
def options_for_content_type
current_site.content_types.map do |c|
- c != @content_type ? [c.name, c.klass_with_custom_fields(:entries).to_s] : nil
+ [c.name, c.klass_with_custom_fields(:entries).to_s]
end.compact
end
diff --git a/app/mailers/locomotive/notifications.rb b/app/mailers/locomotive/notifications.rb
index b59e1364..c0ebd019 100644
--- a/app/mailers/locomotive/notifications.rb
+++ b/app/mailers/locomotive/notifications.rb
@@ -4,7 +4,7 @@ module Locomotive
default :from => Locomotive.config.mailer_sender
def new_content_entry(account, entry)
- @account, @entry, @type = account, entry.to_presenter, entry.content_type
+ @account, @entry, @type = account, entry, entry.content_type
subject = t('locomotive.notifications.new_content_entry.subject', :type => @type.name, :locale => account.locale)
diff --git a/app/models/locomotive/content_entry.rb b/app/models/locomotive/content_entry.rb
index adb981f6..5be95ed7 100644
--- a/app/models/locomotive/content_entry.rb
+++ b/app/models/locomotive/content_entry.rb
@@ -86,7 +86,7 @@ module Locomotive
end
def as_json(options = {})
- self.to_presenter.as_json
+ self.to_presenter(options).as_json
end
protected
@@ -146,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.include?(account._id)
+ next unless self.content_type.public_submission_accounts.map(&:to_s).include?(account._id.to_s)
Locomotive::Notifications.new_content_entry(account, self).deliver
end
diff --git a/app/models/locomotive/extensions/page/editable_elements.rb b/app/models/locomotive/extensions/page/editable_elements.rb
index 31fc0d8f..4137d0bb 100644
--- a/app/models/locomotive/extensions/page/editable_elements.rb
+++ b/app/models/locomotive/extensions/page/editable_elements.rb
@@ -71,6 +71,11 @@ 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
diff --git a/app/models/locomotive/extensions/page/tree.rb b/app/models/locomotive/extensions/page/tree.rb
index ff60d7eb..2a3ec0b6 100644
--- a/app/models/locomotive/extensions/page/tree.rb
+++ b/app/models/locomotive/extensions/page/tree.rb
@@ -19,6 +19,9 @@ 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
@@ -105,6 +108,16 @@ 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!
diff --git a/app/models/locomotive/extensions/site/subdomain_domains.rb b/app/models/locomotive/extensions/site/subdomain_domains.rb
index 46f1df2a..71963b5f 100644
--- a/app/models/locomotive/extensions/site/subdomain_domains.rb
+++ b/app/models/locomotive/extensions/site/subdomain_domains.rb
@@ -37,9 +37,13 @@ module Locomotive
module InstanceMethods
+ def subdomain=(subdomain)
+ super(subdomain.try(:downcase))
+ end
+
def domains=(array)
array.reject!(&:blank?)
- array = [] if array.blank?; super(array)
+ array = [] if array.blank?; super(array.map(&:downcase))
end
def add_subdomain_to_domains
@@ -84,4 +88,4 @@ module Locomotive
end
end
end
-end
\ No newline at end of file
+end
diff --git a/app/models/locomotive/site.rb b/app/models/locomotive/site.rb
index 63538fc3..1110259a 100644
--- a/app/models/locomotive/site.rb
+++ b/app/models/locomotive/site.rb
@@ -54,8 +54,12 @@ module Locomotive
Locomotive::Liquid::Drops::Site.new(self)
end
+ def to_presenter(options = {})
+ Locomotive::SitePresenter.new(self, options)
+ end
+
def as_json(options = {})
- Locomotive::SitePresenter.new(self, options).as_json
+ self.to_presenter(options).as_json
end
protected
diff --git a/app/presenters/locomotive/content_asset_presenter.rb b/app/presenters/locomotive/content_asset_presenter.rb
index 939cd516..afce9e53 100644
--- a/app/presenters/locomotive/content_asset_presenter.rb
+++ b/app/presenters/locomotive/content_asset_presenter.rb
@@ -1,7 +1,7 @@
module Locomotive
class ContentAssetPresenter < BasePresenter
- delegate :content_type, :vignette_url, :to => :source
+ delegate :content_type, :width, :height, :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)
+ super + %w(full_filename filename short_name extname content_type content_type_text url vignette_url width height)
end
end
diff --git a/app/presenters/locomotive/membership_presenter.rb b/app/presenters/locomotive/membership_presenter.rb
index e0d82227..06b592b5 100644
--- a/app/presenters/locomotive/membership_presenter.rb
+++ b/app/presenters/locomotive/membership_presenter.rb
@@ -1,7 +1,7 @@
module Locomotive
class MembershipPresenter < BasePresenter
- delegate :role, :to => :source
+ delegate :role, :account_id, :to => :source
def name
self.source.account.name
@@ -26,8 +26,13 @@ module Locomotive
end
def included_methods
- super + %w(name email role role_name can_update grant_admin)
+ super + %w(account_id 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
\ No newline at end of file
diff --git a/app/presenters/locomotive/site_presenter.rb b/app/presenters/locomotive/site_presenter.rb
index 272571be..406002ee 100644
--- a/app/presenters/locomotive/site_presenter.rb
+++ b/app/presenters/locomotive/site_presenter.rb
@@ -15,5 +15,10 @@ 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
\ No newline at end of file
diff --git a/app/views/locomotive/custom_fields/types/_many_to_many.html.haml b/app/views/locomotive/custom_fields/types/_many_to_many.html.haml
index 0aef925b..6680b1fa 100644
--- a/app/views/locomotive/custom_fields/types/_many_to_many.html.haml
+++ b/app/views/locomotive/custom_fields/types/_many_to_many.html.haml
@@ -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: #{target_content_type.list_or_group_entries.to_json}
\ No newline at end of file
+ , all_#{name}_entries: #{target_content_type.list_or_group_entries.to_json(:depth => 1)}
\ No newline at end of file
diff --git a/app/views/locomotive/notifications/new_content_entry.html.haml b/app/views/locomotive/notifications/new_content_entry.html.haml
index 05844631..ea3b670a 100644
--- a/app/views/locomotive/notifications/new_content_entry.html.haml
+++ b/app/views/locomotive/notifications/new_content_entry.html.haml
@@ -10,13 +10,20 @@
%hr
%ul
- - @type.entries_custom_fields.each do |field|
- - value = @entry.value_for(field)
+ - @type.ordered_entries_custom_fields.each do |field|
+ - value = @entry.send(field.name)
%li
%strong= field.label
-
%i
- - if field.type == 'file'
- = link_to File.basename(value), value
- - else
+ - case field.type.to_s
+ - when 'string', 'text', 'boolean', 'date'
= 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(', ')
\ No newline at end of file
diff --git a/app/views/locomotive/public/pages/show_toolbar.html.haml b/app/views/locomotive/public/pages/show_toolbar.html.haml
index 6bc1857e..909ac165 100644
--- a/app/views/locomotive/public/pages/show_toolbar.html.haml
+++ b/app/views/locomotive/public/pages/show_toolbar.html.haml
@@ -25,11 +25,13 @@
$(document).ready(function() {
- window.application_view = new Locomotive.Views.InlinEditor.ApplicationView();
+ window.application_view = new Locomotive.Views.InlineEditor.ApplicationView();
window.application_view.render();
});
+ = render '/locomotive/content_assets/picker'
+
%body
#page
%iframe{ :src => request.fullpath.gsub('_admin', '_edit'), :scrolling => 'no', :frameborder => '0' }
diff --git a/app/views/locomotive/shared/_form_actions.html.haml b/app/views/locomotive/shared/_form_actions.html.haml
index 8532464f..030b70ae 100644
--- a/app/views/locomotive/shared/_form_actions.html.haml
+++ b/app/views/locomotive/shared/_form_actions.html.haml
@@ -9,6 +9,6 @@
.span-12.last
%p
- = submit_tag button_label.is_a?(Symbol) ? t(".#{button_label}") : button_label
+ = submit_tag button_label.is_a?(Symbol) ? t(".#{button_label}") : button_label, :disable_with => t('.disable_with'), :'data-sending-form-message' => t('locomotive.messages.sending_form')
.clear
\ No newline at end of file
diff --git a/app/views/locomotive/shared/_head.html.haml b/app/views/locomotive/shared/_head.html.haml
index 89f25515..754413bd 100644
--- a/app/views/locomotive/shared/_head.html.haml
+++ b/app/views/locomotive/shared/_head.html.haml
@@ -7,6 +7,10 @@
%meta{ :name => 'key-param', :content => Rails.application.config.session_options[:key] }
%meta{ :name => 'key-token', :content => cookies[key] }
+%script{ :type => 'text/javascript' }
+ :plain
+ window.Locomotive = { mounted_on: '#{Locomotive.mounted_on}' };
+
= stylesheet_link_tag 'locomotive', :media => 'screen'
= javascript_include_tag 'locomotive'
@@ -15,8 +19,7 @@
window.locale = '#{I18n.locale}';
window.content_locale = '#{::Mongoid::Fields::I18n.locale}';
- Locomotive.mounted_on = '#{Locomotive.mounted_on}';
- Locomotive.current_site = new Locomotive.Models.Site(#{current_site.to_json});
+ Locomotive.current_site = new Locomotive.Models.Site(#{current_site.to_presenter.as_json_for_html_view.to_json});
Locomotive.current_account = new Locomotive.Models.Account(#{current_locomotive_account.to_json});
$(document).ready(function() {
@@ -32,4 +35,4 @@
= yield :head
-= render 'locomotive/shared/main_app_head'
\ No newline at end of file
+= render 'locomotive/shared/main_app_head'
diff --git a/app/views/locomotive/theme_assets/index.html.haml b/app/views/locomotive/theme_assets/index.html.haml
index d4b11fd6..7c9e92ff 100644
--- a/app/views/locomotive/theme_assets/index.html.haml
+++ b/app/views/locomotive/theme_assets/index.html.haml
@@ -27,7 +27,7 @@
- content_for :buttons do
- if can?(:manage, Locomotive::ThemeAsset)
- = form_tag theme_assets_url(:json), :id => 'theme-assets-quick-upload', :class => 'quick-upload' do
+ = form_tag theme_assets_url(:json), :id => 'theme-assets-quick-upload', :class => 'quick-upload', :'data-sending-form-message' => t('locomotive.messages.sending_form') do
= file_field_tag 'theme_asset[source]', :multiple => 'multiple'
= local_action_button :quick_upload, '#', :class => 'new'
diff --git a/config/initializers/haml.rb b/config/initializers/haml.rb
index 711427e0..7c13a0b4 100644
--- a/config/initializers/haml.rb
+++ b/config/initializers/haml.rb
@@ -1,2 +1,2 @@
-Haml::Template.options[:ugly] = true
-Haml::Template.options[:format] = :html5
\ No newline at end of file
+Haml::Template.options[:format] = :html5
+Haml::Template.options[:ugly] = true # improve performance in dev
diff --git a/config/locales/admin_ui.de.yml b/config/locales/admin_ui.de.yml
index 3b20686c..44726aaf 100644
--- a/config/locales/admin_ui.de.yml
+++ b/config/locales/admin_ui.de.yml
@@ -48,6 +48,7 @@ de:
create: Neu
update: Speichern
send: Senden
+ disable_with: "locomotive.disable_with.form_actions"
footer:
who_is_behind: "Dienst entwickelt von %{development} und entworfen von Sacha Greif — version %{version}"
diff --git a/config/locales/admin_ui.en.yml b/config/locales/admin_ui.en.yml
index 9bad502f..82e2f862 100644
--- a/config/locales/admin_ui.en.yml
+++ b/config/locales/admin_ui.en.yml
@@ -22,6 +22,7 @@ en:
messages:
confirm: Are you sure ?
+ sending_form: Your form is being submitted
shared:
header:
@@ -48,6 +49,7 @@ en:
create: Create
update: Save
send: Send
+ disable_with: Pending...
list:
untranslated: untranslated
footer:
@@ -193,6 +195,7 @@ 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.
Warning: 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
diff --git a/config/locales/admin_ui.es.yml b/config/locales/admin_ui.es.yml
index 1a3d00a9..42ba21d9 100644
--- a/config/locales/admin_ui.es.yml
+++ b/config/locales/admin_ui.es.yml
@@ -37,6 +37,7 @@ 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 Sacha Greif"
form_actions:
diff --git a/config/locales/admin_ui.fr.yml b/config/locales/admin_ui.fr.yml
index d8f31f53..df9bda20 100644
--- a/config/locales/admin_ui.fr.yml
+++ b/config/locales/admin_ui.fr.yml
@@ -31,6 +31,7 @@ fr:
messages:
confirm: "Êtes-vous sûr(e) ?"
+ sending_form: "Votre formulaire est en cours d'envoi"
shared:
header:
@@ -57,6 +58,7 @@ fr:
create: Créer
update: Mettre à jour
send: Envoyer
+ disable_with: En cours...
notifications:
new_content_entry:
diff --git a/config/locales/admin_ui.it.yml b/config/locales/admin_ui.it.yml
index 2ba82a42..37f094b2 100644
--- a/config/locales/admin_ui.it.yml
+++ b/config/locales/admin_ui.it.yml
@@ -34,6 +34,7 @@ it:
create: Crea
update: Salva
send: Invia
+ disable_with: "locomotive.disable_with.form_actions"
errors:
"500":
diff --git a/config/locales/admin_ui.nl.yml b/config/locales/admin_ui.nl.yml
index 693bc3bb..21c84318 100644
--- a/config/locales/admin_ui.nl.yml
+++ b/config/locales/admin_ui.nl.yml
@@ -31,6 +31,7 @@ nl:
create: Maak
update: Update
send: Verstuur
+ disable_with: "locomotive.disable_with.form_actions"
errors:
"500":
diff --git a/config/locales/admin_ui.no.yml b/config/locales/admin_ui.no.yml
index a8333e60..46baecb3 100644
--- a/config/locales/admin_ui.no.yml
+++ b/config/locales/admin_ui.no.yml
@@ -34,6 +34,7 @@
create: Opprett
update: Lagre
send: Send
+ disable_with: "locomotive.disable_with.form_actions"
errors:
"500":
diff --git a/config/locales/admin_ui.pt-BR.yml b/config/locales/admin_ui.pt-BR.yml
index db05d942..61ac86a4 100644
--- a/config/locales/admin_ui.pt-BR.yml
+++ b/config/locales/admin_ui.pt-BR.yml
@@ -31,6 +31,7 @@ pt-BR:
create: Criar
update: Atualizar
send: Enviar
+ disable_with: "locomotive.disable_with.form_actions"
errors:
"500":
diff --git a/config/locales/admin_ui.ru.yml b/config/locales/admin_ui.ru.yml
index 951d11cc..c6dc911b 100644
--- a/config/locales/admin_ui.ru.yml
+++ b/config/locales/admin_ui.ru.yml
@@ -7,9 +7,22 @@ ru:
new_item: "+ добавить"
switch_to_site: Сайт
delete: "Удалить"
+ close: "Закрыть"
+
+ locales:
+ en: Английский
+ de: Немецкий
+ fr: Французский
+ pt-BR: "Браз. - Португальский"
+ it: Итальянский
+ nl: Голландский
+ "no": Норвежский
+ es: Испанский
+ ru: Русский
messages:
confirm: Вы уверены ?
+ sending_form: Ваша форма отправляется
shared:
header:
@@ -27,6 +40,10 @@ ru:
account: Аккаунт
site: Сайт
theme_assets: Файлы темы
+ form:
+ change_file: изменить
+ delete_file: удалить
+ cancel: отменить
footer:
who_is_behind: "Service developed by %{development} and designed by Sacha Greif"
form_actions:
@@ -34,6 +51,9 @@ ru:
create: Создать
update: Сохранить
send: Отправить
+ disable_with: В ожидании...
+ list:
+ untranslated: непереведено
errors:
"500":
@@ -65,9 +85,15 @@ ru:
delete_file: Удалить файл
has_many:
empty: Пусто
- index:
- is_required: является обязательным
+ new_entry: + Добавить новый элемент
+ many_to_many:
+ empty: Список пуст. Добавьте элемент из селекта ниже.
+ form:
+ required: Обязательное
+ optional: Опциональное
default_label: Название поля
+ select_options:
+ ask_name: "Введите название элемента"
sessions:
new:
@@ -104,7 +130,9 @@ ru:
help: "Заголовок страницы может быть изменен, если кликнуть на нем. Чтобы применить изменения, нажмите кнопку \"Сохранить\"."
ask_for_title: "Пожалуйста введите новое имя страницы"
form:
+ change_file: Изменить
delete_file: Удалить файл
+ cancel: Отмена
default_block: По умолчанию
cache_strategy:
none: Нет
@@ -133,11 +161,11 @@ ru:
new:
title: Новый сайт
help: "Заполните форму, приведенную ниже, чтобы создать новый сайт."
+ domains:
+ empty: "Пока нет ни одного домена, привязанного к этому сайту. Просто добавьте домены ниже. Не забудьте обновить ваши DNS."
current_site:
edit:
- export: экспорт
- import: импорт
new_membership: добавить аккаунт
help: "Название сайта может быть изменено, если кликнуть на нем. Чтобы применить изменения, нажмите кнопку \"Save\"."
ask_for_name: "Пожалуйста введите новое имя сайта"
@@ -160,20 +188,13 @@ ru:
edit:
help: "Вы можете изменить логин просто кликнув на нем. Чтобы применить изменения, нажмите кнопку \"Сохранить\"."
new_site: новый сайт
- en: Английский
- de: Немецкий
- fr: Французский
- pt-BR: "Бразильский - Португальский"
- it: Итальянский
- nl: Голландский
- "no": норвежский
- es: Испанский
ask_for_name: "Пожалуйста введите ваш новый логин"
theme_assets:
index:
title: Список файлов темы
help: "Секция файлов темы это место, где вы можете управлять файлами, необходимыми для вашего шаблона, сниппетов и т.д. Если вам необходимо управление галереей изображений, создайте новый тип контента.
Внимание: вы можете не увидеть всех файлов - в зависимости от ваших прав."
+ quick_upload: Быстрая загрузка
new: новый файл
snippets: Сниппеты
css_and_js: Стили и javascript
@@ -196,29 +217,29 @@ ru:
picker_link: Вставить файл в код
choose_file: Выбрать файл
choose_plain_text: Выбрать простой текст
- images:
- title: Список изображений
- no_items: "Пока нет ни одного файла."
+ image_picker:
+ title: "Вставить изображение"
+ no_items: "Нет ни одного изображения."
+ upload: "Upload theme images"
- assets:
- new:
- title: Новый файл
- help: "Заполните форму, приведенную ниже, для создания файла (asset)."
- edit:
- title: Редактировать файл
- help: "Заполните форму, приведенную ниже, для изменения файла."
+ content_assets:
+ picker:
+ title: "Вставьте медиа-файл"
+ no_items: "Нет ни одного медиа-файла."
+ upload: "Загрузить медиа"
content_types:
index:
new: новая модель
+ edit: редактировать модель
new:
title: Новая модель
help: "Создайте ваши собственные модели данных (Проекты, Персоны, ...и т.д.). Модель должна иметь по крайней мере одно поле. Элементы, созданные из этого типа содержимого, будут иметь первое поле как обязательное."
edit:
title: Редактирование модели
help: "Ваша модель должна иметь по крайней мере одно поле. Элементы, созданные из этого типа содержимого, будут иметь это поле как обязательное."
- show_items: смотреть элементы
- new_item: новый элемент
+ show_entries: смотреть элементы
+ new_entry: новый элемент
form:
order_by:
created_at: 'По дате создания'
@@ -256,23 +277,6 @@ ru:
title: Кроссдоменная аутентификация
notice: Вы будете перенаправлены на вебсайт в течение нескольких секунд.
- import:
- new:
- title: Импортировать шаблон сайта
- help: "Будьте осторожны при загрузке нового шаблона для существующего сайта, ваши текущие данные могут быть изменены или даже удалены."
- show:
- title: Выполняется импорт
- help: "Ваш сайт обновляется из zip файла темы, который вы только что загрузили. Это займет несколько секунд."
- steps:
- site: Информация сайта
- content_types: Пользовательские типы содержимого
- assets: Файлы темы
- snippets: Сниппеты
- pages: Страницы
- messages:
- success: "Ваш сайт был успешно обновлен."
- failure: "Импорт не работает."
-
installation:
common:
title: Первая установка Locomotive
@@ -288,5 +292,21 @@ ru:
step_2:
title: "Шаг 2/2 — Создайте первый сайт"
explanations: "Если вы уже загрузили шаблон сайта по умолчанию (см. инструкцию), вы можете использовать его прямо сейчас. Или вы можете загрузить шаблон сайта как zip файл (доступные бесплатные шаблоны здесь)."
- back_to_default_template: "Нажмите здесь для выбора шаблона сайта по умолчанию"
+ default_site_locale: Локаль сайта по умолчанию
+ default_site_locales_hints: Вы всегда можете добавить больше локалей в разделе Настройки.
next: Создать сайт
+
+ public:
+ pages:
+ show_toolbar:
+ statuses:
+ loading: "Загрузка...."
+ disabled: "Встроенный редактор отключен"
+ labels:
+ save_changes: "Сохранить изменения: "
+ editing_mode: "Режим редактирования: "
+ lang: "Язык: "
+ buttons:
+ back: Назад в админку
+ confirm: Подтвердить
+ cancel: Отменить
diff --git a/config/locales/default.ru.yml b/config/locales/default.ru.yml
index 96e9d99a..091ebea9 100644
--- a/config/locales/default.ru.yml
+++ b/config/locales/default.ru.yml
@@ -1,5 +1,4 @@
ru:
-
errors:
messages:
domain_taken: "%{value} уже занято"
@@ -8,16 +7,15 @@ ru:
protected_page: "Вы не можете удалять стартовую или 404 страницы"
extname_changed: "Новый файл не имеет оригинального расширения"
array_too_short: "слишком мал (минимальное число элементов %{count})"
- liquid_syntax: "Ошибка синтаксиса Liquid ('%{error}')"
invalid_theme_file: "не может быть пустым или не является zip файлом"
-
- too_short: "слишком короткий (не менее %{count} символов)"
- blank: "не может быть пустым"
- invalid: "имеет неверное значение"
- confirmation: "не совпадает с подтверждением"
+ site:
+ default_locale_removed: Предыдущая локаль не может быть удалена.
page:
liquid_syntax: "Ошибка синтаксиса Liquid ('%{error}' в '%{fullpath}')"
- liquid_extend: "Страница '%{fullpath}' расширяет шаблон, который не существует"
+ liquid_extend: "Страница '%{fullpath}' наследует (расширяет) несуществующий шаблон"
+ liquid_translation: "Страница '%{fullpath}' наследует (расширяет) непереведенный шаблон"
+ too_few_custom_fields: "По крайней мере одно поле является обязательным"
+ security: "проблема безопасности"
attributes:
defaults:
diff --git a/config/locales/devise.ru.yml b/config/locales/devise.ru.yml
index cfe28b0a..108e223f 100644
--- a/config/locales/devise.ru.yml
+++ b/config/locales/devise.ru.yml
@@ -7,7 +7,7 @@ ru:
devise:
failure:
- locomotive:
+ locomotive_account:
unauthenticated: 'Вам необходимо войти или зарегистрироваться перед тем, как продолжить.'
unconfirmed: 'Вы должны подтвердить аккаунт перед продолжением.'
locked: 'Ваш аккаунт заблокирован.'
@@ -17,34 +17,34 @@ ru:
timeout: 'Срок действия вашей сессии истек, пожалуйста залогиньтесь для продолжения.'
inactive: 'Ваш аккаунт еще не был активирован.'
sessions:
- locomotive:
+ locomotive_account:
signed_in: 'Вход выполнен успешно.'
signed_out: 'Выход выполнен успешно.'
passwords:
- locomotive:
+ locomotive_account:
send_instructions: 'Вы получите письмо с инструкциями о том, как сбросить ваш пароль, через несколько минут.'
updated: 'Ваш пароль был успешно изменен. Вы вошли в систему.'
confirmations:
- locomotive:
+ locomotive_account:
send_instructions: 'Вы получите письмо с инструкциями о том, как подтвердить ваш аккаунт, через несколько минут.'
confirmed: 'Ваша учетная запись была успешно подтверждена. Вы вошли в систему.'
registrations:
- locomotive:
+ locomotive_account:
signed_up: 'Вы успешно зарегистрировались.'
updated: 'Вы успешно обновили ваш аккаунт.'
destroyed: 'До свидания! Ваш аккаунт был успешно отменен. Мы надеемся скоро увидеть вас снова.'
unlocks:
- locomotive:
+ locomotive_account:
send_instructions: 'Вам будет отправлено письмо с инструкциями о том, как разблокировать ваш аккаунт, в течение нескольких минут.'
unlocked: 'Ваша учетная запись была успешно разблокирована. Вы вошли в систему.'
mailer:
- locomotive:
+ locomotive_account:
confirmation_instructions: 'Инструкции подтверждения'
reset_password_instructions: 'Инструкции по сбросу пароля'
unlock_instructions: 'Инструкции по разблокированию'
-
-
- locomotive:
+
+
+ locomotive_account:
mailer:
common:
hello: Здравствуйте
diff --git a/config/locales/formtastic.ru.yml b/config/locales/formtastic.ru.yml
index f86f606f..7027d6bf 100644
--- a/config/locales/formtastic.ru.yml
+++ b/config/locales/formtastic.ru.yml
@@ -33,26 +33,28 @@ ru:
custom_fields:
field:
name: Алиас
- import:
- new:
- source: Файл
- samples: Копировать образцы
- reset: Сбросить сайт
- default_site_template: "Используйте шаблон сайта по умолчанию. Нажмите здесь для загрузки шаблона сайта в виде zip файла."
content_type:
- item_template: Шаблон элемента
- api_accounts: Уведомленные аккаунты
+ raw_item_template: Шаблон элемента
+ public_submission_enabled: Публичное представление
+ public_submission_accounts: Уведомленные аккаунты
+ "custom_fields/field":
+ select_options: "Опции"
content_entry:
_slug: Постоянная ссылка
account:
edit:
+ locale: Язык интерфейса пользователя
password: Новый пароль
password_confirmation: Подтверждение нового пароля
page:
seo_title: Название
+ target_klass_name: Model
+ site:
+ locales: Языки
hints:
page:
+ handle: "Уникальный идентификатор для поиска этой страницы из экземпляра внешнего rails-контроллера"
published: "Только аутентифицированным пользователям разрешается просматривать неопубликованные страницы."
cache_strategy: "Кэшировать страницу для лучшей производительности. Вариант 'Простое' является хорошим компромиссом."
listed: "Контролируйте возможность показа страницы из сгенерированных меню."
@@ -62,6 +64,7 @@ ru:
snippet:
slug: "Вам необходимо знать это для вставки сниппета в страницу"
site:
+ locales: "Перетащите и отпустите флаг на первую позицию, чтобы сделать ее локалью по умолчанию."
seo_title: "Задайте глобальное значение здесь, которое будет использовано как значение для тэга title в секции head."
meta_keywords: "Meta keywords используются внутри тэга head страницы. Они разделяются запятыми. Требуется для SEO."
meta_description: "Meta description используются для тэга head страницы. Необходимо для SEO."
@@ -77,10 +80,6 @@ ru:
source: "Текущий файл доступен здесь %{url}"
update:
source: "Текущий файл доступен здесь %{url}"
- custom_fields:
- field:
- name: "Свойство, доступное в шаблонах liquid"
- hint: "Текст, отображенный в форме модели, находится ниже поля"
content_entry:
_slug: "Свойство, используемое для генерации ссылки (url) на страницу, работающей как шаблон для этого типа содержимого (ex: \"template_page/{{ your_object._permalink }})\"."
seo_title: "Значение, вводимое вами, будет заменять SEO заголовок шаблонизированной страницы, связанной с вашей моделью."
@@ -91,7 +90,12 @@ ru:
samples: "Если включено, процесс импорта также скопирует содержимое и файлы"
reset: "Если включено, все данные вашего сайта будут уничтожены перед импортом нового сайта"
content_type:
- item_template: "Вы можете задавать текст, отображаемый для каждого элемента в списке. Просто используйте Liquid. Пр.: {{ entry.name }})"
- api_enabled: "Это используется для того, чтобы дать людям извне возможность создавать новые экземляры (пример: сообщения в форме контакта)"
- api_accounts: "Письмо с уведомлением будет отправлено на каждый аккаунт из списка выше, когда создан новый экземпляр"
+ name: "Необходимо вводить название модели во множественном числе. Например: Projects, Recipes, Posts, Articles, ...и т.д."
+ slug: "Поле будет использовано как имя коллекции в шаблонах liquid. Пр.: {{ contents.my_projects }}"
+ raw_item_template: "Вы можете задавать текст, отображаемый для каждого элемента в списке. Просто используйте Liquid. Пр.: {{ entry.name }})"
+ public_submission_enabled: "Это используется для того, чтобы дать людям извне возможность создавать новые экземляры (пример: сообщения в форме контакта)"
+ public_submission_accounts: "Письмо с уведомлением будет отправлено на каждый аккаунт из списка выше каждый раз, когда создается новый экземпляр (если включена опция публичного представления)"
+ "custom_fields/field":
+ name: "Имя свойства для шаблонов liquid. Пр.: {{ your_object.<name_of_your_field> }}"
+ hint: "Текст-подсказка, отображаемый на форме модели под полем"
diff --git a/doc/TODO b/doc/TODO
index e019557d..9fab69ea 100644
--- a/doc/TODO
+++ b/doc/TODO
@@ -8,4 +8,36 @@ x page with regexp url => wildcards
- write more tests
- find_spec
- features
-- clean code
\ No newline at end of file
+- clean code
+
+BACKLOG:
+
+- custom_fields:
+ - validation: regexp (pre-defined regexps ?)
+ x new type: belongs_to => association
+- inline editing (http://www.aloha-editor.com/wiki/index.php/Aloha_PHP_Example)
+ - html view in the aloha popup
+ - editable elements should wrap a tag: div, h1, ...etc (default span)
+ - edit images (upload new ones, ...etc) => wait for aloha or send them an email ?
+- upgrade warning if new version of locomotive (maybe based on the commit id)
+- deploying workflow:
+ - roll back a bad update
+ - conflicts with content types
+ - dev -> staging -> production
+ - sync data
+ - import only theme assets
+- endless pagination
+
+- tooltip to explain the difference between 1.) Admin 2.) Author 3.) Designer?
+- [bushido] guiders / welcome page / devise cas authentication (SSO)
+
+NICE TO HAVE:
+- export site
+- super_finder
+- traffic statistics
+- asset picker (content instance)
+- page with regexp url ?
+- automatic update !
+- page not found (front) => if logged in, link to create the page
+- switch to list (theme assets / assets ?). delete all in once (with checkbox) or see details (updated_at, size, ...etc)
+- code completion ? http://blog.quplo.com/2010/06/common-sense-code-completion/
\ No newline at end of file
diff --git a/features/api/authentication.feature b/features/api/authentication.feature
new file mode 100644
index 00000000..88e67926
--- /dev/null
+++ b/features/api/authentication.feature
@@ -0,0 +1,19 @@
+Feature: Authentication
+ In order to consume the API
+ As an admin
+ I need to get an authentication token
+
+ Background:
+ Given I have the site: "test site" set up
+
+ Scenario: Fail to get a token without an email and a password
+ When I post to "/locomotive/api/tokens.json"
+ Then the JSON response at "message" should be "The request must contain the user email and password."
+
+ Scenario: Get a token
+ When I post to "/locomotive/api/tokens.json" with:
+ """
+ { "email": "admin@locomotiveapp.org", "password": "easyone" }
+ """
+ Then the JSON response at "token" should be a string
+ And the JSON response should not have "message"
\ No newline at end of file
diff --git a/features/api/pages.feature b/features/api/pages.feature
new file mode 100644
index 00000000..1dec1085
--- /dev/null
+++ b/features/api/pages.feature
@@ -0,0 +1,29 @@
+Feature: Pages
+ In order to access the Page resources
+ As an admin
+ I will perform the basic RESTFUL actions on them
+
+ Background:
+ Given I have the site: "test site" set up
+ And I have an "admin" API token
+ And a page named "hello world" with the template:
+ """
+ Hello world :-)
+ """
+ And a page named "goodbye-world" with the template:
+ """
+ Goodbye world :-(
+ """
+
+ Scenario: Protect the pages resources if not authenticated
+ Given I do not have an API token
+ When I visit "/locomotive/api/pages.json"
+ Then the JSON response at "error" should be "You need to sign in or sign up before continuing."
+
+ Scenario: Accessing pages
+ When I visit "/locomotive/api/pages.json"
+ Then the JSON should have the following:
+ | 0/fullpath | "index" |
+ | 1/fullpath | "hello-world" |
+ | 2/fullpath | "404" |
+ | 3/fullpath | "goodbye-world" |
\ No newline at end of file
diff --git a/features/backoffice/mounting.feature b/features/backoffice/mounting.feature
new file mode 100644
index 00000000..0f6af821
--- /dev/null
+++ b/features/backoffice/mounting.feature
@@ -0,0 +1,13 @@
+Feature: Mounting Locomotive CMS
+ As an administrator
+ In order to gain some flexibility when mounting locomotive CMS
+ I want to be able to mount locomotove on any given path
+
+ Background:
+ Given I have a site set up
+
+ @javascript
+ Scenario: Accessing the backend when mounted on a custom path
+ Given the engine is mounted on a non standard path
+ And I am an authenticated "admin"
+ Then I should be able to access the backend
diff --git a/features/public/contact_form.feature b/features/public/contact_form.feature
new file mode 100644
index 00000000..cf1a3897
--- /dev/null
+++ b/features/public/contact_form.feature
@@ -0,0 +1,62 @@
+Feature: Contact form
+ As a visitor
+ In order to keep in touch with the site
+ I want to be able to send them a message
+
+ Background:
+ Given I have the site: "test site" set up
+ And I have a custom model named "Messages" with
+ | label | type | required |
+ | Email | string | true |
+ | Message | text | true |
+ And I enable the public submission of the "Messages" model
+ And a page named "contact" with the template:
+ """
+
+