locomotivecms 3.0.0.pre.alpha.2 → 3.0.0.pre.alpha.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +3 -2
- data/README.md +1 -1
- data/app/api/locomotive/api/forms/membership_form.rb +13 -0
- data/app/api/locomotive/api/resources/membership_resource.rb +5 -3
- data/app/assets/javascripts/locomotive.js +2 -0
- data/app/assets/javascripts/locomotive/utils/backbone_patches.js.coffee +15 -1
- data/app/assets/javascripts/locomotive/utils/file.js.coffee +20 -0
- data/app/assets/javascripts/locomotive/utils/nprogress.js.coffee +5 -0
- data/app/assets/javascripts/locomotive/utils/rails_ujs.js.coffee +36 -0
- data/app/assets/javascripts/locomotive/utils/wysihtml5.js.coffee +1 -1
- data/app/assets/javascripts/locomotive/views/content_assets/picker_view.js.coffee +9 -17
- data/app/assets/javascripts/locomotive/views/editable_elements/edit_view.js.coffee +39 -0
- data/app/assets/javascripts/locomotive/views/editable_elements/index_view.js.coffee +104 -1
- data/app/assets/javascripts/locomotive/views/inputs/file_view.js.coffee +79 -10
- data/app/assets/javascripts/locomotive/views/inputs/rte/file_view.js.coffee +24 -4
- data/app/assets/javascripts/locomotive/views/inputs/rte_view.js.coffee.erb +18 -0
- data/app/assets/javascripts/locomotive/views/pages/new_view.js.coffee +3 -6
- data/app/assets/javascripts/locomotive/views/shared/drawer_view.js.coffee +24 -8
- data/app/assets/javascripts/locomotive/views/shared/form_view.js.coffee +21 -148
- data/app/assets/stylesheets/locomotive/application.scss +6 -0
- data/app/assets/stylesheets/locomotive/base/_form.scss +1 -0
- data/app/assets/stylesheets/locomotive/base/form/_base.scss +9 -0
- data/app/assets/stylesheets/locomotive/base/form/_file_input.scss +1 -1
- data/app/assets/stylesheets/locomotive/base/form/_link.scss +13 -0
- data/app/assets/stylesheets/locomotive/base/form/_select2.scss +28 -1
- data/app/assets/stylesheets/locomotive/components/_drawer.scss +8 -18
- data/app/assets/stylesheets/locomotive/components/_live_editing.scss +83 -0
- data/app/assets/stylesheets/locomotive/components/_transitions.scss +63 -1
- data/app/assets/stylesheets/locomotive/components/header/_base.scss +5 -1
- data/app/assets/stylesheets/locomotive/components/misc/_notify.scss +5 -7
- data/app/assets/stylesheets/locomotive/globals/_bootstrap.scss +4 -4
- data/app/assets/stylesheets/locomotive/globals/_mixins.scss +16 -0
- data/app/assets/stylesheets/locomotive/globals/_nprogress.scss +3 -0
- data/app/assets/stylesheets/locomotive/globals/_variables.scss +57 -49
- data/app/assets/stylesheets/locomotive/layouts/_live_editing.scss +29 -0
- data/app/controllers/locomotive/editable_elements_controller.rb +49 -2
- data/app/controllers/locomotive/pages_controller.rb +2 -2
- data/app/helpers/locomotive/custom_fields_helper.rb +1 -1
- data/app/helpers/locomotive/editable_elements_helper.rb +40 -0
- data/app/helpers/locomotive/pages_helper.rb +0 -1
- data/app/inputs/locomotive/array_input.rb +1 -1
- data/app/inputs/locomotive/file_input.rb +35 -7
- data/app/inputs/locomotive/rte_input.rb +2 -1
- data/app/inputs/locomotive/toggle_input.rb +1 -1
- data/app/models/locomotive/concerns/content_entry/localized.rb +4 -4
- data/app/models/locomotive/concerns/content_type/sync.rb +0 -5
- data/app/models/locomotive/concerns/page/redirect.rb +1 -1
- data/app/models/locomotive/content_entry.rb +5 -11
- data/app/models/locomotive/content_type.rb +22 -0
- data/app/models/locomotive/editable_control.rb +12 -27
- data/app/models/locomotive/editable_element.rb +8 -0
- data/app/models/locomotive/editable_file.rb +0 -1
- data/app/models/locomotive/editable_text.rb +10 -10
- data/app/models/locomotive/page.rb +1 -1
- data/app/policies/locomotive/page_policy.rb +1 -1
- data/app/services/locomotive/editable_element_service.rb +47 -0
- data/app/services/locomotive/page_parsing_service.rb +85 -31
- data/app/uploaders/locomotive/editable_file_uploader.rb +5 -1
- data/app/views/locomotive/editable_elements/_edit.html.haml +49 -0
- data/app/views/locomotive/editable_elements/_edit_with_content_entry.html.haml +21 -0
- data/app/views/locomotive/editable_elements/_form.html.haml +23 -0
- data/app/views/locomotive/editable_elements/index.html.haml +8 -2
- data/app/views/locomotive/editable_elements/index_without_preview.html.haml +33 -0
- data/app/views/locomotive/layouts/{preview.html.haml → live_editing.html.haml} +9 -9
- data/app/views/locomotive/my_account/form/_main.html.haml +1 -1
- data/app/views/locomotive/pages/form/_actions.html.haml +8 -1
- data/app/views/locomotive/pages/form/_main.html.haml +1 -1
- data/app/views/locomotive/pages/form/_tabs.html.haml +2 -2
- data/app/views/locomotive/pages/new.html.haml +1 -1
- data/app/views/locomotive/shared/header/_site.html.haml +1 -1
- data/app/views/locomotive/shared/rte/_image_popover.html.haml +2 -2
- data/app/views/locomotive/shared/rte/_link_popover.html.haml +1 -1
- data/app/views/locomotive/shared/sidebar/_page.html.haml +5 -2
- data/config/locales/admin_ui.en.yml +10 -16
- data/config/locales/inputs.en.yml +18 -11
- data/config/locales/simple_form.en.yml +13 -1
- data/config/routes.rb +3 -1
- data/lib/locomotive.rb +1 -1
- data/lib/locomotive/action_controller/responder.rb +16 -0
- data/lib/locomotive/carrierwave/patches.rb +54 -0
- data/lib/locomotive/dependencies.rb +1 -0
- data/lib/locomotive/engine.rb +9 -3
- data/lib/locomotive/middlewares.rb +1 -1
- data/lib/locomotive/middlewares/page_editing.rb +41 -0
- data/lib/locomotive/middlewares/site.rb +2 -0
- data/lib/locomotive/simple_form.rb +6 -5
- data/lib/locomotive/steam_adaptor.rb +2 -0
- data/lib/locomotive/version.rb +1 -1
- data/lib/tasks/development.rake +4 -0
- data/spec/dummy/config/environments/production.rb +2 -0
- data/spec/dummy/config/initializers/devise.rb +2 -0
- data/spec/dummy/config/mongoid.yml +2 -2
- data/spec/models/locomotive/content_entry_spec.rb +11 -2
- data/spec/support/factories.rb +0 -1
- data/vendor/assets/javascripts/locomotive/history.js +2122 -0
- data/vendor/assets/javascripts/locomotive/subscribe.js +206 -329
- metadata +44 -127
- data/lib/locomotive/middlewares/permalink.rb +0 -22
- data/lib/locomotive/previous_liquid/asset_host.rb +0 -51
- data/lib/locomotive/previous_liquid/drops/base.rb +0 -40
- data/lib/locomotive/previous_liquid/drops/content_entry.rb +0 -78
- data/lib/locomotive/previous_liquid/drops/content_types.rb +0 -119
- data/lib/locomotive/previous_liquid/drops/current_user.rb +0 -21
- data/lib/locomotive/previous_liquid/drops/page.rb +0 -115
- data/lib/locomotive/previous_liquid/drops/proxy_collection.rb +0 -64
- data/lib/locomotive/previous_liquid/drops/session_proxy.rb +0 -16
- data/lib/locomotive/previous_liquid/drops/site.rb +0 -29
- data/lib/locomotive/previous_liquid/drops/uploader.rb +0 -21
- data/lib/locomotive/previous_liquid/errors.rb +0 -8
- data/lib/locomotive/previous_liquid/filters/base.rb +0 -61
- data/lib/locomotive/previous_liquid/filters/date.rb +0 -82
- data/lib/locomotive/previous_liquid/filters/html.rb +0 -117
- data/lib/locomotive/previous_liquid/filters/misc.rb +0 -75
- data/lib/locomotive/previous_liquid/filters/resize.rb +0 -18
- data/lib/locomotive/previous_liquid/filters/text.rb +0 -53
- data/lib/locomotive/previous_liquid/filters/translate.rb +0 -38
- data/lib/locomotive/previous_liquid/patches.rb +0 -21
- data/lib/locomotive/previous_liquid/tags/consume.rb +0 -104
- data/lib/locomotive/previous_liquid/tags/csrf.rb +0 -40
- data/lib/locomotive/previous_liquid/tags/editable.rb +0 -4
- data/lib/locomotive/previous_liquid/tags/editable/base.rb +0 -88
- data/lib/locomotive/previous_liquid/tags/editable/control.rb +0 -41
- data/lib/locomotive/previous_liquid/tags/editable/file.rb +0 -43
- data/lib/locomotive/previous_liquid/tags/editable/text.rb +0 -79
- data/lib/locomotive/previous_liquid/tags/extends.rb +0 -47
- data/lib/locomotive/previous_liquid/tags/fetch_page.rb +0 -36
- data/lib/locomotive/previous_liquid/tags/google_analytics.rb +0 -39
- data/lib/locomotive/previous_liquid/tags/hybrid.rb +0 -25
- data/lib/locomotive/previous_liquid/tags/inherited_block.rb +0 -31
- data/lib/locomotive/previous_liquid/tags/inline_editor.rb +0 -40
- data/lib/locomotive/previous_liquid/tags/javascript.rb +0 -16
- data/lib/locomotive/previous_liquid/tags/link_to.rb +0 -43
- data/lib/locomotive/previous_liquid/tags/locale_switcher.rb +0 -83
- data/lib/locomotive/previous_liquid/tags/model_form.rb +0 -75
- data/lib/locomotive/previous_liquid/tags/nav.rb +0 -164
- data/lib/locomotive/previous_liquid/tags/paginate.rb +0 -114
- data/lib/locomotive/previous_liquid/tags/path_helper.rb +0 -85
- data/lib/locomotive/previous_liquid/tags/path_to.rb +0 -21
- data/lib/locomotive/previous_liquid/tags/seo.rb +0 -72
- data/lib/locomotive/previous_liquid/tags/session_assign.rb +0 -39
- data/lib/locomotive/previous_liquid/tags/snippet.rb +0 -75
- data/lib/locomotive/previous_liquid/tags/with_scope.rb +0 -65
- data/spec/fixtures/portfolio/Gemfile +0 -21
- data/spec/fixtures/portfolio/app/content_types/messages.yml +0 -57
- data/spec/fixtures/portfolio/app/content_types/projects.yml +0 -74
- data/spec/fixtures/portfolio/app/views/pages/404.liquid.haml +0 -10
- data/spec/fixtures/portfolio/app/views/pages/index.liquid.haml +0 -213
- data/spec/fixtures/portfolio/app/views/snippets/footer.liquid.haml +0 -2
- data/spec/fixtures/portfolio/config.ru +0 -3
- data/spec/fixtures/portfolio/config/deploy.yml +0 -18
- data/spec/fixtures/portfolio/config/site.yml +0 -33
- data/spec/fixtures/portfolio/config/translations.yml +0 -8
- data/spec/fixtures/portfolio/data/messages.yml +0 -1
- data/spec/fixtures/portfolio/data/projects.yml +0 -41
- data/spec/fixtures/portfolio/icon.png +0 -0
- data/spec/fixtures/portfolio/public/javascripts/bootstrap.min.js +0 -6
- data/spec/fixtures/portfolio/public/javascripts/cbpAnimatedHeader.js +0 -44
- data/spec/fixtures/portfolio/public/javascripts/cbpAnimatedHeader.min.js +0 -11
- data/spec/fixtures/portfolio/public/javascripts/classie.js +0 -80
- data/spec/fixtures/portfolio/public/javascripts/contact_me.js +0 -65
- data/spec/fixtures/portfolio/public/javascripts/freelancer.js +0 -37
- data/spec/fixtures/portfolio/public/javascripts/jqBootstrapValidation.js +0 -912
- data/spec/fixtures/portfolio/public/samples/portfolio/cabin.png +0 -0
- data/spec/fixtures/portfolio/public/samples/portfolio/cake.png +0 -0
- data/spec/fixtures/portfolio/public/samples/portfolio/circus.png +0 -0
- data/spec/fixtures/portfolio/public/samples/portfolio/game.png +0 -0
- data/spec/fixtures/portfolio/public/samples/portfolio/safe.png +0 -0
- data/spec/fixtures/portfolio/public/samples/portfolio/submarine.png +0 -0
- data/spec/fixtures/portfolio/public/samples/profile.png +0 -0
- data/spec/fixtures/portfolio/public/stylesheets/bootstrap.min.css +0 -7
- data/spec/fixtures/portfolio/public/stylesheets/freelancer.css +0 -445
- data/spec/lib/locomotive/liquid/tags/editable/file_spec.rb +0 -72
- data/spec/lib/locomotive/liquid/tags/editable/text_spec.rb +0 -85
- data/spec/lib/locomotive/liquid/tags/extends_spec.rb +0 -58
- data/vendor/assets/javascripts/locomotive/editable_field.js +0 -50
- data/vendor/assets/javascripts/locomotive/form_submit_notification.js +0 -39
- data/vendor/assets/javascripts/locomotive/slugify.js +0 -47
@@ -9,11 +9,13 @@ class Locomotive.Views.Inputs.Rte.FileView extends Backbone.View
|
|
9
9
|
picker: false
|
10
10
|
|
11
11
|
initialize: ->
|
12
|
-
_.bindAll(@, 'change_image', 'hide')
|
12
|
+
_.bindAll(@, 'change_image', 'insert_file', 'hide')
|
13
13
|
|
14
|
-
@$link
|
15
|
-
@editor
|
16
|
-
@$popover
|
14
|
+
@$link = $(@el)
|
15
|
+
@editor = @options.editor
|
16
|
+
@$popover = @$link.next('.image-dialog-content')
|
17
|
+
|
18
|
+
@pubsub_token = PubSub.subscribe('file_picker.select', @insert_file)
|
17
19
|
|
18
20
|
render: ->
|
19
21
|
@attach_editor()
|
@@ -55,6 +57,19 @@ class Locomotive.Views.Inputs.Rte.FileView extends Backbone.View
|
|
55
57
|
|
56
58
|
@hide()
|
57
59
|
|
60
|
+
insert_file: (msg, data) ->
|
61
|
+
return unless data.parent_view.cid == @.cid
|
62
|
+
|
63
|
+
if data.image
|
64
|
+
@editor.composer.commands.exec 'insertImage',
|
65
|
+
src: data.url
|
66
|
+
title: data.title
|
67
|
+
else
|
68
|
+
html = "<a href='#{data.url}' title='#{data.title}'>#{data.title}</a>"
|
69
|
+
@editor.composer.commands.exec 'insertHTML', html
|
70
|
+
|
71
|
+
@hide()
|
72
|
+
|
58
73
|
show: (state) ->
|
59
74
|
console.log "[insertFileView] show #{state}"
|
60
75
|
|
@@ -99,6 +114,10 @@ class Locomotive.Views.Inputs.Rte.FileView extends Backbone.View
|
|
99
114
|
window.application_view.drawer_view.close()
|
100
115
|
@opened.picker = false
|
101
116
|
|
117
|
+
hide_from_picker: (stack_size) ->
|
118
|
+
if stack_size == 0
|
119
|
+
@opened.picker = false
|
120
|
+
|
102
121
|
hide_popover: ->
|
103
122
|
@$link.popover('hide')
|
104
123
|
@opened.popover = false
|
@@ -113,4 +132,5 @@ class Locomotive.Views.Inputs.Rte.FileView extends Backbone.View
|
|
113
132
|
@detach_popover_events()
|
114
133
|
@$link.popover('destroy')
|
115
134
|
@$('.popover').remove()
|
135
|
+
PubSub.unsubscribe(@pubsub_token)
|
116
136
|
super
|
@@ -6,6 +6,8 @@ class Locomotive.Views.Inputs.RteView extends Backbone.View
|
|
6
6
|
'click a.style': 'open_styles_dialog'
|
7
7
|
|
8
8
|
initialize: ->
|
9
|
+
_.bindAll(@, 'register_keydown_event', 'on_content_change')
|
10
|
+
|
9
11
|
$textarea = @$('textarea')
|
10
12
|
|
11
13
|
@editor = new wysihtml5.Editor $textarea.attr('id'),
|
@@ -14,6 +16,10 @@ class Locomotive.Views.Inputs.RteView extends Backbone.View
|
|
14
16
|
parserRules: wysihtml5ParserRules
|
15
17
|
stylesheets: ['<%= stylesheet_path("locomotive/wysihtml5_editor") %>']
|
16
18
|
|
19
|
+
@editor.on 'load', @register_keydown_event
|
20
|
+
@editor.on 'change', @on_content_change
|
21
|
+
@editor.on 'aftercommand:composer', @on_content_change
|
22
|
+
|
17
23
|
that = @
|
18
24
|
setTimeout(
|
19
25
|
->
|
@@ -46,9 +52,21 @@ class Locomotive.Views.Inputs.RteView extends Backbone.View
|
|
46
52
|
|
47
53
|
@file_view.render()
|
48
54
|
|
55
|
+
register_keydown_event: ->
|
56
|
+
@$('.wysihtml5-sandbox').contents().find('body').on 'keyup', =>
|
57
|
+
@on_content_change()
|
58
|
+
|
59
|
+
on_content_change: ->
|
60
|
+
PubSub.publish 'inputs.text_changed',
|
61
|
+
view: @
|
62
|
+
content: @editor.getValue()
|
63
|
+
|
49
64
|
remove: ->
|
50
65
|
@link_view.remove()
|
51
66
|
@file_view.remove()
|
52
67
|
|
68
|
+
@editor.stopObserving('onLoad', @register_keydown_event)
|
69
|
+
@editor.stopObserving('onChange', @on_content_change)
|
70
|
+
|
53
71
|
super
|
54
72
|
|
@@ -1,8 +1,5 @@
|
|
1
|
-
|
1
|
+
Locomotive.Views.Pages ||= {}
|
2
2
|
|
3
|
-
|
3
|
+
class Locomotive.Views.Pages.NewView extends Locomotive.Views.Pages.FormView
|
4
4
|
|
5
|
-
|
6
|
-
# @save_in_ajax event,
|
7
|
-
# on_success: (response, xhr) ->
|
8
|
-
# window.location.href = xhr.getResponseHeader('location')
|
5
|
+
el: '.main'
|
@@ -30,9 +30,22 @@ class Locomotive.Views.Shared.DrawerView extends Backbone.View
|
|
30
30
|
@show(entry)
|
31
31
|
|
32
32
|
pop: ->
|
33
|
-
entry = @stack.pop(
|
33
|
+
entry = @stack.pop()
|
34
34
|
@hide entry, => @show(@last_entry())
|
35
35
|
|
36
|
+
replace: (entry) ->
|
37
|
+
last_entry = @stack.pop()
|
38
|
+
_container = @container(true)
|
39
|
+
|
40
|
+
@stack.push(entry)
|
41
|
+
|
42
|
+
if entry.url?
|
43
|
+
_container.load entry.url, =>
|
44
|
+
last_entry.view.remove() if last_entry
|
45
|
+
@_show(entry, _container)
|
46
|
+
else
|
47
|
+
@_show(entry, _container)
|
48
|
+
|
36
49
|
show: (entry) ->
|
37
50
|
return if entry == null
|
38
51
|
|
@@ -50,16 +63,16 @@ class Locomotive.Views.Shared.DrawerView extends Backbone.View
|
|
50
63
|
, timeout
|
51
64
|
|
52
65
|
hide: (entry, callback) ->
|
53
|
-
return if entry == null
|
54
|
-
|
55
66
|
if @stack.length == 0
|
56
67
|
$('body').removeClass('drawer-opened')
|
57
68
|
else
|
58
|
-
entry.view.$el.addClass('fadeout')
|
69
|
+
entry.view.$el.addClass('fadeout') if entry?
|
59
70
|
|
60
71
|
setTimeout =>
|
61
|
-
|
62
|
-
|
72
|
+
if entry?
|
73
|
+
entry.view.hide_from_drawer(@stack.length) if entry.view.hide_from_drawer?
|
74
|
+
entry.view.remove()
|
75
|
+
|
63
76
|
callback() if callback?
|
64
77
|
, @delays.remove
|
65
78
|
|
@@ -69,8 +82,11 @@ class Locomotive.Views.Shared.DrawerView extends Backbone.View
|
|
69
82
|
else
|
70
83
|
@stack[@stack.length - 1]
|
71
84
|
|
72
|
-
container: ->
|
73
|
-
|
85
|
+
container: (preserve) ->
|
86
|
+
if preserve? && preserve
|
87
|
+
@$('> .inner').find('> div')
|
88
|
+
else
|
89
|
+
@$('> .inner').html('<div></div>').find('> div')
|
74
90
|
|
75
91
|
_show: (entry, container) ->
|
76
92
|
_klass = entry.view_klass
|
@@ -14,6 +14,8 @@ class Locomotive.Views.Shared.FormView extends Backbone.View
|
|
14
14
|
render: ->
|
15
15
|
@display_active_nav()
|
16
16
|
|
17
|
+
@enable_hover()
|
18
|
+
|
17
19
|
@enable_file_inputs()
|
18
20
|
@enable_array_inputs()
|
19
21
|
@enable_toggle_inputs()
|
@@ -22,20 +24,7 @@ class Locomotive.Views.Shared.FormView extends Backbone.View
|
|
22
24
|
@enable_rte_inputs()
|
23
25
|
@enable_tags_inputs()
|
24
26
|
@enable_document_picker_inputs()
|
25
|
-
|
26
|
-
# make title editable (if possible)
|
27
|
-
# @make_title_editable()
|
28
|
-
|
29
|
-
# @_hide_last_separator()
|
30
|
-
|
31
|
-
# make inputs foldable (if specified)
|
32
|
-
# @make_inputs_foldable()
|
33
|
-
|
34
|
-
# TODO: allow users to save with CTRL+S or CMD+s
|
35
|
-
# @enable_save_with_keys_combination()
|
36
|
-
|
37
|
-
# enable form notifications
|
38
|
-
# @enable_form_notifications()
|
27
|
+
@enable_select_inputs()
|
39
28
|
|
40
29
|
return @
|
41
30
|
|
@@ -46,16 +35,26 @@ class Locomotive.Views.Shared.FormView extends Backbone.View
|
|
46
35
|
@$(".nav-tabs a[href='##{name}']").tab('show')
|
47
36
|
|
48
37
|
record_active_tab: ->
|
49
|
-
|
50
|
-
|
38
|
+
if $('form .nav-tabs li.active a').size() > 0
|
39
|
+
tab_name = $('form .nav-tabs li.active a').attr('href').replace('#', '')
|
40
|
+
@$('#active_tab').val(tab_name)
|
51
41
|
|
52
42
|
change_state: ->
|
53
43
|
@$('form button[type=submit]').button('loading')
|
54
44
|
|
45
|
+
reset_state: ->
|
46
|
+
@$('form button[type=submit]').button('reset')
|
47
|
+
|
55
48
|
save: (event) ->
|
56
49
|
@change_state()
|
57
50
|
@record_active_tab()
|
58
51
|
|
52
|
+
enable_hover: ->
|
53
|
+
$('.form-group.input').hover ->
|
54
|
+
$(this).addClass('hovered')
|
55
|
+
, ->
|
56
|
+
$(this).removeClass('hovered')
|
57
|
+
|
59
58
|
enable_file_inputs: ->
|
60
59
|
self = @
|
61
60
|
@$('.input.file').each ->
|
@@ -106,6 +105,9 @@ class Locomotive.Views.Shared.FormView extends Backbone.View
|
|
106
105
|
enable_tags_inputs: ->
|
107
106
|
@$('.input.tags input[type=text]').tagsinput()
|
108
107
|
|
108
|
+
enable_select_inputs: ->
|
109
|
+
@$('.input.select select:not(.disable-select2)').select2()
|
110
|
+
|
109
111
|
enable_document_picker_inputs: ->
|
110
112
|
self = @
|
111
113
|
@$('.input.document_picker').each ->
|
@@ -114,138 +116,9 @@ class Locomotive.Views.Shared.FormView extends Backbone.View
|
|
114
116
|
self.inputs.push(view)
|
115
117
|
|
116
118
|
remove: ->
|
117
|
-
|
118
|
-
@$('.input.tags input[type=text').tagsinput('destroy')
|
119
|
+
_.each @inputs.each, (view) -> view.remove()
|
120
|
+
@$('.input.tags input[type=text]').tagsinput('destroy')
|
121
|
+
@$('.input.select select').select2('destroy')
|
119
122
|
|
120
123
|
_stop_event: (event) ->
|
121
124
|
event.stopPropagation() & event.preventDefault()
|
122
|
-
|
123
|
-
|
124
|
-
# ===============================
|
125
|
-
|
126
|
-
# save: (event) ->
|
127
|
-
# alert('foo')
|
128
|
-
# by default, follow the default behaviour
|
129
|
-
|
130
|
-
# save_in_ajax: (event, options) ->
|
131
|
-
# event.stopPropagation() & event.preventDefault()
|
132
|
-
|
133
|
-
# @trigger_change_event_on_focused_inputs()
|
134
|
-
|
135
|
-
# form = $(event.target).trigger('ajax:beforeSend')
|
136
|
-
|
137
|
-
# @clear_errors()
|
138
|
-
|
139
|
-
# options ||= { headers: {}, on_success: null, on_error: null }
|
140
|
-
|
141
|
-
# previous_attributes = _.clone @model.attributes
|
142
|
-
|
143
|
-
# xhr = @model.save {},
|
144
|
-
# headers: options.headers
|
145
|
-
# silent: true # since we pass an empty hash above, no need to trigger the callbacks
|
146
|
-
|
147
|
-
# xhr.success (model, response, _options) =>
|
148
|
-
# form.trigger('ajax:complete')
|
149
|
-
|
150
|
-
# @model.set(previous_attributes)
|
151
|
-
# model.attributes = previous_attributes
|
152
|
-
|
153
|
-
# options.on_success(model, xhr) if options.on_success
|
154
|
-
|
155
|
-
# xhr.error (model, xhr) =>
|
156
|
-
# form.trigger('ajax:complete')
|
157
|
-
|
158
|
-
# errors = JSON.parse(model.responseText)
|
159
|
-
|
160
|
-
# @show_errors errors
|
161
|
-
|
162
|
-
# options.on_error() if options.on_error
|
163
|
-
|
164
|
-
# make_title_editable: ->
|
165
|
-
# title = @$('h2 a.editable')
|
166
|
-
|
167
|
-
# if title.size() > 0
|
168
|
-
# target = @$("##{title.attr('rel')}")
|
169
|
-
# target.parent().hide()
|
170
|
-
|
171
|
-
# title.click (event) =>
|
172
|
-
# event.stopPropagation() & event.preventDefault()
|
173
|
-
# newValue = prompt(title.attr('title'), title.html());
|
174
|
-
# if newValue && newValue != ''
|
175
|
-
# title.html(newValue)
|
176
|
-
# target.val(newValue).trigger('change')
|
177
|
-
|
178
|
-
# make_inputs_foldable: ->
|
179
|
-
# self = @
|
180
|
-
# @$('.formtastic fieldset.foldable.folded ol').hide()
|
181
|
-
# @$('.formtastic fieldset.foldable legend').click ->
|
182
|
-
# parent = $(@).parent()
|
183
|
-
# content = $(@).next()
|
184
|
-
|
185
|
-
# if parent.hasClass 'folded'
|
186
|
-
# parent.removeClass 'folded'
|
187
|
-
# content.slideDown 100, -> self.after_inputs_fold(parent)
|
188
|
-
# else
|
189
|
-
# content.slideUp 100, -> parent.addClass('folded')
|
190
|
-
|
191
|
-
# trigger_change_event_on_focused_inputs: ->
|
192
|
-
# # make sure that the current text field gets saved too
|
193
|
-
# input = @$('form input[type=text]:focus, form input[type=password]:focus, form input[type=number]:focus, form textarea:focus')
|
194
|
-
# input.trigger('change') if input.size() > 0
|
195
|
-
|
196
|
-
# enable_save_with_keys_combination: ->
|
197
|
-
# $.cmd 'S', (() =>
|
198
|
-
# @$('form input[type=submit]').trigger('click')
|
199
|
-
# ), [], ignoreCase: true
|
200
|
-
|
201
|
-
# enable_form_notifications: ->
|
202
|
-
# @$('form').formSubmitNotification()
|
203
|
-
|
204
|
-
# after_inputs_fold: ->
|
205
|
-
# # overide this method if necessary
|
206
|
-
|
207
|
-
# clear_errors: ->
|
208
|
-
# @$('.inline-errors').remove()
|
209
|
-
|
210
|
-
# show_errors: (errors) ->
|
211
|
-
# for attribute, message of errors
|
212
|
-
# if _.isString(message[0])
|
213
|
-
# html = $("<div class=\"inline-errors\"><p>#{message[0]}</p></div>")
|
214
|
-
# @show_error attribute, message[0], html
|
215
|
-
# else
|
216
|
-
# @show_error attribute, message
|
217
|
-
|
218
|
-
# show_error: (attribute, message, html) ->
|
219
|
-
# prefix = if @namespace? then "#{@namespace}_" else ''
|
220
|
-
|
221
|
-
# input = @$("##{prefix}#{@model.paramRoot}_#{attribute}")
|
222
|
-
# input = @$("##{prefix}#{@model.paramRoot}_#{attribute}_id") if input.size() == 0
|
223
|
-
# input = @$("##{prefix}#{@model.paramRoot}_#{attribute}_ids") if input.size() == 0
|
224
|
-
|
225
|
-
# return unless input.size() > 0
|
226
|
-
|
227
|
-
# anchor = input.parent().find('.error-anchor')
|
228
|
-
# anchor = input if anchor.size() == 0
|
229
|
-
# anchor.after(html)
|
230
|
-
|
231
|
-
# _enable_checkbox: (name, options) ->
|
232
|
-
# options ||= {}
|
233
|
-
# model_name = options.model_name || @model.paramRoot
|
234
|
-
|
235
|
-
# @$("li##{model_name}_#{name}_input input[type=checkbox]").checkToggle
|
236
|
-
# on_callback: =>
|
237
|
-
# _.each options.features, (exp) -> @$("li##{model_name}_#{exp}_input").hide()
|
238
|
-
# options.on_callback() if options.on_callback?
|
239
|
-
# @_hide_last_separator()
|
240
|
-
# off_callback: =>
|
241
|
-
# _.each options.features, (exp) -> @$("li##{model_name}_#{exp}_input").show()
|
242
|
-
# options.off_callback() if options.off_callback?
|
243
|
-
# @_hide_last_separator()
|
244
|
-
|
245
|
-
# _hide_last_separator: ->
|
246
|
-
# _.each @$('fieldset'), (fieldset) =>
|
247
|
-
# $(fieldset).find('li.last').removeClass('last')
|
248
|
-
# $(_.last($(fieldset).find('li.input:visible'))).addClass('last')
|
249
|
-
|
250
|
-
# enable_form_notifications: ->
|
251
|
-
# @$('form').formSubmitNotification()
|
@@ -12,10 +12,15 @@
|
|
12
12
|
@import "./globals/bootstrap";
|
13
13
|
@import "bootstrap";
|
14
14
|
|
15
|
+
@import "./globals/nprogress";
|
16
|
+
@import "nprogress";
|
17
|
+
@import "nprogress-bootstrap";
|
18
|
+
|
15
19
|
@import "./base/all";
|
16
20
|
|
17
21
|
@import "layouts/main";
|
18
22
|
@import "layouts/responsive";
|
23
|
+
@import "layouts/live_editing";
|
19
24
|
|
20
25
|
@import "components/misc";
|
21
26
|
@import "components/transitions";
|
@@ -25,5 +30,6 @@
|
|
25
30
|
@import "components/main";
|
26
31
|
@import "components/list";
|
27
32
|
@import "components/content_assets";
|
33
|
+
@import "components/live_editing";
|
28
34
|
|
29
35
|
@import "components/sites";
|
@@ -4,7 +4,7 @@ $select2-height: 32px;
|
|
4
4
|
|
5
5
|
.simple_form {
|
6
6
|
|
7
|
-
fieldset .input.
|
7
|
+
fieldset .input.select .form-wrapper {
|
8
8
|
border: none;
|
9
9
|
}
|
10
10
|
|
@@ -105,3 +105,30 @@ $select2-height: 32px;
|
|
105
105
|
margin-right: 5px;
|
106
106
|
}
|
107
107
|
}
|
108
|
+
|
109
|
+
.simple_form {
|
110
|
+
fieldset .input.select.inline {
|
111
|
+
.form-wrapper {
|
112
|
+
margin-top: 0px;
|
113
|
+
margin-left: 15px;
|
114
|
+
float: right;
|
115
|
+
position: relative;
|
116
|
+
top: -8px;
|
117
|
+
|
118
|
+
.select2-container {
|
119
|
+
width: 280px;
|
120
|
+
|
121
|
+
.select2-choice {
|
122
|
+
height: 18px;
|
123
|
+
line-height: 18px;
|
124
|
+
|
125
|
+
.select2-arrow {
|
126
|
+
b {
|
127
|
+
background-position: 0px -2px;
|
128
|
+
}
|
129
|
+
}
|
130
|
+
}
|
131
|
+
}
|
132
|
+
}
|
133
|
+
}
|
134
|
+
}
|