edgarj 0.01.12

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.
Files changed (185) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.rdoc +23 -0
  4. data/Rakefile +40 -0
  5. data/app/assets/javascripts/edgarj/base.js +49 -0
  6. data/app/assets/javascripts/edgarj/menu.js +39 -0
  7. data/app/assets/javascripts/edgarj/operator_selection.js +133 -0
  8. data/app/assets/stylesheets/edgarj/base.css +304 -0
  9. data/app/assets/stylesheets/edgarj/menu.css +65 -0
  10. data/app/controllers/edgarj/authentication_mixin.rb.sample +30 -0
  11. data/app/controllers/edgarj/controller_mixin_common.rb +80 -0
  12. data/app/controllers/edgarj/controller_mixin_for_app.rb +71 -0
  13. data/app/controllers/edgarj/edgarj_controller.rb +535 -0
  14. data/app/controllers/edgarj/model_permissions_controller.rb +8 -0
  15. data/app/controllers/edgarj/permission_mixin.rb +84 -0
  16. data/app/controllers/edgarj/popup_controller.rb +128 -0
  17. data/app/controllers/edgarj/rescue_mixin.rb +37 -0
  18. data/app/controllers/edgarj/user_group_users_controller.rb +8 -0
  19. data/app/controllers/edgarj/user_groups_controller.rb +9 -0
  20. data/app/controllers/edgarj/user_groups_popup_controller.rb +8 -0
  21. data/app/helpers/edgarj/assoc_helper.rb +369 -0
  22. data/app/helpers/edgarj/common_helper.rb +37 -0
  23. data/app/helpers/edgarj/edgarj_helper.rb +20 -0
  24. data/app/helpers/edgarj/field_helper.rb +397 -0
  25. data/app/helpers/edgarj/form_drawer.rb +322 -0
  26. data/app/helpers/edgarj/list_drawer.rb +169 -0
  27. data/app/helpers/edgarj/menu_helper.rb +92 -0
  28. data/app/helpers/edgarj/model_permissions_helper.rb +9 -0
  29. data/app/helpers/edgarj/popup_helper.rb +40 -0
  30. data/app/helpers/edgarj/search_helper.rb +14 -0
  31. data/app/helpers/edgarj/sessions_helper.rb +9 -0
  32. data/app/helpers/edgarj/user_group_users_helper.rb +9 -0
  33. data/app/helpers/edgarj/user_groups_helper.rb +9 -0
  34. data/app/helpers/edgarj/user_groups_popup_helper.rb +9 -0
  35. data/app/models/edgarj/drawer/base.rb +234 -0
  36. data/app/models/edgarj/drawer/normal.rb +6 -0
  37. data/app/models/edgarj/drawer/popup.rb +47 -0
  38. data/app/models/edgarj/drawer.rb +13 -0
  39. data/app/models/edgarj/model_permission.rb +41 -0
  40. data/app/models/edgarj/page_info.rb +47 -0
  41. data/app/models/edgarj/search.rb +81 -0
  42. data/app/models/edgarj/search_form.rb +255 -0
  43. data/app/models/edgarj/search_popup.rb +44 -0
  44. data/app/models/edgarj/sssn.rb +120 -0
  45. data/app/models/edgarj/user_group.rb +67 -0
  46. data/app/models/edgarj/user_group_user.rb +18 -0
  47. data/app/models/edgarj.rb +5 -0
  48. data/app/views/edgarj/edgarj/_form.html.erb +25 -0
  49. data/app/views/edgarj/edgarj/_list.html.erb +52 -0
  50. data/app/views/edgarj/edgarj/_message_popup.html.erb +15 -0
  51. data/app/views/edgarj/edgarj/_search_form.html.erb +64 -0
  52. data/app/views/edgarj/edgarj/_search_operator.html.erb +17 -0
  53. data/app/views/edgarj/edgarj/_search_operator_selection.html.erb +12 -0
  54. data/app/views/edgarj/edgarj/clear.js.erb +1 -0
  55. data/app/views/edgarj/edgarj/create.js.erb +4 -0
  56. data/app/views/edgarj/edgarj/destroy.js.erb +2 -0
  57. data/app/views/edgarj/edgarj/index.html.erb +37 -0
  58. data/app/views/edgarj/edgarj/index.js.erb +1 -0
  59. data/app/views/edgarj/edgarj/message_popup.js.erb +3 -0
  60. data/app/views/edgarj/edgarj/page_info_save.js.erb +1 -0
  61. data/app/views/edgarj/edgarj/search.js.erb +4 -0
  62. data/app/views/edgarj/edgarj/search_clear.js.erb +1 -0
  63. data/app/views/edgarj/edgarj/show.js.erb +1 -0
  64. data/app/views/edgarj/edgarj/top.html.erb +4 -0
  65. data/app/views/edgarj/edgarj/update.js.erb +4 -0
  66. data/app/views/edgarj/popup/_index.html.erb +16 -0
  67. data/app/views/edgarj/popup/_list.html.erb +42 -0
  68. data/app/views/edgarj/popup/_message_popup.html.erb +15 -0
  69. data/app/views/edgarj/popup/_search.html.erb +42 -0
  70. data/app/views/edgarj/popup/_search_save_popup.html.erb +16 -0
  71. data/app/views/edgarj/popup/index.js.erb +5 -0
  72. data/app/views/edgarj/popup/message_popup.js.erb +3 -0
  73. data/app/views/edgarj/popup/page_info_save.js.erb +1 -0
  74. data/app/views/edgarj/popup/search.js.erb +15 -0
  75. data/app/views/edgarj/popup/view_status_save.js.erb +1 -0
  76. data/config/routes.rb +15 -0
  77. data/config/settings.yml +5 -0
  78. data/db/migrate/20131118084600_create_edgar_sssns.rb +14 -0
  79. data/db/migrate/20131123124730_create_edgar_page_infos.rb +15 -0
  80. data/db/migrate/20140116062252_create_edgar_user_groups.rb +18 -0
  81. data/db/migrate/20140116062327_create_edgar_user_group_users.rb +10 -0
  82. data/db/migrate/20140206222308_create_edgar_model_permissions.rb +14 -0
  83. data/db/migrate/20141209053055_rename_edgar_to_edgarj.rb +17 -0
  84. data/lib/core_ext/active_record.rb +123 -0
  85. data/lib/core_ext/resources.rb +71 -0
  86. data/lib/edgarj/engine.rb +64 -0
  87. data/lib/edgarj/enum_cache.rb +46 -0
  88. data/lib/edgarj/templates/rails/helper/helper.rb +10 -0
  89. data/lib/edgarj/templates/test_unit/scaffold/functional_test.rb +575 -0
  90. data/lib/edgarj/version.rb +3 -0
  91. data/lib/edgarj.rb +14 -0
  92. data/lib/generators/edgarj/popup_scaffold/USAGE +6 -0
  93. data/lib/generators/edgarj/popup_scaffold/popup_scaffold_generator.rb +35 -0
  94. data/lib/generators/edgarj/popup_scaffold/templates/controller.rb +13 -0
  95. data/lib/generators/edgarj/popup_scaffold/templates/functional_test.rb +197 -0
  96. data/lib/generators/edgarj/popup_scaffold/templates/helper.rb +9 -0
  97. data/lib/generators/edgarj/scaffold/USAGE +17 -0
  98. data/lib/generators/edgarj/scaffold/scaffold_generator.rb +40 -0
  99. data/lib/generators/edgarj/scaffold/templates/controller.rb +13 -0
  100. data/lib/tasks/edgarj_tasks.rake +32 -0
  101. data/lib/tasks/pakcage.rake +18 -0
  102. data/locale/en.yml +94 -0
  103. data/locale/ja.yml +100 -0
  104. data/test/dummy/README.rdoc +28 -0
  105. data/test/dummy/Rakefile +6 -0
  106. data/test/dummy/app/assets/javascripts/application.js +21 -0
  107. data/test/dummy/app/assets/javascripts/authors.js +2 -0
  108. data/test/dummy/app/assets/stylesheets/application.css +16 -0
  109. data/test/dummy/app/assets/stylesheets/authors.css +4 -0
  110. data/test/dummy/app/assets/stylesheets/scaffold.css +56 -0
  111. data/test/dummy/app/controllers/application_controller.rb +15 -0
  112. data/test/dummy/app/controllers/authors_controller.rb +6 -0
  113. data/test/dummy/app/controllers/authors_popup_controller.rb +6 -0
  114. data/test/dummy/app/controllers/books_controller.rb +6 -0
  115. data/test/dummy/app/controllers/dummy_auth_mixin.rb +36 -0
  116. data/test/dummy/app/decorators/models/edgarj/user_group_decorator.rb +1 -0
  117. data/test/dummy/app/helpers/application_helper.rb +3 -0
  118. data/test/dummy/app/helpers/authors_helper.rb +7 -0
  119. data/test/dummy/app/helpers/authors_popup_helper.rb +7 -0
  120. data/test/dummy/app/helpers/books_helper.rb +7 -0
  121. data/test/dummy/app/models/author.rb +32 -0
  122. data/test/dummy/app/models/book.rb +5 -0
  123. data/test/dummy/app/models/user.rb +13 -0
  124. data/test/dummy/app/views/layouts/application.html.erb +32 -0
  125. data/test/dummy/app/views/layouts/login.html.erb +20 -0
  126. data/test/dummy/bin/bundle +3 -0
  127. data/test/dummy/bin/rails +4 -0
  128. data/test/dummy/bin/rake +4 -0
  129. data/test/dummy/config/application.rb +59 -0
  130. data/test/dummy/config/boot.rb +10 -0
  131. data/test/dummy/config/database.yml +15 -0
  132. data/test/dummy/config/edgarj/menu_config.rb +28 -0
  133. data/test/dummy/config/environment.rb +5 -0
  134. data/test/dummy/config/environments/development.rb +42 -0
  135. data/test/dummy/config/environments/production.rb +79 -0
  136. data/test/dummy/config/environments/test.rb +34 -0
  137. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  138. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  139. data/test/dummy/config/initializers/inflections.rb +16 -0
  140. data/test/dummy/config/initializers/mime_types.rb +5 -0
  141. data/test/dummy/config/initializers/secret_token.rb +12 -0
  142. data/test/dummy/config/initializers/session_store.rb +3 -0
  143. data/test/dummy/config/initializers/strong_parameter.rb +3 -0
  144. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  145. data/test/dummy/config/locales/en.yml +26 -0
  146. data/test/dummy/config/routes.rb +60 -0
  147. data/test/dummy/config.ru +4 -0
  148. data/test/dummy/db/migrate/20131107120635_create_authors.rb +9 -0
  149. data/test/dummy/db/migrate/20131218011851_create_books.rb +10 -0
  150. data/test/dummy/db/migrate/20140201000000_add_user_group_id_to_authors.rb +5 -0
  151. data/test/dummy/db/migrate/20140807065420_create_users.rb +10 -0
  152. data/test/dummy/db/schema.rb +93 -0
  153. data/test/dummy/public/404.html +58 -0
  154. data/test/dummy/public/422.html +58 -0
  155. data/test/dummy/public/500.html +57 -0
  156. data/test/dummy/public/favicon.ico +0 -0
  157. data/test/dummy/script/rails +6 -0
  158. data/test/dummy/test/functional/authors_controller_test.rb +631 -0
  159. data/test/dummy/test/functional/books_controller_test.rb +516 -0
  160. data/test/dummy/test/helpers/authors_helper_test.rb +4 -0
  161. data/test/dummy/test/unit/author_test.rb +7 -0
  162. data/test/dummy/test/unit/book_test.rb +7 -0
  163. data/test/edgar_test.rb +7 -0
  164. data/test/fixtures/authors.yml +32 -0
  165. data/test/fixtures/books.yml +56 -0
  166. data/test/fixtures/edgarj/model_permissions.yml +97 -0
  167. data/test/fixtures/edgarj/page_infos.yml +84 -0
  168. data/test/fixtures/edgarj/sssns.yml +38 -0
  169. data/test/fixtures/edgarj/user_group_users.yml +114 -0
  170. data/test/fixtures/edgarj/user_groups.yml +95 -0
  171. data/test/fixtures/users.yml +49 -0
  172. data/test/functional/edgarj/edgarj_controller_test.rb +24 -0
  173. data/test/functional/edgarj/model_permissions_controller_test.rb +554 -0
  174. data/test/functional/edgarj/user_group_users_controller_test.rb +567 -0
  175. data/test/integration/navigation_test.rb +10 -0
  176. data/test/support/edgarj/controller_supporter.rb +23 -0
  177. data/test/test_helper.rb +23 -0
  178. data/test/unit/edgarj/model_permission_test.rb +27 -0
  179. data/test/unit/edgarj/page_info_test.rb +7 -0
  180. data/test/unit/edgarj/sssn_test.rb +10 -0
  181. data/test/unit/edgarj/user_group_test.rb +32 -0
  182. data/test/unit/edgarj/user_group_user_test.rb +9 -0
  183. data/test/unit/helpers/edgarj/model_permissions_helper_test.rb +6 -0
  184. data/test/unit/helpers/edgarj/user_group_users_helper_test.rb +6 -0
  185. metadata +456 -0
@@ -0,0 +1,13 @@
1
+ <% model_name = class_name.singularize -%>
2
+ <% if namespaced? -%>
3
+ require_dependency "<%= namespaced_file_path %>/application_controller"
4
+
5
+ <% end -%>
6
+ <% module_namespacing do -%>
7
+ class <%= controller_class_name %>PopupController < Edgarj::PopupController
8
+ private
9
+ def drawer_class
10
+ <%= controller_class_name %>PopupHelper::<%= model_name -%>PopupDrawer
11
+ end
12
+ end
13
+ <% end -%>
@@ -0,0 +1,197 @@
1
+ require 'test_helper'
2
+
3
+ <% module_namespacing do -%>
4
+ class <%= controller_class_name %>PopupControllerTest < ActionController::TestCase
5
+ context 'root user' do
6
+ setup do
7
+ login_as(:root)
8
+ @pi = create_page_info(@sssn, '<%= table_name %>', <%= class_name %>)
9
+ end
10
+
11
+ should 'get index' do
12
+ xhr :get, :index,
13
+ id_target: "PARENT_MODEL_DOM_ID"
14
+ assert_response :success
15
+ assert_not_nil assigns(:list)
16
+ end
17
+
18
+ should 'paginate' do
19
+ xhr :get, :index, page: 2,
20
+ id_target: "PARENT_MODEL_DOM_ID"
21
+ assert_response :success
22
+ assert_not_nil assigns(:list)
23
+ end
24
+
25
+ should 'sort' do
26
+ xhr :put, :page_info_save, id: @pi.id,
27
+ id_target: "PARENT_MODEL_DOM_ID",
28
+ edgarj_page_info: {
29
+ dir: 'asc',
30
+ order_by: 'created_at'
31
+ }
32
+ assert_response :success
33
+ assert_not_nil assigns(:list)
34
+ assert_equal 'asc', assigns(:page_info).dir
35
+ assert_equal 'created_at', assigns(:page_info).order_by
36
+ end
37
+
38
+ should 'search' do
39
+ xhr :get, :search, edgarj_search_form: {},
40
+ id_target: "PARENT_MODEL_DOM_ID"
41
+ assert_response :success
42
+ assert assigns(:list).count >= 1
43
+ end
44
+ end
45
+
46
+ # All of tests in this context is skipped because it is required
47
+ # to prepare read-only user.
48
+ # When complete the preparation, delete the skip lines.
49
+ context 'read-only user' do
50
+ setup do
51
+ # prepare fixtures of model_permissions, user_groups, and
52
+ # user_group_users for read-only user of the
53
+ # <%= controller_class_name %>Controller and login by him/her.
54
+ #
55
+ login_as(:<%= singular_table_name %>_reader)
56
+ @pi = create_page_info(@sssn, '<%= table_name %>', <%= class_name %>)
57
+ end
58
+
59
+ should 'get index' do
60
+ skip 'get index'
61
+ xhr :get, :index,
62
+ id_target: "PARENT_MODEL_DOM_ID"
63
+ assert_response :success
64
+ assert_not_nil assigns(:list)
65
+ end
66
+
67
+ should 'paginate' do
68
+ skip 'get paginate'
69
+ xhr :get, :index, page: 2,
70
+ id_target: "PARENT_MODEL_DOM_ID"
71
+ assert_response :success
72
+ assert_not_nil assigns(:list)
73
+ end
74
+
75
+ should 'sort' do
76
+ skip 'sort'
77
+ xhr :put, :page_info_save, id: @pi.id,
78
+ id_target: "PARENT_MODEL_DOM_ID",
79
+ edgarj_page_info: {
80
+ dir: 'asc',
81
+ order_by: 'created_at'
82
+ }
83
+ assert_response :success
84
+ assert_not_nil assigns(:list)
85
+ assert_equal 'asc', assigns(:page_info).dir
86
+ assert_equal 'created_at', assigns(:page_info).order_by
87
+ end
88
+
89
+ should 'search' do
90
+ skip 'search'
91
+ xhr :get, :search, edgarj_search_form: {},
92
+ id_target: "PARENT_MODEL_DOM_ID"
93
+ assert_response :success
94
+ assert assigns(:list).count >= 1
95
+ end
96
+ end
97
+
98
+ # All of tests in this context is skipped because it is required
99
+ # to prepare 'permitted but user_scoped' user.
100
+ # When complete the preparation, delete the skip lines.
101
+ context 'permitted and user_scoped user' do
102
+ setup do
103
+ # prepare fixtures of model_permissions, user_groups, and
104
+ # user_group_users for read-only user of the
105
+ #login_as(:permitted_n_user_scoped_on_<%= table_name %>)
106
+ #@pi = create_page_info(@sssn, '<%= table_name %>', <%= class_name %>)
107
+ @<%= singular_table_name %> = <%= table_name %>(:one)
108
+ @<%= singular_table_name %>_scoped_out = <%= table_name %>(:two)
109
+ end
110
+
111
+ should 'search since role and user_scoped satisfy' do
112
+ skip 'search since role and user_scoped satisfy'
113
+ xhr :get, :search, edgarj_search_form: {col: 'id', val: @<%= singular_table_name %>.id},
114
+ id_target: "PARENT_MODEL_DOM_ID"
115
+ assert_response :success
116
+ assert_equal 1, assigns(:list).count
117
+ end
118
+
119
+ should 'not search since key is out-of-scope' do
120
+ skip 'not search since key is out-of-scope'
121
+ xhr :get, :search, edgarj_search_form: {col: 'id', val: @<%= singular_table_name %>_scoped_out.id},
122
+ id_target: "PARENT_MODEL_DOM_ID"
123
+ assert_response :success
124
+ assert_equal 0, assigns(:list).count
125
+ end
126
+ end
127
+
128
+ context 'not-permitted user' do
129
+ setup do
130
+ login_as(:not_permitted)
131
+ @pi = create_page_info(@sssn, '<%= table_name %>', <%= class_name %>)
132
+ end
133
+
134
+ should 'not get index' do
135
+ xhr :get, :index,
136
+ id_target: "PARENT_MODEL_DOM_ID"
137
+ assert_template 'message_popup'
138
+ assert_equal I18n.t('edgarj.default.permission_no'), flash[:error]
139
+ end
140
+
141
+ should 'not paginate' do
142
+ xhr :get, :index, page: 2,
143
+ id_target: "PARENT_MODEL_DOM_ID"
144
+ assert_template 'message_popup'
145
+ assert_equal I18n.t('edgarj.default.permission_no'), flash[:error]
146
+ end
147
+
148
+ should 'not sort' do
149
+ xhr :put, :page_info_save, id: @pi.id,
150
+ id_target: "PARENT_MODEL_DOM_ID",
151
+ edgarj_page_info: {
152
+ dir: 'asc',
153
+ order_by: 'created_at'
154
+ }
155
+ assert_template 'message_popup'
156
+ assert_equal I18n.t('edgarj.default.permission_no'), flash[:error]
157
+ end
158
+
159
+ should 'not search' do
160
+ xhr :get, :search, edgarj_search_form: {},
161
+ id_target: "PARENT_MODEL_DOM_ID"
162
+ assert_template 'message_popup'
163
+ assert_equal I18n.t('edgarj.default.permission_no'), flash[:error]
164
+ end
165
+ end
166
+
167
+ context 'not-login' do
168
+ should 'not get index' do
169
+ xhr :get, :index,
170
+ id_target: "PARENT_MODEL_DOM_ID"
171
+ assert_equal I18n.t('edgarj.default.login_failed'), flash[:error]
172
+ end
173
+
174
+ should 'not paginate' do
175
+ xhr :get, :index, page: 2,
176
+ id_target: "PARENT_MODEL_DOM_ID"
177
+ assert_equal I18n.t('edgarj.default.login_failed'), flash[:error]
178
+ end
179
+
180
+ should 'not sort' do
181
+ xhr :put, :page_info_save, id: 0,
182
+ id_target: "PARENT_MODEL_DOM_ID",
183
+ edgarj_page_info: {
184
+ dir: 'asc',
185
+ order_by: 'created_at'
186
+ }
187
+ assert_equal I18n.t('edgarj.default.login_failed'), flash[:error]
188
+ end
189
+
190
+ should 'not search' do
191
+ xhr :get, :search, edgarj_search_form: {},
192
+ id_target: "PARENT_MODEL_DOM_ID"
193
+ assert_equal I18n.t('edgarj.default.login_failed'), flash[:error]
194
+ end
195
+ end
196
+ end
197
+ <% end -%>
@@ -0,0 +1,9 @@
1
+ <% module_namespacing do -%>
2
+ module <%= class_name.pluralize %>PopupHelper
3
+ class <%= class_name %>PopupDrawer < Edgarj::Drawer::Popup
4
+ def initialize(view_context, params, page_info, model_class = <%= class_name %>)
5
+ super
6
+ end
7
+ end
8
+ end
9
+ <% end -%>
@@ -0,0 +1,17 @@
1
+ Description:
2
+ 'edgarj:scaffold' is similar to original scaffold, but adds the followings:
3
+
4
+ * CRUD with Ajax
5
+ * QBE search form
6
+ * sort by clicking list column header
7
+ * csv-download
8
+ * role-based access control on controller
9
+ * data-scope access control on data model
10
+
11
+ If you want to remove all the generated files, run
12
+ 'rails destroy edgarj/scaffold ModelName'.
13
+
14
+ Example:
15
+ `rails generate edgarj:scaffold Author name`
16
+ `rails generate edgarj:scaffold Book name desc:text author:belongs_to`
17
+ `rails generate edgarj:scaffold Purchase amount:decimal tracking_id:integer:uniq`
@@ -0,0 +1,40 @@
1
+ require 'rails/generators'
2
+
3
+ module Edgarj
4
+ class ScaffoldGenerator < Rails::Generators::NamedBase
5
+ include Rails::Generators::ResourceHelpers
6
+
7
+ source_root File.expand_path('../templates', __FILE__)
8
+ invoke :model, in: :rails
9
+
10
+ def add_edgarj_routes
11
+ route "edgarj_resources :#{file_name.pluralize}"
12
+ end
13
+
14
+ def create_controller_files
15
+ template 'controller.rb', File.join('app/controllers',
16
+ class_path, "#{controller_file_name}_controller.rb")
17
+ end
18
+
19
+ hook_for :test_framework, as: :scaffold
20
+ hook_for :helper, in: :rails, as: :scaffold do |invoked|
21
+ invoke invoked, [ controller_name ]
22
+ end
23
+
24
+ =begin
25
+ private
26
+ # copied from TestUnit::Generators::ScaffoldGenerator
27
+ def attributes_hash
28
+ return if attributes_names.empty?
29
+
30
+ attributes_names.map do |name|
31
+ if %w(password password_confirmation).include?(name) && attributes.any?(&:password_digest?)
32
+ "#{name}: 'secret'"
33
+ else
34
+ "#{name}: @#{singular_table_name}.#{name}"
35
+ end
36
+ end.sort.join(', ')
37
+ end
38
+ =end
39
+ end
40
+ end
@@ -0,0 +1,13 @@
1
+ <% model_name = class_name.singularize -%>
2
+ <% if namespaced? -%>
3
+ require_dependency "<%= namespaced_file_path %>/application_controller"
4
+
5
+ <% end -%>
6
+ <% module_namespacing do -%>
7
+ class <%= controller_class_name %>Controller < Edgarj::EdgarjController
8
+ private
9
+ def drawer_class
10
+ <%= controller_class_name %>Helper::<%= model_name -%>Drawer
11
+ end
12
+ end
13
+ <% end -%>
@@ -0,0 +1,32 @@
1
+ if Rails.env != 'production'
2
+ require 'yard'
3
+
4
+ namespace :doc do
5
+ desc 'upload to sourceforge'
6
+ task up: [:yard, :gen_juli] do
7
+ sh <<-EOSH
8
+ cd doc/www
9
+ rsync -avz --delete . ido00,jjedgarj@web.sourceforge.net:htdocs/
10
+ EOSH
11
+ end
12
+
13
+ desc 'generate documents'
14
+ task :gen_juli do
15
+ sh <<-EOSH
16
+ unset RUBYOPT
17
+ (cd doc/doc-en; juli; juli sitemap; juli recent_update)
18
+ (cd doc/doc-jp; juli; juli sitemap; juli recent_update)
19
+ EOSH
20
+ end
21
+
22
+ YARD::Rake::YardocTask.new do |t|
23
+ #t.files = ['lib/**/*.rb', OTHER_PATHS] # optional
24
+
25
+ # NOTE: --exclude option value should be Regex rather than
26
+ # shell wildcard (e.g. foo/**/*.rb)
27
+ t.options = %w(--private -o doc/www/api
28
+ --exclude lib/edgarj/templates
29
+ --exclude lib/generators/edgarj/.*/templates)
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,18 @@
1
+ namespace :edgarj do
2
+ desc "build package under pkg/ with umask 002"
3
+ task :build_gem do
4
+ FileUtils.mkdir "/tmp/edgarj" if !File.directory?("/tmp/edgarj")
5
+ sh <<-EOSH
6
+ umask 002
7
+ git archive --format=tar --prefix=edgarj/ HEAD | gzip >/tmp/edgarj.tgz
8
+ cd /tmp/edgarj &&
9
+ tar zxvf /tmp/edgarj.tgz &&
10
+ cd edgarj &&
11
+ gem build edgarj.gemspec
12
+ EOSH
13
+
14
+ FileUtils.mkdir "pkg" if !File.directory?("pkg")
15
+ sh "mv /tmp/edgarj/edgarj/edgarj-*.gem pkg/"
16
+ sh "rm -r /tmp/edgarj"
17
+ end
18
+ end
data/locale/en.yml ADDED
@@ -0,0 +1,94 @@
1
+ en:
2
+ # active record column
3
+ activerecord:
4
+ models:
5
+ edgarj/address: Address
6
+ edgarj/model_permission: Role
7
+ edgarj/sssn: Session
8
+ edgarj/user: User
9
+ edgarj/user_group: Group
10
+ edgarj/user_group_user: Group - User
11
+ edgarj/zip_address: Zip - Address
12
+ attributes:
13
+ edgarj/address:
14
+ zip: Zip
15
+ prefecture: State
16
+ city: City/County
17
+ town: Town
18
+ other: Street
19
+ other2: Bldg/Floor
20
+ other3: (Reserved)
21
+ other4: (Reserved)
22
+ edgarj/model_permission:
23
+ flags: Access Type
24
+ edgarj/user:
25
+ code: Login Id
26
+ password_confirmation: Password (confirmation)
27
+ edgarj/zip_address:
28
+ zip: Zip
29
+ prefecture: State
30
+ city: City/County
31
+ town: Town
32
+ # active model column
33
+ activemodel:
34
+ attributes:
35
+ edgarj/search_form:
36
+ _id: Id
37
+ edgarj/search_popup:
38
+ val: Value
39
+
40
+ # controller human name
41
+ #
42
+ # if derived model class name is not defined at activerecord.models,
43
+ # then definition here is used.
44
+ controller:
45
+ #edgarj/addresses: Address
46
+
47
+ edgarj:
48
+ # Edgarj specific time format
49
+ time:
50
+ format: ! '%b %d,%Y %H:%M:%S'
51
+ form:
52
+ delete_confirm: 'Really Delete?'
53
+ popup:
54
+ title: '%s Selection'
55
+ message_popup:
56
+ title: 'Message'
57
+ view:
58
+ sssns:
59
+ login: 'Login'
60
+ login_success: 'Logged in!'
61
+ login_failed: 'Logged failed!'
62
+ logout: 'Logged out!'
63
+
64
+ # final fallback is here.
65
+ #
66
+ # NOTE: even if humanize() is enough in some cases (e.g. name: 'Name')
67
+ # I18n is defined here because those are used in Edgarj plugin:
68
+ default:
69
+ clear: 'Clear'
70
+ close: 'Close'
71
+ create: 'Create'
72
+ created_at: 'Created at'
73
+ csv_download: 'CSV Download'
74
+ date: Date
75
+ delete: 'Delete'
76
+ kind: 'Kind'
77
+ login_failed: 'Login failed'
78
+ logout: 'Logout'
79
+ name: 'Name'
80
+ not_found: 'Not found'
81
+ parent: 'Parent'
82
+ password: 'Password'
83
+ permission_no: You don't have enough permission.
84
+ read: 'Read'
85
+ save: 'Save'
86
+ search_form: 'Search Form'
87
+ seq: 'Sequence'
88
+ total_records: Total %d Records
89
+ updated_at: 'Update'
90
+ updated_at: 'Updated at'
91
+ zip_complete: 'to Address'
92
+
93
+ # just for test purpose
94
+ test_column: 'TEST COLUMN in global!!'
data/locale/ja.yml ADDED
@@ -0,0 +1,100 @@
1
+ ja:
2
+ # active record column
3
+ activerecord:
4
+ models:
5
+ edgarj/address: 住所
6
+ edgarj/model_permission: 権限
7
+ edgarj/sssn: セッション
8
+ edgarj/user: ユーザ
9
+ edgarj/user_group: グループ
10
+ edgarj/user_group_user: ユーザのグループ所属
11
+ edgarj/zip_address: 〒→住所
12
+ attributes:
13
+ edgarj/address:
14
+ zip: 〒
15
+ prefecture: 都道府県
16
+ city: 市・郡
17
+ town: 町・村
18
+ other: 番地
19
+ other2: ビル・フロア
20
+ other3: (未使用)
21
+ other4: (未使用)
22
+ edgarj/model_permission:
23
+ flags: アクセス種類
24
+ edgarj/user:
25
+ code: ログインId
26
+ password_confirmation: パスワード(確認)
27
+ edgarj/zip_address:
28
+ zip: 〒
29
+ prefecture: 都道府県
30
+ city: 市・郡
31
+ town: 町・村
32
+ # active model column
33
+ activemodel:
34
+ attributes:
35
+ edgarj/search_form:
36
+ _id: Id
37
+ edgarj/search_popup:
38
+ val: 値
39
+
40
+ views:
41
+ pagination:
42
+ first: "&laquo; 最初"
43
+ last: "最後 &raquo;"
44
+ previous: "&lsaquo; 前"
45
+ next: "次 &rsaquo;"
46
+ truncate: "&hellip;"
47
+
48
+ # コントローラ名
49
+ #
50
+ # もしコントローラから導出されるモデルのラベルが activerecord.models で
51
+ # 定義されてない場合、ここの定義が使用されます。
52
+ controller:
53
+ #edgarj/addresses: 住所
54
+
55
+ edgarj:
56
+ # Edgarj specific time format
57
+ time:
58
+ format: ! '%Y/%m/%d %H:%M:%S'
59
+ form:
60
+ delete_confirm: '本当に削除しますか?'
61
+ popup:
62
+ title: '%s 選択'
63
+ message_popup:
64
+ title: 'メッセージ'
65
+ view:
66
+ sssns:
67
+ login: 'ログイン'
68
+ login_success: 'ログインしました。'
69
+ login_failed: 'ログインに失敗しました。'
70
+ logout: 'ログアウトしました。'
71
+ # final fallback is here.
72
+ default:
73
+ clear: 'クリア'
74
+ close: '閉じる'
75
+ create: '作成'
76
+ created_at: '作成日時'
77
+ csv_download: 'csvダウンロード'
78
+ date: '日付'
79
+ delete: '削除'
80
+ kind: '種類'
81
+ login_failed: 'ログインできません。'
82
+ logout: 'ログアウト'
83
+ name: '名前'
84
+ not_found: 'Not found'
85
+ parent: '親'
86
+ password: 'パスワード'
87
+ permission_no: '権限がありません。'
88
+ read: '参照'
89
+ records_per_page: '件/頁'
90
+ save: '保存'
91
+ search: '検索'
92
+ search_clear: 'クリア'
93
+ search_end: '検索終了'
94
+ search_form: '検索フォーム'
95
+ search_save: '検索条件保存(未実装)'
96
+ seq: '順序'
97
+ total_records: 計 %d件
98
+ update: '更新'
99
+ updated_at: '更新日時'
100
+ zip_complete: '〒→住所'
@@ -0,0 +1,28 @@
1
+ == README
2
+
3
+ This README would normally document whatever steps are necessary to get the
4
+ application up and running.
5
+
6
+ Things you may want to cover:
7
+
8
+ * Ruby version
9
+
10
+ * System dependencies
11
+
12
+ * Configuration
13
+
14
+ * Database creation
15
+
16
+ * Database initialization
17
+
18
+ * How to run the test suite
19
+
20
+ * Services (job queues, cache servers, search engines, etc.)
21
+
22
+ * Deployment instructions
23
+
24
+ * ...
25
+
26
+
27
+ Please feel free to use a different markup language if you do not plan to run
28
+ <tt>rake doc:app</tt>.
@@ -0,0 +1,6 @@
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
+
4
+ require File.expand_path('../config/application', __FILE__)
5
+
6
+ Dummy::Application.load_tasks
@@ -0,0 +1,21 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // compiled file.
9
+ //
10
+ // Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
11
+ // about supported directives.
12
+ //
13
+ //= require jquery
14
+ //= require jquery_ujs
15
+ //= require jquery-ui
16
+ //= require jquery-ui/datepicker-ja
17
+ //= require jquery.remotipart
18
+ //= require edgarj/base
19
+ //= require edgarj/menu
20
+ //= require edgarj/operator_selection
21
+ //= require_tree .
@@ -0,0 +1,2 @@
1
+ // Place all the behaviors and hooks related to the matching controller here.
2
+ // All this logic will automatically be available in application.js.
@@ -0,0 +1,16 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the top of the
9
+ * compiled file, but it's generally better to create a new file per style scope.
10
+ *
11
+ *= require jquery-ui
12
+ *= require edgarj/base
13
+ *= require edgarj/menu
14
+ *= require_self
15
+ *= require_tree .
16
+ */
@@ -0,0 +1,4 @@
1
+ /*
2
+ Place all the styles related to the matching controller here.
3
+ They will automatically be included in application.css.
4
+ */
@@ -0,0 +1,56 @@
1
+ body { background-color: #fff; color: #333; }
2
+
3
+ body, p, ol, ul, td {
4
+ font-family: verdana, arial, helvetica, sans-serif;
5
+ font-size: 13px;
6
+ line-height: 18px;
7
+ }
8
+
9
+ pre {
10
+ background-color: #eee;
11
+ padding: 10px;
12
+ font-size: 11px;
13
+ }
14
+
15
+ a { color: #000; }
16
+ a:visited { color: #666; }
17
+ a:hover { color: #fff; background-color:#000; }
18
+
19
+ div.field, div.actions {
20
+ margin-bottom: 10px;
21
+ }
22
+
23
+ #notice {
24
+ color: green;
25
+ }
26
+
27
+ .field_with_errors {
28
+ padding: 2px;
29
+ background-color: red;
30
+ display: table;
31
+ }
32
+
33
+ #error_explanation {
34
+ width: 450px;
35
+ border: 2px solid red;
36
+ padding: 7px;
37
+ padding-bottom: 0;
38
+ margin-bottom: 20px;
39
+ background-color: #f0f0f0;
40
+ }
41
+
42
+ #error_explanation h2 {
43
+ text-align: left;
44
+ font-weight: bold;
45
+ padding: 5px 5px 5px 15px;
46
+ font-size: 12px;
47
+ margin: -7px;
48
+ margin-bottom: 0px;
49
+ background-color: #c00;
50
+ color: #fff;
51
+ }
52
+
53
+ #error_explanation ul li {
54
+ font-size: 12px;
55
+ list-style: square;
56
+ }