has_accounts_engine 2.0.1 → 3.0.0.beta0

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.
@@ -15,9 +15,6 @@ function addAutofocusBehaviour() {
15
15
  // Add datepicker
16
16
  function addDatePickerBehaviour() {
17
17
  $('.date-picker').each(function(){
18
- if ($(this).hasClass('date')) {
19
- $(this).data('date', new Date().toISOString());
20
- }
21
18
  $(this).datepicker({ format: 'dd.mm.yyyy' });
22
19
  });
23
20
  };
@@ -6,7 +6,7 @@ class AccountsController < HasAccountsController
6
6
  has_scope :page, :only => :index
7
7
 
8
8
  def index
9
- @accounts = apply_scopes(Account).includes(:account_type).includes(:credit_bookings, :credit_bookings)
9
+ @accounts = apply_scopes(Account).includes(:account_type).includes(:credit_bookings, :credit_bookings).page(params[:page]).per_page(100)
10
10
  end
11
11
 
12
12
  def show
@@ -1,8 +1,19 @@
1
1
  class DateFieldInput < SimpleForm::Inputs::StringInput
2
+ # Normalizes to localized date
3
+ def date_value
4
+ value = object.send(attribute_name)
5
+
6
+ return nil unless value.present?
7
+
8
+ value = Date.parse(value) if value.is_a? String
9
+
10
+ I18n.localize(value)
11
+ end
12
+
2
13
  def input
3
14
  input_html_options[:type] = 'text'
4
15
  template.content_tag(:div, :class => 'input-append date-picker date') do
5
- super +
16
+ @builder.text_field(attribute_name, input_html_options.merge(:value => date_value)) +
6
17
  template.content_tag(:div, :class => 'add-on') do
7
18
  template.content_tag(:i, '', :class => 'icon-calendar')
8
19
  end
@@ -0,0 +1,11 @@
1
+ %table.table.table-striped.accounts.collection
2
+ %thead
3
+ %tr
4
+ %th= t_attr(:code, Account)
5
+ %th= t_attr(:title, Account)
6
+ %th{:style => "text-align: right"}= t_attr(:saldo, Account)
7
+ %th.action-links
8
+ %tbody
9
+ = render @accounts
10
+
11
+ = render 'bookings/sidebar'
@@ -2,16 +2,16 @@
2
2
 
3
3
  %tr[booking]
4
4
  %td= booking.value_date
5
- %td
6
- = link_to booking.title, item_action.call(booking), 'data-href-container' => 'tr'
5
+ %td.subject
6
+ = link_to booking.title, item_action.call(booking), 'data-remote' => true, 'data-table-key' => '13'
7
7
  - if booking.comments.present?
8
- %hr{:style => "height: 1px; margin: 0"}/
9
- %i= booking.comments
8
+ %div
9
+ %i= booking.comments
10
10
  %td= link_to booking.reference.to_s(:reference), booking.reference unless booking.reference.nil?
11
11
  %td= link_to booking.debit_account.code, account_path(booking.debit_account), :title => booking.debit_account.title unless booking.debit_account.nil?
12
12
  %td= link_to booking.credit_account.code, account_path(booking.credit_account), :title => booking.credit_account.title unless booking.credit_account.nil?
13
13
  %td.currency= currency_fmt(booking.amount)
14
14
  %td.action-links
15
- = list_link_for(:edit, booking)
16
- = list_link_for(:delete, booking, :remote => true)
17
- = list_link_for(:copy, booking)
15
+ = list_link_for(:edit, booking, 'data-table-key' => '69')
16
+ = list_link_for(:delete, booking, :remote => true, 'data-table-key' => '68')
17
+ = list_link_for(:copy, booking, 'data-table-key' => '67')
@@ -0,0 +1,15 @@
1
+ - booking = resource
2
+ %tr[booking]
3
+ = simple_fields_for booking, :wrapper => 'table' do |f|
4
+ %td= f.input :value_date, :as => 'date_field', :label => false
5
+ %td
6
+ = f.input :title, :input_html => {'data-autofocus' => true}
7
+ = f.input :comments, :rows => 2
8
+ %td= link_to booking.reference.to_s(:reference), booking.reference unless booking.reference.nil?
9
+ %td= f.association :debit_account, :collection => accounts_as_collection(Account.all), :as => :combobox, :input_html => { :style => 'max-width: 14ex' }
10
+ %td= f.association :credit_account, :collection => accounts_as_collection(Account.all), :as => :combobox, :input_html => { :style => 'max-width: 14ex' }
11
+ %td= f.input :amount, :as => :string
12
+ %td.action-links
13
+ = list_link_for(:show, booking, :icon => 'remove', :method => :put, :remote => true, 'data-table-key' => '27')
14
+ = link_to "#", 'data-table-key' => '13' do
15
+ %i.icon-ok
@@ -1,14 +1,15 @@
1
- %table.table.table-striped.bookings.collection
2
- %thead
3
- %tr
4
- %th= t_attr :valuta
5
- %th= t_attr :title
6
- %th= t_attr :reference
7
- %th= t_attr :debit_account
8
- %th= t_attr :credit_account
9
- %th.currency= t_attr 'amount'
10
- %th.action-links
11
- %tbody
12
- = render collection, :item_action => (item_action ||= nil)
1
+ = form_tag '', :id => 'bookings_table_form', 'data-table-select' => true, :method => :put, :remote => true do
2
+ %table.table.table-striped.bookings.collection
3
+ %thead
4
+ %tr
5
+ %th.valute_date= t_attr :valuta
6
+ %th.title= t_attr :title
7
+ %th.reference= t_attr :reference
8
+ %th.debit_account= t_attr :debit_account
9
+ %th.credit_account= t_attr :credit_account
10
+ %th.amount.currency= t_attr 'amount'
11
+ %th.action-links(style='width: 66px')
12
+ %tbody
13
+ = render collection, :item_action => (item_action ||= nil)
13
14
 
14
15
  = render 'bookings/sidebar'
@@ -1,4 +1,4 @@
1
- = contextual_links
1
+ = contextual_links 'data-remote' => true
2
2
 
3
3
  = boot_page_title(BookingTemplate)
4
4
  = render 'booking_templates/list', :item_action => lambda{|object| new_booking_booking_template_path(object)}
@@ -0,0 +1,4 @@
1
+ $('#booking_<%= resource.id %>').replaceWith('<%=j render "booking_form" %>');
2
+ $('#bookings_table_form').attr('action', '<%= booking_path(resource) %>');
3
+ initializeBehaviours();
4
+ window.bookyt_table.enterEdit()
@@ -0,0 +1,4 @@
1
+ $('#<%= "#{resource.class.name.underscore}_#{resource.to_param}" %>').replaceWith('<%=escape_javascript render resource %>');
2
+ $('tr#<%= "#{resource.class.name.underscore}_#{resource.to_param}" %>').addClass('selected')
3
+ initializeBehaviours();
4
+
@@ -1,3 +1,3 @@
1
1
  module HasAccountsEngine
2
- VERSION = "2.0.1"
2
+ VERSION = "3.0.0.beta0"
3
3
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: has_accounts_engine
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
5
- prerelease:
4
+ version: 3.0.0.beta0
5
+ prerelease: 6
6
6
  platform: ruby
7
7
  authors:
8
8
  - Simon Hürlimann (CyT)
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-03-24 00:00:00.000000000 Z
12
+ date: 2014-04-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -300,18 +300,18 @@ files:
300
300
  - app/views/accounts/_edit_booking.html.haml
301
301
  - app/views/accounts/_edit_bookings.html.haml
302
302
  - app/views/accounts/_form.html.haml
303
+ - app/views/accounts/_list.html.haml
303
304
  - app/views/accounts/_list_footer.html.haml
304
- - app/views/accounts/_list_header.html.haml
305
305
  - app/views/accounts/_show.html.haml
306
306
  - app/views/accounts/_show_bookings.html.haml
307
307
  - app/views/accounts/edit_bookings.html.haml
308
308
  - app/views/accounts/edit_bookings.js.erb
309
- - app/views/accounts/index.html.haml
310
309
  - app/views/accounts/show.html.haml
311
310
  - app/views/booking_templates/_booking_template.html.haml
312
311
  - app/views/booking_templates/_form.html.haml
313
312
  - app/views/booking_templates/_list.html.haml
314
313
  - app/views/bookings/_booking.html.haml
314
+ - app/views/bookings/_booking_form.html.haml
315
315
  - app/views/bookings/_form.html.haml
316
316
  - app/views/bookings/_list.html.haml
317
317
  - app/views/bookings/_new_form.html.haml
@@ -320,7 +320,9 @@ files:
320
320
  - app/views/bookings/new.html.haml
321
321
  - app/views/bookings/select.html.haml
322
322
  - app/views/bookings/show.html.haml
323
+ - app/views/bookings/show.js.erb
323
324
  - app/views/bookings/simple_edit.html.haml
325
+ - app/views/bookings/update.js.erb
324
326
  - app/views/has_accounts/_form.html.haml
325
327
  - app/views/has_accounts/_list.html.haml
326
328
  - app/views/has_accounts/_search_form.html.haml
@@ -364,9 +366,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
364
366
  required_rubygems_version: !ruby/object:Gem::Requirement
365
367
  none: false
366
368
  requirements:
367
- - - ! '>='
369
+ - - ! '>'
368
370
  - !ruby/object:Gem::Version
369
- version: '0'
371
+ version: 1.3.1
370
372
  requirements: []
371
373
  rubyforge_project:
372
374
  rubygems_version: 1.8.23
@@ -1,5 +0,0 @@
1
- %tr
2
- %th= t_attr(:code, Account)
3
- %th= t_attr(:title, Account)
4
- %th{:style => "text-align: right"}= t_attr(:saldo, Account)
5
- %th.action-links
@@ -1,9 +0,0 @@
1
- = contextual_links
2
- = boot_page_title
3
- %table.table.table-striped.accounts.collection
4
- %thead
5
- = render 'list_header'
6
- %tbody
7
- = render @accounts
8
-
9
- = render 'bookings/sidebar'