edgarj 4.00.04 → 4.01.00

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: 6e354eb22c54ed1a8d2b4f36fafb43d3dc4f3af4
4
- data.tar.gz: 753e8b133475f62e837f19fb584a6616ce217b82
3
+ metadata.gz: c8b1ee705a94b09bfc44212b36254af434d80cc3
4
+ data.tar.gz: e5e0bbe5a297528159e2143abe70932c8b6306fa
5
5
  SHA512:
6
- metadata.gz: e7916712333a9a729e84114bfe33d5f228f7e0a18c848d6f319ddb2fd6ff3936cbd7daa33bb147a5bcbfc0381ffd4041bee92ac707084916815c132c51dcb63d
7
- data.tar.gz: 720a8b32847a8d53cfd7b3d7fa6c7c7d77b03a443cb67415f7ec87e338aba799bb9de9b4fa89084fe3ad79d9a5a8792283a0f942b72ab163ab39652bab387450
6
+ metadata.gz: aa4d540716d0c53cfd790c843d90f1f76dcf49538d41fa4030284939c99e24b8d77a8697dd8d6200500690eaeee9897ddac21a38f8f86ee7a960c9b1d9ee3d0a
7
+ data.tar.gz: 4a6af60d04ce9edc7c99baf9fa7e3d7f808f13bf61622100f73d2c8e9fa945b95b1b1ae4374e36b453d572338963117667702d3fb9fe86276d05a80c13450ffa
@@ -118,8 +118,20 @@ module Edgarj
118
118
  Edgarj::ListDrawer::Normal
119
119
  end
120
120
 
121
+ def url_for_show(record)
122
+ @vc.url_for(action: 'show', id: record.id, format: :js)
123
+ end
124
+
125
+ def draw_row(record, &block)
126
+ @vc.content_tag(:tr,
127
+ class: "list_line#{@line_color} edgarj_row",
128
+ data: {url: url_for_show(record)}) do
129
+ yield
130
+ end
131
+ end
132
+
121
133
  def draw_list(list)
122
- line_color = 1
134
+ @line_color = 1
123
135
  d = list_drawer_class.new(
124
136
  self,
125
137
  @options[:list_drawer_options] || {})
@@ -134,9 +146,8 @@ module Edgarj
134
146
  end +
135
147
  ''.html_safe.tap do |trs|
136
148
  for rec in list do
137
- line_color = 1 - line_color
138
- d.set_path(rec)
139
- trs << @vc.content_tag(:tr, class: "list_line#{line_color}") do
149
+ @line_color = 1 - @line_color
150
+ trs << draw_row(rec) do
140
151
  ''.html_safe.tap do |cols|
141
152
  for col in columns_for(list_columns) do
142
153
  cols << d.draw_column(rec, col)
@@ -9,8 +9,16 @@ module Edgarj
9
9
  # * options
10
10
  # * list_drawer_options - options for Edgarj::ListDrawer::Normal
11
11
  class Popup < Base
12
+ def draw_row(record, &block)
13
+ @vc.content_tag(:tr,
14
+ class: "list_line#{@line_color} edgarj_row edgarj_popup_list_row",
15
+ data: {id: record.id, name: record.name}) do
16
+ yield
17
+ end
18
+ end
19
+
12
20
  def draw_list(list)
13
- line_color = 1
21
+ @line_color = 1
14
22
  d = Edgarj::ListDrawer::Normal.new(
15
23
  self,
16
24
  @options[:list_drawer_options] || {})
@@ -25,11 +33,8 @@ module Edgarj
25
33
  end +
26
34
  ''.html_safe.tap do |trs|
27
35
  for rec in list do
28
- line_color = 1 - line_color
29
- d.set_path(rec)
30
- trs << @vc.content_tag(:tr,
31
- class: "list_line#{line_color} edgarj_popup_list_row",
32
- data: {id: rec.id, name: rec.name}) do
36
+ @line_color = 1 - @line_color
37
+ trs << draw_row(rec) do
33
38
  ''.html_safe.tap do |cols|
34
39
  for col in columns_for(list_columns) do
35
40
  cols << d.draw_column(rec, col)
@@ -15,7 +15,6 @@ module Edgarj
15
15
  # :save:: html options for 'save' button.
16
16
  # :search_form:: html options for 'search_form' button.
17
17
  # :delete:: html options for 'delete' button.
18
- # :namespace:: delete url namespace
19
18
  def draw_form_buttons(options = {})
20
19
  content_tag(:table) do
21
20
  content_tag(:tr) do
@@ -10,7 +10,6 @@ module Edgarj
10
10
 
11
11
  # * drawer - Edgarj::Drawer::Base object
12
12
  # * options
13
- # * namespace - namespace for path (ex: :admin)
14
13
  #
15
14
  # TODO: enum_cache は止め、グローバルに1つのキャッシュを作る。
16
15
  def initialize(drawer, options = {})
@@ -191,23 +190,14 @@ module Edgarj
191
190
  #@belongs_to_link = true # make link on belongs_to
192
191
  end
193
192
 
194
- # prepare path for the rec, which will be drawn later.
195
- def set_path(rec)
196
- @path = @vc.polymorphic_path([@options[:namespace], rec], format: :js)
197
- end
198
-
199
193
  # <td> options
200
194
  #
201
195
  # add Edgarj.click_listCB() with base result.
202
196
  # When the column is parent, do nothing.
203
197
  def td_options(rec, col)
204
- result = super.merge(
198
+ super.merge(
205
199
  style: 'cursor:pointer;',
206
200
  class: '_edgarj_list_column')
207
- #if !@parent_rec
208
- result[:'data-url'] = @path
209
- #end
210
- result
211
201
  end
212
202
  end
213
203
  end
@@ -45,7 +45,7 @@
45
45
 
46
46
  /* show detail on clicking a list row */
47
47
  $('._edgarj_list_column').click(function(){
48
- $.ajax($(this).attr('data-url'));
48
+ $.ajax($(this).closest('.edgarj_row').attr('data-url'));
49
49
  });
50
50
  });
51
51
  <% end %>
@@ -1,20 +1,24 @@
1
1
  module ActionDispatch::Routing::Mapper::Resources
2
- # add followings to work on Edgarj::EdgarjController derived class to
3
- # default resource routing:
2
+ # define edgarj specific routing for CRUD.
4
3
  #
5
- # collection do
6
- # get :clear
7
- # get :csv_download
8
- # get :search
9
- # get :search_clear
10
- # get :search_save
11
- # get :search_load
12
- # end
4
+ # Following declaration in config/routes.rb:
13
5
  #
14
- # member do
15
- # put :page_info_save
16
- # end
6
+ # edgarj_resources :photos
17
7
  #
8
+ # creates the following routes in addition to the default routes
9
+ # in your application,
10
+ # all mapping to the Photos controller which inherits from
11
+ # Edgarj::EdgarjController:
12
+ #
13
+ # GET /photos/clear
14
+ # GET /photos/csv_download
15
+ # GET /photos/search
16
+ # GET /photos/search_clear
17
+ # GET /photos/zip_complete
18
+ # PATCH/PUT /photos/:id/page_info_save
19
+ #
20
+ # Where, :id is internally used for session so that client application
21
+ # doesn't have to take care it.
18
22
  def edgarj_resources(*symbols, &block)
19
23
  resources *symbols do
20
24
  yield if block_given?
@@ -30,29 +34,30 @@ module ActionDispatch::Routing::Mapper::Resources
30
34
  end
31
35
 
32
36
  member do
33
- put :page_info_save
37
+ put :page_info_save
38
+ patch :page_info_save
34
39
  end
35
40
  end
36
41
 
37
42
  self
38
43
  end
39
44
 
40
- # add followings to work on Edgarj::PopupController derived class to
41
- # default resource routing:
45
+ # define edgarj specific routing for popup.
46
+ #
47
+ # Following declaration in config/routes.rb:
48
+ #
49
+ # edgarj_popup_resources :photos_popup
42
50
  #
43
- # collection do
44
- # get :clear
45
- # get :csv_download
46
- # get :search
47
- # get :search_clear
48
- # get :search_save
49
- # get :search_load
50
- # end
51
+ # creates the following routes in your application,
52
+ # all mapping to the Photos controller which inherits from
53
+ # Edgarj::PopupController:
51
54
  #
52
- # member do
53
- # put :page_info_save
54
- # end
55
+ # GET /photos_popup/index
56
+ # GET /photos_popup/search
57
+ # PATCH/PUT /photos_popup/:id/page_info_save
55
58
  #
59
+ # Where, :id is internally used for session so that client application
60
+ # doesn't have to take care it.
56
61
  def edgarj_popup_resources(*symbols, &block)
57
62
  resources *symbols, only: [:index] do
58
63
  yield if block_given?
@@ -1,3 +1,3 @@
1
1
  module Edgarj
2
- VERSION = "4.00.04"
2
+ VERSION = "4.01.00"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: edgarj
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.00.04
4
+ version: 4.01.00
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fuminori Ido
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-23 00:00:00.000000000 Z
11
+ date: 2016-03-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails