releaf 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (201) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +15 -12
  3. data/Rakefile +8 -0
  4. data/app/assets/javascripts/releaf/controllers/base.js +0 -40
  5. data/app/assets/javascripts/releaf/include/field.type_date_or_datetime_or_time.js +43 -0
  6. data/app/assets/javascripts/releaf/include/nested_fields.js +58 -65
  7. data/app/assets/javascripts/releaf/include/sortable.js +19 -17
  8. data/app/assets/stylesheets/releaf/controllers/releaf/content.css.erb +6 -0
  9. data/app/assets/stylesheets/releaf/include/field.css.erb +37 -13
  10. data/app/controllers/releaf/admins_controller.rb +13 -6
  11. data/app/controllers/releaf/base_application_controller.rb +4 -1
  12. data/app/controllers/releaf/base_controller.rb +415 -154
  13. data/app/controllers/releaf/content_controller.rb +62 -45
  14. data/app/controllers/releaf/roles_controller.rb +11 -9
  15. data/app/controllers/releaf/sessions_controller.rb +23 -1
  16. data/app/controllers/releaf/translations_controller.rb +21 -25
  17. data/app/helpers/releaf/admin_helper.rb +0 -20
  18. data/app/models/releaf/admin.rb +9 -0
  19. data/app/models/releaf/blank_node_base.rb +29 -0
  20. data/app/models/releaf/node.rb +6 -5
  21. data/app/models/releaf/node_base.rb +9 -3
  22. data/app/models/releaf/role.rb +9 -2
  23. data/app/views/layouts/releaf/admin.html.haml +12 -6
  24. data/app/views/layouts/releaf/devise.html.haml +32 -0
  25. data/app/views/releaf/aliases/{_edit.body.haml → _edit.body.html.haml} +0 -0
  26. data/app/views/releaf/aliases/{_edit.header.haml → _edit.header.html.haml} +1 -1
  27. data/app/views/releaf/aliases/_index.row.html.haml +5 -0
  28. data/app/views/releaf/aliases/{_secondary_panel.haml → _secondary_panel.html.haml} +0 -0
  29. data/app/views/releaf/base/_edit.body.html.haml +11 -0
  30. data/app/views/releaf/base/_edit.field.html.haml +23 -0
  31. data/app/views/releaf/base/{_edit.field.type_autocomplete.haml → _edit.field_type_autocomplete.html.haml} +1 -1
  32. data/app/views/releaf/base/{_edit.field.type_checkbox.haml → _edit.field_type_boolean.html.haml} +1 -1
  33. data/app/views/releaf/base/{_edit.field.type_date.haml → _edit.field_type_date.html.haml} +0 -0
  34. data/app/views/releaf/base/{_edit.field.type_datetime.haml → _edit.field_type_datetime.html.haml} +0 -0
  35. data/app/views/releaf/base/{_edit.field.type_delete_nested.haml → _edit.field_type_delete_nested.html.haml} +0 -0
  36. data/app/views/releaf/base/{_edit.field.type_file.haml → _edit.field_type_file.html.haml} +0 -0
  37. data/app/views/releaf/base/_edit.field_type_image.html.haml +12 -0
  38. data/app/views/releaf/base/_edit.field_type_item.html.haml +31 -0
  39. data/app/views/releaf/base/{_edit.field.type_link.haml → _edit.field_type_link.html.haml} +0 -0
  40. data/app/views/releaf/base/_edit.field_type_link_i18n.html.haml +26 -0
  41. data/app/views/releaf/base/{_edit.field.type_password.haml → _edit.field_type_password.html.haml} +0 -0
  42. data/app/views/releaf/base/{_edit.field.type_richtext.haml → _edit.field_type_richtext.html.haml} +0 -0
  43. data/app/views/releaf/base/{_edit.field.type_richtext_i18n.haml → _edit.field_type_richtext_i18n.html.haml} +0 -0
  44. data/app/views/releaf/base/{_edit.field.type_text.haml → _edit.field_type_text.html.haml} +0 -0
  45. data/app/views/releaf/base/{_edit.field.type_text_i18n.haml → _edit.field_type_text_i18n.html.haml} +0 -0
  46. data/app/views/releaf/base/{_edit.field.type_textarea.haml → _edit.field_type_textarea.html.haml} +0 -0
  47. data/app/views/releaf/base/{_edit.field.type_textarea_i18n.haml → _edit.field_type_textarea_i18n.html.haml} +0 -0
  48. data/app/views/releaf/base/{_edit.field.type_time.haml → _edit.field_type_time.html.haml} +0 -0
  49. data/app/views/releaf/base/_edit.fields.association.html.haml +48 -0
  50. data/app/views/releaf/base/_edit.fields.has_many_template.html.haml +15 -0
  51. data/app/views/releaf/base/_edit.fields.html.haml +20 -0
  52. data/app/views/releaf/base/{_edit.footer.haml → _edit.footer.html.haml} +2 -2
  53. data/app/views/releaf/base/_edit.form.html.haml +4 -0
  54. data/app/views/releaf/base/_edit.header.html.haml +3 -0
  55. data/app/views/releaf/base/{_index.body.haml → _index.body.html.haml} +2 -2
  56. data/app/views/releaf/base/_index.cell.html.haml +20 -0
  57. data/app/views/releaf/base/_index.footer.html.haml +28 -0
  58. data/app/views/releaf/base/_index.header.html.haml +4 -0
  59. data/app/views/releaf/base/_index.row.html.haml +6 -0
  60. data/app/views/releaf/base/_index.search.html.haml +5 -0
  61. data/app/views/releaf/base/_index.table.html.haml +24 -0
  62. data/app/views/releaf/base/_secondary_panel.html.haml +10 -0
  63. data/app/views/releaf/base/_show.body.html.haml +3 -0
  64. data/app/views/releaf/base/_show.field.html.haml +20 -0
  65. data/app/views/releaf/base/_show.field_type_date.html.haml +9 -0
  66. data/app/views/releaf/base/_show.field_type_date_time.html.haml +9 -0
  67. data/app/views/releaf/base/_show.field_type_email.html.haml +6 -0
  68. data/app/views/releaf/base/_show.field_type_file.html.haml +7 -0
  69. data/app/views/releaf/base/_show.field_type_image.html.haml +10 -0
  70. data/app/views/releaf/base/_show.field_type_item.html.haml +11 -0
  71. data/app/views/releaf/base/_show.field_type_link.html.haml +14 -0
  72. data/app/views/releaf/base/_show.field_type_password.html.haml +6 -0
  73. data/app/views/releaf/base/_show.field_type_richtext.html.haml +6 -0
  74. data/app/views/releaf/base/_show.field_type_text.html.haml +6 -0
  75. data/app/views/releaf/base/_show.field_type_textarea.html.haml +6 -0
  76. data/app/views/releaf/base/_show.field_type_time.html.haml +9 -0
  77. data/app/views/releaf/base/_show.field_type_url.html.haml +7 -0
  78. data/app/views/releaf/base/_show.fields.association.html.haml +36 -0
  79. data/app/views/releaf/base/_show.fields.has_many_template.html.haml +12 -0
  80. data/app/views/releaf/base/_show.fields.html.haml +17 -0
  81. data/app/views/releaf/base/{_show.footer.haml → _show.footer.html.haml} +6 -4
  82. data/app/views/releaf/base/_show.header.html.haml +3 -0
  83. data/app/views/releaf/base/confirm_destroy.html.haml +17 -0
  84. data/app/views/releaf/base/edit.html.haml +1 -0
  85. data/app/views/releaf/base/index.html.haml +3 -0
  86. data/app/views/releaf/base/new.html.haml +1 -0
  87. data/app/views/releaf/base/show.html.haml +3 -0
  88. data/app/views/releaf/content/{_edit.body.haml → _edit.body.html.haml} +7 -6
  89. data/app/views/releaf/content/_edit.content_fields.html.haml +11 -0
  90. data/app/views/releaf/content/_edit.fields.html.haml +17 -0
  91. data/app/views/releaf/content/{_edit.slug.haml → _edit.slug.html.haml} +0 -0
  92. data/app/views/releaf/content/{_get_content_form.haml → _get_content_form.html.haml} +2 -2
  93. data/app/views/releaf/content/{_secondary_panel.haml → _secondary_panel.html.haml} +0 -0
  94. data/app/views/releaf/content/{_tree_level.haml → _tree_level.html.haml} +0 -0
  95. data/app/views/releaf/content/{ajax.new.haml → ajax.new.html.haml} +0 -0
  96. data/app/views/releaf/content/{index.haml → index.html.haml} +0 -0
  97. data/app/views/releaf/roles/_edit.field.permissions.html.haml +5 -0
  98. data/app/views/releaf/roles/{_show.field.default.haml → _show.field.default.html.haml} +1 -1
  99. data/app/views/releaf/roles/{_show.field.permissions.haml → _show.field.permissions.html.haml} +2 -2
  100. data/app/views/releaf/translations/{_edit.body.haml → _edit.body.html.haml} +0 -0
  101. data/app/views/releaf/translations/{_edit.header.haml → _edit.header.html.haml} +1 -1
  102. data/app/views/releaf/translations/_index.row.html.haml +5 -0
  103. data/app/views/releaf/translations/{_secondary_panel.haml → _secondary_panel.html.haml} +0 -0
  104. data/lib/generators/releaf/templates/initializers/releaf.rb +0 -39
  105. data/lib/generators/releaf/templates/initializers/releaf_i18n.rb +17 -0
  106. data/lib/generators/releaf/templates/javascripts/3rd_party/jquery.jcarousel.js +1058 -0
  107. data/lib/generators/releaf/templates/javascripts/lib/init_jcarousel.js +40 -0
  108. data/lib/generators/releaf/templates/migrations/create_releaf_roles.rb +1 -0
  109. data/lib/generators/releaf/templates/migrations/create_releaf_tinymce_assets.rb +1 -0
  110. data/lib/generators/releaf/templates/models/admin_ability.rb +1 -1
  111. data/lib/i18n/backend/releaf.rb +5 -4
  112. data/lib/i18n/backend/releaf/translation.rb +5 -0
  113. data/lib/i18n/backend/releaf/translation_data.rb +7 -0
  114. data/lib/i18n/backend/releaf/translation_group.rb +4 -0
  115. data/lib/releaf.rb +4 -0
  116. data/lib/releaf/boolean_at.rb +77 -0
  117. data/lib/releaf/globalize3/fallbacks.rb +19 -0
  118. data/lib/releaf/resources.rb +101 -0
  119. data/lib/releaf/slug.rb +99 -60
  120. data/lib/releaf/version.rb +1 -1
  121. data/spec/spec_helper.rb +6 -0
  122. data/templates/releaf/installer.rb +15 -4
  123. metadata +275 -329
  124. data/app/views/releaf/aliases/_index.row.haml +0 -5
  125. data/app/views/releaf/base/_edit.body.haml +0 -19
  126. data/app/views/releaf/base/_edit.field.haml +0 -96
  127. data/app/views/releaf/base/_edit.field.type_image.haml +0 -14
  128. data/app/views/releaf/base/_edit.field.type_select.haml +0 -11
  129. data/app/views/releaf/base/_edit.form.haml +0 -4
  130. data/app/views/releaf/base/_edit.has_many_associations.haml +0 -45
  131. data/app/views/releaf/base/_edit.header.haml +0 -3
  132. data/app/views/releaf/base/_index.cell.haml +0 -19
  133. data/app/views/releaf/base/_index.footer.haml +0 -22
  134. data/app/views/releaf/base/_index.header.haml +0 -4
  135. data/app/views/releaf/base/_index.row.haml +0 -6
  136. data/app/views/releaf/base/_index.search.haml +0 -5
  137. data/app/views/releaf/base/_index.table.haml +0 -8
  138. data/app/views/releaf/base/_secondary_panel.haml +0 -9
  139. data/app/views/releaf/base/_show.body.haml +0 -7
  140. data/app/views/releaf/base/_show.field.haml +0 -78
  141. data/app/views/releaf/base/_show.field.type_html.haml +0 -1
  142. data/app/views/releaf/base/_show.header.haml +0 -3
  143. data/app/views/releaf/base/confirm_destroy.haml +0 -10
  144. data/app/views/releaf/base/edit.haml +0 -1
  145. data/app/views/releaf/base/index.haml +0 -3
  146. data/app/views/releaf/base/new.haml +0 -1
  147. data/app/views/releaf/base/show.haml +0 -3
  148. data/app/views/releaf/content/_edit.content_fields.haml +0 -19
  149. data/app/views/releaf/content/_show.field.content.haml +0 -11
  150. data/app/views/releaf/roles/_edit.field.admins.haml +0 -0
  151. data/app/views/releaf/roles/_edit.field.permissions.haml +0 -5
  152. data/app/views/releaf/translations/_index.row.haml +0 -5
  153. data/spec/dummy/README.rdoc +0 -261
  154. data/spec/dummy/Rakefile +0 -7
  155. data/spec/dummy/app/assets/images/rails.png +0 -0
  156. data/spec/dummy/app/assets/javascripts/application.js +0 -15
  157. data/spec/dummy/app/assets/stylesheets/application.css +0 -13
  158. data/spec/dummy/app/controllers/application_controller.rb +0 -3
  159. data/spec/dummy/app/helpers/application_helper.rb +0 -2
  160. data/spec/dummy/app/models/admin_ability.rb +0 -51
  161. data/spec/dummy/app/models/settings.rb +0 -2
  162. data/spec/dummy/app/views/layouts/application.html.haml +0 -10
  163. data/spec/dummy/config.ru +0 -4
  164. data/spec/dummy/config/application.rb +0 -68
  165. data/spec/dummy/config/boot.rb +0 -6
  166. data/spec/dummy/config/common_fields.yml.example +0 -17
  167. data/spec/dummy/config/database.yml +0 -42
  168. data/spec/dummy/config/environment.rb +0 -5
  169. data/spec/dummy/config/environments/development.rb +0 -37
  170. data/spec/dummy/config/environments/production.rb +0 -67
  171. data/spec/dummy/config/environments/test.rb +0 -37
  172. data/spec/dummy/config/initializers/backtrace_silencers.rb +0 -7
  173. data/spec/dummy/config/initializers/devise.rb +0 -232
  174. data/spec/dummy/config/initializers/dragonfly.rb +0 -1
  175. data/spec/dummy/config/initializers/inflections.rb +0 -15
  176. data/spec/dummy/config/initializers/mime_types.rb +0 -5
  177. data/spec/dummy/config/initializers/releaf.rb +0 -59
  178. data/spec/dummy/config/initializers/releaf_i18n.rb +0 -8
  179. data/spec/dummy/config/initializers/releaf_store_current_template.rb +0 -25
  180. data/spec/dummy/config/initializers/secret_token.rb +0 -7
  181. data/spec/dummy/config/initializers/session_store.rb +0 -8
  182. data/spec/dummy/config/initializers/wrap_parameters.rb +0 -14
  183. data/spec/dummy/config/locales/devise.en.yml +0 -58
  184. data/spec/dummy/config/locales/en.yml +0 -5
  185. data/spec/dummy/config/routes.rb +0 -11
  186. data/spec/dummy/db/migrate/20130204164516_create_settings.rb +0 -17
  187. data/spec/dummy/db/migrate/20130204164523_create_releaf_nodes.rb +0 -25
  188. data/spec/dummy/db/migrate/20130204164524_create_releaf_roles.rb +0 -11
  189. data/spec/dummy/db/migrate/20130204164525_create_releaf_translations.rb +0 -31
  190. data/spec/dummy/db/migrate/20130204164526_create_releaf_admins.rb +0 -53
  191. data/spec/dummy/db/schema.rb +0 -112
  192. data/spec/dummy/db/seeds.rb +0 -64
  193. data/spec/dummy/doc/README_FOR_APP +0 -2
  194. data/spec/dummy/log/development.log +0 -74
  195. data/spec/dummy/log/test.log +0 -129
  196. data/spec/dummy/public/404.html +0 -26
  197. data/spec/dummy/public/422.html +0 -26
  198. data/spec/dummy/public/500.html +0 -25
  199. data/spec/dummy/public/favicon.ico +0 -0
  200. data/spec/dummy/script/rails +0 -6
  201. data/spec/dummy/tmp/cache/9C5/660/settings%3Ai18n_updated_at +0 -1
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 0560889a4c9f9bbfad922e22b7a6a22daf49e7cf
4
+ data.tar.gz: 20582215d646200c722e10bbc1787466162d931b
5
+ SHA512:
6
+ metadata.gz: 288b4b11e3d7668d98c54d77dbe61da14d2d83b03a41569f91406e448ceb1bb719e44db4f722f280581751720f252f17205dd19fdb67f6236ad72773530d0f21
7
+ data.tar.gz: 5d64688b47c6ee3ad126ec7ea67569e05adeb2707349b788d90af0b20cf29e2b0c68c4564659c96f30954b80d15f7c7c9a04a99e12ff82754e0816fb32c82925
data/README.md CHANGED
@@ -1,11 +1,14 @@
1
1
  ## Releaf
2
2
 
3
- Releaf is Admin interface for Rails projects
3
+ Releaf is Admin interface for Rails projects.
4
+
5
+ Documentation: http://cubesystems.github.com/releaf/
4
6
 
5
7
  ## Getting started
6
8
 
7
9
  Releaf will work with Rails 3.2.
8
10
  You can add it to your Gemfile with:
11
+
9
12
  ```ruby
10
13
  gem 'will_paginate', '~> 3.0.4'
11
14
  gem 'acts_as_list'
@@ -26,25 +29,26 @@ gem 'strong_parameters'
26
29
  gem 'tinymce-rails', '~> 3.5.8'
27
30
  gem 'tinymce-rails-imageupload'
28
31
  gem 'will_paginate', '~> 3.0.4'
29
- gem 'yui-rails', :git => 'https://github.com/ConnectCubed-Open/yui-rails'
32
+ gem 'yui-rails', '~> 0.2.0'
30
33
  ```
31
34
 
32
35
  Run the bundle command to install it.
33
36
 
34
37
  Now in config/application.rb set
38
+
35
39
  ```ruby
36
- config.active_record.whitelist_attributes = false
40
+ config.active_record.whitelist_attributes = false
37
41
  ```
38
- because releaf is expacting strog_params gem to be used
39
42
 
43
+ because releaf is expacting strog_params gem to be used
40
44
 
41
45
  ```console
42
46
  rails generate settings settings
43
47
  rake db:migrate
44
48
  ```
45
49
 
46
-
47
50
  After you install Releaf, you need to run the generator:
51
+
48
52
  ```console
49
53
  rails generate releaf:install
50
54
  rails generate i18n:releaf:install
@@ -56,17 +60,16 @@ The generator will install an initializer which describes Releaf routes and conf
56
60
 
57
61
  Now you need to add something like this for releaf itself and standart admin,
58
62
  permissions controllers
63
+
59
64
  ```ruby
60
- mount_releaf_at '/admin'
61
- namespace :admin do
62
- resources :admins, :roles do
63
- get :confirm_destroy, :on => :member
64
- match :urls, :on => :collection
65
- end
66
- end
65
+ mount_releaf_at '/admin'
66
+ namespace :admin do
67
+ releaf_resources :admins, :roles
68
+ end
67
69
  ```
68
70
 
69
71
  Add dragonfly initializer (/config/initializers/dragonfly.rb)
72
+
70
73
  ```ruby
71
74
  require 'dragonfly/rails/images'
72
75
  ```
data/Rakefile CHANGED
@@ -21,6 +21,14 @@ RDoc::Task.new(:rdoc) do |rdoc|
21
21
  rdoc.rdoc_files.include('app/**/*.rb')
22
22
  end
23
23
 
24
+ desc "Run specs and generate coverage report."
25
+ task :ci do
26
+ rm_rf "coverage" if File.exists? 'coverage'
27
+ ENV['RAILS_ENV'] = 'test'
28
+ ENV['COVERAGE'] ||= 'y'
29
+ Rake::Task[:spec].invoke
30
+ end
31
+
24
32
  desc 'Dummy test app tasks'
25
33
  namespace :dummy do
26
34
  desc 'Remove current dummy app'
@@ -120,46 +120,6 @@ jQuery(function()
120
120
 
121
121
 
122
122
 
123
- // initialize date/datetime/time pickers
124
- jQuery(document.body).delegate('form', 'initcalendars', function() {
125
- var forms = jQuery(this);
126
- var options = {
127
- timeFormat: 'HH:mm:ss',
128
- controlType: 'select',
129
- showHour: true,
130
- showMinute: true,
131
- // showSecond: true,
132
- // showTimezone: true,
133
- }
134
-
135
- forms.find('.date_picker').each(function() {
136
- var picker = jQuery(this);
137
- var opt = options;
138
- opt['dateFormat'] = picker.attr('data-date-format') || 'yy-mm-dd';
139
- picker.datepicker(opt);
140
- });
141
-
142
- forms.find('.datetime_picker').each(function() {
143
- var picker = jQuery(this);
144
- var opt = options;
145
- opt['dateFormat'] = picker.attr('data-date-format') || 'yy-mm-dd';
146
- opt['pickerTimeFormat'] = picker.attr('data-time-format') || 'HH:mm'
147
- picker.datetimepicker(opt);
148
- });
149
-
150
- /*
151
- * forms.find('.time_picker').each(function() {
152
- * var picker = jQuery(this);
153
- * var opt = options;
154
- * opt['pickerTimeFormat'] = picker.attr('data-time-format') || 'HH:mm'
155
- * picker.timepicker(options);
156
- * });
157
- */
158
- });
159
-
160
- jQuery('form').trigger('initcalendars');
161
-
162
-
163
123
  jQuery('form').on('keyup, change', '.sync_field', function(e) {
164
124
  var input = jQuery(e.target);
165
125
  var value_div = input.parents('.value:first');
@@ -0,0 +1,43 @@
1
+ jQuery(document).ready(function() {
2
+ // initialize date/datetime/time pickers
3
+ jQuery(document.body).delegate('form', 'initcalendars', function() {
4
+ var forms = jQuery(this);
5
+ var options = {
6
+ timeFormat: 'HH:mm:ss',
7
+ controlType: 'select',
8
+ showHour: true,
9
+ showMinute: true,
10
+ changeMonth: true,
11
+ changeYear: true
12
+ // showSecond: true,
13
+ // showTimezone: true,
14
+ }
15
+
16
+ forms.find('.date_picker').each(function() {
17
+ var picker = jQuery(this);
18
+ var opt = options;
19
+ opt['dateFormat'] = picker.attr('data-date-format') || 'yy-mm-dd';
20
+ picker.datepicker(opt);
21
+ });
22
+
23
+ forms.find('.datetime_picker').each(function() {
24
+ var picker = jQuery(this);
25
+ var opt = options;
26
+ opt['dateFormat'] = picker.attr('data-date-format') || 'yy-mm-dd';
27
+ opt['pickerTimeFormat'] = picker.attr('data-time-format') || 'HH:mm'
28
+ picker.datetimepicker(opt);
29
+ });
30
+
31
+ /*
32
+ * forms.find('.time_picker').each(function() {
33
+ * var picker = jQuery(this);
34
+ * var opt = options;
35
+ * opt['pickerTimeFormat'] = picker.attr('data-time-format') || 'HH:mm'
36
+ * picker.timepicker(options);
37
+ * });
38
+ */
39
+ });
40
+
41
+ jQuery('form').trigger('initcalendars');
42
+
43
+ });
@@ -1,71 +1,64 @@
1
- jQuery(function()
1
+ jQuery(document).ready(function()
2
2
  {
3
- var forms = jQuery('form');
4
3
 
5
- forms.each(function()
6
- {
7
- var form = jQuery( this );
8
- form.find( '.nested_wrap' ).each(function()
9
- {
10
- var nested = jQuery( this );
11
- var list = nested.find( '.list:first' );
12
- var template = jQuery( '<div></div>' ).append( nested.find( '.template:first' ).clone().removeClass( 'template' ) ).html();
4
+ jQuery(document.body).on('click', '.nested_wrap .add', function(e) {
5
+ e.stopPropagation;
6
+ var button = jQuery(e.target);
7
+ var nested_wrap = button.parents('.nested_wrap:first');
8
+ var key = 'on-' + new Date().getTime();
9
+ var template = jQuery( '<div></div>' ).append( nested_wrap.find( '.template:first' ).clone().removeClass( 'template' ) ).html();
10
+ var item = jQuery( template.replace( /(".*?)(_template_)(.*?")/g, '$1' + key + '$3' ) );
11
+ var list = nested_wrap.find( '.list:first' );
12
+ list.append( item );
13
13
 
14
- nested.on( 'click', '.add', function()
15
- {
16
- var key = 'on-' + new Date().getTime();
17
- var item = jQuery( template.replace( /(".*?)(_template_)(.*?")/g, '$1' + key + '$3' ) );
18
- list.append( item );
19
- if( item.is('tr') )
20
- {
21
- item.fadeIn( 'normal' );
22
- item.trigger('itemadd');
23
- }
24
- else
25
- {
26
- item.css({ opacity: 0 });
27
- item.slideDown( 'fast', function()
28
- {
29
- item.css({ opacity: '' });
30
- item.find( 'input:first' ).focus();
31
- item.hide();
32
- item.fadeIn( 'fast' );
33
- item.trigger('itemadd');
34
- });
35
- }
36
- });
37
14
 
38
- nested.on( 'click', '.remove', function()
39
- {
40
- var item = jQuery( this ).parents( '.item' );
41
- var destroy = item.find( '.destroy' );
42
- var end = function()
43
- {
44
- item.hide();
45
- item.trigger('itemremoveend');
46
- if( destroy.length > 0 )
47
- {
48
- destroy.val( true );
49
- }
50
- else
51
- {
52
- item.remove();
53
- }
54
- }
55
- if( item.is('tr') )
56
- {
57
- item.fadeOut( 'fast', end );
58
- }
59
- else
60
- {
61
- item.fadeOut( 'fast', function()
62
- {
63
- item.css( 'opacity', 0 ).show().slideUp( 'fast', end );
64
- });
65
- }
66
- item.trigger('itemremove');
67
- });
68
- });
69
- });
15
+ if( item.is('tr') )
16
+ {
17
+ item.fadeIn( 'normal' );
18
+ item.trigger('itemadd');
19
+ }
20
+ else
21
+ {
22
+ item.css({ opacity: 0 });
23
+ item.slideDown( 'fast', function()
24
+ {
25
+ item.css({ opacity: 1 });
26
+ item.find( 'input:first' ).focus();
27
+ item.hide();
28
+ item.fadeIn( 'fast' );
29
+ item.trigger('itemadd');
30
+ });
31
+ }
32
+
33
+ });
34
+
35
+
36
+ jQuery(document.body).on('click', '.nested_wrap .remove', function(e) {
37
+ e.stopPropagation;
38
+ var button = jQuery(e.target);
39
+ var item = button.parents('.item:first');
40
+ var destroy = item.find('input.destroy');
41
+
42
+ var remove_item = function()
43
+ {
44
+ item.css('display', 'none');
45
+ item.trigger('itemremoveend');
46
+ if ( destroy.length > 0 )
47
+ {
48
+ destroy.val( true );
49
+ }
50
+ else
51
+ {
52
+ item.remove();
53
+ }
54
+ }
55
+
56
+
57
+ item.css('overflow', 'hidden');
58
+ item.animate({opacity: 0, height: 0}, 'fast', 'swing', remove_item)
59
+
60
+ item.trigger('itemremove');
61
+
62
+ });
70
63
 
71
64
  });
@@ -1,25 +1,27 @@
1
1
  jQuery(document).ready(function() {
2
- jQuery('.list[data-sortable]').sortable({
3
- axis: "y",
4
- ontainment: "parent",
5
- cursor: "move",
6
- delay: 150,
7
- distance: 5,
8
- handle: '> .handle',
9
- items: "> .item",
10
- scroll: true,
11
- update: function( event, ui ) {
12
- jQuery(this).trigger('sortableupdate');
13
- }
14
- });
15
2
 
16
- jQuery('[data-sortable]').on('sortableupdate', function() {
17
- var sortable_container = jQuery(this);
18
- sortable_container.find('> .item > input[type="hidden"].position').each(function(i) {
19
- jQuery(this).attr('value', i);
3
+ jQuery(document.body).on('initsortable', function(e) {
4
+ jQuery(e.target).find('.list[data-sortable]').sortable({
5
+ axis: "y",
6
+ ontainment: "parent",
7
+ cursor: "move",
8
+ delay: 150,
9
+ distance: 5,
10
+ handle: '> .handle',
11
+ items: "> .item",
12
+ scroll: true,
13
+ update: function( event, ui ) {
14
+ jQuery(this).trigger('sortableupdate');
15
+ }
20
16
  });
21
17
  });
22
18
 
19
+ jQuery(document.body).trigger('initsortable');
20
+
21
+ jQuery( document.body ).on('itemadd', function (e) {
22
+ jQuery(e.target).trigger('initsortable');
23
+ });
24
+
23
25
  jQuery( document.body ).on('itemadd', '.list[data-sortable]', function (e) {
24
26
  jQuery(e.target).trigger('sortableupdate');
25
27
  });
@@ -159,6 +159,11 @@
159
159
  margin-left: 0;
160
160
  display: inline-block;
161
161
  }
162
+ .controller-releaf-content .global_fields .value span
163
+ {
164
+ padding-top: 2px;
165
+ display: inline-block;
166
+ }
162
167
  .controller-releaf-content .global_fields select
163
168
  {
164
169
  width: 158px;
@@ -407,6 +412,7 @@ margin: 0;
407
412
  }
408
413
  .controller-releaf-content .nested_object .field {
409
414
  border-bottom: 1px dotted #DDD;
415
+ margin: 0;
410
416
  }
411
417
  .controller-releaf-content .field .object_url {
412
418
  padding-left: 85px;
@@ -78,31 +78,38 @@
78
78
  }
79
79
 
80
80
  /* type: textarea */
81
- .field.type_textarea,
82
- .field.type_richtext
81
+ .create-feature .field.type_textarea,
82
+ .create-feature .field.type_richtext,
83
+ .edit-feature .field.type_textarea,
84
+ .edit-feature .field.type_richtext
83
85
  {
84
86
  width: 710px;
85
87
  margin: 0 auto;
86
88
  }
87
89
 
88
- .field.type_textarea .label_wrap,
89
- .field.type_richtext .label_wrap
90
+ .create-feature .field.type_textarea .label_wrap,
91
+ .create-feature .field.type_richtext .label_wrap,
92
+ .edit-feature .field.type_textarea .label_wrap,
93
+ .edit-feature .field.type_richtext .label_wrap
90
94
  {
91
95
  float: none;
92
96
  text-align: left;
93
97
  width: auto;
94
98
  }
95
- .field.type_textarea .value,
96
- .field.type_richtext .value
99
+ .create-feature .field.type_textarea .value,
100
+ .create-feature .field.type_richtext .value,
101
+ .edit-feature .field.type_textarea .value,
102
+ .edit-feature .field.type_richtext .value
97
103
  {
98
104
  margin-left: 0;
99
105
  padding-left: 0;
100
106
  }
101
- .field.type_textarea textarea,
102
- .field.type_richtext textarea
107
+ .create-feature .field.type_textarea textarea,
108
+ .create-feature .field.type_richtext textarea,
109
+ .edit-feature .field.type_textarea textarea,
110
+ .edit-feature .field.type_richtext textarea
103
111
  {
104
- min-width: 650px;
105
- <%# width: 100%; %>
112
+ min-width: 650px;
106
113
  -moz-box-sizing: border-box;
107
114
  box-sizing: border-box;
108
115
  }
@@ -226,6 +233,9 @@
226
233
 
227
234
 
228
235
 
236
+ .nested_wrap .add {
237
+ margin: 10px;
238
+ }
229
239
  .nested_wrap .item {
230
240
  position: relative;
231
241
  background-color: #F3F3F3;
@@ -240,6 +250,13 @@
240
250
  padding: 0;
241
251
  border: none;
242
252
  }
253
+ .nested_wrap .item .nested_wrap {
254
+ background-color: #ededed;
255
+ }
256
+ .nested_wrap .item .nested_wrap,
257
+ .nested_wrap .item .nested_wrap .item {
258
+ border: 1px dotted gray;
259
+ }
243
260
 
244
261
  .nested_wrap .field .label_wrap {
245
262
  width: auto;
@@ -249,9 +266,16 @@
249
266
  .nested_wrap .field .value {
250
267
  margin-left: 0;
251
268
  }
252
- .nested_wrap .field {
253
- border-bottom: 1px dotted #DDD;
254
- }
255
269
  .value_preview {
256
270
  padding: 5px;
257
271
  }
272
+ .nested_wrap .list > .resource
273
+ {
274
+ padding-top: 10px;
275
+ padding-bottom: 10px;
276
+ border-top: 1px dotted #DDD;
277
+ }
278
+ .nested_wrap .list > .resource:last-child
279
+ {
280
+ border-bottom: 1px dotted #DDD;
281
+ }