alchemy_cms 3.4.2 → 3.5.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.codeclimate.yml +9 -3
- data/.teatro.yml +1 -0
- data/.travis.yml +14 -17
- data/CHANGELOG.md +44 -6
- data/Gemfile +7 -4
- data/README.md +60 -10
- data/Rakefile +1 -1
- data/alchemy_cms.gemspec +5 -8
- data/app/assets/javascripts/alchemy/admin.js +2 -0
- data/app/assets/javascripts/alchemy/alchemy.dialog.js.coffee +1 -0
- data/app/assets/javascripts/alchemy/alchemy.gui.js.coffee +1 -0
- data/app/assets/javascripts/alchemy/alchemy.hotkeys.js.coffee +1 -1
- data/app/assets/javascripts/alchemy/alchemy.initializer.js.coffee +9 -7
- data/app/assets/javascripts/alchemy/alchemy.link_dialog.js.coffee +1 -0
- data/app/assets/javascripts/alchemy/alchemy.preview_window.js.coffee +11 -7
- data/app/assets/javascripts/alchemy/alchemy.sitemap.js.coffee +1 -1
- data/app/assets/javascripts/alchemy/alchemy.tinymce.js.coffee +8 -3
- data/app/assets/javascripts/alchemy/alchemy.tooltips.coffee +10 -0
- data/app/assets/javascripts/alchemy/alchemy.uploader.js.coffee +104 -73
- data/app/assets/stylesheets/alchemy/_defaults.scss +1 -4
- data/app/assets/stylesheets/alchemy/_extends.scss +13 -35
- data/app/assets/stylesheets/alchemy/_mixins.scss +82 -18
- data/app/assets/stylesheets/alchemy/_variables.scss +21 -8
- data/app/assets/stylesheets/alchemy/admin.scss +4 -0
- data/app/assets/stylesheets/alchemy/archive.scss +8 -12
- data/app/assets/stylesheets/alchemy/attachments.scss +39 -0
- data/app/assets/stylesheets/alchemy/base.scss +26 -15
- data/app/assets/stylesheets/alchemy/buttons.scss +59 -31
- data/app/assets/stylesheets/alchemy/dashboard.scss +3 -3
- data/app/assets/stylesheets/alchemy/dialogs.scss +10 -8
- data/app/assets/stylesheets/alchemy/elements.scss +65 -41
- data/app/assets/stylesheets/alchemy/errors.scss +7 -0
- data/app/assets/stylesheets/alchemy/flash.scss +1 -1
- data/app/assets/stylesheets/alchemy/form_fields.scss +0 -37
- data/app/assets/stylesheets/alchemy/forms.scss +18 -27
- data/app/assets/stylesheets/alchemy/frame.scss +104 -204
- data/app/assets/stylesheets/alchemy/hints.scss +62 -0
- data/app/assets/stylesheets/alchemy/icon-font.scss +2 -1
- data/app/assets/stylesheets/alchemy/icons.scss +9 -4
- data/app/assets/stylesheets/alchemy/image_library.scss +6 -6
- data/app/assets/stylesheets/alchemy/jquery-ui.scss +6 -4
- data/app/assets/stylesheets/alchemy/lists.scss +0 -1
- data/app/assets/stylesheets/alchemy/menubar.scss +3 -4
- data/app/assets/stylesheets/alchemy/modules.scss +0 -6
- data/app/assets/stylesheets/alchemy/navigation.scss +242 -0
- data/app/assets/stylesheets/alchemy/pagination.scss +3 -3
- data/app/assets/stylesheets/alchemy/print.scss +1 -0
- data/app/assets/stylesheets/alchemy/resource_info.scss +45 -0
- data/app/assets/stylesheets/alchemy/search.scss +72 -1
- data/app/assets/stylesheets/alchemy/selects.scss +38 -44
- data/app/assets/stylesheets/alchemy/sitemap.scss +89 -79
- data/app/assets/stylesheets/alchemy/tables.scss +6 -10
- data/app/assets/stylesheets/alchemy/toolbar.scss +7 -36
- data/app/assets/stylesheets/alchemy/upload.scss +12 -3
- data/app/assets/stylesheets/tinymce/skins/alchemy/content.min.css.scss +6 -3
- data/app/assets/stylesheets/tinymce/skins/alchemy/fonts/tinymce-small.svg +58 -170
- data/app/assets/stylesheets/tinymce/skins/alchemy/fonts/tinymce-small.ttf +0 -0
- data/app/assets/stylesheets/tinymce/skins/alchemy/fonts/tinymce-small.woff +0 -0
- data/app/assets/stylesheets/tinymce/skins/alchemy/fonts/tinymce.svg +124 -148
- data/app/assets/stylesheets/tinymce/skins/alchemy/fonts/tinymce.ttf +0 -0
- data/app/assets/stylesheets/tinymce/skins/alchemy/fonts/tinymce.woff +0 -0
- data/app/assets/stylesheets/tinymce/skins/alchemy/skin.min.css.scss +426 -144
- data/app/controllers/alchemy/admin/attachments_controller.rb +24 -16
- data/app/controllers/alchemy/admin/clipboard_controller.rb +1 -1
- data/app/controllers/alchemy/admin/essence_files_controller.rb +1 -1
- data/app/controllers/alchemy/admin/essence_pictures_controller.rb +9 -8
- data/app/controllers/alchemy/admin/layoutpages_controller.rb +1 -0
- data/app/controllers/alchemy/admin/pages_controller.rb +2 -2
- data/app/controllers/alchemy/admin/resources_controller.rb +2 -2
- data/app/controllers/alchemy/admin/tags_controller.rb +1 -1
- data/app/controllers/alchemy/api/pages_controller.rb +16 -0
- data/app/controllers/alchemy/messages_controller.rb +1 -1
- data/app/controllers/concerns/alchemy/admin/uploader_responses.rb +2 -2
- data/app/helpers/alchemy/admin/attachments_helper.rb +11 -0
- data/app/helpers/alchemy/admin/base_helper.rb +37 -4
- data/app/helpers/alchemy/admin/contents_helper.rb +11 -4
- data/app/helpers/alchemy/admin/elements_helper.rb +0 -19
- data/app/helpers/alchemy/admin/essences_helper.rb +7 -30
- data/app/helpers/alchemy/admin/navigation_helper.rb +13 -51
- data/app/helpers/alchemy/admin/pages_helper.rb +21 -16
- data/app/helpers/alchemy/admin/pictures_helper.rb +9 -0
- data/app/helpers/alchemy/deprecated_pages_helper.rb +54 -0
- data/app/helpers/alchemy/essences_helper.rb +1 -1
- data/app/helpers/alchemy/pages_helper.rb +8 -109
- data/app/helpers/alchemy/url_helper.rb +8 -13
- data/app/models/alchemy/attachment.rb +7 -4
- data/app/models/alchemy/cell.rb +2 -2
- data/app/models/alchemy/content.rb +2 -2
- data/app/models/alchemy/content/factory.rb +12 -9
- data/app/models/alchemy/element.rb +6 -3
- data/app/models/alchemy/essence_file.rb +1 -1
- data/app/models/alchemy/essence_picture.rb +37 -47
- data/app/models/alchemy/essence_picture_view.rb +8 -1
- data/app/models/alchemy/folded_page.rb +3 -2
- data/app/models/alchemy/legacy_page_url.rb +3 -3
- data/app/models/alchemy/page.rb +50 -5
- data/app/models/alchemy/page/fixed_attributes.rb +63 -0
- data/app/models/alchemy/page/page_elements.rb +10 -7
- data/app/models/alchemy/page/page_natures.rb +19 -0
- data/app/models/alchemy/picture.rb +1 -0
- data/app/models/alchemy/picture/transformations.rb +1 -1
- data/app/models/alchemy/picture/url.rb +82 -0
- data/app/serializers/alchemy/page_tree_serializer.rb +29 -8
- data/app/views/alchemy/_edit_mode.html.erb +2 -0
- data/app/views/alchemy/_menubar.html.erb +1 -1
- data/app/views/alchemy/_preview_mode_code.html.erb +6 -0
- data/app/views/alchemy/admin/attachments/_archive_overlay.html.erb +1 -1
- data/app/views/alchemy/admin/attachments/_attachment.html.erb +25 -5
- data/app/views/alchemy/admin/attachments/_replace_button.html.erb +26 -0
- data/app/views/alchemy/admin/attachments/index.html.erb +1 -1
- data/app/views/alchemy/admin/attachments/show.html.erb +52 -0
- data/app/views/alchemy/admin/elements/_element_header.html.erb +6 -3
- data/app/views/alchemy/admin/elements/create.js.erb +0 -2
- data/app/views/alchemy/admin/elements/trash.js.erb +0 -1
- data/app/views/alchemy/admin/elements/update.js.erb +0 -2
- data/app/views/alchemy/admin/essence_pictures/crop.html.erb +1 -4
- data/app/views/alchemy/admin/essence_pictures/edit.html.erb +1 -1
- data/app/views/alchemy/admin/languages/index.html.erb +1 -0
- data/app/views/alchemy/admin/layoutpages/_layoutpage.html.erb +26 -27
- data/app/views/alchemy/admin/layoutpages/edit.html.erb +1 -1
- data/app/views/alchemy/admin/pages/_form.html.erb +13 -40
- data/app/views/alchemy/admin/pages/_locked_page.html.erb +1 -1
- data/app/views/alchemy/admin/pages/_page.html.erb +119 -61
- data/app/views/alchemy/admin/pages/_page_for_links.html.erb +4 -2
- data/app/views/alchemy/admin/pages/_page_infos.html.erb +12 -12
- data/app/views/alchemy/admin/pages/_page_status.html.erb +1 -1
- data/app/views/alchemy/admin/pages/_publication_fields.html.erb +35 -0
- data/app/views/alchemy/admin/pages/edit.html.erb +13 -2
- data/app/views/alchemy/admin/pages/index.html.erb +3 -8
- data/app/views/alchemy/admin/pages/info.html.erb +15 -2
- data/app/views/alchemy/admin/pages/sort.js.erb +1 -1
- data/app/views/alchemy/admin/pages/update.js.erb +1 -14
- data/app/views/alchemy/admin/partials/_main_navigation_entry.html.erb +12 -8
- data/app/views/alchemy/admin/partials/_remote_search_form.html.erb +4 -4
- data/app/views/alchemy/admin/partials/_search_form.html.erb +1 -1
- data/app/views/alchemy/admin/partials/_sub_navigation.html.erb +9 -6
- data/app/views/alchemy/admin/pictures/_filter_and_size_bar.html.erb +1 -1
- data/app/views/alchemy/admin/pictures/_picture.html.erb +1 -6
- data/app/views/alchemy/admin/pictures/_picture_to_assign.html.erb +1 -6
- data/app/views/alchemy/admin/pictures/index.html.erb +1 -1
- data/app/views/alchemy/admin/pictures/show.html.erb +1 -6
- data/app/views/alchemy/admin/uploader/_button.html.erb +4 -4
- data/app/views/alchemy/base/500.html.erb +15 -1
- data/app/views/alchemy/essences/_essence_boolean_editor.html.erb +13 -15
- data/app/views/alchemy/essences/_essence_boolean_view.html.erb +1 -3
- data/app/views/alchemy/essences/_essence_date_editor.html.erb +0 -2
- data/app/views/alchemy/essences/_essence_date_view.html.erb +0 -2
- data/app/views/alchemy/essences/_essence_file_editor.html.erb +2 -7
- data/app/views/alchemy/essences/_essence_file_view.html.erb +1 -3
- data/app/views/alchemy/essences/_essence_html_editor.html.erb +0 -2
- data/app/views/alchemy/essences/_essence_html_view.html.erb +1 -3
- data/app/views/alchemy/essences/_essence_link_editor.html.erb +0 -2
- data/app/views/alchemy/essences/_essence_link_view.html.erb +0 -2
- data/app/views/alchemy/essences/_essence_picture_editor.html.erb +47 -49
- data/app/views/alchemy/essences/_essence_picture_view.html.erb +1 -3
- data/app/views/alchemy/essences/_essence_richtext_editor.html.erb +0 -2
- data/app/views/alchemy/essences/_essence_richtext_view.html.erb +1 -3
- data/app/views/alchemy/essences/_essence_select_editor.html.erb +27 -29
- data/app/views/alchemy/essences/_essence_select_view.html.erb +1 -3
- data/app/views/alchemy/essences/_essence_text_editor.html.erb +17 -19
- data/app/views/alchemy/essences/_essence_text_view.html.erb +0 -2
- data/app/views/alchemy/pages/_meta_data.html.erb +9 -0
- data/app/views/layouts/alchemy/admin.html.erb +9 -11
- data/bin/alchemy +1 -2
- data/config/alchemy/config.yml +1 -1
- data/config/alchemy/modules.yml +0 -16
- data/config/initializers/dragonfly.rb +0 -18
- data/config/initializers/mini_profiler.rb +6 -0
- data/config/locales/alchemy.de.yml +9 -1
- data/config/locales/alchemy.en.yml +7 -1
- data/config/locales/alchemy.es.yml +6 -0
- data/config/locales/alchemy.fr.yml +2 -0
- data/config/locales/alchemy.it.yml +3 -1
- data/config/locales/alchemy.nl.yml +2 -0
- data/config/locales/alchemy.ru.yml +2 -0
- data/config/routes.rb +3 -8
- data/db/migrate/20160912223112_add_index_to_alchemy_pages_rgt.rb +9 -0
- data/db/migrate/20160927205604_add_foreign_key_indices_and_null_constraints.rb +20 -0
- data/db/migrate/20160928080104_add_foreign_keys.rb +27 -0
- data/lib/alchemy/admin/locale.rb +4 -3
- data/lib/alchemy/engine.rb +2 -4
- data/lib/alchemy/errors.rb +9 -2
- data/lib/alchemy/forms/builder.rb +8 -0
- data/lib/alchemy/modules.rb +20 -19
- data/lib/alchemy/permissions.rb +15 -4
- data/lib/alchemy/resources_helper.rb +4 -2
- data/lib/alchemy/sass_support.rb +9 -0
- data/lib/alchemy/seeder.rb +89 -1
- data/lib/alchemy/test_support/essence_shared_examples.rb +2 -0
- data/lib/alchemy/test_support/factories/attachment_factory.rb +1 -1
- data/lib/alchemy/test_support/factories/content_factory.rb +1 -0
- data/lib/alchemy/test_support/factories/element_factory.rb +1 -0
- data/lib/alchemy/test_support/factories/picture_factory.rb +1 -1
- data/lib/alchemy/test_support/fixtures/image.png +0 -0
- data/lib/alchemy/tinymce.rb +2 -6
- data/lib/alchemy/upgrader.rb +4 -55
- data/lib/alchemy/upgrader/tasks/install_dragonfly_config.rb +14 -0
- data/lib/alchemy/upgrader/three_point_five.rb +32 -0
- data/lib/alchemy/upgrader/three_point_four.rb +2 -8
- data/lib/alchemy/upgrader/three_point_one.rb +30 -30
- data/lib/alchemy/upgrader/three_point_three.rb +31 -31
- data/lib/alchemy/upgrader/three_point_two.rb +25 -25
- data/lib/alchemy/upgrader/three_point_zero.rb +59 -59
- data/lib/alchemy/version.rb +1 -1
- data/lib/rails/generators/alchemy/elements/templates/view.html.erb +1 -1
- data/lib/rails/generators/alchemy/elements/templates/view.html.haml +1 -1
- data/lib/rails/generators/alchemy/elements/templates/view.html.slim +1 -1
- data/lib/rails/generators/alchemy/essence/templates/editor.html.erb +1 -3
- data/lib/rails/generators/alchemy/install/files/_article_view.html.erb +1 -1
- data/lib/rails/generators/alchemy/install/files/application.html.erb +3 -4
- data/lib/rails/generators/alchemy/install/install_generator.rb +4 -0
- data/lib/rails/generators/alchemy/install/templates/dragonfly.rb.tt +35 -0
- data/lib/rails/generators/alchemy/module/module_generator.rb +1 -1
- data/lib/tasks/alchemy/db.rake +6 -0
- data/lib/tasks/alchemy/tidy.rake +85 -0
- data/lib/tasks/alchemy/upgrade.rake +165 -16
- data/vendor/assets/javascripts/clipboard.min.js +7 -0
- data/vendor/assets/javascripts/fileupload/jquery.fileupload-process.js +4 -4
- data/vendor/assets/javascripts/fileupload/jquery.fileupload-validate.js +2 -2
- data/vendor/assets/javascripts/fileupload/jquery.fileupload.js +29 -14
- data/vendor/assets/javascripts/fileupload/jquery.iframe-transport.js +2 -2
- data/vendor/assets/javascripts/tinymce/langs/es.js +2 -2
- data/vendor/assets/javascripts/tinymce/langs/fr.js +1 -1
- data/vendor/assets/javascripts/tinymce/langs/it.js +1 -1
- data/vendor/assets/javascripts/tinymce/langs/nl.js +3 -3
- data/vendor/assets/javascripts/tinymce/tinymce.min.js +15 -12
- metadata +44 -88
- data/app/assets/stylesheets/tinymce/skins/alchemy/fonts/readme.md +0 -1
- data/app/assets/stylesheets/tinymce/skins/alchemy/fonts/tinymce-small.eot +0 -0
- data/app/assets/stylesheets/tinymce/skins/alchemy/fonts/tinymce.eot +0 -0
- data/app/assets/stylesheets/tinymce/skins/alchemy/img/wline.gif +0 -0
- data/app/assets/stylesheets/tinymce/skins/alchemy/skin.ie7.min.css +0 -1
- data/app/controllers/alchemy/pictures_controller.rb +0 -97
- data/app/views/alchemy/admin/elements/_refresh_editor.js.erb +0 -8
- data/vendor/assets/javascripts/tinymce/plugins/anchor/plugin.min.js +0 -1
- data/vendor/assets/javascripts/tinymce/plugins/autoresize/plugin.min.js +0 -1
- data/vendor/assets/javascripts/tinymce/plugins/charmap/plugin.min.js +0 -1
- data/vendor/assets/javascripts/tinymce/plugins/code/plugin.min.js +0 -1
- data/vendor/assets/javascripts/tinymce/plugins/directionality/plugin.min.js +0 -1
- data/vendor/assets/javascripts/tinymce/plugins/fullscreen/plugin.min.js +0 -1
- data/vendor/assets/javascripts/tinymce/plugins/hr/plugin.min.js +0 -1
- data/vendor/assets/javascripts/tinymce/plugins/link/plugin.min.js +0 -1
- data/vendor/assets/javascripts/tinymce/plugins/paste/plugin.min.js +0 -1
- data/vendor/assets/javascripts/tinymce/plugins/tabfocus/plugin.min.js +0 -1
- data/vendor/assets/javascripts/tinymce/plugins/table/plugin.min.js +0 -1
- data/vendor/assets/javascripts/tinymce/themes/modern/theme.min.js +0 -1
@@ -1,6 +1,8 @@
|
|
1
1
|
window.Alchemy = {} if typeof(window.Alchemy) is 'undefined'
|
2
2
|
|
3
3
|
Alchemy.PreviewWindow =
|
4
|
+
MIN_WIDTH: 240
|
5
|
+
HEIGHT: 75 # Top menu height
|
4
6
|
|
5
7
|
init: (url) ->
|
6
8
|
$iframe = $("<iframe name=\"alchemy_preview_window\" src=\"#{url}\" id=\"alchemy_preview_window\" frameborder=\"0\"/>")
|
@@ -14,13 +16,9 @@ Alchemy.PreviewWindow =
|
|
14
16
|
@resize()
|
15
17
|
|
16
18
|
resize: ->
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
else
|
21
|
-
width = $window.width() - 466
|
22
|
-
height = $window.height() - 73
|
23
|
-
width = 240 if width < 240
|
19
|
+
width = @_calculateWidth()
|
20
|
+
height = $(window).height() - @HEIGHT
|
21
|
+
width = @MIN_WIDTH if width < @MIN_WIDTH
|
24
22
|
@currentWidth = width
|
25
23
|
@currentWindow.css
|
26
24
|
width: width
|
@@ -54,5 +52,11 @@ Alchemy.PreviewWindow =
|
|
54
52
|
$reload.click =>
|
55
53
|
@refresh()
|
56
54
|
|
55
|
+
_calculateWidth: ->
|
56
|
+
width = $(window).width() - $('#left_menu').width()
|
57
|
+
unless Alchemy.ElementsWindow.hidden
|
58
|
+
width -= $('#alchemy_elements_window').width()
|
59
|
+
return width
|
60
|
+
|
57
61
|
Alchemy.reloadPreview = ->
|
58
62
|
Alchemy.PreviewWindow.refresh()
|
@@ -7,7 +7,7 @@ Alchemy.Sitemap =
|
|
7
7
|
|
8
8
|
# Storing some objects.
|
9
9
|
init: (options) ->
|
10
|
-
@search_field = $("
|
10
|
+
@search_field = $(".search_input_field")
|
11
11
|
@filter_field_clear = $('.js_filter_field_clear')
|
12
12
|
@display = $('#page_filter_result')
|
13
13
|
@sitemap_wrapper = $('#sitemap-wrapper p.loading')
|
@@ -45,7 +45,11 @@ $.extend Alchemy.Tinymce,
|
|
45
45
|
# - Editor id that should be initialized.
|
46
46
|
#
|
47
47
|
initEditor: (id) ->
|
48
|
-
|
48
|
+
editor_id = "tinymce_#{id}"
|
49
|
+
textarea = $("##{editor_id}")
|
50
|
+
editor = tinymce.get(editor_id)
|
51
|
+
# remove editor instance, if already initialized
|
52
|
+
editor.remove() if editor
|
49
53
|
if textarea.length == 0
|
50
54
|
Alchemy.log_error "Could not initialize TinyMCE for textarea#tinymce_#{id}!"
|
51
55
|
return
|
@@ -63,7 +67,7 @@ $.extend Alchemy.Tinymce,
|
|
63
67
|
$this = $("##{inst.id}")
|
64
68
|
parent = $this.closest('.element-editor')
|
65
69
|
parent.find('.spinner').remove()
|
66
|
-
inst.on '
|
70
|
+
inst.on 'dirty', (e) ->
|
67
71
|
Alchemy.setElementDirty(parent)
|
68
72
|
|
69
73
|
# Removes the TinyMCE editor from given dom ids.
|
@@ -77,6 +81,7 @@ $.extend Alchemy.Tinymce,
|
|
77
81
|
# Remove all tinymce instances for given selector
|
78
82
|
removeFrom: (selector) ->
|
79
83
|
$(selector).each ->
|
80
|
-
tinymce.get(this.id)
|
84
|
+
elem = tinymce.get(this.id)
|
85
|
+
elem.remove() if elem
|
81
86
|
return
|
82
87
|
return
|
@@ -0,0 +1,10 @@
|
|
1
|
+
window.Alchemy = {} if typeof(window.Alchemy) is 'undefined'
|
2
|
+
|
3
|
+
Alchemy.Tooltips = (scope) ->
|
4
|
+
$('[data-alchemy-tooltip]', scope).each ->
|
5
|
+
$el = $(this)
|
6
|
+
text = $el.data('alchemy-tooltip')
|
7
|
+
$el.wrap('<span class="with-hint"/>')
|
8
|
+
$el.after('<span class="hint-bubble">'+text+'</span>')
|
9
|
+
return
|
10
|
+
return
|
@@ -10,6 +10,9 @@ window.Alchemy = {} if typeof(window.Alchemy) is 'undefined'
|
|
10
10
|
Alchemy.Uploader = (settings) ->
|
11
11
|
totalFilesCount = 0
|
12
12
|
completedUploads = 0
|
13
|
+
$filesContainer = $('.upload-progress-container')
|
14
|
+
selector = settings.selector || '.fileupload'
|
15
|
+
$fields = $(selector)
|
13
16
|
$dropZone = $(settings.dropzone)
|
14
17
|
|
15
18
|
# Normalize file types regex
|
@@ -22,79 +25,107 @@ Alchemy.Uploader = (settings) ->
|
|
22
25
|
$dropZone.on 'dragleave', ->
|
23
26
|
$dropZone.removeClass('dragover')
|
24
27
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
$dropZone.removeClass('dragover').addClass('upload-in-progress')
|
45
|
-
$('.overall-upload').addClass('visible')
|
46
|
-
# trigger validations
|
47
|
-
data.process -> $this.fileupload('process', data)
|
48
|
-
if data.files.error
|
49
|
-
data.context.setError()
|
50
|
-
data.context.setStatus(data.files[0].error)
|
51
|
-
data.context.$fileProgressCancel.click (e) ->
|
52
|
-
e.preventDefault()
|
53
|
-
data.context.setCancelled()
|
54
|
-
data.context.setStatus('cancelled')
|
55
|
-
false
|
56
|
-
false
|
57
|
-
else
|
58
|
-
xhr = data.submit()
|
59
|
-
data.context.$fileProgressCancel.click (e) ->
|
60
|
-
e.preventDefault()
|
61
|
-
xhr.abort()
|
62
|
-
data.context.setCancelled()
|
63
|
-
data.context.setStatus('cancelled')
|
64
|
-
false
|
65
|
-
xhr
|
66
|
-
progress: (e, data) ->
|
67
|
-
progress = parseInt(data.loaded / data.total * 100, 10)
|
68
|
-
data.context.setProgress(progress)
|
69
|
-
progressall: (e, data) ->
|
70
|
-
progress = parseInt(data.loaded / data.total * 100, 10)
|
71
|
-
bar = $('.overall-upload .progress')
|
72
|
-
bar.css width: "#{progress}%"
|
73
|
-
$('.progress-status').text("#{progress}%")
|
74
|
-
done: (e, data) ->
|
75
|
-
completedUploads += 1
|
76
|
-
$('.uploaded-files-count').text(completedUploads)
|
77
|
-
data.context.setComplete()
|
78
|
-
data.context.setStatus('complete')
|
79
|
-
response_data = data.xhr().response
|
80
|
-
if completedUploads == totalFilesCount
|
81
|
-
completedUploads = 0
|
82
|
-
totalFilesCount = 0
|
83
|
-
$('.overall-upload').removeClass('visible')
|
84
|
-
settings.complete()
|
85
|
-
fail: (e, data) ->
|
28
|
+
getNumberOfFiles = ->
|
29
|
+
$filesContainer
|
30
|
+
.children()
|
31
|
+
.not('.progress-bar-in-progress').length - 1
|
32
|
+
|
33
|
+
dragover = ->
|
34
|
+
$dropZone.addClass('dragover')
|
35
|
+
return
|
36
|
+
|
37
|
+
add = (e, data) ->
|
38
|
+
$this = $(this)
|
39
|
+
data.context = new Alchemy.FileProgress(data.files[0])
|
40
|
+
totalFilesCount = data.originalFiles.length
|
41
|
+
$('.total-files-count').text(totalFilesCount)
|
42
|
+
$dropZone.removeClass('dragover').addClass('upload-in-progress')
|
43
|
+
$('.overall-upload').addClass('visible')
|
44
|
+
# trigger validations
|
45
|
+
data.process -> $this.fileupload('process', data)
|
46
|
+
if data.files.error
|
86
47
|
data.context.setError()
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
48
|
+
data.context.setStatus(data.files[0].error)
|
49
|
+
data.context.$fileProgressCancel.click (e) ->
|
50
|
+
data.context.setCancelled()
|
51
|
+
data.context.setStatus('cancelled')
|
52
|
+
return false
|
53
|
+
return false
|
54
|
+
else
|
55
|
+
xhr = data.submit()
|
56
|
+
data.context.$fileProgressCancel.click (e) ->
|
57
|
+
xhr.abort()
|
58
|
+
data.context.setCancelled()
|
59
|
+
data.context.setStatus('cancelled')
|
60
|
+
return false
|
61
|
+
return xhr
|
62
|
+
|
63
|
+
progress = (e, data) ->
|
64
|
+
progress = parseInt(data.loaded / data.total * 100, 10)
|
65
|
+
data.context.setProgress(progress)
|
66
|
+
return
|
67
|
+
|
68
|
+
progressall = (e, data) ->
|
69
|
+
progress = parseInt(data.loaded / data.total * 100, 10)
|
70
|
+
bar = $('.overall-upload .progress')
|
71
|
+
bar.css width: "#{progress}%"
|
72
|
+
$('.progress-status').text("#{progress}%")
|
73
|
+
return
|
74
|
+
|
75
|
+
done = (e, data) ->
|
76
|
+
completedUploads += 1
|
77
|
+
$('.uploaded-files-count').text(completedUploads)
|
78
|
+
data.context.setComplete()
|
79
|
+
data.context.setStatus('complete')
|
80
|
+
response_data = data.xhr().response
|
81
|
+
if completedUploads == totalFilesCount
|
82
|
+
completedUploads = 0
|
83
|
+
totalFilesCount = 0
|
84
|
+
$('.overall-upload').removeClass('visible')
|
85
|
+
settings.complete()
|
86
|
+
return
|
87
|
+
|
88
|
+
fail = (e, data) ->
|
89
|
+
data.context.setError()
|
90
|
+
response_data = data.xhr().response
|
91
|
+
if response_data
|
92
|
+
response = JSON.parse(response_data)
|
93
|
+
error = response.files[0].error
|
94
|
+
data.context.setStatus(error || data.textStatus)
|
95
|
+
return
|
96
|
+
|
97
|
+
always = (e, data) ->
|
98
|
+
xhr = data.xhr()
|
99
|
+
response_data = xhr.response
|
100
|
+
if response_data
|
101
|
+
response = JSON.parse(response_data)
|
102
|
+
if response.growl_message
|
103
|
+
Alchemy.growl(response.growl_message, if xhr.status == 422 then 'alert' else 'notice')
|
104
|
+
return
|
105
|
+
|
106
|
+
$fields.each ->
|
107
|
+
$field = $(this)
|
108
|
+
$form = $field.parents('form')
|
109
|
+
url = $form.attr('action')
|
110
|
+
http_method = $form.find('[name="_method"]').val()
|
111
|
+
# Init jquery.fileupload
|
112
|
+
$field.fileupload
|
113
|
+
url: url
|
114
|
+
type: if http_method then http_method.toUpperCase() else 'POST'
|
115
|
+
dropZone: $dropZone
|
116
|
+
dataType: 'json'
|
117
|
+
filesContainer: $filesContainer
|
118
|
+
acceptFileTypes: new RegExp("(.|/)(#{file_types})", "i")
|
119
|
+
maxNumberOfFiles: Alchemy.uploader_defaults.file_upload_limit
|
120
|
+
maxFileSize: Alchemy.uploader_defaults.file_size_limit * 1000000
|
121
|
+
getNumberOfFiles: getNumberOfFiles
|
122
|
+
dragover: dragover
|
123
|
+
add: add
|
124
|
+
progress: progress
|
125
|
+
progressall: progressall
|
126
|
+
done: done
|
127
|
+
fail: fail
|
128
|
+
always: always
|
129
|
+
return
|
99
130
|
|
100
131
|
return
|
@@ -1,5 +1,5 @@
|
|
1
1
|
%rounded-border {
|
2
|
-
|
2
|
+
border-radius: $default-border-radius;
|
3
3
|
}
|
4
4
|
|
5
5
|
%text-overflow {
|
@@ -11,33 +11,6 @@
|
|
11
11
|
-moz-text-overflow: ellipsis;
|
12
12
|
}
|
13
13
|
|
14
|
-
%tooltip {
|
15
|
-
display: none;
|
16
|
-
background: $light_yellow;
|
17
|
-
@extend %rounded-border;
|
18
|
-
@include box-shadow(0 4px 24px $dark-gray);
|
19
|
-
position: absolute;
|
20
|
-
right: -25px;
|
21
|
-
top: 26px;
|
22
|
-
z-index: 100;
|
23
|
-
padding: 8px;
|
24
|
-
line-height: 1.5em;
|
25
|
-
min-width: 180px;
|
26
|
-
font-size: 12px;
|
27
|
-
|
28
|
-
&:before {
|
29
|
-
content: '';
|
30
|
-
position: absolute;
|
31
|
-
top: -8px;
|
32
|
-
right: 24px;
|
33
|
-
width: 0px;
|
34
|
-
height: 0px;
|
35
|
-
border-style: solid;
|
36
|
-
border-width: 0 8px 8px 8px;
|
37
|
-
border-color: transparent transparent $light_yellow transparent;
|
38
|
-
}
|
39
|
-
}
|
40
|
-
|
41
14
|
%thumbnail-background {
|
42
15
|
display: table-cell;
|
43
16
|
background-color: $dark-gray;
|
@@ -51,7 +24,7 @@
|
|
51
24
|
border-color: $error_border_color;
|
52
25
|
color: $error_text_color;
|
53
26
|
background-color: lighten($error_background_color, 8%);
|
54
|
-
|
27
|
+
box-shadow: inset 1px 1px 4px rgba($error_border_color, 0.5);
|
55
28
|
}
|
56
29
|
|
57
30
|
%blue-focus-style {
|
@@ -59,10 +32,9 @@
|
|
59
32
|
}
|
60
33
|
|
61
34
|
%default-input-style {
|
62
|
-
|
63
|
-
$border-inset-color: lighten($default-border-color, 20%);
|
35
|
+
box-sizing: border-box;
|
64
36
|
@extend %rounded-border;
|
65
|
-
|
37
|
+
box-shadow: inset 0px 1px 1px $medium-gray;
|
66
38
|
font: $default-font-style;
|
67
39
|
padding: 1px 2*$default-padding;
|
68
40
|
margin: $default-form-field-margin;
|
@@ -74,7 +46,7 @@
|
|
74
46
|
width: 100%;
|
75
47
|
font-size: 12px;
|
76
48
|
line-height: 12px;
|
77
|
-
height:
|
49
|
+
height: $default-form-field-height;
|
78
50
|
@include transition(
|
79
51
|
box-shadow 0.25s ease-in-out,
|
80
52
|
background-color 0.25s ease-in-out,
|
@@ -84,10 +56,16 @@
|
|
84
56
|
&:focus {
|
85
57
|
@extend %blue-focus-style;
|
86
58
|
}
|
59
|
+
|
60
|
+
&[disabled], .disabled {
|
61
|
+
color: #888;
|
62
|
+
background-color: rgba(#fff, 0.5);
|
63
|
+
cursor: not-allowed;
|
64
|
+
}
|
87
65
|
}
|
88
66
|
|
89
67
|
%gradiated-toolbar {
|
90
|
-
background: $
|
68
|
+
background: $toolbar-bg-color;
|
91
69
|
padding: 8px 4px;
|
92
|
-
height:
|
70
|
+
height: $default-form-field-height;
|
93
71
|
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
@mixin default-focus-style {
|
2
2
|
border-color: $blue;
|
3
|
-
|
3
|
+
box-shadow: 0 0 1px 1px $blue;
|
4
4
|
outline: none;
|
5
5
|
|
6
6
|
&::-moz-focus-inner {
|
@@ -9,10 +9,58 @@
|
|
9
9
|
}
|
10
10
|
}
|
11
11
|
|
12
|
-
@mixin button-defaults
|
13
|
-
|
14
|
-
|
15
|
-
|
12
|
+
@mixin button-defaults(
|
13
|
+
$first-color: $button-gradient-first-color,
|
14
|
+
$second-color: $button-gradient-second-color,
|
15
|
+
$border-radius: $default-border-radius,
|
16
|
+
$padding: $button-padding,
|
17
|
+
$margin: $button-margin) {
|
18
|
+
display: inline-block;
|
19
|
+
font-size: 12px;
|
20
|
+
padding: $padding;
|
21
|
+
cursor: pointer;
|
22
|
+
border-radius: $border-radius;
|
23
|
+
background-color: $button-bg-color;
|
24
|
+
background-image: linear-gradient($first-color, $second-color);
|
25
|
+
box-shadow: white 0 1px 0 inset;
|
26
|
+
border: 1px solid $button-border-color;
|
27
|
+
color: $text-color;
|
28
|
+
text-shadow: $button-text-shadow;
|
29
|
+
margin: $margin;
|
30
|
+
@include appearance(none);
|
31
|
+
|
32
|
+
&:hover {
|
33
|
+
text-decoration: none;
|
34
|
+
background-color: $button-hover-bg-color;
|
35
|
+
background-image: linear-gradient(
|
36
|
+
darken($first-color, 5%),
|
37
|
+
darken($second-color, 5%)
|
38
|
+
);
|
39
|
+
border-color: $button-hover-border-color;
|
40
|
+
}
|
41
|
+
|
42
|
+
&:active, &:active:focus {
|
43
|
+
box-shadow: #c4c4c4 0 1px 2px inset;
|
44
|
+
border-color: $button-border-color;
|
45
|
+
}
|
46
|
+
|
47
|
+
&:focus {
|
48
|
+
@include default-focus-style;
|
49
|
+
}
|
50
|
+
|
51
|
+
&.disabled, &[disabled],
|
52
|
+
&.disabled:active, &[disabled]:active,
|
53
|
+
&.disabled:hover, &[disabled]:hover {
|
54
|
+
opacity: 0.6;
|
55
|
+
background: $second-color;
|
56
|
+
cursor: not-allowed;
|
57
|
+
box-shadow: none;
|
58
|
+
}
|
59
|
+
|
60
|
+
&::-moz-focus-inner {
|
61
|
+
padding: 0 !important;
|
62
|
+
margin: -1px !important;
|
63
|
+
}
|
16
64
|
}
|
17
65
|
|
18
66
|
@mixin default-label-style {
|
@@ -54,7 +102,7 @@
|
|
54
102
|
margin: $default-form-field-margin;
|
55
103
|
padding: $default-padding 2*$default-padding;
|
56
104
|
line-height: 21px;
|
57
|
-
min-height:
|
105
|
+
min-height: $default-form-field-height;
|
58
106
|
background: white;
|
59
107
|
@extend %rounded-border;
|
60
108
|
@extend .border-box-sizing;
|
@@ -123,17 +171,33 @@
|
|
123
171
|
}
|
124
172
|
|
125
173
|
@mixin linked-button($border-radius: $default-border-radius) {
|
126
|
-
@include
|
127
|
-
|
128
|
-
$
|
129
|
-
$
|
130
|
-
$
|
131
|
-
$
|
132
|
-
$sb-text-color,
|
133
|
-
$sb-text-style,
|
134
|
-
$sb-pseudo-states,
|
135
|
-
$sb-ie-support
|
174
|
+
@include button-defaults(
|
175
|
+
$first-color: $linked-color,
|
176
|
+
$second-color: darken($linked-color, 10%),
|
177
|
+
$border-radius: $border-radius,
|
178
|
+
$padding: 3px,
|
179
|
+
$margin: 0
|
136
180
|
);
|
137
|
-
|
138
|
-
|
181
|
+
}
|
182
|
+
|
183
|
+
@mixin zoom-in {
|
184
|
+
cursor: pointer;
|
185
|
+
cursor: image-url('alchemy/lupe.cur');
|
186
|
+
cursor: -webkit-zoom-in;
|
187
|
+
cursor: -moz-zoom-in;
|
188
|
+
cursor: zoom-in;
|
189
|
+
}
|
190
|
+
|
191
|
+
@mixin truncate($max-width, $display: inline-block) {
|
192
|
+
display: $display;
|
193
|
+
max-width: $max-width;
|
194
|
+
overflow: hidden;
|
195
|
+
text-overflow: ellipsis;
|
196
|
+
}
|
197
|
+
|
198
|
+
@mixin hint-hover-style {
|
199
|
+
visibility: visible;
|
200
|
+
top: 26px;
|
201
|
+
opacity: 1;
|
202
|
+
transition-delay: .2s;
|
139
203
|
}
|