ab_admin 0.8.3 → 0.10.0

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.
Files changed (151) hide show
  1. checksums.yaml +4 -4
  2. data/MIT-LICENSE +1 -1
  3. data/README.md +11 -5
  4. data/app/assets/javascripts/ab_admin/components/admin_assets.js.coffee +0 -25
  5. data/app/assets/javascripts/ab_admin/components/google_translate.js.coffee +3 -5
  6. data/app/assets/javascripts/ab_admin/components/in_place_edit.js.coffee +33 -25
  7. data/app/assets/javascripts/ab_admin/core/batch_actions.js.coffee +1 -1
  8. data/app/assets/javascripts/ab_admin/core/columns_hider.js.coffee +24 -23
  9. data/app/assets/javascripts/ab_admin/core/init.js.coffee +7 -2
  10. data/app/assets/javascripts/ab_admin/core/search_form.js.coffee +1 -7
  11. data/app/assets/javascripts/ab_admin/core/ui_utils.js.coffee +23 -7
  12. data/app/assets/javascripts/ab_admin/core/utils.js.coffee +16 -2
  13. data/app/assets/javascripts/ab_admin/inputs/datetime_input.js.coffee +1 -0
  14. data/app/assets/javascripts/ab_admin/main.js +3 -4
  15. data/app/assets/stylesheets/ab_admin/bootstrap_and_overrides.scss +71 -25
  16. data/app/assets/stylesheets/ab_admin/components/_base.scss +21 -1
  17. data/app/assets/stylesheets/ab_admin/components/_colored_tabs.scss +1 -1
  18. data/app/assets/stylesheets/ab_admin/components/_form.scss +16 -18
  19. data/app/assets/stylesheets/ab_admin/components/_grid_view.scss +2 -2
  20. data/app/assets/stylesheets/ab_admin/components/_locale_tabs.scss +11 -23
  21. data/app/assets/stylesheets/ab_admin/components/_navigation.scss +7 -11
  22. data/app/assets/stylesheets/ab_admin/components/_table_view.scss +85 -11
  23. data/app/assets/stylesheets/ab_admin/components/_tooltip.scss +81 -0
  24. data/app/assets/stylesheets/ab_admin/components/_tree_view.scss +1 -1
  25. data/app/assets/stylesheets/ab_admin/devise.scss +2 -2
  26. data/app/assets/stylesheets/ab_admin/fileupload.scss +2 -9
  27. data/app/assets/stylesheets/ab_admin/main.scss +1 -2
  28. data/app/controllers/admin/assets_controller.rb +1 -1
  29. data/app/controllers/admin/base_controller.rb +133 -149
  30. data/app/controllers/admin/dashboards_controller.rb +2 -2
  31. data/app/controllers/admin/locators_controller.rb +8 -6
  32. data/app/controllers/admin/manager_controller.rb +19 -49
  33. data/app/controllers/admin/static_pages_controller.rb +0 -4
  34. data/app/controllers/admin/structures_controller.rb +2 -2
  35. data/app/views/ab_admin/devise/sessions/new.html.slim +2 -0
  36. data/app/views/admin/assets/batch_edit.html.slim +3 -2
  37. data/app/views/admin/base/_search_layout.html.slim +7 -6
  38. data/app/views/admin/base/create.js.erb +6 -3
  39. data/app/views/admin/base/edit.js.erb +1 -1
  40. data/app/views/admin/base/index.html.slim +4 -4
  41. data/app/views/admin/base/new.js.erb +1 -1
  42. data/app/views/admin/base/update.js.erb +7 -2
  43. data/app/views/admin/fileupload/_asset_templates.html.slim +1 -2
  44. data/app/views/admin/fileupload/_image.html.slim +1 -2
  45. data/app/views/admin/locators/edit.html.slim +7 -6
  46. data/app/views/admin/manager/_map.html.slim +4 -0
  47. data/app/views/admin/manager/_show_table.html.slim +1 -1
  48. data/app/views/admin/manager/_stats.html.slim +4 -0
  49. data/app/views/admin/manager/_table.html.slim +7 -4
  50. data/app/views/admin/shared/_content_actions.html.slim +35 -30
  51. data/app/views/admin/shared/_flash.html.slim +5 -4
  52. data/app/views/admin/shared/_locale_tabs.html.slim +2 -2
  53. data/app/views/admin/shared/_main_menu.html.slim +1 -1
  54. data/app/views/admin/shared/_save_buttons.html.slim +10 -1
  55. data/app/views/admin/structures/_form.html.slim +1 -1
  56. data/app/views/admin/users/_form.html.slim +3 -3
  57. data/app/views/admin/users/_search_form.html.slim +1 -1
  58. data/app/views/layouts/admin/_footer.html.slim +0 -1
  59. data/app/views/layouts/admin/_navigation.html.slim +1 -1
  60. data/app/views/layouts/admin/application.html.slim +2 -2
  61. data/config/locales/de.yml +1 -2
  62. data/config/locales/en.yml +9 -15
  63. data/config/locales/it.yml +1 -0
  64. data/config/locales/ru.yml +0 -1
  65. data/config/locales/uk.yml +0 -1
  66. data/db/migrate/20130101000001_create_users.rb +1 -4
  67. data/db/migrate/20130101000003_create_assets.rb +1 -1
  68. data/db/migrate/20130101000004_create_headers.rb +5 -5
  69. data/db/migrate/20130101000005_create_static_pages.rb +2 -5
  70. data/db/migrate/20130101000006_create_structures.rb +1 -1
  71. data/db/migrate/20130101000007_base_translations.rb +43 -12
  72. data/db/migrate/20130101000008_create_admin_comments.rb +2 -7
  73. data/db/migrate/20130101000009_create_tracks.rb +4 -8
  74. data/lib/ab_admin/abstract_resource.rb +6 -5
  75. data/lib/ab_admin/carrierwave/base_uploader.rb +87 -75
  76. data/lib/ab_admin/carrierwave/glue.rb +0 -5
  77. data/lib/ab_admin/concerns/admin_addition.rb +15 -27
  78. data/lib/ab_admin/concerns/translations_macro.rb +97 -0
  79. data/lib/ab_admin/concerns/utilities.rb +2 -2
  80. data/lib/ab_admin/config/base.rb +27 -4
  81. data/lib/ab_admin/controllers/callbacks.rb +3 -26
  82. data/lib/ab_admin/core_ext/array.rb +1 -50
  83. data/lib/ab_admin/core_ext/hash.rb +2 -31
  84. data/lib/ab_admin/core_ext/other.rb +0 -6
  85. data/lib/ab_admin/core_ext/string.rb +1 -86
  86. data/lib/ab_admin/devise.rb +7 -0
  87. data/lib/ab_admin/engine.rb +2 -1
  88. data/lib/ab_admin/hooks/ckeditor_lazy.rb +13 -0
  89. data/lib/ab_admin/hooks/will_paginate_id_prefetch.rb +8 -6
  90. data/lib/ab_admin/hooks/will_paginate_no_uri.rb +1 -1
  91. data/lib/ab_admin/i18n_tools/google_translate.rb +3 -1
  92. data/lib/ab_admin/i18n_tools/model_translator.rb +1 -1
  93. data/lib/ab_admin/menu/base_group.rb +0 -1
  94. data/lib/ab_admin/menu/group.rb +2 -4
  95. data/lib/ab_admin/menu/item.rb +4 -8
  96. data/lib/ab_admin/models/asset.rb +7 -10
  97. data/lib/ab_admin/models/header.rb +2 -2
  98. data/lib/ab_admin/models/locator.rb +29 -3
  99. data/lib/ab_admin/models/settings.rb +2 -2
  100. data/lib/ab_admin/models/structure.rb +3 -3
  101. data/lib/ab_admin/models/track.rb +15 -3
  102. data/lib/ab_admin/models/user.rb +12 -48
  103. data/lib/ab_admin/utils/csv_document.rb +8 -6
  104. data/lib/ab_admin/utils/eval_helpers.rb +0 -13
  105. data/lib/ab_admin/utils/logger.rb +12 -2
  106. data/lib/ab_admin/utils/mysql.rb +2 -3
  107. data/lib/ab_admin/utils/xls_document.rb +18 -18
  108. data/lib/ab_admin/utils.rb +0 -5
  109. data/lib/ab_admin/version.rb +1 -1
  110. data/lib/ab_admin/views/admin_helpers.rb +43 -28
  111. data/lib/ab_admin/views/admin_navigation_helpers.rb +18 -16
  112. data/lib/ab_admin/views/form_builder.rb +7 -5
  113. data/lib/ab_admin/views/helpers.rb +0 -9
  114. data/lib/ab_admin/views/inputs/ckeditor_input.rb +1 -5
  115. data/lib/ab_admin/views/manager_helpers.rb +15 -6
  116. data/lib/ab_admin/views/search_form_builder.rb +13 -13
  117. data/lib/ab_admin/views/will_paginate_bootstrap_renderer.rb +60 -0
  118. data/lib/ab_admin.rb +44 -32
  119. data/lib/generators/ab_admin/glob/glob_generator.rb +4 -5
  120. data/lib/generators/ab_admin/glob/templates/migration.erb +10 -7
  121. data/lib/generators/ab_admin/install/templates/config/ab_admin.rb.erb +1 -1
  122. data/lib/generators/ab_admin/install/templates/models/user.rb +1 -13
  123. data/lib/generators/ab_admin/install/templates/spec/spec_helper.rb +0 -1
  124. data/lib/generators/ab_admin/install/templates/spec/support/database_cleaner.rb +8 -11
  125. data/lib/generators/ab_admin/install/templates/uploaders/attachment_file_uploader.rb +1 -1
  126. data/lib/generators/ab_admin/install/templates/uploaders/avatar_uploader.rb +1 -1
  127. data/lib/generators/ab_admin/install/templates/uploaders/picture_uploader.rb +16 -3
  128. data/lib/generators/ab_admin/model/model_generator.rb +3 -4
  129. data/lib/generators/ab_admin/model/templates/resource.erb +5 -2
  130. data/lib/generators/ab_admin/resource/resource_generator.rb +0 -4
  131. data/lib/generators/ab_admin/resource/templates/controller.erb +2 -9
  132. data/lib/tasks/assets.rake +5 -5
  133. metadata +45 -85
  134. data/app/assets/images/admin/Jcrop.gif +0 -0
  135. data/app/assets/images/admin/flags/de.png +0 -0
  136. data/app/assets/images/admin/flags/en.png +0 -0
  137. data/app/assets/images/admin/flags/es.png +0 -0
  138. data/app/assets/images/admin/flags/fr.png +0 -0
  139. data/app/assets/images/admin/flags/it.png +0 -0
  140. data/app/assets/images/admin/flags/ja.png +0 -0
  141. data/app/assets/images/admin/flags/pl.png +0 -0
  142. data/app/assets/images/admin/flags/ru.png +0 -0
  143. data/app/assets/images/admin/flags/uk.png +0 -0
  144. data/app/assets/javascripts/ab_admin/components/croppable_image.js.coffee +0 -33
  145. data/app/assets/stylesheets/ab_admin/components/_columns_hider.scss +0 -5
  146. data/app/assets/stylesheets/ab_admin/components/_perms.scss +0 -39
  147. data/app/views/admin/shared/_columns_hider.html.slim +0 -9
  148. data/lib/ab_admin/hooks/globalize_locale_suffix_accessors.rb +0 -25
  149. data/lib/ab_admin/hooks/globalize_valid_locale.rb +0 -9
  150. data/lib/generators/ab_admin/ckeditor_assets/ckeditor_assets_generator.rb +0 -19
  151. data/lib/generators/template.rb +0 -96
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 43ed57227cecaa2f87430c9c4d91b091a481d63a7c114f11815475d035d7c0fa
4
- data.tar.gz: 3c468bae1894700743f5c78d9c833c57ece9638179174294e6a1ba90dd2cae54
3
+ metadata.gz: 6e4cff3af876fcd7ea0ee9a0a340b10ceb31d22c2a3728910692c0048c8f0e6c
4
+ data.tar.gz: 7c66e65f59261910436f0c4d18cf069e1f94e42cec845c39bb5d7ee07de434e5
5
5
  SHA512:
6
- metadata.gz: f172fa06ba23701ba8d0849267642bbe51485951aed25d1f686a342b7b770d5983b0387886cc544c83269e653d026e31cae9fb3b2eacd40c2c5e402b2c032b3d
7
- data.tar.gz: c90de19869723ace5d640bfc0b426cbfa7982f1555312dee5b990cf8a523bb09d4468c7fb1fd3297d5181987a892897638e8411690a06474539de0bb42e687fc
6
+ metadata.gz: 0c5926ca259601ec0369db9588748dc3c6b34fca63816ea9ef2adda4a238f45eb26f2f215d2337a38fe7a5061e870e0bdae466dcd46b5f51c7b0f2118e3e9084
7
+ data.tar.gz: 8ecd6b3078af74eee5d0135eb8fe1764d27f2dbd623c6e0f663d5e9b8e4e808323e968e6c87955e4f4f0c9ad7431743307b364a22a870fda1874b5a3fd9942e3
data/MIT-LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright 2013 YOURNAME
1
+ Copyright 2013 Alex Leshchenko
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -4,13 +4,19 @@ Simple and real-life tested Rails::Engine admin interface based on slim, bootstr
4
4
 
5
5
  ## Installation
6
6
 
7
- To build a new Rails application with AbAdmin, run:
7
+ Add this line to your application's Gemfile:
8
8
 
9
- ```bash
10
- rails new [my_app_name] -m https://raw.githubusercontent.com/leschenko/ab_admin/master/lib/generators/template.rb
11
- ```
9
+ gem 'simple_slug'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install simple_slug
12
18
 
13
- Or add gems from template [list of gems](https://raw.githubusercontent.com/leschenko/ab_admin/master/lib/generators/template.rb) to an existing application and run generators:
19
+ Run generators
14
20
 
15
21
  ```bash
16
22
  rails generate devise:install
@@ -5,13 +5,6 @@
5
5
  #= require fileupload/jquery.fileupload-validate
6
6
  #= require ab_admin/components/base_assets
7
7
 
8
- #q= require ab_admin/jquery.Jcrop
9
- #q= require ab_admin/components/croppable_image
10
-
11
- #q=require fileupload/jquery.fileupload-image
12
- #q=require fileupload/jquery.fileupload-audio
13
- #q=require fileupload/jquery.fileupload-video
14
-
15
8
  class window.AdminAssets extends BaseAssets
16
9
  showErrors: (e, data) ->
17
10
  errors = _.map(data.files,(file) ->
@@ -20,29 +13,11 @@ class window.AdminAssets extends BaseAssets
20
13
 
21
14
  initDisabled: ->
22
15
  super
23
- @initFancybox() if $.fn.fancybox
24
16
 
25
17
  initHandlers: ->
26
18
  super
27
- @initFancybox() if $.fn.fancybox
28
- @initCrop() if @options.crop
29
19
  @initEditMeta() if @options.edit_meta
30
20
 
31
- initFancybox: =>
32
- @list.find("a.fancybox")
33
- .click (e) ->
34
- e.preventDefault()
35
- .fancybox
36
- afterShow: =>
37
- @crop?.fancyboxHandler()
38
- helpers:
39
- overlay:
40
- locked: false
41
-
42
- initCrop: ->
43
- return unless $.fn.Jcrop
44
- @crop = new CroppableImage(@el, @options.crop)
45
-
46
21
  initEditMeta: ->
47
22
  @el.find('.fileupload-edit-button').show().click =>
48
23
  ids = @el.find('.fileupload-list .fileupload-asset').map(-> $(this).data('id')).get()
@@ -20,8 +20,7 @@ window.translate = (text, element, from, to) ->
20
20
  window.google_t = (text, element, from, to) ->
21
21
  return '' unless $.trim(text)
22
22
  opts = {q: text, from: from, to: to}
23
- $.post '/admin/translate', opts, ((data) =>
24
- element.inputVal $.unescape(data.text).replace(/%\s{/g, ' %{')), 'json'
23
+ $.post '/admin/translate', opts, ((data) => element.inputVal $.unescape(data.text)), 'json'
25
24
 
26
25
  # get value of text field or CKEDITOR area
27
26
  $.fn.inputVal = (v = null) ->
@@ -45,13 +44,12 @@ $.fn.inputVal = (v = null) ->
45
44
  $el.val()
46
45
 
47
46
  class window.GoogleLocaleTabs
48
- @locales = ['ru', 'en', 'it']
49
47
  constructor: ->
50
- @locales = GoogleLocaleTabs.locales
48
+ @locales = $('.locale_tabs:first .nav-tabs a').map(-> $(this).attr('href').replace('#', '') ).get()
51
49
  @limit = 10000
52
50
  html = '<div class="t_locales">'
53
51
  for l in @locales
54
- html += "<div class='t_locale t_locale_#{l}'></div>"
52
+ html += "<div class='t_locale t_locale_#{l}'>#{localeToFlag(l)}</div>"
55
53
  html += '</div>'
56
54
  @html = $(html)
57
55
  $('.locale_tabs:not(".no_translate") .tab-pane').prepend(@html)
@@ -6,7 +6,10 @@ EditableForm.prototype.saveWithUrlHook = (value) ->
6
6
  originalUrl.call(@options.scope, params)
7
7
  else
8
8
  params[@options.model] ||= {}
9
- params[@options.model][params.name] = params.value
9
+ if _.isString(params.value) && params.value.match(/@\d+/)
10
+ params[@options.model][params.name] = params.value.replace('@', '')
11
+ else
12
+ params[@options.model][params.name] = params.value
10
13
  params._method = 'PATCH'
11
14
  ajax_opts =
12
15
  url: originalUrl
@@ -26,30 +29,35 @@ EditableForm.prototype.saveWithUrlHook = (value) ->
26
29
  EditableForm.prototype.saveWithoutUrlHook = EditableForm.prototype.save
27
30
  EditableForm.prototype.save = EditableForm.prototype.saveWithUrlHook
28
31
 
29
- $(document).on 'admin:init', (e) ->
30
- $('.editable').editable
31
- onblur: 'submit'
32
- placement: 'bottom'
33
- emptytext: I18n.lookup('admin.js.empty') || 'Empty'
34
- error: (response, newValue) ->
35
- log response
36
- if response.status == 422
37
- flash JSON.parse(response.responseText).errors.join(', ')
38
- else
39
- response.responseText
40
- success: (response) ->
41
- if response && $(this).data().options?.accept == 'script'
42
- $.globalEval(response.responseText)
43
- datetimepicker:
44
- format: "dd.mm.yyyy hh:ii"
45
- autoclose: true
46
- todayBtn: true
47
- language: I18n.locale
48
- ajaxOptions:
49
- xhrFields:
50
- withCredentials: true
51
- headers:
52
- Accept: 'application/json'
32
+ window.initInPlaceEditable = ->
33
+ $('.editable').each ->
34
+ $el = $(this)
35
+ $el.editable
36
+ onblur: 'submit'
37
+ placement: 'bottom'
38
+ emptytext: $el.attr('placeholder') || I18n.t('admin.js.empty') || 'Empty'
39
+ error: (response) ->
40
+ if response.status == 422
41
+ Object.entries(response.responseJSON.errors).map((i) -> i.join(': ')).join(', ')
42
+ else
43
+ response.responseText
44
+ success: (response) ->
45
+ if response && $(this).data().options?.accept == 'script'
46
+ $.globalEval(response.responseText)
47
+ datetimepicker:
48
+ format: "dd.mm.yyyy hh:ii"
49
+ autoclose: true
50
+ todayBtn: true
51
+ language: I18n.locale
52
+ ajaxOptions:
53
+ xhrFields:
54
+ withCredentials: true
55
+ headers:
56
+ Accept: 'application/json'
57
+
58
+
59
+ $(document).on 'admin:init', initInPlaceEditable
60
+
53
61
  $ ->
54
62
  _.each $('.editable'), (el) ->
55
63
  $el = $(el)
@@ -1,6 +1,6 @@
1
1
  $ ->
2
2
  if $('#list')[0]
3
- input_name = 'by_ids'
3
+ input_name = 'q[id_in]'
4
4
  $(document).on 'click', '#list input.toggle', ->
5
5
  checked = $(this).is(":checked")
6
6
  $("#list [name='#{input_name}[]']").attr "checked", checked
@@ -1,18 +1,36 @@
1
1
  class window.ColumnsHider
2
2
  constructor: ->
3
3
  @store_key = 'cols'
4
- @data_el = $('#columns_hider_data')
5
4
  @column_names = @columnNames()
6
5
  @collection_name = window.location.href.match(/admin\/(\w+)/)?[1]
7
6
  return unless @collection_name
8
7
  @data = @getData()
9
- @initDefaults()
10
8
  @initButtons()
11
9
  @initHandlers()
12
10
  @refreshColumns()
13
11
 
14
- initDefaults: ->
15
- @data
12
+ initHandlers: ->
13
+ $(document).on 'pjax:end admin:list_init', =>
14
+ @initButtons()
15
+ @refreshColumns()
16
+
17
+ $(document).on 'click', '#columns_hider_wrap label', (e) =>
18
+ e.preventDefault()
19
+ e.stopPropagation()
20
+ $input = $(e.currentTarget).find('input')
21
+ $input.prop('checked', !$input.is(':checked'))
22
+ colIds = _.map $('#columns_hider_wrap .dropdown-menu input:not(:checked)'), (el) -> parseInt($(el).val())
23
+ @data[@collection_name] = colIds
24
+ @refreshColumns()
25
+ @setData()
26
+
27
+ initButtons: ->
28
+ $menu = $('#columns_hider_wrap .dropdown-menu')
29
+ $menu.empty()
30
+ for col, i in @column_names
31
+ isActive = !_.include(@data[@collection_name], i)
32
+ html = "<label class='checkbox'><input type='checkbox' #{'checked' if isActive} value='#{i}'>#{col.name}</label>"
33
+ $menu.append(html)
16
34
 
17
35
  setData: ->
18
36
  res = {}
@@ -33,27 +51,10 @@ class window.ColumnsHider
33
51
  data[@collection_name].push(i) if col.disabled
34
52
  data
35
53
 
36
- initButtons: ->
37
- @data_el.empty()
38
- for col, i in @column_names
39
- css_class = if _.include(@data[@collection_name], i) then 'active' else ''
40
- html = "<button class='btn btn-primary #{css_class}' data-val='#{i}'>#{col.name}</button>"
41
- @data_el.append(html)
42
-
43
54
  columnNames: ->
44
55
  _.map $('#list > thead > tr > th'), (el) ->
45
56
  $el = $(el)
46
- {disabled: $el.hasClass('hide_cell'), name: $.trim($el.text().replace(/[▼▲]/g, ''))}
47
-
48
- initHandlers: ->
49
- $('#submit_columns_hider').click =>
50
- col_ids = _.map $('#columns_hider_data .active'), (el) -> $(el).data('val')
51
- @data[@collection_name] = col_ids
52
- $('#columns_hider').modal('hide')
53
- @refreshColumns()
54
- @setData()
55
- $(document).on 'pjax:end admin:list_init', =>
56
- @refreshColumns()
57
+ {disabled: $el.hasClass('hide_cell'), name: $.trim($el.text().replace(/[▼▲]/g, '')) || ' - '}
57
58
 
58
59
  refreshColumns: ->
59
60
  if @data[@collection_name]
@@ -69,4 +70,4 @@ class window.ColumnsHider
69
70
  $("#list > thead > tr > th, #list > tbody > tr > td").show()
70
71
 
71
72
  $ ->
72
- window.columns_hider = new ColumnsHider()
73
+ window.columnsHider = new ColumnsHider()
@@ -23,14 +23,13 @@ $ ->
23
23
  e.preventDefault()
24
24
  $(this).closest('tr').remove()
25
25
 
26
- $(document).on 'admin:init', ->
27
26
  $form = $('form.simple_form')
28
27
  window.resource_id = $form.data('id')
29
28
  $form.trigger('admin:form_init')
30
29
 
31
30
  $(document).on 'admin:list_init', ->
32
31
  initPopover()
33
- initTooltip()
32
+ initInPlaceEditable()
34
33
 
35
34
  $(document).on 'admin:form_init', 'form', ->
36
35
  initEditor()
@@ -58,3 +57,9 @@ $ ->
58
57
  $('body').css('background-color', "##{window.fv.bg_color.replace(/^#/, '')}")
59
58
 
60
59
  initHotkeys() if window.fv?.hotkeys
60
+
61
+ clipboard = new Clipboard('.js-copy')
62
+ clipboard.on 'success', (e) ->
63
+ $el = $(e.trigger)
64
+ $el.addClass('js-copy-popup')
65
+ setTimeout((-> $el.removeClass('js-copy-popup')), 1200)
@@ -4,12 +4,6 @@ $ ->
4
4
  $el = $(this)
5
5
  $el.next('input').attr('name', "q[#{$el.val()}]")
6
6
 
7
- # $("#search_form").submit ->
8
- # $("#search_form [name$='_at_gteq]']").val (i, v) ->
9
- # v + " 00:00" if v
10
- # $("#search_form [name$='_at_lteq]']").val (i, v) ->
11
- # v + " 23:59" if v
12
-
13
- $('#search_cancel').click (e) ->
7
+ $('.js-search-cancel').click (e) ->
14
8
  e.preventDefault()
15
9
  window.location.search = ""
@@ -22,16 +22,12 @@ window.initAcFileds = ->
22
22
  maxHeight: 400
23
23
  width: 220
24
24
 
25
- window.initTooltip = ->
26
- $('.js-tooltip').tooltip
27
- animation: false
28
-
29
25
  window.initEditor = (baseSelector='form') ->
30
26
  return if fv.test
31
27
  $("#{baseSelector} .do_wysihtml5").each ->
32
28
  $el = $(this)
33
29
  return if $el.hasClass('wysihtml5_done')
34
- editor = $el.wysihtml5({html: true, locale: 'ru'}).data('wysihtml5').editor
30
+ editor = $el.wysihtml5({html: true, locale: 'en'}).data('wysihtml5').editor
35
31
  resizeIframe = -> editor.composer.iframe.style.height = editor.composer.element.scrollHeight + "px"
36
32
  editor.on "load", ->
37
33
  if editor.composer
@@ -50,7 +46,7 @@ window.inputBtnClose = ->
50
46
  $(this).closest('.close-wrap').remove()
51
47
 
52
48
  window.flash = (message, type='notice') ->
53
- $("<div class='alert alert-#{type}'><a class='close' data-dismiss='alert'>×</a>#{message}</div>").insertBefore $('#container')
49
+ $("<div class='alert alert-#{type}'><a class='close' data-dismiss='alert'>×</a>#{message}</div>").prependTo $('#flash')
54
50
 
55
51
  window.focusInput = (scope=null) ->
56
52
  scope ||= $('form.simple_form:first')
@@ -89,4 +85,24 @@ window.initNestedFields = (opts={}) ->
89
85
  window.initFancySelect() unless opts.skip_fancy
90
86
  window.initPickers() unless opts.skip_pickers
91
87
  window.initEditor() unless opts.skip_editor
92
- opts.callback.call(e) if opts.callback
88
+ opts.callback.call(e) if opts.callback
89
+
90
+ window.initCkeditor = (dom_id, options={}) ->
91
+ if window.CKEDITOR
92
+ CKEDITOR.replace(dom_id, options) unless CKEDITOR.instances[dom_id]
93
+ else
94
+ $.getScript $("##{dom_id}").data('cdnUrl'), ->
95
+ CKEDITOR.replaceClass = null;
96
+ CKEDITOR.replace(dom_id, options) unless CKEDITOR.instances[dom_id]
97
+
98
+ window.lazyInitCkeditor = (dom_id, options={}) ->
99
+ $el = $("##{dom_id}")
100
+ $form = $el.closest('form')
101
+ height = options.height || 200
102
+ height += if options.toolbar == 'mini' then 34 else 67
103
+ $el.height(height)
104
+ callback = (intersectionRatio) ->
105
+ initCkeditor(dom_id, options) if intersectionRatio
106
+ window.ckeditorVisibilityObserver = new IntersectionObserver (entries, observer) =>
107
+ entries.forEach(((entry) => callback(entry.intersectionRatio)), {root: $form[0]})
108
+ window.ckeditorVisibilityObserver.observe document.getElementById(dom_id)
@@ -1,7 +1,7 @@
1
1
  window.fv ||= {}
2
2
  window.I18n ||= {}
3
- I18n.locale = window.fv.locale || 'ru'
4
- window.locale_path = if I18n.locale == 'ru' then '' else "/#{I18n.locale}"
3
+ I18n.locale = window.fv.locale || 'en'
4
+ window.locale_path = if I18n.locale == 'en' then '' else "/#{I18n.locale}"
5
5
 
6
6
  _.sum = (obj) ->
7
7
  return 0 if not $.isArray(obj) or obj.length is 0
@@ -168,3 +168,17 @@ window.storeData = (key, data) ->
168
168
 
169
169
  window.fetchData = (key) ->
170
170
  window.localStorage?[key] or $.cookie(key)
171
+
172
+ window.localeToFlag = (l) ->
173
+ l = l.toUpperCase()
174
+ l = {'JA': 'JP', 'EN': 'GB', 'UK': 'UA'}[l] || l
175
+ chars = {"A":"🇦","B":"🇧","C":"🇨","D":"🇩","E":"🇪","F":"🇫","G":"🇬","H":"🇭","I":"🇮","J":"🇯","K":"🇰","L":"🇱","M":"🇲","N":"🇳","O":"🇴","P":"🇵","Q":"🇶","R":"🇷","S":"🇸","T":"🇹","U":"🇺","V":"🇻","W":"🇼","X":"🇽","Y":"🇾","Z":"🇿"}
176
+ l.replace /[A-Z]/g, (m) -> chars[m]
177
+
178
+ window.I18n ||= {}
179
+ window.I18n.locale = 'en'
180
+ window.I18n.translations ||= {}
181
+ I18n.t = (key) ->
182
+ keys = key.split('.')
183
+ keys.unshift(I18n.locale)
184
+ _.get(I18n.translations, keys)
@@ -7,6 +7,7 @@ $ ->
7
7
  viewSelect: 'month'
8
8
  minView: 'day'
9
9
  language: I18n.locale
10
+ weekStart: 1
10
11
 
11
12
  search_form_options = _.defaults({pickerPosition: "bottom-left datetimepicker-bottom-left-custom"}, base_options)
12
13
  search_form_options_gt = _.defaults({initialDate: new Date(new Date().setHours(0,0,0,0))}, search_form_options)
@@ -1,4 +1,3 @@
1
- //= require i18n
2
1
  //= require i18n/translations
3
2
  //= require jquery.min
4
3
  //= require jquery_ujs
@@ -7,7 +6,7 @@
7
6
  //= require jquery.cookie
8
7
  //= require jquery.pjax
9
8
  //= require jquery.hotkeys
10
- //= require bootstrap
9
+ //= require bootstrap_2_3_2/bootstrap
11
10
  //= require ab_admin/jquery_nested_form
12
11
  //= require ab_admin/bootstrap-tab-multi
13
12
  //= require ab_admin/bootstrap-datetimepicker/bootstrap-datetimepicker
@@ -17,10 +16,10 @@
17
16
  //= require moment.min
18
17
  //= require ab_admin/bootstrap-editable
19
18
  //= require ab_admin/bootbox.min
20
- //= require select2
21
- //= require fancybox
19
+ //= require select2_3_5_2/select2
22
20
  //= require ab_admin/jquery-ui-1.10.3.custom.min
23
21
  //= require jquery.ui.nestedSortable
22
+ //= require clipboard.min
24
23
  //= require ab_admin/components/sortable_tree
25
24
  //= require ab_admin/components/google_translate
26
25
  //= require ab_admin/components/locator
@@ -1,8 +1,8 @@
1
1
  $baseFontSize: 13px !default;
2
2
  $baseLineHeight: 18px !default;
3
3
 
4
- @import "bootstrap";
5
- @import "bootstrap-responsive";
4
+ @import "bootstrap_2_3_2/bootstrap";
5
+ @import "bootstrap_2_3_2/bootstrap-responsive";
6
6
  @import "ab_admin/components/base";
7
7
  @import "ab_admin/components/navigation";
8
8
  @import "ab_admin/components/table_view";
@@ -13,11 +13,10 @@ $baseLineHeight: 18px !default;
13
13
  @import "ab_admin/components/colored_tabs";
14
14
  @import "ab_admin/components/locale_tabs";
15
15
  @import "ab_admin/components/translations";
16
- @import "ab_admin/components/perms";
17
16
  @import "ab_admin/components/admin_comments";
18
17
  @import "ab_admin/components/geo_input";
19
18
  @import "ab_admin/components/view_layout";
20
- @import "ab_admin/components/columns_hider";
19
+ @import "ab_admin/components/tooltip";
21
20
 
22
21
  img {
23
22
  max-width: none;
@@ -89,6 +88,15 @@ ul.nav li.dropdown:hover ul.dropdown-menu {
89
88
  width: auto;
90
89
  }
91
90
 
91
+ .label a {
92
+ color: white;
93
+ font-size: 12px;
94
+ font-weight: 500;
95
+ text-decoration: none;
96
+ border: none;
97
+ line-height: 1.4;
98
+ }
99
+
92
100
  .label-primary, .badge-primary {
93
101
  background-color: #05C;
94
102
  }
@@ -130,6 +138,7 @@ label.input_set, label.label-large, .label.label-large {
130
138
  font-size: 15px;
131
139
  padding: 4px 10px 6px;
132
140
  display: block;
141
+ text-align: center;
133
142
  }
134
143
 
135
144
  label.label-med {
@@ -145,42 +154,79 @@ label.control-label.label-reset {
145
154
  text-align: left;
146
155
  }
147
156
 
148
- .table tbody {
149
- tr.success > td, &.success > tr > td {
150
- background-color: #dff0d8;
157
+ .js-copy-popup {
158
+ position: relative;
159
+ &:before {
160
+ content: none;
151
161
  }
152
-
153
- tr.error > td, &.error > tr > td {
154
- background-color: #f2dede;
162
+ &:after {
163
+ background-color: transparent;
164
+ padding: 0;
165
+ animation: text-pop-up-top 1s cubic-bezier(0.250, 0.460, 0.450, 0.940) both;
166
+ content: 'Copied!';
167
+ position: absolute;
168
+ color: #468847;
169
+ font-size: 14px;
170
+ left: -5px;
171
+ top: -5px;
155
172
  }
173
+ }
156
174
 
157
- tr.warning > td, &.warning > tr > td {
158
- background-color: #fcf8e3;
175
+ .pulse.badge-important {
176
+ cursor: pointer;
177
+ box-shadow: 0 0 0 rgba(185, 74, 72, 0.7);
178
+ animation: pulse-important 1s infinite;
179
+ }
180
+ .pulse:hover {
181
+ animation: none;
182
+ }
183
+ @keyframes pulse-important {
184
+ 0% {
185
+ box-shadow: 0 0 0 0 rgba(185, 74, 72, 0.7);
159
186
  }
160
-
161
- tr.muted > td, &.muted > tr > td {
162
- background-color: #ededed;
187
+ 70% {
188
+ box-shadow: 0 0 0 10px rgba(185, 74, 72, 0);
163
189
  }
164
-
165
- tr.info > td, &.info > tr > td {
166
- background-color: #d9edf7;
190
+ 100% {
191
+ box-shadow: 0 0 0 0 rgba(185, 74, 72, 0);
167
192
  }
168
193
  }
169
194
 
170
- // utility
171
- .over {
172
- overflow: visible !important;
195
+ @keyframes text-pop-up-top {
196
+ 0% {
197
+ transform: translateY(0);
198
+ transform-origin: 50% 50%;
199
+ }
200
+ 95% {
201
+ opacity: 0.9;
202
+ }
203
+ 100% {
204
+ transform: translateY(-30px);
205
+ transform-origin: 50% 50%;
206
+ opacity: 0;
207
+ }
173
208
  }
209
+
174
210
  .clear {
175
211
  clear: both;
176
212
  }
177
- .inline_block {
178
- display: inline-block;
179
- }
180
- .white-space-nowrap {
213
+
214
+ .white-space-nowrap, .wsn {
181
215
  white-space: nowrap;
182
216
  }
183
217
 
218
+ .text-pink {
219
+ color: #F52887;
220
+ }
221
+
222
+ .text-violet {
223
+ color: #BA55D3;
224
+ }
225
+
226
+ .text-turquoise {
227
+ color: #07d3d3;
228
+ }
229
+
184
230
  @media (max-width: 767px) {
185
231
  body, .container-fluid {
186
232
  padding: 0;
@@ -21,7 +21,10 @@ html, body {
21
21
  margin: 0 0 20px -253px;
22
22
  float: left;
23
23
  &.well {
24
- width: 220px;
24
+ width: 240px;
25
+ }
26
+ &.well-tiny {
27
+ padding: 5px;
25
28
  }
26
29
  }
27
30
  .content_with_sidebar {
@@ -39,6 +42,23 @@ html, body {
39
42
  }
40
43
  }
41
44
 
45
+ #flash {
46
+ position: fixed;
47
+ bottom: 0;
48
+ right: 0;
49
+ padding: 15px;
50
+ opacity: 0.9;
51
+ min-width: 25%;
52
+ max-width: 400px;
53
+ z-index: 5;
54
+ .alert {
55
+ margin-bottom: 5px;
56
+ &:last-child {
57
+ margin-bottom: 0;
58
+ }
59
+ }
60
+ }
61
+
42
62
  #push {
43
63
  height: 40px;
44
64
  }
@@ -25,7 +25,7 @@
25
25
  border-top: none;
26
26
  padding: 10px;
27
27
  }
28
- margin: 20px 0;
28
+ margin: 10px 0;
29
29
  }
30
30
 
31
31
  .colored_tabs {