tenon 1.0.57 → 1.0.59

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2fa377e208a93cb3c4055726e4426d6c19071b95
4
- data.tar.gz: 4a579c1c5d84967166901b55a7f4b99f64e6c7a2
3
+ metadata.gz: 5e1552d054d34f083ccfc50373dcabadf752fd73
4
+ data.tar.gz: c4ceadb0f3c8f00d2112dda9f1c8ff621d1fc914
5
5
  SHA512:
6
- metadata.gz: e40afd867429f2e8022e558b10817730a56371cbb28fa678a86e07bca8c47f7ae474cabdbbbad876bd7868fd8f38a7637ce4c03baa3bc35164b1860bb9cfa9d7
7
- data.tar.gz: 18ad631a0e525d60ee8397df3eacf4b5e9c936d85de9d59879a0f69b75d97332b1a49c1d8ce18eac0c9e0215af079df1495f3f86bda7b00ba77ae0492512fc03
6
+ metadata.gz: ae9c6153301dca657825b2e6dff6442cb481258660d95fb152cfaa79261224db2faf9366dab2d77bd62588d190c9bb5f7653572d9ba8fa3f8c4bf85a2be446f0
7
+ data.tar.gz: 7f1b2dfaf00b234a737616cee00781664c7a79e346f0849bf564a0503a8c847771420baa21a0e56329cf8eca80eaa2d61f0856f69b89154d9bdb4c01d4ac044e
@@ -0,0 +1,11 @@
1
+ class Tenon.features.CocoonHooks
2
+ constructor: ->
3
+ $(document).on('cocoon:after-insert', @afterInsert)
4
+
5
+ afterInsert: (e, insertedItem) =>
6
+ @$insertedItem = $(insertedItem)
7
+ @_checkTenonContent()
8
+
9
+ _checkTenonContent: ->
10
+ if @$insertedItem.find('.tn-tc')
11
+ new Tenon.features.tenonContent.Base
@@ -23,10 +23,15 @@ class Tenon.features.ModalWindows
23
23
  beforeSend: null
24
24
 
25
25
  _launchWithTarget: (e) =>
26
- if @$link.data('modal-clone')
27
- $el = $(@$link.data('modal-target') + ':first').clone()
26
+ if @$link.data('modal-closest')
27
+ $parentNode = @$link.closest(@$link.data('modal-closest'))
28
+ $el = $parentNode.find(@$link.data('modal-target'))
29
+ else if @$link.data('modal-parent')
30
+ $el = $(@$link.data('modal-parent')).find(@$link.data('modal-target'))
28
31
  else
29
32
  $el = $(@$link.data('modal-target'))
33
+ $el = $el.filter(':first').clone() if @$link.data('modal-clone')
34
+
30
35
  @_openInModal($el)
31
36
 
32
37
  _openInModal: (el) =>
@@ -1,9 +1,15 @@
1
1
  class Tenon.features.SortableNestedFields
2
2
  constructor: ->
3
3
  $lists = $('.nested-field-list.sortable')
4
- $lists
5
- .sortable(update: @_doUpdate)
6
- .on('cocoon:after-insert', -> $(this).sortable('refresh'))
4
+ $.each $lists, (i, list) =>
5
+ $list = $(list)
6
+ $list
7
+ .sortable(
8
+ update: @_doUpdate
9
+ cancel: ':input,button,[contenteditable]'
10
+ handle: $list.data('sortable-handle')
11
+ )
12
+ .on('cocoon:after-insert', -> $(this).sortable('refresh'))
7
13
 
8
14
  _doUpdate: (event, ui) ->
9
15
  $list = $(ui.item).closest('ul')
@@ -3,7 +3,7 @@ class Tenon.features.tenonContent.Aesthetics
3
3
  @$wrap = @$container.closest('.tn-tc-wrap')
4
4
  @$container.imagesLoaded(@_applyAesthetics)
5
5
  $(window).on('resize', @_applyAesthetics)
6
- $('.tenon-content').on('cocoon:after-insert', @_applyAesthetics)
6
+ $(document).on('cocoon:after-insert', '.tenon-content', @_applyAesthetics)
7
7
  @$container.on('tenon.asset_attached', '.asset-field', @_applyAesthetics)
8
8
  @$container.on('tenon.content.column_resized', 'div', @_applyAesthetics)
9
9
  @$wrap.on('tenon.content.popped', @_applyAesthetics)
@@ -1,8 +1,8 @@
1
1
  class Tenon.features.tenonContent.BottombarToggler
2
2
  constructor: (@$container) ->
3
3
  @_toggleBottombars()
4
- $('.tenon-content').on('cocoon:after-insert', @_toggleBottombars)
5
- $('.tenon-content').on('cocoon:after-remove', @_toggleBottombars)
4
+ $(document).on('cocoon:after-insert', '.tenon-content', @_toggleBottombars)
5
+ $(document).on('cocoon:after-remove', '.tenon-content', @_toggleBottombars)
6
6
 
7
7
  _toggleBottombars: =>
8
8
  # Hide them all
@@ -1,7 +1,7 @@
1
1
  class Tenon.features.tenonContent.Editor
2
2
  constructor: ->
3
- $('.tenon-content').on('cocoon:after-insert', @_rowInserted)
4
- $('.tenon-content').on('cocoon:after-remove', @_rowRemoved)
3
+ $(document).on('cocoon:after-insert', '.tenon-content', @_rowInserted)
4
+ $(document).on('cocoon:after-remove', '.tenon-content', @_rowRemoved)
5
5
  $(document).on('input keypress paste change', '.editable-text', @_contentUpdated)
6
6
  for div in $('.tn-tc')
7
7
  @_updateButtons($(div))
@@ -12,16 +12,28 @@ class Tenon.features.tenonContent.Library
12
12
  _closeModal: => @$template.modal('hide')
13
13
 
14
14
  _setContext: =>
15
- if @$link.hasClass('above') || @$link.hasClass('below')
16
- @_setToInsertRelative(@$link)
15
+ if @$link.hasClass('initial-row')
16
+ @_setToInsertInitialRow()
17
+ else if @$link.hasClass('above') || @$link.hasClass('below')
18
+ @_setToInsertRelative()
17
19
  else
18
- @_setToInsertByData(@$link)
20
+ @_setToInsertByData()
19
21
 
20
- _setToInsertByData: (@$link) =>
21
- for data in ['association-insertion-node', 'association-insertion-method']
22
+ _setToInsertInitialRow: =>
23
+ node = @$link.closest('.tn-tc').find('.tenon-content')
24
+ $('.tenon-library a').data('association-insertion-node', node)
25
+ $('.tenon-library a').data('association-insertion-method', 'prepend')
26
+
27
+ _setToInsertByData: =>
28
+ datas = [
29
+ 'association-insertion-node',
30
+ 'association-insertion-method',
31
+ 'association-insertion-traversal'
32
+ ]
33
+ for data in datas
22
34
  $('.tenon-library a').data(data, @$link.data(data))
23
35
 
24
- _setToInsertRelative: (@$link) =>
36
+ _setToInsertRelative: =>
25
37
  method = if @$link.hasClass('below') then 'after' else 'before'
26
38
  $('.tenon-library a').data('association-insertion-node', @$link.closest('.tn-tc-row'))
27
39
  $('.tenon-library a').data('association-insertion-method', method)
@@ -35,6 +35,7 @@ var Tenon = {
35
35
  new Tenon.features.Flash();
36
36
  new Tenon.features.AssetCropping();
37
37
  new Tenon.features.AssetDetachment();
38
+ new Tenon.features.CocoonHooks();
38
39
  new Tenon.features.FocusFirstField();
39
40
  new Tenon.features.MainMenu();
40
41
  new Tenon.features.Pagination();
@@ -8,6 +8,7 @@ module Tenon
8
8
  end
9
9
 
10
10
  def index
11
+ authorize!(:index, klass)
11
12
  params[:page] = 1 if params[:page].to_i == 0
12
13
  respond_to do |format|
13
14
  format.html
@@ -15,7 +15,7 @@
15
15
  = fa_icon('eye')
16
16
  %span Edit in Preview Mode
17
17
 
18
- = link_to '#', class: 'tn-tc-add-content btn btn-primary', 'data-modal-target' => ".#{field} .tenon-library", 'data-modal-clone' => 'true', 'data-modal-title' => 'Add Content', 'data-association-insertion-node' => "##{field}-tenon-content", 'data-association-insertion-method' => 'prepend', 'data-modal-handler' => 'Tenon.features.tenonContent.Library' do
18
+ = link_to '#', class: 'tn-tc-add-content btn btn-primary initial-row', data: { modal_target: ".tenon-library", modal_closest: '.tn-tc', modal_clone: 'true', modal_title: 'Add Content', modal_handler: 'Tenon.features.tenonContent.Library' } do
19
19
  = fa_icon('plus-circle')
20
20
  %span Add Content
21
21
 
@@ -26,7 +26,7 @@
26
26
  Use preview mode to see how your content will look on different devices. You can still make edits when you're in preview mode, but the toolbars are hidden to give you a better picture of how your content will be laid out.
27
27
  = tenon_content_sizes
28
28
  = link_to 'Done', '#', class: 'tn-tc-pop-out-close btn btn-comp'
29
- .tenon-content{id: "#{field}-tenon-content"}
29
+ .tenon-content
30
30
  = f.fields_for "#{field}_tenon_content_rows" do |row|
31
31
  - if row.object
32
32
  = render "tenon/tenon_content/row", f: row, row_partial: row.object.decorate.form_partial, field: field, title: row.object.row_type.titleize
@@ -4,7 +4,7 @@
4
4
  .actions
5
5
  %i.fa.fa-arrows.drag-anchor
6
6
 
7
- = link_to '#', class: 'tn-tc-open-library above', 'data-modal-target' => ".#{field} .tenon-library", 'data-modal-title' => "Insert Content", 'data-modal-handler' => 'Tenon.features.tenonContent.Library', 'data-modal-clone' => 'true', 'data-tooltip' => '', title: 'Insert Content' do
7
+ = link_to '#', class: 'tn-tc-open-library above', data: { modal_target: ".tenon-library", modal_closest: '.tn-tc', modal_title: "Insert Content", modal_handler: 'Tenon.features.tenonContent.Library', modal_clone: 'true', tooltip: '' }, title: 'Insert Content' do
8
8
  = fa_icon('plus-circle')
9
9
 
10
10
  = link_to_remove_association(fa_icon('trash-o'), f, {'data-confirm' => 'Are you sure?', 'data-wrapper-class' => 'tn-tc-row'})
@@ -15,5 +15,5 @@
15
15
 
16
16
  .tn-tc-bottombar
17
17
  .actions
18
- = link_to '#', class: 'tn-tc-open-library below', 'data-modal-target' => ".#{field} .tenon-library", 'data-modal-title' => "Insert Content", 'data-modal-handler' => 'Tenon.features.tenonContent.Library', 'data-modal-clone' => 'true', 'data-tooltip' => '', title: 'Insert Content' do
18
+ = link_to '#', class: 'tn-tc-open-library below', data: { modal_target: ".tenon-library", modal_closest: '.tn-tc', modal_title: "Insert Content", modal_handler: 'Tenon.features.tenonContent.Library', modal_clone: 'true', modal_closest: '.tn-tc', tooltip: ''}, title: 'Insert Content' do
19
19
  = fa_icon('plus-circle')
@@ -49,6 +49,9 @@ Tenon.configure do |config|
49
49
  config.after_update_path = :edit
50
50
  config.after_create_path = :edit
51
51
 
52
+ # Change the default root path for Tenon's back-end
53
+ # config.routing.root = 'index#index'
54
+
52
55
  # Set up languages for front-end internationalization
53
56
  # Currently Tenon is anglo-centric so you don't need to
54
57
  # specify English.
data/config/routes.rb CHANGED
@@ -50,6 +50,6 @@ Tenon::Engine.routes.draw do
50
50
  get 'approve', :on => :member
51
51
  end
52
52
 
53
- root :to => 'index#index'
53
+ root :to => Tenon.config.routing.root
54
54
  end
55
55
 
@@ -0,0 +1,25 @@
1
+ # File: lib/tenon/videos.rb
2
+ # Adds configuration options for videos
3
+ # eg.
4
+ #
5
+ # Tenon.configure do |config|
6
+ # config.events.display = :calendar
7
+ # end
8
+
9
+ module Tenon
10
+ class Configuration
11
+ attr_accessor :routing
12
+
13
+ def routing
14
+ @routing ||= RoutingConfiguration.new
15
+ end
16
+
17
+ class RoutingConfiguration
18
+ attr_accessor :root
19
+
20
+ def initialize
21
+ @root = 'index#index'
22
+ end
23
+ end
24
+ end
25
+ end
data/lib/tenon/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Tenon
2
- VERSION = '1.0.57'
2
+ VERSION = '1.0.59'
3
3
  end
data/lib/tenon.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require 'tenon/engine'
2
2
  require 'tenon/config/breakpoints.rb'
3
3
  require 'tenon/config/events.rb'
4
+ require 'tenon/config/routing.rb'
4
5
  require 'tenon/config/grid.rb'
5
6
  require 'tenon/can_be_foreign.rb'
6
7
  require 'tenon/can_have_comments.rb'
@@ -25,6 +26,7 @@ module Tenon
25
26
 
26
27
  class Configuration
27
28
  attr_accessor :mobile_layout, :languages, :seo_callout, :front_end,
28
- :after_create_path, :after_update_path, :client_color, :primary_color
29
+ :after_create_path, :after_update_path, :client_color,
30
+ :primary_color
29
31
  end
30
32
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tenon
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.57
4
+ version: 1.0.59
5
5
  platform: ruby
6
6
  authors:
7
7
  - factor[e] design initiative
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-04 00:00:00.000000000 Z
11
+ date: 2015-02-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: better_errors
@@ -949,6 +949,7 @@ files:
949
949
  - app/assets/javascripts/tenon/features/asset_list_post_crop_handler.js.coffee
950
950
  - app/assets/javascripts/tenon/features/asset_uploader.js.coffee
951
951
  - app/assets/javascripts/tenon/features/box_toggles.js.coffee
952
+ - app/assets/javascripts/tenon/features/cocoon_hooks.js.coffee
952
953
  - app/assets/javascripts/tenon/features/date_time_picker.js.coffee
953
954
  - app/assets/javascripts/tenon/features/file_select_widget.js.erb
954
955
  - app/assets/javascripts/tenon/features/flash.js.coffee
@@ -1382,6 +1383,7 @@ files:
1382
1383
  - lib/tenon/config/breakpoints.rb
1383
1384
  - lib/tenon/config/events.rb
1384
1385
  - lib/tenon/config/grid.rb
1386
+ - lib/tenon/config/routing.rb
1385
1387
  - lib/tenon/engine.rb
1386
1388
  - lib/tenon/factories/assets.rb
1387
1389
  - lib/tenon/factories/comments.rb
@@ -1515,7 +1517,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1515
1517
  version: '0'
1516
1518
  requirements: []
1517
1519
  rubyforge_project:
1518
- rubygems_version: 2.4.5
1520
+ rubygems_version: 2.2.2
1519
1521
  signing_key:
1520
1522
  specification_version: 4
1521
1523
  summary: A highly flexible mountable Rails CMS built for rapid application development.