aerogel-pages 1.4.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +14 -0
- data/Rakefile +1 -0
- data/aerogel-pages.gemspec +26 -0
- data/app/helpers/README.md +7 -0
- data/app/helpers/decorators.rb +74 -0
- data/app/helpers/pages.rb +32 -0
- data/app/routes/admin-pages.rb +150 -0
- data/app/routes/pages.rb +16 -0
- data/assets/javascripts/admin-pages/pages-widget.js.coffee +83 -0
- data/assets/javascripts/admin-pages/pane-preview.js.coffee +37 -0
- data/assets/javascripts/admin-pages/pane-tree.js.coffee +105 -0
- data/assets/javascripts/admin-pages-edit/admin-modal-select.js.coffee +63 -0
- data/assets/javascripts/admin-pages-edit/datetime-picker-field.js.coffee +36 -0
- data/assets/javascripts/admin-pages-edit/page-blocks.js.coffee +71 -0
- data/assets/javascripts/admin-pages-edit/page-content-tabs.js.coffee +40 -0
- data/assets/javascripts/admin-pages-utils/attached-footer.js.coffee +62 -0
- data/assets/javascripts/admin-pages-utils/autofixed-height.js.coffee +15 -0
- data/assets/javascripts/admin-pages-utils/two-pane-widget.js.coffee +78 -0
- data/assets/javascripts/aerogel-pages.js.coffee +3 -0
- data/assets/javascripts/controllers/admin-pages-edit.js.coffee +33 -0
- data/assets/javascripts/controllers/admin-pages.js.coffee +17 -0
- data/assets/stylesheets/admin-pages/_admin-pages-alert.css.scss +14 -0
- data/assets/stylesheets/admin-pages/_pages-widget.css.scss +113 -0
- data/assets/stylesheets/admin-pages/_pane-tree.css.scss +15 -0
- data/assets/stylesheets/admin-pages/_preview.css.scss +35 -0
- data/assets/stylesheets/admin-pages/_two-pane-widget.css.scss +103 -0
- data/assets/stylesheets/admin-pages-common/_admin-modals-select.css.scss +34 -0
- data/assets/stylesheets/admin-pages-common/_form-details.css.scss +11 -0
- data/assets/stylesheets/admin-pages-common/_nav-tabs.css.scss +6 -0
- data/assets/stylesheets/admin-pages-common/_page-blocks.css.scss +18 -0
- data/assets/stylesheets/admin-pages-common/_panels.css.scss +11 -0
- data/assets/stylesheets/admin-pages-common/_publication-states.css.scss +11 -0
- data/assets/stylesheets/admin-pages-common/_smart-links.css.scss +9 -0
- data/assets/stylesheets/admin-pages-common/_smart-tree-table-icons.css.scss +42 -0
- data/assets/stylesheets/admin-pages-edit/breadcrumbs.css.scss +11 -0
- data/assets/stylesheets/admin-pages-edit/form.css.scss +23 -0
- data/assets/stylesheets/admin-pages-edit/page-blocks.css.scss +88 -0
- data/assets/stylesheets/admin-pages-edit/page-footer.css.scss +21 -0
- data/assets/stylesheets/admin-pages-edit/page-header.css.scss +15 -0
- data/assets/stylesheets/admin-pages-edit/page.css.scss +30 -0
- data/assets/stylesheets/admin-pages-edit/tabs.css.scss +20 -0
- data/assets/stylesheets/aerogel-pages.css.scss +20 -0
- data/assets/stylesheets/controllers/admin-pages-edit.css.scss +7 -0
- data/assets/stylesheets/controllers/admin-pages.css.scss +5 -0
- data/assets/stylesheets/pages/_body.css.scss +3 -0
- data/assets/stylesheets/pages/_footer.css.scss +13 -0
- data/assets/stylesheets/pages/_header.css.scss +5 -0
- data/assets/stylesheets/pages/_image.css.scss +18 -0
- data/assets/stylesheets/pages/_layout-sticky-footer.css.scss +27 -0
- data/assets/stylesheets/pages/_menu.css.scss +45 -0
- data/assets/stylesheets/pages/_page-content.css.scss +3 -0
- data/assets/vendor/jquery.history.js +1 -0
- data/assets/vendor/smart-links.js.coffee +42 -0
- data/config/README.md +3 -0
- data/config/development/.keep +0 -0
- data/config/production/.keep +0 -0
- data/db/model/page.rb +137 -0
- data/db/model/page_node.rb +43 -0
- data/db/model/page_type.rb +15 -0
- data/db/model/pages/block.rb +38 -0
- data/db/model/pages/blocks/hr.rb +9 -0
- data/db/model/pages/blocks/image.rb +16 -0
- data/db/model/pages/blocks/pages_list.rb +41 -0
- data/db/model/pages/blocks/text.rb +9 -0
- data/db/seed/development/.keep +0 -0
- data/db/seed/development/01_page_types.seed +8 -0
- data/db/seed/development/02_root_page_node.seed +8 -0
- data/db/seed/development/03_root_pages.seed +10 -0
- data/db/seed/development/04_news_page_node.seed +15 -0
- data/db/seed/development/05_news_pages.seed +10 -0
- data/db/seed/production/.keep +0 -0
- data/db/seed/production/01_page_types.seed +8 -0
- data/db/seed/production/02_root_page_node.seed +8 -0
- data/db/seed/production/03_root_pages.seed +10 -0
- data/db/seed/seed.template +42 -0
- data/lib/aerogel/pages/core.rb +37 -0
- data/lib/aerogel/pages/traversal.rb +30 -0
- data/lib/aerogel/pages/version.rb +5 -0
- data/lib/aerogel/pages.rb +19 -0
- data/locales/actions.en.yml +11 -0
- data/locales/actions.ru.yml +11 -0
- data/locales/admin.en.yml +11 -0
- data/locales/admin.ru.yml +11 -0
- data/locales/models.en.yml +18 -0
- data/locales/models.ru.yml +19 -0
- data/locales/views.en.yml +38 -0
- data/locales/views.ru.yml +39 -0
- data/public/README.md +1 -0
- data/rake/README.md +3 -0
- data/views/admin/pages/_edit_form.html.erb +23 -0
- data/views/admin/pages/_page-DISABLED.html.erb +5 -0
- data/views/admin/pages/append.html.erb +4 -0
- data/views/admin/pages/delete.html.erb +28 -0
- data/views/admin/pages/edit/_block.html.erb +16 -0
- data/views/admin/pages/edit/_block_header.html.erb +66 -0
- data/views/admin/pages/edit/_breadcrumbs.html.erb +13 -0
- data/views/admin/pages/edit/_page.html.erb +63 -0
- data/views/admin/pages/edit/_page_footer.html.erb +55 -0
- data/views/admin/pages/edit/_page_header.html.erb +65 -0
- data/views/admin/pages/edit/_page_node.html.erb +79 -0
- data/views/admin/pages/edit/block/_default.html.erb +3 -0
- data/views/admin/pages/edit/block/_hr.html.erb +5 -0
- data/views/admin/pages/edit/block/_image.html.erb +20 -0
- data/views/admin/pages/edit/block/_pages_list.html.erb +53 -0
- data/views/admin/pages/edit/block/_text.html.erb +3 -0
- data/views/admin/pages/edit/select_page.html.erb +59 -0
- data/views/admin/pages/edit/select_template.html.erb +50 -0
- data/views/admin/pages/edit.html.erb +4 -0
- data/views/admin/pages/index/_pane_preview.html.erb +23 -0
- data/views/admin/pages/index/_pane_tree.html.erb +50 -0
- data/views/admin/pages/index/_pane_tree_tabs.html.erb +26 -0
- data/views/admin/pages/index.html.erb +26 -0
- data/views/admin/pages/insert.html.erb +4 -0
- data/views/admin/pages/preview/_block.html.erb +7 -0
- data/views/admin/pages/preview/_breadcrumbs.html.erb +11 -0
- data/views/admin/pages/preview/block/_default.html.erb +5 -0
- data/views/admin/pages/preview/block/_hr.html.erb +1 -0
- data/views/admin/pages/preview/block/_image.html.erb +8 -0
- data/views/admin/pages/preview/block/_pages_list.html.erb +14 -0
- data/views/admin/pages/preview/block/_text.html.erb +1 -0
- data/views/admin/pages/preview.html.erb +30 -0
- data/views/admin/table_builder/smart-list-table/_table_column.html.erb +3 -0
- data/views/admin/table_builder/smart-list-table/_table_row.html.erb +9 -0
- data/views/admin/table_builder/smart-list-table/table.html.erb +10 -0
- data/views/admin/table_builder/smart-tree-table/_table_column.html.erb +3 -0
- data/views/admin/table_builder/smart-tree-table/_table_row.html.erb +14 -0
- data/views/admin/table_builder/smart-tree-table/table.html.erb +10 -0
- data/views/admin/tabs_builder/pages-tree-tabs/_tab.html.erb +5 -0
- data/views/admin/tabs_builder/pages-tree-tabs/tabs.html.erb +3 -0
- data/views/form_builder/admin-pages-edit/field.erb +31 -0
- data/views/form_builder/admin-pages-edit/field_datetime.erb +19 -0
- data/views/form_builder/admin-pages-edit/field_default.erb +5 -0
- data/views/form_builder/admin-pages-edit/field_radio_buttons.erb +22 -0
- data/views/form_builder/admin-pages-edit/field_text_addon.erb +17 -0
- data/views/form_builder/admin-pages-edit/field_textarea.erb +28 -0
- data/views/form_builder/admin-pages-edit/field_title.erb +5 -0
- data/views/form_builder/admin-pages-edit/fieldset.erb +4 -0
- data/views/form_builder/admin-pages-edit-block/field.erb +31 -0
- data/views/form_builder/admin-pages-edit-block/field_default.erb +5 -0
- data/views/form_builder/admin-pages-edit-block/field_media-file.erb +60 -0
- data/views/form_builder/admin-pages-edit-block/field_media-image.erb +67 -0
- data/views/form_builder/admin-pages-edit-block/field_radio_buttons.erb +22 -0
- data/views/form_builder/admin-pages-edit-block/field_select_page.erb +34 -0
- data/views/form_builder/admin-pages-edit-block/field_select_template.erb +32 -0
- data/views/form_builder/admin-pages-edit-block/field_text_inline.erb +5 -0
- data/views/form_builder/admin-pages-edit-block/field_textarea.erb +2 -0
- data/views/form_builder/admin-pages-edit-block/fieldset.erb +4 -0
- data/views/layouts/admin/pages/preview.html.erb +9 -0
- data/views/layouts/application.html.erb +62 -0
- data/views/layouts/pages/_breadcrumbs.html.erb +20 -0
- data/views/layouts/pages/_flashes.html.erb +9 -0
- data/views/layouts/pages/_menu.html.erb +37 -0
- data/views/layouts/pages/_menu_item.html.erb +15 -0
- data/views/layouts/pages/_menu_user.html.erb +8 -0
- data/views/pages/_block.html.erb +7 -0
- data/views/pages/block/_default.html.erb +5 -0
- data/views/pages/block/_hr.html.erb +1 -0
- data/views/pages/block/_image.html.erb +8 -0
- data/views/pages/block/_pages_list.html.erb +13 -0
- data/views/pages/block/_text.html.erb +1 -0
- data/views/pages/list/_default.html.erb +7 -0
- data/views/pages/list/_table.html.erb +12 -0
- data/views/pages/list/_ul.html.erb +7 -0
- data/views/pages/view.html.erb +4 -0
- metadata +267 -0
@@ -0,0 +1,36 @@
|
|
1
|
+
class @DatetimePickerField
|
2
|
+
constructor: (@widget) ->
|
3
|
+
@data_field = @widget.find('input').first()
|
4
|
+
@field_id = @data_field.attr 'id'
|
5
|
+
@helper_field = @data_field.clone()
|
6
|
+
@helper_field.attr 'id', "#{@field_id}-helper"
|
7
|
+
@helper_field.attr 'name', ''
|
8
|
+
@helper_field.val ''
|
9
|
+
@helper_field.removeClass 'datetimepicker'
|
10
|
+
@helper_field.addClass 'datetimepicker-helper'
|
11
|
+
@data_field.before @helper_field
|
12
|
+
@data_field.attr 'type', 'hidden'
|
13
|
+
@widget.before @data_field
|
14
|
+
@widget.datetimepicker(
|
15
|
+
language: I18n.locale()
|
16
|
+
)
|
17
|
+
console.log "setting date"
|
18
|
+
# initial_date = "2013-10-11T12:00Z" # @data_field.val()
|
19
|
+
initial_date = @data_field.val()
|
20
|
+
# @datetimepicker().setDate "2013-10-11T12:00Z" #@data_field.val()
|
21
|
+
@datetimepicker().setDate initial_date
|
22
|
+
console.log "setting date to: '#{initial_date}', result: '#{@datetimepicker().getDate()?.format('L')}'"
|
23
|
+
@widget.on "change.dp", (e) =>
|
24
|
+
date = @datetimepicker().getDate()
|
25
|
+
if date?
|
26
|
+
console.log "date selected: #{date.format('L')}"
|
27
|
+
@data_field.val date.toISOString()
|
28
|
+
else
|
29
|
+
console.log "setting date to empty string"
|
30
|
+
@data_field.val ''
|
31
|
+
console.log "DateTimePickerField created"
|
32
|
+
# copy data field
|
33
|
+
# ...
|
34
|
+
datetimepicker: ->
|
35
|
+
@widget.data("DateTimePicker")
|
36
|
+
|
@@ -0,0 +1,71 @@
|
|
1
|
+
# page blocks functionality
|
2
|
+
#
|
3
|
+
#
|
4
|
+
|
5
|
+
page_block_lang = (el) ->
|
6
|
+
el.closest('.page').attr 'data-lang'
|
7
|
+
|
8
|
+
page_blocks = (lang) ->
|
9
|
+
$(".page-#{lang} .page-blocks fieldset.page_block")
|
10
|
+
|
11
|
+
page_block_delete = (el) ->
|
12
|
+
marked_for_removal = el.closest('.page_block').find('.marked-for-removal')
|
13
|
+
marked_for_removal.val 'true'
|
14
|
+
console.log "page_block_delete():#{marked_for_removal.size()}", marked_for_removal
|
15
|
+
|
16
|
+
page_block_create = (el) ->
|
17
|
+
lang = el.attr 'data-lang'
|
18
|
+
opts =
|
19
|
+
page_block:
|
20
|
+
lang: el.attr 'data-lang'
|
21
|
+
type: el.attr 'data-type'
|
22
|
+
position: page_block_get_new_position( lang )
|
23
|
+
page_node_id: el.attr 'data-page-node-id'
|
24
|
+
page_id: el.attr 'data-page-id'
|
25
|
+
|
26
|
+
console?.log "** creating new page block:", opts
|
27
|
+
$.get "edit/page_block", opts, (data) =>
|
28
|
+
$(".page-"+lang+" .page-blocks").append( data );
|
29
|
+
|
30
|
+
page_block_sort_start = (e, ui) ->
|
31
|
+
console?.log "** page block sortable start"
|
32
|
+
|
33
|
+
page_block_sort_stop = (e, ui) ->
|
34
|
+
position = 0
|
35
|
+
$('.page-blocks fieldset.page_block').each ->
|
36
|
+
$(@).find('.page-block-position').val position
|
37
|
+
position += 1
|
38
|
+
console?.log "** page block sortable stop"
|
39
|
+
|
40
|
+
page_block_get_max_position = (lang) ->
|
41
|
+
max_position = 0
|
42
|
+
page_blocks( lang ).each ->
|
43
|
+
position = $(@).find('.page-block-position').val()
|
44
|
+
position = parseInt( position )
|
45
|
+
if !isNaN(position) && position > max_position
|
46
|
+
max_position = position
|
47
|
+
return max_position
|
48
|
+
|
49
|
+
page_block_get_new_position = (lang) ->
|
50
|
+
if page_blocks( lang ).length > 0
|
51
|
+
page_block_get_max_position( lang ) + 1
|
52
|
+
else
|
53
|
+
0
|
54
|
+
|
55
|
+
$ ->
|
56
|
+
$('body').on 'click', '.btn-block-delete', ->
|
57
|
+
page_block_delete $(@)
|
58
|
+
|
59
|
+
$('body').on 'click', '.btn-block-create', ->
|
60
|
+
page_block_create $(@)
|
61
|
+
|
62
|
+
$('.page-blocks').sortable
|
63
|
+
placeholder: 'page-block-sortable-placeholder'
|
64
|
+
handle: '.page-block .header'
|
65
|
+
start: page_block_sort_start
|
66
|
+
stop: page_block_sort_stop
|
67
|
+
delay: 150
|
68
|
+
distance: 5
|
69
|
+
|
70
|
+
|
71
|
+
|
@@ -0,0 +1,40 @@
|
|
1
|
+
#
|
2
|
+
#
|
3
|
+
log = (msg) ->
|
4
|
+
console?.log "** admin/pages/edit:tabs: #{msg}"
|
5
|
+
|
6
|
+
current_lang = ->
|
7
|
+
$('.page-tabs .tab-pane.active').attr 'id'
|
8
|
+
|
9
|
+
page_fields = (lang) ->
|
10
|
+
$("input,textarea,select", ".page-#{lang} .field")
|
11
|
+
|
12
|
+
@page_clear = (lang) ->
|
13
|
+
$(".page-#{lang}").find('input.marked-for-removal').val true
|
14
|
+
$(".page-#{lang}").hide()
|
15
|
+
page_fields(lang).prop 'disabled', true
|
16
|
+
$(".page-empty-#{lang}").show()
|
17
|
+
|
18
|
+
@page_add = (lang) ->
|
19
|
+
$(".page-#{lang}").find('input.marked-for-removal').val ''
|
20
|
+
$(".page-#{lang}").show()
|
21
|
+
page_fields(lang).prop 'disabled', false
|
22
|
+
$(".page-empty-#{lang}").hide()
|
23
|
+
|
24
|
+
bind_event_listeners = ->
|
25
|
+
$('.clear-page-content-link').on 'click', (e) ->
|
26
|
+
e.preventDefault()
|
27
|
+
page_clear current_lang()
|
28
|
+
log "remove page content: #{current_lang()}"
|
29
|
+
|
30
|
+
$('.add-page-content-link').on 'click', (e) ->
|
31
|
+
e.preventDefault()
|
32
|
+
lang = $(e.currentTarget).attr 'data-lang'
|
33
|
+
page_add lang
|
34
|
+
log "add page content: #{lang}"
|
35
|
+
|
36
|
+
|
37
|
+
|
38
|
+
$ ->
|
39
|
+
bind_event_listeners()
|
40
|
+
log "initialized"
|
@@ -0,0 +1,62 @@
|
|
1
|
+
class @AttachedFooter
|
2
|
+
float_footer: ->
|
3
|
+
return if @is_floating
|
4
|
+
@placeholder = $ "<div>"
|
5
|
+
@placeholder.css 'display', 'block'
|
6
|
+
@placeholder.height @footer.outerHeight()
|
7
|
+
@element.after @placeholder
|
8
|
+
@footer.css "position", @opts.position
|
9
|
+
@footer.css "bottom", "0"
|
10
|
+
@footer.addClass "floating"
|
11
|
+
@footer.hide()
|
12
|
+
# console?.log "fadeing IN"
|
13
|
+
@footer.fadeIn()
|
14
|
+
@is_floating = true
|
15
|
+
# console?.log "** footer is floating"
|
16
|
+
|
17
|
+
unfloat_footer: ->
|
18
|
+
return unless @is_floating
|
19
|
+
@is_floating = false
|
20
|
+
# console?.log "fadeing OUT"
|
21
|
+
# @footer.fadeOut done: =>
|
22
|
+
@footer.show()
|
23
|
+
@footer.css "position", "static"
|
24
|
+
@footer.css "bottom", "auto"
|
25
|
+
@placeholder.remove()
|
26
|
+
@footer.removeClass "floating"
|
27
|
+
# console?.log "** footer is unfloated"
|
28
|
+
|
29
|
+
update_footer: ->
|
30
|
+
# t_start = $.now()
|
31
|
+
view_y = $(window).scrollTop()
|
32
|
+
view_b = view_y + $(window).height()
|
33
|
+
el_y = @element.offset().top
|
34
|
+
el_b = el_y + @element.height()
|
35
|
+
ft_h = @footer.outerHeight()
|
36
|
+
# console?.log "view_y:#{view_y}, view_b:#{view_b} el_b:#{el_b} "
|
37
|
+
if view_b - ft_h > el_b
|
38
|
+
# element's bottom is on screen?
|
39
|
+
@unfloat_footer()
|
40
|
+
else
|
41
|
+
@float_footer()
|
42
|
+
# t_end = $.now()
|
43
|
+
# console?.log "update_footer: elapsed:#{t_end-t_start}, view_y:#{view_y} view_b:#{view_b}"
|
44
|
+
|
45
|
+
constructor: ( @opts ) ->
|
46
|
+
@element = opts.target
|
47
|
+
@footer = opts.footer
|
48
|
+
@observer = opts.observe
|
49
|
+
@opts.position ||= 'absolute'
|
50
|
+
@is_floating = false
|
51
|
+
@update_footer()
|
52
|
+
@observer.scroll =>
|
53
|
+
@update_footer()
|
54
|
+
# @element.scroll =>
|
55
|
+
# @update_footer()
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
|
60
|
+
@attach_floating_footer = (element, footer, observer) ->
|
61
|
+
new AttachedFooter $(element), $(footer), observer
|
62
|
+
# console?.log "floating footer attached"
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class @AutofixedHeight
|
2
|
+
constructor: (@element, @max_height_delta, @min_height_delta = @max_height_delta) ->
|
3
|
+
@resize()
|
4
|
+
$(window).on 'resize', @resize
|
5
|
+
|
6
|
+
resize: =>
|
7
|
+
wh = $(window).height()
|
8
|
+
h = wh - @max_height_delta + 1
|
9
|
+
@element.css 'max-height', h # outerHeight h
|
10
|
+
h = wh - @min_height_delta + 1
|
11
|
+
@element.css 'min-height', h # outerHeight h
|
12
|
+
@element.height h # outerHeight h
|
13
|
+
# console?.log "** FixedHeightWatcher: element resized to #{h} (#{wh} - #{@max_height_delta})"
|
14
|
+
|
15
|
+
|
@@ -0,0 +1,78 @@
|
|
1
|
+
|
2
|
+
debug = false
|
3
|
+
log = (msg) ->
|
4
|
+
console?.log "** two-pane-widget: #{msg}" if debug
|
5
|
+
error = (msg) ->
|
6
|
+
console?.error "** two-pane-widget: #{msg}" if debug
|
7
|
+
throw new Error msg
|
8
|
+
|
9
|
+
class @TwoPaneWidget
|
10
|
+
constructor: (@widget, @left_selector, @right_selector) ->
|
11
|
+
@widget = $(@widget)
|
12
|
+
@left_pane = @widget.find( @left_selector ).first()
|
13
|
+
@right_pane = @widget.find( @right_selector ).first()
|
14
|
+
@btn_open_left = @left_pane.find('.btn-open').first()
|
15
|
+
@btn_open_right = @right_pane.find('.btn-open').first()
|
16
|
+
@state = null
|
17
|
+
@bind_event_listeners()
|
18
|
+
@open_middle( false )
|
19
|
+
log "widget created, left:#{@left_selector} right:#{@right_selector}"
|
20
|
+
|
21
|
+
bind_event_listeners: ->
|
22
|
+
@btn_open_left.on 'click', @on_open_left_clicked
|
23
|
+
@btn_open_right.on 'click', @on_open_right_clicked
|
24
|
+
|
25
|
+
on_open_left_clicked: =>
|
26
|
+
log "open left clicked"
|
27
|
+
if @state == 'middle'
|
28
|
+
@open_left()
|
29
|
+
else
|
30
|
+
@open_middle()
|
31
|
+
|
32
|
+
on_open_right_clicked: =>
|
33
|
+
log "open right clicked"
|
34
|
+
|
35
|
+
if @state == 'middle'
|
36
|
+
@open_right()
|
37
|
+
else
|
38
|
+
@open_middle()
|
39
|
+
|
40
|
+
open_left: ( trigger_event = true ) ->
|
41
|
+
return if @state == 'left'
|
42
|
+
log "open left pane to full width"
|
43
|
+
@open_pane @left_pane
|
44
|
+
@close_pane @right_pane
|
45
|
+
@state = 'left'
|
46
|
+
@trigger() if trigger_event
|
47
|
+
|
48
|
+
open_right: ( trigger_event = true ) ->
|
49
|
+
return if @state == 'right'
|
50
|
+
log "open right pane to full width"
|
51
|
+
@open_pane @right_pane
|
52
|
+
@close_pane @left_pane
|
53
|
+
@state = 'right'
|
54
|
+
@trigger() if trigger_event
|
55
|
+
|
56
|
+
open_middle: ( trigger_event = true ) ->
|
57
|
+
return if @state == 'middle'
|
58
|
+
log "open panes to middle width"
|
59
|
+
@half_open_pane @right_pane
|
60
|
+
@half_open_pane @left_pane
|
61
|
+
@state = 'middle'
|
62
|
+
@trigger() if trigger_event
|
63
|
+
|
64
|
+
open_pane: (pane) ->
|
65
|
+
pane.removeClass 'closed half-open'
|
66
|
+
pane.addClass 'open'
|
67
|
+
|
68
|
+
half_open_pane: (pane) ->
|
69
|
+
pane.removeClass 'closed open half-open'
|
70
|
+
pane.addClass 'half-open'
|
71
|
+
|
72
|
+
close_pane: (pane) ->
|
73
|
+
pane.removeClass 'closed open half-open'
|
74
|
+
pane.addClass 'closed'
|
75
|
+
|
76
|
+
trigger: ->
|
77
|
+
@widget.trigger 'changed.two-pane', @state
|
78
|
+
|
@@ -0,0 +1,33 @@
|
|
1
|
+
#= require moment
|
2
|
+
#= require bootstrap-datetimepicker
|
3
|
+
#= require smart-tree-table
|
4
|
+
#= require smart-list-table
|
5
|
+
#= require smart-links
|
6
|
+
#= require aerogel-media
|
7
|
+
#= require_tree ../admin-pages-edit
|
8
|
+
#= require admin-pages-utils/attached-footer
|
9
|
+
|
10
|
+
@select_page_dialog = (field) ->
|
11
|
+
field = $("##{field}")
|
12
|
+
console?.log "select page: from field #{field.val()}"
|
13
|
+
$("#adminModal").modal
|
14
|
+
remote: 'edit/select_page'
|
15
|
+
|
16
|
+
|
17
|
+
@select_template_dialog = (field) ->
|
18
|
+
field = $("##{field}")
|
19
|
+
console?.log "select template: from field #{field.val()}"
|
20
|
+
$("#adminModal").modal
|
21
|
+
remote: 'edit/select_template'
|
22
|
+
|
23
|
+
|
24
|
+
$ ->
|
25
|
+
$('.datetimepicker').each ->
|
26
|
+
new DatetimePickerField $(@)
|
27
|
+
|
28
|
+
@attached_footer = new AttachedFooter
|
29
|
+
target: $(".page-tabs")
|
30
|
+
footer: $(".form-buttons")
|
31
|
+
observe: $(window)
|
32
|
+
position: 'fixed'
|
33
|
+
|
@@ -0,0 +1,17 @@
|
|
1
|
+
#= require smart-tree-table
|
2
|
+
#= require jquery.history
|
3
|
+
#= require aerogel-media
|
4
|
+
#= require_tree ../admin-pages-utils
|
5
|
+
#= require_tree ../admin-pages
|
6
|
+
|
7
|
+
|
8
|
+
@pages_widget = null
|
9
|
+
@pane_tree = null
|
10
|
+
@pane_preview = null
|
11
|
+
|
12
|
+
$ =>
|
13
|
+
@pages_widget = new PagesWidget $(".pages-widget"), $(".pane-tree"), $(".pane-preview")
|
14
|
+
@pane_tree = new PaneTree $(".pane-tree").first()
|
15
|
+
@pane_preview = new PanePreview $(".pane-preview").first()
|
16
|
+
|
17
|
+
|
@@ -0,0 +1,113 @@
|
|
1
|
+
@import "admin/global";
|
2
|
+
@import "two-pane-widget";
|
3
|
+
@import "admin/utils/center-absolutely";
|
4
|
+
|
5
|
+
|
6
|
+
#page-content {
|
7
|
+
width: 100%;
|
8
|
+
margin: 0;
|
9
|
+
padding: 0;
|
10
|
+
|
11
|
+
}
|
12
|
+
|
13
|
+
$pane-btn-radius: 6px;
|
14
|
+
$pane-btn-hover-bg: $item-hover-bg; // #eee;
|
15
|
+
$pane-border: 1px solid #ccc;
|
16
|
+
|
17
|
+
//
|
18
|
+
//
|
19
|
+
//
|
20
|
+
.pages-widget {
|
21
|
+
@include two-pane-widget;
|
22
|
+
|
23
|
+
// stylize panes
|
24
|
+
.pane.left:hover {
|
25
|
+
box-shadow: 5px 0px 10px -5px rgba( 0,0,0, 0.3 );
|
26
|
+
.btn-open {
|
27
|
+
box-shadow: 5px 0px 10px -3px rgba( 0,0,0, 0.3 );
|
28
|
+
}
|
29
|
+
}
|
30
|
+
.pane.right:hover {
|
31
|
+
box-shadow: -5px 0px 10px -5px rgba( 0,0,0, 0.3 );
|
32
|
+
.btn-open {
|
33
|
+
box-shadow: -5px 0px 10px -3px rgba( 0,0,0, 0.3 );
|
34
|
+
}
|
35
|
+
}
|
36
|
+
.pane.right.half-open {
|
37
|
+
border-left: $pane-border;
|
38
|
+
}
|
39
|
+
|
40
|
+
// stylize buttons
|
41
|
+
.pane .btn-open {
|
42
|
+
background: white;
|
43
|
+
border: $pane-border;
|
44
|
+
&:hover {
|
45
|
+
background: $pane-btn-hover-bg;
|
46
|
+
}
|
47
|
+
}
|
48
|
+
.pane.left .btn-open {
|
49
|
+
border-left: none;
|
50
|
+
border-radius: 0 $pane-btn-radius $pane-btn-radius 0;
|
51
|
+
}
|
52
|
+
.pane.right .btn-open {
|
53
|
+
border-right: none;
|
54
|
+
border-radius: $pane-btn-radius 0 0 $pane-btn-radius;
|
55
|
+
}
|
56
|
+
|
57
|
+
|
58
|
+
// stylize pane content
|
59
|
+
.pane-preview {
|
60
|
+
// border-left: 1px solid #ccc;
|
61
|
+
|
62
|
+
#preview { padding: 15px; }
|
63
|
+
#preview-empty {
|
64
|
+
@extend .center-absolutely;
|
65
|
+
width: 50%;
|
66
|
+
line-height: 100px;
|
67
|
+
height: 100px;
|
68
|
+
text-align: center;
|
69
|
+
vertical-align: middle;
|
70
|
+
color: $text-disabled-color;
|
71
|
+
}
|
72
|
+
}
|
73
|
+
|
74
|
+
// stylize pane toolbars
|
75
|
+
.pane {
|
76
|
+
&:not(.open) {
|
77
|
+
#preview, .bottom-toolbar .container {
|
78
|
+
width: 100%;
|
79
|
+
}
|
80
|
+
}
|
81
|
+
|
82
|
+
.bottom-toolbar:not(.floating) {
|
83
|
+
.container {
|
84
|
+
padding-top: 15px;
|
85
|
+
padding-bottom: 15px;
|
86
|
+
}
|
87
|
+
}
|
88
|
+
.bottom-toolbar.floating {
|
89
|
+
width: 100%;
|
90
|
+
height: 60px;
|
91
|
+
background: rgba( 0,0,0, 0.3 );
|
92
|
+
|
93
|
+
.container {
|
94
|
+
}
|
95
|
+
|
96
|
+
// vertically centering container of unknown height:
|
97
|
+
&:before, .container {
|
98
|
+
display: inline-block;
|
99
|
+
vertical-align: middle;
|
100
|
+
}
|
101
|
+
&:before {
|
102
|
+
content: '';
|
103
|
+
display: inline-block;
|
104
|
+
width: 0;
|
105
|
+
height: 100%;
|
106
|
+
vertical-align: middle;
|
107
|
+
margin-left: -0.35em;
|
108
|
+
}
|
109
|
+
}
|
110
|
+
|
111
|
+
}
|
112
|
+
|
113
|
+
}
|
@@ -0,0 +1,35 @@
|
|
1
|
+
.page-preview-body {
|
2
|
+
.breadcrumb {
|
3
|
+
margin-bottom: 15px;
|
4
|
+
}
|
5
|
+
.title {
|
6
|
+
margin: 0 0 7px;
|
7
|
+
padding: 0;
|
8
|
+
}
|
9
|
+
|
10
|
+
.headers {
|
11
|
+
margin: 0 0 15px 0;
|
12
|
+
padding-bottom: 7px;
|
13
|
+
color: $item-disabled-fg;
|
14
|
+
border-bottom: 1px solid #eee;
|
15
|
+
}
|
16
|
+
|
17
|
+
.image {
|
18
|
+
&.left {
|
19
|
+
float: left;
|
20
|
+
margin: 5px 5px 5px 0;
|
21
|
+
}
|
22
|
+
&.middle {
|
23
|
+
margin: 5px;
|
24
|
+
text-align: center;
|
25
|
+
img {
|
26
|
+
margin-left: auto;
|
27
|
+
margin-right: auto;
|
28
|
+
}
|
29
|
+
}
|
30
|
+
&.right {
|
31
|
+
float: right;
|
32
|
+
margin: 5px 0px 5px 5px;
|
33
|
+
}
|
34
|
+
}
|
35
|
+
}
|
@@ -0,0 +1,103 @@
|
|
1
|
+
|
2
|
+
//
|
3
|
+
// TwoPaneWidget styles mixin for a widget
|
4
|
+
//
|
5
|
+
@mixin two-pane-widget {
|
6
|
+
width: 100%;
|
7
|
+
height: 100px;
|
8
|
+
margin: 0;
|
9
|
+
padding: 0;
|
10
|
+
box-sizing: border-box;
|
11
|
+
|
12
|
+
.pane.left {
|
13
|
+
@include two-pane-widget-pane( -1 );
|
14
|
+
}
|
15
|
+
.pane.right {
|
16
|
+
@include two-pane-widget-pane( 1 );
|
17
|
+
}
|
18
|
+
}
|
19
|
+
|
20
|
+
//
|
21
|
+
// TwoPaneWidget styles mixin for a pane
|
22
|
+
// $left_or_right: -1 for left, 1 for right
|
23
|
+
//
|
24
|
+
@mixin two-pane-widget-pane( $left_or_right ) {
|
25
|
+
|
26
|
+
display: inline-block;
|
27
|
+
box-sizing: border-box;
|
28
|
+
width: 50%;
|
29
|
+
height: 100%;
|
30
|
+
vertical-align: top;
|
31
|
+
|
32
|
+
position: relative;
|
33
|
+
|
34
|
+
&.closed {
|
35
|
+
width: 0;
|
36
|
+
.btn-open {
|
37
|
+
display: inline-block;
|
38
|
+
}
|
39
|
+
.content {
|
40
|
+
display: none;
|
41
|
+
}
|
42
|
+
}
|
43
|
+
&.half-open{
|
44
|
+
width: 50%;
|
45
|
+
&:not(:hover) .btn-open { display: none }
|
46
|
+
}
|
47
|
+
&.open {
|
48
|
+
width: 100%;
|
49
|
+
.btn-open { display: none }
|
50
|
+
}
|
51
|
+
|
52
|
+
// scrollable content of a pane
|
53
|
+
.content {
|
54
|
+
overflow-y: scroll;
|
55
|
+
height: 100%;
|
56
|
+
}
|
57
|
+
|
58
|
+
// opening button/tab
|
59
|
+
.btn-open {
|
60
|
+
@include two-pane-widget-button( $left_or_right );
|
61
|
+
}
|
62
|
+
&.closed {
|
63
|
+
.btn-open:not(:hover) {
|
64
|
+
opacity: 0.5;
|
65
|
+
}
|
66
|
+
}
|
67
|
+
}
|
68
|
+
|
69
|
+
|
70
|
+
// Opening button/tab mixin.
|
71
|
+
// $left_or_right: -1 for left, 1 for right
|
72
|
+
//
|
73
|
+
@mixin two-pane-widget-button( $left_or_right ) {
|
74
|
+
$btn-size: 45px;
|
75
|
+
|
76
|
+
width: $btn-size;
|
77
|
+
height: $btn-size;
|
78
|
+
position: absolute;
|
79
|
+
z-index: 50;
|
80
|
+
top: 45%;
|
81
|
+
|
82
|
+
@if $left_or_right > 0 {
|
83
|
+
right: 100%;
|
84
|
+
} @else {
|
85
|
+
left: 100%;
|
86
|
+
}
|
87
|
+
|
88
|
+
cursor: pointer;
|
89
|
+
|
90
|
+
i {
|
91
|
+
display: inline-block;
|
92
|
+
margin: auto;
|
93
|
+
position: absolute;
|
94
|
+
height: 16px;
|
95
|
+
width: 16px;
|
96
|
+
top: 0;
|
97
|
+
right: 0;
|
98
|
+
bottom: 0;
|
99
|
+
left: 0;
|
100
|
+
}
|
101
|
+
}
|
102
|
+
|
103
|
+
|
@@ -0,0 +1,34 @@
|
|
1
|
+
.tree-select-page-widget {
|
2
|
+
// border: 1px solid $input-border-color;
|
3
|
+
max-height: 300px;
|
4
|
+
overflow-y: scroll;
|
5
|
+
|
6
|
+
.smart-tree-table {
|
7
|
+
thead {
|
8
|
+
display: none;
|
9
|
+
}
|
10
|
+
tbody {
|
11
|
+
tr td:nth-child(1) {
|
12
|
+
width: 30px;
|
13
|
+
}
|
14
|
+
}
|
15
|
+
}
|
16
|
+
}
|
17
|
+
|
18
|
+
|
19
|
+
.list-select-template-widget {
|
20
|
+
// border: 1px solid $input-border-color;
|
21
|
+
max-height: 300px;
|
22
|
+
overflow-y: scroll;
|
23
|
+
|
24
|
+
.smart-list-table {
|
25
|
+
thead {
|
26
|
+
display: none;
|
27
|
+
}
|
28
|
+
tbody {
|
29
|
+
tr td:nth-child(1) {
|
30
|
+
// width: 30px;
|
31
|
+
}
|
32
|
+
}
|
33
|
+
}
|
34
|
+
}
|