redde 0.0.8 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (166) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +4 -0
  3. data/.travis.yml +10 -0
  4. data/Gemfile +3 -3
  5. data/LICIENSE.md +21 -0
  6. data/README.md +53 -14
  7. data/lib/generators/redde/layout/layout_generator.rb +7 -4
  8. data/lib/generators/redde/layout/templates/assets/images/admin/error-label-triangle.png +0 -0
  9. data/lib/generators/redde/layout/templates/assets/images/admin/favicon.png +0 -0
  10. data/lib/generators/redde/layout/templates/assets/javascripts/admin.js +9 -76
  11. data/lib/generators/redde/layout/templates/assets/redactor/images/.keep +0 -0
  12. data/lib/generators/redde/layout/templates/assets/redactor/images/redactor/icons.png +0 -0
  13. data/lib/generators/redde/layout/templates/assets/redactor/javascripts/jquery-migrate-1.2.1.js +521 -0
  14. data/lib/generators/redde/layout/templates/assets/{images/admin → redactor/javascripts}/redactor/redactor.js.erb +9 -21
  15. data/lib/generators/redde/layout/templates/assets/{images/admin/redactor/css/redactor.css → redactor/stylesheets/redactor/redactor.css.scss} +1 -1
  16. data/lib/generators/redde/layout/templates/assets/stylesheets/admin/blocks/error-msg.sass +47 -0
  17. data/lib/generators/redde/layout/templates/assets/stylesheets/admin/blocks/paginate.sass +28 -0
  18. data/lib/generators/redde/layout/templates/assets/stylesheets/admin/blocks/pagination.scss +28 -0
  19. data/lib/generators/redde/layout/templates/assets/stylesheets/admin/blocks/phead-tabs.sass +27 -0
  20. data/lib/generators/redde/layout/templates/assets/stylesheets/admin/default.scss +0 -0
  21. data/lib/generators/redde/layout/templates/assets/stylesheets/admin/defaults/input.sass +35 -0
  22. data/lib/generators/redde/layout/templates/assets/stylesheets/admin/layouts/header.sass +50 -0
  23. data/lib/generators/redde/layout/templates/assets/stylesheets/admin/layouts/launchbar.sass +23 -0
  24. data/lib/generators/redde/layout/templates/assets/stylesheets/admin/layouts/main.sass +39 -0
  25. data/lib/generators/redde/layout/templates/assets/stylesheets/admin/layouts/page-header.sass +19 -0
  26. data/lib/generators/redde/layout/templates/assets/stylesheets/admin/layouts/page-sidebar.sass +22 -0
  27. data/lib/generators/redde/layout/templates/assets/stylesheets/admin/layouts/sidebar.sass +30 -0
  28. data/lib/generators/redde/layout/templates/assets/stylesheets/admin/reset.sass +33 -0
  29. data/lib/generators/redde/layout/templates/assets/stylesheets/admin.scss +9 -9
  30. data/lib/generators/redde/layout/templates/base/_header.html.haml +12 -0
  31. data/lib/generators/redde/layout/templates/base/_launchbar.html.haml +11 -0
  32. data/lib/generators/redde/layout/templates/base/_sidebar.html.haml +15 -0
  33. data/lib/generators/redde/layout/templates/base/_validate.haml +8 -0
  34. data/lib/generators/redde/layout/templates/base/welcome.haml +2 -0
  35. data/lib/generators/redde/layout/templates/controllers/base_controller.rb +5 -0
  36. data/lib/generators/redde/layout/templates/layouts/admin.html.haml +14 -15
  37. data/lib/generators/redde/scaffold/scaffold_generator.rb +8 -0
  38. data/lib/generators/redde/scaffold/templates/edit.html.haml +2 -6
  39. data/lib/generators/redde/scaffold/templates/index.html.haml +1 -1
  40. data/lib/redde/version.rb +1 -1
  41. data/lib/redde.rb +3 -0
  42. data/redde.gemspec +11 -10
  43. data/spec/dummy/.rspec +1 -0
  44. data/spec/dummy/README.rdoc +28 -0
  45. data/spec/dummy/Rakefile +6 -0
  46. data/spec/dummy/app/assets/images/.keep +0 -0
  47. data/spec/dummy/app/assets/javascripts/application.js +14 -0
  48. data/spec/dummy/app/assets/stylesheets/application.css.scss +0 -0
  49. data/spec/dummy/app/controllers/application_controller.rb +5 -0
  50. data/spec/dummy/app/controllers/articles_controller.rb +12 -0
  51. data/spec/dummy/app/models/.keep +0 -0
  52. data/spec/dummy/app/models/article.rb +3 -0
  53. data/spec/dummy/app/models/article_category.rb +2 -0
  54. data/spec/dummy/app/views/articles/show.html.haml +2 -0
  55. data/spec/dummy/app/views/layouts/application.html.erb +15 -0
  56. data/spec/dummy/bin/bundle +3 -0
  57. data/spec/dummy/bin/rails +4 -0
  58. data/spec/dummy/bin/rake +4 -0
  59. data/spec/dummy/config/application.rb +33 -0
  60. data/spec/dummy/config/boot.rb +5 -0
  61. data/spec/dummy/config/database.yml +25 -0
  62. data/spec/dummy/config/environment.rb +5 -0
  63. data/spec/dummy/config/environments/development.rb +29 -0
  64. data/spec/dummy/config/environments/production.rb +80 -0
  65. data/spec/dummy/config/environments/test.rb +36 -0
  66. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  67. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  68. data/spec/dummy/config/initializers/inflections.rb +16 -0
  69. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  70. data/spec/dummy/config/initializers/secret_token.rb +12 -0
  71. data/spec/dummy/config/initializers/session_store.rb +3 -0
  72. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  73. data/spec/dummy/config/locales/en.yml +36 -0
  74. data/spec/dummy/config/routes.rb +3 -0
  75. data/spec/dummy/config.ru +4 -0
  76. data/spec/dummy/db/development.sqlite3 +0 -0
  77. data/spec/dummy/db/migrate/20130908123351_create_articles.rb +9 -0
  78. data/spec/dummy/db/migrate/20140128152208_create_article_categories.rb +11 -0
  79. data/spec/dummy/db/schema.rb +29 -0
  80. data/spec/dummy/db/test.sqlite3 +0 -0
  81. data/spec/dummy/lib/assets/.keep +0 -0
  82. data/spec/dummy/log/.keep +0 -0
  83. data/spec/dummy/log/development.log +26606 -0
  84. data/spec/dummy/log/test.log +53411 -0
  85. data/spec/dummy/public/404.html +58 -0
  86. data/spec/dummy/public/422.html +58 -0
  87. data/spec/dummy/public/500.html +57 -0
  88. data/spec/dummy/public/favicon.ico +0 -0
  89. data/spec/{deploy_generator_spec.rb → generators/deploy_generator_spec.rb} +1 -1
  90. data/spec/{layout_generator_spec.rb → generators/layout_generator_spec.rb} +5 -5
  91. data/spec/generators/scaffold_generator_spec.rb +59 -0
  92. data/spec/spec_helper.rb +53 -4
  93. metadata +187 -155
  94. data/LICENSE +0 -22
  95. data/lib/generators/redde/layout/templates/assets/images/admin/redactor/css/docstyle.css +0 -123
  96. data/lib/generators/redde/layout/templates/assets/images/admin/redactor/css/style.css +0 -119
  97. data/lib/generators/redde/layout/templates/assets/images/admin/redactor/img/icons.png +0 -0
  98. data/lib/generators/redde/layout/templates/assets/images/admin/redactor/langs/by.js +0 -72
  99. data/lib/generators/redde/layout/templates/assets/images/admin/redactor/langs/de.js +0 -75
  100. data/lib/generators/redde/layout/templates/assets/images/admin/redactor/langs/es.js +0 -76
  101. data/lib/generators/redde/layout/templates/assets/images/admin/redactor/langs/fr.js +0 -74
  102. data/lib/generators/redde/layout/templates/assets/images/admin/redactor/langs/hu.js +0 -76
  103. data/lib/generators/redde/layout/templates/assets/images/admin/redactor/langs/it.js +0 -76
  104. data/lib/generators/redde/layout/templates/assets/images/admin/redactor/langs/ja.js +0 -76
  105. data/lib/generators/redde/layout/templates/assets/images/admin/redactor/langs/lv.js +0 -74
  106. data/lib/generators/redde/layout/templates/assets/images/admin/redactor/langs/nl.js +0 -76
  107. data/lib/generators/redde/layout/templates/assets/images/admin/redactor/langs/pl.js +0 -75
  108. data/lib/generators/redde/layout/templates/assets/images/admin/redactor/langs/pt_br.js +0 -81
  109. data/lib/generators/redde/layout/templates/assets/images/admin/redactor/langs/sq.js +0 -76
  110. data/lib/generators/redde/layout/templates/assets/images/admin/redactor/langs/tr.js +0 -76
  111. data/lib/generators/redde/layout/templates/assets/images/admin/redactor/langs/ua.js +0 -75
  112. data/lib/generators/redde/layout/templates/assets/images/admin/redactor/langs/zh_cn.js +0 -77
  113. data/lib/generators/redde/layout/templates/assets/images/admin/redactor/redactor.min.js +0 -1
  114. data/lib/generators/redde/layout/templates/assets/images/admin/redactor/toolbars/mini.js +0 -103
  115. data/lib/generators/redde/layout/templates/assets/images/admin/reddebox/_jquery.reddebox.js.erb +0 -214
  116. data/lib/generators/redde/layout/templates/assets/images/admin/reddebox/close.png +0 -0
  117. data/lib/generators/redde/layout/templates/assets/images/admin/reddebox/jquery.reddebox.js.erb +0 -246
  118. data/lib/generators/redde/layout/templates/assets/images/admin/reddebox/jquery.reddebox.scss +0 -31
  119. data/lib/generators/redde/layout/templates/assets/images/admin/reddebox/next.png +0 -0
  120. data/lib/generators/redde/layout/templates/assets/images/admin/reddebox/prev.png +0 -0
  121. data/lib/generators/redde/layout/templates/assets/images/admin/uploadifive/change-log.txt +0 -19
  122. data/lib/generators/redde/layout/templates/assets/images/admin/uploadifive/check-exists.php +0 -15
  123. data/lib/generators/redde/layout/templates/assets/images/admin/uploadifive/index.php +0 -50
  124. data/lib/generators/redde/layout/templates/assets/images/admin/uploadifive/jquery.uploadifive.js +0 -888
  125. data/lib/generators/redde/layout/templates/assets/images/admin/uploadifive/jquery.uploadifive.min.js +0 -6
  126. data/lib/generators/redde/layout/templates/assets/images/admin/uploadifive/license-standard.txt +0 -71
  127. data/lib/generators/redde/layout/templates/assets/images/admin/uploadifive/uploadifive-cancel.png +0 -0
  128. data/lib/generators/redde/layout/templates/assets/images/admin/uploadifive/uploadifive-image-only.php +0 -66
  129. data/lib/generators/redde/layout/templates/assets/images/admin/uploadifive/uploadifive.css +0 -100
  130. data/lib/generators/redde/layout/templates/assets/images/admin/uploadifive/uploadifive.php +0 -33
  131. data/lib/generators/redde/layout/templates/assets/images/admin/uploadify/#swfobject.js +0 -4
  132. data/lib/generators/redde/layout/templates/assets/images/admin/uploadify/cancel.png +0 -0
  133. data/lib/generators/redde/layout/templates/assets/images/admin/uploadify/jquery.uploadify.min.js +0 -315
  134. data/lib/generators/redde/layout/templates/assets/images/admin/uploadify/uploadify-cancel.png +0 -0
  135. data/lib/generators/redde/layout/templates/assets/images/admin/uploadify/uploadify.css +0 -66
  136. data/lib/generators/redde/layout/templates/assets/images/admin/uploadify/uploadify.swf +0 -0
  137. data/lib/generators/redde/layout/templates/assets/javascripts/admin/swfobject.js +0 -4
  138. data/lib/generators/redde/layout/templates/assets/javascripts/admin/zen_textarea.min.js +0 -17
  139. data/lib/generators/redde/layout/templates/assets/stylesheets/admin/_reset.scss +0 -32
  140. data/lib/generators/redde/layout/templates/assets/stylesheets/admin/defaults/_input.scss +0 -43
  141. data/lib/generators/redde/layout/templates/assets/stylesheets/admin/layouts/_header.scss +0 -57
  142. data/lib/generators/redde/layout/templates/assets/stylesheets/admin/layouts/_launchbar.scss +0 -35
  143. data/lib/generators/redde/layout/templates/assets/stylesheets/admin/layouts/_main.scss +0 -59
  144. data/lib/generators/redde/layout/templates/assets/stylesheets/admin/layouts/_sidebar.scss +0 -35
  145. data/lib/generators/redde/layout/templates/shared/_header.html.haml +0 -13
  146. data/lib/generators/redde/layout/templates/shared/_launchbar.html.haml +0 -9
  147. data/lib/generators/redde/layout/templates/shared/_sidebar.html.haml +0 -9
  148. data/spec/scaffold_generator_spec.rb +0 -25
  149. /data/lib/generators/redde/layout/templates/assets/{images/admin → redactor/images}/redactor/plugins/file.html +0 -0
  150. /data/lib/generators/redde/layout/templates/assets/{images/admin → redactor/images}/redactor/plugins/image.html +0 -0
  151. /data/lib/generators/redde/layout/templates/assets/{images/admin → redactor/images}/redactor/plugins/image_edit.html +0 -0
  152. /data/lib/generators/redde/layout/templates/assets/{images/admin → redactor/images}/redactor/plugins/link.html +0 -0
  153. /data/lib/generators/redde/layout/templates/assets/{images/admin → redactor/images}/redactor/plugins/table.html +0 -0
  154. /data/lib/generators/redde/layout/templates/assets/{images/admin → redactor/images}/redactor/plugins/video.html +0 -0
  155. /data/lib/generators/redde/layout/templates/assets/{images/admin → redactor/javascripts}/redactor/langs/en.js +0 -0
  156. /data/lib/generators/redde/layout/templates/assets/{images/admin → redactor/javascripts}/redactor/langs/ru.js +0 -0
  157. /data/lib/generators/redde/layout/templates/assets/{images/admin → redactor/javascripts}/redactor/toolbars/default.js +0 -0
  158. /data/lib/generators/redde/layout/templates/assets/{images/admin/redactor/css → redactor/stylesheets/redactor}/wym.css +0 -0
  159. /data/lib/generators/redde/layout/templates/assets/stylesheets/admin/blocks/{_list.scss → list.scss} +0 -0
  160. /data/lib/generators/redde/layout/templates/assets/stylesheets/admin/blocks/{_notice.scss → notice.scss} +0 -0
  161. /data/lib/generators/redde/layout/templates/assets/stylesheets/admin/blocks/{_orders.scss → orders.scss} +0 -0
  162. /data/lib/generators/redde/layout/templates/assets/stylesheets/admin/blocks/{_partners.scss → partners.scss} +0 -0
  163. /data/lib/generators/redde/layout/templates/assets/stylesheets/admin/blocks/{_photos.scss → photos.scss} +0 -0
  164. /data/lib/generators/redde/layout/templates/assets/stylesheets/admin/blocks/{_sortable.scss → sortable.scss} +0 -0
  165. /data/lib/generators/redde/layout/templates/assets/stylesheets/admin/defaults/{_table.scss → table.scss} +0 -0
  166. /data/lib/generators/redde/layout/templates/assets/stylesheets/admin/layouts/{_login.scss → login.scss} +0 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: cc3d7f424511a702d9e9bf16a094083f3ebefd8e
4
+ data.tar.gz: ecc04dd48b7cb5f90b05019174078e9deb83ff1a
5
+ SHA512:
6
+ metadata.gz: bdb1a73599c050b7321d6100e631a7b9419c02de0dbeab87e2013449359e2c4b720c764e6828155e5f9d94eba9ae7bd4b502f28ac5f3fa93482e482d51649206
7
+ data.tar.gz: ae25347849265d4e437814c42b88a0997cf253bbaa685424fb914064d5e6cdfb3c646e9d28d0dfb5e6a5ee7038f48c8aacbcbad4892a568c5d011b133dbfaa5e
data/.gitignore CHANGED
@@ -18,3 +18,7 @@ tmp
18
18
  *.DS_Store
19
19
  .rvmrc
20
20
  .powrc
21
+
22
+ /spec/dummy/public/uploads
23
+ /spec/dummy/log
24
+ /spec/dummy/db/*sqlite3
data/.travis.yml ADDED
@@ -0,0 +1,10 @@
1
+ script: rspec
2
+ language: ruby
3
+ notifications:
4
+ email: false
5
+ rvm:
6
+ - 1.9.3
7
+ - 2.0.0
8
+ - 2.1.0
9
+ before_script:
10
+ - "cd spec/dummy; rake db:setup RAILS_ENV=test"
data/Gemfile CHANGED
@@ -1,8 +1,8 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in redde.gemspec
4
- gem "compass-rails", "~> 2.0.alpha.0"
5
- gem "jquery-rails"
6
- gem "jquery-ui-rails"
4
+ gem 'russian', '>= 0.6.0'
5
+ gem 'haml'
6
+ gem 'compass-rails'
7
7
 
8
8
  gemspec
data/LICIENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) [2013] [redde]
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md CHANGED
@@ -1,12 +1,14 @@
1
1
  # Redde
2
+ [![Build Status](https://secure.travis-ci.org/redde/redde.png)](http://travis-ci.org/redde/redde)
3
+ [![Code Climate](https://codeclimate.com/github/redde/redde.png)](https://codeclimate.com/github/redde/redde)
2
4
 
3
- Redde admin generator
5
+ Admin generator for redde projects
4
6
 
5
7
  ## Installation
6
8
 
7
9
  Add this line to your application's Gemfile:
8
10
 
9
- gem 'redde', :group => :development
11
+ gem 'redde'
10
12
 
11
13
  And then execute:
12
14
 
@@ -34,24 +36,61 @@ To set admin login layout you need to modify application controller:
34
36
  end
35
37
  end
36
38
 
37
- To generate admin views and controller for model type:
39
+ To generate admin views and controller for a model, enter:
38
40
 
39
41
  rails g redde:scaffold ModelNames
40
42
 
41
- Add to your config/prodcution.rb these files: admin.scss and admin.js
43
+ Add `admin.scss` and `admin.js` to assets precompilation in config/production.rb:
42
44
 
43
45
  config.assets.precompile += %w( admin.js admin.css )
46
+
47
+ ## Gemset dependenсies
48
+
49
+ Somehow, some dependencies are not initialized inside rails apps. If you get error about missing gems, add these gems to your Gemfile:
50
+
51
+ gem 'autoprefixer-rails'
52
+ gem 'jquery-ui-rails'
53
+ gem 'haml-rails'
54
+ gem 'russian'
55
+ gem 'devise'
56
+
57
+ Its highly possible, that you will not have any problems with gems
58
+
59
+ ## Autoprefixer note for development mode
60
+
61
+ Its neccessary to have joined asset files, change assets debug to false in `config/environments/development.rb`:
62
+
63
+ config.assets.debug = false
64
+
65
+ ## Localization's example
66
+
67
+ ru:
68
+ activerecord:
69
+ models:
70
+ product:
71
+ one: Продукт
72
+ acc: продукт (винительный падеж)
73
+ other: Продукты
74
+ attributes:
75
+ product:
76
+ name: Название
77
+ descr: Описание
78
+
79
+ ## WYSIWYG editor note
80
+
81
+ To use styles for the WYSIWYG editor, add its styles to precompile in `config/production.rb`:
82
+
83
+ config.assets.precompile += %w( redactor/wym.css )
44
84
 
45
- ## Options
46
- If you have these fields in your model:
85
+ ## Sortable
86
+
87
+ If you have field `position` of integer type in your model, generator will add special column as a hook for sort.
88
+ You should add POST `sort` action to you routes:
47
89
 
48
- * `visible:boolean` for toggle option
49
- * `position:integer` for sortable option
90
+ resources :article_categories do
91
+ post 'sort', on: :collection
92
+ end
50
93
 
51
- ## Contributing
94
+ ## Visible
52
95
 
53
- 1. Fork it
54
- 2. Create your feature branch (`git checkout -b my-new-feature`)
55
- 3. Commit your changes (`git commit -am 'Added some feature'`)
56
- 4. Push to the branch (`git push origin my-new-feature`)
57
- 5. Create new Pull Request
96
+ If you have field `visible` of boolean type in your model, generator will add small eye column for toggling visiblity
@@ -15,10 +15,8 @@ module Redde
15
15
  template "layouts/#{layout}#{ext}", "app/views/layouts/#{layout}#{ext}"
16
16
  end
17
17
 
18
- # copy shared
19
- %w{ header launchbar sidebar }.each do |shared|
20
- template "shared/_#{shared}#{ext}", "app/views/admin/shared/_#{shared}#{ext}"
21
- end
18
+ # copy base
19
+ directory "base", "app/views/admin/base"
22
20
 
23
21
  # copy js
24
22
  %w{ admin.js }.each do |js|
@@ -32,6 +30,11 @@ module Redde
32
30
  end
33
31
  directory "assets/stylesheets/admin", "app/assets/stylesheets/admin"
34
32
 
33
+ # copy redactor
34
+
35
+ directory "assets/redactor", "app/assets"
36
+
37
+
35
38
  # copy helpers
36
39
  template "helpers/admin_helper.rb", "app/helpers/admin_helper.rb"
37
40
 
@@ -1,88 +1,21 @@
1
- // This is a manifest file that'll be compiled into including all the files listed below.
2
- // Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
3
- // be included in the compiled file accessible from http://example.com/assets/application.js
4
- // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
5
- // the compiled file.
6
- //
7
1
  //= require jquery
8
2
  //= require jquery_ujs
9
- //= require jquery.ui.all
10
- //= require admin/swfobject
11
- //= require admin/uploadify/jquery.uploadify.min
12
- //= require admin/uploadifive/jquery.uploadifive
13
3
  //= require admin/lightbox/js/jquery.lightbox-0.5
14
- //= require admin/jquery.ui.nestedSortable
15
- //= require admin/zen_textarea.min
16
- //= require admin/redactor/redactor
17
- //= require admin/redactor/langs/ru
18
- //= require admin/redactor/toolbars/default
19
4
 
20
- function goTo(event,url) {
21
- if (!$(event.target).hasClass("dont-move")) {
22
- window.location = url;
23
- };
24
- };
5
+ //= require jquery-migrate-1.2.1
6
+ //= require redactor/redactor
7
+ //= require redactor/langs/ru
8
+ //= require redactor/toolbars/default
25
9
 
26
- var lightBox;
27
-
28
- function remove_fields(link) {
29
- $(link).prev("input[type=hidden]").val("1");
30
- $(link).closest("div").hide();
31
- }
32
-
33
- function remove_fields_gal(link) {
34
- $(link).prev("input[type=hidden]").val("1");
35
- hideElem($(link).closest("tr"));
36
- function hideElem(el) {
37
- el.hide();
38
- el.hasClass("bot") ? el.hide() : hideElem(el.next("tr"));
39
- };
40
- }
41
-
42
- function add_fields(link, association, content) {
43
- var new_id = new Date().getTime();
44
- var regexp = new RegExp("new_" + association, "g")
45
- var innerPrint = $(link).before(content.replace(regexp, new_id));
46
- }
47
-
48
- function add_fields_gal(link, association, content) {
49
- var new_id = new Date().getTime();
50
- var regexp = new RegExp("new_" + association, "g")
51
- var innerPrint = $(link).closest("tfoot").prev("tbody").append(content.replace(regexp, new_id));
52
- }
10
+ //= require jquery.ui.sortable
11
+ //=# require admin/jquery.ui.nestedSortable
53
12
 
54
- function selectCheckbox(el) {
55
- el.checked ? $(el).closest("tr").addClass("selected") : $(el).closest("tr").removeClass("selected");
56
- }
57
-
58
- function selectLang(el) {
59
- var show_lang = el.removeClass("selected").attr("class");
60
- $("tr, tbody").filter("."+show_lang).show();
61
- var hide_lang = el.siblings("a").removeClass("selected").attr("class");
62
- $("tr, tbody").filter("."+hide_lang).hide();
63
- el.addClass("selected");
64
- }
13
+ var lightBox;
65
14
 
66
15
  $(function(){
67
-
68
- $("#onchange-submit").find("select, input").change(function(){
69
- $(this).closest("form").submit();
70
- });
71
-
16
+
72
17
  lightBox = $("ul.photos:not(.no-lb) a:not(.del)").lightBox();
73
18
 
74
- $('textarea:not(.nowred)').redactor({
75
- path: '/assets/redactor',
76
- load: false
77
- });
78
-
79
- setTimeout(function(){
80
- selectLang($("tr.lang").find("a.selected"));
81
- }, 500);
82
- ;
83
- $('a.ru_lang, a.en_lang').click(function(e) {
84
- selectLang($(this));
85
- e.preventDefault();
86
- });
19
+ $('textarea:not(.nowred)').redactor();
87
20
 
88
21
  });