locomotive_cms 2.0.0.rc7 → 2.0.0.rc8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile +6 -4
- data/README.textile +4 -3
- data/app/assets/images/locomotive/icons/flags/{no.png → nb.png} +0 -0
- data/app/assets/javascripts/aloha/plugins/custom/locomotive_media/lib/locomotive_media-plugin.js +1 -1
- data/app/assets/javascripts/locomotive/utils/core_ext.js +2 -0
- data/app/assets/javascripts/locomotive/views/application_view.js.coffee +7 -0
- data/app/assets/javascripts/locomotive/views/content_assets/picker_view.js.coffee +4 -1
- data/app/assets/javascripts/locomotive/views/content_entries/_form_view.js.coffee +4 -2
- data/app/assets/javascripts/locomotive/views/content_entries/_popup_form_view.js.coffee +8 -3
- data/app/assets/javascripts/locomotive/views/content_types/_form_view.js.coffee +0 -2
- data/app/assets/javascripts/locomotive/views/content_types/custom_field_entry_view.js.coffee +9 -2
- data/app/assets/javascripts/locomotive/views/current_site/edit_view.js.coffee +10 -11
- data/app/assets/javascripts/locomotive/views/inline_editor/application_view.js.coffee +9 -0
- data/app/assets/javascripts/locomotive/views/pages/_form_view.js.coffee +3 -3
- data/app/assets/javascripts/locomotive/views/shared/asset_picker_view.js.coffee +11 -18
- data/app/assets/javascripts/locomotive/views/shared/fields/many_to_many_view.js.coffee +0 -4
- data/app/assets/javascripts/locomotive/views/shared/form_view.js.coffee +2 -1
- data/app/assets/javascripts/locomotive/views/snippets/_form_view.js.coffee +3 -1
- data/app/assets/javascripts/locomotive/views/theme_assets/_form_view.js.coffee +4 -4
- data/app/assets/javascripts/locomotive/views/theme_assets/image_picker_view.js.coffee +10 -2
- data/app/assets/javascripts/tinymce/plugins/locomotive_media/editor_plugin.js +4 -1
- data/app/assets/stylesheets/locomotive/backoffice/codemirror_changes.css.scss +1 -0
- data/app/assets/stylesheets/locomotive/backoffice/datepicker.css.scss +1 -1
- data/app/assets/stylesheets/locomotive/backoffice/dialog_changes.css.scss +9 -3
- data/app/assets/stylesheets/locomotive/backoffice/formtastic_changes.css.scss +3 -1
- data/app/cells/locomotive/global_actions_cell.rb +1 -1
- data/app/controllers/locomotive/api/base_controller.rb +7 -4
- data/app/controllers/locomotive/api/content_assets_controller.rb +13 -0
- data/app/controllers/locomotive/api/content_types_controller.rb +14 -1
- data/app/controllers/locomotive/api/current_site_controller.rb +3 -1
- data/app/controllers/locomotive/api/memberships_controller.rb +49 -0
- data/app/controllers/locomotive/api/pages_controller.rb +14 -1
- data/app/controllers/locomotive/api/sites_controller.rb +44 -0
- data/app/controllers/locomotive/api/snippets_controller.rb +14 -1
- data/app/controllers/locomotive/api/theme_assets_controller.rb +13 -0
- data/app/controllers/locomotive/public/content_entries_controller.rb +7 -3
- data/app/helpers/locomotive/content_types_helper.rb +4 -0
- data/app/helpers/locomotive/custom_fields_helper.rb +1 -1
- data/app/models/locomotive/ability.rb +2 -0
- data/app/models/locomotive/content_entry.rb +4 -2
- data/app/models/locomotive/content_type.rb +7 -0
- data/app/models/locomotive/extensions/content_type/default_values.rb +1 -1
- data/app/models/locomotive/extensions/page/redirect.rb +1 -1
- data/app/models/locomotive/extensions/page/tree.rb +14 -1
- data/app/models/locomotive/site.rb +5 -1
- data/app/models/locomotive/theme_asset.rb +1 -1
- data/app/presenters/locomotive/membership_presenter.rb +7 -2
- data/app/presenters/locomotive/site_presenter.rb +5 -0
- data/app/views/locomotive/content_assets/_picker.html.haml +3 -3
- data/app/views/locomotive/content_entries/_form.html.haml +1 -1
- data/app/views/locomotive/content_types/_form.html.haml +2 -2
- data/app/views/locomotive/current_site/_form.html.haml +1 -1
- data/app/views/locomotive/custom_fields/types/_many_to_many.html.haml +5 -5
- data/app/views/locomotive/my_account/edit.html.haml +1 -1
- data/app/views/locomotive/pages/_form.html.haml +1 -1
- data/app/views/locomotive/public/pages/show_toolbar.html.haml +2 -2
- data/app/views/locomotive/public/sitemaps/show.xml.builder +2 -2
- data/app/views/locomotive/shared/_form_actions.html.haml +1 -1
- data/app/views/locomotive/shared/_head.html.haml +2 -2
- data/app/views/locomotive/snippets/_form.html.haml +1 -1
- data/app/views/locomotive/theme_assets/_form.html.haml +1 -1
- data/app/views/locomotive/theme_assets/index.html.haml +5 -5
- data/config/locales/admin_ui.de.yml +37 -31
- data/config/locales/admin_ui.en.yml +1 -1
- data/config/locales/admin_ui.es.yml +2 -1
- data/config/locales/admin_ui.fr.yml +1 -1
- data/config/locales/admin_ui.it.yml +2 -1
- data/config/locales/{admin_ui.no.yml → admin_ui.nb.yml} +72 -55
- data/config/locales/admin_ui.nl.yml +2 -1
- data/config/locales/admin_ui.pt-BR.yml +2 -1
- data/config/locales/admin_ui.ru.yml +1 -1
- data/config/locales/{carrierwave.no.yml → carrierwave.nb.yml} +1 -1
- data/config/locales/default.de.yml +13 -3
- data/config/locales/default.en.yml +5 -0
- data/config/locales/default.fr.yml +4 -0
- data/config/locales/{default.no.yml → default.nb.yml} +43 -1
- data/config/locales/{devise.no.yml → devise.nb.yml} +9 -9
- data/config/locales/{flash.no.yml → flash.nb.yml} +1 -1
- data/config/locales/{formtastic.no.yml → formtastic.nb.yml} +21 -17
- data/config/routes.rb +4 -0
- data/lib/generators/locomotive/install/templates/locomotive.rb +9 -2
- data/lib/locomotive.rb +1 -0
- data/lib/locomotive/configuration.rb +4 -3
- data/lib/locomotive/custom_fields.rb +2 -0
- data/lib/locomotive/liquid/drops/page.rb +1 -1
- data/lib/locomotive/liquid/tags/csrf.rb +40 -0
- data/lib/locomotive/liquid/tags/extends.rb +3 -9
- data/lib/locomotive/liquid/tags/nav.rb +8 -8
- data/lib/locomotive/mongoid/patches.rb +54 -9
- data/lib/locomotive/rails.rb +1 -0
- data/lib/locomotive/rails/action_view.rb +9 -0
- data/lib/locomotive/render.rb +4 -4
- data/lib/locomotive/version.rb +1 -1
- data/vendor/assets/javascripts/locomotive/backbone.modelbinding.js +13 -4
- metadata +259 -95
data/Gemfile
CHANGED
|
@@ -22,9 +22,8 @@ end
|
|
|
22
22
|
group :assets do
|
|
23
23
|
gem 'sass-rails', '~> 3.2.4'
|
|
24
24
|
gem 'coffee-rails', '~> 3.2.2'
|
|
25
|
-
gem 'uglifier', '~> 1.2.
|
|
26
|
-
gem 'compass'
|
|
27
|
-
gem 'compass-rails', :git => 'git://github.com/Compass/compass-rails.git'
|
|
25
|
+
gem 'uglifier', '~> 1.2.4'
|
|
26
|
+
gem 'compass-rails'
|
|
28
27
|
end
|
|
29
28
|
|
|
30
29
|
group :test do
|
|
@@ -36,6 +35,7 @@ group :test do
|
|
|
36
35
|
# gem 'growl-glue'
|
|
37
36
|
|
|
38
37
|
gem 'cucumber-rails', :require => false
|
|
38
|
+
gem 'poltergeist'
|
|
39
39
|
gem 'rspec-rails', '~> 2.8.0'
|
|
40
40
|
gem 'shoulda-matchers'
|
|
41
41
|
|
|
@@ -50,4 +50,6 @@ group :test do
|
|
|
50
50
|
gem 'json_spec'
|
|
51
51
|
|
|
52
52
|
gem 'database_cleaner'
|
|
53
|
-
|
|
53
|
+
|
|
54
|
+
# gem 'debugger', :git => 'git://github.com/cldwalker/debugger.git'
|
|
55
|
+
end
|
data/README.textile
CHANGED
|
@@ -24,8 +24,8 @@ h2. Gems
|
|
|
24
24
|
|
|
25
25
|
Here is a short list of main gems / technologies used in the application.
|
|
26
26
|
|
|
27
|
-
* Rails 3.2.
|
|
28
|
-
* Mongoid 2.4.
|
|
27
|
+
* Rails 3.2.5
|
|
28
|
+
* Mongoid 2.4.9 (with MongoDB 2.0)
|
|
29
29
|
* Liquid
|
|
30
30
|
* Devise
|
|
31
31
|
* Carrierwave
|
|
@@ -46,7 +46,7 @@ h2. Community
|
|
|
46
46
|
|
|
47
47
|
* 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)
|
|
48
48
|
* Join us on IRC "#locomotivecms at irc.freenode.net!":http://webchat.freenode.net/
|
|
49
|
-
* "Follow us on twitter":http://twitter.com/
|
|
49
|
+
* "Follow us on twitter":http://twitter.com/locomotivecms
|
|
50
50
|
|
|
51
51
|
h2. Contributing to Locomotive
|
|
52
52
|
|
|
@@ -55,6 +55,7 @@ Locomotive CMS is an open source project, we encourage contributions. If you hav
|
|
|
55
55
|
* Install ruby and mongoDB
|
|
56
56
|
* Clone the project <code>git clone git@github.com:locomotivecms/engine.git</code>
|
|
57
57
|
* Setup a virtual host entry for <code>test.example.com</code> to point to localhost
|
|
58
|
+
* Install PhantomJS (Required for the cucumber suite See: https://github.com/jonleighton/poltergeist)
|
|
58
59
|
* Run the tests <code>rake</code>
|
|
59
60
|
* Write your failing tests
|
|
60
61
|
* Make the tests pass
|
|
File without changes
|
|
@@ -83,3 +83,10 @@ class Locomotive.Views.ApplicationView extends Backbone.View
|
|
|
83
83
|
locale = $(@).attr('data-locale')
|
|
84
84
|
window.addParameterToURL 'content_locale', locale
|
|
85
85
|
|
|
86
|
+
unique_dialog_zindex: ->
|
|
87
|
+
# returns the number of jQuery UI modals created in order to set a valid zIndex for each of them.
|
|
88
|
+
# Each modal window should have a different zIndex, otherwise there will be conflicts between them.
|
|
89
|
+
window.Locomotive.jQueryModals ||= 0
|
|
90
|
+
|
|
91
|
+
998 + window.Locomotive.jQueryModals++
|
|
92
|
+
|
|
@@ -12,7 +12,10 @@ class Locomotive.Views.ContentAssets.PickerView extends Locomotive.Views.Shared.
|
|
|
12
12
|
ich.content_asset_picker
|
|
13
13
|
|
|
14
14
|
fetch_assets: ->
|
|
15
|
-
@
|
|
15
|
+
@_reset()
|
|
16
|
+
@collection.fetch
|
|
17
|
+
success: () =>
|
|
18
|
+
@open()
|
|
16
19
|
|
|
17
20
|
build_uploader: (el, link) ->
|
|
18
21
|
link.bind 'click', (event) ->
|
|
@@ -50,11 +50,13 @@ class Locomotive.Views.ContentEntries.FormView extends Locomotive.Views.Shared.F
|
|
|
50
50
|
settings = _.extend {}, @tinyMCE_settings(),
|
|
51
51
|
oninit: ((editor) =>
|
|
52
52
|
$.cmd 'S', (() =>
|
|
53
|
-
|
|
53
|
+
editor.save()
|
|
54
|
+
$(textarea).trigger('changeSilently')
|
|
54
55
|
@$('form').trigger('submit')
|
|
55
56
|
), [], ignoreCase: true, document: editor.dom.doc),
|
|
56
57
|
onchange_callback: (editor) =>
|
|
57
|
-
|
|
58
|
+
editor.save()
|
|
59
|
+
$(textarea).trigger('changeSilently')
|
|
58
60
|
|
|
59
61
|
$(textarea).tinymce(settings)
|
|
60
62
|
|
|
@@ -26,11 +26,9 @@ class Locomotive.Views.ContentEntries.PopupFormView extends Locomotive.Views.Con
|
|
|
26
26
|
@dialog = $(@el).dialog
|
|
27
27
|
autoOpen: false
|
|
28
28
|
modal: true
|
|
29
|
-
zIndex:
|
|
29
|
+
zIndex: window.application_view.unique_dialog_zindex()
|
|
30
30
|
width: 770,
|
|
31
31
|
create: (event, ui) =>
|
|
32
|
-
$('.ui-widget-overlay').bind 'click', => @close()
|
|
33
|
-
|
|
34
32
|
$(@el).prev().find('.ui-dialog-title').html(@$('h2').html())
|
|
35
33
|
@$('h2').remove()
|
|
36
34
|
actions = @$('.dialog-actions').appendTo($(@el).parent()).addClass('ui-dialog-buttonpane ui-widget-content ui-helper-clearfix')
|
|
@@ -39,6 +37,7 @@ class Locomotive.Views.ContentEntries.PopupFormView extends Locomotive.Views.Con
|
|
|
39
37
|
actions.find('input[type=submit]').click (event) => @save(event)
|
|
40
38
|
|
|
41
39
|
open: (event, ui, extra) =>
|
|
40
|
+
$(@el).dialog('overlayEl').bind 'click', => @close()
|
|
42
41
|
# nothing to do
|
|
43
42
|
|
|
44
43
|
open: ->
|
|
@@ -50,11 +49,14 @@ class Locomotive.Views.ContentEntries.PopupFormView extends Locomotive.Views.Con
|
|
|
50
49
|
parent_el.find('.new-section').hide()
|
|
51
50
|
parent_el.find('.edit-section').show()
|
|
52
51
|
|
|
52
|
+
@clear_errors()
|
|
53
|
+
|
|
53
54
|
$(@el).dialog('open')
|
|
54
55
|
|
|
55
56
|
close: (event) ->
|
|
56
57
|
event.stopPropagation() & event.preventDefault() if event?
|
|
57
58
|
@clear_errors()
|
|
59
|
+
$(@el).dialog('overlayEl').unbind('click')
|
|
58
60
|
$(@el).dialog('close')
|
|
59
61
|
|
|
60
62
|
center: ->
|
|
@@ -69,6 +71,9 @@ class Locomotive.Views.ContentEntries.PopupFormView extends Locomotive.Views.Con
|
|
|
69
71
|
else
|
|
70
72
|
@refresh()
|
|
71
73
|
|
|
74
|
+
slugify_label_field: ->
|
|
75
|
+
# disabled in a popup form
|
|
76
|
+
|
|
72
77
|
enable_has_many_fields: ->
|
|
73
78
|
# disabled in a popup form
|
|
74
79
|
|
data/app/assets/javascripts/locomotive/views/content_types/custom_field_entry_view.js.coffee
CHANGED
|
@@ -58,11 +58,18 @@ class Locomotive.Views.ContentTypes.CustomFieldEntryView extends Backbone.View
|
|
|
58
58
|
fetch_inverse_of_list: ->
|
|
59
59
|
@$('li.input.inverse-of select option').remove()
|
|
60
60
|
|
|
61
|
-
|
|
61
|
+
list = @inverse_of_list[@model.get('type')] || []
|
|
62
|
+
|
|
63
|
+
_.each list, (data) =>
|
|
62
64
|
if data.class_name == @model.get('class_name')
|
|
63
|
-
option = new Option(data.label, data.name, data.
|
|
65
|
+
option = new Option(data.label, data.name, data.name == @model.get('inverse_of') || list.length == 1)
|
|
64
66
|
@$('li.input.inverse-of select').append(option)
|
|
65
67
|
|
|
68
|
+
# by default, select the first option
|
|
69
|
+
if !@model.get('inverse_of')? && list.length > 0
|
|
70
|
+
@model.set
|
|
71
|
+
inverse_of: list[0].name
|
|
72
|
+
|
|
66
73
|
render_select_options_view: ->
|
|
67
74
|
@select_options_view = new Locomotive.Views.ContentTypes.SelectOptionsView
|
|
68
75
|
model: @model
|
|
@@ -15,8 +15,6 @@ class Locomotive.Views.CurrentSite.EditView extends Locomotive.Views.Shared.Form
|
|
|
15
15
|
|
|
16
16
|
Backbone.ModelBinding.bind @, checkbox: 'class'
|
|
17
17
|
|
|
18
|
-
window.foo = @model
|
|
19
|
-
|
|
20
18
|
render: ->
|
|
21
19
|
super()
|
|
22
20
|
|
|
@@ -57,15 +55,16 @@ class Locomotive.Views.CurrentSite.EditView extends Locomotive.Views.Shared.Form
|
|
|
57
55
|
@$('#site_memberships_input').append(@memberships_view.render().el)
|
|
58
56
|
|
|
59
57
|
enable_liquid_editing: ->
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
58
|
+
if($('#site_robots_txt').length)
|
|
59
|
+
input = @$('#site_robots_txt')
|
|
60
|
+
@editor = CodeMirror.fromTextArea input.get()[0],
|
|
61
|
+
mode: 'liquid'
|
|
62
|
+
autoMatchParens: false
|
|
63
|
+
lineNumbers: false
|
|
64
|
+
passDelay: 50
|
|
65
|
+
tabMode: 'shift'
|
|
66
|
+
theme: 'default'
|
|
67
|
+
onChange: (editor) => @model.set(robots_txt: editor.getValue())
|
|
69
68
|
|
|
70
69
|
save: (event) ->
|
|
71
70
|
if @model.includes_domain(window.location.host)
|
|
@@ -24,6 +24,8 @@ class Locomotive.Views.InlineEditor.ApplicationView extends Backbone.View
|
|
|
24
24
|
|
|
25
25
|
@toolbar_view.render()
|
|
26
26
|
|
|
27
|
+
@content_assets_picker_view.render()
|
|
28
|
+
|
|
27
29
|
enable_iframe_autoheight: ->
|
|
28
30
|
iframe = @iframe
|
|
29
31
|
|
|
@@ -89,6 +91,13 @@ class Locomotive.Views.InlineEditor.ApplicationView extends Backbone.View
|
|
|
89
91
|
toolbar_view.show_status 'loading'
|
|
90
92
|
window.history.pushState('Object', 'Title', link.attr('href').replace('_edit', '_admin'))
|
|
91
93
|
|
|
94
|
+
unique_dialog_zindex: ->
|
|
95
|
+
# returns the number of jQuery UI modals created in order to set a valid zIndex for each of them.
|
|
96
|
+
# Each modal window should have a different zIndex, otherwise there will be conflicts between them.
|
|
97
|
+
window.Locomotive.jQueryModals ||= 0
|
|
98
|
+
|
|
99
|
+
1050 + window.Locomotive.jQueryModals++
|
|
100
|
+
|
|
92
101
|
_$: (selector) ->
|
|
93
102
|
$(selector, @iframe[0].contentWindow.document)
|
|
94
103
|
|
|
@@ -16,14 +16,14 @@ class Locomotive.Views.Pages.FormView extends Locomotive.Views.Shared.FormView
|
|
|
16
16
|
|
|
17
17
|
@model = new Locomotive.Models.Page(@options.page)
|
|
18
18
|
|
|
19
|
-
window.foo = @model
|
|
20
|
-
|
|
21
19
|
@touched_url = false
|
|
22
20
|
|
|
23
21
|
@image_picker_view = new Locomotive.Views.ThemeAssets.ImagePickerView
|
|
24
22
|
collection: new Locomotive.Models.ThemeAssetsCollection()
|
|
25
23
|
on_select: @insert_image
|
|
26
24
|
|
|
25
|
+
@image_picker_view.render()
|
|
26
|
+
|
|
27
27
|
Backbone.ModelBinding.bind @
|
|
28
28
|
|
|
29
29
|
@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
|
|
|
58
58
|
open_image_picker: (event) ->
|
|
59
59
|
event.stopPropagation() & event.preventDefault()
|
|
60
60
|
@image_picker_view.editor = @editor
|
|
61
|
-
@image_picker_view.
|
|
61
|
+
@image_picker_view.fetch_assets()
|
|
62
62
|
|
|
63
63
|
insert_image: (path) ->
|
|
64
64
|
text = "{{ '#{path}' | theme_image_url }}"
|
|
@@ -11,11 +11,9 @@ class Locomotive.Views.Shared.AssetPickerView extends Backbone.View
|
|
|
11
11
|
@collection.bind('remove', @remove_asset)
|
|
12
12
|
|
|
13
13
|
render: ->
|
|
14
|
-
@_reset()
|
|
15
|
-
|
|
16
14
|
$(@el).html(@template()())
|
|
17
15
|
|
|
18
|
-
@
|
|
16
|
+
@create_dialog()
|
|
19
17
|
|
|
20
18
|
return @
|
|
21
19
|
|
|
@@ -29,33 +27,32 @@ class Locomotive.Views.Shared.AssetPickerView extends Backbone.View
|
|
|
29
27
|
# please overide build_uploader
|
|
30
28
|
|
|
31
29
|
create_dialog: ->
|
|
32
|
-
@dialog
|
|
30
|
+
@dialog ||= $(@el).dialog
|
|
31
|
+
autoOpen: false
|
|
33
32
|
modal: true
|
|
34
|
-
zIndex:
|
|
33
|
+
zIndex: window.application_view.unique_dialog_zindex()
|
|
35
34
|
width: 650,
|
|
36
35
|
create: (event, ui) =>
|
|
37
|
-
$('.ui-widget-overlay').bind 'click', => @close()
|
|
38
|
-
|
|
39
36
|
$(@el).prev().find('.ui-dialog-title').html(@$('h2').html())
|
|
40
37
|
@$('h2').remove()
|
|
41
38
|
actions = @$('.dialog-actions').appendTo($(@el).parent()).addClass('ui-dialog-buttonpane ui-widget-content ui-helper-clearfix')
|
|
42
39
|
|
|
43
40
|
actions.find('#close-link').click (event) => @close(event)
|
|
44
41
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
el = actions.find('input[type=file]')
|
|
48
|
-
link = actions.find('#upload-link')
|
|
42
|
+
input = actions.find('input[type=file]')
|
|
43
|
+
link = actions.find('#upload-link')
|
|
49
44
|
|
|
50
|
-
@build_uploader(
|
|
45
|
+
@build_uploader(input, link)
|
|
51
46
|
|
|
52
|
-
|
|
47
|
+
open: (event, ui, extra) =>
|
|
48
|
+
$(@el).dialog('overlayEl').bind 'click', => @close()
|
|
53
49
|
|
|
54
50
|
open: ->
|
|
55
51
|
$(@el).dialog('open')
|
|
56
52
|
|
|
57
53
|
close: (event) ->
|
|
58
54
|
event.stopPropagation() & event.preventDefault() if event?
|
|
55
|
+
$(@el).dialog('overlayEl').unbind('click')
|
|
59
56
|
$(@el).dialog('close')
|
|
60
57
|
|
|
61
58
|
shake: ->
|
|
@@ -70,8 +67,6 @@ class Locomotive.Views.Shared.AssetPickerView extends Backbone.View
|
|
|
70
67
|
|
|
71
68
|
@_refresh()
|
|
72
69
|
|
|
73
|
-
setTimeout (=> @create_dialog()), 30 # disable flickering
|
|
74
|
-
|
|
75
70
|
add_asset: (asset, first) ->
|
|
76
71
|
# please overide add_asset (the 'first' param is to know if it comes from the first collection fetch)
|
|
77
72
|
|
|
@@ -94,6 +89,4 @@ class Locomotive.Views.Shared.AssetPickerView extends Backbone.View
|
|
|
94
89
|
_on_refresh: ->
|
|
95
90
|
|
|
96
91
|
_reset: ->
|
|
97
|
-
|
|
98
|
-
@$('.actions input[type=file]').remove()
|
|
99
|
-
@dialog.dialog('destroy') if @dialog?
|
|
92
|
+
# for nothing to do
|
|
@@ -24,10 +24,6 @@ class Locomotive.Views.Shared.Fields.ManyToManyView extends Backbone.View
|
|
|
24
24
|
@collection = @model.get(@options.name)
|
|
25
25
|
@all_entries = @options.all_entries
|
|
26
26
|
|
|
27
|
-
window.collection = @collection
|
|
28
|
-
window.bar = @all_entries
|
|
29
|
-
window.model = @model
|
|
30
|
-
|
|
31
27
|
render: ->
|
|
32
28
|
$(@el).html(@template()())
|
|
33
29
|
|
|
@@ -36,7 +36,8 @@ class Locomotive.Views.Shared.FormView extends Backbone.View
|
|
|
36
36
|
previous_attributes = _.clone @model.attributes
|
|
37
37
|
|
|
38
38
|
@model.save {},
|
|
39
|
-
headers:
|
|
39
|
+
headers: options.headers
|
|
40
|
+
silent: true # since we pass an empty hash above, no need to trigger the callbacks
|
|
40
41
|
success: (model, response, xhr) =>
|
|
41
42
|
form.trigger('ajax:complete')
|
|
42
43
|
|
|
@@ -19,6 +19,8 @@ class Locomotive.Views.Snippets.FormView extends Locomotive.Views.Shared.FormVie
|
|
|
19
19
|
collection: new Locomotive.Models.ThemeAssetsCollection()
|
|
20
20
|
on_select: @insert_image
|
|
21
21
|
|
|
22
|
+
@image_picker_view.render()
|
|
23
|
+
|
|
22
24
|
Backbone.ModelBinding.bind @
|
|
23
25
|
|
|
24
26
|
render: ->
|
|
@@ -38,7 +40,7 @@ class Locomotive.Views.Snippets.FormView extends Locomotive.Views.Shared.FormVie
|
|
|
38
40
|
open_image_picker: (event) ->
|
|
39
41
|
event.stopPropagation() & event.preventDefault()
|
|
40
42
|
@image_picker_view.editor = @editor
|
|
41
|
-
@image_picker_view.
|
|
43
|
+
@image_picker_view.fetch_assets()
|
|
42
44
|
|
|
43
45
|
insert_image: (path) ->
|
|
44
46
|
text = "{{ '#{path}' | theme_image_url }}"
|
|
@@ -15,10 +15,10 @@ class Locomotive.Views.ThemeAssets.FormView extends Locomotive.Views.Shared.Form
|
|
|
15
15
|
|
|
16
16
|
@model = new Locomotive.Models.ThemeAsset(@options.theme_asset)
|
|
17
17
|
|
|
18
|
-
window.foo = @model
|
|
19
|
-
|
|
20
18
|
@image_picker_view = new Locomotive.Views.ThemeAssets.ImagePickerView on_select: @insert_image
|
|
21
19
|
|
|
20
|
+
@image_picker_view.render()
|
|
21
|
+
|
|
22
22
|
Backbone.ModelBinding.bind @
|
|
23
23
|
|
|
24
24
|
render: ->
|
|
@@ -72,10 +72,10 @@ class Locomotive.Views.ThemeAssets.FormView extends Locomotive.Views.Shared.Form
|
|
|
72
72
|
open_image_picker: (event) ->
|
|
73
73
|
event.stopPropagation() & event.preventDefault()
|
|
74
74
|
@image_picker_view.editor = @editor
|
|
75
|
-
@image_picker_view.
|
|
75
|
+
@image_picker_view.fetch_assets()
|
|
76
76
|
|
|
77
77
|
insert_image: (path) ->
|
|
78
|
-
text = "
|
|
78
|
+
text = "'#{path}'"
|
|
79
79
|
@editor.replaceSelection(text)
|
|
80
80
|
@image_picker_view.close()
|
|
81
81
|
|
|
@@ -15,7 +15,12 @@ class Locomotive.Views.ThemeAssets.ImagePickerView extends Locomotive.Views.Shar
|
|
|
15
15
|
ich.theme_image_picker
|
|
16
16
|
|
|
17
17
|
fetch_assets: ->
|
|
18
|
-
@
|
|
18
|
+
@_reset()
|
|
19
|
+
@collection.fetch
|
|
20
|
+
data:
|
|
21
|
+
content_type: 'image'
|
|
22
|
+
success: () =>
|
|
23
|
+
@open()
|
|
19
24
|
|
|
20
25
|
build_uploader: (el, link) ->
|
|
21
26
|
link.bind 'click', (event) ->
|
|
@@ -37,4 +42,7 @@ class Locomotive.Views.ThemeAssets.ImagePickerView extends Locomotive.Views.Shar
|
|
|
37
42
|
|
|
38
43
|
add_asset: (asset) ->
|
|
39
44
|
@$('ul.list').append(ich.theme_asset(asset.toJSON()))
|
|
40
|
-
@_refresh()
|
|
45
|
+
@_refresh()
|
|
46
|
+
|
|
47
|
+
_reset: ->
|
|
48
|
+
@$('ul.list').empty()
|