diff options
author | Stefan Wintermeyer <stefan.wintermeyer@amooma.de> | 2013-02-04 13:51:15 +0100 |
---|---|---|
committer | Stefan Wintermeyer <stefan.wintermeyer@amooma.de> | 2013-02-04 13:51:15 +0100 |
commit | 636be20a183fac10637fea700f55f89bc371577b (patch) | |
tree | 0ccfad9b5ddbaf761dd1121962d2dd5977c4ba93 | |
parent | 049b3e62c2ad3e0affac17214baa38afb994b6ba (diff) |
Refactoring and bugfixes.
-rw-r--r-- | app/assets/javascripts/call_route.js.coffee | 4 | ||||
-rw-r--r-- | app/assets/javascripts/softkey.js.coffee | 4 | ||||
-rw-r--r-- | app/controllers/call_routes_controller.rb | 3 | ||||
-rw-r--r-- | app/views/call_routes/_index_core.html.haml | 60 | ||||
-rw-r--r-- | app/views/softkeys/_index_core.html.haml | 23 | ||||
-rw-r--r-- | config/environments/development.rb | 2 |
6 files changed, 49 insertions, 47 deletions
diff --git a/app/assets/javascripts/call_route.js.coffee b/app/assets/javascripts/call_route.js.coffee index f41d65b..91d62ca 100644 --- a/app/assets/javascripts/call_route.js.coffee +++ b/app/assets/javascripts/call_route.js.coffee @@ -1,6 +1,6 @@ jQuery -> - $("table tbody").sortable + $('#call_routes').sortable axis: 'y' handle: '.handle' update: -> - $.post('call_routes/sort', $(this).sortable('serialize'))
\ No newline at end of file + $.post($(this).data('update-url'), $(this).sortable('serialize'))
\ No newline at end of file diff --git a/app/assets/javascripts/softkey.js.coffee b/app/assets/javascripts/softkey.js.coffee index 19103f0..a8d2d0c 100644 --- a/app/assets/javascripts/softkey.js.coffee +++ b/app/assets/javascripts/softkey.js.coffee @@ -1,6 +1,6 @@ jQuery -> - $("table tbody").sortable + $('#softkeys').sortable axis: 'y' handle: '.handle' update: -> - $.post('/softkeys/sort', $(this).sortable('serialize'))
\ No newline at end of file + $.post($(this).data('update-url'), $(this).sortable('serialize'))
\ No newline at end of file diff --git a/app/controllers/call_routes_controller.rb b/app/controllers/call_routes_controller.rb index 779e23c..661ceba 100644 --- a/app/controllers/call_routes_controller.rb +++ b/app/controllers/call_routes_controller.rb @@ -1,5 +1,5 @@ class CallRoutesController < ApplicationController - authorize_resource :call_route + authorize_resource :call_route, :except => [:sort] # before_filter { |controller| # if !params[:call_route].blank? and !params[:call_route][:endpoint_str].blank? @@ -67,6 +67,7 @@ class CallRoutesController < ApplicationController def sort params[:call_route].each_with_index do |id, index| CallRoute.update_all({position: index+1}, {id: id}) + #CallRoute.find(:id).move_to_bottom end render nothing: true end diff --git a/app/views/call_routes/_index_core.html.haml b/app/views/call_routes/_index_core.html.haml index 9eae9ee..b6c5d33 100644 --- a/app/views/call_routes/_index_core.html.haml +++ b/app/views/call_routes/_index_core.html.haml @@ -1,31 +1,31 @@ -/ - cache(['call_routes_table', call_routes.count, call_routes.reorder(:updated_at).last]) do -%table.table.table-striped{ :id => "call_routes" } - %thead - %tr - %th - %th= t('call_routes.index.name') - %th= t('route_elements.index.pattern') - %th= t('call_routes.index.endpoint') +- cache(['call_routes_table', I18n.locale, call_routes.count, call_routes.reorder(:updated_at).last]) do + %table.table.table-striped + %thead + %tr + %th + %th= t('call_routes.index.name') + %th= t('route_elements.index.pattern') + %th= t('call_routes.index.endpoint') - %tbody - - for call_route in call_routes - / - cache(['call_route_single_table_row', call_route, call_routes.count]) do - = content_tag_for :tr, call_route do - %td - %span.handle - %i.icon-resize-vertical - %td= call_route.name - %td - - if call_route.route_elements.any? - = call_route.route_elements.first.pattern - - if call_route.route_elements.count > 1 - = ', ...' - - else - = '-' - %td - - endpoint = call_route.endpoint - - if endpoint - = endpoint - - else - = call_route.endpoint_type - =render :partial => 'shared/index_view_edit_destroy_part', :locals => {:child => call_route} + %tbody{ :id => "call_routes", :'data-update-url' => sort_call_routes_url} + - for call_route in call_routes + - cache(['call_route_single_table_row', I18n.locale, call_route]) do + = content_tag_for :tr, call_route do + %td + %span.handle + %i.icon-resize-vertical + %td= call_route.name + %td + - if call_route.route_elements.any? + = call_route.route_elements.first.pattern + - if call_route.route_elements.count > 1 + = ', ...' + - else + = '-' + %td + - endpoint = call_route.endpoint + - if endpoint + = endpoint + - else + = call_route.endpoint_type + =render :partial => 'shared/index_view_edit_destroy_part', :locals => {:child => call_route} diff --git a/app/views/softkeys/_index_core.html.haml b/app/views/softkeys/_index_core.html.haml index 4ebb29c..70c96bc 100644 --- a/app/views/softkeys/_index_core.html.haml +++ b/app/views/softkeys/_index_core.html.haml @@ -1,5 +1,5 @@ -- cache(['softkeys', I18n.locale, current_user, softkeys]) do - %table.table.table-striped{ :id => "softkeys" } +- cache(['softkeys_table', I18n.locale, current_user, softkeys]) do + %table.table.table-striped %thead %tr %th @@ -7,13 +7,14 @@ %th= t('softkeys.index.number') %th= t('softkeys.index.label') - %tbody + %tbody{ :id => "softkeys", :'data-update-url' => sort_softkeys_url} - for softkey in softkeys - = content_tag_for :tr, softkey do - %td - %span.handle - %i.icon-resize-vertical - %td= softkey.function - %td= softkey.number - %td= softkey.label - =render :partial => 'shared/index_view_edit_destroy_part', :locals => {:parent => softkey.sip_account, :child => softkey}
\ No newline at end of file + - cache(['softkeys_table_tr', I18n.locale, current_user, softkey]) do + = content_tag_for :tr, softkey do + %td + %span.handle + %i.icon-resize-vertical + %td= softkey.function + %td= softkey.number + %td= softkey.label + =render :partial => 'shared/index_view_edit_destroy_part', :locals => {:parent => softkey.sip_account, :child => softkey}
\ No newline at end of file diff --git a/config/environments/development.rb b/config/environments/development.rb index 1a3acae..e677834 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -13,7 +13,7 @@ Gemeinschaft42c::Application.configure do config.consider_all_requests_local = true # Enable caching for development - config.action_controller.perform_caching = true + config.action_controller.perform_caching = false CacheDigests::TemplateDigestor.cache = ActiveSupport::Cache::NullStore.new # Don't care if the mailer can't send |