nostalgic 0.4.0 → 0.4.1

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: 26fa4daebfb49dc9fd1a633b4698e1d3fa614914
4
- data.tar.gz: 88282bae434f84a89e6698863cc2f49f7b43ca67
3
+ metadata.gz: 30046f16c7635d42dc567d99a4f5e56a981f4c95
4
+ data.tar.gz: 329f5f5079d7973fba0bd0333fc00209d00c65bd
5
5
  SHA512:
6
- metadata.gz: 4eb21955bc4028d2c6c0bc5dc91120c63c60e6d1f9b1bbd02470751be6ab5a80c336df1084a128ce20b51f7c54555ddf9d8eec4eb29281885d11ddd0998493ca
7
- data.tar.gz: aa97adf2d5c1461ee8bca5ec9700893a243a93d7afe35e1a2ef37b3bcc18b6028d2966b7e1cf761cd127f6572fac9f9dd15a7597dd7b3f16db0c6b5ec40df231
6
+ metadata.gz: 7cf8490c51e7401914a58bad1d5861f20945144854396c525c761c295ef3789affdf66459f11e816c7b963627fd3710cd3a0303462594ad0f47220708814fc0a
7
+ data.tar.gz: 6f9f9b6d49c518aa57f06819728d831dd1896572660c38e70d48bc41d7df054192d2000b93443b8996432ea046d0b06d35793b12c359d1d09ee4a5afc9162e17
@@ -0,0 +1,37 @@
1
+ var nostalgic = [];
2
+
3
+ nostalgic.remove_row = function(trigger) {
4
+ var tr = $(trigger).closest('tr');
5
+ tr.find('input[name*="\[_destroy\]"]').val(true);
6
+ tr.hide();
7
+ };
8
+
9
+ nostalgic.edit_nostalgic_attr = function(trigger) {
10
+ var table = $(trigger).closest('table');
11
+ var tbody = table.find('tbody');
12
+
13
+ tbody.toggle();
14
+ if (tbody.is(':visible')) {
15
+ $(trigger).closest('td').prev().children().show();
16
+ nostalgic.init_datepicker(table);
17
+ } else {
18
+ $(trigger).closest('td').prev().children().hide();
19
+ }
20
+ };
21
+
22
+ nostalgic.init_datepicker = function(selector) {
23
+ $(selector).find('.datepicker').each(function() {
24
+ $(this).datepicker({
25
+ dateFormat: 'yy-mm-dd',
26
+ changeYear: true,
27
+ changeMonth: true,
28
+ buttonImage: '<%= image_path('nostalgic/calendar.gif') %>',
29
+ buttonText: '',
30
+ buttonImageOnly: true,
31
+ showOn: 'button',
32
+ beforeShow: function() {
33
+ if ($(this).attr('readonly')) { return false; }
34
+ }
35
+ });
36
+ });
37
+ };
@@ -6,6 +6,8 @@
6
6
  </td>
7
7
  <td>
8
8
  <%= f.text_field "#{attr}_effective_at", :class => 'datepicker', :style => 'display: none;' %>
9
+ </td>
10
+ <td>
9
11
  <%= image_tag 'nostalgic/list.png', :onclick => 'nostalgic.edit_nostalgic_attr(this); return false;' %>
10
12
  </td>
11
13
  </tr>
@@ -17,10 +19,12 @@
17
19
  <td>
18
20
  <%= f.hidden_field :id %>
19
21
  <%= f.hidden_field :_destroy %>
20
- <%= f.text_field :value, :class => css_class, :disabled => true, :readonly => true %>
22
+ <%= content_tag(:span, f.object.value, class: css_class) %>
23
+ </td>
24
+ <td>
25
+ <%= content_tag(:span, f.object.effective_at, class: css_class) %>
21
26
  </td>
22
27
  <td>
23
- <%= f.text_field :effective_at, :class => 'datepicker', :disabled => true, :readonly => true %>
24
28
  <%= image_tag 'nostalgic/minus.png', :onclick => 'nostalgic.remove_row(this); return false;' %>
25
29
  </td>
26
30
  </tr>
@@ -1,3 +1,3 @@
1
1
  module Nostalgic
2
- VERSION = '0.4.0'
2
+ VERSION = '0.4.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nostalgic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - ichy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-02-11 00:00:00.000000000 Z
11
+ date: 2018-02-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -95,9 +95,10 @@ extra_rdoc_files: []
95
95
  files:
96
96
  - README.md
97
97
  - Rakefile
98
+ - app/assets/images/nostalgic/calendar.gif
98
99
  - app/assets/images/nostalgic/list.png
99
100
  - app/assets/images/nostalgic/minus.png
100
- - app/assets/javascripts/nostalgic.js
101
+ - app/assets/javascripts/nostalgic.js.erb
101
102
  - app/assets/javascripts/nostalgic/application.js
102
103
  - app/assets/stylesheets/nostalgic.css.scss
103
104
  - app/assets/stylesheets/nostalgic/application.css
@@ -1,19 +0,0 @@
1
- var nostalgic = [];
2
-
3
- nostalgic.remove_row = function(trigger) {
4
- var tr = $(trigger).closest('tr');
5
- tr.find('input[name*="\[_destroy\]"]').val(true);
6
- tr.hide();
7
- };
8
-
9
- nostalgic.edit_nostalgic_attr = function(trigger) {
10
- var table = $(trigger).closest('table');
11
-
12
- table.find('tbody').toggle();
13
- if (table.find('tbody').is(':visible')) {
14
- $(trigger).siblings().show();
15
- hyacc.init_datepicker_within(table);
16
- } else {
17
- $(trigger).siblings().hide();
18
- }
19
- };