ksk 0.2.5 → 0.2.6

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 29fbce166b148f3c43b1cf550ee920e7f02ee53f
4
- data.tar.gz: 8e71177bf41ca7ff4294a912925c51fe2da27e9a
3
+ metadata.gz: 97b5b715bb7af5193329121359012da1cb78ef78
4
+ data.tar.gz: 9870ff9f1f46315745574d2922605ed6395c5836
5
5
  SHA512:
6
- metadata.gz: be634ecb99a57fc45e1f1c168b057c16d02c170205dae9b3345bd89bad8aa7d566c1bd0b7c02ccec0934ee06ebbe391a859272cf788f0d459528023df01183fb
7
- data.tar.gz: dfc5bac4a737cca62550fc7842645f8a599c757c00816a10488c98e4d37a228d5e5bb71c65469a7d599177894978ee23d38a45306d5c4f9add4d9a6f976a3322
6
+ metadata.gz: e09419e0e64ae4f8d42744950b1fb696bfe37f1b32ed8f3fc4014e03933376fabdb1dd8356bf47db0595f9ba6c11015800eb8cef1032c17c34451271c36c0662
7
+ data.tar.gz: 861ca03711665305bb055da29870805649a54992c04cf47c34399c6a925aa9fc1deed51a1c182d9055346365dfb08941518935bf2c2a661fc99cb0e457504fea
@@ -1,7 +1,7 @@
1
1
  //= require_tree ./classes
2
2
 
3
- var kskInit = function(){
4
- $$('.js_tree_holder').each(function(elem){
3
+ initHelper(function(scope){
4
+ scope.getElements('.js_tree_holder').each(function(elem){
5
5
  var naviA = new NaviAdmin({
6
6
  elemTree: elem.getElement('.js_tree_list'),
7
7
  onItemDropped: function(item, parent, itemId, parentId){
@@ -43,7 +43,7 @@ var kskInit = function(){
43
43
  });
44
44
  });
45
45
 
46
- $$('.assets_list').each(function(elem){
46
+ scope.getElements('.assets_list').each(function(elem){
47
47
  new Sortables(elem, {
48
48
  handle: '.handle',
49
49
  onStart: function(element, clone){
@@ -58,10 +58,4 @@ var kskInit = function(){
58
58
  }
59
59
  });
60
60
  });
61
- };
62
-
63
- window.addEvent('domready', kskInit);
64
-
65
- if (document.addEventListener) {
66
- document.addEventListener('page:load', kskInit);
67
- }
61
+ });
@@ -1,5 +1,5 @@
1
1
  module Ksk
2
- module ApplicationHelper
2
+ module FrontendHelper
3
3
 
4
4
  def recursive_navi(navis, current_level = 0, max_level = 99)
5
5
  a = ' <ul>'
@@ -3,7 +3,7 @@
3
3
  - imgs = f.object.assets.only_images
4
4
  - if imgs.any?
5
5
  %h4= t('ksk.asset.list.headline.photos')
6
- %ol.assets_list{:'data-sort-url' => sort_bhf_entries_path('assets')}
6
+ %ol.assets_list{:'data-sort-url' => sort_entries_path('assets')}
7
7
  - imgs.each do |asset|
8
8
  %li{id: "#{asset.id}_images"}
9
9
  = render partial: 'bhf/entries/form/has_many/upload', locals: {field: field, f: f, asset: asset, allow_position: !@quick_edit}
@@ -11,7 +11,7 @@
11
11
  - files = f.object.assets.only_data_files
12
12
  - if files.any?
13
13
  %h4= t('ksk.asset.list.headline.files')
14
- %ol.assets_list{:'data-sort-url' => sort_bhf_entries_path('assets')}
14
+ %ol.assets_list{:'data-sort-url' => sort_entries_path('assets')}
15
15
  - files.each do |asset|
16
16
  %li{id: "#{asset.id}_data_files"}
17
17
  = render partial: 'bhf/entries/form/has_many/upload', locals: {field: field, f: f, asset: asset, allow_position: !@quick_edit}
@@ -9,12 +9,12 @@
9
9
 
10
10
  - if asset.is_image?
11
11
  = image_tag(asset.file.url(:medium), class: 'uploaded_image float_left')
12
- = link_to t('ksk.asset.image_preview.button.edit'), edit_bhf_entry_path('assets', asset.id), class: 'alt_button float_right'
12
+ = link_to t('ksk.asset.image_preview.button.edit'), edit_entry_path('assets', asset.id), class: 'alt_button float_right'
13
13
  - else
14
14
  = link_to asset.file_file_name, asset.file.url, class: 'uploaded_file float_left'
15
15
  - if asset.has_preview?
16
- = link_to t('ksk.asset.file_preview.button.edit'), edit_bhf_entry_path('previews', asset.preview), class: 'alt_button float_right'
16
+ = link_to t('ksk.asset.file_preview.button.edit'), edit_entry_path('previews', asset.preview), class: 'alt_button float_right'
17
17
  - else
18
- = link_to t('ksk.asset.file_preview.button.create'), new_bhf_entry_path('previews', asset_id: asset.id), class: 'alt_button float_right'
18
+ = link_to t('ksk.asset.file_preview.button.create'), new_entry_path('previews', asset_id: asset.id), class: 'alt_button float_right'
19
19
 
20
20
  .clear
@@ -2,8 +2,8 @@
2
2
  def p_recursive_navi(navis, current_level = 0, max_level = 99, ul = 'ul', first_wrap = '')
3
3
  a = "\n <#{ul}#{first_wrap}>\n"
4
4
  navis.each do |navi|
5
- x = link_to 'edit', edit_bhf_entry_path('navigation', navi), class: 'edit icon'
6
- y = link_to 'delete', bhf_entry_path('navigation', navi), :method => :delete, :confirm => t('bhf.helpers.promts.confirm'), class: 'delete icon'
5
+ x = link_to 'edit', edit_entry_path('navigation', navi), class: 'edit icon'
6
+ y = link_to 'delete', entry_path('navigation', navi), :method => :delete, :confirm => t('bhf.helpers.promts.confirm'), class: 'delete icon'
7
7
  a += " <li id='navigation_#{navi.id}'><div><span class='title'>#{navi.title}</span> <span class='links'>#{x} #{y}</span></div>"
8
8
  if current_level <= max_level and navi.children.any?
9
9
  a += p_recursive_navi(navi.children, current_level+1, max_level, ul)
@@ -19,14 +19,14 @@
19
19
  %h4= platform.title
20
20
  %p.info= t('ksk.navigation_sort.info')
21
21
  - unless platform.hide_create
22
- %p.create= link_to new_t(platform), new_bhf_entry_path(platform.name), class: :alt_button
22
+ %p.create= link_to new_t(platform), new_entry_path(platform.name), class: :alt_button
23
23
  - unless platform.custom_partial
24
24
  = render partial: 'search', locals: {platform: platform} if platform.search?
25
25
 
26
26
  .content_box
27
- .navi.js_tree_holder{data: {:'update-url' => sort_ksk_navigations_path}}
27
+ .navi.js_tree_holder{data: {:'update-url' => ksk.sort_navigations_path}}
28
28
  = p_recursive_navi(Navigation.top_level, 0, 99, 'ol', ' class="multi_grid js_tree_list"').html_safe
29
29
 
30
- .template_data.hide{data: {:'update-path' => ksk_navigations_path, :'prompt-question' => I18n.t('ksk.navigation_sort.prompt_question')}}
31
- = link_to 'edit', edit_bhf_entry_path('navigation', 'NAVIID'), class: 'edit icon'
32
- = link_to 'delete', bhf_entry_path('navigation', 'NAVIID'), method: :delete, data: {confirm: t('bhf.helpers.promts.confirm')}, class: 'delete icon'
30
+ .template_data.hide{data: {:'update-path' => ksk.navigations_path, :'prompt-question' => I18n.t('ksk.navigation_sort.prompt_question')}}
31
+ = link_to 'edit', edit_entry_path('navigation', 'NAVIID'), class: 'edit icon'
32
+ = link_to 'delete', entry_path('navigation', 'NAVIID'), method: :delete, data: {confirm: t('bhf.helpers.promts.confirm')}, class: 'delete icon'
data/config/routes.rb CHANGED
@@ -1,3 +1,7 @@
1
- unless Bhf::Engine.config.remove_default_routes
2
- Rails.application.routes.draw(&Ksk::Engine.config.ksk_routes)
3
- end
1
+ Ksk::Engine.routes.draw do
2
+
3
+ resources :navigations, only: [:create] do
4
+ put :sort, on: :collection
5
+ end
6
+
7
+ end
@@ -9,6 +9,7 @@ module Ksk
9
9
 
10
10
  has_one :navigation
11
11
  has_many :assets, :as => :fileable
12
+ # TODO: needs on_delete hook to destroy navigation if Navigation is availible for this object
12
13
 
13
14
  accepts_nested_attributes_for :assets, allow_destroy: true
14
15
  end
data/lib/ksk.rb CHANGED
@@ -3,16 +3,16 @@ require 'stringex'
3
3
  module Ksk
4
4
  class Engine < Rails::Engine
5
5
 
6
+ isolate_namespace Ksk
7
+
6
8
  config.css << 'ksk/application'
7
9
  config.js << 'ksk/application'
8
10
 
9
- config.ksk_routes = lambda {
10
- namespace :ksk, path: Bhf::Engine.config.mount_at do
11
- resources :navigations, only: [:create] do
12
- put :sort, on: :collection
13
- end
11
+ initializer 'ksk.action_controller' do |app|
12
+ ActiveSupport.on_load :action_controller do
13
+ helper Ksk::FrontendHelper
14
14
  end
15
- }
15
+ end
16
16
 
17
17
  end
18
18
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ksk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anton Pawlik
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-07 00:00:00.000000000 Z
11
+ date: 2013-12-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bhf
@@ -45,8 +45,11 @@ extensions: []
45
45
  extra_rdoc_files:
46
46
  - README.md
47
47
  files:
48
+ - app/assets/javascripts/ksk/application.js
49
+ - app/assets/javascripts/ksk/classes/NaviAdmin.js
50
+ - app/assets/stylesheets/ksk/application.css.sass
48
51
  - app/controllers/ksk/navigations_controller.rb
49
- - app/helpers/ksk/application_helper.rb
52
+ - app/helpers/ksk/frontend_helper.rb
50
53
  - app/views/bhf/entries/form/column/_file.html.haml
51
54
  - app/views/bhf/entries/form/column/_select_file_assets.html.haml
52
55
  - app/views/bhf/entries/form/has_many/_assets.html.haml
@@ -67,9 +70,6 @@ files:
67
70
  - lib/apdown.rb
68
71
  - lib/ksk.rb
69
72
  - lib/rails/generators/ksk/templates/initializer.rb
70
- - vendor/assets/javascripts/ksk/application.js
71
- - vendor/assets/javascripts/ksk/classes/NaviAdmin.js
72
- - vendor/assets/stylesheets/ksk/application.css.sass
73
73
  - README.md
74
74
  homepage: http://github.com/antpaw/ksk
75
75
  licenses: